@jiaozhiye/qm-design-react 1.11.26 → 1.12.1

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/lib/index.esm.js CHANGED
@@ -1 +1 @@
1
- import*as e from"react";import t,{createContext as n,version as r,isValidElement as i,useRef as l,useLayoutEffect as a,useEffect as o,useState as s,useCallback as c,Component as d,forwardRef as u,useImperativeHandle as m}from"react";import h from"dayjs";import"dayjs/locale/zh-cn";import p from"dayjs/plugin/localeData";import f from"dayjs/plugin/advancedFormat";import g from"dayjs/plugin/customParseFormat";import v from"dayjs/plugin/quarterOfYear";import y from"dayjs/plugin/weekOfYear";import b from"dayjs/plugin/weekday";import{ConfigProvider as x,Button as E,Tooltip as w,Popconfirm as C,Space as S,Empty as N,Spin as T,Upload as I,message as R,Input as O,Tabs as k,Drawer as L,Modal as A,Form as P,Row as _,Col as F,Select as D,Checkbox as M,Dropdown as H,InputNumber as $,Divider as q,Radio as j,Menu as K,Popover as V,Tree as z,Switch as W,Pagination as B,Rate as U,Tag as G,TreeSelect as Y,Cascader as X,Image as Q,notification as Z,Slider as J}from"antd";export{Affix,Alert,Anchor,AutoComplete,Avatar,BackTop,Badge,Breadcrumb,Button,Card,Carousel,Cascader,Checkbox,Col,Collapse,Comment,ConfigProvider,Descriptions,Divider,Drawer,Dropdown,Empty,Form,Grid,Image,Input,InputNumber,Layout,List,Mentions,Menu,Modal,PageHeader,Pagination,Popconfirm,Popover,Progress,Radio,Rate,Result,Row,Segmented,Select,Skeleton,Slider,Space,Spin,Statistic,Steps,Switch,Table,Tabs,Tag,Timeline,Tooltip,Transfer,Tree,TreeSelect,Typography,Upload,message,notification}from"antd";import ee from"dayjs/plugin/weekYear";import te from"antd/es/calendar/generateCalendar";import ne from"antd/es/date-picker/generatePicker";import re from"antd/es/locale/zh_CN";import ie from"antd/es/locale/en_GB";import{isArray as le,isPlainObject as ae,isNumber as oe,isFunction as se,isString as ce,isUndefined as de,get as ue,transform as me,isEqual as he,set as pe,xor as fe,isRegExp as ge,intersection as ve,map as ye,groupBy as be,flatten as xe,spread as Ee,mergeWith as we,isDate as Ce,sumBy as Se,maxBy as Ne,minBy as Te,merge as Ie,union as Re,pickBy as Oe,uniqBy as ke,debounce as Le,throttle as Ae}from"lodash-es";import Pe from"classnames";import{UpOutlined as _e,DownOutlined as Fe,UploadOutlined as De,LinkOutlined as Me,EditOutlined as He,CheckOutlined as $e,EyeOutlined as qe,DownloadOutlined as je,DeleteOutlined as Ke,FullscreenExitOutlined as Ve,FullscreenOutlined as ze,UnorderedListOutlined as We,HolderOutlined as Be,InfoCircleFilled as Ue,ReloadOutlined as Ge,PrinterOutlined as Ye,ImportOutlined as Xe,SettingOutlined as Qe,CopyOutlined as Ze,CheckSquareOutlined as Je,CloseCircleOutlined as et,MonitorOutlined as tt,FolderOpenOutlined as nt,PlusOutlined as rt,CloseOutlined as it,FilterOutlined as lt,SortAscendingOutlined as at,LeftOutlined as ot,RightOutlined as st,EyeInvisibleOutlined as ct,ColumnHeightOutlined as dt,FolderOutlined as ut,BarsOutlined as mt,SaveOutlined as ht,InfoCircleOutlined as pt,BgColorsOutlined as ft,CaretDownOutlined as gt,ExpandAltOutlined as vt,CaretRightOutlined as yt,LineChartOutlined as bt,PieChartOutlined as xt,FunnelPlotOutlined as Et,AppstoreAddOutlined as wt,StepBackwardOutlined as Ct,StepForwardOutlined as St,SearchOutlined as Nt,ClearOutlined as Tt,ZoomInOutlined as It,ZoomOutOutlined as Rt,RotateRightOutlined as Ot,RotateLeftOutlined as kt,InboxOutlined as Lt,ExclamationCircleOutlined as At,PauseOutlined as Pt,QuestionCircleOutlined as _t,MenuOutlined as Ft,BorderOutlined as Dt}from"@ant-design/icons";import Mt,{flushSync as Ht}from"react-dom";import $t from"react-countup";import qt from"resize-observer-polyfill";import jt from"sortablejs";import Kt from"add-dom-event-listener";import Vt from"scroll-into-view-if-needed";import zt from"react-draggable";import Wt from"memoize-one";import*as Bt from"prop-types";import Ut from"prop-types";import{ReactSortable as Gt}from"react-sortablejs";import Yt from"big.js";import Xt from"exceljs";import Qt from"localforage";import Zt from"@rc-component/trigger";import Jt,{ColorBlock as en}from"@rc-component/color-picker";import tn from"@rc-component/portal";import nn from"copy-to-clipboard";import rn from"china-area-data";import ln from"cropperjs";import an from"html2canvas";const on=n({locale:"zh-cn",size:"middle"});var sn={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"过滤{text}",searchAreaText:"过滤{text},用逗号隔开",text:"筛选",selectAll:"全选",invert:"反选",onlyItem:"仅此项",keywordSearch:"关键词搜索"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",nullText:"空值",notNullText:"非空值",startsWithText:"开头是",endsWithText:"结尾是",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",matchCase:"大小写匹配",matchFullchar:"全字符匹配",queryLabel:"查找内容",queryPrev:"查找上一个",queryNext:"查找下一个",queryAll:"查找全部",findTotal:"查找到 {total} 个单元格",cellText:"单元格",valText:"值"},pivotGrid:{text:"多维表",settingTitle:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行",col:"整列"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};let cn=sn;function dn(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const un=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let l=cn;for(let e=0,t=i.length;e<t;e++){if(r=l[i[e]],e===t-1)return dn(r,n);if(!r)return"";l=r}return""},mn=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})),hn=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function pn(e,t){hn((t=>{if(!t)return e()}),t)}h.extend(p),h.extend(f),h.extend(g),h.extend(v),h.extend(y),h.extend(b);var fn={},gn=[];function vn(e,t){if(!e&&void 0!==console){var n=gn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function yn(e,t){if(!e&&void 0!==console){var n=gn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function bn(e,t,n){t||fn[n]||(e(!1,n),fn[n]=!0)}function xn(e,t){bn(vn,e,t)}function En(e,t){bn(yn,e,t)}xn.preMessage=function(e){gn.push(e)},xn.resetWarned=function(){fn={}},xn.noteOnce=En,h.extend(g),h.extend(f),h.extend(b),h.extend(p),h.extend(y),h.extend(ee),h.extend((function(e,t){var n=t.prototype,r=n.format;n.format=function(e){var t=(e||"").replace("Wo","wo");return r.bind(this)(t)}}));var wn={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},Cn=function(e){return wn[e]||e.split("_")[0]},Sn=function(){En(!1,"Not match any format. Please help to fire a issue about this.")},Nn={getNow:function(){return h()},getFixedDate:function(e){return h(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var t=e.locale("en");return t.weekday()+t.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},addYear:function(e,t){return e.add(t,"year")},addMonth:function(e,t){return e.add(t,"month")},addDate:function(e,t){return e.add(t,"day")},setYear:function(e,t){return e.year(t)},setMonth:function(e,t){return e.month(t)},setDate:function(e,t){return e.date(t)},setHour:function(e,t){return e.hour(t)},setMinute:function(e,t){return e.minute(t)},setSecond:function(e,t){return e.second(t)},isAfter:function(e,t){return e.isAfter(t)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return h().locale(Cn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(Cn(e)).weekday(0)},getWeek:function(e,t){return t.locale(Cn(e)).week()},getShortWeekDays:function(e){return h().locale(Cn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return h().locale(Cn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(Cn(e)).format(n)},parse:function(e,t,n){for(var r=Cn(e),i=0;i<n.length;i+=1){var l=n[i],a=t;if(l.includes("wo")||l.includes("Wo")){for(var o=a.split("-")[0],s=a.split("-")[1],c=h(o,"YYYY").startOf("year").locale(r),d=0;d<=52;d+=1){var u=c.add(d,"week");if(u.format("Wo")===s)return u}return Sn(),null}var m=h(a,l).locale(r);if(m.isValid())return m}return t&&Sn(),null}}};const Tn=te(Nn),In=ne(Nn);function Rn(){return Rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rn.apply(null,arguments)}const On=e.forwardRef(((t,n)=>e.createElement(In,Rn({},t,{picker:"time",mode:void 0,ref:n}))));On.displayName="TimePicker";const kn=e.forwardRef(((t,n)=>e.createElement(In.RangePicker,Rn({},t,{picker:"time",mode:void 0,ref:n}))));kn.displayName="RangePicker",On.RangePicker=kn;var Ln={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Filter {text}",searchAreaText:"Filter {text}, separated by commas",text:"Filter",selectAll:"Select all",invert:"Invert",onlyItem:"Only item",keywordSearch:"Keyword Search"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel Merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",nullText:"null value",notNullText:"not null value",startsWithText:"beginning is",endsWithText:"ending is",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",matchCase:"Case matching",matchFullchar:"Full character matching",queryLabel:"Find content",queryPrev:"Find previous",queryNext:"Find next",queryAll:"Find all",findTotal:"Found {total} cells",cellText:"Cell",valText:"Value"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row",col:"Col"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}};const An={[Ln.name]:{qm:Ln,antd:ie},[sn.name]:{qm:sn,antd:re}},Pn=e=>{const n=mn({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:l}=n;t.useMemo((()=>{return e=Object.assign({},An,null==l?void 0:l.langPackage)[r].qm,cn=e||cn,void(cn.name&&h.locale(cn.name));var e}),[r]);const a=t.useMemo((()=>Object.assign({},An,null==l?void 0:l.langPackage)),[l]),[o,s]=t.useState({locale:r,size:i,global:l});return pn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(on.Provider,{value:o},t.createElement(x,{locale:a[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==l?void 0:l.autoInsertSpaceInButton},n.children))};function _n(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function Fn(e,t,n,r){var i,l=arguments.length,a=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(l<3?i(a):l>3?i(t,n,a):i(t,n))||a);return l>3&&a&&Object.defineProperty(t,n,a),a}function Dn(e,t,n,r){return new(n||(n=Promise))((function(i,l){function a(e){try{s(r.next(e))}catch(e){l(e)}}function o(e){try{s(r.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}s((r=r.apply(e,t||[])).next())}))}function Mn(){const{locale:t}=e.useContext(on);return{t:un,$locale:t}}function Hn(t){const n=e.useRef();n.current=t;return e.useCallback(((...e)=>{var t;return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function $n(t){const{size:n}=e.useContext(on);return{$size:e.useMemo((()=>{var e,r;return null!==(r=null!==(e=t.size)&&void 0!==e?e:n)&&void 0!==r?r:""}),[t.size,n])}}Pn.displayName="QmConfigProvider";var qn="undefined"==typeof window;const jn=e=>t.isValidElement(e),Kn=e=>jn(e)&&e.type===t.Fragment,Vn=()=>{},zn=()=>!0,Wn=e=>Dn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Bn=e=>{Promise.resolve().then(e)},Un=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),Gn=e=>!!(!e&&0!==e||le(e)&&!e.length||ae(e)&&!Object.keys(e).length),Yn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Xn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Qn=(e,t=new WeakMap)=>{if(ae(e)||le(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const i=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(i||e,((n,l)=>{i&&(l=n),r[l]=Qn(e[l],t)})),r}return e},Zn=e=>oe(e)?`${e}px`:e.toString();class Jn extends Error{constructor(e){super(e),this.name="QmDesignError"}}function er(e,t){throw new Jn(`[${e}] ${t}`)}function tr(e,t){console.warn(new Jn(`[${e}] ${t}`))}const nr=e=>{const{loading:n,shortcutKey:r,authConfig:i,click:l,confirm:a}=e,{t:o}=Mn(),{$size:s}=$n(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=Hn((e=>{var t;const n=r.split("+").map((e=>e.trim().toLowerCase())),i=n.includes("alt"),l=n.includes("ctrl"),a=n.includes("shift"),o=n[n.length-1];i&&!e.altKey||l&&!e.ctrlKey||a&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),h.disabled||null===(t=h.onClick)||void 0===t||t.call(h,e))})),m=se(l)?{onClick:t=>Dn(void 0,void 0,void 0,(function*(){var n;d(!0);try{yield null===(n=e.click)||void 0===n?void 0:n.call(e,t)}catch(e){tr("Button","`click`方法执行出错")}d(!1)}))}:null,h=Object.assign(Object.assign(Object.assign({},Xn(e,["shortcutKey","authConfig","click","confirm"])),{size:s,loading:c||n||!1}),m);if(i){const{visible:e=1,disabled:t}=i||{};if(!e)return null;t&&(h.disabled=!0)}const p=t.createElement(E,h,e.children);return a?t.createElement(C,{title:a.title||o("qm.button.confirmTitle"),disabled:h.disabled,onConfirm:e=>{var t,n;null===(t=a.onConfirm)||void 0===t||t.call(a),null===(n=h.onClick)||void 0===n||n.call(h,e)},onCancel:e=>{var t;null===(t=a.onCancel)||void 0===t||t.call(a,e)}},t.createElement(E,Rn({},h,{onClick:Vn}),e.children)):!r||h.disabled?p:t.createElement(w,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},p)};var rr;nr.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(rr||(rr={}));const ir=e=>{const{$size:n}=$n(e),r=oe(e.size)?e.size:rr[n||"default"],i=Object.assign(Object.assign({},Xn(e,["size"])),{size:r});return t.createElement(S,i,e.children)};ir.displayName="QmSpace";const lr=e=>`qm-${e}`,ar=e=>{const{label:n,extra:r,collapse:i,bordered:l=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=$n(e),{t:m}=Mn(),h=lr("divider"),p={[h]:!0,[`${h}-borderless`]:!l,[`${h}--lg`]:"large"===u,[`${h}--sm`]:"small"===u};return t.createElement("div",{id:o,className:Pe(p,s),style:c},t.createElement("span",{className:`${h}__title`},n),t.createElement("div",{className:`${h}__extra`},r),void 0!==i&&t.createElement(E,{type:"link",className:`${h}__collapse`,disabled:a,onClick:()=>{null==d||d(!i)}},m(i?"qm.divider.collect":"qm.divider.spread"),i?t.createElement(_e,null):t.createElement(Fe,null)))};ar.displayName="QmDivider";const or=()=>({height:0,opacity:0}),sr=e=>({height:e.scrollHeight,opacity:1}),cr=e=>({height:e?e.offsetHeight:0}),dr=(e,t)=>!0===(null==t?void 0:t.deadline)||"height"===t.propertyName;function ur(e){return ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ur(e)}function mr(e){var t=function(e,t){if("object"!==ur(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ur(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ur(t)?t:String(t)}function hr(e,t,n){return(t=mr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pr(Object(n),!0).forEach((function(t){hr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,l,a,o=[],s=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=l.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yr(e){return e instanceof HTMLElement||e instanceof SVGElement}function br(e){var n,r=function(e){return e&&"object"===ur(e)&&yr(e.nativeElement)?e.nativeElement:yr(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Mt.findDOMNode)||void 0===n?void 0:n.call(Mt,e):null)}var xr,Er={exports:{}},wr={};Er.exports=(xr||(xr=1,function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var f=e.type;switch(f){case r:case l:case i:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case o:case c:case h:case m:case a:return g;default:return p}}case n:return p}}}e=Symbol.for("react.module.reference");var g=o,v=a,y=t,b=c,x=r,E=h,w=m,C=n,S=l,N=i,T=d,I=u,R=!1,O=!1;wr.ContextConsumer=g,wr.ContextProvider=v,wr.Element=y,wr.ForwardRef=b,wr.Fragment=x,wr.Lazy=E,wr.Memo=w,wr.Portal=C,wr.Profiler=S,wr.StrictMode=N,wr.Suspense=T,wr.SuspenseList=I,wr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},wr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},wr.isContextConsumer=function(e){return f(e)===o},wr.isContextProvider=function(e){return f(e)===a},wr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},wr.isForwardRef=function(e){return f(e)===c},wr.isFragment=function(e){return f(e)===r},wr.isLazy=function(e){return f(e)===h},wr.isMemo=function(e){return f(e)===m},wr.isPortal=function(e){return f(e)===n},wr.isProfiler=function(e){return f(e)===l},wr.isStrictMode=function(e){return f(e)===i},wr.isSuspense=function(e){return f(e)===d},wr.isSuspenseList=function(e){return f(e)===u},wr.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===l||t===i||t===d||t===u||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===m||t.$$typeof===a||t.$$typeof===o||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},wr.typeOf=f}()),wr);var Cr=function(e,t){"function"==typeof e?e(t):"object"===ur(e)&&e&&"current"in e&&(e.current=t)},Sr=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);return r.length<=1?r[0]:function(e){t.forEach((function(t){Cr(t,e)}))}},Nr=function(e){var t,n,r=Er.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===Er.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===Er.exports.ForwardRef)};function Tr(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}Number(r.split(".")[0]);var Ir=e.createContext({});function Rr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Or(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mr(r.key),r)}}function kr(e,t,n){return t&&Or(e.prototype,t),n&&Or(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lr(e,t){return Lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Lr(e,t)}function Ar(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lr(e,t)}function Pr(e){return Pr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pr(e)}function _r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Pr(e);if(t){var i=Pr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===ur(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _r(e)}(this,n)}}var Dr=function(t){Ar(r,e.Component);var n=Fr(r);function r(){return Rr(this,r),n.apply(this,arguments)}return kr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function Mr(t){var n=e.useRef(!1),r=vr(e.useState(t),2),i=r[0],l=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[i,function(e,t){t&&n.current||l(e)}]}var Hr="none",$r="appear",qr="enter",jr="leave",Kr="none",Vr="prepare",zr="start",Wr="active",Br="end",Ur="prepared";function Gr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Yr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var Xr,Qr,Zr,Jr=(Xr=Gr(),Qr="undefined"!=typeof window?window:{},Zr={animationend:Yr("Animation","AnimationEnd"),transitionend:Yr("Transition","TransitionEnd")},Xr&&("AnimationEvent"in Qr||delete Zr.animationend.animation,"TransitionEvent"in Qr||delete Zr.transitionend.transition),Zr),ei={};if(Gr()){var ti=document.createElement("div");ei=ti.style}var ni={};function ri(e){if(ni[e])return ni[e];var t=Jr[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var l=n[i];if(Object.prototype.hasOwnProperty.call(t,l)&&l in ei)return ni[e]=t[l],ni[e]}return""}var ii=ri("animationend"),li=ri("transitionend"),ai=!(!ii||!li),oi=ii||"animationend",si=li||"transitionend";function ci(e,t){return e?"object"===ur(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var di=function(t){var n=l(),r=l(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function a(e){e&&(e.removeEventListener(si,i),e.removeEventListener(oi,i))}return e.useEffect((function(){return function(){a(n.current)}}),[]),[function(e){n.current&&n.current!==e&&a(n.current),e&&e!==n.current&&(e.addEventListener(si,i),e.addEventListener(oi,i),n.current=e)},a]},ui=Gr()?a:o,mi=function(e){return+setTimeout(e,16)},hi=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(mi=function(e){return window.requestAnimationFrame(e)},hi=function(e){return window.cancelAnimationFrame(e)});var pi=0,fi=new Map;function gi(e){fi.delete(e)}var vi=function(e){var t=pi+=1;return function n(r){if(0===r)gi(t),e();else{var i=mi((function(){n(r-1)}));fi.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};vi.cancel=function(e){var t=fi.get(e);return gi(e),hi(t)},vi.ids=function(){return fi};var yi=[Vr,zr,Wr,Br],bi=[Vr,Ur],xi=!1,Ei=!0;function wi(e){return e===Wr||e===Br}var Ci=function(t,n,r){var i=vr(Mr(Kr),2),l=i[0],a=i[1],o=function(){var t=e.useRef(null);function n(){vi.cancel(t.current)}return e.useEffect((function(){return function(){n()}}),[]),[function e(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;n();var l=vi((function(){i<=1?r({isCanceled:function(){return l!==t.current}}):e(r,i-1)}));t.current=l},n]}(),s=vr(o,2),c=s[0],d=s[1];var u=n?bi:yi;return ui((function(){if(l!==Kr&&l!==Br){var e=u.indexOf(l),t=u[e+1],n=r(l);n===xi?a(t,!0):t&&c((function(e){function r(){e.isCanceled()||a(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,l]),e.useEffect((function(){return function(){d()}}),[]),[function(){a(Vr,!0)},l]};var Si=function(t){var n=t;"object"===ur(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,a=void 0===i||i,s=t.removeOnLeave,c=void 0===s||s,d=t.forceRender,u=t.children,m=t.motionName,h=t.leavedClassName,p=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(Ir).motion),g=l(),v=l();var y=function(t,n,r,i){var a=i.motionEnter,s=void 0===a||a,c=i.motionAppear,d=void 0===c||c,u=i.motionLeave,m=void 0===u||u,h=i.motionDeadline,p=i.motionLeaveImmediately,f=i.onAppearPrepare,g=i.onEnterPrepare,v=i.onLeavePrepare,y=i.onAppearStart,b=i.onEnterStart,x=i.onLeaveStart,E=i.onAppearActive,w=i.onEnterActive,C=i.onLeaveActive,S=i.onAppearEnd,N=i.onEnterEnd,T=i.onLeaveEnd,I=i.onVisibleChanged,R=vr(Mr(),2),O=R[0],k=R[1],L=vr(Mr(Hr),2),A=L[0],P=L[1],_=vr(Mr(null),2),F=_[0],D=_[1],M=l(!1),H=l(null);function $(){return r()}var q=l(!1);function j(){P(Hr,!0),D(null,!0)}function K(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=q.current;A===$r&&r?n=null==S?void 0:S(t,e):A===qr&&r?n=null==N?void 0:N(t,e):A===jr&&r&&(n=null==T?void 0:T(t,e)),A!==Hr&&r&&!1!==n&&j()}}var V=vr(di(K),1)[0],z=function(e){var t,n,r;switch(e){case $r:return hr(t={},Vr,f),hr(t,zr,y),hr(t,Wr,E),t;case qr:return hr(n={},Vr,g),hr(n,zr,b),hr(n,Wr,w),n;case jr:return hr(r={},Vr,v),hr(r,zr,x),hr(r,Wr,C),r;default:return{}}},W=e.useMemo((function(){return z(A)}),[A]),B=vr(Ci(A,!t,(function(e){if(e===Vr){var t=W[Vr];return t?t($()):xi}var n;return G in W&&D((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===Wr&&(V($()),h>0&&(clearTimeout(H.current),H.current=setTimeout((function(){K({deadline:!0})}),h))),G===Ur&&j(),Ei})),2),U=B[0],G=B[1],Y=wi(G);q.current=Y,ui((function(){k(n);var e,r=M.current;M.current=!0,!r&&n&&d&&(e=$r),r&&n&&s&&(e=qr),(r&&!n&&m||!r&&p&&!n&&m)&&(e=jr);var i=z(e);e&&(t||i[Vr])?(P(e),U()):P(Hr)}),[n]),o((function(){(A===$r&&!d||A===qr&&!s||A===jr&&!m)&&P(Hr)}),[d,s,m]),o((function(){return function(){M.current=!1,clearTimeout(H.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===Hr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=F;return W[Vr]&&G===zr&&(Q=fr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:br(v.current)}catch(e){return null}}),t),b=vr(y,4),x=b[0],E=b[1],w=b[2],C=b[3],S=e.useRef(C);C&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,Cr(r,e)}),[r]),I=fr(fr({},p),{},{visible:a});if(u)if(x===Hr)N=C?u(fr({},I),T):!c&&S.current&&h?u(fr(fr({},I),{},{className:h}),T):d||!c&&!h?u(fr(fr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Vr?O="prepare":wi(E)?O="active":E===zr&&(O="start");var k=ci(m,"".concat(x,"-").concat(O));N=u(fr(fr({},I),{},{className:Pe(ci(m,x),(R={},hr(R,k,k&&O),hr(R,m,"string"==typeof m),R)),style:w}),T)}else N=null;e.isValidElement(N)&&Nr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Dr,{ref:v},N)}));return r.displayName="CSSMotion",r}(ai);function Ni(){return Ni=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ni.apply(this,arguments)}var Ti="add",Ii="keep",Ri="remove",Oi="removed";function ki(e){var t;return fr(fr({},t=e&&"object"===ur(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Li(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(ki)}var Ai=["component","children","onVisibleChanged","onAllRemoved"],Pi=["status"],_i=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Si,r=function(t){Ar(i,e.Component);var r=Fr(i);function i(){var e;Rr(this,i);for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return hr(_r(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),hr(_r(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:fr(fr({},e),{},{status:Oi})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==Oi})).length})),e}return kr(i,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,i=this.props,l=i.component,a=i.children,o=i.onVisibleChanged,s=i.onAllRemoved,c=Tr(i,Ai),d=l||e.Fragment,u={};return _i.forEach((function(e){u[e]=c[e],delete c[e]})),delete c.keys,e.createElement(d,c,r.map((function(r){var i=r.status,l=Tr(r,Pi),c=i===Ti||i===Ii;return e.createElement(n,Ni({},u,{key:l.key,visible:c,eventProps:l,onVisibleChanged:function(e){(null==o||o(e,{key:l.key}),e)||0===t.removeKey(l.key)&&s&&s()}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=Li(n),l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,i=t.length,l=Li(e),a=Li(t);l.forEach((function(e){for(var t=!1,l=r;l<i;l+=1){var o=a[l];if(o.key===e.key){r<l&&(n=n.concat(a.slice(r,l).map((function(e){return fr(fr({},e),{},{status:Ti})}))),r=l),n.push(fr(fr({},o),{},{status:Ii})),r+=1,t=!0;break}}t||n.push(fr(fr({},e),{},{status:Ri}))})),r<i&&(n=n.concat(a.slice(r).map((function(e){return fr(fr({},e),{},{status:Ti})}))));var o={};return n.forEach((function(e){var t=e.key;o[t]=(o[t]||0)+1})),Object.keys(o).filter((function(e){return o[e]>1})).forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==Ri}))).forEach((function(t){t.key===e&&(t.status=Ii)}))})),n}(r,i);return{keyEntities:l.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==Oi||e.status!==Ri}))}}}]),i}();hr(r,"defaultProps",{component:"div"})}(ai);const Fi=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:l,boxStyle:a,isActive:o}=e,[s,c]=t.useState(o||r);if(t.useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=lr("collapse");return t.createElement("div",{ref:n,className:Pe(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},i),style:l},t.createElement("div",{className:`${d}-content-box`,style:a},e.children))}));Fi.displayName="PanelContent";const Di=e=>{const{defaultActive:n,label:r,extra:i,className:l,style:a,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[h,p]=t.useState(!!n),f=lr("collapse"),g=Pe({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},l);return t.createElement("div",{className:g,style:a},t.createElement(ar,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{p(e),null==m||m(e)}}),t.createElement(Si,Rn({visible:h},((e=lr("motion-collapse"))=>({motionName:e,onAppearStart:or,onEnterStart:or,onAppearActive:sr,onEnterActive:sr,onLeaveStart:cr,onLeaveActive:or,onAppearEnd:dr,onEnterEnd:dr,onLeaveEnd:dr,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:n,style:r},i)=>t.createElement(Fi,{ref:i,prefixCls:f,className:n,style:r,boxStyle:o,isActive:h,forceRender:d},e.children))))};Di.displayName="QmCollapse";const Mi=t.createContext(void 0);function Hi(t,n){((t,n)=>{const r=e.useRef(!0);e.useEffect((()=>t(r.current)),n),e.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})((e=>{if(!e)return t()}),n)}const $i=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},qi=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},ji=e=>e.preventDefault(),Ki=(e,t)=>{if(qn||!e||!t)return null;"float"===(t=Un(t))&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=window.getComputedStyle(e);return r?r[t]:""}catch(n){return e.style[t]}},Vi=(e,t,n)=>{!qn&&e&&t&&(ae(t)?Object.keys(t).forEach((n=>{Vi(e,n,t[n])})):(t=Un(t),e.style[t]=n))},zi=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Wi=(e,t)=>Math.abs(zi(e)-zi(t)),Bi=e=>{let t=0,n=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:n}},Ui=(e,t)=>{var n;let r=e;for(;r;){if(null===(n=r.classList)||void 0===n?void 0:n.contains(t))return r;r=r.parentNode}return null},Gi=(e,t)=>{if(qn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Yi=e=>Math.pow(e,3),Xi=e=>e<.5?Yi(2*e)/2:1-Yi(2*(1-e))/2,Qi=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:l,direction:a}=t.useContext(Mi),{t:o}=Mn(),s=t.useRef(qn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===a),[a]),d=t.useMemo((()=>c?"X":"Y"),[c]),u=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},h=e=>{if(1!==e.buttons)return p();const t=e[`page${d}`]-u.current[`start${d}`],r=[n[0],u.current[`containerSize${d}`]-n[1]];let l=u.current[`firstElementSize${d}`]+t;l=Math.max(r[0],l),l=Math.min(r[1],l),i(l)},p=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),qi(document,"mousemove",h),qi(document,"mouseup",p),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${lr("split")}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return t.createElement("div",{className:Pe(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=l.current,n=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),$i(document,"mousemove",h),$i(document,"mouseup",p),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Qi.displayName="ResizeBar";const Zi=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:l}=e,{direction:a,dragging:o}=t.useContext(Mi),s="vertical"===a?"height":"width",c={[lr("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[i]:!!i},d=void 0!==r?{[s]:Zn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:Pe(c),style:Object.assign(Object.assign({},d),l)},e.children)}));Zi.displayName="SplitPane";const Ji=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:l,style:a,onDragStart:o,onDrag:s=Vn,onDragEnd:c}=e,{global:d}=t.useContext(on),u=t.useRef(null),m=t.useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,p=e=>Number.parseInt(e,10),f=e=>{var t;const n=Number.parseInt((null===(t=e.props)||void 0===t?void 0:t.min)||0);return n>=0?n:0},g=t.useMemo((()=>i?`split_${i}`:""),[i]),[v,y]=t.useState(!1),[b,x]=t.useState(h(r));Hi((()=>{v?null==o||o(p(b)):(null==c||c(p(b)),localStorage.setItem(g,b),C(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):w(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},w=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),C=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),S=t.useMemo((()=>({splitRef:u,direction:n,dragging:v})),[n,v]),N=[];t.Children.map(e.children,(e=>{var t;jn(e)&&!Kn(e)&&"SplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const[T,I]=N,R=t.useMemo((()=>[f(T),f(I)]),[T,I]),O={[lr("split")]:!0,vertical:"vertical"===n};return t.createElement(Mi.Provider,{value:S},t.createElement("div",{ref:u,className:Pe(O,l),style:a},t.createElement(Zi,Rn({},T.props,{ref:m,offset:b})),t.createElement(Qi,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Zi,I.props)))};Ji.displayName="QmSplit",Ji.Pane=Zi;const el=e=>{const{className:n,style:r}=e,{$size:i}=$n(e),l=lr("countup"),a={[l]:!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i};return t.createElement($t,Rn({},e,{className:Pe(a,n),style:r}),e.children)};el.displayName="QmCountup";const tl=e=>{const{className:n}=e,{$size:r}=$n(e),i=lr("empty"),l=Object.assign(Object.assign({},e),{image:N.PRESENTED_IMAGE_SIMPLE}),a={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(N,Rn({},l,{className:Pe(a,n)}))};tl.displayName="QmEmpty";const nl=e=>{const n=mn({tip:"Loading..."},e),{fullHeight:r,className:i,style:l}=n,a=lr("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:Pe(o,i)},Xn(n,["fullHeight"])),{style:Object.assign(Object.assign({},l),{maxHeight:"none"})});return t.createElement(T,s,n.children)};nl.displayName="QmSpin";const rl=t.createContext(void 0),il=new Map;const ll=new qt((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=il.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function al(e,t){il.has(e)||(il.set(e,new Set),ll.observe(e)),il.get(e).add(t)}function ol(e,t){il.has(e)&&(il.get(e).delete(t),il.get(e).size||(ll.unobserve(e),il.delete(e)))}function sl(t){const[n,r]=e.useState({width:0,height:0});return e.useLayoutEffect((()=>{const e=t.current,n=e=>{r({width:e.offsetWidth,height:e.offsetHeight})};return e&&al(e,n),()=>{e&&ol(e,n)}}),[t]),n}function cl(t,n){const r=e.useRef(null);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{r.current&&clearTimeout(r.current),r.current=setTimeout((()=>t.apply(this,e)),n)}),[t,n])}const dl=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,ul=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ml=e=>({_s:e,status:ul[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),hl=e=>e?6:5,pl=(e,t,n,r,i)=>{clearTimeout(r.current);const l=ml(e);t(l),n.current=l,null==i||i({current:l})},fl=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:a,initialEntered:d,mountOnEnter:u,unmountOnExit:m,onStateChange:h}=e||{},[p,f]=s((()=>ml(d?2:hl(u)))),g=l(p),v=l(),[y,b]=(e=>ae(e)?[e.enter,e.exit]:[e,e])(a),x=c((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return hl(t)}})(g.current._s,m);e&&pl(e,f,g,v,h)}),[h,m]),E=c((e=>{const l=e=>{switch(pl(e,f,g,v,h),e){case 1:y>=0&&(v.current=setTimeout(x,y));break;case 4:b>=0&&(v.current=setTimeout(x,b));break;case 0:case 3:v.current=setTimeout((()=>l(e+1)),0)}},a=g.current.isEnter;"boolean"!=typeof e&&(e=!a),e?!a&&l(t?r?0:1:2):a&&l(n?i?3:4:hl(m))}),[x,h,t,n,r,i,y,b,m]);return o((()=>()=>clearTimeout(v.current)),[]),[p,E,x]},gl=e=>{const{name:n,in:r,timeout:i,preEnter:l=!0,preExit:a}=e,[o,s]=fl({timeout:i,preEnter:l,preExit:a,initialEntered:r});return pn((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?dl(e,{className:Pe(e.props.className,n,o.status)}):e)))},vl=6,yl={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},bl=e=>{const{thumb:n,always:r,className:i,barSize:l=vl,direction:a="vertical",onDrag:o=Vn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(rl),u=yl[a],m=t.useRef(n),h=t.useRef(null),p=t.useRef(null),f=t.useRef({}),g=t.useRef(!1),v=t.useRef(!1),y=t.useRef(qn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{m.current=n}),[n]),t.useEffect((()=>{const e=c.current;return $i(e,"mousemove",S),$i(e,"mouseleave",N),()=>{C(),qi(document,"mouseup",w),qi(e,"mousemove",S),qi(e,"mouseleave",N)}}),[]);const E=e=>{if(!h.current||!p.current)return;if(!g.current)return;const t=f.current[u.axis];if(!t)return;const n=100*(-1*(h.current.getBoundingClientRect()[u.direction]-e[u.client])-(p.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},w=()=>{g.current=!1,f.current={[u.axis]:0},qi(document,"mousemove",E),qi(document,"mouseup",w),C(),v.current&&x(!1),o(!1)},C=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},S=()=>{v.current=!1,x(!!m.current.size)},N=()=>{v.current=!0,x(g.current)},T=lr("scrollbar"),I={[`${T}__bar`]:!0,"is-vertical":"vertical"===a,"is-horizontal":"horizontal"===a},R={[u.reverse]:l},O={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(gl,{name:"fade",in:r||s||b,timeout:300},t.createElement("div",{ref:h,className:Pe(I,i),style:R},t.createElement("div",{ref:p,className:`${T}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),$i(document,"mousemove",E),$i(document,"mouseup",w),g.current=!0,y.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(f.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},xl=20,El=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:l,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=xl,onScroll:u}=e,m=t.useRef(null),h=t.useRef(null),p=t.useRef(null),[f,g]=t.useState({size:0,offset:0,ratio:1}),[v,y]=t.useState({size:0,offset:0,ratio:1}),[b,x]=t.useState(!1),E=sl(m),w=sl(p);pn((()=>{!s&&C()}),[w.width,w.height,E.width,E.height]);const C=cl((()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=Math.pow(e,2)/h.current.scrollHeight,r=Math.pow(t,2)/h.current.scrollWidth,i=Math.max(n,d),l=Math.max(r,d),a=n/(e-n)/(i/(e-i)),o=r/(t-r)/(l/(t-l)),s=i+4<e?i:0,c=l+4<t?l:0,u=100*h.current.scrollTop/e*a,m=100*h.current.scrollLeft/t*o;g(Object.assign({},f,{size:c,ratio:o,offset:m})),y(Object.assign({},v,{size:s,ratio:a,offset:u}))}),5),S=e=>{x(e)},N=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,i=window.requestAnimationFrame,l=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollTop=r+(t-r)*Xi(a),i(l)):e.scrollTop=t};i(l)})(h.current,e):h.current.scrollTop=e:tr("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,i=window.requestAnimationFrame,l=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollLeft=r+(t-r)*Xi(a),i(l)):e.scrollLeft=t};i(l)})(h.current,e):h.current.scrollLeft=e:tr("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:m.current,scrollTop:(null===(e=h.current)||void 0===e?void 0:e.scrollTop)||0,scrollLeft:(null===(t=h.current)||void 0===t?void 0:t.scrollLeft)||0,SET_SCROLL_TOP:N,SET_SCROLL_LEFT:T}}));const I=t.useMemo((()=>({dragging:b,scrollbarElement:m,wrapElement:h})),[b]),R=lr("scrollbar"),O={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!s};return t.createElement("div",{ref:m,className:Pe(R,e.className),style:e.style},t.createElement("div",{ref:h,className:Pe(O,r),style:i,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=100*h.current.scrollTop/e*v.ratio,r=100*h.current.scrollLeft/t*f.ratio;g(Object.assign({},f,{offset:r})),y(Object.assign({},v,{offset:n}))})(),null==u||u({scrollTop:t,scrollLeft:n})}},t.createElement("div",{ref:p,className:`${R}__view`,style:l},e.children)),!s&&t.createElement(rl.Provider,{value:I},c&&t.createElement(bl,{className:"top",direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(bl,{direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(bl,{direction:"vertical",thumb:v,barSize:a,always:o,onDrag:S})))}));El.displayName="QmScrollbar";const wl=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let r=document.createElement("a");r.href=n,r.download=decodeURI(t),r.click(),r=null}},Cl=(e,{fileName:t,headers:n,params:r})=>Dn(void 0,void 0,void 0,(function*(){const i=r?new URLSearchParams(r).toString():"",l=i?e.includes("?")?"&":"?":"",a=yield fetch(e+`${l+i}`,{method:"GET",headers:n});if(!a.ok)throw new Error(un("qm.download.error"));const o=yield a.blob(),s=a.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));wl(o,c)})),Sl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Nl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Tl=e=>{var n,r;const i=mn({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:l=[],fileDirection:a="vertical",batchDownload:o,draggable:s,editable:c,disabled:d,readOnly:u,button:m={},className:h,onPreview:p,onSortChange:f,onEditChange:g,onDownload:v,onChange:y}=i,{t:b}=Mn(),{$size:x}=$n(i),w=t.useRef(null),C=t.useRef(null),[S,N]=t.useState({}),T=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(A(),()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.destroy()})),[]);const k=(e,t)=>{N((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},L=Hn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...l],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:l[t],fileList:e})}})),A=()=>{s&&(C.current=jt.create(Ui(w.current,lr("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:L}))},P=e=>Dn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=i;try{e.url&&(yield Cl(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){R.error(b("qm.download.error"))}})),_=lr("upload-file"),F={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x,[`${_}--horizontal`]:"horizontal"===a};return t.createElement(I,Rn({className:Pe(F,h)},Xn(i,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>Dn(void 0,void 0,void 0,(function*(){const{fileTypes:l=[],fileSize:a,maxCount:o,fileList:s=[],beforeUpload:c}=i,d=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!a||e.size/1024/1024<a,m=!(o>1)||s.length<o,h=d&&u&&m;if(d||R.warning(b("qm.upload.tooltip",{type:l.join(",")})),u||R.warning(b("qm.upload.sizeLimit",{size:a})),m||R.warning(b("qm.upload.countLimit",{count:o})),!h)return I.LIST_IGNORE;if(c){const i=c(e,t);if(!0===i)return n(e);if(!1===i)return r("not upload");if(i&&"function"==typeof i.then)try{const e=yield i;n(e)}catch(e){r(e)}}else n(e)})))),disabled:T,onChange:y,onPreview:e=>Dn(void 0,void 0,void 0,(function*(){if("function"==typeof p)return p(e,(t=>P(t||e)));d||(yield P(e))})),onDownload:e=>Dn(void 0,void 0,void 0,(function*(){yield P(e)})),itemRender:(e,n,r,a)=>((e,n)=>{const{iconRender:r}=i,{uid:a,name:o,url:u,status:m="done"}=e,h="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return t.createElement("div",{className:Pe("ant-upload-list-item",`ant-upload-list-item-${m}`,"ant-upload-list-item-list-type-text",{handle:s})},t.createElement("div",{className:"ant-upload-list-item-info"},t.createElement("span",{className:"ant-upload-span"},t.createElement("div",{className:"ant-upload-text-icon"},r?r(e):t.createElement(Me,null)),t.createElement("div",{className:"ant-upload-list-item-name"},S[a]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:Sl(o),onBlur:t=>{const{value:n}=t.target;if(n!==Sl(o)){const t=Object.assign({},e,{name:`${n}.${Nl(o)}`}),r=l.map((e=>e.uid!==a?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}k(a,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?T||k(a,!0):n.preview()}},o)),t.createElement("span",{className:"ant-upload-list-item-card-actions"},c&&!T&&t.createElement("button",{type:"button",className:h,onClick:()=>k(a)},S[a]?t.createElement($e,null):t.createElement(He,null)),c&&t.createElement("button",{type:"button",className:Pe(h,"preview"),onClick:()=>n.preview()},t.createElement(qe,null)),t.createElement("button",{type:"button",className:Pe(h,"download"),disabled:d,onClick:()=>n.download()},t.createElement(je,null)),t.createElement("button",{type:"button",className:Pe(h,"delete"),disabled:T,onClick:()=>n.remove()},t.createElement(Ke,null))))))})(n,a)}),t.createElement("span",{className:"inner",ref:w},i.children||u&&l.length?i.children:t.createElement(E,{type:null!==(n=m.type)&&void 0!==n?n:"default",icon:null!==(r=m.icon)&&void 0!==r?r:t.createElement(De,null),disabled:T},m.text||b("qm.upload.text")),o&&!!l.length&&t.createElement(E,{disabled:d,style:{marginLeft:8},onClick:e=>Dn(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),"function"==typeof o)yield o(l);else for(const e of l)yield P(e)}))},b("qm.upload.batchDownload"))))};Tl.displayName="QmUploadFile";const Il=e=>{const n=mn({icon:t.createElement(je,null),withCredentials:!1},e),{$size:r}=$n(n),{t:i}=Mn(),[l,a]=t.useState(!1),o=Xn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,Rn({},o,{size:r,loading:l,onClick:()=>Dn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:l,beforeDownload:a=zn,onSuccess:o}=n,s=ce(e)?e:yield Dn(void 0,void 0,void 0,(function*(){const e=n.action;if(e.api)try{const t=yield e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}));if(!s)return tr("Download","参数 `action` 有误!");if(!a(s))return;yield Cl(s,{fileName:t,headers:r,params:l}),yield Wn(100),null==o||o(),R.success(i("qm.download.success"))}catch(t){null===(e=n.onError)||void 0===e||e.call(n,t),R.error(i("qm.download.error"))}a(!1)}))}),n.children||i("qm.download.text"))};function Rl(t,n){const r=e.useRef(null),i=e.useRef(0);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{const r=Date.now();(!i.current||r-i.current>n)&&(t.apply(this,e),i.current=r)}),[t,n])}Il.displayName="QmDownload";const Ol=e=>{const{activeKey:n,labels:r,onTabClick:i}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const l={item:!0,actived:r===n};return t.createElement("div",{key:r,className:Pe(l),onClick:e=>i(r,e)},t.createElement("span",null,e))})))},kl=e=>{const{label:n,showDivider:r,className:i,style:l}=e,a={[lr("anchor-item")]:!0};return t.createElement("div",{className:Pe(a,i),style:l},r&&t.createElement(ar,{label:n,style:{marginBottom:10}}),e.children)};kl.displayName="AnchorItem";const Ll=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:l,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=$n(e),u=t.useRef(null),m=t.useRef(),h=t.useRef("ready"),p=t.useRef(0),[f,g]=t.useState(i||0),v=t.useMemo((()=>!!(null==r?void 0:r.length)),[r]);t.useEffect((()=>{y();const e=Kt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=Wi(x(f),u.current))},b=e=>{const t=Math.abs(e),n=(v?r.map((e=>document.getElementById(e.id))):Array.from((null===(i=u.current)||void 0===i?void 0:i.children)||[])).map((e=>Wi(e,u.current)));var i;let l=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(l=e)}return l},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=Rl((e=>{if("ready"!==h.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),w=e=>{const t=x(e);t&&(g(e),h.current="stop",m.current&&clearTimeout(m.current),Vt(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>h.current="ready"),500))};t.useImperativeHandle(n,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>p.current?p.current:e,w(e)}})));const C=lr("anchor"),S={[C]:!0,[`${C}-left`]:"left"===a,[`${C}-top`]:"top"===a,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;jn(e)&&!Kn(e)&&"AnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const T=v?r.map((e=>e.label)):N.map((e=>e.props.label)),I=v?r.map((e=>e.id)):N.map(((e,t)=>e.props["data-id"]||t.toString()));return p.current=T.length,t.createElement("div",{className:Pe(S,s),style:c},t.createElement("div",{className:Pe("anchor-nav"),style:{width:l?Zn(l):""}},t.createElement(Ol,{activeKey:f,labels:T,onTabClick:(e,t)=>{w(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:Pe("anchor-container")},v?e.children:N))}));Ll.displayName="QmAnchor",Ll.Item=kl;const Al=e=>t.createElement(k.TabPane,e,e.children);Al.displayName="TabPane";const Pl=e=>{const n=mn({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:l,className:a,authConfig:o}=n,{$size:s}=$n(n),c=lr("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Xn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=l?l:["top","bottom"].includes(i)?30:0}),m=[];t.Children.map(n.children,(e=>{var t;jn(e)&&!Kn(e)&&"TabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&m.push(e)}));const h=r?[...r]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<h.length;t++){const n=h[t],r=e.find((e=>e.dataIndex===n.key)),{visible:i=1,disabled:l}=r||{};i?l&&(n.disabled=!0):(h.splice(t,1),t--)}}return t.createElement(k,Rn({},u,{items:h,className:Pe(d,a)}))};Pl.displayName="QmTabs",Pl.TabPane=Al;const _l=t.forwardRef(((e,n)=>{var r;const i=mn({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:l,open:a,className:o,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:h,onClosed:p,onFullChange:f}=i,{global:g}=t.useContext(on),{$size:v}=$n(i),y=t.useRef(null),b=t.useRef(null),x=t.useRef(!1),[E,w]=t.useState(!1),[C,S]=t.useState(!1),[N,T]=t.useState(!1);Hi((()=>{(null!=a?a:l)&&(!m&&x.current||de(s)&&S(!0))}),[null!=a?a:l]),Hi((()=>{b.current&&Vi(b.current,E?{width:"100%"}:{width:Zn(i.width||"72%")})}),[E]);const I=()=>{b.current=Ui(y.current,"ant-drawer-content-wrapper"),w(!E),null==f||f(!E)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=lr("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===v,[`${R}--sm`]:"small"===v};return t.createElement(L,Rn({},Xn(i,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=a?a:l,maskClosable:null!==(r=null!=u?u:null==g?void 0:g.maskClosable)&&void 0!==r&&r,className:Pe(O,o),title:t.createElement(t.Fragment,null,t.createElement("span",{ref:y,className:"text"},c&&i.title),d&&t.createElement("button",{type:"button",className:"full-screen",onClick:I},t.createElement(E?Ve:ze))),footer:null,afterOpenChange:e=>{e?(x.current=!0,de(s)&&setTimeout((()=>S(!1)),100)):(w(!1),null==p||p())},onClose:h}),i.children,(s||N||C)&&t.createElement(nl,{spinning:!0,className:Pe("spinning")}))}));_l.displayName="QmDrawer";const Fl="10vh";var Dl;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Dl||(Dl={}));const Ml=t.forwardRef(((e,n)=>{var r;const i=mn({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Fl}},e),{visible:l,open:a,width:o,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:h,maskClosable:p,destroyOnClose:f,bodyStyle:g,onFullChange:v,onClose:y,onClosed:b}=i,{global:x}=t.useContext(on),{$size:E}=$n(i),w=t.createRef(),C=t.useRef(!1),S=t.useMemo((()=>`calc(100vh - ${Fl} - ${Fl} - ${Dl[m?E:"none"]}px)`),[E,m]),[N,T]=t.useState(!1),[I,R]=t.useState(!1),[O,k]=t.useState(!1),[L,P]=t.useState(!0),[_,F]=t.useState({left:0,top:0,bottom:0,right:0}),[D,M]=t.useState();Hi((()=>{if(null!=a?a:l){if(!f&&C.current||de(d)&&R(!0),!f&&C.current)return;setTimeout((()=>{C.current=!0,de(d)&&R(!1)}),400)}}),[null!=a?a:l]),Hi((()=>{M(N?{x:0,y:0}:void 0)}),[N]);const H=e=>{const t=Ui(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");N?(Vi(t,{width:Zn(o||"60%"),height:"auto",top:Fl}),Vi(n,{height:s?Zn(s):S,maxHeight:"auto"===s?S:""})):(Vi(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Vi(n,{height:`calc(100vh - ${Dl[m?E:"none"]}px)`,maxHeight:""})),T(!N),null==v||v(!N)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const $=lr("modal"),q={height:s?Zn(s):S,maxHeight:"auto"===s?S:"",overflow:"auto"},j={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===E,[`${$}--sm`]:"small"===E};return t.createElement(A,Rn({},Xn(i,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=a?a:l,maskClosable:null!==(r=null!=p?p:null==x?void 0:x.maskClosable)&&void 0!==r&&r,className:Pe(j,c),title:t.createElement("div",{onMouseOver:()=>{L&&P(!1)},onMouseOut:()=>{P(!0)}},t.createElement("span",{className:"text"},m&&i.title),h&&t.createElement("button",{type:"button",className:"full-screen",onClick:H},t.createElement(N?Ve:ze))),footer:null,bodyStyle:Object.assign({},q,g),onCancel:y,afterClose:()=>{null==b||b(),T(!1)},modalRender:e=>t.createElement(zt,{nodeRef:w,bounds:_,position:D,disabled:!u||L||N,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=w.current.getBoundingClientRect();i&&F({left:-i.left+t.x,right:n-(i.right-t.x)-1,top:-i.top+t.y,bottom:r-(i.bottom-t.y)-1})})(0,t)},t.createElement("div",{ref:w},e))}),i.children,(d||O||I)&&t.createElement(nl,{spinning:!0,className:Pe("spinning")}))}));Ml.displayName="QmModal";const Hl=n(void 0);var $l={string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e,t){return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let n=0,r=(e=Array.isArray(e)?e:[e]).length;n<r;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<r-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,n){return e.split(t).join(n)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != ")}};const ql=["==","<",">","<=",">=","!=","like","nlike","likes","in","nin","^=","=$","nil","nnil"];var jl=function(e){let t=0;const n=e.length;for(let r=0;r<n;r++){const n=e.charAt(r);"("===n&&t++,")"===n&&t--}return 0===t},Kl=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const r=n.split(" ").filter((e=>""!==e));for(let e=0;e<r.length;e++)ql.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),ql.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const Vl=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,zl=["string","number","boolean","symbol"],Wl=e=>zl.includes(typeof e),Bl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Ul=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(new RegExp(Oa,"g")," ").replace(Vl,"\\$1"),"i"),Gl=(e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Ul(n));break;case"nlike":r=null===e.toString().match(Ul(n));break;case"likes":r=n.split(/,|,/).some((t=>Gl(e,"like",t)));break;case"in":Wl(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Wl(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"^=":r=e.toString().startsWith(n);break;case"=$":r=e.toString().endsWith(n);break;case"nil":r=""===e||null==e;break;case"nnil":r=!Gl(e,"nil",null);break;case"!=":case"<>":r=(Bl(e)?e.slice(0,10):e)!=n;break;case"<":r=(Bl(e)?e.slice(0,10):e)<n;break;case"<=":r=(Bl(e)?e.slice(0,10):e)<=n;break;case">":r=(Bl(e)?e.slice(0,10):e)>n;break;case">=":r=(Bl(e)?e.slice(0,10):e)>=n;break;default:r=(Bl(e)?e.slice(0,10):e)==n}return r};window.__query__=(...e)=>Gl(e[0],e[1],e[2]);const Yl=$l.stringify,Xl=$l.array_format,Ql=jl,Zl=(e,t,n)=>{let r=[];t=$l.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Kl(t,"record")};`);r=Da(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Kl(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){tr("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Jl=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Jl(e.children)):t.push(e)})),t},ea=e=>e.filter((e=>(e.children&&(e.children=ea(e.children)),!e.hidden&&!e.noAuth))),ta=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...ta(e.children))})),t},na=(e,t)=>e.map((e=>(e.children&&(e.children=na(e.children,t)),null==t||t(e),e))),ra=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=ra(n.children,t);if(e)return e}}return null},ia=e=>{const t=e.children;return t?t[0].children?ia(t[0]):t[0]:e},la=e=>{const t=e.children;return t?t[t.length-1].children?la(t[t.length-1]):t[t.length-1]:e},aa=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),oa=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=oa(n.children,t);if(e)return e}}return null},sa=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...sa(e.children))})),t},ca=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ca(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},da=e=>{let t=1;const n=(e,r)=>{var i;if(r&&(e.level=r.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((r=>{e.fixed?r.fixed=e.fixed:delete r.fixed,n(r,e),t+=r.colSpan})),e.colSpan=t}else e.colSpan=null!==(i=e.colSpan)&&void 0!==i?i:1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return ta(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},ua=e=>Object.assign(e,{__prevent__:!0}),ma=e=>e.__prevent__,ha=e=>{delete e.__prevent__},pa=(e,t,n={left:0,top:0})=>{if(e){const r=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,r&&r!==document.documentElement&&r!==document.body&&(n.top-=r.scrollTop,n.left-=r.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return pa(e.offsetParent,t,n)}return n},fa=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ga=(e,t)=>me(e,((e,n,r)=>{he(n,t[r])||(e[r]=ae(n)&&ae(t[r])?ga(n,t[r]):n)})),va=(e,t)=>{var n;return null!==(n=ue(e,t))&&void 0!==n?n:""},ya=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),pe(e,t,null!=n?n:"")},ba=(e,t)=>{if(!t.includes("|"))return va(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(va(e,t))})),n.every((e=>!e))?"":n.join(" | ")},xa=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Ea=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],i="";for(;r.length>3;)i=`,${r.slice(-3)}${i}`,r=r.slice(0,r.length-3);return r&&(i=r+i),`${n}${i}${t[1]?`.${t[1]}`:""}`},wa=(e,t)=>{const n=e.toString();if(!xa(n)||0===t)return e;const r=Number.parseFloat(n).toString(),i=r.indexOf(".");if(-1===i)return r+"."+"0".repeat(t);const l=Math.max(0,t-(r.length-i-1));return r+"0".repeat(l)},Ca=(e,t)=>e?h(e,t):null,Sa=(e,t)=>e?h(e).format(t):"",Na=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},Ta=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...Ta(e))}))}else n.push(e);return n},Ia=e=>Ta(e).join(""),Ra=e=>e.filter((e=>!e._group)),Oa="",ka=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let i=0,l=e.length;i<l;i++){const l=e[i];if(!l.fieldName)continue;const a=Array.isArray(l.condition)?Xl(l.condition):Yl(l.condition,Oa);n+=`${l.bracketLeft} ${t?`${l.fieldName}|${l.fieldType}`:l.fieldName} ${l.expression} ${a} ${l.bracketRight} ${l.logic} `,r=l.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[i,l]=r.includes("|")?r.split("|"):[r,""],a=e[r];for(const e in a){n+=`${t?`${i}|${l}`:i} ${e} ${Array.isArray(a[e])?Xl(a[e]):Yl(a[e],Oa)} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},La=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(va(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},Aa=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].dataIndex===t)return[e[n]];if(Array.isArray(e[n].children)){const r=Aa(e[n].children,t);if(r)return[e[n],r].flat()}}},Pa=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].rowKey===t)return[t];if(Array.isArray(e[n].children)){const r=Pa(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},_a=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=_a(n.children,t);if(e)return e}if(t(n))return n}return null},Fa=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...Fa(e[n].children)),t.push(e[n].rowKey);return t},Da=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Da(e.children,t),t(e)||e.children&&e.children.length))),Ma=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Ha=(e,t,n=!1)=>{const r=new Set;return function e(t,i,l=1){if(r.has(t))return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);const a=l+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],i[n],a))return!1;return!0}if(t&&i&&"object"==typeof t&&"object"==typeof i){const n=Object.keys(t);return n.length===Object.keys(i).length&&n.every((n=>e(t[n],i[n],a)))}return!1}(e,t)},$a=e=>["nil","nnil"].includes(e),qa=(e,t,n)=>{if(!Object.keys(t).length||!e.length)return e;if(!n)return e.filter((e=>ja(e,t)));const r=new Map,i=new Set;for(const n of e)if(r.set(n._rowKey,n),ja(n,t)){let e=n;for(;e&&!i.has(e._rowKey);)i.add(e._rowKey),e=r.get(e._parentRowKey)}return e.filter((e=>i.has(e._rowKey)))};function ja(e,t){for(const n in t){const r=t[n],i=va(e,n);if(r&&!r.includes(i))return!1}return!0}const Ka=e=>["","small","middle","large"].includes(e),Va=80,za="1",Wa="0",Ba=400,Ua=["RANGE_INPUT","RANGE_INPUT_NUMBER","RANGE_SEARCH_HELPER","MULTIPLE_CHECKBOX","MULTIPLE_SELECT","RANGE_DATE","RANGE_TIME","MULTIPLE_TREE_SELECT","MULTIPLE_SEARCH_HELPER","MULTIPLE_TREE_TABLE_HELPER","MULTIPLE_CASCADER","UPLOAD_IMG","UPLOAD_FILE"],Ga={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Ya,Xa,Qa;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ya||(Ya={})),function(e){e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY"}(Xa||(Xa={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Qa||(Qa={}));const Za={items:Ut.arrayOf(Ut.shape({type:Ut.string.isRequired,fieldName:Ut.string.isRequired})),initialValues:Ut.object,initialExtras:Ut.object,layout:Ut.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!Ka(e[t]||""))return er("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Ut.number,className:Ut.string,style:Ut.object,compactMode:Ut.bool,labelWidth:Ut.oneOfType([Ut.number,Ut.string]),labelAlign:Ut.oneOf(["left","right"]),labelWrap:Ut.bool,formType:Ut.oneOf(["default","search","onlyShow"]),disabled:Ut.bool,uniqueKey:Ut.string,defaultRows:Ut.number,defaultExpand:Ut.bool,searchButtonCols:Ut.number,scrollToFirstError:Ut.bool,authConfig:Ut.object,isAutoFocus:Ut.bool,isCollapse:Ut.bool,isFieldsDefine:Ut.bool,isSearchBtn:Ut.bool,isSubmitBtn:Ut.bool,fieldsChange:Ut.func,onValuesChange:Ut.func,onFieldsChange:Ut.func,onFinish:Ut.func,onFinishFailed:Ut.func,onReset:Ut.func,onCollapse:Ut.func},Ja={layout:"horizontal",labelWidth:Va,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Vn,onFieldsChange:Vn,onFinish:Vn,onFinishFailed:Vn,onReset:Vn,onCollapse:Vn},eo=(e,t)=>{if(!e)return null;if(t===Xa.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===Xa.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?h().year(Number(t[1])).quarter(Number(t[2])):null}return h(e,t)},to=(e,t)=>e?h(e).format(t):"",no=e=>""===e||null==e,ro=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let i="";for(let t=0,l=r.length;t<l;t++){i+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===l-1?"":" | ")}return i},io=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const i=t[r].split("|"),l=n[r].split("|");i.forEach(((t,n)=>e[t]=e[l[n]]))}else e[t[r]]=e[n[r]]},lo=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const i=t[r].split("|"),l=n[r].split("|");i.forEach(((t,n)=>e[t]=e[l[n]]))}else e[t[r]]=e[n[r]]},ao=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),de(e.isLeaf)||(r.isLeaf=!!e.isLeaf),de(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=ao(e.children,t,n)),r})),oo=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=oo(n.children,t);if(e)return e}}return null},so=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...so(e.children,t,n+1))})),r},co=e=>jn(e)||"string"==typeof e,uo=e=>jn(e)?Ta(e).join(""):null!=e?e:"",mo=(e,t,n,r)=>{var i;const l={};return l.filters=(null===(i=e.filters)||void 0===i?void 0:i.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t})))||[],l.table={columns:e.columns||[],rowKey:e.valueName},l.fieldsDefine={valueKey:e.valueKey||e.valueName},l.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(l.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(l.echoRequest={fetchApi:n(e.echoSetting.api),formatter:t=>{var n;return Object.assign({},t,{[e.echoSetting.paramKey]:null!==(n=t.key)&&void 0!==n?n:t.keys})},dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(l.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(l.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(l.columns=e.emmediateSetting.columns,l.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),l};var ho={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{"曾":"ZENG","沈":"SHEN","嗲":"DIA","碡":"ZHOU","聒":"GUO","炔":"QUE","蚵":"KE","砉":"HUA","嬤":"MO","嬷":"MO","蹒":"PAN","蹊":"XI","丬":"PAN","霰":"XIAN","莘":"XIN","豉":"CHI","饧":"XING","筠":"JUN","长":"CHANG","帧":"ZHEN","峙":"SHI","郍":"NA","芎":"XIONG","谁":"SHUI"}};const po="阿",fo="鿿",go=1,vo=2,yo=3;let bo,xo=null;function Eo(e){return e||null===xo?("object"==typeof Intl&&Intl.Collator?(bo=new Intl.Collator(["zh-Hans-CN","zh-CN"]),xo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):xo=!1,xo):xo}function wo(e){const t=ho.UNIHANS,n=ho.PINYINS,r=ho.EXCEPTIONS,i={source:e};if(e in r)return i.type=vo,i.target=r[e],i;let l,a=-1;if(e.charCodeAt(0)<256)return i.type=go,i.target=e,i;if(l=bo.compare(e,po),l<0)return i.type=yo,i.target=e,i;if(0===l)i.type=vo,a=0;else{if(l=bo.compare(e,fo),l>0)return i.type=yo,i.target=e,i;0===l&&(i.type=vo,a=t.length-1)}if(i.type=vo,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const i=t[a];if(l=bo.compare(e,i),0===l)break;l>0?n=a+1:r=a-1}}return l<0&&a--,i.target=n[a],i.target||(i.type=yo,i.target=i.source),i}function Co(e){return"string"==typeof e&&Eo()?e.split("").map((e=>wo(e))):e}var So={isSupported:Eo,parse:Co,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(ho)})))},genToken:wo,convertToPinyin:(e,t,n)=>Co(e).map((e=>t&&e.type===vo?e.target.toLowerCase():e.target)).join(n||"")};var No={patcher:function(e){e.EXCEPTIONS={"嗲":"DIA","碡":"ZHOU","聒":"GUO","炔":"QUE","蚵":"KE","砉":"HUA","嬷":"MO","蹊":"XI","丬":"PAN","霰":"XIAN","豉":"CHI","饧":"XING","帧":"ZHEN","芎":"XIONG","谁":"SHUI","钶":"KE"},e.UNIHANS[91]="伕",e.UNIHANS[347]="仚",e.UNIHANS[393]="诌",e.UNIHANS[39]="婤",e.UNIHANS[50]="腠",e.UNIHANS[369]="攸",e.UNIHANS[123]="乯",e.UNIHANS[171]="刕",e.UNIHANS[102]="佝",e.UNIHANS[126]="犿",e.UNIHANS[176]="列",e.UNIHANS[178]="刢",e.UNIHANS[252]="娝",e.UNIHANS[330]="偸"},shouldPatch:function(e){return"function"==typeof e&&("FOU"===e("伕").target&&"XIA"===e("仚").target&&"ZHONG"===e("诌").target&&"CHONG"===e("婤").target&&"CONG"===e("腠").target&&"YONG"===e("攸").target&&"HOU"===e("乯").target&&"LENG"===e("刕").target&&"GONG"===e("佝").target&&"HUAI"===e("犿").target&&"LIAO"===e("列").target&&"LIN"===e("刢").target&&"E"===e("钶").target)}};So.isSupported()&&No.shouldPatch(So.genToken)&&So.patchDict(No);const To=e=>{const{value:n,bordered:r}=e;return t.createElement(O,{value:n,title:n,bordered:r,readOnly:!0})};To.displayName="FormItemView";const{Option:Io}=D,Ro=e=>{const{$$form:n}=t.useContext(Hl),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Mn(),{fieldName:d,options:u={},style:m={},placeholder:h=c("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:f=!0,readOnly:g,disabled:v,onClear:y}=e.option,{itemList:b=[],filterable:x=!0,listHeight:E=Ba,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,T=Gn(b)?i:b,I=e=>{var t;return(null===(t=T.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},R=e=>l?(null==e?void 0:e.map((e=>I(e))).join(","))||"":I(e);return n.isOnlyShow?t.createElement(To,{value:R(r),bordered:p}):t.createElement(D,Rn({value:r,mode:l?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:h,style:m,loading:a,bordered:p,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:C},l?{title:R(r)}:null,{filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"",i=So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,R(e),T)})(e)},onClear:y}),T.map((e=>t.createElement(Io,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Oo extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:h,validateTrigger:p,rules:f=[],onChange:g=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Zn(d)},required:e.getFormItemRequired(f)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:f,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Ro,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),h&&t.createElement(F,null,e.renderFormItemButton(o,h)),m&&t.createElement(F,{flex:Zn(m.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}Oo.contextType=Hl;const ko=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=Wa,trueValue:h=za}=o,{t:p}=Mn(),f=e=>p(e===h?"am.form.trueText":"am.form.falseText");return t.createElement(M,{checked:r===h,style:s,disabled:d||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==i||i(e),l(e,f(e))})(t?h:m)}},u?a:null)};class Lo extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option,{labelToCheckbox:p}=o;return t.createElement(P.Item,{label:p?" ":e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ko,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Lo.contextType=Hl;const Ao=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:l}=t.useContext(on),{$$form:a}=t.useContext(Hl),{$size:o}=$n(e),{t:s}=Mn(),c=t.useRef(null),[d,u]=t.useState(!1),m=t.useMemo((()=>n?`form_${n}`:""),[n]);t.useLayoutEffect((()=>{f()}),[]);const h=()=>{if(!m)return;const e=JSON.parse(localStorage.getItem(m));var t;if(e||(t=m,Dn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(m,JSON.stringify(e)),f()):(null==l?void 0:l.getComponentConfigApi)&&p(r)})).catch((()=>{})),!e)return;return fe(e.map((e=>e.fieldName)),r.map((e=>e.fieldName))).length>0?r.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?(de(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName));return Object.assign(Object.assign({},t),e)}))},p=e=>{if(!m)return;const t=e.map((e=>{const t={};return de(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(m));var r,i;he(t,n)||(localStorage.setItem(m,JSON.stringify(t)),r=m,i=t,Dn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.saveComponentConfigApi;if(e)try{yield e({[r]:i})}catch(e){}})))},f=()=>{const e=h();e&&g(e)},g=e=>{null==i||i([...e])},v=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(nr,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||Qn(e);return Object.assign(t,{hidden:e.hidden})}));g(t),p(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));if(he(t,n))return;a.setExpandHandle(!0);const i=Ma(e);g(i),p(i)}},r.map((e=>{var n;return t.createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},t.createElement(M,{disabled:(null===(n=e.rules)||void 0===n?void 0:n.findIndex((e=>e.required)))>-1,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,g(r),p(r)}}),t.createElement(Be,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=lr("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(H,{open:d,trigger:["click"],dropdownRender:()=>v(),overlayClassName:Pe(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>c.current,onOpenChange:e=>{u(e)}},t.createElement("a",{ref:c,style:{padding:"5px 0"}},t.createElement(We,null)))};Ao.displayName="FieldsFilter";const Po=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Hl),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Mn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:p,onFocus:f,onBlur:g,onEnter:v,onClear:y}=e.option,{prefix:b,suffix:x,password:E,maxLength:w,pattern:C,toUpper:S,toTrim:N,autoFocus:T,autoComplete:I,secretType:R}=s,k=R&&(h||p),L=t.useRef(),A=t.useRef(!1);t.useEffect((()=>{var e;const t=()=>null==y?void 0:y(),n=null===(e=L.current)||void 0===e?void 0:e.input.parentNode.querySelector("span[class*='clear-icon']");return m&&n&&n.addEventListener("click",t),()=>{null==n||n.removeEventListener("click",t)}}),[]);const P=e=>{null==l||l(e),a(e)},_=E?O.Password:O,F=k?((e="",t)=>(e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e))(i,R):i;return r.isOnlyShow?t.createElement(To,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(F),bordered:u}):t.createElement(_,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:F,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":F,prefix:b,suffix:x,maxLength:w,bordered:u,allowClear:m,readOnly:h,disabled:p,onFocus:e=>{null==f||f(e.target.value,e)},onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(N){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),null==g||g(r,t)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;null==v||v(n,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=L.current)||void 0===t||t.blur())}},onCompositionStart:()=>{A.current=!0},onCompositionEnd:()=>{A.current=!1},onChange:e=>{let t=e.target.value;ge(C)&&(t=C.test(t)?t:null!=i?i:""),S&&!A.current&&(t=t.toUpperCase()),P(t)}})}));Po.displayName="VInput";class _o extends d{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:h=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Po,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(l,t)}}))),u&&t.createElement(F,null,e.renderFormItemButton(l,u)),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}_o.contextType=Hl;const Fo=e=>{const{$$form:n}=t.useContext(Hl),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:h,suffix:p,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;null==i||i(t),l(t,v(t))},v=e=>e.join(" - ");return n.isOnlyShow?t.createElement(To,{value:v(r),bordered:c}):t.createElement(O.Group,null,t.createElement(O,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:h,suffix:p,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement(O,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:h,suffix:p,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Do extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(o)},required:e.getFormItemRequired(u)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Fo,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(l,n)}}))),c&&t.createElement(F,{flex:Zn(c.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}Do.contextType=Hl;const Mo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Hl),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Mn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:h,onFocus:p,onBlur:f,onEnter:g}=e.option,{step:v=1,min:y,max:b,precision:x,autoFocus:E,stringMode:w,textAlign:C="left",controls:S=!0,formatter:N,parser:T}=s,I=t.useRef(),R=t.useRef(i),O=e=>{const t=no(e)?"":oe(e)?e.toFixed(x):new Yt(e).toFixed(x);return"function"==typeof N?N(t):t},k={[C]:!0,controls:S};return r.isOnlyShow?t.createElement(To,{value:O(i),bordered:u}):t.createElement($,{ref:e=>{I.current=e,"function"==typeof n&&n(e)},value:i,className:Pe(k),placeholder:d,style:Object.assign({width:"100%"},c),step:v,min:y,max:b,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:T,bordered:u,readOnly:m,disabled:h,onFocus:e=>{null==p||p(e.target.value,e)},onBlur:t=>{Bn((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(R.current),null==f||f(R.current,t)}))},onKeyUp:e=>{var t;13===e.keyCode&&(null==g||g(i,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=I.current)||void 0===t||t.blur()))},onChange:e=>{const t=null!=e?e:"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,null==l||l(e),a(e,O(e))})(t)}})}));Mo.displayName="VInputNumber";class Ho extends d{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:h=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Mo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(l,n)}}))),u&&t.createElement(F,null,e.renderFormItemButton(l,u)),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Ho.contextType=Hl;const $o=e=>{const{$$form:n}=t.useContext(Hl),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:h=1,min:p=0,max:f,textAlign:g="left",controls:v=!0,precision:y,formatter:b,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];null==i||i(t),l(t,C(t))},C=e=>no(e)?"":e.map((e=>no(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(To,{value:C(r),bordered:c}):t.createElement(O.Group,null,t.createElement($,{value:r[0],className:Pe("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:h,min:p,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([e,r[1]])},onBlur:()=>{E(r)}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement($,{value:r[1],className:Pe("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:h,min:p,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([r[0],e])},onBlur:()=>{E(r)}}))};class qo extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(o)},required:e.getFormItemRequired(u)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement($o,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(l,n)}}))),c&&t.createElement(F,{flex:Zn(c.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}var jo;qo.contextType=Hl,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(jo||(jo={}));const Ko=n(void 0),Vo={dataIndex:Ut.string.isRequired,title:Ut.string.isRequired,description:Ut.string,colSpan:Ut.number,width:Ut.number,minWidth:Ut.number,fixed:Ut.oneOf(["left","right"]),align:Ut.oneOf(["left","center","right"]),theadAlign:Ut.oneOf(["left","center","right"]),printFixed:Ut.bool,hidden:Ut.bool,noAuth:Ut.bool,noFixed:Ut.bool,ellipsis:Ut.bool,className:Ut.string,theadClassName:Ut.string,children:Ut.array,sorter:Ut.oneOfType([Ut.bool,Ut.func]),filter:Ut.shape({type:Ut.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Ut.arrayOf(Ut.shape({text:Ut.string,value:Ut.oneOfType([Ut.string,Ut.number])})),style:Ut.object}),precision:Ut.number,displayPrecision:Ut.number,formatType:Ut.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Ut.bool,canCopy:Ut.bool,editRender:Ut.func,dictItems:Ut.arrayOf(Ut.shape({text:Ut.string,value:Ut.oneOfType([Ut.string,Ut.number])})),summation:Ut.shape({sumBySelection:Ut.bool,displayWhenNotSelect:Ut.bool,dataKey:Ut.string,unit:Ut.string,render:Ut.func}),groupSummary:Ut.shape({dataKey:Ut.string,unit:Ut.string,render:Ut.func}),shouldCellUpdate:Ut.func,headRender:Ut.func,render:Ut.func};Ut.arrayOf(Ut.shape(Vo)).isRequired,Ut.func,Ut.array,Ut.oneOfType([Ut.string,Ut.func]).isRequired,Ut.number,Ut.bool,Ut.bool,Ut.shape({api:Ut.func.isRequired,params:Ut.object.isRequired,formatter:Ut.func,beforeFetch:Ut.func,afterFetch:Ut.func,stopToFirst:Ut.bool,dataKey:Ut.string,callback:Ut.func}),Ut.bool,Ut.bool,Ut.string,Ut.string,Ut.object,Ut.bool,Ut.bool,Ut.bool,Ut.oneOfType([Ut.object,Ut.func]),Ut.oneOfType([Ut.object,Ut.func]),Ut.array,Ut.func,Ut.bool,Ut.object,Ut.object,Ut.shape({type:Ut.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Ut.array,selectedRowKeys:Ut.array,hideSelectAll:Ut.bool,checkStrictly:Ut.bool,filterable:Ut.bool,selectByClickRow:Ut.bool,selectFirstRowOnChange:Ut.bool,clearableAfterFetched:Ut.bool,selectAllOnCurrentPage:Ut.bool,fetchSelectedRows:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),fetchAllRowKeys:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),disabled:Ut.func,onChange:Ut.func,onSelect:Ut.func,onSelectAll:Ut.func}),Ut.shape({currentRowKey:Ut.oneOfType([Ut.number,Ut.string]),disabled:Ut.func,onChange:Ut.func}),Ut.shape({virtual:Ut.bool,overscan:Ut.number,doubleXScrollbar:Ut.bool,openFetchFilterList:Ut.bool}),Ut.shape({expandIconColumn:Ut.string}),Ut.shape({defaultExpandAllRows:Ut.bool,defaultExpandedRowKeys:Ut.array,expandedRowKeys:Ut.array,hideExpandAll:Ut.bool,rowExpandable:Ut.func,expandedRowClassName:Ut.string,expandedRowRender:Ut.func,onExpand:Ut.func,onChange:Ut.func}),Ut.shape({cellMerge:Ut.bool,onCellMerge:Ut.func,onSelectChange:Ut.func}),Ut.shape({groupItems:Ut.arrayOf(Ut.shape({dataIndex:Ut.string.isRequired,titleIndex:Ut.string,color:Ut.string,backgroundColor:Ut.string})),fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),onChange:Ut.func}),Ut.func,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.shape({current:Ut.number,pageSize:Ut.number,pageSizeOptions:Ut.array,showSizeChanger:Ut.bool,showQuickJumper:Ut.bool}),Ut.shape({fileName:Ut.string,fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object}),beforeExport:Ut.func,cellStyle:Ut.bool,hideIcon:Ut.bool}),Ut.shape({showLogo:Ut.bool}),Ut.shape({fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),fieldList:Ut.arrayOf(Ut.object)}),Ut.shape({position:Ut.oneOf(["top","bottom"]),hideAlert:Ut.bool,hideClearButton:Ut.bool}),Ut.oneOf(["left","right"]),Ut.func,Ut.func,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func;const zo={columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0},Wo=10,Bo="1",Uo="0",Go="YYYY-MM-DD",Yo="YYYY-MM-DD HH:mm:ss",Xo="YYYYMMDDHHmmss",Qo={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Zo;!function(e){e.left="flex-start",e.right="flex-end"}(Zo||(Zo={}));const Jo=Object.assign({},e).useId;let es=0;var ts=Jo?function(e){const t=Jo();return e||t}:function(t){const[n]=e.useState(`qm_unique_${es}`);return e.useEffect((()=>{es+=1}),[]),t||n};let ns=[];const rs={_getInstance:function(e){var t;return null!==(t=ns.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=ns[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==ns.findIndex((e=>e===t))&&(this.deregister(e),ns=[t,...ns])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),ns=[{id:e,vm:t},...ns])},deregister:function(e){e&&(ns=ns.filter((t=>t.id!==e)))}};class is{constructor(){this.state={required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]},this.addToRequired=e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)},this.removeFromRequired=e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)},this.addToValidate=e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)},this.removeFromValidate=e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)},this.addToEdited=e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)},this.removeFromEdited=e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)},this.addToInserted=e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)},this.removeFromInserted=e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)},this.addToUpdated=e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)},this.removeFromUpdated=e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)},this.addToRemoved=e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)},this.removeFromRemoved=e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)},this.clearAllLog=()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]}}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}const ls={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollX:50,virtualScrollY:100,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored",popupClassName:"table-editable__popper"};function as(e){return void 0!==e}function os(t,n){const{defaultValue:r,value:i,onChange:l,postState:a}=n||{},[o,s]=e.useState((()=>as(i)?i:as(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=as(i)?i:o,d=a?a(c):c,u=Hn(l),[m,h]=e.useState([c]);pn((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),pn((()=>{as(i)||s(i)}),[i]);return[d,Hn((e=>{s(e),h([c])}))]}const ss=e=>e.map((e=>{const t=Object.assign({},e);return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=ss(t.children)),t})),cs=(e,n)=>{const{fetch:r,columns:i,border:l,rowSelection:a,summation:o,expandable:s,treeConfig:c,webPagination:d,scrollPagination:u,showSuperSearch:m,showFastSearch:h,showGroupSummary:p,showTableImport:f,showClipboard:g,showSelectCollection:v,showPivotGrid:y,footRender:b}=e,{tableRef:x,getRowKey:E,tableFullData:w,tableFlatData:C,updateMark:S,selectionKeys:N,sorter:T,filters:I,superFilters:R,pagination:O,mergedTdCells:k}=n,{selectionRows:L,summaries:A}=x.current,{expandIconColumn:P=""}=c||{},{t:_}=Mn(),F=e=>{const t=(e=>{const t=[],n=[],r=[];for(let i=0;i<e.length;i++){const l=e[i];"left"===l.fixed?t.push(l):"right"===l.fixed?n.push(l):r.push(l)}return[...t,...r,...n]})(ss(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:ls.selectionColumn,title:"radio"===t?_("qm.table.config.selectionText"):"",width:ls.selectionColumnWidth,fixed:"left",type:t}})(a),r=(null==(i=s)?void 0:i.expandedRowRender)?{dataIndex:ls.expandableColumn,title:"",width:ls.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),ea(t)},D=(e,t,n,r,i)=>{const l=`${t},${n}`;e.has(l)||e.set(l,{row:t,col:n,rowSpan:r,colSpan:i})},M=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),H=t.useMemo((()=>!M&&!!d),[M,d]),$=t.useMemo((()=>M&&!!u),[M,u]),q=t.useMemo((()=>(M||H)&&!$),[M,H,$]),j=t.useMemo((()=>F(i)),[i]),K=t.useMemo((()=>Jl(j)),[j]),V=t.useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),z=t.useMemo((()=>K.filter((e=>!!e.summation))),[K]),W=t.useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),B=t.useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),U=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=C.findIndex((t=>E(t,t.index)===e.rowKey)),r=K.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){D(t,n,r,e.rowSpan,e.colSpan);for(let i=0;i<e.rowSpan;i++)for(let l=0;l<e.colSpan;l++)0===i&&0===l||D(t,n+i,r+l,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(k)),[k,K,w]),G=t.useMemo((()=>{var e,t;const n=K.filter((e=>![ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(e.dataIndex)));return P&&n.some((e=>e.dataIndex===P))?P:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[K,P]),Y=t.useMemo((()=>z.length>0),[z]),X=t.useMemo((()=>!!b||Y),[b,Y]),Q=t.useMemo((()=>da(j).length>1),[j]),Z=t.useMemo((()=>l||Q),[l,Q]),J=t.useMemo((()=>K.some((e=>e.sorter))),[K]),ee=t.useMemo((()=>K.some((e=>e.filter))),[K]),te=t.useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),ne=t.useMemo((()=>!M&&!!f),[M,f]),re=t.useMemo((()=>!!g&&V.length>0),[g,V]),ie=t.useMemo((()=>!!v&&"checkbox"===(null==a?void 0:a.type)),[v,a]),le=t.useMemo((()=>!!m&&ee),[m,ee]),ae=t.useMemo((()=>!M&&!!h),[M,h]),oe=t.useMemo((()=>!M&&!!y),[M,y]),se=t.useMemo((()=>!!p&&K.some((e=>!!e.groupSummary))),[K]),ce=t.useMemo((()=>{var e;return!!(null===(e=null==o?void 0:o.groupItems)||void 0===e?void 0:e.length)}),[o]),de=t.useMemo((()=>!C.length),[C]),ue=t.useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:l}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=l,c=ce?Ra(x.current.tableFullData):x.current.tableFullData,d=!L.length&&!!o;let u=(!a||d?c:L).reduce(((e,t)=>{if(null==t?void 0:t[ls.summaryIgnore])return e;const r=va(t,n);return xa(r)?e.plus(r):e}),new Yt(0));!Object.keys(A).includes(n)||a&&!d||(u=new Yt(va(A,n))),ya(e,n,u.toNumber());let m=r>=0?u.toFixed(r):u.toString();i>=0&&""!==m&&(m=wa(m,i)),m=Ea(m),ya(e,`${n}_text`,s?`${m} ${s}`:m)})),[e]})()),[C,S,N,A]),me=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),he=t.useMemo((()=>{var e;const t=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(T),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,i]=t.split("|"),l=e[t];Object.keys(l).forEach((e=>{n.push({type:["radio","tree"].includes(i)?"checkbox":i,bracketLeft:"",fieldName:r,expression:e,value:$a(e)?null:l[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{const t=e.fieldType;n.push({type:["radio","tree"].includes(t)?"checkbox":t,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:$a(e.expression)?null:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(I,R),i=t?{[ls.sorterFieldName]:t}:null,l=n.length?{[ls.filterFieldName]:n}:null,a=me?{[ls.groupSummary.summaryFieldName]:me,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[ls.currentPageName]:O.current,[ls.pageSizeName]:O.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),l),a),o),s)}),[null==r?void 0:r.params,O.current,O.pageSize,T,I,R,me]);return{isFetch:M,isWebPagination:H,isScrollPagination:$,showPagination:q,tableColumns:j,flattenColumns:K,editableColumns:V,summationColumns:z,leftFixedColumns:W,rightFixedColumns:B,derivedMergeCells:U,treeExpandIndex:G,showSummary:Y,showFooter:X,isHeadGroup:Q,bordered:Z,isHeadSorter:J,isHeadFilter:ee,isServiceSummation:te,isSelectCollection:ie,isTableImport:ne,isTableClipboard:re,isSuperSearch:le,isFastSearch:ae,isPivotGrid:oe,isGroupSummary:se,isGroupSubtotal:ce,isTableEmpty:de,summationRows:ue,fetchParams:he}},ds=(e,n)=>{const{rowKey:r,height:i,dataSource:l,summation:a,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:h,ignorePageIndex:p,columnsChange:f,onChange:g,onDataChange:v,onDataLoad:y,onScrollEnd:b,onFetchError:x}=e,{getRowKey:E,tableRef:w,tableElementRef:C,tableBodyRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,pagerFilter:_,fetchParams:F,selectionKeys:D,rowExpandedKeys:M,highlightKey:H,summationColumns:$,isFetch:q,isWebPagination:j,isScrollPagination:K,isServiceSummation:V,isGroupSubtotal:z,doLayout:W,setTableFullData:B,setTableOriginData:U,setTableFlatData:G,setTableDataMaps:Y,setDeriveRowKeys:X,setPagination:Q,setPingRight:Z,setPingLeft:J,setSpinning:ee,setSorter:te,setFilters:ne,setSuperFilters:re,setPagerFilter:ie,setSelectionKeys:le,setRowExpandedKeys:ae,setHighlightKey:oe,setSelectionRows:se,setFilteredTreeData:ce,setScrollXLoad:de,setScrollYLoad:me,setFieldAuth:he,setResizeState:pe,setSummaries:fe,setPermission:ge,resetTableScroll:ye,clearElementStore:be}=n,{t:xe}=Mn(),{store:Ee}=w.current,we=t.useRef(Object.assign({},F)),Ce=t.useRef(!1),Se=sl(C);pn((()=>{ke(),W()}),[T]),pn((()=>{Ne()}),[Se.width,Se.height,N,i,k.tableAutoHeight]),Hi((()=>{it(),lt(),at(),ot(),q||(j&&Ze(),Be(l)),s&&te(s),c&&ne(c)}),[l,null==o?void 0:o.params]),Hi((()=>{const e=je(F,we.current);e||q&&(null==d?void 0:d.clearableAfterFetched)&&st(),!e&&F[ls.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Ze():q&&ze(),we.current=F}),[F]),Hi((()=>{j&&tt(),K||ye(),He()}),[O.current,O.pageSize]),Hi((()=>{q||Ie(R.length),W()}),[R]),Hi((()=>{w.current.isTreeTable&&tt()}),[M]);const Ne=()=>{const{scrollBarRef:e,resizeState:t}=w.current,{width:n,height:r}=Se;W(),k.tableBodyWidth>n&&Z(!0),e.current.scrollLeft>0&&J(!0),pe(Object.assign({},t,{width:n,height:r}))},Te=()=>{H&&S.current.setClickedValues([H,""]),"radio"===(null==d?void 0:d.type)&&D.length&&S.current.setClickedValues([D[0],""])},Ie=e=>{e!==O.total&&Q((t=>Object.assign({},t,{total:e})))},Re=e=>{Ce.current=e},Oe=cl((e=>{Ye(),null==b||b(e)})),ke=()=>{de(I.length>ls.virtualScrollX)},Le=(e=[])=>{let t=e.length>ls.virtualScrollY;w.current.isTreeTable&&(t=!0),(null==m?void 0:m.virtual)&&(t=!0),me(t)},Ae=e=>z?Pe(_e(e,0)):e,Pe=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Pe(e.children)),delete e.children,t.push(e)})),t},_e=(e,t)=>{var n;const i=null===(n=a.groupItems)||void 0===n?void 0:n[t];if(!i)return e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e;return La(e,[i.dataIndex]).map((e=>{const n={children:_e(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&ya(n,r.toString(),Na()),i.titleIndex&&ya(n,i.titleIndex,va(e[0],i.titleIndex)),ya(n,i.dataIndex,va(e[0],i.dataIndex)),$.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[ls.summaryIgnore])return e;const n=Number(va(t,r));return Number.isNaN(n)?e:e+n}),0);ya(n,r,i)})),n}))},Fe=e=>{le(e),se((e=>{const{selectionRows:t,recordsMap:n}=w.current,r=new Map;t.forEach((e=>r.set(E(e,e.index),e)));const i=[];for(let t=0,l=e.length;t<l;t++){const l=r.get(e[t])||n.get(e[t]);l&&i.push(l)}return i})(e))},De=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let i=[];return w.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:l}=w.current,a=oa(i,e);let o=[];if(!a)return o;let s=Fa((null==a?void 0:a.children)||[]);return r&&(s=s.filter((e=>!l.has(e)||!r(l.get(e))))),o=[...new Set([...t,...s])],((null===(n=Pa(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=oa(i,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,r))})),i="radio"===t?r.slice(0,1):[...new Set([...r,...i])],i},Me=()=>{const{isTreeTable:e,deriveRowKeys:t,recordsMap:n}=w.current;return e?ca(t,(e=>e.rowKey)):Array.from(n.keys())},He=cl((()=>{null==g||g(O,qe(L),$e(A),P,{currentDataSource:et()})})),$e=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},qe=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},je=(e,t)=>{const n=Object.keys(ga(e,t));return 1===n.length&&(n.includes(ls.currentPageName)||n.includes(ls.pageSizeName))},Ke=()=>Dn(void 0,void 0,void 0,(function*(){var t;if(!h)return;let n=Xn(h,["fetch"]);if(h.fetch){const{api:e,params:r,dataKey:i}=h.fetch;try{const l=yield e(r);200===l.code&&(n=null!==(t=i?ue(l.data,i):l.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;ge((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=na(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:i,secretName:l}=r,a=ra(w.current.originColumns,t);he(t,{visible:n,disabled:i,secretName:l}),n||(e.noAuth=!0,a.noAuth=!0),l&&(e.formatType=`secret-${l}`,a.formatType=`secret-${l}`)}}));null==f||f(t)}})),Ve=Hn((()=>Dn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=zn,afterFetch:l,callback:s}=o;if(!i(F))return;const c=!!(null===(e=null==a?void 0:a.fetch)||void 0===e?void 0:e.api);ee(!0);try{const[e,i]=c?yield Promise.all([o.api(r(F)),a.fetch.api(r(F))]):[yield o.api(r(F))];if(w.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:ls.dataKey;let a=null!==(n=ue(e.data,r))&&void 0!==n?n:[];a="function"==typeof l?yield l(a):a;const c=ue(e.data,r.replace(/[^.]+$/,ls.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(F[ls.currentPageName]>d)return Xe(Object.assign(Object.assign({},O),{current:d}));Be(Ce.current?w.current.tableFullData.concat(a):a),Ie(c),Ue((null==i?void 0:i.data)||e.data),null==s||s(e.data,e)}}catch(e){null==x||x(e)}var d,u;d=o,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(o.stopToFirst=!1),ee(!1),Re(!1)})))),ze=cl(Ve),We=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=We(e.children)),e.index=t,p||(e.pageIndex=(e=>{const{current:t,pageSize:n}=O;return!q||K?e:(t-1)*n+e})(t)),e))),Be=e=>{const t=Ae(We(e));nt(t),rt(t),Fe(De()),ae((e=>{const{isTreeTable:t,deriveRowKeys:n,recordsMap:r}=w.current,{defaultExpandAllRows:i,rowExpandable:l,expandedRowRender:a}=u||{};let o=Array.isArray(e)?e:[...M];if(i)o=Me();else if(t){a&&tr("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];H&&e.unshift(H),e.forEach((e=>{const t=Pa(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=[...new Set(o)]}return l&&o.filter((e=>{const t=r.get(e);return!!t&&l(t)})),o})()),Ge(),null==y||y(t)},Ue=e=>{var t,n,r;if(!V)return;const i=null!==(n=null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:ls.summationKey,l=null!==(r=i?ue(e,i):e)&&void 0!==r?r:{},o={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{ya(o,e.dataIndex,Number(va(l,e.summation.dataKey)))})),fe(o)},Ge=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);Fe([t])}else Fe([])}},Ye=()=>{if(!K)return;const e=Qe();Ce.current||O.current>=e||(Re(!0),Xe(Object.assign(Object.assign({},O),{current:O.current+1})))},Xe=({current:e,pageSize:t})=>{Q((n=>Object.assign({},n,{current:e,pageSize:t})))},Qe=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Ze=()=>{Xe(Object.assign({},O,{current:1}))},Je=()=>{const{current:e,pageSize:t}=O;return w.current.tableFullData.slice((e-1)*t,e*t)},et=()=>j?Je():w.current.tableFullData,tt=()=>{const{recordsMap:e,isTreeTable:t}=w.current,n=j?sa(Je()):Array.from(e.values());let r=qa(n,_,t);t&&(ce(r),r=(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=E(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);M.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(r)),Le(r),G(r)},nt=e=>{B(e),Y(e),X(e),tt()},rt=e=>{U(e)},it=()=>{te({})},lt=()=>{ne({})},at=()=>{re([])},ot=()=>{ie({})},st=()=>{Fe([])};return{initialTable:()=>{Ke(),Te(),ke(),Le(),q?Ve():Be(l)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&tr("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,createWebPageData:Je,getTableData:Ve,createTableData:Be,createTableFlatData:tt,createGroupData:Ae,createAllExpandedKeys:Me,setSelectionKeysEffect:Fe,doFieldValidate:(e,t,n,r,i)=>{if(!Array.isArray(e))return tr("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ee.removeFromRequired({x:n,y:r}),Ee.removeFromValidate({x:n,y:r}),e.forEach((e=>{var l;e.required&&Gn(t)&&Ee.addToRequired({x:n,y:r,text:e.message||i+xe("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(l=e.validator)||void 0===l?void 0:l.call(e,t))||Ee.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=Ee.state,l=ve(n,i),a=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:a(e),validate:a(t),inserted:n.filter((e=>!l.includes(e))),updated:r.filter((e=>![...ve(r,n),...ve(r,i)].includes(e))),removed:i.filter((e=>!l.includes(e)))}},dataChange:()=>{null==v||v(w.current.tableFullData)},tableChange:He,toLastPage:()=>{const e=Qe();O.current!==e&&Xe(Object.assign({},O,{current:e}))},toFirstPage:Ze,getPageCount:Qe,pagerChangeHandle:Xe,scrollBottomDebouncer:Oe,clearTableSorter:it,clearTableFilter:lt,clearSuperFilters:at,clearPagerFilter:ot,clearRowSelection:st,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{Ee.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;be(),Ee.destroy(),e.deregister(t)}}},us=(e,n)=>{const{height:r,minHeight:i,maxHeight:l,ellipsis:a,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:m,tableBodyRef:h,$size:p,tableColumns:f,flattenColumns:g,leftFixedColumns:v,derivedMergeCells:y,tableFlatData:b,layout:x,showFooter:E,showPagination:w,isFullScreen:C,setLayout:S,setElementStore:N}=n,T=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,n={};return i&&Object.assign(n,{minHeight:`${fa(i)}px`}),l&&Object.assign(n,{maxHeight:`${fa(l)}px`}),C?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${fa(r)}px`:`${t}px`}):n}),[r,l,i,C,x]),I=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r,rowHeight:i}=d.current;if(void 0!==t&&t>=0)if(t<b.length)if(r)h.current.scrollToYIndex(t);else{const e=R(c(b[t],b[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*i);else if(r){const t=b.findIndex((t=>e===c(t,t.index)));t>=0&&h.current.scrollToYIndex(t)}else{const t=R(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},R=e=>d.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{N("$toper",u.current),N("$table",m.current)},tableStyles:T,getSpan:(e,t,n,r,i)=>{let l=1,a=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(o)?(l=o[0],a=o[1]):ae(o)&&(l=o.rowSpan,a=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,a=e.colSpan)}return{rowSpan:l,colSpan:a}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=ra(f,e);e=t?ia(t).dataIndex:""}let t=0;for(let n=0;n<g.length;n++){const r=g[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=ra(f,e);e=t?la(t).dataIndex:""}const n="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let n=[];return e.forEach((e=>{e.colSpan>0&&n.length>0&&(t.push(n),n=[]),n.push(e)})),n.length>0&&t.push(n),t.map((e=>{const[t,n]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...n,...t.reverse()]})).flat()})(g):g;let r=0;for(let t=n.length-1;t>=0;t--){const i=n[t];if(i.dataIndex===e)break;r+=i.width||i.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?g.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=d.current,i=v.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(l-i)},scrollYToRecord:I,calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(w?jo["small"!==p?"middle":p]+Wo:0)-Wo;S((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{I("",0)},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=ls,i=[];let l=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,l+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=g.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||r)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;i.forEach(((t,i)=>{if(0===i)return;const l=Math.floor((t.minWidth||r)*e);n+=l,t.renderWidth=(t.minWidth||r)+l})),i[0].renderWidth=(i[0].minWidth||r)+t-n}}else i.forEach((e=>{e.renderWidth=e.minWidth||r}));S((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else l=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>Object.assign(Object.assign({},e),{tableBodyWidth:l})));S((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&h.current.resetItemXSize(g)})(),Bn((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,i=o?e.$header.offsetHeight:x.headerHeight,l=E?e.$footer.offsetHeight:x.footerHeight,a=r-i-l,s=e.$tableBody.offsetHeight;let c=0;if(C){const t=e.$toper?e.$toper.offsetHeight+Wo:0,r=e.$pager?e.$pager.offsetHeight+Wo:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:i,footerHeight:l,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function ms({handler:t,delay:n=0}){const r=Rl(t,n),i=Hn(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i))),[i])}const hs=e=>{const{total:n}=e,{tableRef:r,prefixCls:i,selectionKeys:l,isHeadSorter:a,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearPagerFilter:u,clearRowSelection:m,clearRowHighlight:h,setActivedCell:p}=t.useContext(Ko),{infoBarConfig:f,rowSelection:g,rowHighlight:v}=r.current.props,{isTreeTable:y,recordsMap:b,invalidRowKeys:x}=r.current,{hideAlert:E,hideClearButton:w}=f||{},{t:C}=Mn(),[S,N]=t.useState(l.length-x.length);t.useEffect((()=>{Bn((()=>N(l.length-x.length)))}),[l,x]);const T=t.useMemo((()=>!E),[E]),I=t.useMemo((()=>!w&&!!(a||o||g||v)),[w,a,o,g,v]),R={[`${i}__alert`]:!0};return T?t.createElement("div",{className:Pe(R)},t.createElement("i",{className:"svgicon icon"},t.createElement(Ue,null)),t.createElement("span",null,C("qm.table.alert.total",{total:y?b.size:n}),g?`,${C("qm.table.alert.selected",{total:Math.max(S,0)})}`:""),I&&t.createElement("em",{onClick:()=>{c(),d(),u(),m(),h(),Bn((()=>s())),p({})}},C("qm.table.alert.clear"))):null},ps=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:l,setFullScreen:a}=t.useContext(Ko),{t:o}=Mn(),s=()=>{a(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),i?t.createElement("span",{className:`${l}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(Ve,null):t.createElement(ze,null))):null}));ps.displayName="FullScreen";const fs=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:l}=t.useContext(Ko),{t:a}=Mn(),o=()=>{l()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${i}-reload`,title:a("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ge,null))):null}));fs.displayName="Reload";const gs=()=>{const e={dateFormat:e=>{const t=e?h(e).format(Go):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?h(e).format(Yo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?h(e).format(Yo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>xa(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Ea(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},t=(t,n,r)=>{var i,l,a,o;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:m}=n,h=s||(null===(i=null==m?void 0:m(r,n))||void 0===i?void 0:i.items)||[];let p=null!==(o=null!==(a=null===(l=h.find((e=>e.value==t)))||void 0===l?void 0:l.text)&&void 0!==a?a:t)&&void 0!==o?o:"";if(Array.isArray(t)&&(p=t.map((e=>{var t,n;return null!==(n=null===(t=h.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),c>=0&&""!==p&&(p=xa(p)?new Yt(p).toFixed(c):p),d>=0&&""!==p&&(p=wa(p,d)),u){const t=e[`${Un(u)}Format`];t?p=t(p):tr("Table","字段的格式化类型 `formatType` 配置不正确")}return p},n=e=>jn(e)?Ta(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,l)=>{const a=va(e,r.dataIndex),o=r.render?r.render(a,e,r,i,l):t(a,r,e);return n(o)}}},vs=t.forwardRef(((e,n)=>{var r,i,l,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(on),{tableRef:d,prefixCls:u,flattenColumns:m,summationRows:h,showSummary:p,getSpan:f}=t.useContext(Ko),{tablePrint:g,showHeader:v}=d.current.props,{t:y}=Mn(),{getTitleFromCellValue:b}=gs(),x=null!==(i=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==i?i:"",E=null!==(a=null===(l=null==c?void 0:c.print)||void 0===l?void 0:l.rightLogo)&&void 0!==a?a:"",w=!(!x&&!E),C=t.useMemo((()=>Qn(aa(o,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn]))),[o]),S=t.useMemo((()=>Qn(aa(m,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn]))),[m]),N=t.useMemo((()=>Qn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},Aa(C,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?T(t):t},I=(e,t)=>ye(be(xe(e),t),Ee(((...e)=>we(...e,((e,n)=>{if(Array.isArray(e))return I(e.concat(n),t)}))))),R=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(T(e))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const n=e.filter((e=>e.dataIndex===t));return n.length<=1?n[0]:I(n,"dataIndex")[0]})))(n),t.push(da(n))})),t},O=()=>{const e=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const l=e[i];r+=l.width||l.renderWidth,r<=ls.printWidth?(n.push(l),i===e.length-1&&t.push(n),i++):i>0?(e.splice(0,i),N.length&&e.unshift(...N),t.push(n),n=[],r=0,i=0):(l.width=ls.printWidth,n.push(l),t.push(n),i++)}return t})([...S]),t=R(e);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let r=0;r<e.length;r++)n+=k(t[r],e[r],d.current.tableFullData),n+='<div class="page-break"></div>';return n+"</body></html>"},k=(e,t,n)=>{const{showLogo:r=!0}=g;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,v&&(i+=["<thead>",r&&w?`<tr><th colspan="${t.length}" style="border: 0">${['<table class="no-border" width="100%" border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td width="50%" align="left">',x?`<img src="${x}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',E?`<img src="${E}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Ia(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${sa(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:l}=f(e,t,e.index,r,n);if(!i||!l)return null;return`<td rowspan="${i}" colspan="${l}">${0===r&&e._level?`<span style="padding-left:${e._level*ls.treeTable.textIndent}px"></span>`:""}${b(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),p&&h.length&&(i+=["<tfoot>",h.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:i,summation:l}=t,a=(null==l?void 0:l.render)?l.render(n):va(e,`${i}_text`);return`<td>${0===r&&""===a?y("qm.table.config.summaryText"):jn(a)?Ta(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},L=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:i}=e,l=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!i)return Promise.resolve({type:r,content:t,blob:e});wl(e,l)}})({filename:"print",type:"html",isDownload:!1},O()))||void 0===e||e.then((({content:e,blob:t})=>{let n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),d.current.isIE?(n.contentDocument.write(e),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(t))}))};return t.useImperativeHandle(n,(()=>({clickHandle:L}))),s?t.createElement("span",{className:`${u}-print`,title:y("qm.table.print.text"),onClick:()=>L()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ye,null))):null}));vs.displayName="TablePrint";const ys="606060",bs="thin",xs="d4d4d4",Es=(e,t)=>{t&&(e.height=Math.floor(.75*t))},ws=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Cs=()=>({top:{style:bs,color:{argb:xs}},left:{style:bs,color:{argb:xs}},bottom:{style:bs,color:{argb:xs}},right:{style:bs,color:{argb:xs}}}),Ss=e=>{const{children:t}=e;return t&&t.length?Ss(t[0]):e},Ns=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Ts=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(Ko),{spanMethod:l,showHeader:a}=e.current.props,{t:o}=Mn(),s=(e,t)=>{var n,r,i;return null!==(i=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==i?i:""};return{exportXLSX:(t,s,c,d)=>Dn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:m}=t,{rowHeight:h}=e.current,p=Jl(u),f=da(u),g=[],v=[],y=[],b=[];let x=0;const E={};p.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=Ia(e.title),y.push({key:t,width:(n||r||ls.defaultColumnWidth)/8})})),a&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,l=Ss(e),a=p.findIndex((({dataIndex:e})=>e===l.dataIndex));n[l.dataIndex]=Ia(e.title),0!==r&&(r>1||i>1)&&b.push({s:{r:t,c:a},e:{r:t+i-1,c:a+r-1}})})),g.push(n)})):(p.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&b.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),g.push(E)),x+=g.length);const w=sa(s).map(((e,t)=>{const r={};return p.forEach(((i,a)=>{if("function"==typeof l){const{rowSpan:r,colSpan:l}=n(e,i,t,a,s);(l>1||r>1)&&b.push({s:{r:t+x,c:a},e:{r:t+x+r-1,c:a+l-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?va(e,i.dataIndex):d(e,t,i,a)})),r._level=e._level,r}));x+=w.length,r&&m&&c(p,s).forEach(((e,t)=>{const n={};p.forEach(((t,r)=>{const{dataIndex:i,summation:l}=t,a=(null==l?void 0:l.render)?l.render(s):va(e,i);n[i]=0===r&&""===a?o("qm.table.config.summaryText"):jn(a)?Ta(a).join(""):a})),v.push(n)}));const{sheetName:C,useStyle:S}=t,N=new Xt.Workbook,T=N.addWorksheet(C);T.columns=y,a&&T.addRows(g).forEach((e=>{S&&Es(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=ra(u,t.key),{align:r,theadAlign:i}=n;ws(e,i||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:ys}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Cs()})}))})),T.addRows(w).forEach(((e,t)=>{const{_level:n}=w[t];S&&Es(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),r=ra(u,t.key),{align:i}=r;ws(e,i),Object.assign(e,Ns(r)),S&&Object.assign(e,{font:{color:{argb:ys}},border:Cs()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),r&&m&&T.addRows(v).forEach((e=>{S&&Es(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=ra(u,t.key),{align:r}=n;ws(e,r),Object.assign(e,Ns(n)),S&&Object.assign(e,{font:{color:{argb:ys}},border:Cs()})}))})),b.forEach((({s:e,e:t})=>{T.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const I=yield N.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})})),exportCSV:(e,t)=>{const n="\ufeff"+(e=>Array.from(e.rows).map((e=>Array.from(e.cells).map((e=>{var t,n;return((e,t)=>{const n=e.replace(/"/g,'""');return"string"===t?`"=""${n}"""`:"number"===t?n:n.includes(",")||n.includes("\r")||n.includes("\n")?`"${n}"`:n})(null!==(n=null===(t=e.textContent)||void 0===t?void 0:t.trim())&&void 0!==n?n:"",e.getAttribute("data-type"))})).join(","))).join("\r\n"))((e=>{const t=document.createElement("div");t.innerHTML=e.trim();const n=t.querySelector("table");if(!n)throw new Error("Invalid table HTML input.");return n})(t));return new Blob([n],{type:"text/csv;charset=utf-8"})},importXLSX:(e,t)=>{const{columns:n,file:r}=e,i=Jl(n),l=new FileReader;l.onerror=()=>{R.error(o("qm.table.import.error"))},l.onload=e=>{const n=i.map((e=>Ia(e.title))),r=new Xt.Workbook,l=e.target;l?r.xlsx.load(l.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),l=e.findIndex((e=>e&&e.length>0)),a=e[l],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,a);if(c){const r=e.slice(l+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let i=e;Array.isArray(null==i?void 0:i.richText)&&(i=i.richText.map((e=>e.text)).join("")),ae(i)&&"text"in i&&(i=i.text),Ce(i)&&(i=Sa(i,Yo)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[a[n]]=i}));const r={};return n.forEach(((e,n)=>{var l;const{dataIndex:a,dictItems:o}=i[n];Array.isArray(o)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>s(o,e))).filter((e=>""!==e)):t[e]=s(o,t[e])),ya(r,a,t[e])})),r}));null==t||t(r)}else R.error(o("qm.table.import.error"))}else R.error(o("qm.table.import.error"))})):R.error(o("qm.table.import.error"))},l.readAsArrayBuffer(r)}}},Is=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(Ko),{t:l}=Mn();let a,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}},c=()=>Dn(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),o=document.createElement("input"),a.className=`${i}--file-form`,o.name="file",o.type="file",a.appendChild(o),document.body.appendChild(a)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=i=>{const{files:c}=i.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(R.warning(l("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(a),a=null,o=null},a.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(nr,{onClick:()=>c()},l("qm.upload.text"))},Rs=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:l,createTableData:a,dataChange:o}=t.useContext(Ko),{beforeTableImport:s}=i.current.props,{t:c}=Mn(),{importXLSX:d}=Ts(),u=t.useRef(null),[m,h]=t.useState(!1),[p,f]=t.useState(!0),g=e=>e.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex))),v={posIndex:"条"},[y,b]=t.useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,n)=>{const{fileName:r}=n.GET_FIELDS_VALUE(["fileName"]);return t.createElement(t.Fragment,null,r?t.createElement("span",null,r):t.createElement(Is,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&f(!1)}}))}},{type:"SELECT",label:c("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:c("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:c("qm.table.import.fillText"),value:"fill"},{text:c("qm.table.import.addText"),value:"add"},{text:c("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{y.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(v),b([...y])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:i.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return t.createElement("div",{className:`${l}-import__setting`},t.createElement(Tp,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:v,items:y,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(nr,{type:"primary",loading:m,disabled:p,onClick:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||(h(!0),d({columns:g(n),file:t.file},(e=>Dn(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:l}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&a(e),"add"===t.importType&&a([...n,...e]),"insert"===t.importType){const r=t.posIndex,i=n.slice(0,r).concat(e).concat(n.slice(r));a(i)}e.forEach((e=>{l.addToInserted(e)})),o(),R.success(c("qm.table.import.success",{total:e.length})),h(!1),r()})))))}))},c("qm.table.import.text"))))},Os=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,{prefixCls:l}=t.useContext(Ko),{t:a}=Mn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${l}-import`]:!0},u={visible:o,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:Pe(d),title:a("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(Xe,null))),t.createElement(Ml,u,t.createElement(Rs,{columns:r,onClose:()=>s(!1)})))}));function ks(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}function Ls(e,t,n,r){var i=Mt.unstable_batchedUpdates?function(e){Mt.unstable_batchedUpdates(n,e)}:n;return null!=e&&e.addEventListener&&e.addEventListener(t,i,r),{remove:function(){null!=e&&e.removeEventListener&&e.removeEventListener(t,i,r)}}}Os.displayName="TableImport";var As=u((function(e,t){var n=e.didUpdate,r=e.getContainer,i=e.children,a=l(),s=l();m(t,(function(){return{}}));var c=l(!1);return!c.current&&Gr()&&(s.current=r(),a.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==a.current&&a.current.appendChild(s.current),function(){var e;null===(e=s.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(s.current)}}),[]),s.current?Mt.createPortal(i,s.current):null}));function Ps(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var _s;function Fs(e){var t=e.prefixCls,n=e.motion,r=e.animation,i=e.transitionName;return n||(r?{motionName:"".concat(t,"-").concat(r)}:i?{motionName:i}:null)}function Ds(t){var n=t.prefixCls,r=t.visible,i=t.zIndex,l=t.mask,a=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!l)return null;var c={};return(a||s||o)&&(c=fr({motionAppear:!0},Fs({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(Si,Ni({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:i},className:Pe("".concat(n,"-mask"),r)})}))}function Ms(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ms(Object(n),!0).forEach((function(t){qs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ms(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $s(e){return $s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$s(e)}function qs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var js={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function Ks(){if(void 0!==_s)return _s;_s="";var e=document.createElement("p").style;for(var t in js)t+"Transform"in e&&(_s=t);return _s}function Vs(){return Ks()?"".concat(Ks(),"TransitionProperty"):"transitionProperty"}function zs(){return Ks()?"".concat(Ks(),"Transform"):"transform"}function Ws(e,t){var n=Vs();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Bs(e,t){var n=zs();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var Us,Gs=/matrix\((.*)\)/,Ys=/matrix3d\((.*)\)/;function Xs(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Qs(e,t,n){var r=n;if("object"!==$s(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):Us(e,t);for(var i in t)t.hasOwnProperty(i)&&Qs(e,i,t[i])}function Zs(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var i=e.document;"number"!=typeof(n=i.documentElement[r])&&(n=i.body[r])}return n}function Js(e){return Zs(e)}function ec(e){return Zs(e,!0)}function tc(e){var t=function(e){var t,n,r,i=e.ownerDocument,l=i.body,a=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=a.clientLeft||l.clientLeft||0,top:r-=a.clientTop||l.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=Js(r),t.top+=ec(r),t}function nc(e){return null!=e&&e==e.window}function rc(e){return nc(e)?e.document:9===e.nodeType?e:e.ownerDocument}var ic=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),lc=/^(top|right|bottom|left)$/,ac="currentStyle",oc="runtimeStyle",sc="left";function cc(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function dc(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function uc(e,t,n){"static"===Qs(e,"position")&&(e.style.position="relative");var r=-999,i=-999,l=cc("left",n),a=cc("top",n),o=dc(l),s=dc(a);"left"!==l&&(r=999),"top"!==a&&(i=999);var c,d="",u=tc(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[Vs()]||"",Ws(e,"none")),"left"in t&&(e.style[o]="",e.style[l]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[a]="".concat(i,"px")),Xs(e);var m=tc(e),h={};for(var p in t)if(t.hasOwnProperty(p)){var f=cc(p,n),g="left"===p?r:i,v=u[p]-m[p];h[f]=f===p?g+v:g-v}Qs(e,h),Xs(e),("left"in t||"top"in t)&&Ws(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=cc(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}Qs(e,y)}function mc(e,t){var n=tc(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(zs());if(n&&"none"!==n){var r=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(r[12]||r[4],0),y:parseFloat(r[13]||r[5],0)}}return{x:0,y:0}}(e),i={x:r.x,y:r.y};"left"in t&&(i.x=r.x+t.left-n.left),"top"in t&&(i.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(zs());if(r&&"none"!==r){var i,l=r.match(Gs);l?((i=(l=l[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,Bs(e,"matrix(".concat(i.join(","),")"))):((i=r.match(Ys)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,Bs(e,"matrix3d(".concat(i.join(","),")")))}else Bs(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function hc(e,t){for(var n=0;n<e.length;n++)t(e[n])}function pc(e){return"border-box"===Us(e,"boxSizing")}"undefined"!=typeof window&&(Us=window.getComputedStyle?function(e,t,n){var r=n,i="",l=rc(e);return(r=r||l.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[ac]&&e[ac][t];if(ic.test(n)&&!lc.test(t)){var r=e.style,i=r[sc],l=e[oc][sc];e[oc][sc]=e[ac][sc],r[sc]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[sc]=i,e[oc][sc]=l}return""===n?"auto":n});var fc=["margin","border","padding"],gc=-1,vc=2,yc=1;function bc(e,t,n){var r,i,l,a=0;for(i=0;i<t.length;i++)if(r=t[i])for(l=0;l<n.length;l++){var o=void 0;o="border"===r?"".concat(r).concat(n[l],"Width"):r+n[l],a+=parseFloat(Us(e,o))||0}return a}var xc={getParent:function(e){var t=e;do{t=11===t.nodeType&&t.host?t.host:t.parentNode}while(t&&1!==t.nodeType&&9!==t.nodeType);return t}};function Ec(e,t,n){var r=n;if(nc(e))return"width"===t?xc.viewportWidth(e):xc.viewportHeight(e);if(9===e.nodeType)return"width"===t?xc.docWidth(e):xc.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],l="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=pc(e),o=0;(null==l||l<=0)&&(l=void 0,(null==(o=Us(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?yc:gc);var s=void 0!==l||a,c=l||o;return r===gc?s?c-bc(e,["border","padding"],i):o:s?r===yc?c:c+(r===vc?-bc(e,["border"],i):bc(e,["margin"],i)):o+bc(e,fc.slice(r),i)}hc(["Width","Height"],(function(e){xc["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],xc["viewport".concat(e)](n))},xc["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,i=r.body,l=r.documentElement[n];return"CSS1Compat"===r.compatMode&&l||i&&i[n]||l}}));var wc={position:"absolute",visibility:"hidden",display:"block"};function Cc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=t[0];return 0!==i.offsetWidth?r=Ec.apply(void 0,t):function(e,t,n){var r,i={},l=e.style;for(r in t)t.hasOwnProperty(r)&&(i[r]=l[r],l[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(l[r]=i[r])}(i,wc,(function(){r=Ec.apply(void 0,t)})),r}function Sc(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}hc(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);xc["outer".concat(t)]=function(t,n){return t&&Cc(t,e,n?0:yc)};var n="width"===e?["Left","Right"]:["Top","Bottom"];xc[e]=function(t,r){var i=r;return void 0!==i?t?(pc(t)&&(i+=bc(t,["padding","border"],n)),Qs(t,e,i)):void 0:t&&Cc(t,e,gc)}}));var Nc={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:rc,offset:function(e,t,n){if(void 0===t)return tc(e);!function(e,t,n){if(n.ignoreShake){var r=tc(e),i=r.left.toFixed(0),l=r.top.toFixed(0),a=t.left.toFixed(0),o=t.top.toFixed(0);if(i===a&&l===o)return}n.useCssRight||n.useCssBottom?uc(e,t,n):n.useCssTransform&&zs()in document.body.style?mc(e,t):uc(e,t,n)}(e,t,n||{})},isWindow:nc,each:hc,css:Qs,clone:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);if(e.overflow)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:Sc,getWindowScrollLeft:function(e){return Js(e)},getWindowScrollTop:function(e){return ec(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Nc.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Sc(Nc,xc);var Tc=Nc.getParent;function Ic(e){if(Nc.isWindow(e)||9===e.nodeType)return null;var t,n=Nc.getDocument(e).body,r=Nc.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:Tc(e);for(t=Tc(e);t&&t!==n&&9!==t.nodeType;t=Tc(t))if("static"!==(r=Nc.css(t,"position")))return t;return null}var Rc=Nc.getParent;function Oc(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Ic(e),i=Nc.getDocument(e),l=i.defaultView||i.parentWindow,a=i.body,o=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===o||"visible"===Nc.css(r,"overflow")){if(r===a||r===o)break}else{var s=Nc.offset(r);s.left+=r.clientLeft,s.top+=r.clientTop,n.top=Math.max(n.top,s.top),n.right=Math.min(n.right,s.left+r.clientWidth),n.bottom=Math.min(n.bottom,s.top+r.clientHeight),n.left=Math.max(n.left,s.left)}r=Ic(r)}var c=null;Nc.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Nc.css(e,"position")&&(e.style.position="fixed"));var d=Nc.getWindowScrollLeft(l),u=Nc.getWindowScrollTop(l),m=Nc.viewportWidth(l),h=Nc.viewportHeight(l),p=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(a);if("hidden"===g.overflowX&&(p=l.innerWidth),"hidden"===g.overflowY&&(f=l.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Nc.isWindow(e)||9===e.nodeType)return!1;var t=Nc.getDocument(e),n=t.body,r=null;for(r=Rc(e);r&&r!==n&&r!==t;r=Rc(r))if("fixed"===Nc.css(r,"position"))return!0;return!1}(e))n.left=Math.max(n.left,d),n.top=Math.max(n.top,u),n.right=Math.min(n.right,d+m),n.bottom=Math.min(n.bottom,u+h);else{var v=Math.max(p,d+m);n.right=Math.min(n.right,v);var y=Math.max(f,u+h);n.bottom=Math.min(n.bottom,y)}return n.top>=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function kc(e){var t,n,r;if(Nc.isWindow(e)||9===e.nodeType){var i=Nc.getWindow(e);t={left:Nc.getWindowScrollLeft(i),top:Nc.getWindowScrollTop(i)},n=Nc.viewportWidth(i),r=Nc.viewportHeight(i)}else t=Nc.offset(e),n=Nc.outerWidth(e),r=Nc.outerHeight(e);return t.width=n,t.height=r,t}function Lc(e,t){var n=t.charAt(0),r=t.charAt(1),i=e.width,l=e.height,a=e.left,o=e.top;return"c"===n?o+=l/2:"b"===n&&(o+=l),"c"===r?a+=i/2:"r"===r&&(a+=i),{left:a,top:o}}function Ac(e,t,n,r,i){var l=Lc(t,n[1]),a=Lc(e,n[0]),o=[a.left-l.left,a.top-l.top];return{left:Math.round(e.left-o[0]+r[0]-i[0]),top:Math.round(e.top-o[1]+r[1]-i[1])}}function Pc(e,t,n){return e.left<n.left||e.left+t.width>n.right}function _c(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function Fc(e,t,n){var r=[];return Nc.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function Dc(e,t){return e[t]=-e[t],e}function Mc(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function Hc(e,t){e[0]=Mc(e[0],t.width),e[1]=Mc(e[1],t.height)}function $c(e,t,n,r){var i=n.points,l=n.offset||[0,0],a=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;l=[].concat(l),a=[].concat(a);var c={},d=0,u=Oc(s,!(!(o=o||{})||!o.alwaysByViewport)),m=kc(s);Hc(l,m),Hc(a,t);var h=Ac(m,t,i,l,a),p=Nc.merge(m,h);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&Pc(h,m,u)){var f=Fc(i,/[lr]/gi,{l:"r",r:"l"}),g=Dc(l,0),v=Dc(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Ac(m,t,f,g,v),m,u)||(d=1,i=f,l=g,a=v)}if(o.adjustY&&_c(h,m,u)){var y=Fc(i,/[tb]/gi,{t:"b",b:"t"}),b=Dc(l,1),x=Dc(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Ac(m,t,y,b,x),m,u)||(d=1,i=y,l=b,a=x)}d&&(h=Ac(m,t,i,l,a),Nc.mix(p,h));var E=Pc(h,m,u),w=_c(h,m,u);if(E||w){var C=i;E&&(C=Fc(i,/[lr]/gi,{l:"r",r:"l"})),w&&(C=Fc(i,/[tb]/gi,{t:"b",b:"t"})),i=C,l=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&w,(c.adjustX||c.adjustY)&&(p=function(e,t,n,r){var i=Nc.clone(e),l={width:t.width,height:t.height};return r.adjustX&&i.left<n.left&&(i.left=n.left),r.resizeWidth&&i.left>=n.left&&i.left+l.width>n.right&&(l.width-=i.left+l.width-n.right),r.adjustX&&i.left+l.width>n.right&&(i.left=Math.max(n.right-l.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+l.height>n.bottom&&(l.height-=i.top+l.height-n.bottom),r.adjustY&&i.top+l.height>n.bottom&&(i.top=Math.max(n.bottom-l.height,n.top)),Nc.mix(i,l)}(h,m,u,c))}return p.width!==m.width&&Nc.css(s,"width",Nc.width(s)+p.width-m.width),p.height!==m.height&&Nc.css(s,"height",Nc.height(s)+p.height-m.height),Nc.offset(s,{left:p.left,top:p.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:i,offset:l,targetOffset:a,overflow:c}}function qc(e,t,n){var r=n.target||t,i=kc(r),l=!function(e,t){var n=Oc(e,t),r=kc(e);return!n||r.left+r.width<=n.left||r.top+r.height<=n.top||r.left>=n.right||r.top>=n.bottom}(r,n.overflow&&n.overflow.alwaysByViewport);return $c(e,i,n,l)}qc.__getOffsetParent=Ic,qc.__getVisibleRectForElement=Oc;var jc=Gr()?e.useLayoutEffect:e.useEffect,Kc=function(t,n){var r=e.useRef(!0);jc((function(){return t(r.current)}),n),jc((function(){return r.current=!1,function(){r.current=!0}}),[])};function Vc(e,t){var n=null,r=null;var i=new qt((function(e){var i=vr(e,1)[0].target;if(document.documentElement.contains(i)){var l=i.getBoundingClientRect(),a=l.width,o=l.height,s=Math.floor(a),c=Math.floor(o);n===s&&r===c||Promise.resolve().then((function(){t({width:s,height:c})})),n=s,r=c}}));return e&&i.observe(e),function(){i.disconnect()}}function zc(e){return"function"!=typeof e?null:e()}function Wc(e){return"object"===ur(e)&&e?e:null}var Bc=function(e,n){var r=e.children,i=e.disabled,l=e.target,a=e.align,o=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),m=t.useRef(),h=t.Children.only(r),p=t.useRef({});p.current.disabled=i,p.current.target=l,p.current.align=a,p.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function l(){window.clearTimeout(i.current)}return[function t(a){if(l(),r.current&&!0!==a)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(a))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,l()}]}((function(){var e=p.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,l=m.current;if(!t&&n&&l){var a,o=zc(n),s=Wc(n);u.current.element=o,u.current.point=s,u.current.align=r;var c=document.activeElement;return o&&function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var i=e.getBoundingClientRect(),l=i.width,a=i.height;if(l||a)return!0}}return!1}(o)?a=qc(l,o,r):s&&(a=function(e,t,n){var r,i,l=Nc.getDocument(e),a=l.defaultView||l.parentWindow,o=Nc.getWindowScrollLeft(a),s=Nc.getWindowScrollTop(a),c=Nc.viewportWidth(a),d=Nc.viewportHeight(a),u={left:r="pageX"in t?t.pageX:o+t.clientX,top:i="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},m=r>=0&&r<=o+c&&i>=0&&i<=s+d,h=[n.points[0],"cc"];return $c(e,u,Hs(Hs({},n),{},{points:h}),m)}(l,s,r)),function(e,t){e!==document.activeElement&&ks(t,e)&&"function"==typeof e.focus&&e.focus()}(c,l),i&&a&&i(l,a),!0}return!1}),d),g=vr(f,2),v=g[0],y=g[1],b=vr(t.useState(),2),x=b[0],E=b[1],w=vr(t.useState(),2),C=w[0],S=w[1];return Kc((function(){E(zc(l)),S(Wc(l))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=C)||e&&t&&("pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t&&e.clientX===t.clientX&&e.clientY===t.clientY))&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new Set;return function e(t,i){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=r.has(t);if(xn(!a,"Warning: There may be circular references"),a)return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);var o=l+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var s=0;s<t.length;s++)if(!e(t[s],i[s],o))return!1;return!0}if(t&&i&&"object"===ur(t)&&"object"===ur(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every((function(n){return e(t[n],i[n],o)}))}return!1}(e,t)}(u.current.align,a)||v()})),t.useEffect((function(){return Vc(m.current,v)}),[m.current]),t.useEffect((function(){return Vc(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return Ls(window,"resize",v).remove}),[s]),t.useEffect((function(){return function(){y()}}),[]),t.useImperativeHandle(n,(function(){return{forceAlign:function(){return v(!0)}}})),t.isValidElement(h)&&(h=t.cloneElement(h,{ref:Sr(h.ref,m)})),h},Uc=t.forwardRef(Bc);function Gc(){Gc=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},l=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var l=t&&t.prototype instanceof m?t:m,a=Object.create(l.prototype),o=new N(i||[]);return r(a,"_invoke",{value:E(e,n,o)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function m(){}function h(){}function p(){}var f={};s(f,l,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,l)&&(f=v);var y=p.prototype=m.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function i(r,l,a,o){var s=d(e[r],e,l);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==ur(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,a,o)}),(function(e){i("throw",e,a,o)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,o)}))}o(s.arg)}var l;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return l=l?l.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,l){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw l;return I()}for(n.method=i,n.arg=l;;){var a=n.delegate;if(a){var o=w(a,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,u;var l=i.arg;return l?l.done?(t[e.resultName]=l.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):l:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return h.prototype=p,r(y,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=s(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,l){void 0===l&&(l=Promise);var a=new x(c(t,n,r,i),l);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),s(y,o,"Generator"),s(y,l,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var l=this.tryEntries[i],a=l.completion;if("root"===l.tryLoc)return r("end");if(l.tryLoc<=this.prev){var o=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(o&&s){if(this.prev<l.catchLoc)return r(l.catchLoc,!0);if(this.prev<l.finallyLoc)return r(l.finallyLoc)}else if(o){if(this.prev<l.catchLoc)return r(l.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return r(l.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var l=i;break}}l&&("break"===e||"continue"===e)&&l.tryLoc<=t&&t<=l.finallyLoc&&(l=null);var a=l?l.completion:{};return a.type=e,a.arg=t,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function Yc(e,t,n,r,i,l,a){try{var o=e[l](a),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,i)}function Xc(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var l=e.apply(t,n);function a(e){Yc(l,r,i,a,o,"next",e)}function o(e){Yc(l,r,i,a,o,"throw",e)}a(void 0)}))}}Uc.displayName="Align";var Qc=["measure","alignPre","align",null,"motion"],Zc=e.forwardRef((function(t,n){var r=t.visible,i=t.prefixCls,a=t.className,c=t.style,d=t.children,u=t.zIndex,m=t.stretch,h=t.destroyPopupOnHide,p=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,w=t.onMouseDown,C=t.onTouchStart,S=t.onClick,N=l(),T=l(),I=vr(s(),2),R=I[0],O=I[1],k=function(t){var n=vr(e.useState({width:0,height:0}),2),r=n[0],i=n[1];return[e.useMemo((function(){var e={};if(t){var n=r.width,i=r.height;-1!==t.indexOf("height")&&i?e.height=i:-1!==t.indexOf("minHeight")&&i&&(e.minHeight=i),-1!==t.indexOf("width")&&n?e.width=n:-1!==t.indexOf("minWidth")&&n&&(e.minWidth=n)}return e}),[t,r]),function(e){var t=e.offsetWidth,n=e.offsetHeight,r=e.getBoundingClientRect(),l=r.width,a=r.height;Math.abs(t-l)<1&&Math.abs(n-a)<1&&(t=l,n=a),i({width:t,height:n})}]}(m),L=vr(k,2),A=L[0],P=L[1];var _=function(e,t){var n=vr(Mr(null),2),r=n[0],i=n[1],a=l();function s(e){i(e,!0)}function c(){vi.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=vi(Xc(Gc().mark((function e(){var t,n;return Gc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Qc.indexOf(r),(n=Qc[t+1])&&-1!==t&&s(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),o((function(){return function(){c()}}),[]),[r,function(e){c(),a.current=vi((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){m&&P(v())})),F=vr(_,2),D=F[0],M=F[1],H=vr(s(0),2),$=H[0],q=H[1],j=l();function K(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function V(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===D&&(null==b||b(e,t))}Kc((function(){"alignPre"===D&&q(0)}),[D]),Kc((function(){"align"===D&&($<3?K():M((function(){var e;null===(e=j.current)||void 0===e||e.call(j)})))}),[$]);var z=fr({},Fs(t));function W(){return new Promise((function(e){j.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=z[e];z[e]=function(e,n){return M(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==D||M()}),[z.motionName,D]),e.useImperativeHandle(n,(function(){return{forceAlign:K,getElement:function(){return T.current}}}));var B=fr(fr({},A),{},{zIndex:u,opacity:"motion"!==D&&"stable"!==D&&r?0:void 0,pointerEvents:r||"stable"===D?void 0:"none"},c),U=!0;null==f||!f.points||"align"!==D&&"stable"!==D||(U=!1);var G=d;return e.Children.count(d)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},d)),e.createElement(Si,Ni({visible:r,ref:T,leavedClassName:"".concat(i,"-hidden")},z,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:h,forceRender:p}),(function(t,n){var r=t.className,l=t.style,o=Pe(i,a,R,r);return e.createElement(Uc,{target:g||v,key:"popup",ref:N,monitorWindowResize:!0,disabled:U,align:f,onAlign:V},e.createElement("div",{ref:n,className:o,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:w,onTouchStartCapture:C,onClick:S,style:fr(fr({},l),B)},G))}))}));Zc.displayName="PopupInner";var Jc=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,l=t.zIndex,a=t.children,o=t.mobile,s=(o=void 0===o?{}:o).popupClassName,c=o.popupStyle,d=o.popupMotion,u=void 0===d?{}:d,m=o.popupRender,h=t.onClick,p=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return p.current}}}));var f=fr({zIndex:l},c),g=a;return e.Children.count(a)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},a)),m&&(g=m(g)),e.createElement(Si,Ni({visible:i,ref:p,removeOnLeave:!0},u),(function(t,n){var i=t.className,l=t.style,a=Pe(r,s,i);return e.createElement("div",{ref:n,className:a,onClick:h,style:fr(fr({},l),f)},g)}))}));Jc.displayName="MobilePopupInner";var ed=["visible","mobile"],td=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,l=Tr(t,ed),a=vr(s(r),2),c=a[0],d=a[1],u=vr(s(!1),2),m=u[0],h=u[1],p=fr(fr({},l),{},{visible:c});o((function(){d(r),r&&i&&h(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null==e?void 0:e.substr(0,4))}())}),[r,i]);var f=m?e.createElement(Jc,Ni({},p,{mobile:i,ref:n})):e.createElement(Zc,Ni({},p,{ref:n}));return e.createElement("div",null,e.createElement(Ds,p),f)}));td.displayName="Popup";var nd=e.createContext(null);function rd(){}function id(){return""}function ld(e){return e?e.ownerDocument:window.document}var ad=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var od=function(t){var n=function(n){Ar(i,e.Component);var r=Fr(i);function i(t){var n,l;return Rr(this,i),hr(_r(n=r.call(this,t)),"popupRef",e.createRef()),hr(_r(n),"triggerRef",e.createRef()),hr(_r(n),"portalContainer",void 0),hr(_r(n),"attachId",void 0),hr(_r(n),"clickOutsideHandler",void 0),hr(_r(n),"touchOutsideHandler",void 0),hr(_r(n),"contextMenuOutsideHandler1",void 0),hr(_r(n),"contextMenuOutsideHandler2",void 0),hr(_r(n),"mouseDownTimeout",void 0),hr(_r(n),"focusTime",void 0),hr(_r(n),"preClickTime",void 0),hr(_r(n),"preTouchTime",void 0),hr(_r(n),"delayTimer",void 0),hr(_r(n),"hasPopupMouseDown",void 0),hr(_r(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),hr(_r(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),hr(_r(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),hr(_r(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),hr(_r(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&ks(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),hr(_r(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),hr(_r(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),hr(_r(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),hr(_r(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),hr(_r(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),hr(_r(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),hr(_r(n),"onClick",(function(e){if(n.fireEvents("onClick",e),n.focusTime){var t;if(n.preClickTime&&n.preTouchTime?t=Math.min(n.preClickTime,n.preTouchTime):n.preClickTime?t=n.preClickTime:n.preTouchTime&&(t=n.preTouchTime),Math.abs(t-n.focusTime)<20)return;n.focusTime=0}n.preClickTime=0,n.preTouchTime=0,n.isClickToShow()&&(n.isClickToHide()||n.isBlurToHide())&&e&&e.preventDefault&&e.preventDefault();var r=!n.state.popupVisible;(n.isClickToHide()&&!r||r&&n.isClickToShow())&&n.setPopupVisible(!n.state.popupVisible,e)})),hr(_r(n),"onPopupMouseDown",(function(){var e;(n.hasPopupMouseDown=!0,clearTimeout(n.mouseDownTimeout),n.mouseDownTimeout=window.setTimeout((function(){n.hasPopupMouseDown=!1}),0),n.context)&&(e=n.context).onPopupMouseDown.apply(e,arguments)})),hr(_r(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();ks(r,t)&&!n.isContextMenuOnly()||ks(i,t)||n.hasPopupMouseDown||n.close()}})),hr(_r(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=br(n.triggerRef.current);if(t)return t}catch(e){}return Mt.findDOMNode(_r(n))})),hr(_r(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,l=r.builtinPlacements,a=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&l&&t.push(function(e,t,n,r){for(var i=n.points,l=Object.keys(e),a=0;a<l.length;a+=1){var o=l[a];if(Ps(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(l,a,e,o)),s&&t.push(s(e)),t.join(" ")})),hr(_r(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,l=t.popupClassName,a=t.onPopupAlign,o=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,m=t.maskAnimation,h=t.maskTransitionName,p=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,w=n.state,C=w.popupVisible,S=w.point,N=n.getPopupAlign(),T={};return n.isMouseEnterToShow()&&(T.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(T.onMouseLeave=n.onPopupMouseLeave),T.onMouseDown=n.onPopupMouseDown,T.onTouchStart=n.onPopupMouseDown,e.createElement(td,Ni({prefixCls:r,destroyPopupOnHide:i,visible:C,point:y&&S,className:l,align:N,onAlign:a,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:m,maskTransitionName:h,maskMotion:p,ref:n.popupRef,motion:o,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),hr(_r(n),"attachParent",(function(e){vi.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,l=r.getDocument,a=n.getRootDomNode();i?(a||0===i.length)&&(t=i(a)):t=l(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=vi((function(){n.attachParent(e)}))})),hr(_r(n),"getContainer",(function(){if(!n.portalContainer){var e=(0,n.props.getDocument)(n.getRootDomNode()).createElement("div");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",n.portalContainer=e}return n.attachParent(n.portalContainer),n.portalContainer})),hr(_r(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),hr(_r(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),hr(_r(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),l="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:l,popupVisible:l},ad.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return kr(i,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e,t=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(e=t.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Ls(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Ls(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Ls(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Ls(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),vi.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var e;return(null===(e=this.popupRef.current)||void 0===e?void 0:e.getElement())||null}},{key:"getPopupAlign",value:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,r=e.builtinPlacements;return t&&r?function(e,t,n){return fr(fr({},e[t]||{}),n)}(r,t,n):n}},{key:"setPopupVisible",value:function(e,t){var n=this.props.alignPoint,r=this.state.popupVisible;this.clearDelayTimer(),r!==e&&("popupVisible"in this.props||this.setState({popupVisible:e,prevPopupVisible:r}),this.props.onPopupVisibleChange(e)),n&&t&&e&&this.setPoint(t)}},{key:"delaySetPopupVisible",value:function(e,t,n){var r=this,i=1e3*t;if(this.clearDelayTimer(),i){var l=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,l),r.clearDelayTimer()}),i)}else this.setPopupVisible(e,n)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire".concat(e)]:t[e]||n[e]}},{key:"isClickToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var e=this.props.action;return"contextMenu"===e||1===e.length&&"contextMenu"===e[0]}},{key:"isContextMenuToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("contextMenu")||-1!==n.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("focus")}},{key:"isBlurToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var e;this.state.popupVisible&&(null===(e=this.popupRef.current)||void 0===e||e.forceAlign())}},{key:"fireEvents",value:function(e,t){var n=this.props.children.props[e];n&&n(t);var r=this.props[e];r&&r(t)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var n=this.state.popupVisible,r=this.props,i=r.children,l=r.forceRender,a=r.alignPoint,o=r.className,s=r.autoDestroy,c=e.Children.only(i),d={key:"trigger"};this.isContextMenuToShow()?d.onContextMenu=this.onContextMenu:d.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(d.onClick=this.onClick,d.onMouseDown=this.onMouseDown,d.onTouchStart=this.onTouchStart):(d.onClick=this.createTwoChains("onClick"),d.onMouseDown=this.createTwoChains("onMouseDown"),d.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(d.onMouseEnter=this.onMouseEnter,a&&(d.onMouseMove=this.onMouseMove)):d.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?d.onMouseLeave=this.onMouseLeave:d.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(d.onFocus=this.onFocus,d.onBlur=this.onBlur):(d.onFocus=this.createTwoChains("onFocus"),d.onBlur=this.createTwoChains("onBlur"));var u=Pe(c&&c.props&&c.props.className,o);u&&(d.className=u);var m=fr({},d);Nr(c)&&(m.ref=Sr(this.triggerRef,c.ref));var h,p=e.cloneElement(c,m);return(n||this.popupRef.current||l)&&(h=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(h=null),e.createElement(nd.Provider,{value:this.triggerContextValue},p,h)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.popupVisible,r={};return void 0!==n&&t.popupVisible!==n&&(r.popupVisible=n,r.prevPopupVisible=t.popupVisible),r}}]),i}();return hr(n,"contextType",nd),hr(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:id,getDocument:ld,onPopupVisibleChange:rd,afterPopupVisibleChange:rd,onPopupAlign:rd,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1}),n}(As);const sd=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:l}=t.useContext(Ko),{t:a}=Mn(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);Hi((()=>{h()}),[d]),t.useEffect((()=>{m()}),[n]);const m=()=>{const e=[];n.forEach(((t,r)=>{const i=t.colSpan;i>1&&n.slice(r+1,r+i).every((({colSpan:e})=>0===e))&&e.push(n.slice(r,r+i))})),o.current=e},h=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const i=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===i)return e.push(t);e.push(...o.current[i].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),null==r||r(e)},p={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l},f=[`${i}-column-filter`,{selected:s}];return t.createElement(od,{action:["click"],popupVisible:s,popup:t.createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"main"},t.createElement(Gt,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),n=d.map((e=>e.dataIndex));he(t,n)||u(Ma(e))}},d.map((e=>((e,n)=>{const{colSpan:r}=e;if(0===r)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${n}-handle`];return t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),t.createElement("i",{className:Pe(i),title:a("qm.table.columnFilter.draggable")},t.createElement(Be,null)),t.createElement("span",{className:"text"},Ia(e.title)))})(e,"main")))))),popupClassName:Pe(p),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Qo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Pe(f),title:a("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},cd=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:l,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(Ko),{rowSelection:d}=l.current.props,{t:u}=Mn(),m=t.useRef(null),[p,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${h().format(Xo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Qn(n.columns||[])})),[]),[v,y]=t.useState([{type:"INPUT",label:u("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:u("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:u("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:u("qm.table.export.all"),value:"all"},{text:u("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==d?void 0:d.type)},{text:u("qm.table.export.custom"),value:"custom"}]},onChange:e=>{v.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,y([...v])}},options:{min:1},disabled:!0},{type:"INPUT",label:u("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t.createElement(sd,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return t.createElement("div",{className:`${a}-export__setting`},t.createElement(Tp,{ref:m,initialValues:g,items:v,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(nr,{type:"primary",loading:p,onClick:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield m.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);i(t),yield Wn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},dd=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:l=!0}=e,{global:a}=t.useContext(on),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:m,isGroupSubtotal:p,showSummary:f,getSpan:g}=t.useContext(Ko),{exportExcel:v,fetch:y,showHeader:b}=o.current.props,{t:x}=Mn(),{getTitleFromCellValue:E}=gs(),[w,C]=t.useState(!1),[S,N]=t.useState(!1),T=t.useMemo((()=>{var e;return!!(null===(e=null==v?void 0:v.fetch)||void 0===e?void 0:e.api)}),[v]),I=t.useMemo((()=>!d.total||S),[d.total,S]),O=t.useMemo((()=>aa(i,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn])),[i]),k=t.useMemo((()=>aa(c,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn])),[c]),L=(e,t="",n=0)=>e.map(((e,r)=>{const i=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),l=t?`${t}.${i.index+1}`:`${i.index+1}`;return i.indexPath=l,i._level=n,Array.isArray(e.children)&&(i.children=L(e.children,l,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&ya(i,t,va(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(p?Ra(t):t).reduce(((e,t)=>{if(null==t?void 0:t[ls.summaryIgnore])return e;const n=Number(va(t,r));return Number.isNaN(n)?e:e+n}),0);ya(n,r,i)})),[n]},P=(e,t,n,r)=>{const{precision:i,formatType:l}=n;let a=E(e,n,t,r);return i>=0&&!l&&""!==a&&(a=Number(a)),a},{exportXLSX:_,exportCSV:F}=Ts(),D=e=>Dn(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:i,dataKey:l}=y;let a=[];try{N(!0);const o={[ls.currentPageName]:1,[ls.pageSizeName]:null!=e?e:d.total},s=yield n(Object.assign(Object.assign({},r(Object.assign(Object.assign({},u),o))),o));if(200===s.code){let e=Array.isArray(s.data)?s.data:null!==(t=ue(s.data,l))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,a=L(e)}}catch(e){}return N(!1),a})),M=e=>{var t;const n=null===(t=null==a?void 0:a.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},H=(e,t)=>{const{columns:n,footSummation:r}=e,i=Jl(n);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(l+=["<thead>","<tr>",i.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Ia(e.title)}</th>`})).join(""),"</tr>","</thead>"].join("")),t.length&&(l+=`<tbody>${sa(t).map((e=>`<tr>${i.map(((n,r)=>{var i;const{rowSpan:l,colSpan:a}=g(e,n,e.index,r,t);if(!l||!a)return null;const o=P(e,e.index,n,r);return`<td rowspan="${l}" colspan="${a}" data-type="${$(o,null===(i=n.filter)||void 0===i?void 0:i.type)}">${o}</td>`})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(l+=["<tfoot>",A(i,t).map((e=>`<tr>${i.map(((n,r)=>{const{dataIndex:i,summation:l}=n,a=(null==l?void 0:l.render)?l.render(t):va(e,i);return`<td>${0===r&&""===a?x("qm.table.config.summaryText"):jn(a)?Ta(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},$=(e,t)=>{const n={text:"string",textarea:"string",number:"number",date:"date"};return t&&n[t]?n[t]:typeof e},q=null!==(r=null==v?void 0:v.fileName)&&void 0!==r?r:`${h().format(Xo)}.xlsx`,j=q.slice(q.lastIndexOf(".")+1).toLowerCase(),K=()=>{if(I)return R.warning(x("qm.table.export.warnText"));var e;T?(e=q,Dn(void 0,void 0,void 0,(function*(){N(!0);try{const{api:t,params:n}=v.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:i}=e.filter||{};return{title:t,dataIndex:n,type:i,hidden:r}}))},u),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[ls.currentPageName]:void 0,[ls.pageSizeName]:void 0}));r.data&&(wl(r.data,e),M(e))}catch(e){}N(!1)}))):C(!0)};t.useImperativeHandle(n,(()=>({clickHandle:K})));const V={[`${s}-export`]:!0},z={visible:w,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},W={fileName:q.slice(0,q.lastIndexOf(".")),fileType:j,columns:O,useStyle:(null==v?void 0:v.cellStyle)?1:0};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:Pe(V),title:x("qm.table.export.textNoSpace"),onClick:()=>K()},t.createElement("i",{className:"svgicon icon"},t.createElement(je,null))),t.createElement(Ml,z,t.createElement(cd,{defaultValue:W,onClose:()=>C(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:ea(e.columns)}),Dn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:l}=t,{tableFullData:a,selectionRows:s}=o.current;let c=[];if(m?("all"===r&&(c=yield D()),"custom"===r&&(c=yield D(l),c=c.slice(i-1))):("all"===r&&(c=a.slice(0)),"custom"===r&&(c=a.slice(i-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==v?void 0:v.beforeExport))try{c=null==v?void 0:v.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield _(t,c,A,P);wl(n,`${e}.xlsx`),M(`${e}.xlsx`)}if("csv"===n){const n=F(t,H(t,c));wl(n,`${e}.csv`),M(`${e}.csv`)}}))}})))}));dd.displayName="TableExport";const ud=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:l,prefixCls:a,dataChange:o}=t.useContext(Ko),{beforeClipboard:s}=i.current.props,{t:c}=Mn(),d=t.useRef(null),[u,m]=t.useState([{type:"INPUT_NUMBER",label:c("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:c("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:n.map(((e,t)=>({value:t,text:Ia(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[h,p]=t.useState(!1);return t.createElement("div",{className:`${a}-clipboard__setting`},t.createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),t.createElement(Tp,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(nr,{type:"primary",loading:h,onClick:()=>Dn(void 0,void 0,void 0,(function*(){var e;const[t,a]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:m,fieldAuth:h}=i.current;p(!0);const f=a.content.trim().replace(/(\r|\n)$/,"");let g=f.replace(/"[^"]+"/g,"^");((null===(e=f.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{g=g.replace(/\^/,e)}));let v=g.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{v=yield s(v,v[0].map(((e,t)=>n[a.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var i,l;const o=u[a.rowIndex-1+t],s=n[a.colIndex+r];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||(null===(i=e.extra)||void 0===i?void 0:i.disabled)||(null===(l=h[s.dataIndex])||void 0===l?void 0:l.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(ya(o,s.dataIndex,e),m.addToUpdated(o))}}))})),l.current.forceUpdate(),o(),R.success(c("qm.table.clipboard.success",{total:v.length})),p(!1),r()}))},c("qm.table.clipboard.text"))))},md=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,flattenColumns:l}=t.useContext(Ko),{t:a}=Mn(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex))))(l)),[l]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${i}-clipboard`]:!0},m={visible:o,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:Pe(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ze,null))),t.createElement(Ml,m,t.createElement(ud,{columns:c,onClose:()=>s(!1)})))}));md.displayName="TableClipboard";const hd=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:l,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(Ko),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Mn(),u=t.useRef(null),m=sl(u),h=e=>e.map((e=>{var t;const n={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:null!==(t=e.dictItems)&&void 0!==t?t:[],render:e.render};return Array.isArray(e.children)&&(n.children=h(e.children)),n})),[p,f]=t.useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...h(n.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex))))]),[g]=t.useState((()=>{const{disabled:e}=c||{},t=i.current.selectionRows.map((e=>Object.assign(Object.assign({},e),{children:void 0})));return e?t.filter((t=>!e(t))):t})()),[v,y]=t.useState(300),b=cl((()=>{const e=u.current;y(e.offsetHeight-2*jo[l]-30)}),5);return pn((()=>{b()}),[m.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(Bm,{size:l,columns:p,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t.createElement("div",{style:{height:10}}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},pd=t.forwardRef(((e,n)=>{const{columns:r,open:i=!0}=e,{tableRef:l,getRowKey:a,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=t.useContext(Ko),{rowSelection:h}=l.current.props,{t:p}=Mn(),[f,g]=t.useState(!1),v=t.useRef(!1);Hi((()=>{!v.current&&y()}),[d]);const y=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=h;if(c&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:s},t.params));if(200===r.code){let i=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];i=i.filter((e=>!n(e))),u(i.map(((e,t)=>a(e,t)))),m(i),v.current=!0}}catch(e){}})),b=()=>{g(!0)};t.useImperativeHandle(n,(()=>({clickHandle:b})));const x={visible:f,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:`${o}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>b()},t.createElement("i",{className:"svgicon icon"},t.createElement(Je,null))),t.createElement(Ml,x,t.createElement(hd,{columns:r,onClose:()=>g(!1)})))}));pd.displayName="SelectCollection";const fd=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:i,getRowKey:l,prefixCls:a,$size:o,tableFlatData:s,flattenColumns:c,setActivedCell:d,scrollXToColumn:u,scrollYToRecord:m}=t.useContext(Ko),{uniqueKey:h}=i.current.props,{t:p}=Mn(),{getTitleFromCellValue:f}=gs(),g=t.useRef(""),[v,y]=t.useState(""),[b,x]=t.useState([]),[E,w]=t.useState(0),[C,S]=t.useState(!1),[N,T]=t.useState({case:0,fullchar:0}),I=t.useMemo((()=>`${b.length>0?E+1:E}/${b.length}`),[E,b]);Hi((()=>{_(b[E])}),[E,b]);const R=e=>{T(Object.assign({},N,e))},k=(e,t,n)=>new Promise(((r,i)=>{A.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),L=Hn((e=>Dn(void 0,void 0,void 0,(function*(){if(!v)return g.current=v,P();const t=((e,t)=>{const n=new RegExp(N.fullchar?`^${t}$`:t,N.case?"":"i"),r=[];return e.forEach(((e,t)=>{c.forEach(((i,a)=>{const{dataIndex:o}=i;if([ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(o))return;const s=f(e,i,e.index,a);n.test(s)&&r.push({value:s,rowKey:l(e,e.index),dataIndex:o,rowIndex:t,colIndex:a})}))})),r})(s,v);if(!t.length)return A.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});if(x(t),"all"===e&&S(!0),v!==g.current)return g.current=v,w(0);if("next"===e){const e=E+1;e>t.length-1?yield k(p("qm.table.fastSearch.toTheEnd"),(()=>w(0)),(()=>{})):w(e)}if("prev"===e){const e=E-1;e<0?yield k(p("qm.table.fastSearch.toStart"),(()=>w(t.length-1)),(()=>{})):w(e)}})))),P=()=>{w(0),x([]),d({})},_=e=>{e&&(m(e.rowKey),u(e.dataIndex),d(e))},F=t.useMemo((()=>h?`fastSearch_${h}`:""),[h]),[D,H]=t.useState([]),[$,q]=t.useState(""),[j,K]=t.useState("");Hi((()=>{if(j){const{input:e,config:t}=D.find((e=>e.value===j)).condition;y(e),T(t),setTimeout((()=>L()))}}),[j]),t.useEffect((()=>{V()}),[]);const V=()=>Dn(void 0,void 0,void 0,(function*(){if(!F)return;let e=yield Qt.getItem(F);e||(e=yield z(F),Array.isArray(e)&&(yield Qt.setItem(F,e))),Array.isArray(e)&&e.length&&H(e)})),z=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),W=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement("div",{className:"search-box"},t.createElement("span",{className:"label"},p("qm.table.fastSearch.queryLabel"),":"),t.createElement(O,{value:v,placeholder:p("qm.table.fastSearch.queryCondition"),allowClear:!0,style:{flex:"auto",width:"auto"},onChange:e=>y(e.target.value)})),t.createElement("div",{className:"condition"},t.createElement(M,{checked:!!N.case,onChange:e=>R({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t.createElement(M,{checked:!!N.fullchar,onChange:e=>R({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t.createElement("div",{className:"all-list"},C&&t.createElement("table",{className:"rtable",tabIndex:-1,cellSpacing:"0",cellPadding:"0"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",{style:{width:40,minWidth:40}},"#"),t.createElement("th",{style:{width:130,minWidth:130}},p("qm.table.fastSearch.cellText")),t.createElement("th",null,p("qm.table.fastSearch.valText")))),t.createElement("tbody",null,b.map(((e,n)=>t.createElement("tr",{key:n,className:Pe({active:E===n}),onClick:()=>w(n)},t.createElement("td",null,n+1),t.createElement("td",null,"Row:",e.rowIndex+1,", Col:",e.colIndex+1),t.createElement("td",null,e.value)))))))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:o,value:$,placeholder:p("qm.table.highSearch.configText"),disabled:!v,onChange:e=>{const{value:t}=e.target;q(t)}}),t.createElement(nr,{type:"primary",disabled:!$||!v,style:{marginLeft:"10px"},onClick:()=>Dn(void 0,void 0,void 0,(function*(){if(!F)return tr("Table","必须设置组件参数 `uniqueKey` 才能保存");if(!v)return;const e=Na(),t=[...D,{text:$,value:e,condition:{input:v,config:N}}];H(t),q(""),yield Qt.setItem(F,t),yield W(F,t)}))},p("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${ls.rowHeightMaps[o]}px`}},t.createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,D.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===j}),title:e.text,onClick:()=>{return t=e.value,void K(t!==j?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Dn(void 0,void 0,void 0,(function*(){if(!n)return;const e=D.filter((e=>e.value!==n));H(e),yield Qt.setItem(F,e),yield W(F,e)}))}},t.createElement(et,null))))),!D.length&&t.createElement("div",{style:{padding:Wo}},t.createElement(tl,null)))))),t.createElement("div",{className:"bottom-bar",style:{position:"absolute",left:0,bottom:0,right:0,height:`${jo[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",boxSizing:"border-box"}},t.createElement("div",null,p("qm.table.fastSearch.findTotal",{total:I})),t.createElement("div",null,t.createElement(nr,{onClick:()=>L("all"),style:{marginRight:8}},p("qm.table.fastSearch.queryAll")),t.createElement(nr,{type:"primary",onClick:()=>L("prev"),style:{marginRight:8}},p("qm.table.fastSearch.queryPrev")),t.createElement(nr,{type:"primary",onClick:()=>L("next"),style:{marginRight:8}},p("qm.table.fastSearch.queryNext")),t.createElement(nr,{onClick:()=>n()},p("qm.table.fastSearch.closeButton")))))},gd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,$size:l}=t.useContext(Ko),{t:a}=Mn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:a("qm.table.fastSearch.settingTitle"),width:650,loading:!1,bodyStyle:{paddingBottom:`${jo[l]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(tt,null))),t.createElement(Ml,d,t.createElement(fd,{onClose:()=>s(!1)})))}));gd.displayName="FastSearch";var vd={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"};const yd=e=>[vd.selectionColumnDefine,...e].filter((e=>!e.hidden)),bd=e=>e.some((e=>Array.isArray(e.children))),xd=e=>void 0!==e._groupLevel,Ed=(e,t)=>t.split(vd.separator).reduce(((e,t)=>null==e?void 0:e[t]),e),wd=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(wd)):0,Cd=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const i=t?`${t}${vd.separator}${r}`:r;if(n.push(i),Array.isArray(e[r]))return n;const l=Cd(e[r],i);return n.concat(l)}),[]),Sd=(e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:i}]=t,l=Object.keys(t[0])[0],a=t.slice(1),o=Object.groupBy(e,(e=>n(e,l))),s=Object.keys(o).sort(((e,t)=>{const n=(r=e,l=t,Number.isNaN(r-l)?r.toString().localeCompare(l.toString()):r-l);var r,l;return"ascend"===i?n:-n})),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],a)})),c};return r(e,t)},Nd={sum:e=>Ea(e.reduce(((e,t)=>e+t),0)),avg:e=>e.length>0?(e.reduce(((e,t)=>e+t),0)/e.length).toFixed(2):0,max:e=>e.length>0?Math.max(...e):void 0,min:e=>e.length>0?Math.min(...e):void 0,count:e=>Ea(e.length),unique:e=>new Set(e).size,empty:e=>e.filter((e=>Gn(e))).length,notEmpty:e=>e.filter((e=>!Gn(e))).length},Td=t.createContext(void 0),Id=e=>{const{prefixCls:n,pivotProps:r,size:i,getRowKey:l,flatColumns:a,tableData:o}=e,{initialGroup:s,initialCount:c}=r,d=e=>{const t=new Map;return sa(e).forEach((e=>t.set(l(e,e.index),e))),t},u=t.useRef({props:r,originGridData:o,flatGroupData:[],isTree:bd(o),keyRecordMap:d(o)}),[m,h]=t.useState({pivotRef:u,prefixCls:n,size:i,viewMode:"table",columns:a,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=a.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:[],sorterList:[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=a.map((e=>e.dataIndex)),r={};for(const i in e)n.includes(i)&&t.includes(e[i])&&(r[i]=e[i]);return r})(c):{},summationData:{}}),p=e=>{h((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const l=i;Object.is(t[l],e[l])||(n[l]=e[l],r=!0)})),r?n:t}))};pn((()=>{v(o),f("originGridData",o),f("isTree",bd(o)),f("keyRecordMap",d(o))}),[o]),pn((()=>{g(a)}),[a]),pn((()=>{p({size:i})}),[i]);const f=(e,t)=>{m.pivotRef.current[e]=t};f("props",r);const g=e=>{p({columns:e})},v=e=>{p({gridData:e})},y=e=>{p({groupGridData:e})},b=e=>{p({groupList:e})},x=e=>{p({filterList:e})},E=e=>{p({sorterList:e})},w=e=>{p({colorList:e})},C=e=>{p({expandedKeys:e})},S=e=>{p({searchResults:e})},N=e=>{p({switchIndex:e})},T=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),p({fillColorCells:t})},I=e=>{var t;p({countMethod:(t=Object.assign({},m.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},R=e=>{p({summationData:e})},O=t.useMemo((()=>Object.assign(Object.assign({},m),{setContext:p,getRowKey:l,setPivotGridRef:f,setColumns:g,setGridData:v,setGroupGridData:y,setGroupList:b,setFilterList:x,setSorterList:E,setColorList:w,setExpandedKeys:C,setSearchResults:S,setSwitchIndex:N,setFillColor:T,setCountMethod:I,setSummationData:R})),[m]);return t.createElement(Td.Provider,{value:O},e.children)},Rd=()=>t.useContext(Td),Od=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:i,gridData:l,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=Rd(),{originGridData:d}=n.current,{onGroupChange:u,onDataChange:m}=n.current.props,{t:h}=Mn(),p=t.useRef([]),f=t.useRef([]),g=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),v=t.useMemo((()=>i.map((e=>({label:Ia(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,i]),y=t.useMemo((()=>{const e=g.map((e=>({[e.fieldName]:e.order})));return he(e,p.current)?p.current:(p.current=e,e)}),[g]),b=[{label:h("qm.pivotGrid.group.ascend"),value:"ascend"},{label:h("qm.pivotGrid.group.descend"),value:"descend"}];t.useEffect((()=>{o(f.current)}),[y,d]),t.useLayoutEffect((()=>{const e=Sd(l,y,((e,t)=>{let n=va(e,t);return ae(n)&&(n=Object.values(n)),Array.isArray(n)&&(n=n.join(",")),Gn(n)?h("qm.pivotGrid.group.empty"):n}));var t;s(e),t=Cd(e),f.current=t,c("flatGroupData",((e,t=[])=>{const n=[];return function e(r,i,l=""){if(Array.isArray(r))r.forEach(((e,t)=>{e._varIndex=t,l?e._parentRowKey=l:delete e._parentRowKey})),n.push(...sa(r));else for(const a in r){const o=l?`${l}${vd.separator}${a}`:a,s=Object.keys(t[i])[0];n.push({id:o,_fieldName:s,_groupLevel:i}),e(r[a],i+1,o)}}(e,0),n})(e,y))}),[y,l]),Hi((()=>{null==u||u(g)}),[y]),Hi((()=>{null==m||m(l)}),[l]);const x=()=>{a([...r,{fieldName:"",order:"ascend"}])},E=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},w=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(D,{value:e.fieldName||void 0,placeholder:h("qm.table.editable.selectPlaceholder"),options:v,style:{width:160,margin:"0 10px"},onChange:t=>E("fieldName",e,t)}),t.createElement(D,{value:e.order,options:b,placeholder:h("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>E("order",e,t)}),t.createElement(it,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,h("qm.pivotGrid.group.title")),!!g.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},h("qm.pivotGrid.group.foldAll")),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(f.current)},h("qm.pivotGrid.group.unfoldAll")))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));he(t,n)||a(e)}},r.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},w(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:x},t.createElement(rt,{className:"icon"}),h("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!g.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(nt,{className:"icon"}),h("qm.pivotGrid.group.text"),g.length?`(${g.length})`:null))},kd=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:i,setFilterList:l,setGridData:a}=Rd(),{originGridData:o,isTree:s}=n.current,{onFilterChange:c}=n.current.props,{t:d}=Mn(),u=t.useRef([]),m=t.useMemo((()=>i.filter((e=>e.fieldName&&($a(e.expression)||!Gn(e.value))))),[i]),h=t.useMemo((()=>r.map((e=>({label:Ia(e.title),value:e.dataIndex})))),[r]),[p,f]=t.useState("and"),g=t.useMemo((()=>{const e=m.map((e=>{var t;return`${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}));return he(e,u.current)?u.current:(u.current=e,e)}),[m]);Hi((()=>{l(i.map((e=>Object.assign(Object.assign({},e),{logic:p}))))}),[p]),Hi((()=>{v(),null==c||c(m)}),[g]);const v=cl((()=>{const e=ka(m.map((e=>Object.assign(Object.assign({},Xn(e,["value"])),{condition:e.value}))));a(e?Zl(o,e,s):o)}),200),y=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],b=()=>{l([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:p}])},x=(e,t,n)=>{var a;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(a=r.find((e=>e.dataIndex===n)).filter)||void 0===a?void 0:a.type)||"text";Object.assign(t,{type:e,expression:w(e)[0].value,value:""})}"expression"===e&&$a(n)&&Object.assign(t,{value:""}),l([...i])},E=e=>t.createElement(t.Fragment,null,t.createElement(D,{value:e.fieldName||void 0,options:h,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>x("fieldName",e,t)}),t.createElement(D,{value:e.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:w(e.type),style:{width:100,margin:"0 10px"},onChange:t=>x("expression",e,t)}),C(e),t.createElement(it,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)})),w=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",text:d("qm.table.highSearch.nullText")},{value:"nnil",text:d("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",text:d("qm.table.highSearch.nullText")},{value:"nnil",text:d("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.inText")},{value:"nlike",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"^=",label:d("qm.table.highSearch.startsWithText")},{value:"=$",label:d("qm.table.highSearch.endsWithText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}]}return t},C=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{x("value",e,Gn(t)?"":t)}});case"date":return t.createElement(In,{popupClassName:ls.popupClassName,defaultValue:null!==(n=Ca(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{x("value",e,Sa(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(i=r.find((t=>t.dataIndex===e.fieldName)))||void 0===i?void 0:i.dictItems)||[];return t.createElement(D,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{x("value",e,t)}},n.map((e=>t.createElement(D.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:$a(e.expression),onChange:t=>{x("value",e,t.target.value)}})}};return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&t.createElement(D,{value:p,options:y,style:{width:130},onChange:e=>f(e)})),t.createElement("div",{className:"list"},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},E(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:b},t.createElement(rt,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(lt,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},Ld=()=>{const{prefixCls:e,pivotRef:n,columns:r,gridData:i,sorterList:l,setSorterList:a,setGridData:o}=Rd(),{onSorterChange:s}=n.current.props,{t:c}=Mn(),d=t.useMemo((()=>l.filter((e=>e.fieldName&&e.order))),[l]),u=t.useMemo((()=>r.map((e=>({label:Ia(e.title),value:e.dataIndex,disabled:l.some((t=>t.fieldName===e.dataIndex))})))),[l,r]);Hi((()=>{p(),null==s||s(d)}),[t.useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],h=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,p=()=>{var e;o((e=d,i.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,l=va(t,e),a=va(n,e),o=h(l,a);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},f=()=>{a([...l,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...l])},v=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(D,{value:e.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(D,{value:e.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(it,{className:"icon close",onClick:()=>(e=>{a(l.filter((t=>t!==e)))})(e)}));return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.sorter.title"))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.fieldName)),n=l.map((e=>e.fieldName));he(t,n)||a(e)}},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(rt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(at,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},Ad=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:i,searchResults:l,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=Rd(),{t:c}=Mn(),{getTitleFromCellValue:d}=gs(),[u,m]=t.useState(!1),h=t.useMemo((()=>l.length),[l]);Hi((()=>{u||setTimeout((()=>{s(0),o([])}),200)}),[u]);const p=(e,t)=>{const r=[];return e.forEach(((e,l)=>{i.forEach(((i,a)=>{const o=d(e,i,l,a)+"";o.includes(t)&&r.push({value:o,rowKey:n(e,e.index),dataIndex:i.dataIndex})})),Array.isArray(e.children)&&r.push(...p(e.children,t))})),r},f=cl((e=>{const t=e.target.value.trim();s(0),o(t?p(r,t):[])}),200),g=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&v()},v=()=>{if(!h)return;s((a+1)%h)},y=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!h)return;s((a-1+h)%h)})()},t.createElement(ot,null)),t.createElement("span",{className:"num"},h>0?a+1:a,"/",h),t.createElement("button",{className:"button-icon",onClick:()=>v()},t.createElement(st,null)));return t.createElement(H,{open:u,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.search.title")),t.createElement("button",{className:"button-icon",onClick:()=>m(!1)},t.createElement(it,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:y(),onChange:f,onKeyUp:g}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>m(!u)},t.createElement(tt,{className:"icon"}),c("qm.pivotGrid.search.text")))},Pd=(e,t)=>e.map((e=>(e.children&&(e.children=Pd(e.children,t)),t(e)))),_d=()=>{const{prefixCls:e,pivotRef:n,columns:r,setColumns:i}=Rd(),{uniqueKey:l,onColumnsChange:a}=n.current.props,{t:o}=Mn(),s=t.useMemo((()=>l?`grid_field_${l}`:""),[l]);t.useLayoutEffect((()=>{c()}),[]),Hi((()=>{u(r)}),[r]);const c=()=>{const e=m();e&&(null==a||a(e))},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),Object.assign({dataIndex:e.dataIndex},t)})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));he(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));if(!e)return;return fe(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Pd(r,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Pd(e,(e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},h=t.useMemo((()=>{let e=0;for(let t=0;t<r.length-1&&("left"!==r[t].fixed||r[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let n=0;n<r.length;n++)n===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(r[n]);return t}),[r]),p=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,o("qm.pivotGrid.field.title"))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:h,setList:e=>{const t=e.map((e=>e.dataIndex)),n=h.map((e=>e.dataIndex));he(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const i=e[r];r<t?i.fixed="left":delete i.fixed,r!==t&&n.push(i)}i(n),null==a||a(n)})(Ma(e))}},h.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Be,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},Ia(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...r];i(t),null==a||a(t)})(e)},e.hidden?t.createElement(ct,null):t.createElement(qe,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(H,{trigger:["click"],dropdownRender:()=>p(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(Qe,{className:"icon"}),o("qm.pivotGrid.field.text")))},Fd=()=>{const{prefixCls:e,size:n,setContext:r}=Rd(),{t:i}=Mn(),l=[{label:i("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:i("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:i("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},l.map((e=>t.createElement("li",{key:e.value,className:Pe("ant-dropdown-menu-item check-item",{active:n===e.value}),onClick:()=>r({size:e.value})},t.createElement("span",{className:"label"},e.label),t.createElement("i",{className:"icon"},t.createElement($e,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},t.createElement("span",null,t.createElement(dt,{className:"icon"}),i("qm.pivotGrid.lineHeight.text")))},Dd="606060",Md="thin",Hd="d4d4d4",$d=(e,t)=>{t&&(e.height=Math.floor(.75*t))},qd=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},jd=()=>({top:{style:Md,color:{argb:Hd}},left:{style:Md,color:{argb:Hd}},bottom:{style:Md,color:{argb:Hd}},right:{style:Md,color:{argb:Hd}}}),Kd=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Vd=()=>{const{prefixCls:e,pivotRef:n,columns:r,countMethod:i,summationData:l}=Rd(),{t:a}=Mn(),{exportXLSX:o}=(()=>{const{size:e}=Rd(),{t:t}=Mn(),{rowHeightMaps:n}=ls,r=(e,t)=>{var n,r,i;return null!==(i=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==i?i:""};return{exportXLSX:(r,i,l,a)=>Dn(void 0,void 0,void 0,(function*(){const{columns:o,footSummation:s}=r,c=n[e],d=Jl(o),u=[],m=[],h=[];let p=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=Ia(e.title),h.push({key:t,width:(n||r)/8})})),u.push(f),p+=u.length;const g=i.map(((e,t)=>{const n={};return d.forEach(((r,i)=>{const l=["percent","finance"].includes(r.formatType);n[r.dataIndex]=l?va(e,r.dataIndex):a(e,t,r,i)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));p+=g.length,s&&l(d,i).forEach(((e,n)=>{const r={};d.forEach(((n,l)=>{const{dataIndex:a,summation:o}=n,s=(null==o?void 0:o.render)?o.render(i):va(e,a);r[a]=0===l&&""===s?t("qm.table.config.summaryText"):jn(s)?Ta(s).join(""):s})),m.push(r)}));const{sheetName:v,useStyle:y}=r,b=new Xt.Workbook,x=b.addWorksheet(v);x.columns=h,x.addRows(u).forEach((e=>{y&&$d(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=ra(o,t.key),{align:r,theadAlign:i}=n;qd(e,i||r),y&&Object.assign(e,{font:{bold:!0,color:{argb:Dd}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:jd()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];y&&$d(e,c),e.eachCell(((e,t)=>{const i=x.getColumn(e.col),l=ra(o,i.key),{align:a}=l;qd(e,1===t||void 0===r?a:"right"),Object.assign(e,Kd(l)),y&&Object.assign(e,{font:{color:{argb:Dd}},border:jd()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),s&&x.addRows(m).forEach((e=>{y&&$d(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=ra(o,n.key),{align:i}=r;qd(e,1===t?i:"right"),Object.assign(e,Kd(r)),y&&Object.assign(e,{font:{color:{argb:Dd}},border:jd()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=yield b.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})})),importXLSX:(e,n)=>{const{columns:i,file:l}=e,a=Jl(i),o=new FileReader;o.onerror=()=>{R.error(t("qm.table.import.error"))},o.onload=e=>{const i=a.map((e=>Ia(e.title))),l=new Xt.Workbook,o=e.target;o?l.xlsx.load(o.result).then((e=>{const l=e.worksheets[0];if(l){const e=l.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(i,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let i=e;Array.isArray(null==i?void 0:i.richText)&&(i=i.richText.map((e=>e.text)).join("")),ae(i)&&"text"in i&&(i=i.text),Ce(i)&&(i=Sa(i,Yo)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[s[n]]=i}));const n={};return i.forEach(((e,i)=>{var l;const{dataIndex:o,dictItems:s}=a[i];Array.isArray(s)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>r(s,e))).filter((e=>""!==e)):t[e]=r(s,t[e])),ya(n,o,t[e])})),n}));null==n||n(t)}else R.error(t("qm.table.import.error"))}else R.error(t("qm.table.import.error"))})):R.error(t("qm.table.import.error"))},o.readAsArrayBuffer(l)}}})(),{getTitleFromCellValue:s}=gs(),c=[{text:a("qm.pivotGrid.count.records"),value:"count"},{text:a("qm.pivotGrid.count.unique"),value:"unique"},{text:a("qm.pivotGrid.count.empty"),value:"empty"},{text:a("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:a("qm.pivotGrid.count.sum"),value:"sum"},{text:a("qm.pivotGrid.count.max"),value:"max"},{text:a("qm.pivotGrid.count.min"),value:"min"},{text:a("qm.pivotGrid.count.avg"),value:"avg"}],d={columns:ea(r),fileName:h().format(Xo),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},u=(e,t,n,r)=>{const{dataIndex:i,precision:l,formatType:a}=n;if(xd(e))return va(e,i);let o=s(e,n,t,r);return l>=0&&!a&&""!==o&&(o=Number(o)),o},m=()=>{if(!i||!Object.keys(i).length)return[];const e={};return d.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";(null==i?void 0:i[t])&&(n=c.find((e=>e.value===i[t])).text+" "+l.total[t]),ya(e,t,n)}})),[e]},p=e=>Dn(void 0,void 0,void 0,(function*(){const t=yield o(Object.assign(Object.assign({},d),{footSummation:!!Object.keys(i).length}),e,m,u);wl(t,`${h().format(Xo)}.xlsx`)})),f=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(ut,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.group")),onClick:()=>{p((()=>{const e=[];let t=0;return n.current.flatGroupData.forEach((n=>{const a=Object.assign({},n);xd(n)?(a._level=n._groupLevel,d.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(0===t)ya(a,e,s(n._record,r.find((e=>e.dataIndex===n._fieldName)),0,0));else{let t="";(null==i?void 0:i[e])&&(t=c.find((t=>t.value===i[e])).text+" "+Ed(l,n.id).subtotal[e]),ya(a,e,t)}})),t=n._groupLevel):t>0&&(a._level=n._level+t+1),e.push(a)})),e})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(mt,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.list")),onClick:()=>{p(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(H,{trigger:["click"],menu:{items:f},className:Pe("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(je,{className:"icon"}),a("qm.pivotGrid.export.text")))},zd=()=>{const{prefixCls:e,pivotRef:n,groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o,setContext:s}=Rd(),{uniqueKey:c}=n.current.props,{t:d}=Mn(),u=t.useMemo((()=>c?`grid_conf_${c}`:""),[c]),m=t.useRef({}),[p,f]=t.useState([]),[g,v]=t.useState({}),[y,b]=t.useState(""),x=(e,t)=>{v((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))};t.useLayoutEffect((()=>{E()}),[]),Hi((()=>{w()}),[p]);const E=()=>Dn(void 0,void 0,void 0,(function*(){try{if(!u)return;const e=yield Qt.getItem(u);Array.isArray(e)&&(f(e),v(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}})),w=()=>Dn(void 0,void 0,void 0,(function*(){try{if(!u)return;yield Qt.setItem(u,p)}catch(e){}})),C=()=>{const e=Na();f([{id:e,label:h().format(Xo),value:{groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o}},...p]),Bn((()=>x(e,!0)))},S=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,d("qm.pivotGrid.saved.title"))),t.createElement("div",{className:"list"},t.createElement("ul",null,p.map((e=>t.createElement("li",{key:e.id,className:Pe("ant-dropdown-menu-item sort-item",{active:e.id===y}),onClick:()=>(e=>{if(g[e.id])return;const t=y!==e.id,n=t?e.value:m.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),b(t?e.id:"")})(e)},t.createElement("div",{className:"label",style:{width:200}},g[e.id]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,f([...p])),x(e.id,!1)}}):t.createElement("span",null,e.label)),t.createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?t.createElement($e,null):t.createElement(He,null)),t.createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(p.filter((e=>e.id!==n)))}},t.createElement(it,null))))))),t.createElement("div",{className:"add-record",style:{padding:10}},t.createElement("span",{className:"insert",onClick:C},t.createElement(rt,{className:"icon"}),d("qm.pivotGrid.saved.add"))));return t.createElement(H,{trigger:["click"],dropdownRender:()=>S(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o}:{},m.current=t}},t.createElement("span",null,t.createElement(ht,{className:"icon"}),d("qm.pivotGrid.saved.text")))},Wd=()=>{const{gridData:e}=Rd(),{t:n}=Mn();return t.createElement("div",{className:"alert-info"},t.createElement(pt,{className:"icon"}),n("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Bd=8;const Ud={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},Gd={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Yd=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Xd(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:l,visibleFirst:a}=e,o=t/2,s={};return Object.keys(Ud).forEach((e=>{const c=r&&Gd[e]||Ud[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,Yd.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-o-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=o+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-o-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=o+i}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?Bd:r}}({contentRadius:l,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":d.offset[1]=2*-u.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":d.offset[1]=2*u.arrowOffsetHorizontal-o}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const i=r&&"object"==typeof r?r:{},l={};switch(e){case"top":case"bottom":l.shiftX=2*t.arrowOffsetHorizontal+n,l.shiftY=!0,l.adjustY=!0;break;case"left":case"right":l.shiftY=2*t.arrowOffsetVertical+n,l.shiftX=!0,l.adjustX=!0}const a=Object.assign(Object.assign({},l),i);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,u,t,n),a&&(d.htmlRegion="visibleFirst")})),s}const Qd=e=>{const{value:n,defaultValue:r,disabled:i,disabledAlpha:l,className:a,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=os("",{value:n,defaultValue:r}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),h=Xd({offset:0,arrowWidth:16,borderRadius:6}),p=lr("color-picker");return t.createElement(Zt,{action:["click"],prefixCls:p,popupPlacement:"bottomLeft",builtinPlacements:h,popup:()=>t.createElement(Jt,{prefixCls:p,value:d,disabled:i,disabledAlpha:l,onChange:(e,t)=>{u(e.toRgbString()),null==s||s(m(e),t)},onChangeComplete:(e,t)=>{null==c||c(m(e),t)}})},t.createElement("div",{className:Pe(`${p}-btn`,a),style:o},t.createElement(en,{color:d,prefixCls:p})))};Qd.displayName="ColorPicker";const Zd=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,columns:i,colorList:l,setColorList:a,setFillColor:o}=Rd(),{flatGroupData:s}=n.current,{t:c}=Mn(),d=t.useRef([]),u=t.useMemo((()=>l.filter((e=>e.fieldName&&e.color&&($a(e.expression)||!Gn(e.value)||"col"===e.mode)))),[l]),m=t.useMemo((()=>i.map((e=>({label:Ia(e.title),value:e.dataIndex})))),[i]),h=t.useMemo((()=>yd(i)),[i]),p=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"},{label:c("qm.pivotGrid.fillColor.col"),value:"col"}];Hi((()=>{f()}),[t.useMemo((()=>{const e=u.map((e=>{var t;return{[e.color]:`${e.mode},${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}}));return he(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=cl((()=>{const e=[];u.forEach((t=>{const n=ka([Object.assign(Object.assign({},Xn(t,["value"])),{condition:t.value})]),i=Zl(s.filter((e=>!xd(e))),n);if("cell"===t.mode||"col"===t.mode)for(let n=0;n<i.length;n++)e.push({color:t.color,rowKey:r(i[n],i[n].index),dataIndex:t.fieldName});if("row"===t.mode)for(let n=0;n<i.length;n++){const l=r(i[n],i[n].index);for(let n=0;n<h.length;n++)e.push({color:t.color,rowKey:l,dataIndex:h[n].dataIndex})}})),o(e)}),200),g=()=>{a([...l,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},v=(e,t,n)=>{var r;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(r=i.find((e=>e.dataIndex===n)).filter)||void 0===r?void 0:r.type)||"text";Object.assign(t,{type:e,expression:y(e)[0].value,value:""})}"expression"===e&&$a(n)&&Object.assign(t,{value:""}),a([...l])},y=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",text:c("qm.table.highSearch.nullText")},{value:"nnil",text:c("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",text:c("qm.table.highSearch.nullText")},{value:"nnil",text:c("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.inText")},{value:"nlike",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"^=",label:c("qm.table.highSearch.startsWithText")},{value:"=$",label:c("qm.table.highSearch.endsWithText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}]}return t},b=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(Qd,{defaultValue:e.color,style:{marginLeft:5},onChangeComplete:t=>v("color",e,t.hex)}),t.createElement(D,{value:e.mode,options:p,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:t=>v("mode",e,t)}),t.createElement(D,{value:e.fieldName||void 0,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>v("fieldName",e,t)}),"col"!==e.mode&&t.createElement(D,{value:e.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:y(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),"col"!==e.mode&&(e=>{var n,r;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,Gn(t)?"":t)}});case"date":return t.createElement(In,{popupClassName:ls.popupClassName,defaultValue:null!==(n=Ca(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,Sa(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(r=i.find((t=>t.dataIndex===e.fieldName)))||void 0===r?void 0:r.dictItems)||[];return t.createElement(D,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(D.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:$a(e.expression),onChange:t=>{v("value",e,t.target.value)}})}})(e),t.createElement(it,{className:"icon close",onClick:()=>(e=>{a(l.filter((t=>t!==e)))})(e)}));return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.fillColor.title"))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.fieldName)),n=l.map((e=>e.fieldName));he(t,n)||a(e)}},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},b(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(rt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(ft,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Jd=()=>t.createElement("div",{className:"top-bar"},t.createElement(ir,{size:4},t.createElement(Wd,null),t.createElement(q,{type:"vertical"}),t.createElement(_d,null),t.createElement(Od,null),t.createElement(kd,null),t.createElement(Ld,null),t.createElement(q,{type:"vertical"}),t.createElement(Fd,null),t.createElement(Zd,null),t.createElement(Ad,null),t.createElement(q,{type:"vertical"}),t.createElement(Vd,null)),t.createElement(ir,{size:4},t.createElement(zd,null))),eu=t.createContext(void 0),tu=e=>{var n,r;const{scrollbar:i}=e,{pivotRef:l,getRowKey:a,columns:o,groupGridData:s,setPivotGridRef:c}=Rd(),{rowSelection:d,treeExpandable:u,rowHighlight:m}=l.current.props,h=null===(n=null==u?void 0:u.defaultExpandAllRows)||void 0===n||n,p=t.useRef({bodyEl:null,rowVirtualizer:null}),[f,g]=t.useState({gridRef:p,scrollbarRef:i,selectionKeys:null!==(r=null==d?void 0:d.defaultSelectedRowKeys)&&void 0!==r?r:[],treeExpandKeys:h?ca(l.current.originGridData,(e=>a(e,e.index))):[],highlightKey:"",checkedColumnKey:"",updateLayout:0,clicked:[],isPingLeft:!1}),v=t.useMemo((()=>Math.max(0,wd(s)-1)),[s]),y=e=>{g((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const l=i;Object.is(t[l],e[l])||(n[l]=e[l],r=!0)})),r?n:t}))},b=(e,t)=>{f.gridRef.current[e]=t};t.useLayoutEffect((()=>{I(),S()}),[o]),t.useLayoutEffect((()=>{(null==d?void 0:d.selectedRowKeys)&&y({selectionKeys:d.selectedRowKeys})}),[null==d?void 0:d.selectedRowKeys]),t.useLayoutEffect((()=>{void 0!==(null==m?void 0:m.currentRowKey)&&y({highlightKey:m.currentRowKey})}),[null==m?void 0:m.currentRowKey]);const x=e=>{Array.isArray(null==d?void 0:d.selectedRowKeys)||y({selectionKeys:e})},E=e=>{y({treeExpandKeys:e})},w=e=>{void 0===(null==m?void 0:m.currentRowKey)&&y({highlightKey:e})},C=e=>{y({checkedColumnKey:e})},S=()=>{y({updateLayout:f.updateLayout+1})},N=e=>{Ha(e,f.clicked,!0)||y({clicked:e})},T=e=>{y({isPingLeft:e})},I=()=>{const e=i.current.container.clientWidth,{defaultColumnWidth:t}=ls,n=[];let r=0;if(o.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,r+=e.width):(e.renderWidth=void 0,n.push(e))})),n.length>0){const r=o.reduce(((e,n)=>e+(n.width||n.minWidth||t)),0);if(r<=e){const i=e-r;if(1===n.length)n[0].renderWidth=(n[0].minWidth||t)+i;else{const e=i/n.reduce(((e,n)=>e+(n.minWidth||t)),0);let r=0;n.forEach(((n,i)=>{if(0===i)return;const l=Math.floor((n.minWidth||t)*e);r+=l,n.renderWidth=(n.minWidth||t)+l})),n[0].renderWidth=(n[0].minWidth||t)+i-r}}else n.forEach((e=>{e.renderWidth=e.minWidth||t}))}else r=o.reduce(((e,n)=>e+(n.renderWidth=n.width||n.minWidth||t)),0)},R=t.useMemo((()=>Object.assign(Object.assign({},f),{indentDepth:v,setContext:y,setGridLayoutRef:b,setSelectionKeys:x,setTreeExpandKeys:E,setHighlightKey:w,setCheckColumnKey:C,forceUpdateLayout:S,setClicked:N,setPingLeft:T,updateColumnsWidth:I})),[f,v]);return t.createElement(eu.Provider,{value:R},e.children)},nu=()=>t.useContext(eu),ru=e=>{var n;const{column:r}=e,{columns:i,setColumns:l}=Rd(),{scrollbarRef:a}=nu(),o=t.useRef(null),[s,c]=t.useState(!1),d=t.useRef(document.onselectstart),u=t.useRef({startX:0,originSizeX:0,columnWidth:0}),m=e=>{u.current=Object.assign({},u.current,e)},h=e=>{if(1!==e.buttons)return p();const t=e.clientX-u.current.startX,n=(r.width||r.renderWidth)+t;n<(r.minWidth||ls.defaultColumnWidth)||(m({columnWidth:n}),o.current.style.left=`${u.current.originSizeX+t}px`)},p=()=>{a.current.container.style.cursor="",r.width=u.current.columnWidth,l([...i]),Bn((()=>c(!1))),qi(document,"mousemove",h),qi(document,"mouseup",p),m({startX:0,originSizeX:0,columnWidth:0}),f()},f=()=>{document.onselectstart!==d.current&&(document.onselectstart=d.current)};return t.createElement(t.Fragment,null,t.createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),a.current.container.style.cursor="col-resize";const t=pa(e.target,a.current.container).left-a.current.scrollLeft+3;m({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),$i(document,"mousemove",h),$i(document,"mouseup",p),c(!0),Bn((()=>o.current.style.left=`${t}px`)),d.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(tn,{open:s,getContainer:null===(n=a.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},iu=e=>{var n;const{left:r}=e,{scrollbarRef:i,isPingLeft:l,setPingLeft:a}=nu(),o=Hn((e=>{a(e.target.scrollLeft>1)}));return t.useEffect((()=>{const e=i.current.container.children[0];return e.addEventListener("scroll",o),()=>{e.removeEventListener("scroll",o)}}),[]),t.createElement(tn,{open:!0,getContainer:null===(n=i.current)||void 0===n?void 0:n.container},t.createElement("div",{className:Pe("fixed-line",{active:l}),style:{left:r}}))},lu=()=>{const{pivotRef:e,columns:n}=Rd(),{indentDepth:r,updateLayout:i,checkedColumnKey:l,selectionKeys:a,setSelectionKeys:o,setCheckColumnKey:s}=nu(),{rowSelection:c}=e.current.props,{selectionColumn:d}=ls,{indentWidth:u,selectionColumnDefine:m}=vd,h=t.useMemo((()=>yd(n)),[n]),p=t.useMemo((()=>h.filter((e=>"left"===e.fixed))),[h]),f=t.useMemo((()=>h.filter((e=>"left"!==e.fixed))),[h]),g=t.useMemo((()=>"radio"!==(null==c?void 0:c.type)),[c]),v=t.useMemo((()=>p.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?r*u:0)),0)),[r,i,p]),y=t.useMemo((()=>a.length>0&&a.length===e.current.keyRecordMap.size),[a]),b=t.useMemo((()=>a.length>0&&a.length<e.current.keyRecordMap.size),[a]),x=(n,i)=>t.createElement("div",{className:Pe(i?"fixed-left":"no-fixed"),style:{width:i?v:""}},n.map(((a,h)=>{const{dataIndex:p,title:f,align:v,width:x,renderWidth:E}=a,w={"selection-column":p===d,"col--center":"center"===v,"col--right":"right"===v,"col--checked":l===p},C=i&&1===h||!i&&h===n.length-1?r*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return t.createElement("div",{key:p,className:Pe("table-cell",w),style:S,onClick:()=>{return e=p,void([m.dataIndex].includes(e)||s(l!==e?e:""));var e}},p!==d?t.createElement("span",{className:"cell"},f):c&&g?t.createElement(M,{checked:y,indeterminate:b,onChange:t=>(t=>{var n;const r=t?Array.from(e.current.keyRecordMap.keys()):[];o(r),null===(n=null==c?void 0:c.onChange)||void 0===n||n.call(c,r,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",p!==d&&t.createElement(ru,{column:a}))})));return t.createElement("div",{className:"header"},x(p,!0),(e=>x(e))(f),t.createElement(iu,{left:v}))};function au(e,t,n){var r;let i,l=null!==(r=n.initialDeps)&&void 0!==r?r:[];function a(){var r,a,o,s,c;let d;n.key&&(null===(r=n.debug)||void 0===r?void 0:r.call(n))&&(d=Date.now());const u=e(),m=u.length!==l.length||u.some(((e,t)=>l[t]!==e));if(!(null===(a=n.noCache)||void 0===a?void 0:a.call(n))&&!m)return i;let h;if(l=u,n.key&&(null===(o=n.debug)||void 0===o?void 0:o.call(n))&&(h=Date.now()),i=t(...u),n.key&&(null===(s=n.debug)||void 0===s?void 0:s.call(n))){const e=Math.round(100*(Date.now()-d))/100,t=Math.round(100*(Date.now()-h))/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return null===(c=null==n?void 0:n.onChange)||void 0===c||c.call(n,i),i}return a.updateDeps=e=>{l=e},a}function ou(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const su=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,i)),n)}},cu=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},du=e=>e,uu=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},mu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(cu(n)),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver((t=>{const r=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(cu(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()}));return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},hu={passive:!0},pu="undefined"==typeof window||"onscrollend"in window,fu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const l=e.options.useScrollendEvent&&pu?()=>{}:su(r,(()=>{t(i,!1)}),e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:o}=e.options;i=a?n.scrollLeft*(o?-1:1):n.scrollTop,l(),t(i,r)},o=a(!0),s=a(!1);s(),n.addEventListener("scroll",o,hu);const c=e.options.useScrollendEvent&&pu;return c&&n.addEventListener("scrollend",s,hu),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",s)}},gu=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e){return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},vu=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;const a=e+t;null===(l=null===(i=r.scrollElement)||void 0===i?void 0:i.scrollTo)||void 0===l||l.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class yu{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver((e=>{e.forEach((e=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()}))})):null);return{disconnect:()=>{var n;null===(n=t())||void 0===n||n.disconnect(),e=null},observe:e=>{var n;return null===(n=t())||void 0===n?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null===(n=t())||void 0===n?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options=Object.assign({debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:du,rangeExtractor:uu,onChange:()=>{},measureElement:gu,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1},e)},this.notify=e=>{var t,n;null===(n=(t=this.options).onChange)||void 0===n||n.call(t,this,e)},this.maybeNotify=au((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e,t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=null!==(t=null===(e=this.scrollElement)||void 0===e?void 0:e.window)&&void 0!==t?t:null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}},this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=null!==(e=this.scrollRect)&&void 0!==e?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=null!==(e=this.scrollOffset)&&void 0!==e?e:"function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let i=t-1;i>=0;i--){const t=e[i];if(n.has(t.lane))continue;const l=r.get(t.lane);if(null==l||t.end>l.end?r.set(t.lane,t):t.end<l.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0},this.getMeasurementOptions=au((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i})),{key:!1}),this.getMeasurements=au((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,a);for(let i=a;i<e;i++){const e=r(i),a=1===this.options.lanes?o[i-1]:this.getFurthestMeasurement(o,i),s=a?a.end+this.options.gap:t+n,c=l.get(e),d="number"==typeof c?c:this.options.estimateSize(i),u=s+d,m=a?a.lane:i%this.options.lanes;o[i]={index:i,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=au((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,l=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let a=bu(0,i,l,n),o=a;if(1===r)for(;o<i&&e[o].end<n+t;)o++;else if(r>1){const l=Array(r).fill(0);for(;o<i&&l.some((e=>e<n+t));){const t=e[o];l[t.lane]=t.end,o++}const s=Array(r).fill(n+t);for(;a>=0&&s.some((e=>e>=n));){const t=e[a];s[t.lane]=t.start,a--}a=Math.max(0,a-a%r),o=Math.min(i,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null),{key:"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=au((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,i)=>null===r||null===i?[]:e({startIndex:r,endIndex:i,overscan:t,count:n})),{key:"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const i=r.key,l=this.elementsCache.get(i);l!==e&&(l&&this.observer.unobserve(l),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{var n;const r=this.measurementsCache[e];if(!r)return;const i=t-(null!==(n=this.itemSizeCache.get(r.key))&&void 0!==n?n:r.size);0!==i&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.measureElement=e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))},this.getVirtualItems=au((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,i=e.length;r<i;r++){const i=t[e[r]];n.push(i)}return n}),{key:"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return ou(t[bu(0,t.length-1,(e=>ou(t[e]).start),e)])},this.getOffsetForAlignment=(e,t,n=0)=>{const r=this.getSize(),i=this.getScrollOffset();"auto"===t&&(t=e>=i+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const l=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(l,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),i=this.getScrollOffset();if("auto"===t)if(n.end>=i+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=i+this.options.scrollPaddingStart))return[i,t];t="start"}const l="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,t,n.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:t="auto",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const i=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[i,a]=r;this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame((()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,a);var r,i;n?(r=n[0],i=t,Math.abs(r-i)<1.01||l(a)):console.warn("Failed to get offset for index:",e)}))},l=t=>{this.targetWindow&&(r++,r<10?(this.options.debug&&console.info("Schedule retry",r,10),this.targetWindow.requestAnimationFrame((()=>i(t)))):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};i(t)},this.scrollBy=(e,{behavior:t}={})=>{"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e,t;const n=this.getMeasurements();let r;if(0===n.length)r=this.options.paddingStart;else if(1===this.options.lanes)r=null!==(t=null===(e=n[n.length-1])||void 0===e?void 0:e.end)&&void 0!==t?t:0;else{const e=Array(this.options.lanes).fill(null);let t=n.length-1;for(;t>=0&&e.some((e=>null===e));){const r=n[t];null===e[r.lane]&&(e[r.lane]=r.end),t--}r=Math.max(...e.filter((e=>null!==e)))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const bu=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else{if(!(l>r))return i;t=i-1}}return e>0?e-1:0};const xu="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function Eu(t){return function(t){const n=e.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},t),{onChange:(e,r)=>{var i;r?Ht(n):n(),null===(i=t.onChange)||void 0===i||i.call(t,e,r)}}),[i]=e.useState((()=>new yu(r)));return i.setOptions(r),xu((()=>i._didMount()),[]),xu((()=>i._willUpdate())),i}(Object.assign({observeElementRect:mu,observeElementOffset:fu,scrollToFn:vu},t))}const wu=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Cu=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Su=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!wu(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Nu({ref:t,handler:n,enabled:r=!0,omitClassNames:i=[]}){const l=Hn(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{Su(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&Su(e,t)&&Cu(e,i)&&(a.current.isPointerDown=!1,l(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&Su(e,t)&&Cu(e,i)&&(a.current.isPointerDown=!1,l(e))},c=wu(t.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[n,t,l,a,r])}const Tu=e=>{const{pivotRef:n,getRowKey:r,size:i}=Rd(),{scrollbarRef:l,clicked:a,setHighlightKey:o,setClicked:s}=nu(),{flatGroupData:c}=n.current,{rowHighlight:d}=n.current.props,u=t.useMemo((()=>2*ls.rowHeightMaps[i]),[i]),m=t.useMemo((()=>c.filter((e=>!xd(e)))),[c]),h=Hn((t=>{var n,i;const{keyCode:c}=t;if(!Gn(a)&&(27===c&&(o(""),s([])),38===c||40===c)){ji(t);const h=m.length;let p=m.findIndex((e=>r(e,e.index)===a[0]));const f=38===c?(--p+h)%h:++p%h,g=m[f],v=r(g,g.index);d&&!(null===(n=d.disabled)||void 0===n?void 0:n.call(d,g))&&(o(v),null===(i=d.onChange)||void 0===i||i.call(d,v,g)),((t,n,r)=>{const i=m.length,a=e.find((e=>e.key===r)),o=l.current.scrollTop,s=l.current.container.offsetHeight,c=a.top,d=a.height;"top"===t?c<o?l.current.SET_SCROLL_TOP(c):n===i-1&&l.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?l.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&l.current.SET_SCROLL_TOP(c)})(38===c?"top":"bottom",f,v),s([v,a[1]])}}));t.useLayoutEffect((()=>(window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h))),[])},Iu=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:l,countMethod:a,summationData:o,setCountMethod:s}=Rd(),{t:c}=Mn(),{dataIndex:d,filter:u}=n,[m,h]=t.useState(!1),p=t.useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:Nd.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:Nd.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:Nd.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:Nd.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:Nd.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:Nd.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:Nd.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:Nd.avg}];return"number"===(null==u?void 0:u.type)?e:e.slice(0,-4)}),[]),f=t.useMemo((()=>{var e,t,n;const l=a[d];if(!l)return c("qm.pivotGrid.count.statistic");return`${p.find((e=>e.value===l)).text} ${null!==(n=null===(t=null===(s=o,u=r,e=u?Ed(s,u):s)||void 0===e?void 0:e[i])||void 0===t?void 0:t[d])&&void 0!==n?n:""}`;var s,u}),[o,a]);return t.createElement(H,{open:m,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},p.map((e=>{const n=e.value===a[d];return t.createElement("li",{key:e.value,className:Pe("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[d]:n?void 0:e.value}),h(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement($e,null)))})))),className:Pe("count-select",{show:!!a[d]}),overlayClassName:`${l}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>h(e)},t.createElement("span",null,f," ",t.createElement(gt,{className:"icon"})))},Ru=(e,n)=>{const{pivotRef:r,columns:i,expandedKeys:l,searchResults:a,switchIndex:o,fillColorCells:s,setExpandedKeys:c}=Rd(),{gridRef:d,indentDepth:u,highlightKey:m,checkedColumnKey:h,selectionKeys:p,treeExpandKeys:f,setSelectionKeys:g,setTreeExpandKeys:v,setHighlightKey:y,setClicked:b}=nu(),{keyRecordMap:x,isTree:E}=r.current,{bodyEl:w,rowVirtualizer:C}=d.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,onRowEdit:I,onRowClick:R}=r.current.props,{t:O}=Mn(),{renderText:k,getTitleFromCellNode:L}=gs(),{selectionColumn:A,treeTable:P}=ls,{indentWidth:_}=vd,F=t.useMemo((()=>n?0:yd(i).length-e.length),[i,e]),D=t.useMemo((()=>"radio"!==(null==S?void 0:S.type)),[S]),H=(e,t)=>{var n,r;null==S||S.checkStrictly;const i=D?e?[...p,t]:p.filter((e=>e!==t)):[t];g(i),null===(n=null==S?void 0:S.onSelect)||void 0===n||n.call(S,e,x.get(t)),null===(r=null==S?void 0:S.onChange)||void 0===r||r.call(S,i,$(i))},$=e=>{const t=[];return e.forEach((e=>t.push(x.get(e)))),t},q=(e,t)=>{var n,r;return(null===(n=a[o])||void 0===n?void 0:n.rowKey)===e&&(null===(r=a[o])||void 0===r?void 0:r.dataIndex)===t},K=(e,t)=>{const n=w.querySelectorAll(`li.table-row[data-row-key='${e}']`);Array.from(n).forEach((e=>{e.classList[t&&!(null==C?void 0:C.isScrolling)?"add":"remove"]("row--hover")}))},V=e=>t.createElement("button",{className:Pe("button-icon",{expand:l.includes(e.id)}),onClick:()=>{return t=e.id,void c(l.includes(t)?l.filter((e=>e!==t)):[...l,t]);var t}},t.createElement(yt,null)),z=(e,n,r,l)=>{const{dataIndex:a,width:o,renderWidth:s}=e,c={"expandable-column":a===A},d=1===n?(u-r._groupLevel)*_:0,m={width:`${(o||s||0)+d}px`,minWidth:`${(o||s||0)+d}px`};return t.createElement("div",{key:a,className:Pe("label-cell",c),style:m},a!==A?t.createElement(t.Fragment,null,1===n&&t.createElement("span",{className:"title"},(e=>{const{_record:n,_fieldName:r}=e,l=va(n,r),a=i.find((e=>e.dataIndex===r));return Gn(l)||!a?t.createElement("span",{className:"empty"},O("qm.pivotGrid.group.empty")):a.render?a.render(l,n,a,0,0):k(l,a,n)})(r)),t.createElement(Iu,{column:e,keyPath:r.id,type:"subtotal"})):V(r))},W=(e,n)=>{var r,i;const l=null===(r=null==N?void 0:N.rowExpandable)||void 0===r?void 0:r.call(N,e);return t.createElement(Fe,{className:Pe("cell--expand",{fold:!f.includes(n),disabled:l}),style:{visibility:(null===(i=e.children)||void 0===i?void 0:i.length)>0?"visible":"hidden"},onClick:()=>{l||(e=>{var t,n;const r=f.includes(e),i=r?f.filter((t=>t!==e)):[...f,e];v(i),null===(t=null==N?void 0:N.onExpand)||void 0===t||t.call(N,!r,x.get(e)),null===(n=null==N?void 0:N.onChange)||void 0===n||n.call(N,i)})(n)}})},B=(e,n,r,i,l)=>{var a,o;const{dataIndex:c,width:d,renderWidth:u,align:m,render:f}=e,g=va(r,c),v=f?f(g,r,e,r.index,n):k(g,e,r),x=L(v),w=p.includes(l),C={"selection-column":c===A,"col--center":"center"===m,"col--right":"right"===m,"col--checked":h===c,active:q(l,c)},N={width:`${d||u||0}px`,minWidth:`${d||u||0}px`,backgroundColor:s.get(`${l}|${c}`)};return t.createElement("div",{key:c,"data-col-index":n,title:x,className:Pe("table-cell",C),style:N,onClick:t=>{var n,i;c!==A&&(b([l,c]),T&&!(null===(n=T.disabled)||void 0===n?void 0:n.call(T,r))&&(y(l),null===(i=T.onChange)||void 0===i||i.call(T,l,r)),null==R||R(r,e,t))}},c!==A?t.createElement(t.Fragment,null,E&&1===n&&t.createElement(t.Fragment,null,(O=r._level)?t.createElement("span",{key:O,className:`cell--indent indent-level-${O}`,style:{paddingLeft:O*P.textIndent+"px"}}):null,W(r,l)),t.createElement("span",{className:"cell"},v)):t.createElement("div",{className:"action"},t.createElement("span",{className:"drag-icon"}),t.createElement("div",{className:"middle"},t.createElement("span",{className:"order"},((e,t)=>E?0===e._level?e._varIndex+1:null:t+1)(r,i)),S&&t.createElement(t.Fragment,null,D?t.createElement(M,{className:"checkbox",checked:w,disabled:null===(a=null==S?void 0:S.disabled)||void 0===a?void 0:a.call(S,r),onChange:e=>H(e.target.checked,l)}):t.createElement(j,{className:"checkbox",checked:w,disabled:null===(o=null==S?void 0:S.disabled)||void 0===o?void 0:o.call(S,r),onChange:e=>H(e.target.checked,l)}))),t.createElement("span",{className:"expand-icon",onClick:()=>null==I?void 0:I(r,i)},I?t.createElement(vt,null):null)));var O};return{renderGroupRow:(n,r)=>t.createElement("div",{className:"label-row"},e.map(((e,t)=>z(e,F+t,n)))),renderRow:(n,r,i)=>{const l={"row--selection":p.includes(i),"row--highlight":m===i};return t.createElement("li",{key:i,"data-row-key":i,className:Pe("table-row",l),onMouseEnter:()=>K(i,!0),onMouseLeave:()=>K(i)},e.map(((e,t)=>B(e,F+t,n,r,i))))}}},Ou=e=>{const{tbodyColumns:n,layout:r,displayList:i,virtualRows:l,notGroup:a}=e,{indentDepth:o,updateLayout:s}=nu(),{indentWidth:c}=vd,d=t.useMemo((()=>n.filter((e=>"left"===e.fixed))),[n]),u=t.useMemo((()=>d.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?o*c:0)),0)),[o,s,d]),{renderGroupRow:m,renderRow:h}=Ru(d,!0);return t.createElement("div",{className:"left-panel",style:{width:u}},t.createElement("div",{className:Pe("container",{"no-group":a})},l.map((e=>{const n=e.index,l=r[n],a=i[n];if(xd(a))return t.createElement("div",{key:a.id,className:Pe("group-label",`level${a._groupLevel}`),style:{top:l.top,left:l.left,right:0,height:l.height}},m(a,l.key));const o=n===r.length-1||xd(i[n+1]);return t.createElement("div",{key:l.key,className:Pe("row-item",{last:o}),style:{top:l.top,left:l.left,right:0,height:l.height}},h(a,a._varIndex,l.key))}))))},ku=e=>{const{tbodyColumns:n,layout:r,displayList:i,virtualRows:l,notGroup:a}=e;Rd();const o=t.useMemo((()=>n.filter((e=>"left"!==e.fixed))),[n]),{renderGroupRow:s,renderRow:c}=Ru(o);return t.createElement("div",{className:"main-panel"},t.createElement("div",{className:Pe("container",{"no-group":a})},l.map((e=>{const n=e.index,l=r[n],a=i[n];if(xd(a))return t.createElement("div",{key:a.id,className:Pe("group-label",`level${a._groupLevel}`),style:{top:l.top,left:0,right:l.right,height:l.height}},s(a,l.key));const o=n===r.length-1||xd(i[n+1]);return t.createElement("div",{key:l.key,className:Pe("row-item",{last:o}),style:{top:l.top,left:0,right:l.right,height:l.height}},c(a,a._varIndex,l.key))}))))},Lu=()=>{const{pivotRef:e,getRowKey:n,prefixCls:r,size:i,columns:l,groupGridData:a,expandedKeys:o,searchResults:s,switchIndex:c}=Rd(),{scrollbarRef:d,treeExpandKeys:u,setGridLayoutRef:m}=nu(),{flatGroupData:h}=e.current,{contextMenues:p}=e.current.props,{groupMargin:f}=vd,{rowHeightMaps:g}=ls,v=t.useRef(null),y=t.useMemo((()=>yd(l)),[l]),b=t.useMemo((()=>Array.isArray(a)),[a]),{contextMenu:x,closeMenu:E}=(({ref:e,popup:n,getTriggerContainer:r,prevent:i,prefixCls:l="",enabled:a=!0})=>{const o=t.useRef(null),s=t.useRef(null),c=e=>{s.current=e},[d,u]=t.useState(!1),[m,h]=t.useState(null),p={width:150,height:200,zIndex:9999};Nu({ref:o,handler:()=>f()});const f=()=>{u(!1),h(null),c(null)},g=Hn((e=>{if(e.preventDefault(),null==i?void 0:i(e.target))return f();c(e),u(!0),Bn((()=>{var t;const{width:n,height:r}=(null===(t=o.current)||void 0===t?void 0:t.getBoundingClientRect())||p,i=n,l=r,a=window.innerWidth,s=window.innerHeight;let c=e.clientX,d=e.clientY;c+i>a&&(c=Math.max(c-i,0)),d+l>s&&(d=Math.max(d-l,0)),h({x:c,y:d})}))}));t.useEffect((()=>{const t=(null==r?void 0:r(e.current))||e.current;return a&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const v={position:"fixed",top:`${(null==m?void 0:m.y)||0}px`,left:`${(null==m?void 0:m.x)||0}px`,zIndex:p.zIndex};return{contextMenu:t.createElement(tn,{open:d},t.createElement("div",{ref:o,className:`${l}__context-menu`,style:v},s.current?n(s.current):null)),closeMenu:f}})({ref:v,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:r,enabled:!!p,popup:e=>{var r;const i=Ui(e.target,"table-cell"),l=(null===(r=null==i?void 0:i.parentNode)||void 0===r?void 0:r.getAttribute("data-row-key"))||"",a=h.find((e=>n(e,e.index)==l)),o=Number((null==i?void 0:i.getAttribute("data-col-index"))||-1),s=y[o];return t.createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},p.map((e=>{var n;const r=(null===(n=e.disabled)||void 0===n?void 0:n.call(e,a,s))||!1;return t.createElement("li",{key:e.key,className:Pe("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":r}),onClick:()=>{var t;r||(Bn((()=>E())),null===(t=e.onClick)||void 0===t||t.call(e,a,s))}},e.prefix&&t.createElement("span",{className:"prefix"},e.prefix),t.createElement("span",{className:"label"},e.label),e.suffix&&t.createElement("span",{className:"suffix"},e.suffix))})))}}),w=e=>{var t;const n=h[e];for(let r=e+1;r<h.length;r++)if(null===(t=h[r]._parentRowKey)||void 0===t?void 0:t.startsWith(n.id)){Object.assign(n,{_record:h[r]});break}},C=t.useMemo((()=>{const e=new Map,t=[];return h.forEach(((r,i)=>{if(xd(r)){if(0===r._groupLevel)return e.set(r.id,o.includes(r.id)),w(i),void t.push(r);const n=r.id.slice(0,r.id.lastIndexOf(vd.separator));return void(o.includes(n)&&e.get(n)&&(e.set(r.id,o.includes(r.id)),w(i),t.push(r)))}const l=n(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(l,u.includes(l)),t.push(r))})),e.clear(),t}),[a,o,u]),S=t.useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],i=[],l=n,a=vd.indentWidth,o=vd.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;i.length>0&&i[i.length-1]._level>=e._groupLevel;){const e=i.pop();if(e.height=e._childHeight+l,r[e._index].height=e.height,i.length>0){const t=i[i.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}i[i.length-1];const t={key:e.id,top:s,left:a*e._groupLevel,right:a*e._groupLevel,height:l,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),i.push(t),s+=l}else{const n=i[i.length-1]||{left:0,right:0},a={key:t(e,e.index),top:s,left:n.left,right:n.right,height:l};r.push(a),s+=l,i.length>0&&(n._childHeight+=l)}}));i.length>0;){const e=i.pop();if(e.height=e._childHeight+l,r[e._index].height=e.height,i.length>0){const t=i[i.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(C,{getRowKey:n,rowHeight:g[i]})),[C,i]);Tu(S);const N=t.useMemo((()=>{if(b)return S.reduce(((e,t)=>e+t.height),0)+2*f;const e=S.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*f+2*f}),[b,S]),{rowVirtualizer:T,virtualRows:I}=(e=>{const{layout:n,isGroup:r}=e,{size:i}=Rd(),{scrollbarRef:l}=nu(),{rowHeightMaps:a}=ls,o=t.useMemo((()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[l.current]),s=Eu({count:n.length,getScrollElement:()=>o,estimateSize:e=>n[e].height,overscan:1,noCache:r,rangeExtractor:e=>{var t;if(!r)return uu(e);const c=l.current.scrollTop,d=(null===(t=s.scrollElement)||void 0===t?void 0:t.offsetHeight)||o.offsetHeight,u=[];for(let e=0;e<n.length;e++){const t=n[e];c>t.top+t.height+a[i]||c+d+a[i]<t.top||u.push(e)}return u}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:S,isGroup:!b});Hi((()=>{const e=h.findIndex((e=>{var t;return n(e,e.index)===(null===(t=s[c])||void 0===t?void 0:t.rowKey)}));e>=0&&d.current.SET_SCROLL_TOP(e*g[i]);const t=y.findIndex((e=>{var t;return e.dataIndex===(null===(t=s[c])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=y.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);d.current.SET_SCROLL_LEFT(e)}}),[c,s]),t.useLayoutEffect((()=>{m("bodyEl",v.current),m("rowVirtualizer",T)}),[]);const R={tbodyColumns:y,layout:S,displayList:C,virtualRows:I,notGroup:b};return t.createElement("div",{ref:v,className:"body",style:{height:N}},t.createElement(Ou,R),t.createElement(ku,R),x)},Au=()=>{const{columns:e,groupGridData:n,countMethod:r,setSummationData:i}=Rd(),{indentDepth:l,updateLayout:a}=nu(),{selectionColumn:o}=ls,{indentWidth:s}=vd,c=t.useMemo((()=>yd(e)),[e]),d=t.useMemo((()=>c.filter((e=>"left"===e.fixed))),[c]),u=t.useMemo((()=>c.filter((e=>"left"!==e.fixed))),[c]),m=t.useMemo((()=>d.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?l*s:0)),0)),[l,a,d]);Hi((()=>{i(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const i=e.map((e=>Yn(e,r)||0));n[r]=t[r](i)}return n},i=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const l={},a={};Object.keys(t).forEach((e=>{a[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>Yn(e,n)||0));e[n]=t[n](r),a[n].push(...r)}l[r]={subtotal:e}}else{const e=i(o);l[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&a[n].push(t)}}}if(0===n.length)return l;const o={};for(const e in t)o[e]=t[e](a[e]);return l.subtotal=o,l},l=Array.isArray(e)?{total:r(e)}:i(e);return n.length>0&&(l.total=r(n)),delete l.subtotal,l})(n,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:Nd[e[n]]});return t})(r)))}),[r,n]);const h=(e,n)=>t.createElement("div",{className:Pe(n?"fixed-left":"no-fixed"),style:{width:n?m:""}},e.map(((r,i)=>{const{dataIndex:a,width:c,renderWidth:d}=r,u={"selection-column":a===o,"col--right":!0},m=n&&1===i||!n&&i===e.length-1?l*s:0,h={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return t.createElement("div",{key:a,className:Pe("table-cell",u),style:h},a!==o?t.createElement(Iu,{column:r,keyPath:"",type:"total"}):null)})));return t.createElement("div",{className:"footer"},h(d,!0),(e=>h(e))(u))},Pu=()=>{const{prefixCls:e,size:n}=Rd(),r=t.useRef(null);return t.createElement(tu,{scrollbar:r},t.createElement(El,{ref:r,wrapStyle:{height:"100%",maxHeight:"inherit"},className:Pe(`${e}__layout`,n)},t.createElement(lu,null),t.createElement(Lu,null),t.createElement(Au,null)))},_u=()=>t.createElement("div",{className:"wrapper"},t.createElement(Pu,null)),Fu={rowKey:"id",columns:[],dataSource:[]},Du=e=>{const n=mn(Fu,e),{rowKey:r,fromTable:i,columns:l,dataSource:a,height:o,maxHeight:s,className:c,style:d}=n,{$size:u}=$n(n),m=Hn(((e,t)=>{const n="function"==typeof r?r(e,t):null==e?void 0:e[r];return void 0===n?(tr("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),h=(e,t="",n=0)=>e.map(((e,r)=>{const i=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=h(e.children,i,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),p=e=>{let t=!1;const n=(e=>e.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex))))(e).map((e=>{"left"===e.fixed&&(t=!0);const n=Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0});return i&&(void 0===n.fixed&&delete n.fixed,delete n.editRender),n}));return!t&&n.length&&(n[0].fixed="left",tr("PivotGrid","至少需要有一项 `fixed: left` 的固定列")),n},f=t.useMemo((()=>p(l)),[l]),g=t.useMemo((()=>h(a)),[a]),v=lr("pivot-grid"),y={[v]:!0,"is-from-table":i},b={height:o,maxHeight:o||s?s:500},x={prefixCls:v,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:Xn(n,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return t.createElement("div",{className:Pe(y,c),style:Object.assign(Object.assign({},d),b)},t.createElement(Id,x,t.createElement(Jd,null),t.createElement(_u,null)))};Du.displayName="PivotGrid";const Mu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:i,prefixCls:l,flattenColumns:a}=t.useContext(Ko),{rowKey:o,uniqueKey:s}=i.current.props,{t:c}=Mn(),{tableFullData:d}=i.current,[u,m]=t.useState(!1),h=()=>{m(!0)};t.useImperativeHandle(n,(()=>({clickHandle:h})));const p={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>h()},t.createElement("i",{className:"svgicon icon"},t.createElement(bt,null))),t.createElement(Ml,p,t.createElement(Du,{fromTable:!0,rowKey:o,uniqueKey:s,columns:a,dataSource:d})))}));Mu.displayName="PivotGrid";const Hu=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:l,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(Ko),{fetch:d}=l.current.props,{t:u}=Mn(),m=e=>{var t;const r=n.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:null!==(t=r.dictItems)&&void 0!==t?t:[]}},p=r.map((e=>Object.assign({dataIndex:e.group},m(e.group)))),f=i.map((e=>e.summary===ls.groupSummary.total.value?{dataIndex:e.summary,title:ls.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},m(e.summary)),{formula:e.formula}))),g=t.useMemo((()=>Object.assign({},s,{[ls.sorterFieldName]:void 0,[ls.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[ls.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[ls.currentPageName]:1})),[s,r,i]),[v,y]=t.useState(((e,t)=>[{title:u("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{var t;const r=null===(t=n.find((t=>t.dataIndex===e.dataIndex)))||void 0===t?void 0:t.groupSummary;let i=r?{summation:r}:null;return e.dataIndex===ls.groupSummary.total.value&&(i={dataIndex:ls.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?i:null)}))])(p,f)),[b]=t.useState(c?[]:(e=>{const t=La(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&ya(t,r,va(e[0],r))})),i.forEach((n=>{const r=n.summary!==ls.groupSummary.total.value?n.summary:ls.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&ya(t,r,e.length),"sum"===i&&ya(t,r,Se(e,r)),"max"===i&&ya(t,r,Ne(e,r)[r]),"min"===i&&ya(t,r,Te(e,r)[r]),"avg"===i&&ya(t,r,(Se(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(l.current.tableFullData)),x=Object.assign(Object.assign({size:a,height:400},c?{fetch:{api:d.api,params:g,dataKey:null==d?void 0:d.dataKey}}:{dataSource:b}),{columns:v,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${h().format(Xo)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(Bm,x)},$u=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:i,prefixCls:l,$size:a,flattenColumns:o}=t.useContext(Ko),{uniqueKey:s}=i.current.props,{t:c}=Mn(),d=t.useRef(null),u=t.useRef(null),[m,h]=t.useState(!1),[p,f]=t.useState([]),[g,v]=t.useState(""),[y,b]=t.useState("");Hi((()=>{if(y){const{group:e,summary:t}=p.find((e=>e.value===y)).list;T(e),L(t)}else{const e=D();T((null==e?void 0:e.group)||[]),L((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{M()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex)))),[o]),w=E.filter((e=>!e.groupSummary)).map((e=>({text:Ia(e.title),value:e.dataIndex}))),C=[ls.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:Ia(e.title),value:e.dataIndex})))],S=[{text:c("qm.table.groupSummary.sumText"),value:"sum"},{text:c("qm.table.groupSummary.maxText"),value:"max"},{text:c("qm.table.groupSummary.minText"),value:"min"},{text:c("qm.table.groupSummary.avgText"),value:"avg"},{text:c("qm.table.groupSummary.countText"),value:"count"}],[N,T]=t.useState([]),[I,R]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(nr,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>Object.assign(Object.assign({},e),{disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[k,L]=t.useState([]),[A,P]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(nr,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>Object.assign(Object.assign({},e),{disabled:k.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===ls.groupSummary.total.value?S.slice(S.length-1):S})}]),_=t.useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=k.length&&k.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,k]),F=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}))},D=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},M=()=>Dn(void 0,void 0,void 0,(function*(){if(!x)return;const e=D();if(e){const{group:t,summary:n}=e;T(t),L(n)}let t=yield Qt.getItem(x);t||(t=yield H(x),Array.isArray(t)&&(yield Qt.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),H=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),$=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),q={visible:m,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return t.createElement("div",{className:`${l}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Bm,{ref:d,size:a,columns:I,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{T(e)}},t.createElement(nr,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(Bm,{ref:u,size:a,columns:A,dataSource:k,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{L(e)}},t.createElement(nr,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(nr,{type:"primary",disabled:!g||_,style:{marginLeft:"10px"},onClick:()=>Dn(void 0,void 0,void 0,(function*(){if(!x)return tr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Na(),t=[...p,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}}];f(t),b(e),v(""),yield Qt.setItem(x,t),yield $(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${ls.rowHeightMaps[a]}px`}},t.createElement("span",null,c("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,p.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===y}),title:e.text,onClick:()=>{return t=e.value,void b(t!==y?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:c("qm.table.groupSummary.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Dn(void 0,void 0,void 0,(function*(){if(!n)return;const e=p.filter((e=>e.value!==n));f(e),n===y&&b(""),yield Qt.setItem(x,e),yield $(x,e)}))}},t.createElement(et,null))))),!p.length&&t.createElement("div",{style:{padding:Wo}},t.createElement(tl,null)))))),t.createElement(Ml,q,t.createElement(Hu,{columns:E,group:N,summary:k})),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(nr,{type:"primary",disabled:_,onClick:()=>(F(),void h(!0))},c("qm.table.groupSummary.confirmButton"))))},qu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Ko),{t:l}=Mn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-group-summary`,title:l("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(xt,null))),t.createElement(Ml,c,t.createElement($u,{onClose:()=>o(!1)})))}));qu.displayName="GroupSummary";const ju=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:i,$size:l,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c,clearPagerFilter:d}=t.useContext(Ko),{uniqueKey:u}=i.current.props,{t:m}=Mn(),h=t.useRef(null),[p,f]=t.useState([]),[g,v]=t.useState([]),[y,b]=t.useState(""),[x,E]=t.useState("");Hi((()=>{f(x?g.find((e=>e.value===x)).list:M()||[])}),[x]),t.useEffect((()=>{H()}),[]);const w=t.useMemo((()=>u?`superSearch_${u}`:""),[u]),C=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),S=ka(p),N=t.useMemo((()=>!(S&&Ql(S))),[S]),T=t.useMemo((()=>!!p.length&&N),[p,N]),I=[{value:"and",text:m("qm.table.highSearch.andText")},{value:"or",text:m("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Ia(e.title)}))),k=e=>["in","nin"].includes(e),L=(e,t)=>{let n;switch(e){case"number":n="number";break;case"date":n="date";break;case"checkbox":case"radio":n=t?"select-multiple":"select";break;default:n="text"}return n},A=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:m("qm.table.highSearch.gtText")},{value:"<",text:m("qm.table.highSearch.ltText")},{value:">=",text:m("qm.table.highSearch.gteText")},{value:"<=",text:m("qm.table.highSearch.lteText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:m("qm.table.highSearch.inText")},{value:"nin",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",text:m("qm.table.highSearch.inText")},{value:"nlike",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"^=",text:m("qm.table.highSearch.startsWithText")},{value:"=$",text:m("qm.table.highSearch.endsWithText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}]}return t},[P,_]=t.useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(nr,{type:"text",onClick:()=>{h.current.REMOVE_RECORDS(n)}},m("qm.table.highSearch.removeText")))},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:R,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:m("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const i=Object.values(t)[0],l=null===(n=C.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,a=A(l);e.fieldType=l,e.expression=i?null===(r=a[0])||void 0===r?void 0:r.value:"",e.condition=k(e.expression)?[]:"",i||(e.bracketLeft=e.bracketRight="")}})},{title:m("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:m("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{var t;const n=null===(t=C.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:A(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=k(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const i=C.find((t=>t.dataIndex===e.fieldName)),l=null==i?void 0:i.filter.type,a=null!==(r=null!==(n=null===(t=null==i?void 0:i.filter)||void 0===t?void 0:t.items)&&void 0!==n?n:null==i?void 0:i.dictItems)&&void 0!==r?r:[];return{type:L(l,k(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName||$a(e.expression),cornerSign:!1}}}},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),F=()=>{c(),d(),s(p.map((e=>Xn(e,["index","pageIndex"])))),D(),n()},D=()=>{w&&sessionStorage.setItem(w,JSON.stringify(p.filter((e=>!!e.fieldName))))},M=()=>{if(!w)return;const e=sessionStorage.getItem(w);return e?JSON.parse(e):null},H=()=>Dn(void 0,void 0,void 0,(function*(){if(!w)return;const e=M();e&&f(e);let t=yield Qt.getItem(w);t||(t=yield $(w),Array.isArray(t)&&(yield Qt.setItem(w,t))),Array.isArray(t)&&t.length&&(v(t),!e&&E(t[0].value))})),$=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),q=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Bm,{ref:h,size:l,columns:P,dataSource:p,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(n)&&("bracketLeft"===n&&(e[n]=e[n]?"":"("),"bracketRight"===n&&(e[n]=e[n]?"":")"),f([...p]))},onDataChange:e=>{f(e)}},t.createElement(nr,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{h.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),ls.highSearch.showSQL&&S&&t.createElement("code",{className:"lang-js"},S)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:l,value:y,placeholder:m("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;b(t)}}),t.createElement(nr,{type:"primary",disabled:!y||N,style:{marginLeft:"10px"},onClick:()=>Dn(void 0,void 0,void 0,(function*(){if(!w)return tr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Na(),t=[...g,{text:y,value:e,list:p.filter((e=>!!e.fieldName))}];v(t),E(e),b(""),yield Qt.setItem(w,t),yield q(w,t)}))},m("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${ls.rowHeightMaps[l]}px`}},t.createElement("span",null,m("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,g.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===x}),title:e.text,onClick:()=>{return t=e.value,void E(t!==x?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:m("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Dn(void 0,void 0,void 0,(function*(){if(!n)return;const e=g.filter((e=>e.value!==n));v(e),n===x&&E(""),yield Qt.setItem(w,e),yield q(w,e)}))}},t.createElement(et,null))))),!g.length&&t.createElement("div",{style:{padding:Wo}},t.createElement(tl,null)))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),t.createElement(nr,{type:"primary",disabled:T,onClick:()=>F()},m("qm.table.highSearch.searchButton"))))},Ku=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Ko),{t:l}=Mn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:l("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(Et,null))),t.createElement(Ml,c,t.createElement(ju,{onClose:()=>o(!1)})))}));Ku.displayName="SuperSearch";const Vu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:l,showPrint:a,showImport:o,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:m,showPivotGrid:h,showGroupSummary:p,showToolBox:f}=e,{global:g}=t.useContext(on),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(Ko),{uniqueKey:E,exportExcel:w}=v.current.props,{t:C}=Mn(),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(null),_=t.useRef(null),F=t.useRef(!1),D=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[$,q]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),j={fullScreen:i,reload:l,print:a,import:o,export:s&&!(null==w?void 0:w.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:m,pivotGrid:h,groupSummary:p},[V,z]=t.useState(!1);Hi((()=>{F.current&&(B(),F.current=!1)}),[$]),t.useEffect((()=>{W()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return tr("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const W=()=>{if(!D||!f)return;const e=JSON.parse(localStorage.getItem(D));e||U(D).then((e=>{e&&(q(Object.assign({},$,e)),localStorage.setItem(D,JSON.stringify(e)))})).catch((()=>{})),e&&q(Object.assign({},$,e))},B=()=>{if(!D||!f)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(D,JSON.stringify(e)),G(D,e)},U=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==g?void 0:g.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),G=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==g?void 0:g.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),Y=e=>Dn(void 0,void 0,void 0,(function*(){z(!1),yield Wn(100),e.current.clickHandle()})),X=(e,t)=>{F.current=!0,q(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${b}--lg`]:"large"===y,[`${b}--sm`]:"small"===y};return t.createElement(t.Fragment,null,i&&t.createElement(ps,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),l&&t.createElement(fs,{ref:N,open:!f||$.reload}),a&&t.createElement(vs,{ref:T,tableColumns:r,open:!f||$.print}),o&&t.createElement(Os,{ref:I,tableColumns:r,open:!f||$.import}),s&&t.createElement(dd,{ref:R,tableColumns:r,open:(!f||$.export)&&!(null==w?void 0:w.hideIcon)}),c&&t.createElement(md,{ref:O,open:!f||$.clipboard}),d&&t.createElement(pd,{ref:k,columns:r,open:!f||$.collection}),u&&t.createElement(gd,{ref:L,open:!f||$.fastSearch}),h&&t.createElement(Mu,{ref:A,open:!f||$.pivotGrid}),p&&t.createElement(qu,{ref:P,open:!f||$.groupSummary}),m&&t.createElement(Ku,{ref:_,open:!f||$.superSearch}),f&&t.createElement(H,{open:V,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.screen.full"))),onClick:()=>Y(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.refresh.text"))),onClick:()=>Y(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.print.text"))),onClick:()=>Y(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.import.textNoSpace"))),onClick:()=>Y(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.export.textNoSpace"))),onClick:()=>Y(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.clipboard.textNoSpace"))),onClick:()=>Y(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.selectCollection.text"))),onClick:()=>Y(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.fastSearch.text"))),onClick:()=>Y(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.pivotGrid.text"))),onClick:()=>Y(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.groupSummary.text"))),onClick:()=>Y(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.highSearch.text"))),onClick:()=>Y(_)}];return t.createElement(K,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:Pe(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{z(e)}},t.createElement("span",{className:`${b}-toolbox`,title:C("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(wt,null)))))}));Vu.displayName="ToolBox";const zu=(e,t)=>e.map((e=>(e.children&&(e.children=zu(e.children,t)),t(e)))),Wu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(on),{tableRef:l,prefixCls:a,$size:o}=t.useContext(Ko),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=l.current.props,{t:m}=Mn(),h=t.useRef([]),[p,f]=t.useState(!1),g=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),v=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),b=t.useMemo((()=>c?`table_${c}`:""),[c]);Hi((()=>{w(r)}),[r]),t.useLayoutEffect((()=>{C()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:C})));const x=()=>{if(!b)return;const e=JSON.parse(localStorage.getItem(b));var t;if(e||(t=b,Dn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(b,JSON.stringify(e)),C()):(null==i?void 0:i.getComponentConfigApi)&&w(r)})).catch((()=>{})),!e)return;return fe(ta(e).map((e=>e.dataIndex)),ta(r).map((e=>e.dataIndex))).length>0?zu(r,(t=>{const n=ra(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):zu(e,(e=>{const t=ra(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},E=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=E(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),Object.assign({dataIndex:e.dataIndex},t)})),w=e=>{if(!b)return;const t=E(e),n=JSON.parse(localStorage.getItem(b));var r,a;l.current.columnsDefined&&!he(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,Dn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},C=()=>{const e=x();var t;e&&(t=S(e),h.current=t,null==u||u(e))},S=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const i=n.colSpan;i>1&&e.slice(r+1,r+i).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+i))})),t},N=()=>{const e=t=>t.map((t=>{const n=ra(r,t.dataIndex)||Qn(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));null==u||u(e(l.current.originColumns))},T=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:i}=n;if(0===r)return;if(1===r)return t.push(n);const l=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===l)return t.push(n);t.push(...h.current[l].map((({dataIndex:t},r)=>{const i=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(i.hidden=n.hidden),void 0!==n.fixed?i.fixed=n.fixed:i.fixed&&delete i.fixed),i})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==u||u(t)},I=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,T(r))},R=(e,n)=>{var i;const{colSpan:l,noFixed:a}=e;if(0===l)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=Ia(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,T(r)}}),t.createElement("i",{className:Pe(s),title:m("qm.table.columnFilter.draggable")},t.createElement(Be,null)),t.createElement("span",{className:"text",title:o},o),"main"===n?t.createElement("span",{className:Pe("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedLeft"),onClick:()=>I(e,"left")},t.createElement(Ct,null)),t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},t.createElement(St,null))):"sub"!==n?t.createElement("span",{className:Pe("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.cancelFixed"),onClick:()=>I(e)},t.createElement(et,null))):null);return!e.hidden&&(null===(i=e.children)||void 0===i?void 0:i.length)?t.createElement(V,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:O(e.children,e.dataIndex)},c):c},O=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement(Gt,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const i=t.map((e=>e.dataIndex)),l=e.map((e=>e.dataIndex));he(i,l)||((e,t)=>{ra(r,t).children=e,null==u||u([...r])})(Ma(t),n)}},e.map((e=>R(e,"sub"))))),k={[`${a}__popper`]:!0,"column-filter__popper":!0,[`${a}--lg`]:"large"===o,[`${a}--sm`]:"small"===o},L=[`${a}-column-filter`,{selected:p}];return s?t.createElement(od,{action:["click"],popupVisible:p,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(nr,{type:"text",size:"small",onClick:N},m("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(Gt,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),n=g.map((e=>e.dataIndex));he(t,n)||T([...Ma(e),...y,...v])}},g.map((e=>R(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(Gt,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));he(t,n)||T([...g,...Ma(e),...v])}},y.map((e=>R(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(Gt,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));he(t,n)||T([...g,...y,...Ma(e)])}},v.map((e=>R(e,"right")))))),popupClassName:Pe(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Qo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Pe(L),title:d?m("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null)),!d&&t.createElement("span",null,m("qm.table.columnFilter.text")))):null}));Wu.displayName="ColumnFilter";const Bu=t.createContext({}),Uu=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"})),Gu=t.forwardRef(((e,n)=>{const{dataIndex:r,className:i,style:l}=e;return t.createElement("li",{ref:n,"data-index":r,className:Pe("list-item",i),style:l},e.children)}));Gu.displayName="ListItem";const Yu=t.forwardRef(((e,n)=>{var r,i;const{dataSource:l=[],height:a,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,m=t.useRef(null),h=Eu({count:l.length,getScrollElement:()=>{var e,t;return null!==(t=null===(e=m.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null},estimateSize:()=>s||40,overscan:3,onChange:(e,t)=>null==d?void 0:d(e,t)}),p=h.getVirtualItems();t.useImperativeHandle(n,(()=>({SCROLL_TO_INDEX:e=>h.scrollToIndex(e),SCROLL_TO_OFFSET:e=>h.scrollToOffset(e)})));const f=lr("virtual-list");return t.createElement(El,{ref:m,wrapStyle:{height:a,maxHeight:o},className:Pe(f,u),style:e.style},t.createElement("div",{className:"container",style:{height:h.getTotalSize()}},t.createElement("ul",{style:{transform:`translateY(${null!==(i=null===(r=p[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0}px)`}},p.map((e=>t.createElement(Gu,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(l[e.index],e.index)))))))}));Yu.displayName="VirtualList";const Xu=e=>{const{column:n,isEnum:r,style:i,onChange:l}=e,{tableRef:a,$size:o,isWebPagination:s,flattenColumns:c,tableFlatData:d,pagerFilter:u,setPagerFilter:m,createWebPageData:h}=t.useContext(Ko),{dataKey:p,inputCache:f,filterValue:g={}}=t.useContext(Bu),{t:v}=Mn(),{getTitleFromCellValue:y}=gs(),b=p.split("|")[0],{isTreeTable:x}=a.current,E=u,w=b;E[w];const C=_n(E,["symbol"==typeof w?w:w+""]),S=t.useRef(!1),N=t.useMemo((()=>c.indexOf(n)),[c,n]),T=t.useRef(0),I=t.useMemo((()=>x?a.current.filteredTreeData.length:d.length),[d]),R=e=>{let t=s?sa(h()):Array.from(a.current.recordsMap.values());var r;e||(t=qa(t,C),r=t.length,T.current=r);const i=new Map;return t.forEach((e=>{const t=va(e,b);i.has(t)||i.set(t,y(e,n,e.index,N))})),i},k=e=>r?[{text:v("qm.table.highSearch.nullText"),value:""},...n.filter.items||n.dictItems||[]]:Array.from(R(e).entries()).map((([e,t])=>({text:t,value:e}))),L=t.useMemo((()=>k()),[]),A=t.useMemo((()=>Gn(C)?L:k(!0)),[]),[P,_]=t.useState(L),F=t.useMemo((()=>new Map(P.map((e=>[e.value,null])))),[P]),[D,H]=t.useState(f.current||""),[$,q]=t.useState((r?g.in:u[b])||A.map((e=>e.value))),j=t.useMemo((()=>Array.from(F.keys()).every((e=>$.includes(e)))),[$,F]),K=t.useMemo((()=>{const e=Array.from(F.keys()).filter((e=>$.includes(e)));return e.length>0&&e.length<P.length}),[$,P,F]),V=t.useMemo((()=>$.length===A.length),[$]);t.useEffect((()=>{D&&z(D)}),[]),Hi((()=>{null==l||l($,V)}),[$]),Hi((()=>{const e=V?null:$;if(!he(e,u[b]))return e?void m(Object.assign(Object.assign({},u),{[b]:e})):m(C)}),[P,$]);const z=e=>{_(L.filter((t=>t.text.includes(e))))},W=cl(z,200),B=e=>{var t;H(e),t=e,f.current=t,S.current||W(e)};return t.createElement("div",{className:"list-panel",style:i},t.createElement(O,{value:D,size:o,style:{width:200},placeholder:v("qm.table.filter.keywordSearch"),suffix:t.createElement(Nt,null),autoFocus:!0,allowClear:!0,onCompositionStart:()=>{S.current=!0},onCompositionEnd:e=>{S.current=!1,B(e.target.value)},onChange:e=>B(e.target.value)}),t.createElement("div",{className:"select-all"},t.createElement("div",{className:"action"},t.createElement(M,{checked:j,indeterminate:K,disabled:!P.length,onChange:e=>{q((t=>e.target.checked?[...new Set([...t,...Array.from(F.keys())])]:t.filter((e=>!F.has(e)))))}},v("qm.table.filter.selectAll")),t.createElement("i",{className:"divider"},"|"),t.createElement("button",{className:"btn invert",disabled:!P.length,onClick:()=>{q((e=>[...Array.from(F.keys()).filter((t=>!e.includes(t))),...e.filter((e=>!F.has(e)))]))}},v("qm.table.filter.invert"))),t.createElement("div",{className:"total"},r?null:`${I}/${T.current}`)),t.createElement(Yu,{className:"select-list",maxHeight:180,itemHeight:26,dataSource:P,renderItem:(e,n)=>t.createElement(t.Fragment,null,t.createElement(M,{key:n,checked:$.includes(e.value),onChange:t=>{q((n=>t.target.checked?[...n,e.value]:n.filter((t=>t!==e.value))))}},e.text),t.createElement("button",{className:"btn right",onClick:()=>{q((t=>he(t,[e.value])?t:[e.value]))}},v("qm.table.filter.onlyItem")))}))},Qu=t.forwardRef(((e,n)=>{const{value:r,style:i}=e,{$size:l,filters:a,pagerFilter:o,setPagerFilter:s}=t.useContext(Ko),{dataKey:c,onChange:d}=t.useContext(Bu),{t:u}=Mn(),m=c.split("|")[0],h=e=>{if(!e){const e=a,t=c;e[t];return _n(e,["symbol"==typeof t?t:t+""])}const t=Object.assign({},e);for(const e in t)(""===(n=t[e])||null==n)&&delete t[e];var n;return Object.keys(t).length?Object.assign({},a,{[c]:t}):h()},p=(e,t)=>{d(h(null!=e?e:r),null==t||t)};return t.useImperativeHandle(n,(()=>({doFinish:p}))),t.createElement(S,{className:"footer",style:Object.assign(Object.assign({},i),{justifyContent:"flex-end"})},t.createElement(nr,{size:l,onClick:()=>(()=>{if(o[m]){const e=o,t=m;e[t];const n=_n(e,["symbol"==typeof t?t:t+""]);s(n)}d(h(),!0)})()},u("qm.table.filter.reset")),t.createElement(nr,{type:"primary",size:l,onClick:()=>p()},u("qm.table.filter.search")))}));Qu.displayName="FooterPanel";const Zu=e=>{const{column:n}=e,{$size:r}=t.useContext(Ko),{filterValue:i={}}=t.useContext(Bu),{t:l}=Mn(),a=t.useRef(null),[o,s]=t.useState(Object.keys(i)[0]||"like"),[c,d]=t.useState(i[o]&&!$a(o)?i[o]:""),u=t.useMemo((()=>c?{[o]:c}:$a(o)?{[o]:1}:null),[o,c]),m=[{value:"like",label:l("qm.table.highSearch.inText")},{value:"nlike",label:l("qm.table.highSearch.ninText")},{value:"==",label:l("qm.table.highSearch.eqText")},{value:"!=",label:l("qm.table.highSearch.neqText")},{value:"^=",label:l("qm.table.highSearch.startsWithText")},{value:"=$",label:l("qm.table.highSearch.endsWithText")},{value:"nil",label:l("qm.table.highSearch.nullText")},{value:"nnil",label:l("qm.table.highSearch.notNullText")}];return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(D,{value:o,options:m,size:r,className:"condition",style:{width:70,marginRight:6},onChange:e=>{s(e),$a(e)&&d("")}}),t.createElement(O,{value:c,size:r,autoFocus:!0,style:{width:124,paddingLeft:6,paddingRight:2},placeholder:l("qm.table.filter.searchText",{text:Ia(n.title)}),disabled:$a(o),onChange:e=>{d(e.target.value)},onKeyDown:e=>{13===e.keyCode&&a.current.doFinish()}})),t.createElement(Xu,{column:n,style:{marginTop:6}}),t.createElement(Qu,{ref:a,value:u}))},Ju=e=>{var n,r;const{onChange:i}=e,{filterValue:l={}}=t.useContext(Bu),{t:a}=Mn(),[o,s]=t.useState({nil:null!==(n=l.nil)&&void 0!==n?n:0,nnil:null!==(r=l.nnil)&&void 0!==r?r:0});return Hi((()=>{const e={};for(const t in o)o[t]&&(e[t]=1);i(e)}),[o]),t.createElement("div",{style:e.style},t.createElement(M,{checked:!!o.nil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nnil:0}:null,{nil:t})))}},a("qm.table.highSearch.nullText")),t.createElement(M,{checked:!!o.nnil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nil:0}:null,{nnil:t})))}},a("qm.table.highSearch.notNullText")))},em=e=>{var n;const{column:r}=e,{$size:i}=t.useContext(Ko),{filterValue:l={}}=t.useContext(Bu),{t:a}=Mn(),o=t.useRef(null),s="likes",[c,d]=t.useState(null!==(n=l[s])&&void 0!==n?n:""),[u,m]=t.useState({}),h=t.useMemo((()=>Object.keys(u).length?u:c?{[s]:c}:null),[c,u]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(O.TextArea,{value:c,size:i,autoFocus:!0,placeholder:a("qm.table.filter.searchAreaText",{text:Ia(r.title)}),style:{width:200},disabled:!!Object.keys(u).length,onChange:e=>{d(e.target.value)},onKeyDown:e=>{13===e.keyCode&&o.current.doFinish()}})),t.createElement(Ju,{style:{marginTop:6},onChange:e=>{Object.keys(e).length&&d(""),m(e)}}),t.createElement(Xu,{column:r,style:{marginTop:6}}),t.createElement(Qu,{ref:o,value:h}))},tm=e=>{const{$size:n}=t.useContext(Ko),{filterValue:r={}}=t.useContext(Bu),{t:i}=Mn(),l=t.useRef(null),[a,o]=t.useState(r),s=e=>({value:a[e],size:n,disabled:Object.keys(a).some((e=>$a(e))),onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o((n=>Object.assign({},n,{[e]:t})))},onKeyDown:e=>{13===e.keyCode&&l.current.doFinish()}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement($,Rn({},s(">"),{placeholder:i("qm.table.highSearch.gtText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement($,Rn({},s("<"),{placeholder:i("qm.table.highSearch.ltText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement($,Rn({},s("=="),{placeholder:i("qm.table.highSearch.eqText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement($,Rn({},s("!="),{placeholder:i("qm.table.highSearch.neqText"),style:{width:150}}))))),t.createElement(Ju,{style:{paddingLeft:20},onChange:e=>o(e)}),t.createElement(Qu,{ref:l,value:a}))},nm=e=>{const{$size:n}=t.useContext(Ko),{filterValue:r={}}=t.useContext(Bu),{t:i}=Mn(),[l,a]=t.useState(r),o=e=>({value:Ca(l[e],Go),format:Go,size:n,disabled:Object.keys(l).some((e=>$a(e))),onChange:t=>{a((n=>Object.assign({},n,{[e]:Sa(t,Go)})))}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement(In,Rn({},o(">"),{placeholder:i("qm.table.highSearch.gtText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement(In,Rn({},o("<"),{placeholder:i("qm.table.highSearch.ltText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement(In,Rn({},o("=="),{placeholder:i("qm.table.highSearch.eqText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement(In,Rn({},o("!="),{placeholder:i("qm.table.highSearch.neqText"),style:{width:"150px"}}))))),t.createElement(Ju,{style:{paddingLeft:20},onChange:e=>a(e)}),t.createElement(Qu,{value:l}))},rm=e=>{const{column:n}=e,r=t.useRef(null);return t.createElement(t.Fragment,null,t.createElement(Xu,{column:n,isEnum:!0,onChange:(e,t)=>{r.current.doFinish(t?null:{in:e},!1)}}),t.createElement(Qu,{ref:r,style:{display:"none"}}))},im=(e,t,n)=>{let r;for(let i=0;i<e.length;i++){const l=e[i];if(l.children)if(l.children.some((e=>e[n]===t)))r=l[n];else{const e=im(l.children,t,n);e&&(r=e)}}return r},lm=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&lm(e.children,t),t(e)||e.children&&e.children.length))),am=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...am(e.children,t)),t(e)&&n.push(e)})),n},om=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=om(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},sm=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:sm(e.children,t,n,r)}):e)),cm=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...cm(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},dm=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][n]===t)return[t];if(Array.isArray(e[r].children)){const i=dm(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},um=(e,t)=>{var n;const r=(null===(n=e.children)||void 0===n?void 0:n.map((e=>e[t])))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...um(e,t)))),r},mm=t.forwardRef(((e,n)=>{const{className:r,style:i,filterable:l=!0,multiple:a,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:m,checkStrategy:h="SHOW_CHILD",placeholder:p,fieldsDefine:f,value:g,height:v,defaultSelectedKeys:y=[],defaultExpandedKeys:b=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:w=!0,onSelectChange:C,onCheckChange:S,onDragStart:N,onDragChange:T,onExpand:I}=e,{$size:R}=$n(e),{t:k}=Mn(),L=(null==f?void 0:f.valueKey)||"value",A=(null==f?void 0:f.textKey)||"text";null==f||f.children;const P=t.useRef(null),_=t.useRef(null),F=sl(P),[D,M]=os(v,{value:v}),[H,$]=t.useState(!1),q=cl((()=>{M(P.current.offsetHeight-ee.current.offsetHeight-10)}),5);pn((()=>{v||q()}),[F.height]);const[j,K]=t.useState([]),[V,W]=t.useState({}),[B,U]=t.useState([]),[G,Y]=t.useState([]),[X,Q]=t.useState(""),[Z,J]=t.useState(x),ee=t.useRef(null),te=t.useRef([]),ne=t.useRef([]);t.useEffect((()=>{Array.isArray(s)&&(re(s),U(ie(s)),W({}))}),[s]),t.useEffect((()=>{var e;oe(),d&&(null===(e=_.current)||void 0===e||e.focus())}),[]),Hi((()=>{oe()}),[null==c?void 0:c.params]),Hi((()=>{Y(ae())}),[V]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=om(j,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],re([...j]))},REMOVE_RECORD:e=>{var t;const n=im(j,e,L);if(void 0===n&&j.find((t=>t[L]===e)))re(j.filter((t=>t[L]!==e)));else{const r=om(j,(e=>n===e[L]));if(!r)return;const i=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[L]));i>=0&&(r.children.splice(i,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const n=om(j,(t=>e===t[L]));n&&(Ie(n,t),re([...j]))}})));const re=e=>{K(e),te.current=e,ne.current=cm(e,L)},ie=e=>{if(a)return y;const t=am(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},le=e=>{var t;return(null===(t=dm(j,e,L))||void 0===t?void 0:t.slice(0,-1))||[]},ae=()=>{if(x)return ne.current;const e=[];return B.forEach((t=>{if(a){if("SHOW_ALL"===h&&!ne.current.includes(t)&&e.push(...le(t)),"SHOW_CHILD"===h&&e.push(...le(t)),"SHOW_PARENT"===h){const n=oo(j,t);if(n){const r=le(t),i=um(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...le(t))})),[...new Set([...b,...e])]},oe=()=>Dn(void 0,void 0,void 0,(function*(){var e;if(!c)return;const{api:t,params:n,dataKey:r,afterFetch:i,callback:l}=c;try{$(!0);const a=yield t(n);if(200===a.code){let t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),U(ie(t)),W({}),null==l||l(t)}}catch(e){}$(!1)})),se=e=>`${e}|${So.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ce=lr("search-tree"),de={[ce]:!0,[`${ce}--lg`]:"large"===R,[`${ce}--sm`]:"small"===R};return t.createElement("div",{ref:P,className:Pe(de,r),style:i},t.createElement("div",{ref:ee,className:"topper",style:{display:E||w?"":"none"}},E&&t.createElement(O,{ref:_,value:X,size:R,placeholder:p||k("qm.form.inputPlaceholder"),suffix:t.createElement(Nt,null),allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=lm(te.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==se(n).indexOf(e)}));Q(e),K(t),Y(x||e?cm(t,L):ae())})(e.target.value)}),w&&t.createElement("a",{className:"trigger",onClick:()=>{J(!Z),Y(Z?[]:ne.current)}},Z?t.createElement(_e,null):t.createElement(Fe,null)," ",k(Z?"qm.form.collect":"qm.form.spread"))),t.createElement(nl,{spinning:H},t.createElement(z,{fieldNames:{title:A,key:L,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:D,disabled:e.disabled,checkStrictly:m,selectedKeys:null!=g?g:B,checkedKeys:null!=g?g:B,expandedKeys:G,treeData:j,loadData:u?({key:e,children:t})=>Dn(void 0,void 0,void 0,(function*(){var n;if(!c||t)return;const{api:r,params:i,dataKey:l,formatter:a=(e=>e),afterFetch:o}=c;try{const t=yield r(a(Object.assign(Object.assign({},i),{[L]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,l))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const i=sm(te.current,e,L,r);re(i)}}catch(e){}})):void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!X)return!1;const t=e[A]||"";return-1!==se(t).indexOf(X)},onDragStart:N,onDragEnter:e=>{Y(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),i=e.dropPosition-Number(r[r.length-1]),l=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][L]===t)return n(e[r],r,e);e[r].children&&l(e[r].children,t,n)}},a=[...j];let o;if(l(a,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)l(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];l(a,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,o):n.splice(e+1,0,o)}else l(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(a)},onDragEnd:e=>{null==T||T(e,j)},onExpand:(e,t)=>{Gn(e)&&J(!1),ne.current.every((t=>e.includes(t)))&&J(!0),Y(e),null==I||I(e,t)},onSelect:e=>{U(e);const t=am(te.current,(t=>e.includes(ue(t,L))));null==C||C(a?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),m||("SHOW_CHILD"===h&&(e=e.filter((e=>!ne.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,n)=>!n.includes(im(j,e,L))))));const t=am(te.current,(t=>e.includes(ue(t,L))));null==S||S(a?t:t[0])}})))}));mm.displayName="QmSearchTree";const hm=e=>{var n;const{column:r}=e,{$size:i}=t.useContext(Ko),{filterValue:l={}}=t.useContext(Bu),a=t.useMemo((()=>r.filter.items||r.dictItems||[]),[]),o=t.useMemo((()=>{const e=[];return function t(n){n.forEach((n=>{Array.isArray(n.children)?t(n.children):e.push(n.value)}))}(a),e}),[a]),[s,c]=t.useState(null!==(n=l.in)&&void 0!==n?n:o),[d,u]=t.useState({}),m=t.useMemo((()=>Object.keys(d).length?d:s.length===o.length?null:{in:s}),[s,d]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"tree-panel",style:r.filter.style},t.createElement(mm,{multiple:!0,value:s,dataSource:a,disabled:!!Object.keys(d).length,size:i,style:{height:238},onCheckChange:e=>{c(e.map((e=>e.value)))}})),t.createElement(Ju,{style:{marginLeft:-10,marginRight:-10,padding:"6px 0 0 20px",borderTop:"1px solid #e8e8e8"},onChange:e=>{Object.keys(e).length&&c([]),u(e)}}),t.createElement(Qu,{value:m}))},pm=e=>{const{column:n,filters:r}=e,{$size:i,prefixCls:l,pagerFilter:a,setFilters:o,clearSuperFilters:s}=t.useContext(Ko),{t:c}=Mn(),[d,u]=t.useState(!1),m=t.useRef(""),h=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),p=t.useMemo((()=>!!Object.keys(r[h]||{}).length||!!a[n.dataIndex]),[r,a]),f=(e,t)=>{s(),o(e),t&&u(!1)},g=t.useMemo((()=>({dataKey:h,inputCache:m,filterValue:r[h],onChange:f})),[r]);t.useEffect((()=>{"radio"===n.filter.type&&tr("Table","表头筛选类型 `radio` 即将被弃用,请使用 `checkbox` 替代")}),[]);const v={text:e=>t.createElement(Zu,{column:e}),textarea:e=>t.createElement(em,{column:e}),number:e=>t.createElement(tm,{column:e}),date:e=>t.createElement(nm,{column:e}),radio:e=>v.checkbox(e),checkbox:e=>t.createElement(rm,{column:e}),tree:e=>t.createElement(hm,{column:e})},y={"head-filter__popper":!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i},b=["cell--filter",{selected:d,actived:p}];return t.createElement(od,{action:["click"],popupVisible:d,popup:(()=>{const e=v[n.filter.type];return e?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement(Bu.Provider,{value:g},e(n))):(tr("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Pe(y),popupStyle:{minWidth:150},onPopupVisibleChange:e=>u(e),builtinPlacements:Qo,destroyPopupOnHide:!0,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:Pe(b),title:c("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(Uu,null))))},fm=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(Ko),{columns:l,resizable:a,columnsChange:o=Vn}=r.current.props,s=t.useMemo((()=>la(n)),[n]),c={resizable:!0,"is--line":a&&!i};return t.createElement("div",{className:Pe(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:i}=r.current,a=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=pa(t,n.$table).left-i.current.scrollLeft+c;n.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const m=s.width||s.renderWidth;let h=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||ls.defaultColumnWidth)||(h=Math.floor(n),a.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof h&&(ra(l,s.dataIndex).width=h,o([...l]))},!1}})},gm=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:l,setSelectionKeysEffect:a,setInvalidRowKeys:o,setSpinning:s,pagination:c,isFetch:d,isWebPagination:u,createWebPageData:m}=t.useContext(Ko),{t:h}=Mn(),{selectionRows:p,recordsMap:f}=r.current,{rowSelection:g}=r.current.props,{fetchAllRowKeys:v,selectAllOnCurrentPage:y,filterable:b,onSelectAll:x}=g,E=t.useRef([]),C=t.useMemo((()=>d&&!!v),[d,v]),S=t.useMemo((()=>!C&&!!y),[C,y]),N=t.useMemo((()=>(null==b||b)&&!S),[b,S]),T=()=>{const{disabled:e}=g;return(e?p.filter((t=>!e(t))):p).map((e=>i(e,e.index)))},I=()=>u?sa(m()):Array.from(f.values()),R=t.useMemo((()=>(()=>{const{disabled:e}=g;if(C)return E.current.length?E.current:Re(Array.from(f.keys()),T());if(!S)return e?Array.from(f.keys()).filter((t=>!e(f.get(t)))):Array.from(f.keys());const t=e?I().filter((t=>!e(t))).map((e=>i(e,e.index))):I().map((e=>i(e,e.index)));return Re(t,T())})()),[f,E,p,c]),O=n.filter((e=>!R.includes(e))),k=n.length-O.length,L=k>0&&k<R.length,A=!!k&&k===R.length;o(O);const P=()=>Dn(void 0,void 0,void 0,(function*(){var e;const t=v;let n=[];s(!0);try{const r=yield t.api(l);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:l}=g;l&&(n=fe(n,I().filter((e=>l(e))).map((e=>i(e,e.index))))),E.current=n}}catch(e){}return s(!1),n})),_=e=>Dn(void 0,void 0,void 0,(function*(){let t=[];t=C?e?yield P():[]:e?R.slice(0):[],t=[...new Set([...t,...O])],a(t),null==x||x(e,t)})),F=()=>{const e=[{key:1,label:h("qm.table.selection.all"),onClick:()=>{_(!0)}},{key:2,label:h("qm.table.selection.invert"),onClick:()=>Dn(void 0,void 0,void 0,(function*(){let e=[];e=fe(n,C?yield P():R),e=[...new Set([...e,...O])],a(e)}))},{key:3,label:h("qm.table.selection.clear"),onClick:()=>{_(!1)}}];return t.createElement(K,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(M,{checked:A,indeterminate:L,disabled:!R.length,onChange:e=>_(e.target.checked)}),N&&t.createElement(H,{overlayClassName:"all-selection__popper",dropdownRender:()=>F()},t.createElement(Fe,{className:"svgicon icon"})),S&&t.createElement(w,{placement:"top",title:h("qm.table.selection.currentPage")},t.createElement(pt,{className:"info"})))},vm=e=>{const{style:n}=e,{tableRef:r,getRowKey:i,rowExpandedKeys:l,setRowExpandedKeys:a,createAllExpandedKeys:o,filters:s,pagerFilter:c,superFilters:d}=t.useContext(Ko),{expandable:u}=r.current.props,[m,h]=t.useState((null==u?void 0:u.defaultExpandAllRows)||!1);Hi((()=>{p(l)!==m&&h(!m)}),[l]),Hi((()=>{const{isTreeTable:e,filteredTreeData:t}=r.current;e&&(Gn(s)&&Gn(c)&&Gn(d)||!p(l)&&a([...t.map((e=>i(e,e.index)))]))}),[s,c,d]);const p=e=>o().every((t=>e.includes(t))),f={[`${lr("expand")}--icon`]:!0,expanded:m,collapsed:!m};return t.createElement("span",{className:Pe(f),title:"",onClick:e=>{e.stopPropagation(),h(!m),a(m?[]:o())},style:n})},ym=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),bm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),xm=e=>{const{tableColumns:n}=e,{tableRef:r,prefixCls:i,layout:l,flattenColumns:a,sorter:o,filters:s,superFilters:c,pagerFilter:d,selectionKeys:u,isFetch:m,isGroupSubtotal:h,treeExpandIndex:p,tableChange:f,setSorter:g,setElementStore:v,resetTableScroll:y,getStickyLeft:b,getStickyRight:x,createGroupData:E,createTableFullData:C,createTableFlatData:S}=t.useContext(Ko),{ellipsis:N,resizable:T,multipleSort:I,rowSelection:R,expandable:O,tableConfig:k}=r.current.props,[L,A]=ls.sortDirections,{t:P}=Mn(),{tableOriginData:_}=r.current,F=t.useRef(null),D=t.useMemo((()=>_.some((e=>Array.isArray(e.children)))),[_]),M=t.useMemo((()=>!m),[m]),H=t.useMemo((()=>!(null==O?void 0:O.hideExpandAll)),[O]),$=t.useMemo((()=>!!R&&(m?!(!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys):!R.hideSelectAll)),[m,R]);Hi((()=>{B(),f(),y()}),[o]),Hi((()=>{X(),f(),y()}),[s]),Hi((()=>{X(),f(),y()}),[c]),Hi((()=>{Z(),y()}),[d]),t.useEffect((()=>{!Gn(o)&&Bn((()=>B())),!Gn(s)&&Bn((()=>X()))}),[]),t.useLayoutEffect((()=>{q()}),[]);const q=()=>{v("$header",F.current)},j=(e,n,i)=>{var l,a,s;const{dataIndex:c,colSpan:d,rowSpan:u,fixed:m,align:h,theadAlign:p,theadClassName:f="",sorter:g,filter:v,required:y,headRender:E}=e;if(0===d)return null;const w=p||h,C=["header--column",{"col--ellipsis":null!==(l=e.ellipsis)&&void 0!==l?l:N,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!y,"column-has-sorter":g,"column-has-filter":v,"column--sort":!!o[c],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&!(null===(a=i[n+(null!=d?d:1)])||void 0===a?void 0:a.fixed),"cell-fix-right-first":"right"===m&&!(null===(s=i[n-1])||void 0===s?void 0:s.fixed),[f]:!!f}],S={left:"left"===m?`${b(c)}px`:"",right:"right"===m?`${x(c,"thead")}px`:""},I=T&&![ls.expandableColumn,ls.selectionColumn].includes(c);return t.createElement("th",{key:c,className:Pe(C),colSpan:d,rowSpan:u,style:Object.assign({},S),onClick:t=>W(t,e)},t.createElement("div",{className:"cell--wrapper"},E?t.createElement("div",{className:"cell--text cell"},E(e,r.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},K(e)),v?z(e):null)),I&&t.createElement(fm,{column:e}))},K=e=>{const{dataIndex:n,type:i,sorter:l,title:a,description:s}=e;if(n===ls.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},$?t.createElement(gm,{selectionKeys:u}):P("qm.table.config.selectionText"));if("radio"===i)return t.createElement("div",{className:"cell"},a)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:Ia(a)},r.current.isTreeTable&&n===p&&H?t.createElement(vm,null):null,n===ls.expandableColumn&&H?t.createElement(vm,null):a)),s&&c.push(t.createElement(w,{key:1,placement:"top",title:s},t.createElement(pt,{className:"tip"}))),l&&c.push(V(o[n])),c},V=e=>{const n=["svgicon cell--sorter__asc",{actived:e===L}],r=["svgicon cell--sorter__desc",{actived:e===A}];return t.createElement("div",{key:2,className:"cell--sorter",title:P("qm.table.sorter.text")},t.createElement("span",{className:Pe(n)},t.createElement(ym,null)),t.createElement("span",{className:Pe(r)},t.createElement(bm,null)))},z=e=>t.createElement(pm,{column:e,filters:s}),W=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===A?null:A:L;I?(delete o[r],g(Object.assign({},o,{[r]:t}))):g(Object.assign({},{[r]:t}))}},B=()=>{M&&U()},U=e=>{const t=Oe(o,(e=>null!==e));Y(t),e||Object.keys(t).length||Y({index:L})},G=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,Y=e=>{const{tableFullData:t}=r.current,n=((e,t)=>e.sort(((e,n)=>{for(const r in t){const i=a.find((e=>e.dataIndex===r)),l=t[r],o=va(e,r),s=va(n,r),c="function"!=typeof(null==i?void 0:i.sorter)?G(o,s):i.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(h?E(Ra(t)):t,e);C(n)},X=()=>{M&&Q()},Q=()=>{const e=c.length?ka(c):ka(s),t=""!==e?h?E(Zl(Ra(_),e,D)):Zl(_,e,D):_;C(t),U(!0)},Z=()=>{!M&&(null==k?void 0:k.openFetchFilterList)||S()},J=da(n),{tableBodyWidth:ee}=l;return t.createElement("div",{ref:F,className:`${i}--header-wrapper`},t.createElement("table",{className:`${i}--header`,cellSpacing:"0",cellPadding:"0",style:{width:ee?`${ee}px`:""}},t.createElement("colgroup",null,a.map((e=>{const{dataIndex:n,width:r,renderWidth:i}=e;return t.createElement("col",{key:n,style:{width:`${r||i}px`,minWidth:`${r||i}px`}})}))),t.createElement("thead",null,(e=>e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>j(t,n,e)))))))(J))))},Em=t.createContext([]),wm=(e,t,n,r,i,l,a,o,s,c)=>{var d;const{clientX:u,clientY:m}=e,{top:h,height:p}=e.target.getBoundingClientRect(),f=(((null==i?void 0:i.x)||0)-u-12)/r,g=s.filter((e=>{var t,n;return null===(n=null===(t=o[e])||void 0===t?void 0:t.children)||void 0===n?void 0:n.length}));let v=Cm(o,n.eventKey);if(m<h+p/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=Cm(o,t)}const y=v.key,b=v,x=v.key;let E=0,w=0;if(!g.includes(y))for(let e=0;e<f&&Nm(v);e+=1)v=v.parent,w+=1;const C=t.data,S=v.node;let N=!0;return Tm(v)&&0===v.level&&m<h+p/2&&l({dragNode:C,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?l({dragNode:C,dropNode:S,dropPosition:0})?E=0:N=!1:0===w?f>-1.5?l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:C,dropNode:S,dropPosition:0})?E=c?1:0:l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:w,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:x,dropContainerKey:0===E?null:(null===(d=v.parent)||void 0===d?void 0:d.key)||null,dropAllowed:N}},Cm=(e,t)=>e[t],Sm=e=>e.split("-"),Nm=e=>{if(e.parent){const t=Sm(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Tm=e=>{const t=Sm(e.pos);return 0===Number(t[t.length-1])},Im=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:i,setRowExpandedKeys:l,createTableFullData:a,dataChange:o}=t.useContext(Ko),{tableFullData:s,recordsMap:c,isTreeTable:d}=n.current,u=zn,m=t.useRef(null),h=t.useRef(null),p=t.useRef(null),f=t.useRef(),[g,v]=t.useState({}),[y,b]=t.useState(null),[x,E]=t.useState([]),[w,C]=t.useState(0),[S,N]=t.useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),T=e=>{N((t=>Object.assign({},t,e)))};t.useLayoutEffect((()=>{e&&v((e=>{const t={},n=(e,i=null,l=0)=>{const a=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:l,node:e,parent:i,pos:(d=(null==i?void 0:i.pos)||"0",u=o,`${d}-${u}`),nodes:[...(null==i?void 0:i.nodes)||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,l+1)),t[s]=c,a.push(c)})),a};return n(e),t})(s))}),[s]),t.useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const I=()=>{T({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==y&&(b(null),T({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),h.current=null,p.current=null},O=e=>{k(),window.removeEventListener("dragend",O)},k=(e,t,n)=>{T({dragOverNodeKey:null}),R(),m.current=null,window.removeEventListener("dragend",O)},L=e=>{const t=e.node.eventKey,n=e.dragNode.eventKey,i=e.node.pos.split("-"),l=e.dropPosition-Number(i[i.length-1]),c=(e,t,n)=>{for(let i=0;i<e.length;i++){if(r(e[i],e[i].index)===t)return n(e[i],i,e);e[i].children&&c(e[i].children,t,n)}},d=[...s];let u;if(c(d,n,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,i)=>{n=i,e=r})),-1===l?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));a(d),o()};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;m.current=t,h.current={x:e.clientX,y:e.clientY};const r=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(i,n);b(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Cm(t,e).children),n})(n,g)),C(2*ls.treeTable.textIndent),l(r),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(p.current!==n&&(p.current=n),!m.current)return void I();const{dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b,dragOverNodeKey:E}=wm(e,m.current,t,w,h.current,u,Array.from(c.keys()),g,i,!d);-1===x.indexOf(o)&&b?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),m.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{var e;if(null===y)return;let t=[...i];const r=Cm(g,n);r&&(null===(e=r.children)||void 0===e?void 0:e.length)&&(t=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(i,n)),l(t)}),800)),m.current.eventKey!==o||0!==a?T({dragOverNodeKey:E,dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b}):I()):I()},onNodeDragOver:(e,t)=>{if(!m.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:l,dropContainerKey:a,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:p}=wm(e,m.current,t,w,h.current,u,Array.from(c.keys()),g,i,!d);-1===x.indexOf(l)&&o&&(m.current.eventKey===l&&0===r?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||I():n===S.dropPosition&&r===S.dropLevelOffset&&l===S.dropTargetKey&&a===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&p===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:r,dropTargetKey:l,dropContainerKey:a,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:p}))},onNodeDragLeave:(e,t)=>{p.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(I(),p.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,n=!1)=>{const{dropPosition:r,dropTargetKey:i,dropTargetPos:l,dropAllowed:a,dragOverNodeKey:o}=S;if(!a)return;if(T({dragOverNodeKey:null}),R(),null===i)return;const s=Object.assign(Object.assign({},((e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const i=Cm(r,e);return{eventKey:e,pos:i?i.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}})(i,{dropPosition:r,dragOverNodeKey:o,keyEntities:g})),{data:Cm(g,i).node});-1!==x.indexOf(i)&&tr("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=Sm(l),d={event:e,node:s,dragNode:m.current,dragNodesKeys:[m.current.eventKey].concat(x),dropToGap:0!==r,dropPosition:r+Number(c[c.length-1])};n||L(d),m.current=null},indent:w,dropOptions:S}};function Rm(){const[,t]=e.useReducer((e=>e+1),0);return t}const Om=t.forwardRef(((e,n)=>{const{rowKey:r,rowIndex:i,row:l,className:a,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:h,onNodeDragLeave:p,onNodeDragEnd:f,onNodeDrop:g}=e,v=t.useRef({eventKey:r,data:l,props:e}),y=t.useRef(!1),[b,x]=t.useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===r&&0===E,I=C===r&&-1===E,R=C===r&&1===E,O=l._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const L={"body--row-draggable":!0,"body--row-dragging":b,"drop-target":S===r,"drop-container":N===r,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return t.createElement("tr",{ref:n,"data-row-key":r,"data-row-index":i,className:Pe(a,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),y.current=t)},onDragStart:e=>{if(e.stopPropagation(),y.current)return e.preventDefault();x(!0),u(e,v.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,v.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),h(e,v.current)},onDragLeave:e=>{e.stopPropagation(),p(e,v.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,v.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,v.current)}},e.children,C===r&&null!==E&&null!==w&&t.createElement("td",{className:"drop-indicator",style:k}))}));Om.displayName="DraggableTr";const km=e=>{const{selectionKeys:n,column:r,record:i,rowKey:l}=e,{tableRef:a}=t.useContext(Ko),{rowSelection:o}=a.current.props,s=t.useMemo((()=>r.type||""),[r.type]),c=e=>{var t,r;const i=null===(t=o.checkStrictly)||void 0===t||t;if(!a.current.isTreeTable||i)return!1;const l=oa(a.current.deriveRowKeys,e);return((e,t)=>{const n=new Set(t);let r=!1,i=!1;for(const t of e)if(n.has(t)?r=!0:i=!0,r&&i)break;return r&&i})(Fa(null!==(r=null==l?void 0:l.children)&&void 0!==r?r:[]),n)};return"radio"===s?(()=>{const e=o.disabled,r=null==e?void 0:e(i),a=!r&&n[0]===l;return t.createElement(j,{checked:a,disabled:r})})():(()=>{const e=o.disabled,r=null==e?void 0:e(i),a=!!n.includes(l);return t.createElement(M,{checked:a,indeterminate:c(l),disabled:r})})()},Lm=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:l,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(Ko),{expandable:s={}}=l.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);Hi((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${lr("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:Pe(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];o(t)},style:i})},Am=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:l,min:a,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:h,allowClear:p,readOnly:f,disabled:g,formatter:v=(e=>e.toString()),parser:y=(e=>e),onFocus:b}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<a&&(t=a.toString()),m>=0&&""!==t&&(t=new Yt(t).toFixed(m)),t},E=void 0!==l,[w,C]=t.useState(null!=i?i:""),S=v(E?l:w),N=y(S);Hi((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[w]);return t.createElement(O,{ref:n,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:p,readOnly:f,disabled:g,onChange:t=>{const n=y(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===m&&n.includes(".")&&(r=!1),a>=0&&n.startsWith("-")&&(r=!1),r){if(!h&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):C(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(N);null===(t=e.onBlur)||void 0===t||t.call(e,n,N)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(N),N))}})}));Am.displayName="InputNumber";const Pm=e=>{var n,r,i;const{multiple:l,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=$n(e),{t:m}=Mn(),[h,p]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${lr("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Xn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:Pe(g,s),style:c},t.createElement(mm,{multiple:l,fetch:v,fieldsDefine:{valueKey:null===(r=a.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=a.fetch)||void 0===i?void 0:i.textKey},autoFocus:!0,asyncLoad:a.asyncLoad,checkStrictly:a.checkStrictly,checkStrategy:a.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:a.defaultExpandAll,onSelectChange:e=>p(e),onCheckChange:e=>p(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${jo[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>d(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!h,onClick:()=>d(h)},m("qm.dialog.confirm"))))};Pm.displayName="TreeHelper";const{Search:_m}=O,Fm=t.forwardRef(((e,n)=>{var r,i,l,a,o,s;const{column:c,record:d,rowKey:u,columnKey:m}=e,{tableRef:h,tableBodyRef:p,$size:f,flattenColumns:g,updateTableFlatData:v,doFieldValidate:y,dataChange:b}=t.useContext(Ko),x=t.useContext(Em),{t:w}=Mn(),C=Rm(),{store:S,fieldAuth:N}=h.current,T=(null===(r=c.editRender)||void 0===r?void 0:r.call(c,d,c))||{},I=t.useRef(null),R=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(!1),_=t.useRef({}),F=t.useRef({}),H=t.useRef([]),[$,q]=t.useState(!1),[j,K]=t.useState(!1),[V,z]=t.useState(T.items||[]),[B,U]=t.useState(),G=(T.editable||he(x,[u,m]))&&!T.disabled&&!(null===(i=N[m])||void 0===i?void 0:i.disabled),Y=`${u}|${m}`,X=2===x.length?`${x[0]}|${x[1]}`:"",Q=![...S.state.required,...S.state.validate].some((({x:e,y:t})=>e===u&&t===m)),Z=(null===(l=S.state.required.find((({x:e,y:t})=>e===u&&t===m)))||void 0===l?void 0:l.text)||"",J=(null===(a=S.state.validate.find((({x:e,y:t})=>e===u&&t===m)))||void 0===a?void 0:a.text)||"",ee=S.state.edited.some((({x:e,y:t})=>e===u&&t===m)),te=G||!Q||$||j,ne=!!(null===(o=T.helper)||void 0===o?void 0:o.combinedDataIndex)&&("search-helper"===T.type||"tree-helper"===T.type),re=null===(s=T.type)||void 0===s?void 0:s.endsWith("multiple");t.useLayoutEffect((()=>{te&&X===Y&&oe()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&le(e.map((e=>({[F.current.valueKey]:e.value,[F.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},le=e=>{H.current=e},oe=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=R.current)||void 0===e||e.focus();break;case"number":null===(t=k.current)||void 0===t||t.select();break;case"search-helper":null===(n=L.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=A.current)||void 0===r||r.focus()}},se=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=R.current)||void 0===e||e.blur();break;case"number":null===(t=k.current)||void 0===t||t.blur();break;case"search-helper":null===(n=L.current)||void 0===n||n.blur();break;case"tree-helper":null===(r=A.current)||void 0===r||r.blur()}};t.useImperativeHandle(n,(()=>({focus:oe,blur:se,isEditable:()=>!T.disabled,isOpening:()=>$})));const ce=(e,t,n)=>{const{cornerSign:r=!0}=T.extra||{};S.addToUpdated(e),r&&S.addToEdited({x:t,y:n})},de=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",me={text:(e,n,r)=>{var i;const{dataIndex:l}=n,{type:a,extra:o={},rules:s=[],onInput:c,onChange:d,onEnter:h,onBlur:p}=T,g=va(e,l),v=Object.assign({},{minRows:1,maxRows:4},o.autoSize),b=r?{rows:v.minRows,autoSize:v}:null,x=o.password?O.Password:r?O.TextArea:O;return t.createElement(x,Rn({ref:R,size:f,value:g,maxLength:o.maxLength,showCount:o.showCount},b,{autoComplete:o.password?"new-password":"off",placeholder:null!==(i=o.placeholder)&&void 0!==i?i:w("qm.table.editable.inputPlaceholder"),allowClear:o.allowClear,readOnly:o.readOnly,disabled:o.disabled,suffix:o.suffix,onChange:t=>{var r;const i=null!==(r=t.target.value)&&void 0!==r?r:"";ya(e,l,i),y(s,i,u,m,Ia(n.title)),C(),null==c||c({[Y]:i}),P.current=!0},onBlur:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";P.current&&(P.current=!1,ce(e,u,m),null==d||d({[Y]:r},e),null==p||p({[Y]:r},e),ie())},onKeyUp:t=>{var n;if(13===t.keyCode&&!t.shiftKey){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==h||h({[Y]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&h&&e.preventDefault()}}))},textarea:(e,t)=>me.text(e,t,!0),number:(e,n)=>{var r,i;const{dataIndex:l,precision:a,formatType:o}=n,{type:s,extra:c={},rules:d=[],onInput:h,onChange:p,onEnter:g,onBlur:v}=T,b=va(e,l);let x,E;return"finance"===o&&(x=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},E=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(x=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Yt(e).times(100).toNumber()}`,E=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Yt(e).times(.01).toString()),t.createElement(Am,{ref:k,size:f,value:b,min:c.min,max:c.max,precision:a,stringMode:c.stringMode,prefix:c.prefix,suffix:null!==(r=c.suffix)&&void 0!==r?r:"percent"===o?"%":void 0,placeholder:null!==(i=c.placeholder)&&void 0!==i?i:w("qm.table.editable.inputPlaceholder"),maxLength:c.maxLength,allowClear:c.allowClear,readOnly:c.readOnly,disabled:c.disabled,formatter:x,parser:E,onChange:t=>{ya(e,l,t),y(d,t,u,m,Ia(n.title)),C(),null==h||h({[Y]:t}),P.current=!0},onBlur:(t,n)=>{if(!P.current)return;P.current=!1;let r=c.stringMode?t:de(t);"percent"===o&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),ya(e,l,r),ce(e,u,m),null==p||p({[Y]:r},e),null==v||v({[Y]:r},e),ie()},onEnter:(t,n)=>{let r=c.stringMode?t:de(t);"percent"===o&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==g||g({[Y]:r},e)}})},select:(e,n,r)=>{var i,l;const{dataIndex:a,dictItems:o=[]}=n,{type:s,extra:c={},rules:d=[],items:h,onChange:p,onEnter:g}=T,v=h||o,b=va(e,a);let x=b;return t.createElement(D,{mode:r?"multiple":void 0,size:f,popupClassName:ls.popupClassName,value:b||void 0,placeholder:null!==(i=c.placeholder)&&void 0!==i?i:w("qm.table.editable.selectPlaceholder"),allowClear:c.allowClear,listHeight:c.listHeight,maxTagCount:c.collapseTags?"responsive":void 0,maxTagTextLength:c.maxTagTextLength,disabled:c.disabled,style:{width:"100%"},showSearch:null===(l=c.filterable)||void 0===l||l,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>q(e),onChange:t=>{ya(e,a,t),y(d,t,u,m,Ia(n.title)),ce(e,u,m),null==p||p({[Y]:t},e),ie()},onSelect:e=>{x=e},onInputKeyDown:t=>{13===t.keyCode&&Bn((()=>null==g?void 0:g({[Y]:x},e)))}},v.map((e=>t.createElement(D.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>me.select(e,t,!0),date:(e,n,r)=>{var i;const{dataIndex:l}=n,{type:a,extra:o={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=va(e,l);return t.createElement(In,{size:f,popupClassName:ls.popupClassName,value:null!==(i=Ca(h,Xa[d]))&&void 0!==i?i:void 0,picker:Ya[d],format:o.format,showTime:"datetime"===d,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=o;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=Sa(t,Xa[d]);ya(e,l,r),y(s,r,u,m,Ia(n.title)),ce(e,u,m),null==c||c({[Y]:r},e),ie()}})},datetime:(e,t)=>me.date(e,t,"datetime"),month:(e,t)=>me.date(e,t,"month"),year:(e,t)=>me.date(e,t,"year"),time:(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onChange:s}=T,c="HH:mm:ss",d=va(e,i);return t.createElement(On,{size:f,popupClassName:ls.popupClassName,value:null!==(r=Ca(d,c))&&void 0!==r?r:void 0,format:a.format||c,placeholder:a.placeholder,allowClear:a.allowClear,disabled:a.disabled,style:{width:"100%"},onChange:t=>{const r=Sa(t,c);ya(e,i,r),y(o,r,u,m,Ia(n.title)),ce(e,u,m),null==s||s({[Y]:r},e),ie()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],onChange:o}=T,{trueValue:s=Bo,falseValue:c=Uo,disabled:d}=l,h=va(e,r);return t.createElement(M,{checked:h===s,disabled:d,onChange:t=>{const i=t.target.checked?s:c;ya(e,r,i),y(a,i,u,m,Ia(n.title)),ce(e,u,m),null==o||o({[Y]:i},e),ie()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],onChange:o}=T,{trueValue:s=Bo,falseValue:c=Uo,disabled:d}=l,h=va(e,r);return t.createElement(W,{checked:h===s,disabled:d,onChange:t=>{const i=t?s:c;ya(e,r,i),y(a,i,u,m,Ia(n.title)),ce(e,u,m),null==o||o({[Y]:i},e),ie()}})},"search-helper":(e,n)=>{var r,i;const{dataIndex:l,precision:a}=n,{type:o,extra:s={},rules:c=[],helper:d={},onInput:h,onChange:p,onEnter:v}=T,b=ba(e,ne?d.combinedDataIndex:l),x=d.fieldAliasMap;x||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(l)||tr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||tr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[l].includes("|")&&tr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=e=>{const{filterAliasMap:t}=d,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],i={[l]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(ae(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i},S=e=>{const{autoQueryAssign:t=!0}=d;t&&(_.current=C(e)),q(!0)},N=(t,r)=>{const{beforeOpen:i}=d,l=(null!=i?i:zn)({[Y]:b},e,n);(null==l?void 0:l.then)?l.then((()=>{S(t),null==r||r()})).catch((()=>{})):!1!==l&&(S(t),null==r||r())},I=e=>{const t={};for(const n in E){const r=E[n];n!==l&&(t[n]=ba(e,r))}const n=E[l]?ba(e,E[l]):"";O(n,t);const{closed:r}=d;q(!1),null==r||r(e)},R=()=>{const{onlySelect:e=!0}=d;P.current&&O(e?"":b),q(!1)},O=(t="",r)=>{var i;if(ae(r)&&Object.keys(r).length)for(const t in r){const n=r[t],l=g.find((e=>e.dataIndex===t));if(l){ya(e,t,n,l.precision);const r=null===(i=l.editRender)||void 0===i?void 0:i.call(l,e,l);r&&Array.isArray(r.rules)&&y(r.rules,n,u,t,Ia(l.title))}else ya(e,t,n)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return ya(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&ya(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,d.combinedDataIndex,""),ya(e,l,t,a),y(c,t,u,m,Ia(n.title)),ce(e,u,m),null==p||p({[Y]:t},e),ie(),_.current={},P.current=!1,U(void 0)},k={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${jo[f]+20}px`},onClose:()=>{R()}},A=Object.assign(Object.assign({},d),{size:f,initialValue:Object.assign({},_.current,d.initialValue),onClose:e=>{e?I(e):R()}});return t.createElement(t.Fragment,null,t.createElement(_m,{ref:L,value:null!=B?B:b,placeholder:null!==(i=s.placeholder)&&void 0!==i?i:w("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:i}=d;if(P.current&&!$)return n&&r&&(null===(t=null==i?void 0:i.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=d,{beforeFetch:r=zn}=t.fetch;return new Promise(((i,l)=>Dn(void 0,void 0,void 0,(function*(){var a;const o=Ie({},t.fetch.params,Object.assign(Object.assign({},n),C(e)),{currentPage:1,pageSize:500});if(!r(o))return l();K(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=ue(e.data,t.fetch.dataKey))&&void 0!==a?a:[];i(n)}else l()}catch(e){l(e)}finally{Bn((()=>K(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>ba(e,E[l]).toString().includes(t)));if(1===n.length)return I(n[0]);N(t)})(e,n))).catch((()=>O(""))):void O(n)},onChange:e=>{const{value:t}=e.target;null==h||h({[Y]:t}),P.current=!0,U(t)},onKeyDown:e=>{var t;if(13===e.keyCode){const n=null!==(t=e.target.value)&&void 0!==t?t:"";!$&&N(n)}},onDoubleClick:e=>{const{value:t}=e.target;N(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&N(e)}}),t.createElement(Ml,k,t.createElement(Um,A)))},"search-helper-multiple":(e,n)=>{var r,i;const{dataIndex:l}=n,{type:a,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:h,onChange:p,onEnter:g}=T,v=va(e,l),b=d.fieldAliasMap;b||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||tr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),F.current=x;const C=t=>{const{beforeOpen:r}=d,i=(null!=r?r:zn)({[Y]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},S=()=>{q(!1)},N=t=>{ya(e,l,t),y(c,t,u,m,Ia(n.title)),ce(e,u,m),null==p||p({[Y]:t},e,H.current),ie()},I={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${jo[f]+20}px`},onClose:()=>{S()}},R=Object.assign(Object.assign({},d),{size:f,multiple:!0,initialValue:Ie({},d.initialValue),defaultSelectedKeys:v,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=x;le(ke([...H.current.filter((e=>t.includes(e[r]))),...e],r));const i=H.current.map((e=>({text:e[n],value:e[r]}))),l=ke([...i,...o],"value").filter((e=>t.includes(e.value)));z(l),N(l.map((e=>e.value)));const{closed:a}=d;q(!1),null==a||a(H.current)})(e,t):S()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(D,{mode:"multiple",open:!1,value:v,placeholder:null!==(i=s.placeholder)&&void 0!==i?i:w("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!$&&C()},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=x;le(H.current.filter((n=>e.includes(n[t])))),N(e)}},V.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:s.disabled,icon:t.createElement(Nt,null),onClick:()=>{C()}})))),t.createElement(Ml,I,t.createElement(Um,R)))},"tree-helper":(e,n)=>{var r,i,l;const{dataIndex:a,precision:o}=n,{type:s,extra:c={},rules:d=[],helper:h={},onChange:p,onEnter:v}=T,b=ba(e,ne?h.combinedDataIndex:a),x=h.fieldAliasMap;x||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(a)||tr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(h.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||tr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[a].includes("|")&&tr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=t=>{const{beforeOpen:r}=h,i=(null!=r?r:zn)({[Y]:b},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},S=()=>{q(!1)},N=(t="",r)=>{var i;if(ae(r)&&Object.keys(r).length)for(const t in r){const n=r[t],l=g.find((e=>e.dataIndex===t));if(l){ya(e,t,n,l.precision);const r=null===(i=l.editRender)||void 0===i?void 0:i.call(l,e,l);r&&Array.isArray(r.rules)&&y(r.rules,n,u,t,Ia(l.title))}else ya(e,t,n)}ya(e,a,t,o),y(d,t,u,m,Ia(n.title)),ce(e,u,m),null==p||p({[Y]:t},e),ie()},I={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=h.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${jo[f]+20}px`},onClose:()=>{S()}},R=Object.assign(Object.assign({},h),{defaultSelectedKeys:[b],size:f,onClose:e=>{e?(e=>{const t={};for(const n in E){const r=E[n];n!==a&&(t[n]=ba(e,r))}const n=E[a]?ba(e,E[a]):"";N(n,t);const{closed:r}=h;q(!1),null==r||r(e)})(e):S()}});return t.createElement(t.Fragment,null,t.createElement(_m,{ref:A,value:b,allowClear:null===(i=c.allowClear)||void 0===i||i,readOnly:c.readOnly,disabled:c.disabled,placeholder:null!==(l=c.placeholder)&&void 0!==l?l:w("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!$&&C())},onDoubleClick:()=>{C()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?C():N(""))}}),t.createElement(Ml,I,t.createElement(Pm,R)))},"tree-helper-multiple":(e,n)=>{var r,i;const{dataIndex:l}=n,{type:a,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:h,onChange:p,onEnter:g}=T,v=va(e,l),b=d.fieldAliasMap;b||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||tr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),F.current=x;const C=t=>{const{beforeOpen:r}=d,i=(null!=r?r:zn)({[Y]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},S=()=>{q(!1)},N=t=>{ya(e,l,t),y(c,t,u,m,Ia(n.title)),ce(e,u,m),null==p||p({[Y]:t},e,H.current),ie()},I={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${jo[f]+20}px`},onClose:()=>{S()}},R=Object.assign(Object.assign({},d),{size:f,multiple:!0,initialValue:Ie({},d.initialValue),defaultSelectedKeys:v,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=x;le(e);const r=H.current.map((e=>({text:e[t],value:e[n]})));z(r),N(r.map((e=>e.value)));const{closed:i}=d;q(!1),null==i||i(H.current)})(e):S()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(D,{mode:"multiple",open:!1,value:v,placeholder:null!==(i=o.placeholder)&&void 0!==i?i:w("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!$&&C()},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=x;le(H.current.filter((n=>e.includes(n[t])))),N(e)}},V.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:o.disabled,icon:t.createElement(Nt,null),onClick:()=>{C()}})))),t.createElement(Ml,I,t.createElement(Pm,R)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],render:o,onChange:s}=T;if(!o)return tr("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=va(e,r),d=t=>{ya(e,r,t),y(a,t,u,m,Ia(n.title)),ce(e,u,m),null==s||s({[Y]:t},e),ie()},h=o(e,n,d);return t.isValidElement(h)?t.cloneElement(h,{value:c,disabled:l.disabled,readOnly:l.readOnly,popupClassName:ls.popupClassName,onChange:d}):null}};return t.createElement(t.Fragment,null,te?(()=>{const{type:e}=T,n=me[e];if(!n)return tr("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!Q}];return t.createElement("div",{ref:I,className:Pe(r)},n(d,c),!Q&&t.createElement("div",{className:"cell-error"},Z||J))})():(()=>{const{disabled:n,extra:r={}}=T,{disabledColor:i,disabledBgColor:l}=r,a=["cell--show",{"is-cell-bg":n&&l}];return t.createElement(t.Fragment,null,t.createElement("span",{className:Pe(a),style:{color:n?i:""}},e.children),n&&l&&t.createElement("i",{className:"cell--bg",style:{background:l}}))})(),ee&&t.createElement("i",{className:"cell--sign"}))}));Fm.displayName="CellEdit";const Dm=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:l}=e,{t:a}=Mn();return dl(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=nn(n,r);null==l||l(n,c),c&&i&&R.success(a("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Dm.displayName="QmCopyToClipboard";const Mm=t.forwardRef(((n,r)=>{const{column:i,row:l,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=n,{tableRef:d,selectionKeys:u,treeExpandIndex:m,updateMark:h}=t.useContext(Ko),{dataIndex:p,canCopy:f,render:g,editRender:v,shouldCellUpdate:y}=i,{t:b}=Mn(),{renderText:x,getTitleFromCellNode:E}=gs(),w=t.useRef(null),C=va(l,p),[S,N]=function(t,n,r){const i=e.useRef({});return"value"in i.current&&!r(i.current.condition,n)||(i.current.value=t(),i.current.condition=n),i.current.value}((()=>{const e=g?g(C,l,i,a,o):x(C,i,l);return[e,v?t.createElement(Fm,{ref:r,column:i,record:l,rowKey:s,columnKey:p},e):null]}),[h,l,C,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,l)}return!Ha(e,t,!0)}));t.useEffect((()=>{if([ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(p))return;const e=w.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const T=e=>Array.isArray(e.children);return t.createElement("div",{ref:w,className:"cell"},(()=>{if(p===ls.expandableColumn)return t.createElement(Lm,{record:l,rowKey:s});if(p===ls.selectionColumn)return t.createElement(km,{selectionKeys:u,column:i,record:l,rowKey:s});if(N)return N;if(d.current.isTreeTable&&p===m)return t.createElement(t.Fragment,null,(e=l._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*ls.treeTable.textIndent+"px"}}):null,t.createElement(Lm,{key:"expand",record:l,rowKey:s,style:T(l)?{}:{visibility:"hidden"}}),S);var e;if(f){const e=E(S);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},S),e&&t.createElement(Dm,{text:e},t.createElement(Ze,{className:"icon",title:b("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Mm.displayName="Cell";const Hm={open:!1,offsetX:0,offsetY:0},$m=t.forwardRef(((e,n)=>{const{rowVirtualize:r}=e,{tableRef:i,getRowKey:l,prefixCls:a,tableFlatData:o,flattenColumns:s,mergedTdCells:c,setMergedCells:d}=t.useContext(Ko),{areaSelection:u={}}=i.current.props,{elementStore:m,scrollYLoad:h}=i.current,{t:p}=Mn(),f=t.useRef(document.onselectstart),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=e=>{y.current=e},[x,E]=t.useState(null),[w,C]=t.useState(null),[S,N]=t.useState(null),T=e=>{if(!e)return N(null);let t=!1;for(const n in e)if((null==S?void 0:S[n])!==e[n]){t=!0;break}t&&N(Object.assign({},S,e))};Nu({ref:g,handler:()=>K()}),t.useEffect((()=>{const e=Kt(m.$tableBody,"mousedown",D),t=Kt(m.$tableBody,"contextmenu",_),n=Kt(document,"keydown",F);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const I=()=>{E(null),T(null),b(null),C(null)};t.useImperativeHandle(n,(()=>({blur:I})));const R=e=>{let t=e;for(;t;){if(!m.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},O=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),k=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),L=e=>{let[t,n,r,i]=[1/0,-1/0,1/0,-1/0];for(const l of e)t=Math.min(t,l.rowStart),n=Math.max(n,l.rowEnd),r=Math.min(r,l.colStart),i=Math.max(i,l.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:i}},A=cl((e=>{let t=L([k(e),y.current]);c.forEach((e=>{const n=o.findIndex((t=>l(t,t.index)===e.rowKey)),r=s.findIndex((t=>t.dataIndex===e.dataIndex)),i={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+e.colSpan};var a,c;c=i,(a=t).rowEnd<=c.rowStart||a.rowStart>=c.rowEnd||a.colEnd<=c.colStart||a.colStart>=c.colEnd||(t=L([t,i]))})),T(t)}),5),P=e=>{var t;d(e),null===(t=u.onCellMerge)||void 0===t||t.call(u,e),Bn((()=>I()))},_=Hn((e=>{u.cellMerge&&x&&q(e.clientX,e.clientY)?(e.preventDefault(),j(e)):(null==w?void 0:w.open)&&K()})),F=Hn((e=>{27===e.keyCode&&I()})),D=Hn((e=>{e.stopPropagation();const t=R(e.target);if(1!==e.buttons||!t)return;K();const n=O(t);E(n);const r=k(n);b(r),T(r),document.addEventListener("mousemove",M),document.addEventListener("mouseup",H),f.current=document.onselectstart,document.onselectstart=()=>!1})),M=Hn((e=>{const t=R(e.target);t&&A(O(t))})),H=Hn((()=>{var e;null===(e=u.onSelectChange)||void 0===e||e.call(u,(()=>{const e=[];if(!x||!S)return e;for(let t=S.rowStart;t<S.rowEnd;t++)for(let n=S.colStart;n<S.colEnd;n++)e.push({rowKey:l(o[t],o[t].index),dataIndex:s[n].dataIndex,cellValue:va(o[t],s[n].dataIndex)});return e})()),document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",H),$()})),$=()=>{document.onselectstart!==f.current&&(document.onselectstart=f.current)},q=(e,t)=>{const{top:n,left:r}=m.$tableBody.parentNode.getBoundingClientRect(),[i,l]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=U();return!(i<a||i>a+s||l<o||l>o+c)},j=e=>{const{top:t,left:n,height:r}=v.current.getBoundingClientRect();C({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},K=()=>{C((e=>Object.assign(Object.assign({},e),{open:!1})))},V=e=>({rowIndex:o.findIndex((t=>l(t,t.index)===e.rowKey)),colIndex:s.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),z=()=>{if(!x||!S||(t=S,(e=x).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return I();var e,t;const n={rowKey:l(o[S.rowStart],o[S.rowStart].index),dataIndex:s[S.colStart].dataIndex,rowSpan:S.rowEnd-S.rowStart,colSpan:S.colEnd-S.colStart};P([...c.filter((e=>!((e,t)=>{const n=V(e),r=V(t),[i,l,a,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return i<=s&&l<=c&&a>=d&&o>=u||s<=i&&c<=l&&d>=a&&u>=o})(e,n))),n])},W=()=>{const e=l(o[S.rowStart],o[S.rowStart].index),t=s[S.colStart].dataIndex;P(c.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},B=e=>{if(h){return r.measurementsCache.slice(0,e).map((e=>e.size)).reduce(((e,t)=>e+t),0)}if(e>=o.length)return m.$tableBody.parentNode.offsetHeight;const t=l(o[e],o[e].index),n=m.$tableBody.querySelector(`tbody > tr[data-row-key="${t}"]`);return n?n.offsetTop:i.current.rowHeight*e},U=()=>{const{w:e,h:t,l:n,t:r}=x,i=s.slice(0,S.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=B(S.rowStart);return{sl:n,st:r,sw:e,sh:t,el:i,et:l,ew:s.slice(0,S.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-i,eh:B(S.rowEnd)-l}};return t.createElement("div",{className:`${a}--area-select`},(()=>{if(!x||!S)return null;const{sl:e,st:n,sw:r,sh:i,el:l,et:a,ew:o,eh:s}=U(),{open:c,offsetX:d,offsetY:u}=w||Hm,m=t.createElement("ul",{ref:g,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:z},p("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:W},p("qm.table.areaSelect.cancelMerge")));return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:i}}),t.createElement(od,{popupVisible:c,popup:m,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:ls.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:v,className:"checked-area",style:{left:l,top:a,width:o,height:s}})))})())}));$m.displayName="AreaSelect";const qm=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:m,layout:h,showFooter:p,selectionKeys:f,rowExpandedKeys:g,highlightKey:v,activedCell:y,isPingLeft:b,isPingRight:x,isTableEmpty:E,isGroupSubtotal:w,setElementStore:C,setSelectionKeysEffect:S,setHighlightKey:N,setActivedCell:T,getStickyLeft:I,getStickyRight:R,setPingLeft:O,setPingRight:k,setFullScreen:L,scrollBottomDebouncer:A}=t.useContext(Ko),{height:P,minHeight:_,maxHeight:F,rowHeight:D,rowSelection:M,rowHighlight:H,expandable:$,stripe:q,summation:j,rowStyle:K,cellStyle:V,spanMethod:z,tableConfig:W,areaSelection:B,ellipsis:U,showHeader:G,rowDraggable:Y,onRowClick:X,onRowDblclick:Q,onRowContextmenu:Z,onRowEnter:J}=r.current.props,ee=t.useRef(null),te=t.useRef({}),ne=t.useRef(null),re=t.useRef({prevST:0,prevSL:0}),{onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de,indent:ue,dropOptions:me}=Im({openDragSort:Y}),{rowVirtualizer:pe,columnVirtualizer:fe,virtualRows:ge,virtualColumns:ve,resetItemXSize:ye,getYIndexes:be,virtualTranslateY:xe,virtualTranslateX:Ee,calcVirtualYSize:we,calcVirtualXSize:Ce,scrollToYIndex:Se}=((e,n)=>{var r;const{tableRef:i}=t.useContext(Ko),{props:l,scrollBarRef:a,rowHeight:o}=i.current,s=(null===(r=l.tableConfig)||void 0===r?void 0:r.overscan)||1,c=t.useMemo((()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[a.current]),d=t.useMemo((()=>{const e=[],t=[];return n.forEach(((n,r)=>{"left"===n.fixed&&e.push(r),"right"===n.fixed&&t.push(r)})),[e,t]}),[n]),u=Eu({count:e.length,getScrollElement:()=>c,estimateSize:()=>o,indexAttribute:"data-row-index",overscan:s,enabled:i.current.scrollYLoad}),m=u.getVirtualItems(),h=Eu({horizontal:!0,count:n.length,getScrollElement:()=>c,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:s,enabled:i.current.scrollXLoad,rangeExtractor:e=>[...new Set([...d[0],...uu(e),...d[1]])]}),p=h.getVirtualItems();return{rowVirtualizer:u,columnVirtualizer:h,virtualRows:m,virtualColumns:p,resetItemXSize:e=>{e.forEach(((e,t)=>{h.resizeItem(t,e.width||e.renderWidth||ls.defaultColumnWidth)}))},getYIndexes:()=>u.getVirtualIndexes()||[],getXIndexes:()=>h.getVirtualIndexes()||[],virtualTranslateY:()=>{var e,t;return null!==(t=null===(e=m[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},virtualTranslateX:()=>{var e,t,n,r,i,l,a;const o=d[0].length;return o?(null===(n=p[o])||void 0===n?void 0:n.index)===o?null!==(i=null===(r=p[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0:(null!==(a=null===(l=p[o])||void 0===l?void 0:l.start)&&void 0!==a?a:0)-p.slice(0,o).reduce(((e,t)=>e+t.size),0):null!==(t=null===(e=p[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},calcVirtualYSize:()=>u.getTotalSize()||void 0,calcVirtualXSize:()=>h.getTotalSize()||void 0,scrollToYIndex:e=>{u.scrollToIndex(e)},scrollToXIndex:e=>{h.scrollToIndex(e)}}})(a,o),Ne=be(),Te=e=>{if(e&&!U)return pe.measureElement(e)},Ie=t.useMemo((()=>u.length&&r.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:i,colSpan:l})=>{const a=e+i-1,o=[];for(let t=e;t<=a;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:l});for(let i=t;i<t+l;i++)0===r&&i===t||n.push({row:e,col:i,rowSpan:0,colSpan:0})}))})),n})(u,Ne):u),[u,Ne.join(",")]),[Re,Oe]=t.useState([]),ke=Rm();Nu({ref:ee,omitClassNames:[`.${ls.popupClassName}`],handler:()=>{var e;ze([]),null===(e=ne.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:ze,createFocus:He,forceUpdate:ke,resetItemXSize:ye,scrollToYIndex:Se}))),Hi((()=>{Re.length&&r.current.tableManager.focus(r.current.uid)}),[Re]),t.useLayoutEffect((()=>{Me();const e=Kt(document,"keydown",_e);return()=>e.remove()}),[]);const Le=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,l={};return E&&Object.assign(l,{minHeight:"100px"}),_&&Object.assign(l,{minHeight:fa(_)-e-n+"px"}),F&&Object.assign(l,{maxHeight:fa(F)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},l),{maxHeight:"",minHeight:"",height:`${t}px`}):l}),[P,F,_,E,h]),Ae=Hn((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:i}=re.current,{scrollTop:l,scrollLeft:a}=e;if(a!==i){G&&(t.$header.scrollLeft=a),p&&(t.$footer.scrollLeft=a);const e=a>0,n=Math.ceil(a)+h.tableWidth<h.tableBodyWidth;b!==e&&O(e),x!==n&&k(n)}l!==n&&Math.ceil(l)+h.viewportHeight>=ee.current.parentNode.offsetHeight&&A({type:"scroll",target:e,preventDefault:Vn,stopPropagation:Vn}),re.current={prevST:l,prevSL:a}})),_e=Hn((e=>{var t,n,l,o,c,d,u;const{keyCode:m}=e;if(r.current.uid===(null===(t=r.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id)&&(27===m&&(ze([]),N(""),T({}),L(!1)),Re.length&&(Gi(document.activeElement,ee.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===m&&("radio"===(null==M?void 0:M.type)||H)){const t=null!==(o=null!==(l=f[0])&&void 0!==l?l:v)&&void 0!==o?o:null,n=null!==(c=a.find((e=>i(e,e.index)===t)))&&void 0!==c?c:null;n&&(null==J||J(n,e))}if(!je(Re[0],Re[1])){if(38===m||40===m){ji(e);const t=a.length;let n=a.findIndex((e=>i(e,e.index)===Re[0]));const r=38===m?(--n+t)%t:++n%t,l=a[r],o=i(l,l.index),s=qe(o,Re[1]);"radio"!==(null==M?void 0:M.type)||(null===(d=M.disabled)||void 0===d?void 0:d.call(M,l))||s||S([o]),!H||(null===(u=H.disabled)||void 0===u?void 0:u.call(H,l))||s||N(o),Fe(38===m?"top":"bottom",r),$e(...Re),ze([o,Re[1]])}if(9===m||e.shiftKey&&9===m){if(ji(e),!s.length)return ze([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Re[1]));const r=e.shiftKey&&9===m?(--n+t)%t:++n%t;$e(...Re),De(e.shiftKey&&9===m?"left":"right",r),ze([Re[0],s[r].dataIndex])}}}})),Fe=(e,t)=>{const{scrollBarRef:n,scrollYLoad:i}=r.current;if(i)return pe.scrollToIndex(t);const l=a.length,o=t,s=ee.current.querySelectorAll("tbody > tr"),c=a.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<n.current.scrollTop?n.current.SET_SCROLL_TOP(c):t===l-1&&n.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):c+d>n.current.scrollTop+h.viewportHeight?n.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):0===t&&n.current.SET_SCROLL_TOP(c)},De=(e,t)=>{const{scrollBarRef:n}=r.current,i=s.length,l=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),a=o.slice(0,l).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[l].width||o[l].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),p=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?a<n.current.scrollLeft+m?n.current.SET_SCROLL_LEFT(a-m):t===i-1&&n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+p):a+u>n.current.scrollLeft+(h.tableWidth-p)?n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+p):0===t&&n.current.SET_SCROLL_LEFT(a-m)},Me=()=>{C("$tableBody",ee.current)},He=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.focus()},$e=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.blur()},qe=(e,t)=>{var n,r;return null!==(r=null===(n=te.current[`${e}-${t}`])||void 0===n?void 0:n.isEditable())&&void 0!==r&&r},je=(e,t)=>{var n,r;return null!==(r=null===(n=te.current[`${e}-${t}`])||void 0===n?void 0:n.isOpening())&&void 0!==r&&r},Ke=e=>{const t=j.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ve=(e,t,n)=>{var l;const{dataIndex:a}=n;if([ls.expandableColumn,ls.operationColumn].includes(a))return;const o=i(t,t.index);ze([o,a]);const s=qe(o,a),{type:c,selectByClickRow:d=!0,disabled:u=Vn}=M||{};!c||u(t)||s||(d||a===ls.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:l}=M||{};if("radio"===n&&S([e]),"checkbox"===n){const n=!f.includes(e),a=r.current.isTreeTable&&!i?Be(e,f,n):We(e,f,n);S(a),null==l||l(n,t,a)}})(o,t),[ls.selectionColumn].includes(a)||(!H||(null===(l=H.disabled)||void 0===l?void 0:l.call(H,t))||s||N(o),null==X||X(t,n,e))},ze=e=>{he(e,Re)||Oe(e)},We=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Be=(e,t,n)=>{var i;const{disabled:l}=M||{},{deriveRowKeys:a,recordsMap:o}=r.current,s=oa(a,e);let c=[],d=Fa((null==s?void 0:s.children)||[]);l&&(d=d.filter((e=>!o.has(e)||!l(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(i=Pa(a,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=oa(a,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>c.includes(e.rowKey)));c=r?[...c,e]:c.filter((t=>t!==e))})),c},Ue=(e,n,i)=>{const{scrollXLoad:l}=r.current,{disabled:a}=M||{},s=["body--row",Object.assign({"body--row-striped":q&&n%2!=0,"body--row-selected":f.includes(i)&&!(null==a?void 0:a(e)),"body--row-current":v===i},w?Ke(e._group):null)],c=(l?ve:o).map(((t,r)=>Ge(l?o[t.index]:t,l?t.index:r,e,n,i)));return Y?t.createElement(Om,{key:i,ref:Te,className:Pe(s),rowKey:i,rowIndex:n,row:e,indent:ue,filter:".cell--edit input",dropOption:me,onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de},c):t.createElement("tr",{key:i,ref:Te,"data-row-key":i,"data-row-index":n,className:Pe(s)},c)},Ge=(e,n,r,i,l)=>{var a,o,s;const{dataIndex:u,fixed:h,align:p,className:f=""}=e,{rowSpan:g,colSpan:v}=Ye(r,e,i,n);if(!g||!v)return null;const b=null!==(a=e.ellipsis)&&void 0!==a?a:U,x=["body--column",{"col--ellipsis":b,"col--center":"center"===p,"col--right":"right"===p,"col-active":y.rowKey===l&&y.dataIndex===u,"column--sort":!!m[u],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(o=c[c.length-v])||void 0===o?void 0:o.dataIndex)===u,"cell-fix-right-first":"right"===h&&(null===(s=d[0])||void 0===s?void 0:s.dataIndex)===u,[f]:!!f}],E={left:"left"===h?`${I(u)}px`:"",right:"right"===h?`${R(u)}px`:""},C=K?"function"==typeof K?K(r,i):K:null,S=V?"function"==typeof V?V(r,e,i,n):V:null,N=w?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=j.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,T=Object.assign({},E,{height:D},N,C,S);return t.createElement("td",{key:u,"data-col-index":n,rowSpan:g>1?g:void 0,colSpan:v>1?v:void 0,className:Pe(x),style:T,onClick:t=>Ve(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(r)||null==Q||Q(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(r)||null==Z||Z(t,n,e)})(t,r,e)},t.createElement(Mm,{ref:e=>te.current[`${l}-${u}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:l,showTitle:b}))},Ye=(e,t,n,r)=>{var i;let l=1,o=1;const s=z;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(c)?(l=c[0],o=c[1]):ae(c)&&(l=c.rowSpan,o=c.colSpan);const d=null!==(i=Ne[0])&&void 0!==i?i:0;if(e===a[d]&&0===l)for(let e=d;e<a.length;e++){const n=s({row:a[e],column:t,rowIndex:e,columnIndex:r,tableData:a});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;l++}}if(Ie.length>0){const e=Ie.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,o=e.colSpan)}return{rowSpan:l,colSpan:o}};return t.createElement(El,{ref:r.current.scrollBarRef,wrapClassName:`${l}--body-wrapper`,wrapStyle:Le,innerStyle:{height:we(),width:Ce()},showTopScrollbar:null==W?void 0:W.doubleXScrollbar,onScroll:Ae},t.createElement(Em.Provider,{value:Re},t.createElement("table",{ref:ee,style:{width:0,marginTop:xe(),marginLeft:Ee()},className:Pe(`${l}--body`,{"virtual-container":r.current.scrollYLoad||r.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=r.current;return t.createElement("colgroup",null,(e?ve:o).map((n=>{const{dataIndex:r,width:i,renderWidth:l}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${i||l}px`,minWidth:`${i||l}px`}})})))})(),t.createElement("tbody",null,(e=>{const{scrollYLoad:n,scrollXLoad:l}=r.current,s=[];return(n?e:a).forEach(((e,r)=>{const c=n?a[e.index]:e,d=n?e.index:r,u=i(c,c.index);if(s.push(Ue(c,d,u)),null==$?void 0:$.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=zn}=$;g.includes(u)&&n(c)&&s.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:(l?ve:o).length,className:"body--column",style:{paddingLeft:M?2*ls.selectionColumnWidth:ls.selectionColumnWidth}},t.createElement("div",{className:Pe("cell",e)},$.expandedRowRender(c,d)))))}})),s})(ge)))),!!B&&t.createElement($m,{ref:ne,rowVirtualize:pe}))}));qm.displayName="TableBody";const jm=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:i,flattenColumns:l,leftFixedColumns:a,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=t.useContext(Ko),{footRender:m}=e.current.props,{t:h}=Mn(),p=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",p.current)},g=(n,i,l)=>{var s,c;const{dataIndex:m,fixed:p,align:f,summation:g}=n,v=["footer--column","col--ellipsis",{"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!r[m],"cell-fix-left":"left"===p,"cell-fix-right":"right"===p,"cell-fix-left-last":"left"===p&&(null===(s=a[a.length-1])||void 0===s?void 0:s.dataIndex)===m,"cell-fix-right-first":"right"===p&&(null===(c=o[0])||void 0===c?void 0:c.dataIndex)===m}],y={left:"left"===p?`${d(m)}px`:"",right:"right"===p?`${u(m)}px`:""},b=(null==g?void 0:g.render)?g.render(e.current.tableFullData):va(i,`${m}_text`),x=0===l&&""===b?h("qm.table.config.summaryText"):b;return t.createElement("td",{key:m,title:x,className:Pe(v),style:Object.assign({},y)},t.createElement("div",{className:"cell"},x))},{tableBodyWidth:v}=i;return t.createElement("div",{ref:p,className:`${n}--footer-wrapper`},m?m(l,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}px`:""}},t.createElement("colgroup",null,l.map((e=>{const{dataIndex:n,width:r,renderWidth:i}=e;return t.createElement("col",{key:n,style:{width:`${r||i}px`,minWidth:`${r||i}px`}})}))),t.createElement("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},l.map(((t,n)=>g(t,e,n)))))))))};var Km;!function(e){e.small="small",e.middle="default",e.large="default"}(Km||(Km={}));const Vm=e=>{var n,r,i,l;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(on),{tableRef:u,prefixCls:m,$size:h,setElementStore:p}=t.useContext(Ko),{uniqueKey:f,paginationConfig:g,infoBarConfig:v}=u.current.props,y=t.useRef(null),b=t.useMemo((()=>f?`tablePager_${f}`:""),[f]);t.useLayoutEffect((()=>{x(),S()}),[]);const x=()=>{p("$pager",y.current)},E=null!==(n=null==g?void 0:g.showSizeChanger)&&void 0!==n?n:ls.pagination.showSizeChanger,w=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:ls.pagination.showQuickJumper,C=(null==g?void 0:g.pageSizeOptions)||(null===(l=null===(i=null==d?void 0:d.table)||void 0===i?void 0:i.pagination)||void 0===l?void 0:l.pageSizeOptions)||ls.pagination.pageSizeOptions,S=()=>Dn(void 0,void 0,void 0,(function*(){if(!b)return;const e=yield N(b);e&&e!==o&&(c(a,e),localStorage.setItem(b,e.toString()))})),N=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t&&!localStorage.getItem(b))try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),T=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),I={[`${m}-pager`]:!0};return t.createElement("div",{ref:y,className:Pe(I)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==v?void 0:v.position)&&t.createElement(hs,{total:s})),t.createElement(B,{size:Km[h],showSizeChanger:E,showQuickJumper:w,pageSizeOptions:C,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},zm=()=>{const{prefixCls:e,layout:n}=t.useContext(Ko),r=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t}=n;return{top:`${e}px`,height:`${t}px`}}),[n]);return t.createElement("div",{className:`${e}--empty`,style:r},t.createElement(tl,null))},Wm=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(Ko),r=t.useRef(null);t.useLayoutEffect((()=>{i()}),[]);const i=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},Bm=t.forwardRef(((e,n)=>{const r=mn(zo,e),{rowKey:i,columns:l,loading:a,resizable:o,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:m,topSpaceAlign:h,showTableInfo:p,showFullScreen:f,showRefresh:g,showToolBox:v,showHeader:y,className:b,style:x}=r,{$size:E}=$n(r),w=t.useRef(null),C=t.useRef(null),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=lr("table"),R=Hn(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(tr("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:O,tableFullData:k,setElementStore:L,setOriginColumns:A,setTableFullData:P,setTableOriginData:_,setTableDataMaps:F,setDeriveRowKeys:D,setInvalidRowKeys:M,setFieldAuth:H,setColumnsDefined:$,setScrollXLoad:q,setScrollYLoad:j,setResizeState:K,setHandleState:V,setSummaries:z,setSelectionRows:W,setFilteredTreeData:B,setUnMounted:U,clearElementStore:G}=((e,{getRowKey:n,$size:r})=>{const{rowHeight:i,dynamicThead:l}=e,a=t.useRef({props:e,uid:ts(),tableManager:rs,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!l,scrollBarRef:t.createRef(),rowHeight:i||ls.rowHeightMaps[r],store:new is,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!1,scrollXLoad:!1,scrollYLoad:!1,selectionRows:[],recordsMap:new Map,filteredTreeData:[],unMounted:!1,isIE:!qn&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,a.current.props=o;const s=(e,t,r="",i=0)=>e.map((e=>{const l=n(e,e.index),a=r?`${r}.${e.index+1}`:`${e.index+1}`,o={level:i,rowKey:l,indexPath:a,parentRowKey:i?t:null};return e.indexPath=a,e._level=i,e._rowKey=l,e._parentRowKey=i?t:null,Array.isArray(e.children)&&(o.children=s(e.children,l,a,i+1)),e.children&&e.children.length||(o.isLeaf=1,e._isLeaf=1),o}));return Object.assign(Object.assign({tableRef:a},a.current),{setElementStore:(e,t)=>{a.current.elementStore[e]=t},setOriginColumns:e=>{a.current.originColumns=e},setTableFullData:e=>{a.current.tableFullData=e},setTableOriginData:e=>{a.current.tableOriginData=e},setTableDataMaps:e=>{const t=sa(e);a.current.recordsMap=new Map(t.map(((e,r)=>[n(e,e.index),t[r]])))},setDeriveRowKeys:e=>{const t=e.some((e=>Array.isArray(e.children)));a.current.isTreeTable=t,a.current.deriveRowKeys=t?s(e,""):[]},setInvalidRowKeys:e=>{a.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{a.current.fieldAuth[e]=t},setColumnsDefined:e=>{a.current.columnsDefined=e},setResizeState:e=>{a.current.resizeState=e},setHandleState:e=>{a.current.handleState=e},setSummaries:e=>{a.current.summaries=e},setScrollXLoad:e=>{a.current.scrollXLoad=e},setScrollYLoad:e=>{a.current.scrollYLoad=e},setSelectionRows:e=>{a.current.selectionRows=e},setFilteredTreeData:e=>{a.current.filteredTreeData=e},setUnMounted:e=>{a.current.unMounted=e},clearElementStore:()=>{for(const e in a.current.elementStore)a.current.elementStore[e]=null}})})(r,{getRowKey:R,$size:E}),{tableFlatData:Y,setTableFlatData:X,filters:Q,setFilters:Z,sorter:J,setSorter:ee,superFilters:te,setSuperFilters:ne,pagerFilter:re,setPagerFilter:ie,pagination:le,setPagination:oe,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:me,setHighlightKey:fe,updateMark:ge,forceUpdate:ve,activedCell:ye,setActivedCell:be,mergedTdCells:xe,setMergedCells:Ee,layout:we,setLayout:Ce,permission:Se,setPermission:Ne,spinning:Te,setSpinning:Ie,isPingLeft:Re,setPingLeft:Oe,isPingRight:ke,setPingRight:Le,isFullScreen:Ae,setFullScreen:_e,updateTableFlatData:Fe}=(e=>{var n,r,i,l,a,o,s,c,d,u,m;const{uniqueKey:h,initialSorter:p={},initialFilter:f={},paginationConfig:g,rowSelection:v,expandable:y,rowHighlight:b,mergedCells:x}=e,{global:E}=t.useContext(on),w={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:ls.pagination.current,pageSize:null!==(o=null!==(i=null!==(r=(()=>{if(h)return Number(localStorage.getItem(`tablePager_${h}`))||void 0})())&&void 0!==r?r:null==g?void 0:g.pageSize)&&void 0!==i?i:null===(a=null===(l=null==E?void 0:E.table)||void 0===l?void 0:l.pagination)||void 0===a?void 0:a.pageSize)&&void 0!==o?o:ls.pagination.pageSize,total:0},C=null!==(c=null!==(s=null==v?void 0:v.selectedRowKeys)&&void 0!==s?s:null==v?void 0:v.defaultSelectedRowKeys)&&void 0!==c?c:[],S=null!==(u=null!==(d=null==y?void 0:y.expandedRowKeys)&&void 0!==d?d:null==y?void 0:y.defaultExpandedRowKeys)&&void 0!==u?u:[],[N,T]=t.useState([]),[I,R]=t.useReducer(((e,t)=>he(e,t)?e:t),f),[O,k]=t.useReducer(((e,t)=>he(e,t)?e:t),p),[L,A]=t.useReducer(((e,t)=>he(e,t)?e:t),[]),[P,_]=t.useReducer(((e,t)=>he(e,t)?e:t),{}),[F,D]=t.useState(w),[M,H]=t.useReducer(((e,t)=>he(e,t)?e:t),C),[$,q]=t.useReducer(((e,t)=>he(e,t)?e:t),S),[j,K]=t.useState(null!==(m=null==b?void 0:b.currentRowKey)&&void 0!==m?m:""),[V,z]=t.useReducer((e=>e+1),0),[W,B]=t.useReducer(((e,t)=>he(e,t)?e:t),{}),[U,G]=os([],{value:x}),[Y,X]=t.useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[Q,Z]=t.useState({export:!0,import:!0,print:!0}),[J,ee]=t.useState(!1),[te,ne]=t.useState(!1),[re,ie]=t.useState(!1),[le,ae]=t.useState(!1);return{tableFlatData:N,setTableFlatData:T,filters:I,setFilters:R,sorter:O,setSorter:k,superFilters:L,setSuperFilters:A,pagerFilter:P,setPagerFilter:_,pagination:F,setPagination:D,selectionKeys:M,setSelectionKeys:H,rowExpandedKeys:$,setRowExpandedKeys:q,highlightKey:j,setHighlightKey:K,updateMark:V,forceUpdate:z,activedCell:W,setActivedCell:B,mergedTdCells:U,setMergedCells:G,layout:Y,permission:Q,setPermission:Z,setLayout:X,spinning:J,setSpinning:ee,isPingLeft:te,setPingLeft:ne,isPingRight:re,setPingRight:ie,isFullScreen:le,setFullScreen:ae,updateTableFlatData:()=>T([...N])}})(r),{isFetch:De,isWebPagination:Me,isScrollPagination:He,showPagination:$e,tableColumns:qe,flattenColumns:je,editableColumns:Ke,summationColumns:Ve,leftFixedColumns:ze,rightFixedColumns:We,derivedMergeCells:Be,treeExpandIndex:Ue,showSummary:Ge,showFooter:Ye,isHeadGroup:Xe,bordered:Qe,isHeadSorter:Ze,isHeadFilter:Je,isServiceSummation:et,isSelectCollection:tt,isTableImport:nt,isTableClipboard:rt,isSuperSearch:it,isFastSearch:lt,isPivotGrid:at,isGroupSummary:ot,isGroupSubtotal:st,isTableEmpty:ct,summationRows:dt,fetchParams:ut}=cs(r,{getRowKey:R,tableRef:O,tableFullData:k,tableFlatData:Y,updateMark:ge,sorter:J,filters:Q,superFilters:te,selectionKeys:se,pagination:le,mergedTdCells:xe}),{createElementStore:mt,tableStyles:ht,getSpan:pt,getStickyLeft:ft,getStickyRight:gt,scrollXToColumn:vt,scrollYToRecord:yt,calcTableHeight:bt,resetTableScroll:xt,doLayout:Et}=us(r,{getRowKey:R,tableRef:O,topElementRef:w,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:qe,flattenColumns:je,leftFixedColumns:ze,derivedMergeCells:Be,tableFlatData:Y,layout:we,showFooter:Ye,showPagination:$e,isFullScreen:Ae,setLayout:Ce,setElementStore:L}),{initialTable:wt,checkDataIndex:Ct,createTableFullData:St,createWebPageData:Nt,getTableData:Tt,createTableData:It,createTableFlatData:Rt,createGroupData:Ot,createAllExpandedKeys:kt,setSelectionKeysEffect:Lt,doFieldValidate:At,getTableLog:Pt,dataChange:_t,tableChange:Ft,toLastPage:Dt,toFirstPage:Mt,getPageCount:Ht,pagerChangeHandle:$t,scrollBottomDebouncer:qt,clearTableSorter:jt,clearTableFilter:Kt,clearSuperFilters:Vt,clearPagerFilter:zt,clearRowSelection:Wt,clearRowHighlight:Bt,clearTableLog:Ut,destroy:Gt}=ds(r,{getRowKey:R,tableRef:O,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:qe,flattenColumns:je,tableFullData:k,pagination:le,layout:we,filters:Q,sorter:J,superFilters:te,pagerFilter:re,fetchParams:ut,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,summationColumns:Ve,isFetch:De,isWebPagination:Me,isScrollPagination:He,isServiceSummation:et,isGroupSubtotal:st,doLayout:Et,setTableFlatData:X,setTableFullData:P,setTableOriginData:_,setTableDataMaps:F,setDeriveRowKeys:D,setPagination:oe,setPingRight:Le,setPingLeft:Oe,setSpinning:Ie,setSorter:ee,setFilters:Z,setSuperFilters:ne,setPagerFilter:ie,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setFilteredTreeData:B,setScrollXLoad:q,setScrollYLoad:j,setFieldAuth:H,setResizeState:K,setSummaries:z,setPermission:Ne,resetTableScroll:xt,clearElementStore:G});((e,n)=>{const{columns:r,summation:i,rowSelection:l,expandable:a,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:h,highlightKey:p,summationRows:f,showSummary:g,isWebPagination:v,isScrollPagination:y,checkDataIndex:b,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,initialTable:A,destroy:P}=n,_=t.useRef(f);Hi((()=>{if(!l)return;const{onChange:e}=l;"radio"===l.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),ma(m)||null==e||e(m,s.current.selectionRows),ha(m)}),[m]),Hi((()=>{if(!a)return;const{onChange:e}=a;ma(h)||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),ha(h)}),[h]),Hi((()=>{var e,t;o&&(c.current.setClickedValues(p?[p,""]:[]),null===(e=o.onChange)||void 0===e||e.call(o,p,null!==(t=s.current.recordsMap.get(p))&&void 0!==t?t:null))}),[p]),Hi((()=>{var e;he(f,_.current)||(_.current=f,g&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,f)))}),[f]),Hi((()=>{const e=l.selectedRowKeys||[];he(e,m)||N(ua(e))}),[null==l?void 0:l.selectedRowKeys]),Hi((()=>{const e=a.expandedRowKeys||[];he(e,h)||I(ua(e))}),[null==a?void 0:a.expandedRowKeys]),Hi((()=>{const{currentRowKey:e}=o;e!==p&&R(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),Hi((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),Hi((()=>{L()}),[d]),Hi((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||tr("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),ms({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),L())},delay:16}),t.useEffect((()=>(T(Qn(r)),A(),b(),Bn((()=>L())),()=>{P(),k(!0)})),[])})(r,{tableRef:O,tableBodyRef:S,$size:E,pagination:le,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,showSummary:Ge,summationRows:dt,isWebPagination:Me,isScrollPagination:He,checkDataIndex:Ct,toLastPage:Dt,toFirstPage:Mt,getPageCount:Ht,setHandleState:V,scrollYToRecord:yt,setOriginColumns:A,setSelectionKeysEffect:Lt,setRowExpandedKeys:ue,setHighlightKey:fe,setResizeState:K,setUnMounted:U,calcTableHeight:bt,initialTable:wt,destroy:Gt});const Yt=t.useMemo((()=>({getRowKey:R,tableRef:O,tableBodyRef:S,prefixCls:I,$size:E,tableFlatData:Y,flattenColumns:je,editableColumns:Ke,leftFixedColumns:ze,rightFixedColumns:We,treeExpandIndex:Ue,sorter:J,filters:Q,superFilters:te,pagerFilter:re,layout:we,bordered:Qe,showFooter:Ye,showSummary:Ge,summationRows:dt,pagination:le,fetchParams:ut,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,activedCell:ye,mergedTdCells:xe,derivedMergeCells:Be,updateMark:ge,isFetch:De,isPingLeft:Re,isPingRight:ke,isHeadSorter:Ze,isHeadFilter:Je,isFullScreen:Ae,isTableEmpty:ct,isHeadGroup:Xe,isGroupSubtotal:st,isWebPagination:Me,dataChange:_t,tableChange:Ft,getTableData:Tt,setElementStore:L,createTableFullData:St,createTableFlatData:Rt,createWebPageData:Nt,createAllExpandedKeys:kt,updateTableFlatData:Fe,setSorter:ee,setFilters:Z,setSuperFilters:ne,setPagerFilter:ie,setHighlightKey:fe,setRowExpandedKeys:ue,setSelectionRows:W,setSelectionKeysEffect:Lt,setInvalidRowKeys:M,setActivedCell:be,setMergedCells:Ee,getSpan:pt,getStickyLeft:ft,getStickyRight:gt,scrollXToColumn:vt,scrollYToRecord:yt,setPagination:oe,setPingLeft:Oe,setPingRight:Le,setSpinning:Ie,setFullScreen:_e,doFieldValidate:At,createTableData:It,createGroupData:Ot,scrollBottomDebouncer:qt,resetTableScroll:xt,clearTableSorter:jt,clearTableFilter:Kt,clearSuperFilters:Vt,clearPagerFilter:zt,clearRowSelection:Wt,clearRowHighlight:Bt})),[E,Y,je,J,Q,te,re,we,Qe,Ye,Ge,dt,le,ut,se,de,me,ye,Be,ge,De,Re,ke,Ze,Je,Ae,ct,Xe,st,Me]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:l,tableBodyRef:a,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:h,highlightKey:p,isFetch:f,dataChange:g,getTableData:v,createTableData:y,createTableFullData:b,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:_,clearRowHighlight:F,clearTableSorter:D,clearTableFilter:M,clearSuperFilters:H,clearPagerFilter:$,clearTableLog:q}=n,{columns:j,columnsChange:K}=i.current.props,V=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=V(e.children,t,n));const l=t.includes(i);return l&&(null==n||n(e,i)),!l}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:e=>Dn(void 0,void 0,void 0,(function*(){f&&(yield Wn(0),yield v(),null==e||e())})),GET_LOG:()=>P(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(_(),F(),D(),M(),H(),$(),q(),y([]))},CLEAR_LOG:()=>{q(),A()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?ua([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?ua([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=ra(j,e);if(!r)return tr("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!ae(t))return tr("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return tr("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&pe(r,e,t[e]);n&&(K?K([...j]):tr("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:l}=i.current,a=(Array.isArray(e)?e:[e]).filter((e=>ae(e)));if(!a.length)return;a.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(n)||ya(e,n,va(e,n))})),n.addToInserted(e)}));const o="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=l;if(c)o?d.unshift(...a):d.push(...a);else{const e=_a(l,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...a):e.children.push(...a):e.children=a)}c&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,l=(Array.isArray(e)?e:[e]).map((e=>ae(e)?r(e,e.index):e));if(!l.length)return;let a=!1;const o=V(n,l,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:l}=r,a=null==l?void 0:l(e,r);if(!a)return;const{rules:o=[],disabled:s}=a;!s&&o.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),a=!0}));a&&(N(Object.assign({},i.current.handleState,{remove:!0})),b(o),I(m.filter((e=>!l.includes(e)))),l.includes(p)&&F(),R(h.filter((e=>!l.includes(e)))),g(),Bn((()=>{S(V(i.current.tableOriginData,l))})))},VALIDATE_FIELDS:(e,t)=>{Array.from(i.current.recordsMap.values()).forEach((n=>{c.forEach((i=>{const{dataIndex:l,title:a,editRender:o}=i,s=null==o?void 0:o(n,i);if(!s)return;const c=r(n,n.index);if(e&&!e.includes(c))return;if(t&&!t.includes(l))return;const{rules:d=[],disabled:u}=s;u||C(d,va(n,l),c,l,Ia(a))}))}));const{required:n,validate:l}=P(),a=[...n,...l];return a.length&&w(a[0].rowKey),A(),{required:n,validate:l}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:je,editableColumns:Ke,pagination:le,fetchParams:ut,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,isFetch:De,dataChange:_t,getTableData:Tt,createTableData:It,createTableFullData:St,calcTableHeight:bt,scrollXToColumn:vt,scrollYToRecord:yt,doFieldValidate:At,setTableOriginData:_,setHandleState:V,setColumnsDefined:$,setSelectionKeysEffect:Lt,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setOriginColumns:A,forceUpdate:ve,getTableLog:Pt,clearRowSelection:Wt,clearRowHighlight:Bt,clearTableSorter:jt,clearTableFilter:Kt,clearSuperFilters:Vt,clearPagerFilter:zt,clearTableLog:Ut}),t.useLayoutEffect((()=>{mt(),O.current.tableManager.register(O.current.uid,null!=n?n:{current:null})}),[]);const Xt={[`${I}--wrapper`]:!0,[`${I}--lg`]:"large"===E,[`${I}--sm`]:"small"===E,[`${I}--maximize`]:Ae,[s]:!!s},Qt={[I]:!0,"is--border":Qe,"is--fixed":ze.length||We.length,"is--sortable":Ze,"is--filterable":Je,"is--head-group":Xe,"is--area-select":!!c,"is--ping-left":Re,"is--ping-right":ke};return t.createElement(Ko.Provider,{value:Yt},t.createElement("div",{className:Pe(Xt,b),style:x},p&&t.createElement("div",{ref:w,className:`${I}-top`},t.createElement("div",{className:`${I}-top__space`},"bottom"!==(null==m?void 0:m.position)&&t.createElement(hs,{total:le.total}),t.createElement("div",{className:`${I}-top__space-slot`,style:{justifyContent:Zo[h]}},r.children)),t.createElement("div",{className:`${I}-top__actions`},t.createElement(Vu,{ref:N,showFullScreen:f,showReload:g&&De,showPrint:Se.print&&!!d,showImport:Se.import&&nt,showExport:Se.export&&!!u,showClipboard:rt,showCollection:tt,showFastSearch:lt,showSuperSearch:it,showPivotGrid:at,showGroupSummary:ot,showToolBox:v,tableColumns:qe}),t.createElement(Wu,{ref:T,columns:l}))),t.createElement(nl,{spinning:null!=a?a:Te},t.createElement("div",{ref:C,className:Pe(Qt),style:ht},t.createElement("div",{className:`${I}--main-wrapper`},y&&t.createElement(xm,{tableColumns:qe}),t.createElement(qm,{ref:S}),Ye&&t.createElement(jm,null)),Qe&&t.createElement("div",{className:`${I}--border-line`}),ct&&t.createElement(zm,null),o&&t.createElement(Wm,null))),$e&&t.createElement(Vm,Rn({},le,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));Bm.displayName="QmTable";const Um=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:m}=e,{$size:h}=$n(e),{t:p}=Mn(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=sl(f),[b,x]=t.useState(c),[E,w]=t.useState(),[C,S]=t.useState(o),[N,T]=t.useState(!1),[I,R]=t.useState(300),[O,k]=t.useState(s),[L,A]=t.useState((e=>[{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[P,_]=t.useState(Ie({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[F,D]=t.useState([]),M=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*jo[h]-30)},H=cl(M,5);pn((()=>{H()}),[y.width]),Hi((()=>{he(s,O)||k(s)}),[s]),t.useEffect((()=>{$()}),[P]),t.useEffect((()=>{a&&v.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;l&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(l))}),[]);const $=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=b;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:a=zn}=n;if(a(P)){T(!0);try{const t=yield r(P);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];i||(S([]),yield Wn(0)),D(n)}}catch(e){}T(!1)}})),q=e=>{i||(w(e),m(e))},j=e=>{_(Object.assign({},P,e))},K={[`${lr("search-helper")}--wrapper`]:!0},V=b.webPagination?{dataSource:F,loading:N,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:P})};return t.createElement("div",{ref:f,className:Pe(K,d),style:u},t.createElement("div",{className:"form-wrap"},O.length?t.createElement(Tp,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>M(),onFinish:e=>j(e),onReset:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||j(t)}))}):null),t.createElement("div",null,t.createElement(Bm,Rn({ref:v,uniqueKey:r,height:I,columns:L,rowKey:b.rowKey||"pageIndex"},V,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(i?t:t[0])}},topSpaceAlign:"left",paginationConfig:b.paginationConfig,columnsChange:e=>A(e),onRowDblclick:q,onRowEnter:q}),b.topBarExtra)),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${jo[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>m(null),style:{marginRight:8}},p("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!E,onClick:()=>m(E,i?C:void 0)},p("qm.dialog.confirm"))))};Um.displayName="QmSearchHelper";const{Search:Gm}=O;class Ym extends d{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||tr("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||tr("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&tr("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Dn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Gn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&io(e,this.alias,c),d&&lo(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=ro(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==l||l([e])}}}catch(e){}this.setState({loading:!1})}})),this.todoOpen=e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)},this.createFilters=e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,r=""!==e?e:void 0,i=("function"==typeof n?n():n)||[],l={[t]:r};return(Array.isArray(i)?i:[i]).forEach((e=>{if(ae(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](r):r;else l[e]=r})),l},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=zn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>Dn(this,void 0,void 0,(function*(){var o;const s=Ie({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return a();this.setState({loading:!0});try{const e=yield t.fetch.api(s);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];l(n)}else a()}catch(e){a(e)}finally{Bn((()=>this.setState({loading:!1})))}}))))},this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const i=ro(e,this.alias[r]);void 0!==i&&(t.SET_FIELDS_VALUE({[r]:i}),r===this.valueKey&&(this._prevValue=i),r===n&&t.setViewValue(n,i))}for(const n in this.extras){const r=ro(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>Dn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=ro(e,this.alias[n]))||void 0===r?void 0:r.toString().toLowerCase().includes(t.toLowerCase())}));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),this.openSearchHelper=(e,t)=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:zn)(n.state.formData);(null==i?void 0:i.then)?i.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==i&&(this.todoOpen(e),null==t||t())})),this.closeSearchHelper=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const i=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===this.valueKey&&(this._prevValue=i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])});const r=ro(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(e)),200)}))},this.closeButNotSelect=()=>{const{onlySelect:e=!0}=this.searchHelper;this._is_change&&(e?this.clearSearchHelperValue():this.searchHelperChangeHandle(this.props.value)),this._is_change=!1,this.setVisible(!1)},this.clearSearchHelperValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}},this.searchHelperChangeHandle=e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,null==t||t(e,this._record)},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},this.focus=()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=un("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:p,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${jo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:Object.assign({},this.deriveParams,c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(To,{value:l,bordered:m}):t.createElement(t.Fragment,null,t.createElement(Gm,{ref:e=>this[`${a}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:m,allowClear:h,readOnly:p,disabled:f,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:i=!0,table:l}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?i?(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)&&this.getSearchHelperTableData(n).then((e=>this.resetSearchHelperValue(e,n))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(n):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!r&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):Bn((()=>this.clearSearchHelperValue())))}}),t.createElement(Ml,b,t.createElement(Um,x)))}}Ym.contextType=Hl;class Xm extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=mo(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:h,rules:p=[]}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ym,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),m&&t.createElement(F,null,e.renderFormItemButton(a,m)),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Xm.contextType=Hl;const Qm=e=>{class n extends d{constructor(){super(...arguments),this.event1=null,this.event2=null,this.$el=null,this.omitClassNames=[],this.state={clickOutside:!1},this.mousedownHandler=e=>{this.startClick=e},this.mouseupHandler=e=>{this.documentHandler(e,this.startClick)},this.documentHandler=(e,t)=>{var n,r;const i=e.target,l=null==t?void 0:t.target,a=!i||!l,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(i))||(null===(r=this.$el)||void 0===r?void 0:r.contains(l)),s=this.$el===i,c=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),d=c.some((e=>null==e?void 0:e.contains(i)))||c.includes(l);let u;u=!(a||o||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=(e=[])=>{this.omitClassNames=e}}componentDidMount(){this.event1=Kt(document,"mousedown",this.mousedownHandler),this.event2=Kt(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:n}=this.props,{clickOutside:r}=this.state;return t.createElement(e,Rn({ref:n},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return n.displayName=`OutsideClick(${e.displayName||e.name})`,t.forwardRef(((e,r)=>t.createElement(n,Rn({},e,{forwardedRef:r}))))};let Zm=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||tr("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||tr("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ke([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||t(e),n(e,this.createViewText(e),this._records)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:i}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:a=(e=>e),dataKey:o,callback:s,fieldAliasMap:c}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},d="function"==typeof c?c():c||{},{value:u}=this.props;if(i){if(Gn(u))return this.setRecords([]);this.setState({loading:!0});try{const e=yield i(a(Object.assign(Object.assign({},l),{keys:u})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];i.forEach((e=>{(null==d?void 0:d.valueKey)&&d.valueKey!==r&&(e[r]=e[d.valueKey]),(null==d?void 0:d.textKey)&&d.textKey!==n&&(e[n]=e[d.textKey])})),i=i.filter((e=>u.includes(e[r])));const l=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(l),this.setViewValue(u),null==s||s(i)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:i}=this.context,{visible:l,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:h={},placeholder:p=un("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:l,title:un("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${jo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:Ie({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},un("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=lr("form-multiple-search-helper"),{size:R}=i.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return i.isOnlyShow?t.createElement(To,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(od,{popupVisible:!y&&a,popup:N,popupClassName:Pe(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ga,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(D,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:p,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},h),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Nt,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Ml,w,t.createElement(Um,C)))}};Zm.contextType=Hl,Zm=Fn([Qm],Zm);class Jm extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=mo(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:h,rules:p=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Zm,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(F,null,e.renderFormItemButton(a,m)),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Jm.contextType=Hl;const eh=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...eh(e.children)),e.children&&t.push(e.value)})),t},th=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=th(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},nh=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&nh(e.children,t),t(e)||e.children&&e.children.length))),rh=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:m,onClose:h}=e,{$size:p}=$n(e),{t:f}=Mn(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=sl(g),[x,E]=t.useState(c),[w,C]=t.useState(),[S,N]=t.useState(o),[T,I]=t.useState(!1),[R,k]=t.useState(300),[L,A]=t.useState(300),[P,_]=t.useState(s),[F,D]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[M,H]=t.useState(Ie({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[$,q]=t.useState([]),j=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*jo[p]-30)},K=cl(j,5);pn((()=>{K()}),[b.width]),Hi((()=>{he(s,P)||_(s)}),[s]),t.useEffect((()=>{V()}),[M]),t.useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;l&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(l)),te()}),[]);const V=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=x;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:a=zn}=n;if(a(M)){I(!0);try{const t=yield r(M);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];i||(N([]),yield Wn(0)),q(n)}}catch(e){}I(!1)}})),W=e=>{i||(C(e),h(e))},B=e=>{H(Object.assign({},M,e))},[U,G]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),J=t.useRef(U),ee=t.useRef([]);Hi((()=>{X(eh(U))}),[U]);const te=()=>Dn(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:i="value",textKey:l="text"}=d.fetch;try{const a=yield t(n);if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[],n=ao(t,i,l);G(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${So.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${lr("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:M})};return t.createElement("div",{ref:g,className:Pe(re,u),style:m},t.createElement(Ji,{defaultValue:200,style:{height:"100%"}},t.createElement(Ji.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(O,{className:"input-wrap",value:Q,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:t.createElement(Nt,null),allowClear:!0,onChange:e=>(e=>{const t=nh(J.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==ne(n).indexOf(e)}));Z(e),G(t)})(e.target.value)}),t.createElement(z,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:Y,treeData:U,filterTreeNode:e=>{if(!Q)return!1;const t=e.text||"";return-1!==ne(t).indexOf(Q)},onExpand:e=>{X(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return tr("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=ue(e,t[r]);B(n)})(th(ee.current,(n=>ue(n,t)===e[0]))||{})}})),t.createElement(Ji.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},P.length?t.createElement(Tp,{ref:v,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>_(e),onCollapse:()=>j(),onFinish:e=>B(e),onReset:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||B(t)}))}):null),t.createElement("div",null,t.createElement(Bm,Rn({ref:y,uniqueKey:r,height:L,columns:F,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(i?t:t[0])}},topSpaceAlign:"left",paginationConfig:x.paginationConfig,columnsChange:e=>D(e),onRowDblclick:W,onRowEnter:W}),x.topBarExtra)))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${jo[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!w,onClick:()=>h(w,i?S:void 0)},f("qm.dialog.confirm"))))};rh.displayName="TreeTableHelper";const{Search:ih}=O;class lh extends d{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||tr("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||tr("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&tr("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Dn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Gn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&io(e,this.alias,c),d&&lo(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=ro(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==l||l([e])}}}catch(e){}this.setState({loading:!1})}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const i=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===this.valueKey&&(this._prevValue=i),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])})},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const i=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===this.valueKey&&(this._prevValue=i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])});const r=ro(e,this.alias[n]);this.triggerChange(r);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(e)),200)}))},this.clearSearchHelperValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l=""}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=un("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:p,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${jo[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:Ie({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(To,{value:l,bordered:m}):t.createElement(t.Fragment,null,t.createElement(ih,{ref:e=>this[`${a}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:m,allowClear:h,readOnly:p,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t.createElement(Ml,b,t.createElement(rh,x)))}}lh.contextType=Hl;class ah extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=mo(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:h,rules:p=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(lh,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(F,null,e.renderFormItemButton(a,m)),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}ah.contextType=Hl;let oh=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||tr("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||tr("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ke([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||t(e),n(e,this.createViewText(e),this._records)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:i}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:a=(e=>e),dataKey:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(i){if(Gn(d))return this.setRecords([]);this.setState({loading:!0});try{const e=yield i(a(Object.assign(Object.assign({},l),{keys:d})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];i.forEach((e=>{(null==c?void 0:c.valueKey)&&c.valueKey!==r&&(e[r]=e[c.valueKey]),(null==c?void 0:c.textKey)&&c.textKey!==n&&(e[n]=e[c.textKey])})),i=i.filter((e=>d.includes(e[r])));const l=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(l),this.setViewValue(d)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:i}=this.context,{visible:l,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:h={},placeholder:p=un("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:l,title:un("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${jo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:Ie({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},un("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=lr("form-multiple-tree-table-helper"),{size:R}=i.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return i.isOnlyShow?t.createElement(To,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(od,{popupVisible:!y&&a,popup:N,popupClassName:Pe(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ga,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(D,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:p,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},h),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Nt,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Ml,w,t.createElement(rh,C)))}};oh.contextType=Hl,oh=Fn([Qm],oh);class sh extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=mo(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:h,rules:p=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(oh,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(F,null,e.renderFormItemButton(a,m)),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}sh.contextType=Hl;const ch="_startSign",dh="_endSign",uh=e=>{var n;const{uniqueKey:r,initialValue:i,filters:l=[],table:a={},onClose:o}=e,{$size:s}=$n(e),{t:c}=Mn(),d=t.useRef(null),u=t.useRef(null),m=t.useRef(null),h=sl(d),[p,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[w,C]=t.useState(l),[S,N]=t.useState((e=>[{title:c("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},{title:c("qm.form.rangeSearchHelper")[0],dataIndex:ch,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:dh,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[T,I]=t.useState(Ie({},null===(n=a.fetch)||void 0===n?void 0:n.params,i)),[O,k]=t.useState([]),L=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),A=t.useMemo((()=>2===L.length&&L.every((e=>void 0!==e))),[L]),P=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*jo[s]-30)},_=cl(P,5);pn((()=>{_()}),[h.width]),Hi((()=>{he(l,w)||C(l)}),[l]),t.useEffect((()=>{F()}),[T]);const F=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=p;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:l=zn}=n;if(l(T)){v(!0);try{const t=yield r(T);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[];k(n)}}catch(e){}v(!1)}})),D=(e,t)=>{delete e[t]},M=()=>{y.forEach((e=>{e&&(D(e,ch),D(e,dh))})),b([])},H=e=>{M(),I(Object.assign({},T,e))},$=lr("range-helper"),q=p.webPagination?{dataSource:O,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},p.fetch),{params:T})};return t.createElement("div",{ref:d,className:`${$}--wrapper`},t.createElement("div",{className:"form-wrap"},w.length?t.createElement(Tp,{ref:u,items:w,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>P(),onFinish:e=>H(e),onReset:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||H(t)}))}):null),t.createElement("div",null,t.createElement(Bm,Rn({ref:m,height:x,columns:S,rowKey:p.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},q,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[ch,dh].includes(n)&&(n===ch&&(e[n]?(D(e,n),b([void 0,y[1]])):e.pageIndex>L[1]?R.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&D(y[0],n),e[n]="[",b([e,y[1]]))),n===dh&&(e[n]?(D(e,n),b([y[0],void 0])):e.pageIndex<L[0]?R.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&D(y[1],n),e[n]="]",b([y[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[ch]="["),e.pageIndex===L[1]&&(e[dh]="]")}))}}),t.createElement(nr,{type:"primary",icon:t.createElement(Tt,null),title:c("qm.table.alert.clear"),onClick:()=>M()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${jo[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!A,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[ch,dh].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};uh.displayName="RangeTableHelper";const mh=new Array(2).fill("");class hh extends d{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:mh},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||tr("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||tr("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setItemList=e=>{this.setState({itemList:e})},this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setTextValue=e=>{this.setState({textValue:e})},this.setRecords=e=>{this._records=e},this.setViewValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,null==t||t(e),n(e,this.createViewText(),this._records)},this.clearSearchHelperValue=()=>{this.setRecords([]),this.setTextValue(mh),this.triggerChange([])},this.closeSearchHelper=e=>{const{valueKey:t,textKey:n}=this.alias,r=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(r),this.setTextValue(r.map((e=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.triggerChange(e.map((e=>e[t])));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.createFilters=e=>{const{fieldName:t}=this.props.option;return{[t]:Gn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=zn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>Dn(this,void 0,void 0,(function*(){var o;const s=Ie({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return a();this.setState({loading:!0});const e=yield t.fetch.api(s);if(Bn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return l(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>Dn(this,void 0,void 0,(function*(){const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{var r;const i=null===(r=e[n])||void 0===r?void 0:r.toString().toLowerCase();return t.some((e=>null==i?void 0:i.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),this.closeButNotSelect=()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:n=[]}=this.props;he(t,n)||he(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!he(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=mh.map(((e,t)=>{var l,a;return null!==(a=null===(l=r[i].find((e=>e.value===n[t])))||void 0===l?void 0:l.text)&&void 0!==a?a:""}));this.setTextValue(e)}}getItemList(){var e;return Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(Gn(c))return this.setRecords([]);this.setState({loading:!0});try{const o=yield r(l(Object.assign(Object.assign({},i),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,a))&&void 0!==e?e:[];r.forEach((e=>{(null==s?void 0:s.valueKey)&&s.valueKey!==n&&(e[n]=e[s.valueKey]),(null==s?void 0:s.textKey)&&s.textKey!==t&&(e[t]=e[s.textKey])})),r=r.filter((e=>c.includes(e[n]))).slice(0,2);const i=r.map((e=>({value:e[n],text:e[t]})));this.setRecords(r),this.setItemList(i),this.setTextValue(i.map((e=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}))}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){var e;const{$$form:n}=this.context;this.props;const{visible:r,loading:i,textValue:l}=this.state,{fieldName:a,options:o={},searchHelper:s={},placeholder:c=un("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,p=l.every((e=>no(e)))?"":l.join(" - "),f={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${jo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:Ie({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(To,{value:p,bordered:d}):t.createElement(t.Fragment,null,t.createElement(O.Group,null,t.createElement(O,{value:l[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?l.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(l).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):l.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,l[1]]))}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),t.createElement(O.Search,{value:l[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:i,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?l.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(l).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):l.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([l[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t.createElement(Ml,f,t.createElement(uh,g)))}}hh.contextType=Hl;class ph extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=mo(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:h=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(c),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(hh,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{p(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(F,null,e.renderFormItemButton(a,u)),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}ph.contextType=Hl;const fh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,items:i,onChange:l,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,h=Gn(m)?i:m,p=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(To,{value:p(r),bordered:c}):t.createElement(M.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==l||l(e),a(e,p(e))})(e)}},h.map((e=>t.createElement(M,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class gh extends d{constructor(){super(...arguments),this.state={itemList:[]}}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}getItemList(){var e;return Dn(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:h=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(fh,{option:this.props.option,items:n,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}gh.contextType=Hl;const vh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:h}=a,p=e=>h?h[Math.ceil(e)-1]:e.toString();return t.createElement(U,{value:r,count:m,style:o,allowHalf:u,allowClear:s,tooltips:h,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==i||i(e),l(e,p(e))})(e)}})};class yh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(vh,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}yh.contextType=Hl;const bh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,items:i,onChange:l,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:m=[]}=o,h=Gn(m)?i:m,p=e=>{var t,n;return null!==(n=null===(t=h.find((t=>t.value===e)))||void 0===t?void 0:t.text)&&void 0!==n?n:""};return n.isOnlyShow?t.createElement(To,{value:p(r),bordered:c}):t.createElement(j.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==l||l(e),a(e,p(e))})(t)}},h.map((e=>t.createElement(j,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class xh extends d{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:h=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(bh,{option:this.props.option,items:n,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}xh.contextType=Hl;const Eh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=Wa,trueValue:h=za}=o,{t:p}=Mn();return t.createElement(t.Fragment,null,t.createElement(W,{checked:r===h,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement($e,null),unCheckedChildren:t.createElement(it,null),onChange:e=>{(e=>{null==i||i(e),l(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:m)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class wh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option,{labelToSwitch:p}=o;return t.createElement(P.Item,{label:p?" ":e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Eh,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}wh.contextType=Hl;const Ch=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{options:o={},style:s={},placeholder:c=a("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:m,disabled:h,onFocus:p,onBlur:f,onEnter:g}=e.option,{showCount:v,maxLength:y,autoSize:b}=o,x=Object.assign({},{minRows:1,maxRows:3},b);return t.createElement(O.TextArea,{value:r,placeholder:c,style:s,maxLength:y,showCount:v,autoSize:x,bordered:d,allowClear:u,readOnly:m||n.isOnlyShow,disabled:h,onFocus:e=>{null==p||p(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),null==f||f(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;null==g||g(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),l(e)})(t)}})};class Sh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ch,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Sh.contextType=Hl;const Nh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.datePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:f}=e.option,{dateType:g="date",format:v,disabledDate:y,minDateTime:b,maxDateTime:x,shortCuts:E=!0}=s,w=t.createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),l(e,S(e))},S=e=>no(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=to(h().subtract(e,"day"),Xa[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return n.isOnlyShow?t.createElement(To,{value:S(r),bordered:u}):t.createElement(In,{ref:w,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ya[g],format:v,bordered:u,showToday:!1,showTime:"datetime"===g&&{defaultValue:h("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:p,disabledDate:null!=y?y:e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[b,x]),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():t.createElement(t.Fragment,null,t.createElement(G,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(G,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(G,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(G,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:eo(r,Xa[g]),onChange:(e,t)=>{C(to(e,Xa[g]))}})};class Th extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Nh,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Th.contextType=Hl;const Ih=e=>[h().subtract(e,"day"),h()],Rh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:f=n.isFormDisabled}=e.option,{dateType:g="date",format:v,disableds:y=[!1,!1],allowEmpty:b,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:Ih(7),[a("qm.form.dateRangePickers")[1]]:Ih(30),[a("qm.form.dateRangePickers")[2]]:Ih(90),[a("qm.form.dateRangePickers")[3]]:Ih(180)},N=e=>no(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(To,{value:N(r),bordered:u}):t.createElement(In.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ya[g],format:v,bordered:u,showTime:"datetime"===g&&{defaultValue:[h("00:00:00","HH:mm:ss"),h("23:59:59","HH:mm:ss")]},allowClear:m,allowEmpty:b,disabled:f?[!0,!0]:y,inputReadOnly:p,disabledDate:null!=x?x:e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w]),ranges:C&&g.includes("date")?S:void 0,value:Gn(r)?null:[eo(null==r?void 0:r[0],Xa[g]),eo(null==r?void 0:r[1],Xa[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),null==i||i(e),l(e,N(e))})([to(null==e?void 0:e[0],Xa[g]),to(null==e?void 0:e[1],Xa[g])])}})};class Oh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Rh,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Oh.contextType=Hl;const kh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:p}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:v=1,secondStep:y=1}=s;return n.isOnlyShow?t.createElement(To,{value:r,bordered:u}):t.createElement(On,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:v,secondStep:y,allowClear:m,disabled:p,inputReadOnly:h,format:Qa[f],value:eo(r,Qa[f]),onChange:(e,t)=>{(e=>{const t=to(e,Qa[f]);null==i||i(t),l(t)})(e)}})};class Lh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(kh,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Lh.contextType=Hl;const Ah=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:p=n.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:v,hourStep:y=1,minuteStep:b=1,secondStep:x=1}=s,E=e=>no(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(To,{value:E(r),bordered:u}):t.createElement(On.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:b,secondStep:x,allowClear:m,allowEmpty:v,disabled:p?[!0,!0]:g,inputReadOnly:h,format:Qa[f],value:Gn(r)?null:[eo(null==r?void 0:r[0],Qa[f]),eo(null==r?void 0:r[1],Qa[f])],onChange:(e,t)=>{(e=>{const t=[to(null==e?void 0:e[0],Qa[f]),to(null==e?void 0:e[1],Qa[f])];null==i||i(t),l(t,E(t))})(e)}})};class Ph extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ah,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Ph.contextType=Hl;class _h extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._clicking=!1,this._prevValue=null,this.state={itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0},this.getSearchHelper=Wt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting(),he(e,t)||this.getItemList()})),this.echoSearchHelper=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:i,echoRequest:l}=this.searchHelper;if(r||tr("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(e)||tr("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),l&&!this.valueKey&&tr("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&tr("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>Dn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Gn(u))try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&io(e,this.alias,c),d&&lo(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=ro(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==l||l([e])}}}catch(e){}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const i=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===this.valueKey&&(this._prevValue=i),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])})},this.fetchHandle=Le(this.getItemList,200),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},this.clickHandle=(e,t)=>{const{$$form:n}=this.context,{fieldName:r}=this.props.option;for(const t in this.alias){if(t===r)continue;const i=ro(e,this.alias[t]);n.SET_FIELDS_VALUE({[t]:i}),t===this.valueKey&&(this._prevValue=e?i:null)}for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:ro(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=ro(e,this.alias[r]);this.triggerChange(i),this.setState({inputText:void 0}),t&&t()},this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(e){var t,n,r,i,l,a;const o=(null===(n=null===(t=e.option.searchHelper)||void 0===t?void 0:t.request)||void 0===n?void 0:n.params)||(null===(r=e.option.request)||void 0===r?void 0:r.params),s=(null===(l=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===l?void 0:l.params)||(null===(a=this.props.option.request)||void 0===a?void 0:a.params);this.paramsChangeHandler(s,o),this.echoSearchHelper()}getItemList(e){var t;return Dn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(l(Object.assign(Object.assign({},i),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=ue(o.data,a))&&void 0!==t?t:[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}))}render(){const{$$form:e}=this.context,{visible:n,loading:r,itemList:i,inputText:l}=this.state,{value:a}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=un("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:p}=this.props.option,{listHeight:f=Ba}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=lr("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t.createElement(T,{spinning:r},i.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:Pe("table")},!g&&t.createElement("thead",null,t.createElement("tr",null,y.filter((e=>!e.hidden)).map((e=>t.createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t.createElement("tbody",null,i.map(((e,n)=>t.createElement("tr",{key:n,className:this.state.activeIndex===n?"active":"",onMouseEnter:()=>{this.setState({activeIndex:n})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},y.filter((e=>!e.hidden)).map((n=>t.createElement("td",{key:n.dataIndex},ue(e,n.dataIndex))))))))):t.createElement(tl,null));return t.createElement(on.Consumer,null,(r=>{const s={[b]:!0,[`${b}--lg`]:"large"===(null==r?void 0:r.size),[`${b}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(To,{value:a,bordered:u}):t.createElement(od,{action:p?[]:["click"],popupVisible:!p&&n,popup:E,popupClassName:Pe(s,`form-popper__${o}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ga,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:d,allowClear:m,bordered:u,readOnly:h,disabled:p,style:Object.assign({width:"100%"},c),value:null!=l?l:a,title:a,onFocus:()=>{!i.length&&this.fetchHandle(a)},onBlur:e=>{v&&!this._clicking&&l!==a&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(i[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const n=40===e.keyCode?++t%i.length:(--t+i.length)%i.length;this.setState({activeIndex:n})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),v?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}))}}_h.contextType=Hl;class Fh extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=mo(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:h,rules:p=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(_h,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(F,null,e.renderFormItemButton(a,m)),u&&t.createElement(F,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Fh.contextType=Hl;class Dh extends d{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:l,className:a,style:o={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:m=Vn}=s,h=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===l)))&&void 0!==e?e:[],r=null!=d?d:t.length-1;t.slice(r+1).forEach((e=>{var t;const r=u.find((t=>t.fieldName===e.fieldName));if(!r)return;const i=r.showLabel?`${e.label}:`:"",l=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==l&&h.push(Object.assign(Object.assign({},e),{text:`${i}${l}`}))}))}return t.createElement(P.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(ar,{id:l,label:i,className:a,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[l],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[l]:e})}))),m(e)}}))}}Dh.contextType=Hl;const Mh=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:Mh(e.children,t,n,r)}):e)),Hh=e=>{var n;const{$$form:r}=t.useContext(Hl),{value:i,items:l,multiple:a,loading:o,onChange:s,onValuesChange:c}=e,{t:d}=Mn(),{fieldName:u,options:m={},style:h={},placeholder:p=d("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,asyncLoad:v,readOnly:y,disabled:b}=e.option,{itemList:x,filterable:E=!0,listHeight:w=Ba,checkStrictly:C,checkStrategy:S="SHOW_CHILD",collapseTags:N,echoRequest:T,defaultExpandAll:I=!v,defaultExpandedKeys:R,dropdownStyle:O,openPyt:k=!0}=m,[L,A]=t.useState(Gn(x)?l:x),[P,_]=t.useState([]),[F,D]=t.useState(!1),[M,H]=t.useState(!1),$=t.useRef(null),q=t.useRef(null),j=t.useRef(L),K=t.useRef(M),V=t.useRef(null),z=e=>{H(e),K.current=e};Nu({ref:q,handler:()=>z(!1)}),t.useEffect((()=>{i!==V.current&&(U(),V.current=i),(()=>{var e;q.current=(null===(e=$.current)||void 0===e?void 0:e.querySelector(".ant-select-selection-overflow-item-rest"))||null})()}),[i]),Hi((()=>{const e=Gn(x)?l:x;v?he(e,j.current)||(A((t=>[...e,...t.filter((e=>!!e.style))])),j.current=e):A(e)}),[x,l]),Hi((()=>{A((e=>[...e,...P.filter((t=>!e.some((e=>e.value===t.value))))]))}),[P]);const W=e=>{var t;return(null===(t=oo(L,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},B=e=>(C&&Array.isArray(i)&&i.every((e=>ae(e)))&&(e=e.map((e=>e.value))),a?(null==e?void 0:e.map((e=>W(e))).join(","))||"":W(e)),U=()=>Dn(void 0,void 0,void 0,(function*(){var e;if(!T)return;if(!v)return tr("Form","TREE_SELECT 的 echoRequest 选项必须组合 `asyncLoad` 一起使用");const{fetchApi:t,params:n,dataKey:r,callback:l,formatter:a=(e=>e)}=T||{},{textKey:o="text",valueKey:s="value"}=v;if(t&&!Gn(i))try{const c=yield t(a(Object.assign(Object.assign({},n),{[s]:i})));if(200===c.code){const t=Array.isArray(c.data)?c.data:null!==(e=ue(c.data,r))&&void 0!==e?e:[];if(t.length){const e=ao(t,s,o);_(e.map((e=>Object.assign(Object.assign({},e),{style:{display:"none"}})))),null==l||l(t)}}}catch(e){}}));return r.isOnlyShow?t.createElement(To,{value:B(i),bordered:f}):t.createElement(od,{popupVisible:!b&&M,popup:(()=>{if(!a)return null;const e=(null==i?void 0:i.map((e=>W(e))))||[];return t.createElement("ul",{className:"ant-dropdown-menu"},e.length?e.map(((e,n)=>t.createElement("li",{key:`${e}-${n}`,className:"ant-dropdown-menu-item"},e))):t.createElement("li",{className:"ant-dropdown-menu-item"},d("qm.table.config.emptyText")))})(),popupStyle:{minWidth:null===(n=$.current)||void 0===n?void 0:n.offsetWidth},onPopupVisibleChange:e=>z(e),builtinPlacements:Ga,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",{ref:$,style:{width:"100%"}},t.createElement(Y,Rn({open:F,fieldNames:{label:"text",value:"value",children:"children"},value:i,multiple:a,treeCheckable:a,treeCheckStrictly:C,showCheckedStrategy:Y[S],popupClassName:`form-popper__${u}`,dropdownStyle:O,placeholder:p,listHeight:w,style:h,loading:o,bordered:f,allowClear:g,disabled:b,treeDefaultExpandAll:I,treeDefaultExpandedKeys:R,showSearch:E,maxTagCount:N?"responsive":void 0,loadData:v?({key:e,children:t})=>Dn(void 0,void 0,void 0,(function*(){var n;if(!v||t)return;const{fetchApi:r,params:i,dataKey:l,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=v;if(r)try{const t=yield r(c(Object.assign(Object.assign({},i),{[o]:e})));if(200===t.code){const r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,l))&&void 0!==n?n:[],i=Mh(L,e,o,ao(r,o,a));A(i),null==s||s(r)}}catch(e){}})):void 0,treeData:L},a?{title:B(i)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(k?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onMouseDown:e=>{e.target.classList.contains("ant-select-selection-overflow-item-rest")&&(z(!0),D(!1))},onDropdownVisibleChange:e=>{if(!e)return D(e);Bn((()=>{K.current||D(e)}))},onChange:e=>{(e=>{null==s||s(e),c(e,B(e),L)})(e),V.current=e}}))))};class $h extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=ao(n,l,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:h,rules:p=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Zn(d)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Hh,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(F,{flex:Zn(m.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}$h.contextType=Hl;const qh=e=>{const{$$form:n}=t.useContext(Hl),{value:r,multiple:i,items:l}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:h,readOnly:p,disabled:f}=e.option,{itemList:g,changeOnSelect:v,checkStrictly:y,checkStrategy:b="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:w=!0}=s,[C,S]=t.useState(Gn(g)?l:g),N=t.useRef(C);Hi((()=>{const e=Gn(g)?l:g;h?he(e,N.current)||(S(e),N.current=e):S(e)}),[g,l]);const T=e=>so(C,null!=e?e:"").map((e=>e.text)).join("/"),I=e=>i?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement(To,{value:I(r),bordered:u}):t.createElement(X,Rn({value:(e=>Gn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:i,maxTagCount:"responsive",changeOnSelect:v||y,showCheckedStrategy:X[b],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:m,disabled:f,showSearch:x&&!h&&{filter:(e,t)=>t.some((t=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:h?e=>Dn(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!h||n.children)return;const{fetchApi:r,params:i,dataKey:l,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=h;if(r)try{const e=yield r(c(Object.assign(Object.assign({},i),{[o]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,l))&&void 0!==t?t:[],i=Mh(C,n.value,o,ao(r,o,a));S(i),null==s||s(r)}}catch(e){}})):void 0},i?{title:I(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,I(t),C)})(((e=[])=>i?e.map((e=>e.join(","))):e.join(","))(t))}}))};class jh extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=ao(n,l,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:h,rules:p=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Zn(d)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:p,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(qh,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(F,{flex:Zn(m.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}jh.contextType=Hl;const Kh=["110000","120000","310000","500000"],Vh=["810000","820000"],zh=[{text:"A",value:"A"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"L",value:"L"},{text:"N",value:"N"},{text:"Q",value:"Q"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],Wh=[{text:"A",value:"A"},{text:"B",value:"B"},{text:"C",value:"C"},{text:"D",value:"D"},{text:"E",value:"E"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"K",value:"K"},{text:"L",value:"L"},{text:"M",value:"M"},{text:"N",value:"N"},{text:"P",value:"P"},{text:"Q",value:"Q"},{text:"R",value:"R"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"W",value:"W"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],Bh=e=>So.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Uh=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...Kh,...Vh].includes(e))):Object.keys(e[t])).map((r=>({l:Bh(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:Uh(e,r,n+1)})))},Gh=(e,t)=>t.map((t=>({l:Bh(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Yh extends d{constructor(e){super(e),this.searchRef=t.createRef(),this.scrollRef=t.createRef(),this.state={visible:!1,select_type:"0",active_key:""},this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)},this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Vt(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){var t;return(null===(t=this.allCities.find((t=>t.c===e)))||void 0===t?void 0:t.n)||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Gh(rn,Kh)},{l:"Z2",n:"港澳",c:"",p:"",children:Gh(rn,Vh)}]}createProvince(){var e;return(null!==(e=Uh(rn,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Wh.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Kh,...Vh].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(j.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},t.createElement(j.Button,{value:"0"},un("qm.form.citySelectType.0")),t.createElement(j.Button,{value:"1"},un("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?zh:Wh).map((n=>t.createElement("li",{key:n.value,className:Pe({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement(D,{size:"small",placeholder:un("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>{var n;return((null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"").toLowerCase().indexOf(e.toLowerCase())>=0},value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t.createElement(D.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:n}=this.state;return("0"===n?this.provinces:this.letterCities).map(((n,r)=>{var i;return t.createElement("div",{key:r},t.createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t.createElement("dd",null,null===(i=n.children)||void 0===i?void 0:i.map((n=>t.createElement("li",{key:n.c,className:Pe({actived:n.c===e}),onClick:()=>this.clickHadnle(n.c)},n.n)))))}))}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=un("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=lr("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,p=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},a)},t.createElement("div",{className:"city-drop"},t.createElement("div",{className:"city-drop-toper"},t.createElement("div",{className:"city-drop-toper__type"},this.renderType()),t.createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t.createElement("div",{className:"city-drop-letter"},this.renderLetter()),t.createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t.createElement("dl",null,this.renderCity(r)))));return t.createElement(on.Consumer,null,(r=>{const l={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(To,{value:p,bordered:s}):t.createElement(od,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:Pe(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ga,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},a),value:p,title:p,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Yh.contextType=Hl;class Xh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Yh,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Xh.contextType=Hl;const Qh=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Qh(e,n)})))};class Zh extends d{constructor(e){super(e),this.searchRef=t.createRef(),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)};const n=Qh(rn,"86")||[];this.state={results:n,visible:!1,values:[],tabs:[n.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.state.values.join(",")!==(null!=n?n:"")&&this.initial()}get isFetch(){var e;return!!(null===(e=this.props.option.request)||void 0===e?void 0:e.fetchApi)}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>{var n,r;return null===(r=null===(n=this.state.tabs[t])||void 0===n?void 0:n.find((t=>t.value===e)))||void 0===r?void 0:r.text})).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const n=this.state.tabs.slice(0,1);for(let r=0;r<t.length;r++){const i=oo(e,t[r]);if(i&&Gn(i.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(null==i?void 0:i.children)&&(n[r+1]=null==i?void 0:i.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}getStreetList(e){var t;return Dn(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:i=(e=>e),dataKey:l,valueKey:a="value",textKey:o="text"}=n;if(r)try{const n=yield r(i({code:e}));if(200===n.code){const e=Array.isArray(n.data)?n.data:null!==(t=ue(n.data,l))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var i;const l=(null===(i=n.find((t=>t.value===e[r])))||void 0===i?void 0:i.text)||`${un("qm.form.selectPlaceholder").replace("...","")}(${un("qm.form.regionSelectLabel")[r]})`;return t.createElement(Pl.TabPane,{key:r.toString(),tab:l},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:Pe({"region-box__item":!0,actived:e.includes(n.value.toString())}),title:n.text,onClick:()=>{let{values:e}=this.state;e[r]=n.value.toString(),e=e.slice(0,r+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(r+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(r+1)}))}},n.text)))))}));return n.length?t.createElement(Pl,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(tl,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=un("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=lr("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,p=t.createElement("div",{className:"container"},this.renderTabs());let f=this.prevText;if(!n){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(f=e,this.prevText=f)}return t.createElement(on.Consumer,null,(r=>{const l={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(To,{value:f,bordered:s}):t.createElement(od,{action:u?[]:["click"],popupVisible:!u&&n,popup:p,popupClassName:Pe(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ga,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:Object.assign({width:"100%"},a),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&Bn((()=>this.initial()))}})))}))}}Zh.contextType=Hl;class Jh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Zh,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Jh.contextType=Hl;const ep=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:h,draggable:p,editable:f,batchDownload:g,fileDirection:v,onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w}=a,{action:C,headers:S,params:N,withCredentials:T=!1,dataKey:I="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:A}=o,P="function"==typeof k?k():k||{},{t:_}=Mn();return t.createElement(Tl,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:T,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:m,fileSize:h,draggable:p,editable:f,batchDownload:g,fileDirection:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(je,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in P)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[P[i]])||"";return e.response&&200!==n.code&&R.error(n.message||_("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(I?ue(n.data,I):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(e)},onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w})};class tp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ep,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}tp.contextType=Hl;const np=t.forwardRef(((e,n)=>{const r=mn({src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0},e),{className:i,style:l,src:a,alt:o,imgStyle:s}=r,c=_n(r,["className","style","src","alt","imgStyle"]),d=t.useRef(null),u=t.useRef(null);t.useEffect((()=>{const e={};for(const t in c)void 0!==r[t]&&(e[t]=r[t]);return u.current=new ln(d.current,e),()=>{y(),u.current=null}}),[]);const m=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.reset()},h=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},p=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.crop()},f=(e,t=!1)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.replace(e,t)},g=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.enable()},v=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.disable()},y=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.destroy()},b=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.move(e,t)},x=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.moveTo(e,t)},E=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoom(e)},w=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},C=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotate(e)},S=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotateTo(e)},N=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleX(e)},T=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleY(e)},I=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.scale(e,t)},R=(e=!1)=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getData(e)},O=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setData(e)},k=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getContainerData()},L=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getImageData()},A=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCanvasData()},P=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCanvasData(e)},_=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},F=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},D=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},M=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},H=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setDragMode(e)};t.useImperativeHandle(n,(()=>({reset:m,clear:h,initCrop:p,replace:f,enable:g,disable:v,destroy:y,move:b,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:_,setCropBoxData:F,getCroppedCanvas:D,setAspectRatio:M,setDragMode:H})));const $={[lr("cropper")]:!0};return t.createElement("div",{className:Pe($,i),style:l},t.createElement("img",{ref:d,src:a,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));np.displayName="Cropper";const rp=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:l,beforeCrop:a,className:o}=e,{t:s}=Mn(),c=t.useRef(null),d=t.useRef(),u=t.useRef(),m=t.useRef(),h=t.useRef(),[p,f]=t.useState(""),g=e=>{c.current.relativeZoom(e)},v=e=>{c.current.rotate(e)},y=()=>{f("")},b=lr("cropper-preview");return t.createElement(t.Fragment,null,(()=>{const n=Array.isArray(e.children)?e.children[0]:e.children;if(!n)return null;const r=n.props,{beforeUpload:i}=r,l=_n(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},l),{beforeUpload:(e,t)=>new Promise(((n,r)=>Dn(void 0,void 0,void 0,(function*(){const r=()=>n(I.LIST_IGNORE);if(a&&!(yield a(e,t)))return void r();u.current=e,m.current=n,h.current=r;const i=new FileReader;i.onload=()=>{f(i.result),i.onload=null},i.readAsDataURL(e)}))))}))})(),p&&t.createElement(A,{open:!0,wrapClassName:Pe(b,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{Dn(void 0,void 0,void 0,(function*(){const{type:e,name:t,uid:r}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((i=>Dn(void 0,void 0,void 0,(function*(){let l=new File([i],t,{type:e});if(Object.assign(l,{uid:r}),n.length&&!n.includes(l.name.slice(l.name.lastIndexOf(".")+1).toLowerCase()))return R.warning(s("qm.upload.tooltip",{type:n.join(",")})),h.current("file type is error");if("function"!=typeof d.current)return m.current(l);const a=d.current(l,[l]);if("boolean"==typeof a||a){if(!0===a)return m.current(l);if(!1===a)return h.current("not upload");if(a&&"function"==typeof a.then)try{const e=yield a,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(l=e),m.current(l)}catch(e){h.current(e)}}else tr("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,l),yield Wn(100),y()}))},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:i?`calc(380px * ${i[1]/i[0]})`:"auto"};return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(np,{ref:c,aspectRatio:i?i[0]/i[1]:i,src:p,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(S,{size:"small"},t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(It,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Rt,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Ot,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(kt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},ip=e=>{const n=mn({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:i=!0,fixedSize:l,quality:a=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:h,popupClassName:p,beforeCrop:f,onSortChange:g,onChange:v}=n,{t:y}=Mn(),{$size:b}=$n(n),x=t.useRef(null),E=t.useRef(null),w=t.useRef(!1),[C,S]=t.useState(!1),[N,T]=t.useState(0),O=t.useMemo((()=>u||m),[u,m]),k=t.useMemo((()=>!c||r.length<c),[r,c]);t.useEffect((()=>(A(),document.addEventListener("paste",_),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",_)})),[]),Hi((()=>{k||(w.current=!1)}),[r]);const L=Hn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[i]=e.splice(t,1);e.splice(n,0,i),null==g||g(e),null==v||v({file:r[t],fileList:e})}})),A=()=>{d&&(E.current=jt.create(Ui(x.current,lr("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:L}))},P=(e,t)=>new Promise(((r,i)=>Dn(void 0,void 0,void 0,(function*(){const{fileTypes:l=[],fileSize:a,beforeUpload:o}=n,s=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!a||e.size/1024/1024<a,d=s&&c;if(s||R.warning(y("qm.upload.tooltip",{type:l.join(",")})),c||R.warning(y("qm.upload.sizeLimit",{size:a})),!d)return I.LIST_IGNORE;if(o){const n=o(e,t);if(!0===n)return r(e);if(!1===n)return i("not upload");if(n&&"function"==typeof n.then)try{const e=yield n;r(e)}catch(e){i(e)}}else r(e)})))),_=Hn((e=>Dn(void 0,void 0,void 0,(function*(){const{action:t,data:i,headers:l}=n;if(w.current&&k&&t)for(const n of e.clipboardData.items)if("file"===n.kind&&n.type.startsWith("image/")){const e=n.getAsFile(),a=Date.now(),o=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${a}`});try{yield P(o,[...r,o]);const e=new FormData;if(e.append("file",o),i)for(const t in i)e.append(t,i[t]);const n="string"==typeof t?t:yield t(o),a=yield fetch(n,{method:"POST",body:e,headers:l});if(!a.ok)throw new Error(y("qm.upload.uploadError"));const s=yield a.json();null==v||v({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})))),F=lr("upload-img"),D={[F]:!0,[`${F}--lg`]:"large"===b,[`${F}--sm`]:"small"===b},M=t.createElement(I,Rn({className:Pe(D,h)},Xn(n,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:P,disabled:O,onPreview:e=>{const t=r.findIndex((t=>t.url===e.url));t<0||(T(t),S(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,n,r,i)=>t.createElement("div",{className:Pe("upload-item",{handle:d})},e,!O&&t.createElement(it,{title:y("qm.upload.remove"),className:"icon",onClick:()=>i.remove()}))}),t.createElement("span",{className:"inner",ref:x},k&&!(m&&r.length)&&t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(Lt,null)),t.createElement("p",{className:"ant-upload-text"},y("qm.uploadCropper.dragableText")),t.createElement("button",{className:Pe("ant-upload-button",{disabled:O}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,i?t.createElement(rp,{className:p,fixedSize:l,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},M):M,t.createElement("div",{style:{display:"none"}},t.createElement(Q.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:N,rootClassName:p,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(Q,{key:e.uid||n,src:e.url,alt:""}))))))};ip.displayName="QmUploadImg";const lp=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:h,openCropper:p,fileTypes:f,fileSize:g,draggable:v,onRemove:y,onSortChange:b}=a,{action:x,headers:E,params:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=Mn();return t.createElement(ip,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:u,fixedSize:m,quality:h,openCropper:p,fileTypes:f,fileSize:g,draggable:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in O)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[O[i]])||"";return e.response&&200!==n.code&&R.error(n.message||k("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(S?ue(n.data,S):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(e)},onRemove:y,onSortChange:b})};class ap extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(lp,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ap.contextType=Hl;const op={onActivate:Bt.func,onAddUndo:Bt.func,onBeforeAddUndo:Bt.func,onBeforeExecCommand:Bt.func,onBeforeGetContent:Bt.func,onBeforeRenderUI:Bt.func,onBeforeSetContent:Bt.func,onBeforePaste:Bt.func,onBlur:Bt.func,onChange:Bt.func,onClearUndos:Bt.func,onClick:Bt.func,onContextMenu:Bt.func,onCommentChange:Bt.func,onCopy:Bt.func,onCut:Bt.func,onDblclick:Bt.func,onDeactivate:Bt.func,onDirty:Bt.func,onDrag:Bt.func,onDragDrop:Bt.func,onDragEnd:Bt.func,onDragGesture:Bt.func,onDragOver:Bt.func,onDrop:Bt.func,onExecCommand:Bt.func,onFocus:Bt.func,onFocusIn:Bt.func,onFocusOut:Bt.func,onGetContent:Bt.func,onHide:Bt.func,onInit:Bt.func,onKeyDown:Bt.func,onKeyPress:Bt.func,onKeyUp:Bt.func,onLoadContent:Bt.func,onMouseDown:Bt.func,onMouseEnter:Bt.func,onMouseLeave:Bt.func,onMouseMove:Bt.func,onMouseOut:Bt.func,onMouseOver:Bt.func,onMouseUp:Bt.func,onNodeChange:Bt.func,onObjectResizeStart:Bt.func,onObjectResized:Bt.func,onObjectSelected:Bt.func,onPaste:Bt.func,onPostProcess:Bt.func,onPostRender:Bt.func,onPreProcess:Bt.func,onProgressState:Bt.func,onRedo:Bt.func,onRemove:Bt.func,onReset:Bt.func,onSaveContent:Bt.func,onSelectionChange:Bt.func,onSetAttrib:Bt.func,onSetContent:Bt.func,onShow:Bt.func,onSubmit:Bt.func,onUndo:Bt.func,onVisualAid:Bt.func,onSkinLoadError:Bt.func,onThemeLoadError:Bt.func,onModelLoadError:Bt.func,onPluginLoadError:Bt.func,onIconsLoadError:Bt.func,onLanguageLoadError:Bt.func},sp=Object.assign({apiKey:Bt.string,id:Bt.string,inline:Bt.bool,init:Bt.object,initialValue:Bt.string,onEditorChange:Bt.func,value:Bt.string,tagName:Bt.string,cloudChannel:Bt.string,plugins:Bt.oneOfType([Bt.string,Bt.array]),toolbar:Bt.oneOfType([Bt.string,Bt.array]),disabled:Bt.bool,textareaName:Bt.string,tinymceScriptSrc:Bt.string,rollback:Bt.oneOfType([Bt.number,Bt.oneOf([!1])]),scriptLoading:Bt.shape({async:Bt.bool,defer:Bt.bool,delay:Bt.number})},op),cp=e=>"function"==typeof e,dp=e=>e in op,up=e=>e.substr(2),mp=(e,t,n,r,i)=>((e,t,n,r,i,l,a)=>{const o=Object.keys(i).filter(dp),s=Object.keys(l).filter(dp),c=o.filter((e=>void 0===l[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=up(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const i=r(e,n),l=up(n);a[l]=i,t(l,i)}))})(i,e.on.bind(e),e.off.bind(e),((t,n)=>r=>{var i;return null===(i=t(n))||void 0===i?void 0:i(r,e)}),t,n,r);let hp=0;const pp=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return hp++,e+"_"+n+hp+String(t)},fp=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),gp=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),vp=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},yp=()=>({listeners:[],scriptId:pp("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),bp=(()=>{let e=yp();return{load:(t,n,r,i,l,a)=>{const o=()=>((e,t,n,r,i,l)=>{const a=t.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=e,a.src=n,a.async=r,a.defer=i;const o=()=>{a.removeEventListener("load",o),l()};a.addEventListener("load",o),t.head&&t.head.appendChild(a)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?a():(e.listeners.push(a),e.scriptLoading||(e.scriptLoading=!0,l>0?setTimeout(o,l):o()))},reinitialize:()=>{e=yp()}}})(),xp=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Ep extends e.Component{constructor(t){var n,r,i;super(t),this.rollbackTimer=void 0,this.valueCursor=void 0,this.rollbackChange=()=>{const e=this.editor,t=this.props.value;e&&t&&t!==this.currentContent&&e.undoManager.ignore((()=>{if(e.setContent(t),this.valueCursor&&(!this.inline||e.hasFocus()))try{e.selection.moveToBookmark(this.valueCursor)}catch(e){}})),this.rollbackTimer=void 0},this.handleBeforeInput=e=>{if(void 0!==this.props.value&&this.props.value===this.currentContent&&this.editor&&(!this.inline||this.editor.hasFocus()))try{this.valueCursor=this.editor.selection.getBookmark(3)}catch(e){}},this.handleBeforeInputSpecial=e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)},this.handleEditorChange=e=>{const t=this.editor;if(t&&t.initialized){const e=t.getContent();void 0!==this.props.value&&this.props.value!==e&&!1!==this.props.rollback&&(this.rollbackTimer||(this.rollbackTimer=window.setTimeout(this.rollbackChange,"number"==typeof this.props.rollback?this.props.rollback:200))),e!==this.currentContent&&(this.currentContent=e,"function"==typeof this.props.onEditorChange&&this.props.onEditorChange(e,t))}},this.handleEditorChangeSpecial=e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)},this.initialise=(e=0)=>{var t,n,r;const i=this.elementRef.current;if(!i)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,n=e.parentNode;for(;null!=n;)t=n,n=t.parentNode;return t===e.ownerDocument}return e.isConnected})(i)){if(0===e)setTimeout((()=>this.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>this.initialise(e+1)),100)}return}const l=xp(this.view);if(!l)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},this.props.init),{selector:void 0,target:i,readonly:this.props.disabled,inline:this.inline,plugins:(o=null===(t=this.props.init)||void 0===t?void 0:t.plugins,s=this.props.plugins,gp(o).concat(gp(s))),toolbar:null!==(n=this.props.toolbar)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!fp(i)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&cp(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{var t,n;const r=this.getInitialValue();this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:e.getContent(),this.currentContent!==r&&(this.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const i=null!==(n=this.props.disabled)&&void 0!==n&&n;vp(this.editor,i?"readonly":"design"),this.props.init&&cp(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(i.style.visibility=""),fp(i)&&(i.value=this.getInitialValue()),l.init(a)},this.id=this.props.id||pp("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(i=null!==(n=this.props.inline)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.inline)&&void 0!==i&&i,this.boundHandlers={}}get view(){var e,t;return null!==(t=null===(e=this.elementRef.current)||void 0===e?void 0:e.ownerDocument.defaultView)&&void 0!==t?t:window}componentDidUpdate(e){var t,n;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const n=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const r of[t,n])if(r)try{e.selection.moveToBookmark(r),this.valueCursor=r;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=null!==(n=this.props.disabled)&&void 0!==n&&n;vp(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,l;null!==xp(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&bp.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),null!==(t=null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)&&void 0!==t&&t,null!==(r=null===(n=this.props.scriptLoading)||void 0===n?void 0:n.defer)&&void 0!==r&&r,null!==(l=null===(i=this.props.scriptLoading)||void 0===i?void 0:i.delay)&&void 0!==l?l:0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){var e,t,n;return(null===(n=null===(t=null===(e=xp(this.view))||void 0===e?void 0:e.Env)||void 0===t?void 0:t.browser)||void 0===n?void 0:n.isIE())?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){mp(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,n=t(e),r=t(this.props);!n&&r?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):n&&!r&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}var wp;Ep.propTypes=sp,Ep.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(wp||(wp={}));const Cp=e=>{var n;const{className:r,style:i,tinymce:l={},upload:a={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:h}=t.useContext(on),{$size:p}=$n(e),{$locale:f,t:g}=Mn(),v=400,y="preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",b="file edit view insert format tools table help",x="undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",E=Object.assign(Object.assign({height:l.height||v,plugins:l.plugins||y,toolbar:l.toolbar||x,menubar:l.menubar||b,font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:wp[f],skin:"tinymce-5"},Xn(l,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>{const{action:t,headers:n,dataKey:r,customHandler:i}=a;return i?i(e):new Promise(((i,l)=>Dn(void 0,void 0,void 0,(function*(){const a=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(t&&c/1024/1024>o)try{const e=yield fetch(t,{method:"POST",body:s,headers:n});if(!e.ok)throw l(""),new Error(g("qm.upload.uploadError"));const a=yield e.json();if(200===a.code){const e=r?ue(a.data,r):a.data;i(e)}}catch(e){R.error(g("qm.uploadCropper.uploadError"))}else i(a)}))))},setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),w=lr("tinymce"),C={[w]:!0,[`${w}--lg`]:"large"===p,[`${w}--sm`]:"small"===p},S={init:E,value:d,disabled:c,tinymceScriptSrc:s||(null===(n=null==h?void 0:h.tinymce)||void 0===n?void 0:n.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==m||m(t.getContent(),t)}};return t.createElement("div",{className:Pe(C,r),style:i},t.createElement(Ep,S))};Cp.displayName="QmTinymce";const Sp=e=>{const{$$form:n}=t.useContext(Hl),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:h}=a;return t.createElement(Cp,{value:r,tinymce:u,upload:o,thresholdSize:m,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{null==i||i(e),l(e)})(e)}})};class Np extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Sp,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(F,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Np.contextType=Hl;class Tp extends d{constructor(e){var n;super(e),this.provide={$$form:this,echo_data:{}},this._fieldAuth={},this.wrapperRef=t.createRef(),this.formRef=t.createRef(),this.originItems=[],this.state={formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:null!==(n=this.props.cols)&&void 0!==n?n:4,collapse:!!this.props.defaultExpand},this.resizeObserveHandler=()=>{var e;const t=null===(e=this.wrapperRef.current)||void 0===e?void 0:e.offsetWidth;if(void 0===t||0===t||this.props.cols>0)return;let n=Math.floor(t/300);n=24%n==0?n:n-1,n=n<1?1:n,n=n>8?8:n,n!==this.state.flexCols&&this.setState({flexCols:n})},this.resizeListenerHandle=Le(this.resizeObserveHandler,10),this.getFormItems=Wt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=Wt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{ae(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t})),this.valuesChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onValuesChange)||void 0===r||r.call(n,e,this._initialValues)},this.fieldsChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onFieldsChange)||void 0===r||r.call(n,e,t)},this.finishHandle=e=>{var t,n;null===(n=(t=this.props).onFinish)||void 0===n||n.call(t,Object.assign({},this.get_fields_other(),this.formatFormValue(e)))},this.finishFailedHandle=({values:e,errorFields:t})=>{var n,r;null===(r=(n=this.props).onFinishFailed)||void 0===r||r.call(n,t)},this.openValidateInfo=e=>{const n=t.createElement("ul",null,e.map((e=>{const{label:n}=this.formItems.find((t=>t.fieldName===e.name[0]));return t.createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof n?`${n}: `:"")+e.errors.join(","),"]")})));Z.error({message:un("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Vt(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})},this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){var e,t;return null!==(t=null!==(e=this.props.size)&&void 0!==e?e:this.context.size)&&void 0!==t?t:""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){var e;const t=this.context.global;return null!==(e=this.props.compactMode)&&void 0!==e?e:"small"===this.$size&&!!(null==t?void 0:t.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){al(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){ol(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&tr("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(e=[]){return e.some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>ae(e.extra))).forEach((n=>{var r;t[n.fieldName]=null!==(r=e[n.fieldName])&&void 0!==r?r:""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>ae(e.collapse))).forEach((t=>{var n;e[t.fieldName]=null!==(n=t.collapse.defaultExpand)&&void 0!==n&&n})),Object.assign({},e)}getInitialValue(e,t){var n;const{type:r,options:i}=e;return t=null!=t?t:void 0,Ua.includes(r)&&(t=null!=t?t:[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=null!==(n=null!=t?t:null==i?void 0:i.falseValue)&&void 0!==n?n:Wa),t}createFormValue(e){const t={};return this.flattenItems.forEach((n=>{t[n.fieldName]=this.getInitialValue(n,e[n.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}createOriginItems(){this.originItems=Qn(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.viewData,{[e]:t})})))}getViewValue(e){var t;return null!==(t=this.state.viewData[e])&&void 0!==t?t:""}setExpandHandle(e){e!==this.state.collapse&&this.setState({collapse:e},(()=>{var t,n;return null===(n=(t=this.props).onCollapse)||void 0===n?void 0:n.call(t,e)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:n}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!n||setTimeout((()=>this.CREATE_FOCUS(n)))}getFormItemLabel(e){var t,n,r,i,l;if(co(e))return uo(e);if(ae(e)){const{fieldName:a,label:o,options:s={}}=e;if(co(o))return uo(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([a])[a])&&void 0!==n?n:this._initialValues[a])&&void 0!==r?r:null===(i=c[0])||void 0===i?void 0:i.value;return(null===(l=c.find((e=>e.value===d)))||void 0===l?void 0:l.text)||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){var n,r;if("DIVIDER"===e)return!0;const i=this.getBlockDerivedItems();for(let e=0,l=i.length;e<l;e++){const l=i[e],a=this.dividers.find((e=>e.fieldName===l[0].fieldName)),o=null!==(r=null===(n=null==a?void 0:a.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:l.length-1;for(let e=1;e<l.length;e++){if(l[e].fieldName===t&&e>o)return this.state.expand[l[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(no(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{no(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[l,a]=r.split("|");e[l]=null!==(t=i[0])&&void 0!==t?t:"",e[a]=null!==(n=i[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)Gn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return Dn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=Xn(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:l}=r.fetch;try{const r=yield t(n);200===r.code&&(i=null!==(e=l?ue(r.data,l):r.data)&&void 0!==e?e:{})}catch(e){}}if(Array.isArray(i.fieldList)){const e=this.props.items.map((e=>{const{fieldName:t}=e,n=i.fieldList.find((e=>e.dataIndex===t));if(n){const r=this.originItems.find((e=>e.fieldName===t)),{visible:i=1,disabled:l,secretName:a}=n;i||(e.noAuth=!0,r.noAuth=!0),l&&(e.disabled=!0,r.disabled=!0),a&&(e.options?e.options.secretType=a:e.options={secretType:a},r.options=Object.assign({},r.options,{secretType:a})),this.setFieldAuth(t,{visible:i,disabled:l,secretName:a})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(_o,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(Do,{option:e})}INPUT_NUMBER(e){return t.createElement(Ho,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(qo,{option:e})}SEARCH_HELPER(e){return t.createElement(Xm,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(Jm,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(ah,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(sh,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(ph,{option:e})}CHECKBOX(e){return t.createElement(Lo,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(gh,{option:e})}RATE(e){return t.createElement(yh,{option:e})}RADIO(e){return t.createElement(xh,{option:e})}SWITCH(e){return t.createElement(wh,{option:e})}TEXT_AREA(e){return t.createElement(Sh,{option:e})}DATE(e){return t.createElement(Th,{option:e})}RANGE_DATE(e){return t.createElement(Oh,{option:e})}TIME(e){return t.createElement(Lh,{option:e})}RANGE_TIME(e){return t.createElement(Ph,{option:e})}SELECT(e){return t.createElement(Oo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(Oo,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Fh,{option:e})}DIVIDER(e){return t.createElement(Dh,{option:e})}TREE_SELECT(e){return t.createElement($h,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement($h,{option:e,multiple:!0})}CASCADER(e){return t.createElement(jh,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(jh,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(Xh,{option:e})}REGION_SELECT(e){return t.createElement(Jh,{option:e})}UPLOAD_FILE(e){return t.createElement(tp,{option:e})}UPLOAD_IMG(e){return t.createElement(ap,{option:e})}TINYMCE(e){return t.createElement(Np,{option:e})}renderFormLabel(e){if(co(e)||!ae(e))return e;const{type:n,fieldName:r,label:i,options:l={},onChange:a=Vn}=e,{itemList:o=[]}=l;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(Ro,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{style:{paddingRight:5}},i),t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(ko,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:l}=e,{extra:a}=this.state;if(r)return t.createElement(w,{className:"extra-tooltip",title:a[n]},t.createElement(At,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:l?"":a[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},l?l(o,this):a[n]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:n,fieldName:r,invisible:i,tooltip:l,className:a,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return t.createElement(P.Item,{label:this.renderFormLabel(n),name:r,rules:c,tooltip:l,hidden:i,className:Pe(a),style:Object.assign({width:"100%"},d),labelCol:{flex:this.verticalLayout?"initial":Zn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):t.createElement(t.Fragment,null))}createFormItem(e){return se(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(tr("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:i}=this.props,l=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)l.push({});l.push(e);for(let e=0;e<n;e++)l.push({})}));const a=24/e,o=[],s=l.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=l.map(((n,r)=>{let{selfCol:i=1}=n;const{type:l,fieldName:s}=n;i=i>=24||"DIVIDER"===l||"TINYMCE"===l?e:i;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[r]),t.createElement(F,{key:null!=s?s:r,className:s,span:i*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},l?this.createFormItem(Qn(n)):null)}));return i&&"default"===n&&u.push(t.createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:n,collapse:r}=this.state,{searchButtonCols:i,isSearchBtn:l,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=i||1,c=n-e%n-s;return l?t.createElement(F,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(S,{style:{marginBottom:12}},t.createElement(nr,{type:"primary",size:this.$size,icon:t.createElement(Nt,null),onClick:()=>this.SUBMIT_FORM()},un("qm.form.search")),t.createElement(nr,{size:this.$size,icon:t.createElement(Ge,null),onClick:()=>this.RESET_FORM()},un("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(_e,null):t.createElement(Fe,null)," ",un(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:n,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const i=24/e;return r&&"default"===n?t.createElement(_,{gutter:0},t.createElement(F,{key:"-",span:i},t.createElement(P.Item,null,t.createElement(S,{style:{marginBottom:12}},t.createElement(nr,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},un("qm.form.save")),t.createElement(nr,{size:this.$size,onClick:()=>this.RESET_FORM()},un("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(Ao,{uniqueKey:e,items:n,fieldsChange:r})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){const[n,r]=yield this.VALIDATE_FIELDS(),i=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>{var t;return null===(t=this[`${e.fieldName}_Ref`])||void 0===t?void 0:t.searchRef._is_change})).map((e=>({name:[e.fieldName],errors:[un("qm.form.searchHelperTips")],warnings:[]})));n||i.length?t((n||[]).concat(i)):e(r)}))))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}GET_FORM_DATA(){return Dn(this,void 0,void 0,(function*(){try{const e=yield this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}))}VALIDATE_FIELDS(e){return Dn(this,void 0,void 0,(function*(){try{return[null,yield this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}))}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}SUBMIT_FORM(){return Dn(this,void 0,void 0,(function*(){try{yield this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}))}RESET_FORM(){var e,t;const n=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),r=this.flattenItems.map((e=>e.fieldName)).filter((e=>!n.includes(e)));r.length&&this.formRef.current.resetFields(r),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),i={};return r.forEach((e=>i[e]=void 0)),{other:Object.assign({},this._initialOthers,i)}})),this.setState({extra:Object.assign({},this._initialExtras)}),null===(t=(e=this.props).onReset)||void 0===t||t.call(e)}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){tr("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:i}=this.props,l=r.find((t=>t.fieldName===e));if(!l)return tr("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!ae(t))return tr("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(l.noAuth)return tr("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||pe(l,n,t[n]));n&&(i?i([...r]):tr("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:l,labelAlign:a,labelWrap:o,customClass:s}=this.props,c=lr("form"),d={required:"${label}"+un("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t.createElement("div",{ref:this.wrapperRef,className:Pe(u,e),style:n},t.createElement(P,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:a,labelWrap:o,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Zn(l)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Hl.Provider,{value:this.provide},t.createElement(_,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Tp.contextType=on,Tp.propTypes=Za,Tp.defaultProps=Ja;const Ip=e=>null!=e;function Rp(e,n,r,i){const[l,a]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[o,s]=t.useState(null),c=()=>{if(l){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:l,left:a}=e.getBoundingClientRect();return r>=0&&a>=0&&i<=t&&l<=n})(l)&&n&&l.scrollIntoView(i);const{left:e,top:t,width:r,height:a}=l.getBoundingClientRect(),o={left:e,top:t,width:r,height:a,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[l,n]),ms({handler:c});return[t.useMemo((()=>{if(!o)return o;const e=(null==r?void 0:r.offset)||6,t=(null==r?void 0:r.radius)||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,r]),l]}const Op={fill:"transparent",pointerEvents:"auto"},kp=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:l,style:a={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${ts()}`,m="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(tn,{open:s,autoLock:!0},t.createElement("div",{className:Pe(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},a)},l?t.createElement("svg",{style:{width:"100%",height:"100%"}},t.createElement("defs",null,t.createElement("mask",{id:u},t.createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),i&&t.createElement("rect",{x:i.left,y:i.top,rx:i.radius,width:i.width,height:i.height,fill:"black",className:m?`${n}-placeholder-animated`:""}))),t.createElement("rect",Rn({},i?null:Op,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",Rn({},Op,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",Rn({},Op,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",Rn({},Op,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",Rn({},Op,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},Lp=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:l,onPlay:a}=e,[o,s]=os(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=Hn((e=>{m(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=Kt(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!o),o?null==l||l():null==a||a())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,i=window.innerWidth,l=window.innerHeight,a=e.clientX-Bi(t).x,o=e.clientY-Bi(t).y;return document.onmousemove=e=>{let s=e.clientX-a,c=e.clientY-o;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>l-r-1&&(c=l-r-1),Vi(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},o?t.createElement(Pt,null):t.createElement(yt,null))},Ap=e=>{const{prefixCls:n,current:r,total:i=0,cover:l,title:a,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:h,onFinish:p,className:f,indicatorsRender:g}=e,{t:v}=Mn(),y="primary"!==c?"primary":"default",b=Hn((e=>{C(e),40===e.keyCode&&(r<i-1?null==h||h():null==p||p()),38===e.keyCode&&r>0&&(null==m||m())}));t.useEffect((()=>{const e=Kt(document,"keyup",b);return()=>e.remove()}),[]);const x=Ip(l)?t.createElement("div",{className:`${n}-cover`},l):null,E=Ip(o)?t.createElement("div",{className:`${n}-description`},o):null;let w;w=g?g(r,i):[...Array.from({length:i}).keys()].map(((e,i)=>t.createElement("span",{key:e,className:Pe(i===r&&`${n}-indicator-active`,`${n}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:Pe(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(it,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(V,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(_t,{className:Pe(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},a)),E,t.createElement("div",{className:`${n}-footer`},i>1&&t.createElement("div",{className:`${n}-indicators`},w),t.createElement(ir,{className:`${n}-buttons`},0!==r?t.createElement(nr,{className:`${n}-prev-btn`,size:"small",onMouseDown:C,onClick:m},v("qm.tour.prevStep")):null,r===i-1?t.createElement(nr,{className:`${n}-finish-btn`,type:y,size:"small",onClick:p},v("qm.tour.finish")):t.createElement(nr,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:h},v("qm.tour.nextStep"))))))},Pp=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(Ap,e))},_p={left:"50%",top:"50%",width:1,height:1},Fp=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:l,onChange:a,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:h=!0,overlayClassName:p,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0}=e,S=_n(e,["steps","defaultCurrent","current","onChange","onClose","onFinish","open","type","mask","arrow","control","overlayClassName","overlayStyle","placement","helper","zIndex","renderPanel","indicatorsRender","gap","animated","scrollIntoViewOptions"]),N=t.useRef(),[T,I]=os(0,{value:l,defaultValue:i}),[R,O]=os(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=os(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),_=t.useRef(R);t.useLayoutEffect((()=>{R&&!_.current&&I(0),_.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:F,type:D,placement:M,trigger:H,delay:$,style:q,arrow:j,className:K,mask:V,scrollIntoViewOptions:z,zIndex:W,action:B}=r[T]||{},U=W||k,G=D||d,Y=R&&(null!=V?V:u),X=null!=z?z:C,[Q,Z]=Rp(F,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Z,g,M),ee=!!Z&&(void 0===j?m:j),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),Hi((()=>{R&&(ie(),null==B||B(Z,T))}),[R,Z]);const ne=e=>{I(e),null==a||a(e)},re=()=>{O(!1),null==o||o(T)},ie=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===Ki(r=n,"display")||"hidden"===Ki(r,"visibility")||"0"===Ki(r,"opacity"))||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const le=()=>Dn(void 0,void 0,void 0,(function*(){if(!H||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[i,l]=[e+n/2,t+r/2],a=new MouseEvent(H,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:l}),o=document.elementFromPoint(i,l);o&&(o.dispatchEvent(a),yield Wn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=lr("tour"),de=[{[`${ce}-primary`]:"primary"===G},p,K],ue=Xd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(kp,{zIndex:U,prefixCls:ce,pos:Q,showMask:ae,style:null==oe?void 0:oe.style,fill:null==oe?void 0:oe.color,open:A,animated:w,rootClassName:p}),t.createElement(tn,{open:A,autoLock:!0},t.createElement(Zt,Rn({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:Pe(de),prefixCls:ce,popup:()=>t.createElement(Pp,Rn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>Dn(void 0,void 0,void 0,(function*(){yield le(),ne(T-1)})),onNext:()=>Dn(void 0,void 0,void 0,(function*(){yield le(),ne(T+1)})),onClose:re,current:T,onFinish:()=>{re(),null==s||s()}},Object.assign({},r[T],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),t.createElement("div",{className:Pe(p,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Q||_p),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(tn,{open:R},t.createElement(Lp,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));Fp.displayName="QmTour";var Dp={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Mp=n(void 0);var Hp=null;function $p(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),n=e.match(/MSIE\D?\d+/i),r=e.match(/OPR\D?\d+/i),i=e.match(/Firefox\D?\d+/i),l=e.match(/x64/i);if(!t&&!n&&l)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||l)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var a=e.match(/Chrome\D?\d+/i);if(a&&(a=a[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function qp(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if($p()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void R.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else{i&&r.match(/x64/i);if(e||t?n=i?e:t:Hp?n=Hp:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),i?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Hp=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&$p(),n}catch(e){R.error("getLodop 出错:"+e)}}$p();const jp=e=>{const t=e/25.4*(()=>{var e;const t=[],{deviceXDPI:n,deviceYDPI:r}=window.screen;if(n&&r)t[0]=n,t[1]=r;else{let n=document.createElement("DIV");n.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(n),t[0]=parseInt(n.offsetWidth.toString()),t[1]=parseInt(n.offsetHeight.toString()),null===(e=n.parentNode)||void 0===e||e.removeChild(n),n=null}return t})()[0];return Math.ceil(t)},Kp=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:l}=t.useContext(on),{$$preview:a}=t.useContext(Mp),{state:o,isWindowsPrinter:s,pageSize:c}=a,d=t.useRef(null),u=t.useRef({}),m=t.useRef([]),h=t.useRef([]),p=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:L,createPrintHtml:k,SHOW_PREVIEW:A,DIRECT_PRINT:P}))),Hi((()=>{R()}),[o.form.printerType,o.form.setting.direction,o.form.setting.distance,o.form.setting.fixedLogo]),t.useEffect((()=>{u.current.templateEl=d.current.querySelector(".origin-template").children[0],u.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Dp.defaultDistance+10*Dp.defaultDistance:0;return("vertical"===e?c[0]:c[1])-t}),[o,s,c]),y=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Dp.defaultDistance+10*Dp.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return jp(v-10*(e.left-Dp.defaultDistance)-10*(e.right-Dp.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return jp(y-10*(e.top-Dp.defaultDistance)-10*(e.bottom-Dp.defaultDistance))}),[o,y]),E=o.form.scale,w=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:jp(10*e.left),right:jp(10*e.right),top:jp(10*e.top),bottom:jp(10*e.bottom)}}),[o]),C=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:i}=w,l=b+t+n,a=Dp.previewWidth-l<=0?0:(Dp.previewWidth-l)/2,s=Math.abs((1-E)*l/2);let c=0;return E>1&&(c=s>a?-1*a:-1*s),E<1&&(c=l-2*s>Dp.previewWidth?0:a>0?s:(Dp.previewWidth-(l-2*s))/2),{width:`${b}px`,height:""+("stylus"===e?"auto":x+"px"),paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${i}px`,transform:`translateX(${c}px) scale(${E})`,opacity:f?0:1}}),[o,f,w,E,x,b]);m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const S=()=>{var e,t,n,r;const i=null!==(t=null===(e=null==l?void 0:l.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",a=null!==(r=null===(n=null==l?void 0:l.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Dp.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',i?`<img src="${i}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',a?`<img src="${a}" border="0" height="46" />`:"","</td>","</tr>"].join("")},N=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},T=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=u.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},I=()=>{const e=u.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const i=e[r].clientHeight;e[r].style.height=i+"px",n.push(i),t.push(e[r].outerHTML)}h.current=n,m.current=t},R=()=>{var e;if(!m.current.length)return;const{form:{setting:t,printerType:n}}=o;if(i)return p.current.push([N(),S(),...m.current]);const r=t.fixedLogo?x-Dp.logoHeight:x;let l=[];if(p.current=[],"stylus"===n)p.current.push([N(),...t.fixedLogo?[S()]:[],...m.current]);else{let e=0;for(let n=0,i=h.current.length;n<i;n++){const a=m.current[n],o=h.current[n];t.fixedLogo||0!==n||(e+=Dp.logoHeight),e+=o,e<=r?l.push(a):(p.current.push([N(),...t.fixedLogo?[S()]:[],...l]),l=[],e=0,n-=1),n===i-1&&l.length&&p.current.push([N(),...t.fixedLogo?[S()]:[],...l])}}t.fixedLogo||null===(e=p.current[0])||void 0===e||e.splice(1,0,S());for(let e=0,t=p.current.length;e<t&&e!==t-1;e++)p.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:p.current.length}),O()},O=()=>{var e,t;const{currentPage:n}=o;let r=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;r+=null!==(t=null===(e=p.current[n-1])||void 0===e?void 0:e.join(""))&&void 0!==t?t:"",r+="</table>",u.current.previewEl.innerHTML=r,u.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;if(void 0!==e){t+=[...p.current[e-1]].join("")}else for(let e=0;e<p.current.length;e++)t+=p.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+S()+N()+e.join("")+"</table>"},A=()=>Dn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();u.current.previewEl.innerHTML||(T(),yield Wn(0),I(),R(),g(!1))})),P=()=>Dn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();T(),yield Wn(0),I(),R(),g(!1),a.doPrint(k()),yield Wn(0),a.doClose()})),_=()=>{tr("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},F={[lr("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:Pe(F)},t.createElement(nl,{wrapperClassName:"spin",spinning:f,tip:"Loading..."},t.createElement("div",{className:"preview"},t.createElement("div",{className:"origin-template",style:{width:`${b}px`,marginLeft:`-${Math.floor(b/2)}px`}},null==r?void 0:r()),t.createElement("div",{className:"workspace",style:C}))))}));Kp.displayName="Container";class Vp extends d{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:un("qm.print.setPanel.printParameter")},{type:"SELECT",label:un("qm.print.setPanel.pagerType"),fieldName:"pageSize",options:{itemList:[{text:"A2",value:"420*594"},{text:"A3",value:"420*297"},{text:"A4",value:"210*297"},{text:"A5",value:"210*148"},{text:un("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:un("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:un("qm.print.setPanel.vertical"),value:"vertical"},{text:un("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:un("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:un("qm.print.setPanel.manualDoublePrint"),value:"manual"}]},disabled:!this.props.setting.doubleSide},options:{trueValue:1,falseValue:0},onChange:e=>{const{formList:t}=this.state;t.find((e=>"doubleSide"===e.fieldName)).label.disabled=!e,this.setState({formList:t})}},{type:"CHECKBOX",label:un("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:un("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Dp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Dp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Dp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Dp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]}],this.getInitialvalue=()=>{const{setting:e}=this.props,{distance:t}=e;return Object.assign({},{disleft:t.left,disright:t.right,distop:t.top,disbottom:t.bottom,pageSize:e.pageSize,direction:e.direction,doubleSide:e.doubleSide,doubleSideType:e.doubleSideType,fixedLogo:e.fixedLogo})},this.getInitialExtra=()=>({disleft:un("qm.print.setPanel.sizeUnit"),disright:un("qm.print.setPanel.sizeUnit"),distop:un("qm.print.setPanel.sizeUnit"),disbottom:un("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>Dn(this,void 0,void 0,(function*(){const[e,t]=yield this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),this.cancelHandle=()=>{this.props.onClose()}}render(){const{formList:e}=this.state;return t.createElement(t.Fragment,null,t.createElement(Tp,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},un("qm.dialog.close")),t.createElement(nr,{type:"primary",onClick:()=>this.confirmHandle()},un("qm.dialog.confirm"))))}}Vp.contextType=on;class zp extends d{constructor(){var e,n,r;super(...arguments),this.provide={$$preview:this},this.containRef=t.createRef(),this.state={visible:!1,form:{printerName:-1,printerType:(null===(e=this.props.defaultConfig)||void 0===e?void 0:e.printerType)||"laser",copies:(null===(n=this.props.defaultConfig)||void 0===n?void 0:n.copies)||1,scale:1,setting:{distance:{left:Dp.defaultDistance,right:Dp.defaultDistance,top:Dp.defaultDistance,bottom:Dp.defaultDistance},pageSize:"210*297",direction:(null===(r=this.props.defaultConfig)||void 0===r?void 0:r.direction)||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0},this.pageChangeHandle=e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))},this.exportClickHandle=()=>{this.doExport(this.containRef.current.createExportHtml())},this.printClickHandle=()=>Dn(this,void 0,void 0,(function*(){if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e=Object.assign(Object.assign({},this.state.form),{printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text});yield Qt.setItem(this.printerKey,e),yield this.savePrintConfig(this.printerKey,e)}catch(e){}})),this.doClose=()=>{var e,t;null===(t=(e=this.props).onClose)||void 0===t||t.call(e)},this.getPrintConfig=e=>Dn(this,void 0,void 0,(function*(){const t=this.context.global,n=null==t?void 0:t.getComponentConfigApi;if(n)try{const t=yield n({key:e});if(200===t.code)return t.data}catch(e){}})),this.savePrintConfig=(e,t)=>Dn(this,void 0,void 0,(function*(){const n=this.context.global,r=null==n?void 0:n.saveComponentConfigApi;if(r)try{yield r({[e]:t})}catch(e){}})),this.createStyle=()=>'\n <style type="text/css">\n table {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n table-layout: fixed;\n }\n table tr td {\n padding: 2px;\n line-height: 1.2;\n word-wrap: break-word;\n }\n .fs12 {\n font-size: 12px;\n }\n .fs13 {\n font-size: 13px;\n }\n .fs14 {\n font-size: 14px;\n }\n .fw500 {\n font-weight: 500;\n }\n .fw700 {\n font-weight: 700;\n }\n .fl {\n float: left;\n }\n .fr {\n float: right;\n }\n .tc {\n text-align: center;\n }\n .tr {\n text-align: right;\n }\n .bor {\n border: 1px solid #000;\n }\n .bor-t {\n border-top: 1px solid #000;\n }\n .bor-b {\n border-bottom: 1px solid #000;\n }\n .bor-l {\n border-left: 1px solid #000;\n }\n .bor-r {\n border-right: 1px solid #000;\n }\n .no-bor {\n border: none !important;\n }\n </style>\n ',this.doPrint=e=>{const t=qp();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i,printerName:l,printerType:a,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Dp,{left:d,right:u,top:m,bottom:h}=i.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(l),t.SET_PRINT_COPIES(o),i.doubleSide&&("auto"===i.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===a&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===a&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==a?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(un("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=qp();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i}}=this.state;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(un("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===i.direction?1:2),t.SAVE_TO_FILE(`${h().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:un("qm.print.laserPrinter"),value:"laser"},{text:un("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=qp(),t=[{text:un("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let r=0;r<n;r++)t.push({text:e.GET_PRINTER_NAME(r),value:r})}catch(e){tr("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}componentDidMount(){var e,t;return Dn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Qt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),ae(n)&&(yield Qt.setItem(this.printerKey,n))),ae(n)&&Object.keys(n).length&&Ie(this.state.form,Object.assign(Object.assign({},n),{printerName:null!==(t=null===(e=this.printerItems.find((e=>e.text===n.printerName)))||void 0===e?void 0:e.value)&&void 0!==t?t:-1}))}catch(e){}}))}render(){const{preview:e,templateRender:n}=this.props,{visible:r,form:i,currentPage:l,totalPage:a,printPage:o}=this.state,s=lr("print-preview"),c={visible:r,title:un("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:Pe(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,un("qm.print.printer"),":",t.createElement(D,{value:i.printerName,onChange:e=>{this.setState((t=>Ie({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,un("qm.print.type"),":",t.createElement(D,{value:i.printerType,onChange:e=>{this.setState((t=>Ie({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,un("qm.print.copies"),":",t.createElement($,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>Ie({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,un("qm.print.printPage.0"),t.createElement($,{value:o,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),un("qm.print.printPage.1")),t.createElement("span",null,t.createElement(B,{size:"small",current:l,pageSize:1,total:a,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(nr,{type:"text",icon:t.createElement(Qe,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},un("qm.print.setting"))),t.createElement("span",null,t.createElement(nr,{type:"text",icon:t.createElement(je,null),className:"text-btn",onClick:()=>this.exportClickHandle()},un("qm.print.export"))),t.createElement("span",null,t.createElement(nr,{icon:t.createElement(Ye,null),type:"primary",onClick:this.printClickHandle},un("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Mp.Provider,{value:this.provide},t.createElement(Kp,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,un("qm.print.scale"),":",t.createElement(J,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>Ie({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,un("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,un("qm.print.pageNumber"),":",un("qm.print.pagination",{currentPage:l,totalPage:a}))))),t.createElement(Ml,c,t.createElement(Vp,{setting:i.setting,onChange:e=>{this.setState((t=>Ie({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Mp.Provider,{value:this.provide},t.createElement(Kp,{ref:this.containRef,templateRender:n,directPrint:!0}))}}zp.contextType=on;class Wp extends d{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>Dn(this,void 0,void 0,(function*(){var e,t;this.setState({loading:!0});try{const n=yield null===(t=(e=this.props).click)||void 0===t?void 0:t.call(e);if(this.setState({loading:!1}),"boolean"==typeof n&&!n)return;yield this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),this.createRender=()=>{const{visible:e}=this.state,{templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:a}=this.props,o={visible:e,title:un("qm.print.preview"),width:`${Dp.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return l?t.createElement(Ml,o,t.createElement(zp,s)):e?t.createElement(zp,s):null},this.DO_PRINT=()=>Dn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield Wn(0),this.setState({visible:!0}),yield Wn(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:n,icon:r,type:i,disabled:l,shape:a}=this.props,o={size:n||this.context.size||"",type:i,shape:a,icon:r,loading:e,disabled:l,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(nr,o,this.props.children),this.createRender())}}function Bp(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Up(e){const t=Bp(e);return t?t.frameElement:null}function Gp(e){const t=Qp(e);return Yp([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Yp(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function Xp(e,t){const n=Up(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,l=!1;for(;i;){const e=Gp(i);if(r.push(e),i=Up(i),l)break;i&&Bp(i)===t&&(l=!0)}return Yp(r)}return e.getBoundingClientRect()}function Qp(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}Wp.propTypes={size:(e,t,n)=>{if(!Ka(e[t]||""))return er("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Ut.elementType},Wp.defaultProps={preview:!0,type:"primary",icon:t.createElement(Ye,null)},Wp.contextType=on;const Zp=Object.assign;class Jp{constructor(e,t){this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=rf.border,this.padding.style.borderColor=rf.padding,this.content.style.backgroundColor=rf.background,Zp(this.node.style,{borderColor:rf.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){nf(t,"margin",this.node),nf(t,"border",this.border),nf(t,"padding",this.padding),Zp(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),Zp(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class ef{constructor(e,t){this.tip=e.createElement("div"),Zp(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),Zp(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),Zp(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,n){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(n)+"px"}updatePosition(e,t){const n=this.tip.getBoundingClientRect(),r=function(e,t,n){const r=Math.max(n.height,20),i=Math.max(n.width,60),l=5;let a;a=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+l:e.top+e.height+l:e.top-r<=t.top+t.height?e.top-r-l<t.top+l?t.top+l:e.top-r-l:t.top+t.height-r-l;let o=e.left+l;e.left<t.left&&(o=t.left+l);e.left+i>t.left+t.width&&(o=t.left+t.width-i-l);return a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:n.width,height:n.height});Zp(this.tip.style,r.style)}}class tf{constructor(){const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const n=e.document;this.container=n.createElement("div"),this.container.style.zIndex="10000000",this.tip=new ef(n,this.container),this.rects=[],n.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const n=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>n.length;){const e=this.rects.pop();null==e||e.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new Jp(this.window.document,this.container));const r={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};n.forEach(((e,t)=>{const n=Xp(e,this.window),i=Qp(e);r.top=Math.min(r.top,n.top-i.marginTop),r.right=Math.max(r.right,n.left+n.width+i.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+i.marginBottom),r.left=Math.min(r.left,n.left-i.marginLeft);this.rects[t].update(n,i)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const i=Xp(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:r.top,left:r.left,height:r.bottom-r.top,width:r.right-r.left},{top:i.top+this.tipBoundsWindow.scrollY,left:i.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function nf(e,t,n){Zp(n.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const rf={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let lf=null,af=null;function of(){null!=window.document&&(lf=null,null!==af&&(af.remove(),af=null))}class sf{constructor(e){this._lastHoveredNode=null,this.iframesListeningTo=new Set,this.onClick=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onMouseEvent=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onPointerDown=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))},this.onPointerMove=e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Gi(t,window.document.querySelector(e)))))return this._selectIgnore=!0,of();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var n,r,i;n=[t],r=null,i=!1,null!=window.document?(null!==lf&&clearTimeout(lf),null!=n&&(null===af&&(af=new tf),af.inspect(n,r),i&&(lf=setTimeout((()=>of()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=Ae((e=>{var t;this._selectIgnore||null===(t=this.onSelect)||void 0===t||t.call(this,e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let n=e;const r=[];for(;n!==t&&null!==n;){let e=n.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,r=Array.from(n.classList).reverse();e<r.length;e++)t.test(r[e])&&n.classList.remove(r[e]);if(n.id&&/^rc-\w+/.test(n.id)&&n.removeAttribute("id"),n.id)e+=`#${n.id}`;else{const t=Array.from(n.parentElement.children).filter((e=>e.tagName===n.tagName)),r=n.className.trim();if(t.filter((e=>e.className.includes(r))).length<=1){if(r){const t=r.split(/\s+/);let n="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(n+=`.${t[e]}`);e+=n}}else n.getAttribute("name")?e+=`[name=${n.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(n)+1})`}n.nodeType!==Node.TEXT_NODE&&r.unshift(e),n=n.parentElement}return r.join(" > ")}(e))}),200,{leading:!1}),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){of(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function cf(e){return document.querySelector(e)}const df=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:l}=e,{t:a}=Mn();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(ir,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(nr,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.closeButton")),t.createElement(nr,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(nr,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.finishButton"))))},uf={left:"50%",top:"50%",width:1,height:1},mf=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:l,steps:a=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:h,helper:p={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=Mn(),E=t.useRef(),w=t.useRef(a.length),[S,N]=os(0,{value:i,defaultValue:l}),[T,I]=os(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=os(1051,{value:h,defaultValue:h}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[_,F]=t.useState(T),[D,M]=t.useState(!1),[$,q]=Rp(k.node,!!r),[j,K]=t.useState(22),z=t.useRef(!1),W=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),B=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new sf({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:Na(),node:e,path:t}),N(w.current),P(!0),G(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?U():G(),T?setTimeout((()=>F(!0)),16):F(!1),()=>{G()})),[T]),t.useEffect((()=>{w.current=a.length}),[a]);const U=()=>{E.current.startHandle()},G=()=>{E.current.stopHandle()},Y=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const X=lr("guide-tracker"),Q=[{[`${X}-primary`]:!0}],Z=Xd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(tn,{open:T&&A,autoLock:!0},t.createElement(Zt,{zIndex:R,builtinPlacements:Z,popupPlacement:o,popupVisible:T&&A,popupClassName:Pe(Q,c),popupStyle:d,prefixCls:X,popup:()=>{const e=()=>{P(!1),U()};return t.createElement("div",{className:`${X}-content`},t.createElement("div",{className:`${X}-inner`},t.createElement(it,{className:`${X}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(H,{open:D,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Gt,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),n=a.map((e=>e.id));if(he(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:S;N(i),null==v||v(Ma(e),i)}},a.map(((e,n)=>t.createElement("li",{key:n,className:Pe("item",{actived:e.id===k.id})},t.createElement(Be,{className:"handle",title:x("qm.form.draggable")}),t.createElement("span",{className:"box"},t.createElement("span",{className:"title",title:e.title,onClick:()=>{n!==S&&(L({id:e.id,node:cf(e.selector),path:e.selector}),N(n),K(22===j?j+1:j-1),null==v||v(a,n))}},e.title),t.createElement(C,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=a.filter((t=>t.id!==e.id)),r=n===S;let i=n<=S?S-1:S;if(i=i<0?0:i,i=i>t.length?t.length:i,r&&t[i]){const{id:e,selector:n}=t[i];L({id:e,node:cf(n),path:n})}N(i),null==v||v(t,i)}},t.createElement(it,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${X}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>M(e)},t.createElement(Ft,{className:Pe(`${X}-close`,"menu-icon"),style:{width:j}})),p.content&&t.createElement(V,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:p.content,title:p.title},t.createElement(_t,{className:Pe(`${X}-close`,"help-icon")})),t.createElement("div",{className:"panel-label"},t.createElement("span",{className:"title"},x("qm.guideTracker.label")),t.createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),B)),m?m({id:k.id,selector:k.path,actionStatus:W,DO_CLOSE:e},S):t.createElement(df,{action:W,onConfirm:()=>{null==v||v("add"===W?[...a,{id:k.id,selector:k.path,title:"Guide Title"}]:[...a],S),e()},onCancel:()=>{null==y||y(S),e()},onFinish:()=>{e(),null==y||y(S),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:Pe(`${X}-target-placeholder`),style:Object.assign(Object.assign({},$||uf),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:Y,onClick:Y}))),s&&t.createElement(tn,{open:_},t.createElement(Lp,{zIndex:R,prefixCls:X,onPause:()=>{z.current=A,P(!1),G()},onPlay:()=>{z.current?P(!0):U()}})))}));mf.displayName="QmGuideTracker";const hf=n=>{var r,i,l,a,o,s,c,d;const{content:u,image:m,width:h,height:p,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:w,className:C,style:S}=n,N=t.useRef(null),T=t.useRef(new Map),I=null!==(r=f.fontSize)&&void 0!==r?r:16,R=null!==(i=f.fontWeight)&&void 0!==i?i:"normal",O=null!==(l=f.fontStyle)&&void 0!==l?l:"normal",k=null!==(a=f.fontFamily)&&void 0!==a?a:"sans-serif",L=null!==(o=f.color)&&void 0!==o?o:"rgba(0, 0, 0, 0.15)",A=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],F=g[1],D=_/2,M=F/2,H=null!==(c=v[0])&&void 0!==c?c:D,$=null!==(d=v[1])&&void 0!==d?d:M,q=t.useMemo((()=>{const e=H-D,t=$-M;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:b}}),[D,M,H,$,b]),j=(e,t)=>{var n;if(N.current){const r=T.current.get(N.current);r&&(N.current.contains(r)&&N.current.removeChild(r),T.current.delete(N.current));const i=document.createElement("div");i.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=N.current)||void 0===n||n.append(i),T.current.set(N.current,i)}},K=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const n=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[r,i]=(e=>{let t=120,n=64;if(!m&&e.measureText){e.font=`${I}px ${k}`;const r=P.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),n=I*P.length+3*(P.length-1)}return[null!=h?h:t,null!=p?p:n]})(t),l=r*n,a=i*n,o=(_+r)*n,s=(F+i)*n,c=_/2*n,d=F/2*n,u=o/2,f=s/2,g=2*(_+r);e.width=2*o,e.height=2*s,t.globalAlpha=x,t.save(),t.translate(u,f),t.rotate(Math.PI/180*y),t.translate(-u,-f);const v=()=>{t.restore(),t.drawImage(e,0,0,o,s,o,s,o,s),w&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),j(e.toDataURL(),g)},b=()=>{const e=Number(I)*n;t.font=`${O} normal ${R} ${e}px/${i}px ${k}`,t.fillStyle=L,t.textAlign=A,t.textBaseline="top",t.translate(l/2,0),P.forEach(((r,i)=>{t.fillText(null!=r?r:"",c,d+i*(e+3*n))})),v()};if(m){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,l,a),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=m}else b()},V=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{K()}),[u,m,h,p,f,g,v,y,b,x,E,w]),function(t,n,r={}){const i=window&&"MutationObserver"in window,l=e.useRef(),a=()=>{l.current&&(l.current.disconnect(),l.current=void 0)};e.useLayoutEffect((()=>(a(),i&&t.current&&(l.current=new MutationObserver(n),l.current.observe(t.current,r)),()=>a())),[t])}(N,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>V(e))),n="attributes"===t.type&&V(t.target);if(e||n){K();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=lr("watermark");return t.createElement("div",{ref:N,className:Pe(z,C),style:Object.assign({position:"relative"},S)},n.children)},pf=new Map,ff=new WeakMap;let gf,vf=0;function yf(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(ff.has(n)||(vf+=1,ff.set(n,vf.toString())),ff.get(n)):"0"):e[t]}`;var n})).toString()}function bf(e,t,n={},r=gf){if(void 0===window.IntersectionObserver&&void 0!==r){const i=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i}),()=>{}}const{id:i,observer:l,elements:a}=function(e){const t=yf(e);let n=pf.get(t);if(!n){const r=new Map;let i=[];const l=new IntersectionObserver((t=>{t.forEach((t=>{var n;const l=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=l),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(l,t)}))}))}),e);i=l.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:l,elements:r},pf.set(t,n)}return n}(n),o=a.get(e)||[];return a.has(e)||a.set(e,o),o.push(t),l.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(a.delete(e),l.unobserve(e)),0===a.size&&(l.disconnect(),pf.delete(i))}}const xf=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:l,className:a,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:l,trackVisibility:a,skip:o,delay:s,onChange:c}={})=>{var d;const[u,m]=t.useState(null),[h,p]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(o||!u)return;let t;return t=bf(u,((e,n)=>{var r;p({inView:e,entry:n}),null===(r=f.current)||void 0===r||r.call(f,e,n),n.isIntersecting&&i&&t&&(t(),t=void 0)}),{root:e,rootMargin:n,threshold:r,trackVisibility:a,delay:s},l),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,o,a,l,s]);const g=null===(d=h.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||i||o||v.current===g||(v.current=g,p({inView:!1,entry:void 0}));const y=[m,h.inView,h.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!l}));t.useEffect((()=>{r||tr("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[lr("lazy-load")]:!0};return t.createElement("div",{ref:s,className:Pe(u,a),style:o},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},i))};class Ef{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class wf{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new wf(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,i=e.y-t.y,l=t.x-n.x,a=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+i*i),m=Math.sqrt(l*l+a*a),h=m/(u+m),p=c+(o-c)*h,f=d+(s-d)*h,g=t.x-p,v=t.y-f;return{c1:new Ef(o+g,s+v),c2:new Ef(c+g,d+v)}}constructor(e,t,n,r,i,l){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=l}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,l=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=l-e,i=a-t;n+=Math.sqrt(r*r+i*i)}e=l,t=a}return n}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}}class Cf{constructor(e,t){this.width=320,this.height=200,this.ratio=Math.max(window.devicePixelRatio||1,1),this.penColor="rgba(0,0,0,1)",this.backgroundColor="rgba(0,0,0,0)",this.canAddHistory=!1,this.openSmooth=!0,this.dotSize=0,this.throttle=16,this.minDistance=5,this.velocityFilterWeight=.7,this.compositeOperation="source-over",this.minWidth=.5,this.maxWidth=2.5,this.fontSize=16,this.eraserSize=20,this.lineHeight=1.25,this.degreeOfBlur=5,this.textInputPos={x:0,y:0},this.onStart=()=>{},this.onEnd=()=>{},this._drawingStroke=!1,this._lastPoints=[],this._data=[],this._historyList=[],this._lastVelocity=0,this._lastWidth=0,this.setCanvasSize=()=>{this.canvas.style.height=`${this.height}px`,this.canvas.style.width=`${this.width}px`,this.canvas.height=this.height*this.ratio,this.canvas.width=this.width*this.ratio,1!==this.ratio&&this.ctx.scale(this.ratio,this.ratio)},this.setTextInput=()=>{this.openSmooth||(this.textInput.setAttribute("class","signature__text-input"),this.textInput.setAttribute("contentEditable","true"),this.textInput.setAttribute("spellCheck","false"),this.canvas.parentNode.appendChild(this.textInput))},this.isTouchEvent=e=>"touches"in e,this.addListener=()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",("ontouchstart"in window||navigator.maxTouchPoints)&&(this.canvas.addEventListener("touchstart",this.onDrawStart,{passive:!1}),this.canvas.addEventListener("touchmove",this.onDrawMove,{passive:!1}),document.addEventListener("touchcancel",this.onDrawEnd,{passive:!1}),document.addEventListener("touchend",this.onDrawEnd,{passive:!1})),this.canvas.addEventListener("mousedown",this.onDrawStart),this.canvas.addEventListener("mousemove",this.onDrawMove),document.addEventListener("mouseup",this.onDrawEnd),this.textInput.addEventListener("blur",this.onInputBlur)},this.removeListener=()=>{this.canvas.style.touchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("touchstart",this.onDrawStart),this.canvas.removeEventListener("touchmove",this.onDrawMove),document.removeEventListener("touchend",this.onDrawEnd),document.removeEventListener("touchcancel",this.onDrawEnd),this.canvas.removeEventListener("mousedown",this.onDrawStart),this.canvas.removeEventListener("mousemove",this.onDrawMove),document.removeEventListener("mouseup",this.onDrawEnd),this.textInput.removeEventListener("blur",this.onInputBlur)},this._isLeftButtonPressed=(e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:1==(1&e.buttons),this._pointerEventToSignatureEvent=e=>{var t,n;return{event:e,type:e.type,x:this.isTouchEvent(e)?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX,y:this.isTouchEvent(e)?null===(n=e.touches[0])||void 0===n?void 0:n.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}},this._getPointGroupOptions=e=>({penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}),this._strokeBegin=e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n=Object.assign(Object.assign({},t),{points:[]});this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)},this._strokeUpdate=(e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const n=this._createPoint(e.x,e.y,e.pressure),r=this._data[this._data.length-1],i=r.points,l=i.length>0&&i[i.length-1],a=!!l&&n.distanceTo(l)<=this.minDistance,o=this._getPointGroupOptions(r);if(!l||!l||!a){const e=this._addPoint(n,o);t&&(l?e&&this._drawCurve(e,o):this._drawDot(n,o)),i.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}},this._strokeEnd=(e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)},this._reset=e=>{this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this.ctx.fillStyle=e.penColor,this.ctx.globalCompositeOperation=e.compositeOperation},this._drawDot=(e,t)=>{const n=this.ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()},this._drawCurve=(e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){const l=n/i,a=l*l,o=a*l,s=1-l,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*l*e.control1.x,u+=3*s*a*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*l*e.control1.y,m+=3*s*a*e.control2.y,m+=o*e.endPoint.y;const h=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,m,h)}n.closePath(),n.fill()},this._drawCurveSegment=(e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)},this._createPoint=(e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new Ef(e-r.left,t-r.top,n,(new Date).getTime())},this._createPointByEvent=e=>this._createPoint(e.x,e.y,e.pressure),this._addPoint=(e,t)=>{const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=wf.fromPoints(n,e);return n.shift(),r}return null},this._strokeWidth=(e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth),this._calculateCurveWidths=(e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),l={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,l},this.onDrawStart=e=>{var t;e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),null===(t=this.onStart)||void 0===t||t.call(this,e))},this.onDrawMove=e=>{e.preventDefault(),"text"!==this.mode&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?window.requestAnimationFrame?window.requestAnimationFrame((()=>this.drawHandler(e))):this.drawHandler(e):this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.onDrawEnd=e=>{var t;this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),null===(t=this.onEnd)||void 0===t||t.call(this,e))},this.onInputBlur=e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()},this.drawHandler=e=>{switch(this.mode){case"line":this.drawLine(e);break;case"square":this.drawSquare(e);break;case"round":this.drawRound(e);break;case"arrow":this.drawArrow(e);break;case"mosaic":this.drawMosaic(e);break;case"text":this.drawText(e);break;case"eraser":this.drawEraser(e)}this.canAddHistory=!0},this.drawSquare=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,i-n),this.ctx.stroke(),this.ctx.restore()},this.drawRound=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),l=Math.min(r,t),a=Math.min(i,n),o=.5*(Math.max(r,t)-l),s=.5*(Math.max(i,n)-a),c=l+o,d=a+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},this.drawArrow=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),l=180*Math.atan2(n-i,t-r)/Math.PI,a=(l+25)*Math.PI/180,o=(l-25)*Math.PI/180,s=15*Math.cos(a),c=15*Math.sin(a),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,i),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,i);const m=r+s,h=i+c;this.ctx.lineTo(m,h);const p=r+d,f=i+u;this.ctx.lineTo(p,f),this.ctx.lineTo(r,i),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,i=e.data,l=[];return l[0]=i[4*(n*r+t)],l[1]=i[4*(n*r+t)+1],l[2]=i[4*(n*r+t)+2],l[3]=i[4*(n*r+t)+3],l},this.setAxisColor=(e,t,n,r)=>{const i=e.width,l=e.data;l[4*(n*i+t)]=r[0],l[4*(n*i+t)+1]=r[1],l[4*(n*i+t)+2]=r[2],l[4*(n*i+t)+3]=r[3]},this.drawMosaic=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),r=this.ctx.getImageData(t*this.ratio,n*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),i=r.width,l=r.height,a=i/this.degreeOfBlur,o=l/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<a;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let i=0;i<this.degreeOfBlur;i++)for(let l=0;l<this.degreeOfBlur;l++)this.setAxisColor(r,t*this.degreeOfBlur+l,e*this.degreeOfBlur+i,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)},this.drawText=e=>{const{x:t,y:n}=this.textInputPos;if(0===t&&0===n)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const r=this.fontSize*this.lineHeight,i=this.width-t,l=e.target.innerText,a=[];let o="";for(let e=0;e<l.length;e++){const t=o+l[e];this.ctx.measureText(t).width>i&&o.length>0?(a.push(o),o=l[e]):o=t}a.push(o),a.forEach(((e,i)=>{this.ctx.fillText(e,t+1,n+i*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}},this.createPencil=e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)},this.drawPencil=e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()},this.createEraser=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)},this.drawEraser=e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"},this.drawLine=e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)},this.createTextInput=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=n?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())},this.setInputStyle=()=>{if(!this._lastPoints.length)return;const{x:e,y:t}=this._lastPoints[0];this.textInput.style.left=e+"px",this.textInput.style.lineHeight=this.lineHeight.toString(),this.textInput.style.fontSize=this.fontSize+"px",this.textInput.style.color=this.penColor,this.textInput.style.top=t-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:e,y:t}},this.drawBgColor=()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))},this.clearWorkSpace=()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},this.addHistory=()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))},this.getLastHistory=()=>this._historyList[this._historyList.length-1],this.setLastHistory=()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()},this.clear=()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())},this.undo=()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()},this.setDrawMode=e=>{this.mode=e},this.setLineWidth=e=>{this.maxWidth=e},this.setPenColor=e=>{this.penColor=e},this.setFontSize=e=>{this.fontSize=e},this.isEmpty=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,1!==this.ratio&&t.scale(this.ratio,this.ratio),this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)),e.toDataURL()===this.canvas.toDataURL()},this.toDataURL=(e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");n.width=this.width,n.height=this.height;return n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)},this.getPNG=()=>this.toDataURL(),this.getJPG=(e=.8)=>this.toDataURL("image/jpeg",e),this.initial(e,t)}initial(e,t={}){e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this.backgroundColor=this.openSmooth&&t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,i,l=0,a=null;const o=()=>{l=Date.now(),a=null,n=e.apply(r,i),a||(r=null,i=[])};return function(...s){const c=Date.now(),d=t-(c-l);return r=this,i=s,d<=0||d>t?(a&&(clearTimeout(a),a=null),l=c,n=e.apply(r,i),a||(r=null,i=[])):a||(a=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}Cf.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),i=r.length,l=new Uint8Array(i);for(let e=0;e<i;++e)l[e]=r.charCodeAt(e);return new Blob([l],{type:n})},Cf.canvasToDataURL=e=>e.toDataURL("image/png",1),Cf.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const Sf=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})),Nf=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M839.111111 269.198222V122.908444A9.159111 9.159111 0 0 0 829.980444 113.777778H208.213333A9.159111 9.159111 0 0 0 199.111111 122.908444v146.289778c0 5.034667 4.124444 9.159111 9.130667 9.159111h64a9.159111 9.159111 0 0 0 9.159111-9.159111V196.067556h192v640h-105.159111a9.159111 9.159111 0 0 0-9.130667 9.130666v64c0 5.034667 4.124444 9.159111 9.130667 9.159111h301.738666a9.159111 9.159111 0 0 0 9.130667-9.159111v-64a9.159111 9.159111 0 0 0-9.130667-9.130666h-105.159111v-640h192v73.130666c0 5.034667 4.124444 9.159111 9.159111 9.159111h64a9.159111 9.159111 0 0 0 9.130667-9.159111z"})),Tf=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M887.65217391 606.59279489a31.26857185 31.26857185 0 0 1-31.26857185-31.26857087v-363.48819946L158.38608696 909.83354065a31.26857185 31.26857185 0 1 1-44.21962762-44.21962761l697.99751609-698.06906805h-363.48819945a31.26857185 31.26857185 0 0 1 0-62.46559075h439.04795087c17.17267109 0 31.26857185 13.95279489 31.26857086 31.19701891v439.04795087a31.26857185 31.26857185 0 0 1-31.3401238 31.26857087z"})),If=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M606.4 103.424a64 64 0 0 1 0.704 0.64l320.256 280.32a64 64 0 0 1 7.104 89.024l-330.432 398.72 320.448 0.128a32 32 0 0 1 0 64.064H397.632a32.128 32.128 0 0 1-6.208-0.64h-20.736a64 64 0 0 1-42.304-16.064l-238.08-210.112A64 64 0 0 1 83.84 620.16l432.32-509.312a64 64 0 0 1 90.24-7.36zM242.048 537.536l-87.04 101.76a32 32 0 0 0 3.584 45.248l213.12 180.672a32 32 0 0 0 20.736 7.616l-0.64-0.064a32.192 32.192 0 0 1 5.76-0.512h102.016a32 32 0 0 0 18.176-10.496l40.96-47.232-316.672-276.992zM592.96 177.28a32 32 0 0 0-45.12 3.456L283.712 488.96l316.928 277.248 264.512-304.96a32 32 0 0 0 1.024-40.704l-3.904-4.16-268.928-238.72a32 32 0 0 0-0.384-0.32z"})),Rf=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M607.75537778 291.05948444H223.6416l115.34336-115.41617778a36.37248 36.37248 0 1 0-51.48216889-51.44576L132.61937778 279.04455111c-13.54410667 13.50769778-21.04433778 31.67573333-21.11715556 50.97244444a71.72551111 71.72551111 0 0 0 21.11715556 51.51857778l154.88341333 154.91982222a36.29966222 36.29966222 0 0 0 51.48216889 0 36.37248 36.37248 0 0 0 0-51.48216889l-121.46005333-121.16878222H607.75537778c130.70791111 0 237.02186667 106.16832 237.02186667 236.65777777s-106.31395555 236.65777778-237.02186667 236.65777778h-254.13404445a36.40888889 36.40888889 0 0 0 0 72.81777779h254.13404445c170.83050667 0 309.83964445-138.82709333 309.83964444-309.47555557 0-170.64846222-139.00913778-309.47555555-309.83964444-309.47555555"})),Of=t.forwardRef(((e,n)=>{const{open:r,width:i,height:l,imageName:a,penColor:o,penMode:s,minWidth:c,maxWidth:d,backgroundColor:u,className:m,style:p,onOk:f,onCancel:g}=e,{t:v}=Mn(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=os(void 0,{value:r,postState:e=>null!=e&&e}),I=t.useMemo((()=>!!e.children),[e.children]),[R,O]=t.useState(s||(I?"square":"line")),[k,L]=t.useState(w[0]),[A,P]=t.useState(I?S[0]:S[4]),[_,F]=t.useState(C[1]),[M,$]=t.useState("bottomLeft"),[q,j]=t.useState(!1),[K,V]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=i?i:null===(e=x.current)||void 0===e?void 0:e.offsetWidth,height:null!=l?l:null===(t=x.current)||void 0===t?void 0:t.offsetHeight,maxWidth:k,mode:R,penColor:A,fontSize:_,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new Cf(b.current,n),()=>y.current.destroy()}),[]);const z=e=>{var t,n;const[r,a]=[null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=l?l:null===(n=x.current)||void 0===n?void 0:n.offsetHeight],{width:o,height:s}=y.current;let c=!1;r&&r!==o&&(y.current.width=r,c=!0),a&&a!==s&&(y.current.height=a,c=!0),(c||e)&&y.current.update()};Hi((()=>{I&&N&&z()}),[N,I]),Hi((()=>{y.current.setDrawMode(R)}),[R]),Hi((()=>{y.current.setLineWidth(k)}),[k]),Hi((()=>{y.current.setPenColor(A)}),[A]),Hi((()=>{y.current.setFontSize(_)}),[_]);const W=()=>Dn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield an(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Cf.canvasToDataURL(t)}catch(e){tr("Signature","生成合成图片失败!")}})),B=()=>{y.current.clear(),null==g||g()};t.useImperativeHandle(n,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>y.current.clear(),UNDO:()=>y.current.undo(),IS_EMPTY:()=>y.current.isEmpty(),UPDATE:z,GET_DATE_URL:W})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},G=e=>t.createElement("div",{className:Pe("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},w.map((e=>t.createElement("span",{key:e,className:Pe("dot",`s${e}`,{active:e===k}),onClick:()=>L(e)})))):t.createElement("div",{className:"fontSize"},t.createElement(D,{size:"small",value:_,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>F(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},S.map((e=>t.createElement("span",{key:e,className:Pe("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>P(e)},t.createElement($e,{className:"icon"})))))),Y=lr("signature"),X={[Y]:!0,"is-annotation":I},Q=i?Object.assign(Object.assign({},p),{width:i}):p;return t.createElement("div",{className:Pe(X,m),style:Q},I&&t.createElement(t.Fragment,null,t.createElement("div",{ref:x,className:"content"},e.children),K&&t.createElement(nl,{spinning:!0,className:"spinning"})),t.createElement("div",{className:Pe("signature",{show:N})},t.createElement("canvas",{ref:b,className:R}),I&&t.createElement("div",{ref:E,className:"signature__tool-bar"},t.createElement("div",{className:"wrapper"},t.createElement("div",{className:Pe("actions",{hidden:q})},t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(Dt,null))),t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(Sf,null))),t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(Tf,null))),t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement(He,null))),t.createElement(H,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(Nf,null))),t.createElement("button",{className:"btn",onClick:()=>Dn(void 0,void 0,void 0,(function*(){yield Dn(void 0,void 0,void 0,(function*(){V(!0);const e=yield W();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):h().format(Xo);wl(Cf.dataURLToBlob(e),`${t}.png`)}V(!1)})),B()}))},t.createElement(je,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(If,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(Rf,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(Tt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(it,null)),t.createElement("button",{className:"btn",onClick:()=>Dn(void 0,void 0,void 0,(function*(){V(!0),yield Wn(10);const e=yield W();V(!1),B(),null==f||f(e)}))},t.createElement($e,null))),t.createElement("button",{className:"btn btn-fold",title:v(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>j(!q)},q?t.createElement(ot,null):t.createElement(st,null))))))}));Of.displayName="QmSignature";const kf="1.11.26";export{Tn as Calendar,In as DatePicker,Ll as DcpAnchor,nr as DcpButton,Di as DcpCollapse,Qd as DcpColorPicker,Pn as DcpConfigProvider,Dm as DcpCopyToClipboard,el as DcpCountup,np as DcpCropper,ar as DcpDivider,Il as DcpDownload,_l as DcpDrawer,tl as DcpEmpty,Tp as DcpForm,mf as DcpGuideTracker,xf as DcpLazyLoad,Ml as DcpModal,Du as DcpPivotGrid,Wp as DcpPrint,uh as DcpRangeTableHelper,El as DcpScrollbar,Um as DcpSearchHelper,mm as DcpSearchTree,Of as DcpSignature,ir as DcpSpace,nl as DcpSpin,Ji as DcpSplit,Bm as DcpTable,Pl as DcpTabs,Cp as DcpTinymce,Fp as DcpTour,gl as DcpTransition,Pm as DcpTreeHelper,rh as DcpTreeTableHelper,Tl as DcpUploadFile,ip as DcpUploadImg,Yu as DcpVirtualList,hf as DcpWatermark,Ll as QmAnchor,nr as QmButton,Di as QmCollapse,Qd as QmColorPicker,Pn as QmConfigProvider,Dm as QmCopyToClipboard,el as QmCountup,np as QmCropper,ar as QmDivider,Il as QmDownload,_l as QmDrawer,tl as QmEmpty,Tp as QmForm,mf as QmGuideTracker,xf as QmLazyLoad,Ml as QmModal,Du as QmPivotGrid,Wp as QmPrint,uh as QmRangeTableHelper,El as QmScrollbar,Um as QmSearchHelper,mm as QmSearchTree,Of as QmSignature,ir as QmSpace,nl as QmSpin,Ji as QmSplit,Bm as QmTable,Pl as QmTabs,Cp as QmTinymce,Fp as QmTour,gl as QmTransition,Pm as QmTreeHelper,rh as QmTreeTableHelper,Tl as QmUploadFile,ip as QmUploadImg,Yu as QmVirtualList,hf as QmWatermark,On as TimePicker,So as pinyin,kf as version};
1
+ import*as e from"react";import t,{createContext as n,version as r,isValidElement as l,useRef as i,useLayoutEffect as a,useEffect as o,useState as s,useCallback as c,Component as d,forwardRef as u,useImperativeHandle as m}from"react";import p from"dayjs";import"dayjs/locale/zh-cn";import h from"dayjs/plugin/localeData";import f from"dayjs/plugin/advancedFormat";import g from"dayjs/plugin/customParseFormat";import v from"dayjs/plugin/quarterOfYear";import y from"dayjs/plugin/weekOfYear";import b from"dayjs/plugin/weekday";import{ConfigProvider as x,Button as E,Tooltip as w,Popconfirm as C,Space as S,Empty as N,Spin as T,Upload as I,message as R,Input as O,Tabs as k,Drawer as L,Modal as A,Form as P,Row as F,Col as _,Select as D,Checkbox as M,Dropdown as H,InputNumber as $,Divider as q,Radio as K,Menu as j,Popover as V,Tree as z,Switch as W,Pagination as B,Rate as U,Tag as G,TreeSelect as Y,Cascader as X,Image as Q,notification as Z,Slider as J}from"antd";export{Affix,Alert,Anchor,AutoComplete,Avatar,BackTop,Badge,Breadcrumb,Button,Card,Carousel,Cascader,Checkbox,Col,Collapse,Comment,ConfigProvider,Descriptions,Divider,Drawer,Dropdown,Empty,Form,Grid,Image,Input,InputNumber,Layout,List,Mentions,Menu,Modal,PageHeader,Pagination,Popconfirm,Popover,Progress,Radio,Rate,Result,Row,Segmented,Select,Skeleton,Slider,Space,Spin,Statistic,Steps,Switch,Table,Tabs,Tag,Timeline,Tooltip,Transfer,Tree,TreeSelect,Typography,Upload,message,notification}from"antd";import ee from"dayjs/plugin/weekYear";import te from"antd/es/calendar/generateCalendar";import ne from"antd/es/date-picker/generatePicker";import re from"antd/es/locale/zh_CN";import le from"antd/es/locale/en_GB";import{isArray as ie,isPlainObject as ae,isNumber as oe,isFunction as se,isString as ce,isUndefined as de,get as ue,set as me,transform as pe,isEqual as he,xor as fe,isRegExp as ge,intersection as ve,map as ye,groupBy as be,flatten as xe,spread as Ee,mergeWith as we,isDate as Ce,sumBy as Se,maxBy as Ne,minBy as Te,merge as Ie,union as Re,pickBy as Oe,uniqBy as ke,debounce as Le,throttle as Ae}from"lodash-es";import Pe from"classnames";import{UpOutlined as Fe,DownOutlined as _e,UploadOutlined as De,LinkOutlined as Me,EditOutlined as He,CheckOutlined as $e,EyeOutlined as qe,DownloadOutlined as Ke,DeleteOutlined as je,FullscreenExitOutlined as Ve,FullscreenOutlined as ze,UnorderedListOutlined as We,HolderOutlined as Be,InfoCircleFilled as Ue,ReloadOutlined as Ge,PrinterOutlined as Ye,ImportOutlined as Xe,SettingOutlined as Qe,CopyOutlined as Ze,CheckSquareOutlined as Je,CloseCircleOutlined as et,MonitorOutlined as tt,FolderOpenOutlined as nt,PlusOutlined as rt,CloseOutlined as lt,FilterOutlined as it,SortAscendingOutlined as at,LeftOutlined as ot,RightOutlined as st,EyeInvisibleOutlined as ct,ColumnHeightOutlined as dt,FolderOutlined as ut,BarsOutlined as mt,SaveOutlined as pt,InfoCircleOutlined as ht,BgColorsOutlined as ft,CaretDownOutlined as gt,ExpandAltOutlined as vt,CaretRightOutlined as yt,LineChartOutlined as bt,PieChartOutlined as xt,FunnelPlotOutlined as Et,AppstoreAddOutlined as wt,StepBackwardOutlined as Ct,StepForwardOutlined as St,SearchOutlined as Nt,ClearOutlined as Tt,ZoomInOutlined as It,ZoomOutOutlined as Rt,RotateRightOutlined as Ot,RotateLeftOutlined as kt,InboxOutlined as Lt,ExclamationCircleOutlined as At,PauseOutlined as Pt,QuestionCircleOutlined as Ft,MenuOutlined as _t,BorderOutlined as Dt}from"@ant-design/icons";import Mt,{flushSync as Ht}from"react-dom";import $t from"react-countup";import qt from"resize-observer-polyfill";import Kt from"sortablejs";import jt from"add-dom-event-listener";import Vt from"scroll-into-view-if-needed";import zt from"react-draggable";import Wt from"memoize-one";import*as Bt from"prop-types";import Ut from"prop-types";import{ReactSortable as Gt}from"react-sortablejs";import Yt from"big.js";import Xt from"exceljs";import Qt from"localforage";import Zt from"@rc-component/trigger";import Jt,{ColorBlock as en}from"@rc-component/color-picker";import tn from"@rc-component/portal";import nn from"copy-to-clipboard";import rn from"china-area-data";import ln from"cropperjs";import an from"html2canvas";const on=n({locale:"zh-cn",size:"middle"});var sn={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"过滤{text}",searchAreaText:"过滤{text},用逗号隔开",text:"筛选",selectAll:"全选",invert:"反选",onlyItem:"仅此项",keywordSearch:"关键词搜索"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",nullText:"空值",notNullText:"非空值",startsWithText:"开头是",endsWithText:"结尾是",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",matchCase:"大小写匹配",matchFullchar:"全字符匹配",queryLabel:"查找内容",queryPrev:"查找上一个",queryNext:"查找下一个",queryAll:"查找全部",findTotal:"查找到 {total} 个单元格",cellText:"单元格",valText:"值"},pivotGrid:{text:"多维表",settingTitle:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行",col:"整列"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};let cn=sn;function dn(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const un=(...e)=>{const[t,n]=e;let r;const l=t.split(".");let i=cn;for(let e=0,t=l.length;e<t;e++){if(r=i[l[e]],e===t-1)return dn(r,n);if(!r)return"";i=r}return""},mn=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})),pn=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function hn(e,t){pn((t=>{if(!t)return e()}),t)}p.extend(h),p.extend(f),p.extend(g),p.extend(v),p.extend(y),p.extend(b);var fn={},gn=[];function vn(e,t){if(!e&&void 0!==console){var n=gn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function yn(e,t){if(!e&&void 0!==console){var n=gn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function bn(e,t,n){t||fn[n]||(e(!1,n),fn[n]=!0)}function xn(e,t){bn(vn,e,t)}function En(e,t){bn(yn,e,t)}xn.preMessage=function(e){gn.push(e)},xn.resetWarned=function(){fn={}},xn.noteOnce=En,p.extend(g),p.extend(f),p.extend(b),p.extend(h),p.extend(y),p.extend(ee),p.extend((function(e,t){var n=t.prototype,r=n.format;n.format=function(e){var t=(e||"").replace("Wo","wo");return r.bind(this)(t)}}));var wn={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},Cn=function(e){return wn[e]||e.split("_")[0]},Sn=function(){En(!1,"Not match any format. Please help to fire a issue about this.")},Nn={getNow:function(){return p()},getFixedDate:function(e){return p(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var t=e.locale("en");return t.weekday()+t.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},addYear:function(e,t){return e.add(t,"year")},addMonth:function(e,t){return e.add(t,"month")},addDate:function(e,t){return e.add(t,"day")},setYear:function(e,t){return e.year(t)},setMonth:function(e,t){return e.month(t)},setDate:function(e,t){return e.date(t)},setHour:function(e,t){return e.hour(t)},setMinute:function(e,t){return e.minute(t)},setSecond:function(e,t){return e.second(t)},isAfter:function(e,t){return e.isAfter(t)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return p().locale(Cn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(Cn(e)).weekday(0)},getWeek:function(e,t){return t.locale(Cn(e)).week()},getShortWeekDays:function(e){return p().locale(Cn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return p().locale(Cn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(Cn(e)).format(n)},parse:function(e,t,n){for(var r=Cn(e),l=0;l<n.length;l+=1){var i=n[l],a=t;if(i.includes("wo")||i.includes("Wo")){for(var o=a.split("-")[0],s=a.split("-")[1],c=p(o,"YYYY").startOf("year").locale(r),d=0;d<=52;d+=1){var u=c.add(d,"week");if(u.format("Wo")===s)return u}return Sn(),null}var m=p(a,i).locale(r);if(m.isValid())return m}return t&&Sn(),null}}};const Tn=te(Nn),In=ne(Nn);function Rn(){return Rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rn.apply(null,arguments)}const On=e.forwardRef(((t,n)=>e.createElement(In,Rn({},t,{picker:"time",mode:void 0,ref:n}))));On.displayName="TimePicker";const kn=e.forwardRef(((t,n)=>e.createElement(In.RangePicker,Rn({},t,{picker:"time",mode:void 0,ref:n}))));kn.displayName="RangePicker",On.RangePicker=kn;var Ln={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Filter {text}",searchAreaText:"Filter {text}, separated by commas",text:"Filter",selectAll:"Select all",invert:"Invert",onlyItem:"Only item",keywordSearch:"Keyword Search"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel Merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",nullText:"null value",notNullText:"not null value",startsWithText:"beginning is",endsWithText:"ending is",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",matchCase:"Case matching",matchFullchar:"Full character matching",queryLabel:"Find content",queryPrev:"Find previous",queryNext:"Find next",queryAll:"Find all",findTotal:"Found {total} cells",cellText:"Cell",valText:"Value"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row",col:"Col"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}};const An={[Ln.name]:{qm:Ln,antd:le},[sn.name]:{qm:sn,antd:re}},Pn=e=>{const n=mn({locale:"zh-cn",size:"middle"},e),{locale:r,size:l,global:i}=n;t.useMemo((()=>{return e=Object.assign({},An,null==i?void 0:i.langPackage)[r].qm,cn=e||cn,void(cn.name&&p.locale(cn.name));var e}),[r]);const a=t.useMemo((()=>Object.assign({},An,null==i?void 0:i.langPackage)),[i]),[o,s]=t.useState({locale:r,size:l,global:i});return hn((()=>{s((e=>Object.assign({},e,{locale:r,size:l})))}),[l,r]),t.createElement(on.Provider,{value:o},t.createElement(x,{locale:a[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==i?void 0:i.autoInsertSpaceInButton},n.children))};function Fn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(r=Object.getOwnPropertySymbols(e);l<r.length;l++)t.indexOf(r[l])<0&&Object.prototype.propertyIsEnumerable.call(e,r[l])&&(n[r[l]]=e[r[l]])}return n}function _n(e,t,n,r){var l,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(l=e[o])&&(a=(i<3?l(a):i>3?l(t,n,a):l(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Dn(e,t,n,r){return new(n||(n=Promise))((function(l,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}s((r=r.apply(e,t||[])).next())}))}function Mn(){const{locale:t}=e.useContext(on);return{t:un,$locale:t}}function Hn(t){const n=e.useRef();n.current=t;return e.useCallback(((...e)=>{var t;return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function $n(t){const{size:n}=e.useContext(on);return{$size:e.useMemo((()=>{var e,r;return null!==(r=null!==(e=t.size)&&void 0!==e?e:n)&&void 0!==r?r:""}),[t.size,n])}}Pn.displayName="QmConfigProvider";var qn="undefined"==typeof window;const Kn=e=>t.isValidElement(e),jn=e=>Kn(e)&&e.type===t.Fragment,Vn=()=>{},zn=()=>!0,Wn=e=>Dn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Bn=e=>{Promise.resolve().then(e)},Un=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),Gn=e=>!!(!e&&0!==e||ie(e)&&!e.length||ae(e)&&!Object.keys(e).length),Yn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Xn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Qn=(e,t=new WeakMap)=>{if(ae(e)||ie(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const l=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(l||e,((n,i)=>{l&&(i=n),r[i]=Qn(e[i],t)})),r}return e},Zn=e=>oe(e)?`${e}px`:e.toString();class Jn extends Error{constructor(e){super(e),this.name="QmDesignError"}}function er(e,t){throw new Jn(`[${e}] ${t}`)}function tr(e,t){console.warn(new Jn(`[${e}] ${t}`))}const nr=e=>{const{loading:n,shortcutKey:r,authConfig:l,click:i,confirm:a}=e,{t:o}=Mn(),{$size:s}=$n(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=Hn((e=>{var t;const n=r.split("+").map((e=>e.trim().toLowerCase())),l=n.includes("alt"),i=n.includes("ctrl"),a=n.includes("shift"),o=n[n.length-1];l&&!e.altKey||i&&!e.ctrlKey||a&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),p.disabled||null===(t=p.onClick)||void 0===t||t.call(p,e))})),m=se(i)?{onClick:t=>Dn(void 0,void 0,void 0,(function*(){var n;d(!0);try{yield null===(n=e.click)||void 0===n?void 0:n.call(e,t)}catch(e){tr("Button","`click`方法执行出错")}d(!1)}))}:null,p=Object.assign(Object.assign(Object.assign({},Xn(e,["shortcutKey","authConfig","click","confirm"])),{size:s,loading:c||n||!1}),m);if(l){const{visible:e=1,disabled:t}=l||{};if(!e)return null;t&&(p.disabled=!0)}const h=t.createElement(E,p,e.children);return a?t.createElement(C,{title:a.title||o("qm.button.confirmTitle"),disabled:p.disabled,onConfirm:e=>{var t,n;null===(t=a.onConfirm)||void 0===t||t.call(a),null===(n=p.onClick)||void 0===n||n.call(p,e)},onCancel:e=>{var t;null===(t=a.onCancel)||void 0===t||t.call(a,e)}},t.createElement(E,Rn({},p,{onClick:Vn}),e.children)):!r||p.disabled?h:t.createElement(w,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},h)};var rr;nr.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(rr||(rr={}));const lr=e=>{const{$size:n}=$n(e),r=oe(e.size)?e.size:rr[n||"default"],l=Object.assign(Object.assign({},Xn(e,["size"])),{size:r});return t.createElement(S,l,e.children)};lr.displayName="QmSpace";const ir=e=>`qm-${e}`,ar=e=>{const{label:n,extra:r,collapse:l,bordered:i=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=$n(e),{t:m}=Mn(),p=ir("divider"),h={[p]:!0,[`${p}-borderless`]:!i,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return t.createElement("div",{id:o,className:Pe(h,s),style:c},t.createElement("span",{className:`${p}__title`},n),t.createElement("div",{className:`${p}__extra`},r),void 0!==l&&t.createElement(E,{type:"link",className:`${p}__collapse`,disabled:a,onClick:()=>{null==d||d(!l)}},m(l?"qm.divider.collect":"qm.divider.spread"),l?t.createElement(Fe,null):t.createElement(_e,null)))};ar.displayName="QmDivider";const or=()=>({height:0,opacity:0}),sr=e=>({height:e.scrollHeight,opacity:1}),cr=e=>({height:e?e.offsetHeight:0}),dr=(e,t)=>!0===(null==t?void 0:t.deadline)||"height"===t.propertyName;function ur(e){return ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ur(e)}function mr(e){var t=function(e,t){if("object"!==ur(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ur(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ur(t)?t:String(t)}function pr(e,t,n){return(t=mr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(n),!0).forEach((function(t){pr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,i,a,o=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,l=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw l}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yr(e){return e instanceof HTMLElement||e instanceof SVGElement}function br(e){var n,r=function(e){return e&&"object"===ur(e)&&yr(e.nativeElement)?e.nativeElement:yr(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Mt.findDOMNode)||void 0===n?void 0:n.call(Mt,e):null)}var xr,Er={exports:{}},wr={};Er.exports=(xr||(xr=1,function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:var f=e.type;switch(f){case r:case i:case l:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case o:case c:case p:case m:case a:return g;default:return h}}case n:return h}}}e=Symbol.for("react.module.reference");var g=o,v=a,y=t,b=c,x=r,E=p,w=m,C=n,S=i,N=l,T=d,I=u,R=!1,O=!1;wr.ContextConsumer=g,wr.ContextProvider=v,wr.Element=y,wr.ForwardRef=b,wr.Fragment=x,wr.Lazy=E,wr.Memo=w,wr.Portal=C,wr.Profiler=S,wr.StrictMode=N,wr.Suspense=T,wr.SuspenseList=I,wr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},wr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},wr.isContextConsumer=function(e){return f(e)===o},wr.isContextProvider=function(e){return f(e)===a},wr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},wr.isForwardRef=function(e){return f(e)===c},wr.isFragment=function(e){return f(e)===r},wr.isLazy=function(e){return f(e)===p},wr.isMemo=function(e){return f(e)===m},wr.isPortal=function(e){return f(e)===n},wr.isProfiler=function(e){return f(e)===i},wr.isStrictMode=function(e){return f(e)===l},wr.isSuspense=function(e){return f(e)===d},wr.isSuspenseList=function(e){return f(e)===u},wr.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===i||t===l||t===d||t===u||t===h||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===m||t.$$typeof===a||t.$$typeof===o||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},wr.typeOf=f}()),wr);var Cr=function(e,t){"function"==typeof e?e(t):"object"===ur(e)&&e&&"current"in e&&(e.current=t)},Sr=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);return r.length<=1?r[0]:function(e){t.forEach((function(t){Cr(t,e)}))}},Nr=function(e){var t,n,r=Er.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===Er.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===Er.exports.ForwardRef)};function Tr(e,t){if(null==e)return{};var n,r,l=function(e,t){if(null==e)return{};var n,r,l={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}Number(r.split(".")[0]);var Ir=e.createContext({});function Rr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Or(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mr(r.key),r)}}function kr(e,t,n){return t&&Or(e.prototype,t),n&&Or(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lr(e,t){return Lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Lr(e,t)}function Ar(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lr(e,t)}function Pr(e){return Pr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pr(e)}function Fr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _r(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Pr(e);if(t){var l=Pr(this).constructor;n=Reflect.construct(r,arguments,l)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===ur(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Fr(e)}(this,n)}}var Dr=function(t){Ar(r,e.Component);var n=_r(r);function r(){return Rr(this,r),n.apply(this,arguments)}return kr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function Mr(t){var n=e.useRef(!1),r=vr(e.useState(t),2),l=r[0],i=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[l,function(e,t){t&&n.current||i(e)}]}var Hr="none",$r="appear",qr="enter",Kr="leave",jr="none",Vr="prepare",zr="start",Wr="active",Br="end",Ur="prepared";function Gr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Yr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var Xr,Qr,Zr,Jr=(Xr=Gr(),Qr="undefined"!=typeof window?window:{},Zr={animationend:Yr("Animation","AnimationEnd"),transitionend:Yr("Transition","TransitionEnd")},Xr&&("AnimationEvent"in Qr||delete Zr.animationend.animation,"TransitionEvent"in Qr||delete Zr.transitionend.transition),Zr),el={};if(Gr()){var tl=document.createElement("div");el=tl.style}var nl={};function rl(e){if(nl[e])return nl[e];var t=Jr[e];if(t)for(var n=Object.keys(t),r=n.length,l=0;l<r;l+=1){var i=n[l];if(Object.prototype.hasOwnProperty.call(t,i)&&i in el)return nl[e]=t[i],nl[e]}return""}var ll=rl("animationend"),il=rl("transitionend"),al=!(!ll||!il),ol=ll||"animationend",sl=il||"transitionend";function cl(e,t){return e?"object"===ur(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var dl=function(t){var n=i(),r=i(t);r.current=t;var l=e.useCallback((function(e){r.current(e)}),[]);function a(e){e&&(e.removeEventListener(sl,l),e.removeEventListener(ol,l))}return e.useEffect((function(){return function(){a(n.current)}}),[]),[function(e){n.current&&n.current!==e&&a(n.current),e&&e!==n.current&&(e.addEventListener(sl,l),e.addEventListener(ol,l),n.current=e)},a]},ul=Gr()?a:o,ml=function(e){return+setTimeout(e,16)},pl=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(ml=function(e){return window.requestAnimationFrame(e)},pl=function(e){return window.cancelAnimationFrame(e)});var hl=0,fl=new Map;function gl(e){fl.delete(e)}var vl=function(e){var t=hl+=1;return function n(r){if(0===r)gl(t),e();else{var l=ml((function(){n(r-1)}));fl.set(t,l)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};vl.cancel=function(e){var t=fl.get(e);return gl(e),pl(t)},vl.ids=function(){return fl};var yl=[Vr,zr,Wr,Br],bl=[Vr,Ur],xl=!1,El=!0;function wl(e){return e===Wr||e===Br}var Cl=function(t,n,r){var l=vr(Mr(jr),2),i=l[0],a=l[1],o=function(){var t=e.useRef(null);function n(){vl.cancel(t.current)}return e.useEffect((function(){return function(){n()}}),[]),[function e(r){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;n();var i=vl((function(){l<=1?r({isCanceled:function(){return i!==t.current}}):e(r,l-1)}));t.current=i},n]}(),s=vr(o,2),c=s[0],d=s[1];var u=n?bl:yl;return ul((function(){if(i!==jr&&i!==Br){var e=u.indexOf(i),t=u[e+1],n=r(i);n===xl?a(t,!0):t&&c((function(e){function r(){e.isCanceled()||a(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,i]),e.useEffect((function(){return function(){d()}}),[]),[function(){a(Vr,!0)},i]};var Sl=function(t){var n=t;"object"===ur(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var l=t.visible,a=void 0===l||l,s=t.removeOnLeave,c=void 0===s||s,d=t.forceRender,u=t.children,m=t.motionName,p=t.leavedClassName,h=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(Ir).motion),g=i(),v=i();var y=function(t,n,r,l){var a=l.motionEnter,s=void 0===a||a,c=l.motionAppear,d=void 0===c||c,u=l.motionLeave,m=void 0===u||u,p=l.motionDeadline,h=l.motionLeaveImmediately,f=l.onAppearPrepare,g=l.onEnterPrepare,v=l.onLeavePrepare,y=l.onAppearStart,b=l.onEnterStart,x=l.onLeaveStart,E=l.onAppearActive,w=l.onEnterActive,C=l.onLeaveActive,S=l.onAppearEnd,N=l.onEnterEnd,T=l.onLeaveEnd,I=l.onVisibleChanged,R=vr(Mr(),2),O=R[0],k=R[1],L=vr(Mr(Hr),2),A=L[0],P=L[1],F=vr(Mr(null),2),_=F[0],D=F[1],M=i(!1),H=i(null);function $(){return r()}var q=i(!1);function K(){P(Hr,!0),D(null,!0)}function j(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=q.current;A===$r&&r?n=null==S?void 0:S(t,e):A===qr&&r?n=null==N?void 0:N(t,e):A===Kr&&r&&(n=null==T?void 0:T(t,e)),A!==Hr&&r&&!1!==n&&K()}}var V=vr(dl(j),1)[0],z=function(e){var t,n,r;switch(e){case $r:return pr(t={},Vr,f),pr(t,zr,y),pr(t,Wr,E),t;case qr:return pr(n={},Vr,g),pr(n,zr,b),pr(n,Wr,w),n;case Kr:return pr(r={},Vr,v),pr(r,zr,x),pr(r,Wr,C),r;default:return{}}},W=e.useMemo((function(){return z(A)}),[A]),B=vr(Cl(A,!t,(function(e){if(e===Vr){var t=W[Vr];return t?t($()):xl}var n;return G in W&&D((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===Wr&&(V($()),p>0&&(clearTimeout(H.current),H.current=setTimeout((function(){j({deadline:!0})}),p))),G===Ur&&K(),El})),2),U=B[0],G=B[1],Y=wl(G);q.current=Y,ul((function(){k(n);var e,r=M.current;M.current=!0,!r&&n&&d&&(e=$r),r&&n&&s&&(e=qr),(r&&!n&&m||!r&&h&&!n&&m)&&(e=Kr);var l=z(e);e&&(t||l[Vr])?(P(e),U()):P(Hr)}),[n]),o((function(){(A===$r&&!d||A===qr&&!s||A===Kr&&!m)&&P(Hr)}),[d,s,m]),o((function(){return function(){M.current=!1,clearTimeout(H.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===Hr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=_;return W[Vr]&&G===zr&&(Q=fr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:br(v.current)}catch(e){return null}}),t),b=vr(y,4),x=b[0],E=b[1],w=b[2],C=b[3],S=e.useRef(C);C&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,Cr(r,e)}),[r]),I=fr(fr({},h),{},{visible:a});if(u)if(x===Hr)N=C?u(fr({},I),T):!c&&S.current&&p?u(fr(fr({},I),{},{className:p}),T):d||!c&&!p?u(fr(fr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Vr?O="prepare":wl(E)?O="active":E===zr&&(O="start");var k=cl(m,"".concat(x,"-").concat(O));N=u(fr(fr({},I),{},{className:Pe(cl(m,x),(R={},pr(R,k,k&&O),pr(R,m,"string"==typeof m),R)),style:w}),T)}else N=null;e.isValidElement(N)&&Nr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Dr,{ref:v},N)}));return r.displayName="CSSMotion",r}(al);function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nl.apply(this,arguments)}var Tl="add",Il="keep",Rl="remove",Ol="removed";function kl(e){var t;return fr(fr({},t=e&&"object"===ur(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Ll(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(kl)}var Al=["component","children","onVisibleChanged","onAllRemoved"],Pl=["status"],Fl=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Sl,r=function(t){Ar(l,e.Component);var r=_r(l);function l(){var e;Rr(this,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return pr(Fr(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),pr(Fr(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:fr(fr({},e),{},{status:Ol})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==Ol})).length})),e}return kr(l,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,l=this.props,i=l.component,a=l.children,o=l.onVisibleChanged,s=l.onAllRemoved,c=Tr(l,Al),d=i||e.Fragment,u={};return Fl.forEach((function(e){u[e]=c[e],delete c[e]})),delete c.keys,e.createElement(d,c,r.map((function(r){var l=r.status,i=Tr(r,Pl),c=l===Tl||l===Il;return e.createElement(n,Nl({},u,{key:i.key,visible:c,eventProps:i,onVisibleChanged:function(e){(null==o||o(e,{key:i.key}),e)||0===t.removeKey(i.key)&&s&&s()}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,l=Ll(n),i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,l=t.length,i=Ll(e),a=Ll(t);i.forEach((function(e){for(var t=!1,i=r;i<l;i+=1){var o=a[i];if(o.key===e.key){r<i&&(n=n.concat(a.slice(r,i).map((function(e){return fr(fr({},e),{},{status:Tl})}))),r=i),n.push(fr(fr({},o),{},{status:Il})),r+=1,t=!0;break}}t||n.push(fr(fr({},e),{},{status:Rl}))})),r<l&&(n=n.concat(a.slice(r).map((function(e){return fr(fr({},e),{},{status:Tl})}))));var o={};return n.forEach((function(e){var t=e.key;o[t]=(o[t]||0)+1})),Object.keys(o).filter((function(e){return o[e]>1})).forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==Rl}))).forEach((function(t){t.key===e&&(t.status=Il)}))})),n}(r,l);return{keyEntities:i.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==Ol||e.status!==Rl}))}}}]),l}();pr(r,"defaultProps",{component:"div"})}(al);const _l=t.forwardRef(((e,n)=>{const{forceRender:r,className:l,style:i,boxStyle:a,isActive:o}=e,[s,c]=t.useState(o||r);if(t.useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=ir("collapse");return t.createElement("div",{ref:n,className:Pe(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},l),style:i},t.createElement("div",{className:`${d}-content-box`,style:a},e.children))}));_l.displayName="PanelContent";const Dl=e=>{const{defaultActive:n,label:r,extra:l,className:i,style:a,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=t.useState(!!n),f=ir("collapse"),g=Pe({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},i);return t.createElement("div",{className:g,style:a},t.createElement(ar,{label:r,extra:l,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),null==m||m(e)}}),t.createElement(Sl,Rn({visible:p},((e=ir("motion-collapse"))=>({motionName:e,onAppearStart:or,onEnterStart:or,onAppearActive:sr,onEnterActive:sr,onLeaveStart:cr,onLeaveActive:or,onAppearEnd:dr,onEnterEnd:dr,onLeaveEnd:dr,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:n,style:r},l)=>t.createElement(_l,{ref:l,prefixCls:f,className:n,style:r,boxStyle:o,isActive:p,forceRender:d},e.children))))};Dl.displayName="QmCollapse";const Ml=t.createContext(void 0);function Hl(t,n){((t,n)=>{const r=e.useRef(!0);e.useEffect((()=>t(r.current)),n),e.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})((e=>{if(!e)return t()}),n)}const $l=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},ql=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Kl=e=>e.preventDefault(),jl=(e,t)=>{if(qn||!e||!t)return null;"float"===(t=Un(t))&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=window.getComputedStyle(e);return r?r[t]:""}catch(n){return e.style[t]}},Vl=(e,t,n)=>{!qn&&e&&t&&(ae(t)?Object.keys(t).forEach((n=>{Vl(e,n,t[n])})):(t=Un(t),e.style[t]=n))},zl=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Wl=(e,t)=>Math.abs(zl(e)-zl(t)),Bl=e=>{let t=0,n=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:n}},Ul=(e,t)=>{var n;let r=e;for(;r;){if(null===(n=r.classList)||void 0===n?void 0:n.contains(t))return r;r=r.parentNode}return null},Gl=(e,t)=>{if(qn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Yl=e=>Math.pow(e,3),Xl=e=>e<.5?Yl(2*e)/2:1-Yl(2*(1-e))/2,Ql=e=>{const{minValues:n,onDragChange:r,onDragging:l}=e,{splitRef:i,direction:a}=t.useContext(Ml),{t:o}=Mn(),s=t.useRef(qn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===a),[a]),d=t.useMemo((()=>c?"X":"Y"),[c]),u=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const t=e[`page${d}`]-u.current[`start${d}`],r=[n[0],u.current[`containerSize${d}`]-n[1]];let i=u.current[`firstElementSize${d}`]+t;i=Math.max(r[0],i),i=Math.min(r[1],i),l(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),ql(document,"mousemove",p),ql(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${ir("split")}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return t.createElement("div",{className:Pe(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=i.current,n=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),$l(document,"mousemove",p),$l(document,"mouseup",h),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Ql.displayName="ResizeBar";const Zl=t.forwardRef(((e,n)=>{const{offset:r,className:l,style:i}=e,{direction:a,dragging:o}=t.useContext(Ml),s="vertical"===a?"height":"width",c={[ir("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[l]:!!l},d=void 0!==r?{[s]:Zn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:Pe(c),style:Object.assign(Object.assign({},d),i)},e.children)}));Zl.displayName="SplitPane";const Jl=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:l,className:i,style:a,onDragStart:o,onDrag:s=Vn,onDragEnd:c}=e,{global:d}=t.useContext(on),u=t.useRef(null),m=t.useRef(null),p=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,h=e=>Number.parseInt(e,10),f=e=>{var t;const n=Number.parseInt((null===(t=e.props)||void 0===t?void 0:t.min)||0);return n>=0?n:0},g=t.useMemo((()=>l?`split_${l}`:""),[l]),[v,y]=t.useState(!1),[b,x]=t.useState(p(r));Hl((()=>{v?null==o||o(h(b)):(null==c||c(h(b)),localStorage.setItem(g,b),C(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(p(e)):w(g).then((e=>{localStorage.setItem(g,p(e||r)),E()})).catch((()=>{}))},w=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),C=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),S=t.useMemo((()=>({splitRef:u,direction:n,dragging:v})),[n,v]),N=[];t.Children.map(e.children,(e=>{var t;Kn(e)&&!jn(e)&&"SplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const[T,I]=N,R=t.useMemo((()=>[f(T),f(I)]),[T,I]),O={[ir("split")]:!0,vertical:"vertical"===n};return t.createElement(Ml.Provider,{value:S},t.createElement("div",{ref:u,className:Pe(O,i),style:a},t.createElement(Zl,Rn({},T.props,{ref:m,offset:b})),t.createElement(Ql,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Zl,I.props)))};Jl.displayName="QmSplit",Jl.Pane=Zl;const ei=e=>{const{className:n,style:r}=e,{$size:l}=$n(e),i=ir("countup"),a={[i]:!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l};return t.createElement($t,Rn({},e,{className:Pe(a,n),style:r}),e.children)};ei.displayName="QmCountup";const ti=e=>{const{className:n}=e,{$size:r}=$n(e),l=ir("empty"),i=Object.assign(Object.assign({},e),{image:N.PRESENTED_IMAGE_SIMPLE}),a={[l]:!0,[`${l}--lg`]:"large"===r,[`${l}--sm`]:"small"===r};return t.createElement(N,Rn({},i,{className:Pe(a,n)}))};ti.displayName="QmEmpty";const ni=e=>{const n=mn({tip:"Loading..."},e),{fullHeight:r,className:l,style:i}=n,a=ir("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:Pe(o,l)},Xn(n,["fullHeight"])),{style:Object.assign(Object.assign({},i),{maxHeight:"none"})});return t.createElement(T,s,n.children)};ni.displayName="QmSpin";const ri=t.createContext(void 0),li=new Map;const ii=new qt((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=li.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function ai(e,t){li.has(e)||(li.set(e,new Set),ii.observe(e)),li.get(e).add(t)}function oi(e,t){li.has(e)&&(li.get(e).delete(t),li.get(e).size||(ii.unobserve(e),li.delete(e)))}function si(t){const[n,r]=e.useState({width:0,height:0});return e.useLayoutEffect((()=>{const e=t.current,n=e=>{r({width:e.offsetWidth,height:e.offsetHeight})};return e&&ai(e,n),()=>{e&&oi(e,n)}}),[t]),n}function ci(t,n){const r=e.useRef(null);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{r.current&&clearTimeout(r.current),r.current=setTimeout((()=>t.apply(this,e)),n)}),[t,n])}const di=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,ui=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],mi=e=>({_s:e,status:ui[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),pi=e=>e?6:5,hi=(e,t,n,r,l)=>{clearTimeout(r.current);const i=mi(e);t(i),n.current=i,null==l||l({current:i})},fi=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:l,timeout:a,initialEntered:d,mountOnEnter:u,unmountOnExit:m,onStateChange:p}=e||{},[h,f]=s((()=>mi(d?2:pi(u)))),g=i(h),v=i(),[y,b]=(e=>ae(e)?[e.enter,e.exit]:[e,e])(a),x=c((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return pi(t)}})(g.current._s,m);e&&hi(e,f,g,v,p)}),[p,m]),E=c((e=>{const i=e=>{switch(hi(e,f,g,v,p),e){case 1:y>=0&&(v.current=setTimeout(x,y));break;case 4:b>=0&&(v.current=setTimeout(x,b));break;case 0:case 3:v.current=setTimeout((()=>i(e+1)),0)}},a=g.current.isEnter;"boolean"!=typeof e&&(e=!a),e?!a&&i(t?r?0:1:2):a&&i(n?l?3:4:pi(m))}),[x,p,t,n,r,l,y,b,m]);return o((()=>()=>clearTimeout(v.current)),[]),[h,E,x]},gi=e=>{const{name:n,in:r,timeout:l,preEnter:i=!0,preExit:a}=e,[o,s]=fi({timeout:l,preEnter:i,preExit:a,initialEntered:r});return hn((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?di(e,{className:Pe(e.props.className,n,o.status)}):e)))},vi=6,yi={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},bi=e=>{const{thumb:n,always:r,className:l,barSize:i=vi,direction:a="vertical",onDrag:o=Vn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(ri),u=yi[a],m=t.useRef(null),p=t.useRef(null),h=t.useRef({}),f=t.useRef(!1),g=t.useRef(!1),v=t.useRef(qn?null:document.onselectstart),[y,b]=t.useState(!1);t.useEffect((()=>{const e=c.current;return $l(e,"mousemove",C),$l(e,"mouseleave",S),()=>{w(),ql(document,"mouseup",E),ql(e,"mousemove",C),ql(e,"mouseleave",S)}}),[]);const x=e=>{if(!m.current||!p.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const n=100*(-1*(m.current.getBoundingClientRect()[u.direction]-e[u.client])-(p.current[u.offset]-t))/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},ql(document,"mousemove",x),ql(document,"mouseup",E),w(),g.current&&b(!1),o(!1)},w=()=>{document.onselectstart!==v.current&&(document.onselectstart=v.current)},C=Hn((()=>{g.current=!1,b(!!n.size)})),S=Hn((()=>{g.current=!0,b(f.current)})),N=ir("scrollbar"),T={[`${N}__bar`]:!0,"is-vertical":"vertical"===a,"is-horizontal":"horizontal"===a},I={[u.reverse]:i},R={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(gi,{name:"fade",in:r||s||y,timeout:300},t.createElement("div",{ref:m,className:Pe(T,l),style:I,onMouseDown:e=>{const t=e.target;if(!t)return;const n=100*(Math.abs(t.getBoundingClientRect()[u.direction]-e[u.client])-p.current[u.offset]/2)/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100}},t.createElement("div",{ref:p,className:`${N}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),$l(document,"mousemove",x),$l(document,"mouseup",E),f.current=!0,v.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},xi=20,Ei=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:l,innerStyle:i,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=xi,onScroll:u}=e,m=t.useRef(null),p=t.useRef(null),h=t.useRef(null),[f,g]=t.useState({size:0,offset:0,ratio:1}),[v,y]=t.useState({size:0,offset:0,ratio:1}),[b,x]=t.useState(!1),E=si(m),w=si(h);hn((()=>{!s&&C()}),[w.width,w.height,E.width,E.height]);const C=ci((()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=Math.pow(e,2)/p.current.scrollHeight,r=Math.pow(t,2)/p.current.scrollWidth,l=Math.max(n,d),i=Math.max(r,d),a=n/(e-n)/(l/(e-l)),o=r/(t-r)/(i/(t-i)),s=l+4<e?l:0,c=i+4<t?i:0,u=100*p.current.scrollTop/e*a,m=100*p.current.scrollLeft/t*o;g(Object.assign({},f,{size:c,ratio:o,offset:m})),y(Object.assign({},v,{size:s,ratio:a,offset:u}))}),5),S=e=>{x(e)},N=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,l=window.requestAnimationFrame,i=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollTop=r+(t-r)*Xl(a),l(i)):e.scrollTop=t};l(i)})(p.current,e):p.current.scrollTop=e:tr("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,l=window.requestAnimationFrame,i=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollLeft=r+(t-r)*Xl(a),l(i)):e.scrollLeft=t};l(i)})(p.current,e):p.current.scrollLeft=e:tr("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:m.current,scrollTop:(null===(e=p.current)||void 0===e?void 0:e.scrollTop)||0,scrollLeft:(null===(t=p.current)||void 0===t?void 0:t.scrollLeft)||0,SET_SCROLL_TOP:N,SET_SCROLL_LEFT:T}}));const I=t.useMemo((()=>({dragging:b,scrollbarElement:m,wrapElement:p})),[b]),R=ir("scrollbar"),O={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!s};return t.createElement("div",{ref:m,className:Pe(R,e.className),style:e.style},t.createElement("div",{ref:p,className:Pe(O,r),style:l,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=100*p.current.scrollTop/e*v.ratio,r=100*p.current.scrollLeft/t*f.ratio;g(Object.assign({},f,{offset:r})),y(Object.assign({},v,{offset:n}))})(),null==u||u({scrollTop:t,scrollLeft:n})}},t.createElement("div",{ref:h,className:`${R}__view`,style:i},e.children)),!s&&t.createElement(ri.Provider,{value:I},c&&t.createElement(bi,{className:"top",direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(bi,{direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(bi,{direction:"vertical",thumb:v,barSize:a,always:o,onDrag:S})))}));Ei.displayName="QmScrollbar";const wi=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let r=document.createElement("a");r.href=n,r.download=decodeURI(t),r.click(),r=null}},Ci=(e,{fileName:t,headers:n,params:r})=>Dn(void 0,void 0,void 0,(function*(){const l=r?new URLSearchParams(r).toString():"",i=l?e.includes("?")?"&":"?":"",a=yield fetch(e+`${i+l}`,{method:"GET",headers:n});if(!a.ok)throw new Error(un("qm.download.error"));const o=yield a.blob(),s=a.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));wi(o,c)})),Si=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Ni=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Ti=e=>{var n,r;const l=mn({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:i=[],fileDirection:a="vertical",batchDownload:o,draggable:s,editable:c,disabled:d,readOnly:u,button:m={},className:p,onPreview:h,onSortChange:f,onEditChange:g,onDownload:v,onChange:y}=l,{t:b}=Mn(),{$size:x}=$n(l),w=t.useRef(null),C=t.useRef(null),[S,N]=t.useState({}),T=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(A(),()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.destroy()})),[]);const k=(e,t)=>{N((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},L=Hn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...i],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:i[t],fileList:e})}})),A=()=>{s&&(C.current=Kt.create(Ul(w.current,ir("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:L}))},P=e=>Dn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=l;try{e.url&&(yield Ci(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){R.error(b("qm.download.error"))}})),F=ir("upload-file"),_={[F]:!0,[`${F}--lg`]:"large"===x,[`${F}--sm`]:"small"===x,[`${F}--horizontal`]:"horizontal"===a};return t.createElement(I,Rn({className:Pe(_,p)},Xn(l,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>Dn(void 0,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:a,maxCount:o,fileList:s=[],beforeUpload:c}=l,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!a||e.size/1024/1024<a,m=!(o>1)||s.length<o,p=d&&u&&m;if(d||R.warning(b("qm.upload.tooltip",{type:i.join(",")})),u||R.warning(b("qm.upload.sizeLimit",{size:a})),m||R.warning(b("qm.upload.countLimit",{count:o})),!p)return I.LIST_IGNORE;if(c){const l=c(e,t);if(!0===l)return n(e);if(!1===l)return r("not upload");if(l&&"function"==typeof l.then)try{const e=yield l;n(e)}catch(e){r(e)}}else n(e)})))),disabled:T,onChange:y,onPreview:e=>Dn(void 0,void 0,void 0,(function*(){if("function"==typeof h)return h(e,(t=>P(t||e)));d||(yield P(e))})),onDownload:e=>Dn(void 0,void 0,void 0,(function*(){yield P(e)})),itemRender:(e,n,r,a)=>((e,n)=>{const{iconRender:r}=l,{uid:a,name:o,url:u,status:m="done"}=e,p="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return t.createElement("div",{className:Pe("ant-upload-list-item",`ant-upload-list-item-${m}`,"ant-upload-list-item-list-type-text",{handle:s})},t.createElement("div",{className:"ant-upload-list-item-info"},t.createElement("span",{className:"ant-upload-span"},t.createElement("div",{className:"ant-upload-text-icon"},r?r(e):t.createElement(Me,null)),t.createElement("div",{className:"ant-upload-list-item-name"},S[a]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:Si(o),onBlur:t=>{const{value:n}=t.target;if(n!==Si(o)){const t=Object.assign({},e,{name:`${n}.${Ni(o)}`}),r=i.map((e=>e.uid!==a?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}k(a,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?T||k(a,!0):n.preview()}},o)),t.createElement("span",{className:"ant-upload-list-item-card-actions"},c&&!T&&t.createElement("button",{type:"button",className:p,onClick:()=>k(a)},S[a]?t.createElement($e,null):t.createElement(He,null)),c&&t.createElement("button",{type:"button",className:Pe(p,"preview"),onClick:()=>n.preview()},t.createElement(qe,null)),t.createElement("button",{type:"button",className:Pe(p,"download"),disabled:d,onClick:()=>n.download()},t.createElement(Ke,null)),t.createElement("button",{type:"button",className:Pe(p,"delete"),disabled:T,onClick:()=>n.remove()},t.createElement(je,null))))))})(n,a)}),t.createElement("span",{className:"inner",ref:w},l.children||u&&i.length?l.children:t.createElement(E,{type:null!==(n=m.type)&&void 0!==n?n:"default",icon:null!==(r=m.icon)&&void 0!==r?r:t.createElement(De,null),disabled:T},m.text||b("qm.upload.text")),o&&!!i.length&&t.createElement(E,{disabled:d,style:{marginLeft:8},onClick:e=>Dn(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),"function"==typeof o)yield o(i);else for(const e of i)yield P(e)}))},b("qm.upload.batchDownload"))))};Ti.displayName="QmUploadFile";const Ii=e=>{const n=mn({icon:t.createElement(Ke,null),withCredentials:!1},e),{$size:r}=$n(n),{t:l}=Mn(),[i,a]=t.useState(!1),o=Xn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,Rn({},o,{size:r,loading:i,onClick:()=>Dn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:i,beforeDownload:a=zn,onSuccess:o}=n,s=ce(e)?e:yield Dn(void 0,void 0,void 0,(function*(){const e=n.action;if(e.api)try{const t=yield e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}));if(!s)return tr("Download","参数 `action` 有误!");if(!a(s))return;yield Ci(s,{fileName:t,headers:r,params:i}),yield Wn(100),null==o||o(),R.success(l("qm.download.success"))}catch(t){null===(e=n.onError)||void 0===e||e.call(n,t),R.error(l("qm.download.error"))}a(!1)}))}),n.children||l("qm.download.text"))};function Ri(t,n){const r=e.useRef(null),l=e.useRef(0);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{const r=Date.now();(!l.current||r-l.current>n)&&(t.apply(this,e),l.current=r)}),[t,n])}Ii.displayName="QmDownload";const Oi=e=>{const{activeKey:n,labels:r,onTabClick:l}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const i={item:!0,actived:r===n};return t.createElement("div",{key:r,className:Pe(i),onClick:e=>l(r,e)},t.createElement("span",null,e))})))},ki=e=>{const{label:n,showDivider:r,className:l,style:i}=e,a={[ir("anchor-item")]:!0};return t.createElement("div",{className:Pe(a,l),style:i},r&&t.createElement(ar,{label:n,style:{marginBottom:10}}),e.children)};ki.displayName="AnchorItem";const Li=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:l,labelWidth:i,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=$n(e),u=t.useRef(null),m=t.useRef(),p=t.useRef("ready"),h=t.useRef(0),[f,g]=t.useState(l||0),v=t.useMemo((()=>!!(null==r?void 0:r.length)),[r]);t.useEffect((()=>{y();const e=jt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=Wl(x(f),u.current))},b=e=>{const t=Math.abs(e),n=(v?r.map((e=>document.getElementById(e.id))):Array.from((null===(l=u.current)||void 0===l?void 0:l.children)||[])).map((e=>Wl(e,u.current)));var l;let i=-1;for(let e=0;e<n.length;e++){const r=n[e],l=n[e+1]||1e4;t>=r-1&&t<l&&(i=e)}return i},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=Ri((e=>{if("ready"!==p.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),w=e=>{const t=x(e);t&&(g(e),p.current="stop",m.current&&clearTimeout(m.current),Vt(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>p.current="ready"),500))};t.useImperativeHandle(n,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,w(e)}})));const C=ir("anchor"),S={[C]:!0,[`${C}-left`]:"left"===a,[`${C}-top`]:"top"===a,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;Kn(e)&&!jn(e)&&"AnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const T=v?r.map((e=>e.label)):N.map((e=>e.props.label)),I=v?r.map((e=>e.id)):N.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=T.length,t.createElement("div",{className:Pe(S,s),style:c},t.createElement("div",{className:Pe("anchor-nav"),style:{width:i?Zn(i):""}},t.createElement(Oi,{activeKey:f,labels:T,onTabClick:(e,t)=>{w(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:Pe("anchor-container")},v?e.children:N))}));Li.displayName="QmAnchor",Li.Item=ki;const Ai=e=>t.createElement(k.TabPane,e,e.children);Ai.displayName="TabPane";const Pi=e=>{const n=mn({tabPosition:"top"},e),{items:r,tabPosition:l,tabBarGutter:i,className:a,authConfig:o}=n,{$size:s}=$n(n),c=ir("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Xn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=i?i:["top","bottom"].includes(l)?30:0}),m=[];t.Children.map(n.children,(e=>{var t;Kn(e)&&!jn(e)&&"TabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&m.push(e)}));const p=r?[...r]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<p.length;t++){const n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:l=1,disabled:i}=r||{};l?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return t.createElement(k,Rn({},u,{items:p,className:Pe(d,a)}))};Pi.displayName="QmTabs",Pi.TabPane=Ai;const Fi=t.forwardRef(((e,n)=>{var r;const l=mn({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:i,open:a,className:o,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:h,onFullChange:f}=l,{global:g}=t.useContext(on),{$size:v}=$n(l),y=t.useRef(null),b=t.useRef(null),x=t.useRef(!1),[E,w]=t.useState(!1),[C,S]=t.useState(!1),[N,T]=t.useState(!1);Hl((()=>{(null!=a?a:i)&&(!m&&x.current||de(s)&&S(!0))}),[null!=a?a:i]),Hl((()=>{b.current&&Vl(b.current,E?{width:"100%"}:{width:Zn(l.width||"72%")})}),[E]);const I=()=>{b.current=Ul(y.current,"ant-drawer-content-wrapper"),w(!E),null==f||f(!E)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=ir("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===v,[`${R}--sm`]:"small"===v};return t.createElement(L,Rn({},Xn(l,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=a?a:i,maskClosable:null!==(r=null!=u?u:null==g?void 0:g.maskClosable)&&void 0!==r&&r,className:Pe(O,o),title:t.createElement(t.Fragment,null,t.createElement("span",{ref:y,className:"text"},c&&l.title),d&&t.createElement("button",{type:"button",className:"full-screen",onClick:I},t.createElement(E?Ve:ze))),footer:null,afterOpenChange:e=>{e?(x.current=!0,de(s)&&setTimeout((()=>S(!1)),100)):(w(!1),null==h||h())},onClose:p}),l.children,(s||N||C)&&t.createElement(ni,{spinning:!0,className:Pe("spinning")}))}));Fi.displayName="QmDrawer";const _i="10vh";var Di;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Di||(Di={}));const Mi=t.forwardRef(((e,n)=>{var r;const l=mn({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:_i}},e),{visible:i,open:a,width:o,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:p,maskClosable:h,destroyOnClose:f,bodyStyle:g,onFullChange:v,onClose:y,onClosed:b}=l,{global:x}=t.useContext(on),{$size:E}=$n(l),w=t.createRef(),C=t.useRef(!1),S=t.useMemo((()=>`calc(100vh - ${_i} - ${_i} - ${Di[m?E:"none"]}px)`),[E,m]),[N,T]=t.useState(!1),[I,R]=t.useState(!1),[O,k]=t.useState(!1),[L,P]=t.useState(!0),[F,_]=t.useState({left:0,top:0,bottom:0,right:0}),[D,M]=t.useState();Hl((()=>{if(null!=a?a:i){if(!f&&C.current||de(d)&&R(!0),!f&&C.current)return;setTimeout((()=>{C.current=!0,de(d)&&R(!1)}),400)}}),[null!=a?a:i]),Hl((()=>{M(N?{x:0,y:0}:void 0)}),[N]);const H=e=>{const t=Ul(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");N?(Vl(t,{width:Zn(o||"60%"),height:"auto",top:_i}),Vl(n,{height:s?Zn(s):S,maxHeight:"auto"===s?S:""})):(Vl(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Vl(n,{height:`calc(100vh - ${Di[m?E:"none"]}px)`,maxHeight:""})),T(!N),null==v||v(!N)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const $=ir("modal"),q={height:s?Zn(s):S,maxHeight:"auto"===s?S:"",overflow:"auto"},K={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===E,[`${$}--sm`]:"small"===E};return t.createElement(A,Rn({},Xn(l,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=a?a:i,maskClosable:null!==(r=null!=h?h:null==x?void 0:x.maskClosable)&&void 0!==r&&r,className:Pe(K,c),title:t.createElement("div",{onMouseOver:()=>{L&&P(!1)},onMouseOut:()=>{P(!0)}},t.createElement("span",{className:"text"},m&&l.title),p&&t.createElement("button",{type:"button",className:"full-screen",onClick:H},t.createElement(N?Ve:ze))),footer:null,bodyStyle:Object.assign({},q,g),onCancel:y,afterClose:()=>{null==b||b(),T(!1)},modalRender:e=>t.createElement(zt,{nodeRef:w,bounds:F,position:D,disabled:!u||L||N,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,l=w.current.getBoundingClientRect();l&&_({left:-l.left+t.x,right:n-(l.right-t.x)-1,top:-l.top+t.y,bottom:r-(l.bottom-t.y)-1})})(0,t)},t.createElement("div",{ref:w},e))}),l.children,(d||O||I)&&t.createElement(ni,{spinning:!0,className:Pe("spinning")}))}));Mi.displayName="QmModal";const Hi=n(void 0);var $i={string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e,t){return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let n=0,r=(e=Array.isArray(e)?e:[e]).length;n<r;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<r-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,n){return e.split(t).join(n)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != ")}};const qi=["==","<",">","<=",">=","!=","like","nlike","likes","in","nin","^=","=$","nil","nnil"];var Ki=function(e){let t=0;const n=e.length;for(let r=0;r<n;r++){const n=e.charAt(r);"("===n&&t++,")"===n&&t--}return 0===t},ji=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const r=n.split(" ").filter((e=>""!==e));for(let e=0;e<r.length;e++)qi.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),qi.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const Vi=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,zi=["string","number","boolean","symbol"],Wi=e=>zi.includes(typeof e),Bi=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Ui=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(new RegExp(Oa,"g")," ").replace(Vi,"\\$1"),"i"),Gi=(e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Ui(n));break;case"nlike":r=null===e.toString().match(Ui(n));break;case"likes":r=n.split(/,|,/).some((t=>Gi(e,"like",t)));break;case"in":Wi(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Wi(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"^=":r=e.toString().startsWith(n);break;case"=$":r=e.toString().endsWith(n);break;case"nil":r=""===e||null==e;break;case"nnil":r=!Gi(e,"nil",null);break;case"!=":case"<>":r=(Bi(e)?e.slice(0,10):e)!=n;break;case"<":r=(Bi(e)?e.slice(0,10):e)<n;break;case"<=":r=(Bi(e)?e.slice(0,10):e)<=n;break;case">":r=(Bi(e)?e.slice(0,10):e)>n;break;case">=":r=(Bi(e)?e.slice(0,10):e)>=n;break;default:r=(Bi(e)?e.slice(0,10):e)==n}return r};window.__query__=(...e)=>Gi(e[0],e[1],e[2]);const Yi=$i.stringify,Xi=$i.array_format,Qi=Ki,Zi=(e,t,n)=>{let r=[];t=$i.replace_symbols(t);try{if(n){const n=new Function("record",`return ${ji(t,"record")};`);r=Da(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${ji(t,"array[i]")};`);for(let t=0,l=e.length;t<l;t++)n(e,t)&&r.push(e[t])}}catch(t){tr("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Ji=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ji(e.children)):t.push(e)})),t},ea=e=>e.filter((e=>(e.children&&(e.children=ea(e.children)),!e.hidden&&!e.noAuth))),ta=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...ta(e.children))})),t},na=(e,t)=>e.map((e=>(e.children&&(e.children=na(e.children,t)),null==t||t(e),e))),ra=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=ra(n.children,t);if(e)return e}}return null},la=e=>{const t=e.children;return t?t[0].children?la(t[0]):t[0]:e},ia=e=>{const t=e.children;return t?t[t.length-1].children?ia(t[t.length-1]):t[t.length-1]:e},aa=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),oa=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=oa(n.children,t);if(e)return e}}return null},sa=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...sa(e.children))})),t},ca=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ca(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},da=e=>{let t=1;const n=(e,r)=>{var l;if(r&&(e.level=r.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((r=>{e.fixed?r.fixed=e.fixed:delete r.fixed,n(r,e),t+=r.colSpan})),e.colSpan=t}else e.colSpan=null!==(l=e.colSpan)&&void 0!==l?l:1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return ta(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},ua=e=>Object.assign(e,{__prevent__:!0}),ma=e=>e.__prevent__,pa=e=>{delete e.__prevent__},ha=(e,t,n={left:0,top:0})=>{if(e){const r=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,r&&r!==document.documentElement&&r!==document.body&&(n.top-=r.scrollTop,n.left-=r.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return ha(e.offsetParent,t,n)}return n},fa=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ga=(e,t)=>pe(e,((e,n,r)=>{he(n,t[r])||(e[r]=ae(n)&&ae(t[r])?ga(n,t[r]):n)})),va=(e,t)=>{var n;return null!==(n=ue(e,t))&&void 0!==n?n:""},ya=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),me(e,t,null!=n?n:"")},ba=(e,t)=>{if(!t.includes("|"))return va(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(va(e,t))})),n.every((e=>!e))?"":n.join(" | ")},xa=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Ea=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],l="";for(;r.length>3;)l=`,${r.slice(-3)}${l}`,r=r.slice(0,r.length-3);return r&&(l=r+l),`${n}${l}${t[1]?`.${t[1]}`:""}`},wa=(e,t)=>{const n=e.toString();if(!xa(n)||0===t)return e;const r=Number.parseFloat(n).toString(),l=r.indexOf(".");if(-1===l)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-l-1));return r+"0".repeat(i)},Ca=(e,t)=>e?p(e,t):null,Sa=(e,t)=>e?p(e).format(t):"",Na=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},Ta=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...Ta(e))}))}else n.push(e);return n},Ia=e=>Ta(e).join(""),Ra=e=>e.filter((e=>!e._group)),Oa="",ka=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let l=0,i=e.length;l<i;l++){const i=e[l];if(!i.fieldName)continue;const a=Array.isArray(i.condition)?Xi(i.condition):Yi(i.condition,Oa);n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${a} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[l,i]=r.includes("|")?r.split("|"):[r,""],a=e[r];for(const e in a){n+=`${t?`${l}|${i}`:l} ${e} ${Array.isArray(a[e])?Xi(a[e]):Yi(a[e],Oa)} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},La=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(va(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},Aa=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].dataIndex===t)return[e[n]];if(Array.isArray(e[n].children)){const r=Aa(e[n].children,t);if(r)return[e[n],r].flat()}}},Pa=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].rowKey===t)return[t];if(Array.isArray(e[n].children)){const r=Pa(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},Fa=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=Fa(n.children,t);if(e)return e}if(t(n))return n}return null},_a=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(..._a(e[n].children)),t.push(e[n].rowKey);return t},Da=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Da(e.children,t),t(e)||e.children&&e.children.length))),Ma=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Ha=(e,t,n=!1)=>{const r=new Set;return function e(t,l,i=1){if(r.has(t))return!1;if(t===l)return!0;if(n&&i>1)return!1;r.add(t);const a=i+1;if(Array.isArray(t)){if(!Array.isArray(l)||t.length!==l.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],l[n],a))return!1;return!0}if(t&&l&&"object"==typeof t&&"object"==typeof l){const n=Object.keys(t);return n.length===Object.keys(l).length&&n.every((n=>e(t[n],l[n],a)))}return!1}(e,t)},$a=e=>["nil","nnil"].includes(e),qa=(e,t,n)=>{if(!Object.keys(t).length||!e.length)return e;if(!n)return e.filter((e=>Ka(e,t)));const r=new Map,l=new Set;for(const n of e)if(r.set(n._rowKey,n),Ka(n,t)){let e=n;for(;e&&!l.has(e._rowKey);)l.add(e._rowKey),e=r.get(e._parentRowKey)}return e.filter((e=>l.has(e._rowKey)))};function Ka(e,t){for(const n in t){const r=t[n],l=va(e,n);if(r&&!r.includes(l))return!1}return!0}const ja=e=>["","small","middle","large"].includes(e),Va=80,za="1",Wa="0",Ba=400,Ua=["RANGE_INPUT","RANGE_INPUT_NUMBER","RANGE_SEARCH_HELPER","MULTIPLE_CHECKBOX","MULTIPLE_SELECT","RANGE_DATE","RANGE_TIME","MULTIPLE_TREE_SELECT","MULTIPLE_SEARCH_HELPER","MULTIPLE_TREE_TABLE_HELPER","MULTIPLE_CASCADER","UPLOAD_IMG","UPLOAD_FILE"],Ga={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Ya,Xa,Qa;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ya||(Ya={})),function(e){e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY"}(Xa||(Xa={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Qa||(Qa={}));const Za={items:Ut.arrayOf(Ut.shape({type:Ut.string.isRequired,fieldName:Ut.string.isRequired})),initialValues:Ut.object,initialExtras:Ut.object,layout:Ut.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!ja(e[t]||""))return er("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Ut.number,className:Ut.string,style:Ut.object,compactMode:Ut.bool,labelWidth:Ut.oneOfType([Ut.number,Ut.string]),labelAlign:Ut.oneOf(["left","right"]),labelWrap:Ut.bool,formType:Ut.oneOf(["default","search","onlyShow"]),disabled:Ut.bool,uniqueKey:Ut.string,defaultRows:Ut.number,defaultExpand:Ut.bool,searchButtonCols:Ut.number,scrollToFirstError:Ut.bool,authConfig:Ut.object,isAutoFocus:Ut.bool,isCollapse:Ut.bool,isFieldsDefine:Ut.bool,isSearchBtn:Ut.bool,isSubmitBtn:Ut.bool,fieldsChange:Ut.func,onValuesChange:Ut.func,onFieldsChange:Ut.func,onFinish:Ut.func,onFinishFailed:Ut.func,onReset:Ut.func,onCollapse:Ut.func},Ja={layout:"horizontal",labelWidth:Va,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Vn,onFieldsChange:Vn,onFinish:Vn,onFinishFailed:Vn,onReset:Vn,onCollapse:Vn},eo=(e,t)=>{if(!e)return null;if(t===Xa.week){const t=e.match(/^(\d{4})-(\d+)/);return t?p().year(Number(t[1])).week(Number(t[2])):null}if(t===Xa.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?p().year(Number(t[1])).quarter(Number(t[2])):null}return p(e,t)},to=(e,t)=>e?p(e).format(t):"",no=e=>""===e||null==e,ro=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let l="";for(let t=0,i=r.length;t<i;t++){l+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===i-1?"":" | ")}return l},lo=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const l=t[r].split("|"),i=n[r].split("|");l.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},io=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const l=t[r].split("|"),i=n[r].split("|");l.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},ao=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),de(e.isLeaf)||(r.isLeaf=!!e.isLeaf),de(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=ao(e.children,t,n)),r})),oo=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=oo(n.children,t);if(e)return e}}return null},so=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...so(e.children,t,n+1))})),r},co=e=>Kn(e)||"string"==typeof e,uo=e=>Kn(e)?Ta(e).join(""):null!=e?e:"",mo=(e,t,n,r)=>{var l;const i={};return i.filters=(null===(l=e.filters)||void 0===l?void 0:l.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t})))||[],i.table={columns:e.columns||[],rowKey:e.valueName},i.fieldsDefine={valueKey:e.valueKey||e.valueName},i.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(i.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(i.echoRequest={fetchApi:n(e.echoSetting.api),formatter:t=>{var n;return Object.assign({},t,{[e.echoSetting.paramKey]:null!==(n=t.key)&&void 0!==n?n:t.keys})},dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(i.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(i.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(i.columns=e.emmediateSetting.columns,i.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),i};var po={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{"曾":"ZENG","沈":"SHEN","嗲":"DIA","碡":"ZHOU","聒":"GUO","炔":"QUE","蚵":"KE","砉":"HUA","嬤":"MO","嬷":"MO","蹒":"PAN","蹊":"XI","丬":"PAN","霰":"XIAN","莘":"XIN","豉":"CHI","饧":"XING","筠":"JUN","长":"CHANG","帧":"ZHEN","峙":"SHI","郍":"NA","芎":"XIONG","谁":"SHUI"}};const ho="阿",fo="鿿",go=1,vo=2,yo=3;let bo,xo=null;function Eo(e){return e||null===xo?("object"==typeof Intl&&Intl.Collator?(bo=new Intl.Collator(["zh-Hans-CN","zh-CN"]),xo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):xo=!1,xo):xo}function wo(e){const t=po.UNIHANS,n=po.PINYINS,r=po.EXCEPTIONS,l={source:e};if(e in r)return l.type=vo,l.target=r[e],l;let i,a=-1;if(e.charCodeAt(0)<256)return l.type=go,l.target=e,l;if(i=bo.compare(e,ho),i<0)return l.type=yo,l.target=e,l;if(0===i)l.type=vo,a=0;else{if(i=bo.compare(e,fo),i>0)return l.type=yo,l.target=e,l;0===i&&(l.type=vo,a=t.length-1)}if(l.type=vo,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const l=t[a];if(i=bo.compare(e,l),0===i)break;i>0?n=a+1:r=a-1}}return i<0&&a--,l.target=n[a],l.target||(l.type=yo,l.target=l.source),l}function Co(e){return"string"==typeof e&&Eo()?e.split("").map((e=>wo(e))):e}var So={isSupported:Eo,parse:Co,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(po)})))},genToken:wo,convertToPinyin:(e,t,n)=>Co(e).map((e=>t&&e.type===vo?e.target.toLowerCase():e.target)).join(n||"")};var No={patcher:function(e){e.EXCEPTIONS={"嗲":"DIA","碡":"ZHOU","聒":"GUO","炔":"QUE","蚵":"KE","砉":"HUA","嬷":"MO","蹊":"XI","丬":"PAN","霰":"XIAN","豉":"CHI","饧":"XING","帧":"ZHEN","芎":"XIONG","谁":"SHUI","钶":"KE"},e.UNIHANS[91]="伕",e.UNIHANS[347]="仚",e.UNIHANS[393]="诌",e.UNIHANS[39]="婤",e.UNIHANS[50]="腠",e.UNIHANS[369]="攸",e.UNIHANS[123]="乯",e.UNIHANS[171]="刕",e.UNIHANS[102]="佝",e.UNIHANS[126]="犿",e.UNIHANS[176]="列",e.UNIHANS[178]="刢",e.UNIHANS[252]="娝",e.UNIHANS[330]="偸"},shouldPatch:function(e){return"function"==typeof e&&("FOU"===e("伕").target&&"XIA"===e("仚").target&&"ZHONG"===e("诌").target&&"CHONG"===e("婤").target&&"CONG"===e("腠").target&&"YONG"===e("攸").target&&"HOU"===e("乯").target&&"LENG"===e("刕").target&&"GONG"===e("佝").target&&"HUAI"===e("犿").target&&"LIAO"===e("列").target&&"LIN"===e("刢").target&&"E"===e("钶").target)}};So.isSupported()&&No.shouldPatch(So.genToken)&&So.patchDict(No);const To=e=>{const{value:n,bordered:r}=e;return t.createElement(O,{value:n,title:n,bordered:r,readOnly:!0})};To.displayName="FormItemView";const{Option:Io}=D,Ro=e=>{const{$$form:n}=t.useContext(Hi),{value:r,items:l,multiple:i,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Mn(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:v,onClear:y}=e.option,{itemList:b=[],filterable:x=!0,listHeight:E=Ba,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,T=Gn(b)?l:b,I=e=>{var t;return(null===(t=T.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},R=e=>i?(null==e?void 0:e.map((e=>I(e))).join(","))||"":I(e);return n.isOnlyShow?t.createElement(To,{value:R(r),bordered:h}):t.createElement(D,Rn({value:r,mode:i?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:p,style:m,loading:a,bordered:h,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:C},i?{title:R(r)}:null,{filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"",l=So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,R(e),T)})(e)},onClear:y}),T.map((e=>t.createElement(Io,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Oo extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:p,validateTrigger:h,rules:f=[],onChange:g=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Zn(d)},required:e.getFormItemRequired(f)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ro,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(o,p)),m&&t.createElement(_,{flex:Zn(m.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}Oo.contextType=Hi;const ko=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=Wa,trueValue:p=za}=o,{t:h}=Mn(),f=e=>h(e===p?"am.form.trueText":"am.form.falseText");return t.createElement(M,{checked:r===p,style:s,disabled:d||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==l||l(e),i(e,f(e))})(t?p:m)}},u?a:null)};class Lo extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option,{labelToCheckbox:h}=o;return t.createElement(P.Item,{label:h?" ":e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ko,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Lo.contextType=Hi;const Ao=e=>{const{uniqueKey:n,items:r,fieldsChange:l}=e,{global:i}=t.useContext(on),{$$form:a}=t.useContext(Hi),{$size:o}=$n(e),{t:s}=Mn(),c=t.useRef(null),[d,u]=t.useState(!1),m=t.useMemo((()=>n?`form_${n}`:""),[n]);t.useLayoutEffect((()=>{f()}),[]);const p=()=>{if(!m)return;const e=JSON.parse(localStorage.getItem(m));var t;if(e||(t=m,Dn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(m,JSON.stringify(e)),f()):(null==i?void 0:i.getComponentConfigApi)&&h(r)})).catch((()=>{})),!e)return;return fe(e.map((e=>e.fieldName)),r.map((e=>e.fieldName))).length>0?r.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?(de(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName));return Object.assign(Object.assign({},t),e)}))},h=e=>{if(!m)return;const t=e.map((e=>{const t={};return de(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(m));var r,l;he(t,n)||(localStorage.setItem(m,JSON.stringify(t)),r=m,l=t,Dn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:l})}catch(e){}})))},f=()=>{const e=p();e&&g(e)},g=e=>{null==l||l([...e])},v=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(nr,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||Qn(e);return Object.assign(t,{hidden:e.hidden})}));g(t),h(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));if(he(t,n))return;a.setExpandHandle(!0);const l=Ma(e);g(l),h(l)}},r.map((e=>{var n;return t.createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},t.createElement(M,{disabled:(null===(n=e.rules)||void 0===n?void 0:n.findIndex((e=>e.required)))>-1,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,g(r),h(r)}}),t.createElement(Be,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=ir("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(H,{open:d,trigger:["click"],dropdownRender:()=>v(),overlayClassName:Pe(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>c.current,onOpenChange:e=>{u(e)}},t.createElement("a",{ref:c,style:{padding:"5px 0"}},t.createElement(We,null)))};Ao.displayName="FieldsFilter";const Po=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Hi),{value:l,onChange:i,onValuesChange:a}=e,{t:o}=Mn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h,onFocus:f,onBlur:g,onEnter:v,onClear:y}=e.option,{prefix:b,suffix:x,password:E,maxLength:w,pattern:C,toUpper:S,toTrim:N,autoFocus:T,autoComplete:I,secretType:R}=s,k=R&&(p||h),L=t.useRef(),A=t.useRef(!1);t.useEffect((()=>{var e;const t=()=>null==y?void 0:y(),n=null===(e=L.current)||void 0===e?void 0:e.input.parentNode.querySelector("span[class*='clear-icon']");return m&&n&&n.addEventListener("click",t),()=>{null==n||n.removeEventListener("click",t)}}),[]);const P=e=>{null==i||i(e),a(e)},F=E?O.Password:O,_=k?((e="",t)=>(e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e))(l,R):l;return r.isOnlyShow?t.createElement(To,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(_),bordered:u}):t.createElement(F,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:_,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":_,prefix:b,suffix:x,maxLength:w,bordered:u,allowClear:m,readOnly:p,disabled:h,onFocus:e=>{null==f||f(e.target.value,e)},onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(N){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),null==g||g(r,t)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;null==v||v(n,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=L.current)||void 0===t||t.blur())}},onCompositionStart:()=>{A.current=!0},onCompositionEnd:()=>{A.current=!1},onChange:e=>{let t=e.target.value;ge(C)&&(t=C.test(t)?t:null!=l?l:""),S&&!A.current&&(t=t.toUpperCase()),P(t)}})}));Po.displayName="VInput";class Fo extends d{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Po,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),u&&t.createElement(_,null,e.renderFormItemButton(i,u)),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Fo.contextType=Hi;const _o=e=>{const{$$form:n}=t.useContext(Hi),{value:r=[],onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:p,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;null==l||l(t),i(t,v(t))},v=e=>e.join(" - ");return n.isOnlyShow?t.createElement(To,{value:v(r),bordered:c}):t.createElement(O.Group,null,t.createElement(O,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:p,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement(O,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:p,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Do extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(s),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(o)},required:e.getFormItemRequired(u)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(_o,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(i,n)}}))),c&&t.createElement(_,{flex:Zn(c.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},c)))))}}Do.contextType=Hi;const Mo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Hi),{value:l,onChange:i,onValuesChange:a}=e,{t:o}=Mn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{step:v=1,min:y,max:b,precision:x,autoFocus:E,stringMode:w,textAlign:C="left",controls:S=!0,formatter:N,parser:T}=s,I=t.useRef(),R=t.useRef(l),O=e=>{const t=no(e)?"":oe(e)?e.toFixed(x):new Yt(e).toFixed(x);return"function"==typeof N?N(t):t},k={[C]:!0,controls:S};return r.isOnlyShow?t.createElement(To,{value:O(l),bordered:u}):t.createElement($,{ref:e=>{I.current=e,"function"==typeof n&&n(e)},value:l,className:Pe(k),placeholder:d,style:Object.assign({width:"100%"},c),step:v,min:y,max:b,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:T,bordered:u,readOnly:m,disabled:p,onFocus:e=>{null==h||h(e.target.value,e)},onBlur:t=>{Bn((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(R.current),null==f||f(R.current,t)}))},onKeyUp:e=>{var t;13===e.keyCode&&(null==g||g(l,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=I.current)||void 0===t||t.blur()))},onChange:e=>{const t=null!=e?e:"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,null==i||i(e),a(e,O(e))})(t)}})}));Mo.displayName="VInputNumber";class Ho extends d{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Mo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(i,u)),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Ho.contextType=Hi;const $o=e=>{const{$$form:n}=t.useContext(Hi),{value:r=[],onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:p=1,min:h=0,max:f,textAlign:g="left",controls:v=!0,precision:y,formatter:b,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];null==l||l(t),i(t,C(t))},C=e=>no(e)?"":e.map((e=>no(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(To,{value:C(r),bordered:c}):t.createElement(O.Group,null,t.createElement($,{value:r[0],className:Pe("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:p,min:h,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([e,r[1]])},onBlur:()=>{E(r)}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement($,{value:r[1],className:Pe("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:p,min:h,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([r[0],e])},onBlur:()=>{E(r)}}))};class qo extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(s),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(o)},required:e.getFormItemRequired(u)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement($o,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(i,n)}}))),c&&t.createElement(_,{flex:Zn(c.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},c)))))}}var Ko;qo.contextType=Hi,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Ko||(Ko={}));const jo=n(void 0),Vo={dataIndex:Ut.string.isRequired,title:Ut.string.isRequired,description:Ut.string,colSpan:Ut.number,width:Ut.number,minWidth:Ut.number,fixed:Ut.oneOf(["left","right"]),align:Ut.oneOf(["left","center","right"]),theadAlign:Ut.oneOf(["left","center","right"]),printFixed:Ut.bool,hidden:Ut.bool,noAuth:Ut.bool,noFixed:Ut.bool,ellipsis:Ut.bool,className:Ut.string,theadClassName:Ut.string,children:Ut.array,sorter:Ut.oneOfType([Ut.bool,Ut.func]),filter:Ut.shape({type:Ut.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Ut.arrayOf(Ut.shape({text:Ut.string,value:Ut.oneOfType([Ut.string,Ut.number])})),style:Ut.object}),precision:Ut.number,displayPrecision:Ut.number,formatType:Ut.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Ut.bool,canCopy:Ut.bool,editRender:Ut.func,dictItems:Ut.arrayOf(Ut.shape({text:Ut.string,value:Ut.oneOfType([Ut.string,Ut.number])})),summation:Ut.shape({sumBySelection:Ut.bool,displayWhenNotSelect:Ut.bool,dataKey:Ut.string,unit:Ut.string,render:Ut.func}),groupSummary:Ut.shape({dataKey:Ut.string,unit:Ut.string,render:Ut.func}),shouldCellUpdate:Ut.func,headRender:Ut.func,render:Ut.func};Ut.arrayOf(Ut.shape(Vo)).isRequired,Ut.func,Ut.array,Ut.oneOfType([Ut.string,Ut.func]).isRequired,Ut.number,Ut.bool,Ut.bool,Ut.shape({api:Ut.func.isRequired,params:Ut.object.isRequired,formatter:Ut.func,beforeFetch:Ut.func,afterFetch:Ut.func,stopToFirst:Ut.bool,dataKey:Ut.string,callback:Ut.func}),Ut.bool,Ut.bool,Ut.string,Ut.string,Ut.object,Ut.bool,Ut.bool,Ut.bool,Ut.oneOfType([Ut.object,Ut.func]),Ut.oneOfType([Ut.object,Ut.func]),Ut.array,Ut.func,Ut.bool,Ut.object,Ut.object,Ut.shape({type:Ut.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Ut.array,selectedRowKeys:Ut.array,hideSelectAll:Ut.bool,checkStrictly:Ut.bool,filterable:Ut.bool,selectByClickRow:Ut.bool,selectFirstRowOnChange:Ut.bool,clearableAfterFetched:Ut.bool,selectAllOnCurrentPage:Ut.bool,fetchSelectedRows:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),fetchAllRowKeys:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),disabled:Ut.func,onChange:Ut.func,onSelect:Ut.func,onSelectAll:Ut.func}),Ut.shape({currentRowKey:Ut.oneOfType([Ut.number,Ut.string]),disabled:Ut.func,onChange:Ut.func}),Ut.shape({virtual:Ut.bool,overscan:Ut.number,doubleXScrollbar:Ut.bool,openFetchFilterList:Ut.bool}),Ut.shape({expandIconColumn:Ut.string}),Ut.shape({defaultExpandAllRows:Ut.bool,defaultExpandedRowKeys:Ut.array,expandedRowKeys:Ut.array,hideExpandAll:Ut.bool,rowExpandable:Ut.func,expandedRowClassName:Ut.string,expandedRowRender:Ut.func,onExpand:Ut.func,onChange:Ut.func}),Ut.shape({cellMerge:Ut.bool,onCellMerge:Ut.func,onSelectChange:Ut.func}),Ut.shape({groupItems:Ut.arrayOf(Ut.shape({dataIndex:Ut.string.isRequired,titleIndex:Ut.string,color:Ut.string,backgroundColor:Ut.string})),fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),onChange:Ut.func}),Ut.func,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.shape({current:Ut.number,pageSize:Ut.number,pageSizeOptions:Ut.array,showSizeChanger:Ut.bool,showQuickJumper:Ut.bool}),Ut.shape({fileName:Ut.string,fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object}),beforeExport:Ut.func,cellStyle:Ut.bool,hideIcon:Ut.bool}),Ut.shape({showLogo:Ut.bool}),Ut.shape({fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),fieldList:Ut.arrayOf(Ut.object)}),Ut.shape({position:Ut.oneOf(["top","bottom"]),hideAlert:Ut.bool,hideClearButton:Ut.bool}),Ut.oneOf(["left","right"]),Ut.func,Ut.func,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func;const zo={columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0},Wo=10,Bo="1",Uo="0",Go="YYYY-MM-DD",Yo="YYYY-MM-DD HH:mm:ss",Xo="YYYYMMDDHHmmss",Qo={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Zo;!function(e){e.left="flex-start",e.right="flex-end"}(Zo||(Zo={}));const Jo=Object.assign({},e).useId;let es=0;var ts=Jo?function(e){const t=Jo();return e||t}:function(t){const[n]=e.useState(`qm_unique_${es}`);return e.useEffect((()=>{es+=1}),[]),t||n};let ns=[];const rs={_getInstance:function(e){var t;return null!==(t=ns.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=ns[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==ns.findIndex((e=>e===t))&&(this.deregister(e),ns=[t,...ns])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),ns=[{id:e,vm:t},...ns])},deregister:function(e){e&&(ns=ns.filter((t=>t.id!==e)))}};class ls{constructor(){this.state={required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]},this.addToRequired=e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)},this.removeFromRequired=e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)},this.addToValidate=e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)},this.removeFromValidate=e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)},this.addToEdited=e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)},this.removeFromEdited=e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)},this.addToInserted=e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)},this.removeFromInserted=e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)},this.addToUpdated=e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)},this.removeFromUpdated=e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)},this.addToRemoved=e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)},this.removeFromRemoved=e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)},this.clearAllLog=()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]}}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}const is={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollX:50,virtualScrollY:100,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored",popupClassName:"table-editable__popper"};function as(e){return void 0!==e}function os(t,n){const{defaultValue:r,value:l,onChange:i,postState:a}=n||{},[o,s]=e.useState((()=>as(l)?l:as(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=as(l)?l:o,d=a?a(c):c,u=Hn(i),[m,p]=e.useState([c]);hn((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),hn((()=>{as(l)||s(l)}),[l]);return[d,Hn((e=>{s(e),p([c])}))]}const ss=e=>e.map((e=>{const t=Object.assign({},e);return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=ss(t.children)),t})),cs=(e,n)=>{const{fetch:r,columns:l,border:i,rowSelection:a,summation:o,expandable:s,treeConfig:c,webPagination:d,scrollPagination:u,showSuperSearch:m,showFastSearch:p,showGroupSummary:h,showTableImport:f,showClipboard:g,showSelectCollection:v,showPivotGrid:y,footRender:b}=e,{tableRef:x,getRowKey:E,tableFullData:w,tableFlatData:C,updateMark:S,selectionKeys:N,sorter:T,filters:I,superFilters:R,pagination:O,mergedTdCells:k}=n,{selectionRows:L,summaries:A}=x.current,{expandIconColumn:P=""}=c||{},{t:F}=Mn(),_=e=>{const t=(e=>{const t=[],n=[],r=[];for(let l=0;l<e.length;l++){const i=e[l];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(ss(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:is.selectionColumn,title:"radio"===t?F("qm.table.config.selectionText"):"",width:is.selectionColumnWidth,fixed:"left",type:t}})(a),r=(null==(l=s)?void 0:l.expandedRowRender)?{dataIndex:is.expandableColumn,title:"",width:is.selectionColumnWidth,fixed:"left",type:"expand"}:null;var l;return n&&t.unshift(n),r&&t.unshift(r),ea(t)},D=(e,t,n,r,l)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:l})},M=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),H=t.useMemo((()=>!M&&!!d),[M,d]),$=t.useMemo((()=>M&&!!u),[M,u]),q=t.useMemo((()=>(M||H)&&!$),[M,H,$]),K=t.useMemo((()=>_(l)),[l]),j=t.useMemo((()=>Ji(K)),[K]),V=t.useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),z=t.useMemo((()=>j.filter((e=>!!e.summation))),[j]),W=t.useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),B=t.useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),U=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=C.findIndex((t=>E(t,t.index)===e.rowKey)),r=j.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){D(t,n,r,e.rowSpan,e.colSpan);for(let l=0;l<e.rowSpan;l++)for(let i=0;i<e.colSpan;i++)0===l&&0===i||D(t,n+l,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(k)),[k,j,w]),G=t.useMemo((()=>{var e,t;const n=j.filter((e=>![is.expandableColumn,is.selectionColumn,is.operationColumn].includes(e.dataIndex)));return P&&n.some((e=>e.dataIndex===P))?P:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[j,P]),Y=t.useMemo((()=>z.length>0),[z]),X=t.useMemo((()=>!!b||Y),[b,Y]),Q=t.useMemo((()=>da(K).length>1),[K]),Z=t.useMemo((()=>i||Q),[i,Q]),J=t.useMemo((()=>j.some((e=>e.sorter))),[j]),ee=t.useMemo((()=>j.some((e=>e.filter))),[j]),te=t.useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),ne=t.useMemo((()=>!M&&!!f),[M,f]),re=t.useMemo((()=>!!g&&V.length>0),[g,V]),le=t.useMemo((()=>!!v&&"checkbox"===(null==a?void 0:a.type)),[v,a]),ie=t.useMemo((()=>!!m&&ee),[m,ee]),ae=t.useMemo((()=>!M&&!!p),[M,p]),oe=t.useMemo((()=>!M&&!!y),[M,y]),se=t.useMemo((()=>!!h&&j.some((e=>!!e.groupSummary))),[j]),ce=t.useMemo((()=>{var e;return!!(null===(e=null==o?void 0:o.groupItems)||void 0===e?void 0:e.length)}),[o]),de=t.useMemo((()=>!C.length),[C]),ue=t.useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:l,summation:i}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=i,c=ce?Ra(x.current.tableFullData):x.current.tableFullData,d=!L.length&&!!o;let u=(!a||d?c:L).reduce(((e,t)=>{if(null==t?void 0:t[is.summaryIgnore])return e;const r=va(t,n);return xa(r)?e.plus(r):e}),new Yt(0));!Object.keys(A).includes(n)||a&&!d||(u=new Yt(va(A,n))),ya(e,n,u.toNumber());let m=r>=0?u.toFixed(r):u.toString();l>=0&&""!==m&&(m=wa(m,l)),m=Ea(m),ya(e,`${n}_text`,s?`${m} ${s}`:m)})),[e]})()),[C,S,N,A]),me=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),pe=t.useMemo((()=>{var e;const t=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(T),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,l]=t.split("|"),i=e[t];Object.keys(i).forEach((e=>{n.push({type:["radio","tree"].includes(l)?"checkbox":l,bracketLeft:"",fieldName:r,expression:e,value:$a(e)?null:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{const t=e.fieldType;n.push({type:["radio","tree"].includes(t)?"checkbox":t,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:$a(e.expression)?null:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(I,R),l=t?{[is.sorterFieldName]:t}:null,i=n.length?{[is.filterFieldName]:n}:null,a=me?{[is.groupSummary.summaryFieldName]:me,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[is.currentPageName]:O.current,[is.pageSizeName]:O.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),i),a),o),s)}),[null==r?void 0:r.params,O.current,O.pageSize,T,I,R,me]);return{isFetch:M,isWebPagination:H,isScrollPagination:$,showPagination:q,tableColumns:K,flattenColumns:j,editableColumns:V,summationColumns:z,leftFixedColumns:W,rightFixedColumns:B,derivedMergeCells:U,treeExpandIndex:G,showSummary:Y,showFooter:X,isHeadGroup:Q,bordered:Z,isHeadSorter:J,isHeadFilter:ee,isServiceSummation:te,isSelectCollection:le,isTableImport:ne,isTableClipboard:re,isSuperSearch:ie,isFastSearch:ae,isPivotGrid:oe,isGroupSummary:se,isGroupSubtotal:ce,isTableEmpty:de,summationRows:ue,fetchParams:pe}},ds=(e,n)=>{const{rowKey:r,height:l,dataSource:i,summation:a,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:p,ignorePageIndex:h,columnsChange:f,onChange:g,onDataChange:v,onDataLoad:y,onScrollEnd:b,onFetchError:x}=e,{getRowKey:E,tableRef:w,tableElementRef:C,tableBodyRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,pagerFilter:F,fetchParams:_,selectionKeys:D,rowExpandedKeys:M,highlightKey:H,summationColumns:$,isFetch:q,isWebPagination:K,isScrollPagination:j,isServiceSummation:V,isGroupSubtotal:z,doLayout:W,setTableFullData:B,setTableOriginData:U,setTableFlatData:G,setTableDataMaps:Y,setDeriveRowKeys:X,setPagination:Q,setPingRight:Z,setPingLeft:J,setSpinning:ee,setSorter:te,setFilters:ne,setSuperFilters:re,setPagerFilter:le,setSelectionKeys:ie,setRowExpandedKeys:ae,setHighlightKey:oe,setSelectionRows:se,setFilteredTreeData:ce,setScrollXLoad:de,setScrollYLoad:me,setFieldAuth:pe,setResizeState:he,setSummaries:fe,setPermission:ge,resetTableScroll:ye,clearElementStore:be}=n,{t:xe}=Mn(),{store:Ee}=w.current,we=t.useRef(Object.assign({},_)),Ce=t.useRef(!1),Se=si(C);hn((()=>{ke(),W()}),[T]),hn((()=>{Ne()}),[Se.width,Se.height,N,l,k.tableAutoHeight]),Hl((()=>{lt(),it(),at(),ot(),q||(K&&Ze(),Be(i)),s&&te(s),c&&ne(c)}),[i,null==o?void 0:o.params]),Hl((()=>{const e=Ke(_,we.current);e||q&&(null==d?void 0:d.clearableAfterFetched)&&st(),!e&&_[is.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Ze():q&&ze(),we.current=_}),[_]),Hl((()=>{K&&tt(),j||ye(),He()}),[O.current,O.pageSize]),Hl((()=>{q||Ie(R.length),W()}),[R]),Hl((()=>{w.current.isTreeTable&&tt()}),[M]);const Ne=()=>{const{scrollBarRef:e,resizeState:t}=w.current,{width:n,height:r}=Se;W(),k.tableBodyWidth>n&&Z(!0),e.current.scrollLeft>0&&J(!0),he(Object.assign({},t,{width:n,height:r}))},Te=()=>{H&&S.current.setClickedValues([H,""]),"radio"===(null==d?void 0:d.type)&&D.length&&S.current.setClickedValues([D[0],""])},Ie=e=>{e!==O.total&&Q((t=>Object.assign({},t,{total:e})))},Re=e=>{Ce.current=e},Oe=ci((e=>{Ye(),null==b||b(e)})),ke=()=>{de(I.length>is.virtualScrollX)},Le=(e=[])=>{let t=e.length>is.virtualScrollY;w.current.isTreeTable&&(t=!0),(null==m?void 0:m.virtual)&&(t=!0),me(t)},Ae=e=>z?Pe(Fe(e,0)):e,Pe=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Pe(e.children)),delete e.children,t.push(e)})),t},Fe=(e,t)=>{var n;const l=null===(n=a.groupItems)||void 0===n?void 0:n[t];if(!l)return e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e;return La(e,[l.dataIndex]).map((e=>{const n={children:Fe(e,t+1),_group:l.dataIndex};return"function"!=typeof r&&ya(n,r.toString(),Na()),l.titleIndex&&ya(n,l.titleIndex,va(e[0],l.titleIndex)),ya(n,l.dataIndex,va(e[0],l.dataIndex)),$.forEach((e=>{var t;const{dataIndex:r}=e,l=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[is.summaryIgnore])return e;const n=Number(va(t,r));return Number.isNaN(n)?e:e+n}),0);ya(n,r,l)})),n}))},_e=e=>{ie(e),se((e=>{const{selectionRows:t,recordsMap:n}=w.current,r=new Map;t.forEach((e=>r.set(E(e,e.index),e)));const l=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&l.push(i)}return l})(e))},De=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let l=[];return w.current.isTreeTable&&!n&&r.forEach((e=>{l.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:l,recordsMap:i}=w.current,a=oa(l,e);let o=[];if(!a)return o;let s=_a((null==a?void 0:a.children)||[]);return r&&(s=s.filter((e=>!i.has(e)||!r(i.get(e))))),o=[...new Set([...t,...s])],((null===(n=Pa(l,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=oa(l,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,r))})),l="radio"===t?r.slice(0,1):[...new Set([...r,...l])],l},Me=()=>{const{isTreeTable:e,deriveRowKeys:t,recordsMap:n}=w.current;return e?ca(t,(e=>e.rowKey)):Array.from(n.keys())},He=ci((()=>{null==g||g(O,qe(L),$e(A),P,{currentDataSource:et()})})),$e=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},qe=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,l]=n.split("|");t[`${r}|${l}`]=e[n]}return t},Ke=(e,t)=>{const n=Object.keys(ga(e,t));return 1===n.length&&(n.includes(is.currentPageName)||n.includes(is.pageSizeName))},je=()=>Dn(void 0,void 0,void 0,(function*(){var t;if(!p)return;let n=Xn(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:l}=p.fetch;try{const i=yield e(r);200===i.code&&(n=null!==(t=l?ue(i.data,l):i.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;ge((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=na(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:l,secretName:i}=r,a=ra(w.current.originColumns,t);pe(t,{visible:n,disabled:l,secretName:i}),n||(e.noAuth=!0,a.noAuth=!0),i&&(e.formatType=`secret-${i}`,a.formatType=`secret-${i}`)}}));null==f||f(t)}})),Ve=Hn((()=>Dn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:l=zn,afterFetch:i,callback:s}=o;if(!l(_))return;const c=!!(null===(e=null==a?void 0:a.fetch)||void 0===e?void 0:e.api);ee(!0);try{const[e,l]=c?yield Promise.all([o.api(r(_)),a.fetch.api(r(_))]):[yield o.api(r(_))];if(w.current.unMounted)return;if(c?200===e.code&&200===l.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:is.dataKey;let a=null!==(n=ue(e.data,r))&&void 0!==n?n:[];a="function"==typeof i?yield i(a):a;const c=ue(e.data,r.replace(/[^.]+$/,is.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(_[is.currentPageName]>d)return Xe(Object.assign(Object.assign({},O),{current:d}));Be(Ce.current?w.current.tableFullData.concat(a):a),Ie(c),Ue((null==l?void 0:l.data)||e.data),null==s||s(e.data,e)}}catch(e){null==x||x(e)}var d,u;d=o,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(o.stopToFirst=!1),ee(!1),Re(!1)})))),ze=ci(Ve),We=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=We(e.children)),e.index=t,h||(e.pageIndex=(e=>{const{current:t,pageSize:n}=O;return!q||j?e:(t-1)*n+e})(t)),e))),Be=e=>{const t=Ae(We(e));nt(t),rt(t),_e(De()),ae((e=>{const{isTreeTable:t,deriveRowKeys:n,recordsMap:r}=w.current,{defaultExpandAllRows:l,rowExpandable:i,expandedRowRender:a}=u||{};let o=Array.isArray(e)?e:[...M];if(l)o=Me();else if(t){a&&tr("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];H&&e.unshift(H),e.forEach((e=>{const t=Pa(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=[...new Set(o)]}return i&&o.filter((e=>{const t=r.get(e);return!!t&&i(t)})),o})()),Ge(),null==y||y(t)},Ue=e=>{var t,n,r;if(!V)return;const l=null!==(n=null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:is.summationKey,i=null!==(r=l?ue(e,l):e)&&void 0!==r?r:{},o={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{ya(o,e.dataIndex,Number(va(i,e.summation.dataKey)))})),fe(o)},Ge=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);_e([t])}else _e([])}},Ye=()=>{if(!j)return;const e=Qe();Ce.current||O.current>=e||(Re(!0),Xe(Object.assign(Object.assign({},O),{current:O.current+1})))},Xe=({current:e,pageSize:t})=>{Q((n=>Object.assign({},n,{current:e,pageSize:t})))},Qe=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Ze=()=>{Xe(Object.assign({},O,{current:1}))},Je=()=>{const{current:e,pageSize:t}=O;return w.current.tableFullData.slice((e-1)*t,e*t)},et=()=>K?Je():w.current.tableFullData,tt=()=>{const{recordsMap:e,isTreeTable:t}=w.current,n=K?sa(Je()):Array.from(e.values());let r=qa(n,F,t);t&&(ce(r),r=(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=E(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);M.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(r)),Le(r),G(r)},nt=e=>{B(e),Y(e),X(e),tt()},rt=e=>{U(e)},lt=()=>{te({})},it=()=>{ne({})},at=()=>{re([])},ot=()=>{le({})},st=()=>{_e([])};return{initialTable:()=>{je(),Te(),ke(),Le(),q?Ve():Be(i)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&tr("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,createWebPageData:Je,getTableData:Ve,createTableData:Be,createTableFlatData:tt,createGroupData:Ae,createAllExpandedKeys:Me,setSelectionKeysEffect:_e,doFieldValidate:(e,t,n,r,l)=>{if(!Array.isArray(e))return tr("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ee.removeFromRequired({x:n,y:r}),Ee.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&Gn(t)&&Ee.addToRequired({x:n,y:r,text:e.message||l+xe("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||Ee.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:l}=Ee.state,i=ve(n,l),a=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:a(e),validate:a(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...ve(r,n),...ve(r,l)].includes(e))),removed:l.filter((e=>!i.includes(e)))}},dataChange:()=>{null==v||v(w.current.tableFullData)},tableChange:He,toLastPage:()=>{const e=Qe();O.current!==e&&Xe(Object.assign({},O,{current:e}))},toFirstPage:Ze,getPageCount:Qe,pagerChangeHandle:Xe,scrollBottomDebouncer:Oe,clearTableSorter:lt,clearTableFilter:it,clearSuperFilters:at,clearPagerFilter:ot,clearRowSelection:st,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{Ee.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;be(),Ee.destroy(),e.deregister(t)}}},us=(e,n)=>{const{height:r,minHeight:l,maxHeight:i,ellipsis:a,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:m,tableBodyRef:p,$size:h,tableColumns:f,flattenColumns:g,leftFixedColumns:v,derivedMergeCells:y,tableFlatData:b,layout:x,showFooter:E,showPagination:w,isFullScreen:C,setLayout:S,setElementStore:N}=n,T=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,n={};return l&&Object.assign(n,{minHeight:`${fa(l)}px`}),i&&Object.assign(n,{maxHeight:`${fa(i)}px`}),C?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${fa(r)}px`:`${t}px`}):n}),[r,i,l,C,x]),I=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r,rowHeight:l}=d.current;if(void 0!==t&&t>=0)if(t<b.length)if(r)p.current.scrollToYIndex(t);else{const e=R(c(b[t],b[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*l);else if(r){const t=b.findIndex((t=>e===c(t,t.index)));t>=0&&p.current.scrollToYIndex(t)}else{const t=R(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},R=e=>d.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{N("$toper",u.current),N("$table",m.current)},tableStyles:T,getSpan:(e,t,n,r,l)=>{let i=1,a=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:l});Array.isArray(o)?(i=o[0],a=o[1]):ae(o)&&(i=o.rowSpan,a=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,a=e.colSpan)}return{rowSpan:i,colSpan:a}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=ra(f,e);e=t?la(t).dataIndex:""}let t=0;for(let n=0;n<g.length;n++){const r=g[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=ra(f,e);e=t?ia(t).dataIndex:""}const n="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let n=[];return e.forEach((e=>{e.colSpan>0&&n.length>0&&(t.push(n),n=[]),n.push(e)})),n.length>0&&t.push(n),t.map((e=>{const[t,n]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...n,...t.reverse()]})).flat()})(g):g;let r=0;for(let t=n.length-1;t>=0;t--){const l=n[t];if(l.dataIndex===e)break;r+=l.width||l.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?g.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=d.current,l=v.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-l)},scrollYToRecord:I,calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(w?Ko["small"!==h?"middle":h]+Wo:0)-Wo;S((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{I("",0)},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=is,l=[];let i=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,l.push(e))})),l.length>0){const e=g.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===l.length)l[0].renderWidth=(l[0].minWidth||r)+t;else{const e=t/l.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;l.forEach(((t,l)=>{if(0===l)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),l[0].renderWidth=(l[0].minWidth||r)+t-n}}else l.forEach((e=>{e.renderWidth=e.minWidth||r}));S((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else i=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>Object.assign(Object.assign({},e),{tableBodyWidth:i})));S((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&p.current.resetItemXSize(g)})(),Bn((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,l=o?e.$header.offsetHeight:x.headerHeight,i=E?e.$footer.offsetHeight:x.footerHeight,a=r-l-i,s=e.$tableBody.offsetHeight;let c=0;if(C){const t=e.$toper?e.$toper.offsetHeight+Wo:0,r=e.$pager?e.$pager.offsetHeight+Wo:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:l,footerHeight:i,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function ms({handler:t,delay:n=0}){const r=Ri(t,n),l=Hn(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",l),()=>window.removeEventListener("resize",l))),[l])}const ps=e=>{const{total:n}=e,{tableRef:r,prefixCls:l,selectionKeys:i,isHeadSorter:a,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearPagerFilter:u,clearRowSelection:m,clearRowHighlight:p,setActivedCell:h}=t.useContext(jo),{infoBarConfig:f,rowSelection:g,rowHighlight:v}=r.current.props,{isTreeTable:y,recordsMap:b,invalidRowKeys:x}=r.current,{hideAlert:E,hideClearButton:w}=f||{},{t:C}=Mn(),[S,N]=t.useState(i.length-x.length);t.useEffect((()=>{Bn((()=>N(i.length-x.length)))}),[i,x]);const T=t.useMemo((()=>!E),[E]),I=t.useMemo((()=>!w&&!!(a||o||g||v)),[w,a,o,g,v]),R={[`${l}__alert`]:!0};return T?t.createElement("div",{className:Pe(R)},t.createElement("i",{className:"svgicon icon"},t.createElement(Ue,null)),t.createElement("span",null,C("qm.table.alert.total",{total:y?b.size:n}),g?`,${C("qm.table.alert.selected",{total:Math.max(S,0)})}`:""),I&&t.createElement("em",{onClick:()=>{c(),d(),u(),m(),p(),Bn((()=>s())),h({})}},C("qm.table.alert.clear"))):null},hs=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:l=!0}=e,{prefixCls:i,setFullScreen:a}=t.useContext(jo),{t:o}=Mn(),s=()=>{a(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),l?t.createElement("span",{className:`${i}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(Ve,null):t.createElement(ze,null))):null}));hs.displayName="FullScreen";const fs=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,getTableData:i}=t.useContext(jo),{t:a}=Mn(),o=()=>{i()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${l}-reload`,title:a("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ge,null))):null}));fs.displayName="Reload";const gs=()=>{const e={dateFormat:e=>{const t=e?p(e).format(Go):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?p(e).format(Yo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?p(e).format(Yo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>xa(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Ea(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},t=(t,n,r)=>{var l,i,a,o;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:m}=n,p=s||(null===(l=null==m?void 0:m(r,n))||void 0===l?void 0:l.items)||[];let h=null!==(o=null!==(a=null===(i=p.find((e=>e.value==t)))||void 0===i?void 0:i.text)&&void 0!==a?a:t)&&void 0!==o?o:"";if(Array.isArray(t)&&(h=t.map((e=>{var t,n;return null!==(n=null===(t=p.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),c>=0&&""!==h&&(h=xa(h)?new Yt(h).toFixed(c):h),d>=0&&""!==h&&(h=wa(h,d)),u){const t=e[`${Un(u)}Format`];t?h=t(h):tr("Table","字段的格式化类型 `formatType` 配置不正确")}return h},n=e=>Kn(e)?Ta(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,l,i)=>{const a=va(e,r.dataIndex),o=r.render?r.render(a,e,r,l,i):t(a,r,e);return n(o)}}},vs=t.forwardRef(((e,n)=>{var r,l,i,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(on),{tableRef:d,prefixCls:u,flattenColumns:m,summationRows:p,showSummary:h,getSpan:f}=t.useContext(jo),{tablePrint:g,showHeader:v}=d.current.props,{t:y}=Mn(),{getTitleFromCellValue:b}=gs(),x=null!==(l=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==l?l:"",E=null!==(a=null===(i=null==c?void 0:c.print)||void 0===i?void 0:i.rightLogo)&&void 0!==a?a:"",w=!(!x&&!E),C=t.useMemo((()=>Qn(aa(o,[is.expandableColumn,is.selectionColumn,is.operationColumn]))),[o]),S=t.useMemo((()=>Qn(aa(m,[is.expandableColumn,is.selectionColumn,is.operationColumn]))),[m]),N=t.useMemo((()=>Qn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},Aa(C,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?T(t):t},I=(e,t)=>ye(be(xe(e),t),Ee(((...e)=>we(...e,((e,n)=>{if(Array.isArray(e))return I(e.concat(n),t)}))))),R=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(T(e))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const n=e.filter((e=>e.dataIndex===t));return n.length<=1?n[0]:I(n,"dataIndex")[0]})))(n),t.push(da(n))})),t},O=()=>{const e=(e=>{const t=[];let n=[],r=0,l=0;for(;l<e.length;){const i=e[l];r+=i.width||i.renderWidth,r<=is.printWidth?(n.push(i),l===e.length-1&&t.push(n),l++):l>0?(e.splice(0,l),N.length&&e.unshift(...N),t.push(n),n=[],r=0,l=0):(i.width=is.printWidth,n.push(i),t.push(n),l++)}return t})([...S]),t=R(e);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let r=0;r<e.length;r++)n+=k(t[r],e[r],d.current.tableFullData),n+='<div class="page-break"></div>';return n+"</body></html>"},k=(e,t,n)=>{const{showLogo:r=!0}=g;let l='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,v&&(l+=["<thead>",r&&w?`<tr><th colspan="${t.length}" style="border: 0">${['<table class="no-border" width="100%" border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td width="50%" align="left">',x?`<img src="${x}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',E?`<img src="${E}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Ia(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(l+=`<tbody>${sa(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:l,colSpan:i}=f(e,t,e.index,r,n);if(!l||!i)return null;return`<td rowspan="${l}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*is.treeTable.textIndent}px"></span>`:""}${b(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),h&&p.length&&(l+=["<tfoot>",p.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:l,summation:i}=t,a=(null==i?void 0:i.render)?i.render(n):va(e,`${l}_text`);return`<td>${0===r&&""===a?y("qm.table.config.summaryText"):Kn(a)?Ta(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},L=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:l}=e,i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!l)return Promise.resolve({type:r,content:t,blob:e});wi(e,i)}})({filename:"print",type:"html",isDownload:!1},O()))||void 0===e||e.then((({content:e,blob:t})=>{let n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),d.current.isIE?(n.contentDocument.write(e),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(t))}))};return t.useImperativeHandle(n,(()=>({clickHandle:L}))),s?t.createElement("span",{className:`${u}-print`,title:y("qm.table.print.text"),onClick:()=>L()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ye,null))):null}));vs.displayName="TablePrint";const ys="606060",bs="thin",xs="d4d4d4",Es=(e,t)=>{t&&(e.height=Math.floor(.75*t))},ws=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Cs=()=>({top:{style:bs,color:{argb:xs}},left:{style:bs,color:{argb:xs}},bottom:{style:bs,color:{argb:xs}},right:{style:bs,color:{argb:xs}}}),Ss=e=>{const{children:t}=e;return t&&t.length?Ss(t[0]):e},Ns=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Ts=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:l}=t.useContext(jo),{spanMethod:i,showHeader:a}=e.current.props,{t:o}=Mn(),s=(e,t)=>{var n,r,l;return null!==(l=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==l?l:""};return{exportXLSX:(t,s,c,d)=>Dn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:m}=t,{rowHeight:p}=e.current,h=Ji(u),f=da(u),g=[],v=[],y=[],b=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=Ia(e.title),y.push({key:t,width:(n||r||is.defaultColumnWidth)/8})})),a&&(l?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:l}=e,i=Ss(e),a=h.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=Ia(e.title),0!==r&&(r>1||l>1)&&b.push({s:{r:t,c:a},e:{r:t+l-1,c:a+r-1}})})),g.push(n)})):(h.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&b.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),g.push(E)),x+=g.length);const w=sa(s).map(((e,t)=>{const r={};return h.forEach(((l,a)=>{if("function"==typeof i){const{rowSpan:r,colSpan:i}=n(e,l,t,a,s);(i>1||r>1)&&b.push({s:{r:t+x,c:a},e:{r:t+x+r-1,c:a+i-1}})}const o=["percent","finance"].includes(l.formatType);r[l.dataIndex]=o?va(e,l.dataIndex):d(e,t,l,a)})),r._level=e._level,r}));x+=w.length,r&&m&&c(h,s).forEach(((e,t)=>{const n={};h.forEach(((t,r)=>{const{dataIndex:l,summation:i}=t,a=(null==i?void 0:i.render)?i.render(s):va(e,l);n[l]=0===r&&""===a?o("qm.table.config.summaryText"):Kn(a)?Ta(a).join(""):a})),v.push(n)}));const{sheetName:C,useStyle:S}=t,N=new Xt.Workbook,T=N.addWorksheet(C);T.columns=y,a&&T.addRows(g).forEach((e=>{S&&Es(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=ra(u,t.key),{align:r,theadAlign:l}=n;ws(e,l||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:ys}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Cs()})}))})),T.addRows(w).forEach(((e,t)=>{const{_level:n}=w[t];S&&Es(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),r=ra(u,t.key),{align:l}=r;ws(e,l),Object.assign(e,Ns(r)),S&&Object.assign(e,{font:{color:{argb:ys}},border:Cs()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),r&&m&&T.addRows(v).forEach((e=>{S&&Es(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=ra(u,t.key),{align:r}=n;ws(e,r),Object.assign(e,Ns(n)),S&&Object.assign(e,{font:{color:{argb:ys}},border:Cs()})}))})),b.forEach((({s:e,e:t})=>{T.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const I=yield N.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})})),exportCSV:(e,t)=>{const n="\ufeff"+(e=>Array.from(e.rows).map((e=>Array.from(e.cells).map((e=>{var t,n;return((e,t)=>{const n=e.replace(/"/g,'""');return"string"===t?`"=""${n}"""`:"number"===t?n:n.includes(",")||n.includes("\r")||n.includes("\n")?`"${n}"`:n})(null!==(n=null===(t=e.textContent)||void 0===t?void 0:t.trim())&&void 0!==n?n:"",e.getAttribute("data-type"))})).join(","))).join("\r\n"))((e=>{const t=document.createElement("div");t.innerHTML=e.trim();const n=t.querySelector("table");if(!n)throw new Error("Invalid table HTML input.");return n})(t));return new Blob([n],{type:"text/csv;charset=utf-8"})},importXLSX:(e,t)=>{const{columns:n,file:r}=e,l=Ji(n),i=new FileReader;i.onerror=()=>{R.error(o("qm.table.import.error"))},i.onload=e=>{const n=l.map((e=>Ia(e.title))),r=new Xt.Workbook,i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),a=e[i],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,a);if(c){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let l=e;Array.isArray(null==l?void 0:l.richText)&&(l=l.richText.map((e=>e.text)).join("")),ae(l)&&"text"in l&&(l=l.text),Ce(l)&&(l=Sa(l,Yo)),(null==l?void 0:l.formula)&&(l=null!==(r=l.result)&&void 0!==r?r:l.value),t[a[n]]=l}));const r={};return n.forEach(((e,n)=>{var i;const{dataIndex:a,dictItems:o}=l[n];Array.isArray(o)&&((null===(i=t[e])||void 0===i?void 0:i.toString().includes(","))?t[e]=t[e].split(",").map((e=>s(o,e))).filter((e=>""!==e)):t[e]=s(o,t[e])),ya(r,a,t[e])})),r}));null==t||t(r)}else R.error(o("qm.table.import.error"))}else R.error(o("qm.table.import.error"))})):R.error(o("qm.table.import.error"))},i.readAsArrayBuffer(r)}}},Is=e=>{const{fileType:n,onChange:r}=e,{prefixCls:l}=t.useContext(jo),{t:i}=Mn();let a,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}},c=()=>Dn(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),o=document.createElement("input"),a.className=`${l}--file-form`,o.name="file",o.type="file",a.appendChild(o),document.body.appendChild(a)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(R.warning(i("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(a),a=null,o=null},a.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(nr,{onClick:()=>c()},i("qm.upload.text"))},Rs=e=>{const{columns:n,onClose:r}=e,{tableRef:l,prefixCls:i,createTableData:a,dataChange:o}=t.useContext(jo),{beforeTableImport:s}=l.current.props,{t:c}=Mn(),{importXLSX:d}=Ts(),u=t.useRef(null),[m,p]=t.useState(!1),[h,f]=t.useState(!0),g=e=>e.filter((e=>![is.expandableColumn,is.selectionColumn,"index","pageIndex",is.operationColumn].includes(e.dataIndex))),v={posIndex:"条"},[y,b]=t.useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,n)=>{const{fileName:r}=n.GET_FIELDS_VALUE(["fileName"]);return t.createElement(t.Fragment,null,r?t.createElement("span",null,r):t.createElement(Is,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&f(!1)}}))}},{type:"SELECT",label:c("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:c("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:c("qm.table.import.fillText"),value:"fill"},{text:c("qm.table.import.addText"),value:"add"},{text:c("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{y.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(v),b([...y])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:l.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return t.createElement("div",{className:`${i}-import__setting`},t.createElement(Hh,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:v,items:y,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(nr,{type:"primary",loading:m,disabled:h,onClick:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||(p(!0),d({columns:g(n),file:t.file},(e=>Dn(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:i}=l.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&a(e),"add"===t.importType&&a([...n,...e]),"insert"===t.importType){const r=t.posIndex,l=n.slice(0,r).concat(e).concat(n.slice(r));a(l)}e.forEach((e=>{i.addToInserted(e)})),o(),R.success(c("qm.table.import.success",{total:e.length})),p(!1),r()})))))}))},c("qm.table.import.text"))))},Os=t.forwardRef(((e,n)=>{const{tableColumns:r,open:l=!0}=e,{prefixCls:i}=t.useContext(jo),{t:a}=Mn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${i}-import`]:!0},u={visible:o,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:Pe(d),title:a("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(Xe,null))),t.createElement(Mi,u,t.createElement(Rs,{columns:r,onClose:()=>s(!1)})))}));function ks(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}function Ls(e,t,n,r){var l=Mt.unstable_batchedUpdates?function(e){Mt.unstable_batchedUpdates(n,e)}:n;return null!=e&&e.addEventListener&&e.addEventListener(t,l,r),{remove:function(){null!=e&&e.removeEventListener&&e.removeEventListener(t,l,r)}}}Os.displayName="TableImport";var As=u((function(e,t){var n=e.didUpdate,r=e.getContainer,l=e.children,a=i(),s=i();m(t,(function(){return{}}));var c=i(!1);return!c.current&&Gr()&&(s.current=r(),a.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==a.current&&a.current.appendChild(s.current),function(){var e;null===(e=s.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(s.current)}}),[]),s.current?Mt.createPortal(l,s.current):null}));function Ps(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Fs;function _s(e){var t=e.prefixCls,n=e.motion,r=e.animation,l=e.transitionName;return n||(r?{motionName:"".concat(t,"-").concat(r)}:l?{motionName:l}:null)}function Ds(t){var n=t.prefixCls,r=t.visible,l=t.zIndex,i=t.mask,a=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!i)return null;var c={};return(a||s||o)&&(c=fr({motionAppear:!0},_s({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(Sl,Nl({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:l},className:Pe("".concat(n,"-mask"),r)})}))}function Ms(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ms(Object(n),!0).forEach((function(t){qs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ms(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $s(e){return $s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$s(e)}function qs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ks={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function js(){if(void 0!==Fs)return Fs;Fs="";var e=document.createElement("p").style;for(var t in Ks)t+"Transform"in e&&(Fs=t);return Fs}function Vs(){return js()?"".concat(js(),"TransitionProperty"):"transitionProperty"}function zs(){return js()?"".concat(js(),"Transform"):"transform"}function Ws(e,t){var n=Vs();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Bs(e,t){var n=zs();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var Us,Gs=/matrix\((.*)\)/,Ys=/matrix3d\((.*)\)/;function Xs(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Qs(e,t,n){var r=n;if("object"!==$s(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):Us(e,t);for(var l in t)t.hasOwnProperty(l)&&Qs(e,l,t[l])}function Zs(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var l=e.document;"number"!=typeof(n=l.documentElement[r])&&(n=l.body[r])}return n}function Js(e){return Zs(e)}function ec(e){return Zs(e,!0)}function tc(e){var t=function(e){var t,n,r,l=e.ownerDocument,i=l.body,a=l&&l.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=a.clientLeft||i.clientLeft||0,top:r-=a.clientTop||i.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=Js(r),t.top+=ec(r),t}function nc(e){return null!=e&&e==e.window}function rc(e){return nc(e)?e.document:9===e.nodeType?e:e.ownerDocument}var lc=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),ic=/^(top|right|bottom|left)$/,ac="currentStyle",oc="runtimeStyle",sc="left";function cc(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function dc(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function uc(e,t,n){"static"===Qs(e,"position")&&(e.style.position="relative");var r=-999,l=-999,i=cc("left",n),a=cc("top",n),o=dc(i),s=dc(a);"left"!==i&&(r=999),"top"!==a&&(l=999);var c,d="",u=tc(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[Vs()]||"",Ws(e,"none")),"left"in t&&(e.style[o]="",e.style[i]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[a]="".concat(l,"px")),Xs(e);var m=tc(e),p={};for(var h in t)if(t.hasOwnProperty(h)){var f=cc(h,n),g="left"===h?r:l,v=u[h]-m[h];p[f]=f===h?g+v:g-v}Qs(e,p),Xs(e),("left"in t||"top"in t)&&Ws(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=cc(b,n),E=t[b]-u[b];y[x]=b===x?p[x]+E:p[x]-E}Qs(e,y)}function mc(e,t){var n=tc(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(zs());if(n&&"none"!==n){var r=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(r[12]||r[4],0),y:parseFloat(r[13]||r[5],0)}}return{x:0,y:0}}(e),l={x:r.x,y:r.y};"left"in t&&(l.x=r.x+t.left-n.left),"top"in t&&(l.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(zs());if(r&&"none"!==r){var l,i=r.match(Gs);i?((l=(i=i[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,l[5]=t.y,Bs(e,"matrix(".concat(l.join(","),")"))):((l=r.match(Ys)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,l[13]=t.y,Bs(e,"matrix3d(".concat(l.join(","),")")))}else Bs(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,l)}function pc(e,t){for(var n=0;n<e.length;n++)t(e[n])}function hc(e){return"border-box"===Us(e,"boxSizing")}"undefined"!=typeof window&&(Us=window.getComputedStyle?function(e,t,n){var r=n,l="",i=rc(e);return(r=r||i.defaultView.getComputedStyle(e,null))&&(l=r.getPropertyValue(t)||r[t]),l}:function(e,t){var n=e[ac]&&e[ac][t];if(lc.test(n)&&!ic.test(t)){var r=e.style,l=r[sc],i=e[oc][sc];e[oc][sc]=e[ac][sc],r[sc]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[sc]=l,e[oc][sc]=i}return""===n?"auto":n});var fc=["margin","border","padding"],gc=-1,vc=2,yc=1;function bc(e,t,n){var r,l,i,a=0;for(l=0;l<t.length;l++)if(r=t[l])for(i=0;i<n.length;i++){var o=void 0;o="border"===r?"".concat(r).concat(n[i],"Width"):r+n[i],a+=parseFloat(Us(e,o))||0}return a}var xc={getParent:function(e){var t=e;do{t=11===t.nodeType&&t.host?t.host:t.parentNode}while(t&&1!==t.nodeType&&9!==t.nodeType);return t}};function Ec(e,t,n){var r=n;if(nc(e))return"width"===t?xc.viewportWidth(e):xc.viewportHeight(e);if(9===e.nodeType)return"width"===t?xc.docWidth(e):xc.docHeight(e);var l="width"===t?["Left","Right"]:["Top","Bottom"],i="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=hc(e),o=0;(null==i||i<=0)&&(i=void 0,(null==(o=Us(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?yc:gc);var s=void 0!==i||a,c=i||o;return r===gc?s?c-bc(e,["border","padding"],l):o:s?r===yc?c:c+(r===vc?-bc(e,["border"],l):bc(e,["margin"],l)):o+bc(e,fc.slice(r),l)}pc(["Width","Height"],(function(e){xc["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],xc["viewport".concat(e)](n))},xc["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,l=r.body,i=r.documentElement[n];return"CSS1Compat"===r.compatMode&&i||l&&l[n]||i}}));var wc={position:"absolute",visibility:"hidden",display:"block"};function Cc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,l=t[0];return 0!==l.offsetWidth?r=Ec.apply(void 0,t):function(e,t,n){var r,l={},i=e.style;for(r in t)t.hasOwnProperty(r)&&(l[r]=i[r],i[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(i[r]=l[r])}(l,wc,(function(){r=Ec.apply(void 0,t)})),r}function Sc(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}pc(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);xc["outer".concat(t)]=function(t,n){return t&&Cc(t,e,n?0:yc)};var n="width"===e?["Left","Right"]:["Top","Bottom"];xc[e]=function(t,r){var l=r;return void 0!==l?t?(hc(t)&&(l+=bc(t,["padding","border"],n)),Qs(t,e,l)):void 0:t&&Cc(t,e,gc)}}));var Nc={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:rc,offset:function(e,t,n){if(void 0===t)return tc(e);!function(e,t,n){if(n.ignoreShake){var r=tc(e),l=r.left.toFixed(0),i=r.top.toFixed(0),a=t.left.toFixed(0),o=t.top.toFixed(0);if(l===a&&i===o)return}n.useCssRight||n.useCssBottom?uc(e,t,n):n.useCssTransform&&zs()in document.body.style?mc(e,t):uc(e,t,n)}(e,t,n||{})},isWindow:nc,each:pc,css:Qs,clone:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);if(e.overflow)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:Sc,getWindowScrollLeft:function(e){return Js(e)},getWindowScrollTop:function(e){return ec(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Nc.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Sc(Nc,xc);var Tc=Nc.getParent;function Ic(e){if(Nc.isWindow(e)||9===e.nodeType)return null;var t,n=Nc.getDocument(e).body,r=Nc.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:Tc(e);for(t=Tc(e);t&&t!==n&&9!==t.nodeType;t=Tc(t))if("static"!==(r=Nc.css(t,"position")))return t;return null}var Rc=Nc.getParent;function Oc(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Ic(e),l=Nc.getDocument(e),i=l.defaultView||l.parentWindow,a=l.body,o=l.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===o||"visible"===Nc.css(r,"overflow")){if(r===a||r===o)break}else{var s=Nc.offset(r);s.left+=r.clientLeft,s.top+=r.clientTop,n.top=Math.max(n.top,s.top),n.right=Math.min(n.right,s.left+r.clientWidth),n.bottom=Math.min(n.bottom,s.top+r.clientHeight),n.left=Math.max(n.left,s.left)}r=Ic(r)}var c=null;Nc.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Nc.css(e,"position")&&(e.style.position="fixed"));var d=Nc.getWindowScrollLeft(i),u=Nc.getWindowScrollTop(i),m=Nc.viewportWidth(i),p=Nc.viewportHeight(i),h=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(a);if("hidden"===g.overflowX&&(h=i.innerWidth),"hidden"===g.overflowY&&(f=i.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Nc.isWindow(e)||9===e.nodeType)return!1;var t=Nc.getDocument(e),n=t.body,r=null;for(r=Rc(e);r&&r!==n&&r!==t;r=Rc(r))if("fixed"===Nc.css(r,"position"))return!0;return!1}(e))n.left=Math.max(n.left,d),n.top=Math.max(n.top,u),n.right=Math.min(n.right,d+m),n.bottom=Math.min(n.bottom,u+p);else{var v=Math.max(h,d+m);n.right=Math.min(n.right,v);var y=Math.max(f,u+p);n.bottom=Math.min(n.bottom,y)}return n.top>=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function kc(e){var t,n,r;if(Nc.isWindow(e)||9===e.nodeType){var l=Nc.getWindow(e);t={left:Nc.getWindowScrollLeft(l),top:Nc.getWindowScrollTop(l)},n=Nc.viewportWidth(l),r=Nc.viewportHeight(l)}else t=Nc.offset(e),n=Nc.outerWidth(e),r=Nc.outerHeight(e);return t.width=n,t.height=r,t}function Lc(e,t){var n=t.charAt(0),r=t.charAt(1),l=e.width,i=e.height,a=e.left,o=e.top;return"c"===n?o+=i/2:"b"===n&&(o+=i),"c"===r?a+=l/2:"r"===r&&(a+=l),{left:a,top:o}}function Ac(e,t,n,r,l){var i=Lc(t,n[1]),a=Lc(e,n[0]),o=[a.left-i.left,a.top-i.top];return{left:Math.round(e.left-o[0]+r[0]-l[0]),top:Math.round(e.top-o[1]+r[1]-l[1])}}function Pc(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Fc(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function _c(e,t,n){var r=[];return Nc.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function Dc(e,t){return e[t]=-e[t],e}function Mc(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function Hc(e,t){e[0]=Mc(e[0],t.width),e[1]=Mc(e[1],t.height)}function $c(e,t,n,r){var l=n.points,i=n.offset||[0,0],a=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;i=[].concat(i),a=[].concat(a);var c={},d=0,u=Oc(s,!(!(o=o||{})||!o.alwaysByViewport)),m=kc(s);Hc(i,m),Hc(a,t);var p=Ac(m,t,l,i,a),h=Nc.merge(m,p);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&Pc(p,m,u)){var f=_c(l,/[lr]/gi,{l:"r",r:"l"}),g=Dc(i,0),v=Dc(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Ac(m,t,f,g,v),m,u)||(d=1,l=f,i=g,a=v)}if(o.adjustY&&Fc(p,m,u)){var y=_c(l,/[tb]/gi,{t:"b",b:"t"}),b=Dc(i,1),x=Dc(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Ac(m,t,y,b,x),m,u)||(d=1,l=y,i=b,a=x)}d&&(p=Ac(m,t,l,i,a),Nc.mix(h,p));var E=Pc(p,m,u),w=Fc(p,m,u);if(E||w){var C=l;E&&(C=_c(l,/[lr]/gi,{l:"r",r:"l"})),w&&(C=_c(l,/[tb]/gi,{t:"b",b:"t"})),l=C,i=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&w,(c.adjustX||c.adjustY)&&(h=function(e,t,n,r){var l=Nc.clone(e),i={width:t.width,height:t.height};return r.adjustX&&l.left<n.left&&(l.left=n.left),r.resizeWidth&&l.left>=n.left&&l.left+i.width>n.right&&(i.width-=l.left+i.width-n.right),r.adjustX&&l.left+i.width>n.right&&(l.left=Math.max(n.right-i.width,n.left)),r.adjustY&&l.top<n.top&&(l.top=n.top),r.resizeHeight&&l.top>=n.top&&l.top+i.height>n.bottom&&(i.height-=l.top+i.height-n.bottom),r.adjustY&&l.top+i.height>n.bottom&&(l.top=Math.max(n.bottom-i.height,n.top)),Nc.mix(l,i)}(p,m,u,c))}return h.width!==m.width&&Nc.css(s,"width",Nc.width(s)+h.width-m.width),h.height!==m.height&&Nc.css(s,"height",Nc.height(s)+h.height-m.height),Nc.offset(s,{left:h.left,top:h.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:l,offset:i,targetOffset:a,overflow:c}}function qc(e,t,n){var r=n.target||t,l=kc(r),i=!function(e,t){var n=Oc(e,t),r=kc(e);return!n||r.left+r.width<=n.left||r.top+r.height<=n.top||r.left>=n.right||r.top>=n.bottom}(r,n.overflow&&n.overflow.alwaysByViewport);return $c(e,l,n,i)}qc.__getOffsetParent=Ic,qc.__getVisibleRectForElement=Oc;var Kc=Gr()?e.useLayoutEffect:e.useEffect,jc=function(t,n){var r=e.useRef(!0);Kc((function(){return t(r.current)}),n),Kc((function(){return r.current=!1,function(){r.current=!0}}),[])};function Vc(e,t){var n=null,r=null;var l=new qt((function(e){var l=vr(e,1)[0].target;if(document.documentElement.contains(l)){var i=l.getBoundingClientRect(),a=i.width,o=i.height,s=Math.floor(a),c=Math.floor(o);n===s&&r===c||Promise.resolve().then((function(){t({width:s,height:c})})),n=s,r=c}}));return e&&l.observe(e),function(){l.disconnect()}}function zc(e){return"function"!=typeof e?null:e()}function Wc(e){return"object"===ur(e)&&e?e:null}var Bc=function(e,n){var r=e.children,l=e.disabled,i=e.target,a=e.align,o=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),m=t.useRef(),p=t.Children.only(r),h=t.useRef({});h.current.disabled=l,h.current.target=i,h.current.align=a,h.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),l=t.useRef(null);function i(){window.clearTimeout(l.current)}return[function t(a){if(i(),r.current&&!0!==a)l.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(a))return;r.current=!0,l.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,i()}]}((function(){var e=h.current,t=e.disabled,n=e.target,r=e.align,l=e.onAlign,i=m.current;if(!t&&n&&i){var a,o=zc(n),s=Wc(n);u.current.element=o,u.current.point=s,u.current.align=r;var c=document.activeElement;return o&&function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var l=e.getBoundingClientRect(),i=l.width,a=l.height;if(i||a)return!0}}return!1}(o)?a=qc(i,o,r):s&&(a=function(e,t,n){var r,l,i=Nc.getDocument(e),a=i.defaultView||i.parentWindow,o=Nc.getWindowScrollLeft(a),s=Nc.getWindowScrollTop(a),c=Nc.viewportWidth(a),d=Nc.viewportHeight(a),u={left:r="pageX"in t?t.pageX:o+t.clientX,top:l="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},m=r>=0&&r<=o+c&&l>=0&&l<=s+d,p=[n.points[0],"cc"];return $c(e,u,Hs(Hs({},n),{},{points:p}),m)}(i,s,r)),function(e,t){e!==document.activeElement&&ks(t,e)&&"function"==typeof e.focus&&e.focus()}(c,i),l&&a&&l(i,a),!0}return!1}),d),g=vr(f,2),v=g[0],y=g[1],b=vr(t.useState(),2),x=b[0],E=b[1],w=vr(t.useState(),2),C=w[0],S=w[1];return jc((function(){E(zc(i)),S(Wc(i))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=C)||e&&t&&("pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t&&e.clientX===t.clientX&&e.clientY===t.clientY))&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new Set;return function e(t,l){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=r.has(t);if(xn(!a,"Warning: There may be circular references"),a)return!1;if(t===l)return!0;if(n&&i>1)return!1;r.add(t);var o=i+1;if(Array.isArray(t)){if(!Array.isArray(l)||t.length!==l.length)return!1;for(var s=0;s<t.length;s++)if(!e(t[s],l[s],o))return!1;return!0}if(t&&l&&"object"===ur(t)&&"object"===ur(l)){var c=Object.keys(t);return c.length===Object.keys(l).length&&c.every((function(n){return e(t[n],l[n],o)}))}return!1}(e,t)}(u.current.align,a)||v()})),t.useEffect((function(){return Vc(m.current,v)}),[m.current]),t.useEffect((function(){return Vc(x,v)}),[x]),t.useEffect((function(){l?y():v()}),[l]),t.useEffect((function(){if(s)return Ls(window,"resize",v).remove}),[s]),t.useEffect((function(){return function(){y()}}),[]),t.useImperativeHandle(n,(function(){return{forceAlign:function(){return v(!0)}}})),t.isValidElement(p)&&(p=t.cloneElement(p,{ref:Sr(p.ref,m)})),p},Uc=t.forwardRef(Bc);function Gc(){Gc=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},i=l.iterator||"@@iterator",a=l.asyncIterator||"@@asyncIterator",o=l.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,l){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new N(l||[]);return r(a,"_invoke",{value:E(e,n,o)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function m(){}function p(){}function h(){}var f={};s(f,i,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,i)&&(f=v);var y=h.prototype=m.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function l(r,i,a,o){var s=d(e[r],e,i);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==ur(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){l("next",e,a,o)}),(function(e){l("throw",e,a,o)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return l("throw",e,a,o)}))}o(s.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){l(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(l,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===l)throw i;return I()}for(n.method=l,n.arg=i;;){var a=n.delegate;if(a){var o=w(a,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var l=d(r,e.iterator,t.arg);if("throw"===l.type)return t.method="throw",t.arg=l.arg,t.delegate=null,u;var i=l.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,l=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return l.next=l}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=h,r(y,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:p,configurable:!0}),p.displayName=s(h,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,l,i){void 0===i&&(i=Promise);var a=new x(c(t,n,r,l),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),s(y,o,"Generator"),s(y,i,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var l=this.tryEntries.length-1;l>=0;--l){var i=this.tryEntries[l],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var l=this.tryEntries[r];if(l.tryLoc<=this.prev&&n.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var i=l;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var l=r.arg;S(n)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function Yc(e,t,n,r,l,i,a){try{var o=e[i](a),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,l)}function Xc(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function a(e){Yc(i,r,l,a,o,"next",e)}function o(e){Yc(i,r,l,a,o,"throw",e)}a(void 0)}))}}Uc.displayName="Align";var Qc=["measure","alignPre","align",null,"motion"],Zc=e.forwardRef((function(t,n){var r=t.visible,l=t.prefixCls,a=t.className,c=t.style,d=t.children,u=t.zIndex,m=t.stretch,p=t.destroyPopupOnHide,h=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,w=t.onMouseDown,C=t.onTouchStart,S=t.onClick,N=i(),T=i(),I=vr(s(),2),R=I[0],O=I[1],k=function(t){var n=vr(e.useState({width:0,height:0}),2),r=n[0],l=n[1];return[e.useMemo((function(){var e={};if(t){var n=r.width,l=r.height;-1!==t.indexOf("height")&&l?e.height=l:-1!==t.indexOf("minHeight")&&l&&(e.minHeight=l),-1!==t.indexOf("width")&&n?e.width=n:-1!==t.indexOf("minWidth")&&n&&(e.minWidth=n)}return e}),[t,r]),function(e){var t=e.offsetWidth,n=e.offsetHeight,r=e.getBoundingClientRect(),i=r.width,a=r.height;Math.abs(t-i)<1&&Math.abs(n-a)<1&&(t=i,n=a),l({width:t,height:n})}]}(m),L=vr(k,2),A=L[0],P=L[1];var F=function(e,t){var n=vr(Mr(null),2),r=n[0],l=n[1],a=i();function s(e){l(e,!0)}function c(){vl.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=vl(Xc(Gc().mark((function e(){var t,n;return Gc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Qc.indexOf(r),(n=Qc[t+1])&&-1!==t&&s(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),o((function(){return function(){c()}}),[]),[r,function(e){c(),a.current=vl((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){m&&P(v())})),_=vr(F,2),D=_[0],M=_[1],H=vr(s(0),2),$=H[0],q=H[1],K=i();function j(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function V(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===D&&(null==b||b(e,t))}jc((function(){"alignPre"===D&&q(0)}),[D]),jc((function(){"align"===D&&($<3?j():M((function(){var e;null===(e=K.current)||void 0===e||e.call(K)})))}),[$]);var z=fr({},_s(t));function W(){return new Promise((function(e){K.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=z[e];z[e]=function(e,n){return M(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==D||M()}),[z.motionName,D]),e.useImperativeHandle(n,(function(){return{forceAlign:j,getElement:function(){return T.current}}}));var B=fr(fr({},A),{},{zIndex:u,opacity:"motion"!==D&&"stable"!==D&&r?0:void 0,pointerEvents:r||"stable"===D?void 0:"none"},c),U=!0;null==f||!f.points||"align"!==D&&"stable"!==D||(U=!1);var G=d;return e.Children.count(d)>1&&(G=e.createElement("div",{className:"".concat(l,"-content")},d)),e.createElement(Sl,Nl({visible:r,ref:T,leavedClassName:"".concat(l,"-hidden")},z,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:p,forceRender:h}),(function(t,n){var r=t.className,i=t.style,o=Pe(l,a,R,r);return e.createElement(Uc,{target:g||v,key:"popup",ref:N,monitorWindowResize:!0,disabled:U,align:f,onAlign:V},e.createElement("div",{ref:n,className:o,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:w,onTouchStartCapture:C,onClick:S,style:fr(fr({},i),B)},G))}))}));Zc.displayName="PopupInner";var Jc=e.forwardRef((function(t,n){var r=t.prefixCls,l=t.visible,i=t.zIndex,a=t.children,o=t.mobile,s=(o=void 0===o?{}:o).popupClassName,c=o.popupStyle,d=o.popupMotion,u=void 0===d?{}:d,m=o.popupRender,p=t.onClick,h=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return h.current}}}));var f=fr({zIndex:i},c),g=a;return e.Children.count(a)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},a)),m&&(g=m(g)),e.createElement(Sl,Nl({visible:l,ref:h,removeOnLeave:!0},u),(function(t,n){var l=t.className,i=t.style,a=Pe(r,s,l);return e.createElement("div",{ref:n,className:a,onClick:p,style:fr(fr({},i),f)},g)}))}));Jc.displayName="MobilePopupInner";var ed=["visible","mobile"],td=e.forwardRef((function(t,n){var r=t.visible,l=t.mobile,i=Tr(t,ed),a=vr(s(r),2),c=a[0],d=a[1],u=vr(s(!1),2),m=u[0],p=u[1],h=fr(fr({},i),{},{visible:c});o((function(){d(r),r&&l&&p(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null==e?void 0:e.substr(0,4))}())}),[r,l]);var f=m?e.createElement(Jc,Nl({},h,{mobile:l,ref:n})):e.createElement(Zc,Nl({},h,{ref:n}));return e.createElement("div",null,e.createElement(Ds,h),f)}));td.displayName="Popup";var nd=e.createContext(null);function rd(){}function ld(){return""}function id(e){return e?e.ownerDocument:window.document}var ad=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var od=function(t){var n=function(n){Ar(l,e.Component);var r=_r(l);function l(t){var n,i;return Rr(this,l),pr(Fr(n=r.call(this,t)),"popupRef",e.createRef()),pr(Fr(n),"triggerRef",e.createRef()),pr(Fr(n),"portalContainer",void 0),pr(Fr(n),"attachId",void 0),pr(Fr(n),"clickOutsideHandler",void 0),pr(Fr(n),"touchOutsideHandler",void 0),pr(Fr(n),"contextMenuOutsideHandler1",void 0),pr(Fr(n),"contextMenuOutsideHandler2",void 0),pr(Fr(n),"mouseDownTimeout",void 0),pr(Fr(n),"focusTime",void 0),pr(Fr(n),"preClickTime",void 0),pr(Fr(n),"preTouchTime",void 0),pr(Fr(n),"delayTimer",void 0),pr(Fr(n),"hasPopupMouseDown",void 0),pr(Fr(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),pr(Fr(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),pr(Fr(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),pr(Fr(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),pr(Fr(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&ks(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),pr(Fr(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),pr(Fr(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),pr(Fr(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),pr(Fr(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),pr(Fr(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),pr(Fr(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),pr(Fr(n),"onClick",(function(e){if(n.fireEvents("onClick",e),n.focusTime){var t;if(n.preClickTime&&n.preTouchTime?t=Math.min(n.preClickTime,n.preTouchTime):n.preClickTime?t=n.preClickTime:n.preTouchTime&&(t=n.preTouchTime),Math.abs(t-n.focusTime)<20)return;n.focusTime=0}n.preClickTime=0,n.preTouchTime=0,n.isClickToShow()&&(n.isClickToHide()||n.isBlurToHide())&&e&&e.preventDefault&&e.preventDefault();var r=!n.state.popupVisible;(n.isClickToHide()&&!r||r&&n.isClickToShow())&&n.setPopupVisible(!n.state.popupVisible,e)})),pr(Fr(n),"onPopupMouseDown",(function(){var e;(n.hasPopupMouseDown=!0,clearTimeout(n.mouseDownTimeout),n.mouseDownTimeout=window.setTimeout((function(){n.hasPopupMouseDown=!1}),0),n.context)&&(e=n.context).onPopupMouseDown.apply(e,arguments)})),pr(Fr(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),l=n.getPopupDomNode();ks(r,t)&&!n.isContextMenuOnly()||ks(l,t)||n.hasPopupMouseDown||n.close()}})),pr(Fr(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=br(n.triggerRef.current);if(t)return t}catch(e){}return Mt.findDOMNode(Fr(n))})),pr(Fr(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,l=r.popupPlacement,i=r.builtinPlacements,a=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return l&&i&&t.push(function(e,t,n,r){for(var l=n.points,i=Object.keys(e),a=0;a<i.length;a+=1){var o=i[a];if(Ps(e[o].points,l,r))return"".concat(t,"-placement-").concat(o)}return""}(i,a,e,o)),s&&t.push(s(e)),t.join(" ")})),pr(Fr(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,l=t.destroyPopupOnHide,i=t.popupClassName,a=t.onPopupAlign,o=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,m=t.maskAnimation,p=t.maskTransitionName,h=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,w=n.state,C=w.popupVisible,S=w.point,N=n.getPopupAlign(),T={};return n.isMouseEnterToShow()&&(T.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(T.onMouseLeave=n.onPopupMouseLeave),T.onMouseDown=n.onPopupMouseDown,T.onTouchStart=n.onPopupMouseDown,e.createElement(td,Nl({prefixCls:r,destroyPopupOnHide:l,visible:C,point:y&&S,className:i,align:N,onAlign:a,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:m,maskTransitionName:p,maskMotion:h,ref:n.popupRef,motion:o,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),pr(Fr(n),"attachParent",(function(e){vl.cancel(n.attachId);var t,r=n.props,l=r.getPopupContainer,i=r.getDocument,a=n.getRootDomNode();l?(a||0===l.length)&&(t=l(a)):t=i(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=vl((function(){n.attachParent(e)}))})),pr(Fr(n),"getContainer",(function(){if(!n.portalContainer){var e=(0,n.props.getDocument)(n.getRootDomNode()).createElement("div");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",n.portalContainer=e}return n.attachParent(n.portalContainer),n.portalContainer})),pr(Fr(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),pr(Fr(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),pr(Fr(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),i="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:i,popupVisible:i},ad.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return kr(l,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e,t=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(e=t.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Ls(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Ls(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Ls(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Ls(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),vl.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var e;return(null===(e=this.popupRef.current)||void 0===e?void 0:e.getElement())||null}},{key:"getPopupAlign",value:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,r=e.builtinPlacements;return t&&r?function(e,t,n){return fr(fr({},e[t]||{}),n)}(r,t,n):n}},{key:"setPopupVisible",value:function(e,t){var n=this.props.alignPoint,r=this.state.popupVisible;this.clearDelayTimer(),r!==e&&("popupVisible"in this.props||this.setState({popupVisible:e,prevPopupVisible:r}),this.props.onPopupVisibleChange(e)),n&&t&&e&&this.setPoint(t)}},{key:"delaySetPopupVisible",value:function(e,t,n){var r=this,l=1e3*t;if(this.clearDelayTimer(),l){var i=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,i),r.clearDelayTimer()}),l)}else this.setPopupVisible(e,n)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire".concat(e)]:t[e]||n[e]}},{key:"isClickToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var e=this.props.action;return"contextMenu"===e||1===e.length&&"contextMenu"===e[0]}},{key:"isContextMenuToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("contextMenu")||-1!==n.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("focus")}},{key:"isBlurToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var e;this.state.popupVisible&&(null===(e=this.popupRef.current)||void 0===e||e.forceAlign())}},{key:"fireEvents",value:function(e,t){var n=this.props.children.props[e];n&&n(t);var r=this.props[e];r&&r(t)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var n=this.state.popupVisible,r=this.props,l=r.children,i=r.forceRender,a=r.alignPoint,o=r.className,s=r.autoDestroy,c=e.Children.only(l),d={key:"trigger"};this.isContextMenuToShow()?d.onContextMenu=this.onContextMenu:d.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(d.onClick=this.onClick,d.onMouseDown=this.onMouseDown,d.onTouchStart=this.onTouchStart):(d.onClick=this.createTwoChains("onClick"),d.onMouseDown=this.createTwoChains("onMouseDown"),d.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(d.onMouseEnter=this.onMouseEnter,a&&(d.onMouseMove=this.onMouseMove)):d.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?d.onMouseLeave=this.onMouseLeave:d.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(d.onFocus=this.onFocus,d.onBlur=this.onBlur):(d.onFocus=this.createTwoChains("onFocus"),d.onBlur=this.createTwoChains("onBlur"));var u=Pe(c&&c.props&&c.props.className,o);u&&(d.className=u);var m=fr({},d);Nr(c)&&(m.ref=Sr(this.triggerRef,c.ref));var p,h=e.cloneElement(c,m);return(n||this.popupRef.current||i)&&(p=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(p=null),e.createElement(nd.Provider,{value:this.triggerContextValue},h,p)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.popupVisible,r={};return void 0!==n&&t.popupVisible!==n&&(r.popupVisible=n,r.prevPopupVisible=t.popupVisible),r}}]),l}();return pr(n,"contextType",nd),pr(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:ld,getDocument:id,onPopupVisibleChange:rd,afterPopupVisibleChange:rd,onPopupAlign:rd,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1}),n}(As);const sd=e=>{const{columns:n,onChange:r}=e,{prefixCls:l,$size:i}=t.useContext(jo),{t:a}=Mn(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);Hl((()=>{p()}),[d]),t.useEffect((()=>{m()}),[n]);const m=()=>{const e=[];n.forEach(((t,r)=>{const l=t.colSpan;l>1&&n.slice(r+1,r+l).every((({colSpan:e})=>0===e))&&e.push(n.slice(r,r+l))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const l=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===l)return e.push(t);e.push(...o.current[l].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),null==r||r(e)},h={[`${l}__popper`]:!0,"column-filter__popper":!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i},f=[`${l}-column-filter`,{selected:s}];return t.createElement(od,{action:["click"],popupVisible:s,popup:t.createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"main"},t.createElement(Gt,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),n=d.map((e=>e.dataIndex));he(t,n)||u(Ma(e))}},d.map((e=>((e,n)=>{const{colSpan:r}=e;if(0===r)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const l=["svgicon","handle",`${n}-handle`];return t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),t.createElement("i",{className:Pe(l),title:a("qm.table.columnFilter.draggable")},t.createElement(Be,null)),t.createElement("span",{className:"text"},Ia(e.title)))})(e,"main")))))),popupClassName:Pe(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Qo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Pe(f),title:a("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},cd=e=>{const{defaultValue:n,onClose:r,onOk:l}=e,{tableRef:i,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(jo),{rowSelection:d}=i.current.props,{t:u}=Mn(),m=t.useRef(null),[h,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${p().format(Xo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Qn(n.columns||[])})),[]),[v,y]=t.useState([{type:"INPUT",label:u("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:u("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:u("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:u("qm.table.export.all"),value:"all"},{text:u("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==d?void 0:d.type)},{text:u("qm.table.export.custom"),value:"custom"}]},onChange:e=>{v.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,y([...v])}},options:{min:1},disabled:!0},{type:"INPUT",label:u("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t.createElement(sd,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return t.createElement("div",{className:`${a}-export__setting`},t.createElement(Hh,{ref:m,initialValues:g,items:v,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(nr,{type:"primary",loading:h,onClick:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield m.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);l(t),yield Wn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},dd=t.forwardRef(((e,n)=>{var r;const{tableColumns:l,open:i=!0}=e,{global:a}=t.useContext(on),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:m,isGroupSubtotal:h,showSummary:f,getSpan:g}=t.useContext(jo),{exportExcel:v,fetch:y,showHeader:b}=o.current.props,{t:x}=Mn(),{getTitleFromCellValue:E}=gs(),[w,C]=t.useState(!1),[S,N]=t.useState(!1),T=t.useMemo((()=>{var e;return!!(null===(e=null==v?void 0:v.fetch)||void 0===e?void 0:e.api)}),[v]),I=t.useMemo((()=>!d.total||S),[d.total,S]),O=t.useMemo((()=>aa(l,[is.expandableColumn,is.selectionColumn,is.operationColumn])),[l]),k=t.useMemo((()=>aa(c,[is.expandableColumn,is.selectionColumn,is.operationColumn])),[c]),L=(e,t="",n=0)=>e.map(((e,r)=>{const l=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),i=t?`${t}.${l.index+1}`:`${l.index+1}`;return l.indexPath=i,l._level=n,Array.isArray(e.children)&&(l.children=L(e.children,i,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&ya(l,t,va(l,t))})),l})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,l=(h?Ra(t):t).reduce(((e,t)=>{if(null==t?void 0:t[is.summaryIgnore])return e;const n=Number(va(t,r));return Number.isNaN(n)?e:e+n}),0);ya(n,r,l)})),[n]},P=(e,t,n,r)=>{const{precision:l,formatType:i}=n;let a=E(e,n,t,r);return l>=0&&!i&&""!==a&&(a=Number(a)),a},{exportXLSX:F,exportCSV:_}=Ts(),D=e=>Dn(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:l,dataKey:i}=y;let a=[];try{N(!0);const o={[is.currentPageName]:1,[is.pageSizeName]:null!=e?e:d.total},s=yield n(Object.assign(Object.assign({},r(Object.assign(Object.assign({},u),o))),o));if(200===s.code){let e=Array.isArray(s.data)?s.data:null!==(t=ue(s.data,i))&&void 0!==t?t:[];e="function"==typeof l?yield l(e):e,a=L(e)}}catch(e){}return N(!1),a})),M=e=>{var t;const n=null===(t=null==a?void 0:a.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},H=(e,t)=>{const{columns:n,footSummation:r}=e,l=Ji(n);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${l.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(i+=["<thead>","<tr>",l.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Ia(e.title)}</th>`})).join(""),"</tr>","</thead>"].join("")),t.length&&(i+=`<tbody>${sa(t).map((e=>`<tr>${l.map(((n,r)=>{var l;const{rowSpan:i,colSpan:a}=g(e,n,e.index,r,t);if(!i||!a)return null;const o=P(e,e.index,n,r);return`<td rowspan="${i}" colspan="${a}" data-type="${$(o,null===(l=n.filter)||void 0===l?void 0:l.type)}">${o}</td>`})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(i+=["<tfoot>",A(l,t).map((e=>`<tr>${l.map(((n,r)=>{const{dataIndex:l,summation:i}=n,a=(null==i?void 0:i.render)?i.render(t):va(e,l);return`<td>${0===r&&""===a?x("qm.table.config.summaryText"):Kn(a)?Ta(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},$=(e,t)=>{const n={text:"string",textarea:"string",number:"number",date:"date"};return t&&n[t]?n[t]:typeof e},q=null!==(r=null==v?void 0:v.fileName)&&void 0!==r?r:`${p().format(Xo)}.xlsx`,K=q.slice(q.lastIndexOf(".")+1).toLowerCase(),j=()=>{if(I)return R.warning(x("qm.table.export.warnText"));var e;T?(e=q,Dn(void 0,void 0,void 0,(function*(){N(!0);try{const{api:t,params:n}=v.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:l}=e.filter||{};return{title:t,dataIndex:n,type:l,hidden:r}}))},u),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[is.currentPageName]:void 0,[is.pageSizeName]:void 0}));r.data&&(wi(r.data,e),M(e))}catch(e){}N(!1)}))):C(!0)};t.useImperativeHandle(n,(()=>({clickHandle:j})));const V={[`${s}-export`]:!0},z={visible:w,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},W={fileName:q.slice(0,q.lastIndexOf(".")),fileType:K,columns:O,useStyle:(null==v?void 0:v.cellStyle)?1:0};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:Pe(V),title:x("qm.table.export.textNoSpace"),onClick:()=>j()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ke,null))),t.createElement(Mi,z,t.createElement(cd,{defaultValue:W,onClose:()=>C(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:ea(e.columns)}),Dn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:l=1,endIndex:i}=t,{tableFullData:a,selectionRows:s}=o.current;let c=[];if(m?("all"===r&&(c=yield D()),"custom"===r&&(c=yield D(i),c=c.slice(l-1))):("all"===r&&(c=a.slice(0)),"custom"===r&&(c=a.slice(l-1,i||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==v?void 0:v.beforeExport))try{c=null==v?void 0:v.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield F(t,c,A,P);wi(n,`${e}.xlsx`),M(`${e}.xlsx`)}if("csv"===n){const n=_(t,H(t,c));wi(n,`${e}.csv`),M(`${e}.csv`)}}))}})))}));dd.displayName="TableExport";const ud=e=>{const{columns:n,onClose:r}=e,{tableRef:l,tableBodyRef:i,prefixCls:a,dataChange:o}=t.useContext(jo),{beforeClipboard:s}=l.current.props,{t:c}=Mn(),d=t.useRef(null),[u,m]=t.useState([{type:"INPUT_NUMBER",label:c("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:c("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:n.map(((e,t)=>({value:t,text:Ia(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,h]=t.useState(!1);return t.createElement("div",{className:`${a}-clipboard__setting`},t.createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),t.createElement(Hh,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(nr,{type:"primary",loading:p,onClick:()=>Dn(void 0,void 0,void 0,(function*(){var e;const[t,a]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:m,fieldAuth:p}=l.current;h(!0);const f=a.content.trim().replace(/(\r|\n)$/,"");let g=f.replace(/"[^"]+"/g,"^");((null===(e=f.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{g=g.replace(/\^/,e)}));let v=g.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{v=yield s(v,v[0].map(((e,t)=>n[a.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var l,i;const o=u[a.rowIndex-1+t],s=n[a.colIndex+r];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||(null===(l=e.extra)||void 0===l?void 0:l.disabled)||(null===(i=p[s.dataIndex])||void 0===i?void 0:i.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(ya(o,s.dataIndex,e),m.addToUpdated(o))}}))})),i.current.forceUpdate(),o(),R.success(c("qm.table.clipboard.success",{total:v.length})),h(!1),r()}))},c("qm.table.clipboard.text"))))},md=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,flattenColumns:i}=t.useContext(jo),{t:a}=Mn(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![is.expandableColumn,is.selectionColumn,"index","pageIndex",is.operationColumn].includes(e.dataIndex))))(i)),[i]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${l}-clipboard`]:!0},m={visible:o,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:Pe(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ze,null))),t.createElement(Mi,m,t.createElement(ud,{columns:c,onClose:()=>s(!1)})))}));md.displayName="TableClipboard";const pd=e=>{const{columns:n,onClose:r}=e,{tableRef:l,$size:i,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(jo),{rowKey:s,rowSelection:c}=l.current.props,{t:d}=Mn(),u=t.useRef(null),m=si(u),p=e=>e.map((e=>{var t;const n={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:null!==(t=e.dictItems)&&void 0!==t?t:[],render:e.render};return Array.isArray(e.children)&&(n.children=p(e.children)),n})),[h,f]=t.useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(n.filter((e=>![is.expandableColumn,is.selectionColumn,"index","pageIndex",is.operationColumn].includes(e.dataIndex))))]),[g]=t.useState((()=>{const{disabled:e}=c||{},t=l.current.selectionRows.map((e=>Object.assign(Object.assign({},e),{children:void 0})));return e?t.filter((t=>!e(t))):t})()),[v,y]=t.useState(300),b=ci((()=>{const e=u.current;y(e.offsetHeight-2*Ko[i]-30)}),5);return hn((()=>{b()}),[m.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(lp,{size:i,columns:h,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t.createElement("div",{style:{height:10}}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},hd=t.forwardRef(((e,n)=>{const{columns:r,open:l=!0}=e,{tableRef:i,getRowKey:a,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=t.useContext(jo),{rowSelection:p}=i.current.props,{t:h}=Mn(),[f,g]=t.useState(!1),v=t.useRef(!1);Hl((()=>{!v.current&&y()}),[d]);const y=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=p;if(c&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:s},t.params));if(200===r.code){let l=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];l=l.filter((e=>!n(e))),u(l.map(((e,t)=>a(e,t)))),m(l),v.current=!0}}catch(e){}})),b=()=>{g(!0)};t.useImperativeHandle(n,(()=>({clickHandle:b})));const x={visible:f,title:h("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:`${o}-select-collection`,title:h("qm.table.selectCollection.text"),onClick:()=>b()},t.createElement("i",{className:"svgicon icon"},t.createElement(Je,null))),t.createElement(Mi,x,t.createElement(pd,{columns:r,onClose:()=>g(!1)})))}));hd.displayName="SelectCollection";const fd=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:l,getRowKey:i,prefixCls:a,$size:o,tableFlatData:s,flattenColumns:c,setActivedCell:d,scrollXToColumn:u,scrollYToRecord:m}=t.useContext(jo),{uniqueKey:p}=l.current.props,{t:h}=Mn(),{getTitleFromCellValue:f}=gs(),g=t.useRef(""),[v,y]=t.useState(""),[b,x]=t.useState([]),[E,w]=t.useState(0),[C,S]=t.useState(!1),[N,T]=t.useState({case:0,fullchar:0}),I=t.useMemo((()=>`${b.length>0?E+1:E}/${b.length}`),[E,b]);Hl((()=>{F(b[E])}),[E,b]);const R=e=>{T(Object.assign({},N,e))},k=(e,t,n)=>new Promise(((r,l)=>{A.confirm({title:h("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),L=Hn((e=>Dn(void 0,void 0,void 0,(function*(){if(!v)return g.current=v,P();const t=((e,t)=>{const n=new RegExp(N.fullchar?`^${t}$`:t,N.case?"":"i"),r=[];return e.forEach(((e,t)=>{c.forEach(((l,a)=>{const{dataIndex:o}=l;if([is.expandableColumn,is.selectionColumn,"index","pageIndex",is.operationColumn].includes(o))return;const s=f(e,l,e.index,a);n.test(s)&&r.push({value:s,rowKey:i(e,e.index),dataIndex:o,rowIndex:t,colIndex:a})}))})),r})(s,v);if(!t.length)return A.warning({title:h("qm.button.confirmPrompt"),content:h("qm.table.fastSearch.notMatch")});if(x(t),"all"===e&&S(!0),v!==g.current)return g.current=v,w(0);if("next"===e){const e=E+1;e>t.length-1?yield k(h("qm.table.fastSearch.toTheEnd"),(()=>w(0)),(()=>{})):w(e)}if("prev"===e){const e=E-1;e<0?yield k(h("qm.table.fastSearch.toStart"),(()=>w(t.length-1)),(()=>{})):w(e)}})))),P=()=>{w(0),x([]),d({})},F=e=>{e&&(m(e.rowKey),u(e.dataIndex),d(e))},_=t.useMemo((()=>p?`fastSearch_${p}`:""),[p]),[D,H]=t.useState([]),[$,q]=t.useState(""),[K,j]=t.useState("");Hl((()=>{if(K){const{input:e,config:t}=D.find((e=>e.value===K)).condition;y(e),T(t),setTimeout((()=>L()))}}),[K]),t.useEffect((()=>{V()}),[]);const V=()=>Dn(void 0,void 0,void 0,(function*(){if(!_)return;let e=yield Qt.getItem(_);e||(e=yield z(_),Array.isArray(e)&&(yield Qt.setItem(_,e))),Array.isArray(e)&&e.length&&H(e)})),z=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),W=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement("div",{className:"search-box"},t.createElement("span",{className:"label"},h("qm.table.fastSearch.queryLabel"),":"),t.createElement(O,{value:v,placeholder:h("qm.table.fastSearch.queryCondition"),allowClear:!0,style:{flex:"auto",width:"auto"},onChange:e=>y(e.target.value)})),t.createElement("div",{className:"condition"},t.createElement(M,{checked:!!N.case,onChange:e=>R({case:e.target.checked})},h("qm.table.fastSearch.matchCase")),t.createElement(M,{checked:!!N.fullchar,onChange:e=>R({fullchar:e.target.checked})},h("qm.table.fastSearch.matchFullchar"))),t.createElement("div",{className:"all-list"},C&&t.createElement("table",{className:"rtable",tabIndex:-1,cellSpacing:"0",cellPadding:"0"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",{style:{width:40,minWidth:40}},"#"),t.createElement("th",{style:{width:130,minWidth:130}},h("qm.table.fastSearch.cellText")),t.createElement("th",null,h("qm.table.fastSearch.valText")))),t.createElement("tbody",null,b.map(((e,n)=>t.createElement("tr",{key:n,className:Pe({active:E===n}),onClick:()=>w(n)},t.createElement("td",null,n+1),t.createElement("td",null,"Row:",e.rowIndex+1,", Col:",e.colIndex+1),t.createElement("td",null,e.value)))))))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:o,value:$,placeholder:h("qm.table.highSearch.configText"),disabled:!v,onChange:e=>{const{value:t}=e.target;q(t)}}),t.createElement(nr,{type:"primary",disabled:!$||!v,style:{marginLeft:"10px"},onClick:()=>Dn(void 0,void 0,void 0,(function*(){if(!_)return tr("Table","必须设置组件参数 `uniqueKey` 才能保存");if(!v)return;const e=Na(),t=[...D,{text:$,value:e,condition:{input:v,config:N}}];H(t),q(""),yield Qt.setItem(_,t),yield W(_,t)}))},h("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${is.rowHeightMaps[o]}px`}},t.createElement("span",null,h("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,D.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===K}),title:e.text,onClick:()=>{return t=e.value,void j(t!==K?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:h("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Dn(void 0,void 0,void 0,(function*(){if(!n)return;const e=D.filter((e=>e.value!==n));H(e),yield Qt.setItem(_,e),yield W(_,e)}))}},t.createElement(et,null))))),!D.length&&t.createElement("div",{style:{padding:Wo}},t.createElement(ti,null)))))),t.createElement("div",{className:"bottom-bar",style:{position:"absolute",left:0,bottom:0,right:0,height:`${Ko[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",boxSizing:"border-box"}},t.createElement("div",null,h("qm.table.fastSearch.findTotal",{total:I})),t.createElement("div",null,t.createElement(nr,{onClick:()=>L("all"),style:{marginRight:8}},h("qm.table.fastSearch.queryAll")),t.createElement(nr,{type:"primary",onClick:()=>L("prev"),style:{marginRight:8}},h("qm.table.fastSearch.queryPrev")),t.createElement(nr,{type:"primary",onClick:()=>L("next"),style:{marginRight:8}},h("qm.table.fastSearch.queryNext")),t.createElement(nr,{onClick:()=>n()},h("qm.table.fastSearch.closeButton")))))},gd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,$size:i}=t.useContext(jo),{t:a}=Mn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:a("qm.table.fastSearch.settingTitle"),width:650,loading:!1,bodyStyle:{paddingBottom:`${Ko[i]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(tt,null))),t.createElement(Mi,d,t.createElement(fd,{onClose:()=>s(!1)})))}));gd.displayName="FastSearch";var vd={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"};const yd=e=>[vd.selectionColumnDefine,...e].filter((e=>!e.hidden)),bd=e=>e.some((e=>Array.isArray(e.children))),xd=e=>void 0!==e._groupLevel,Ed=(e,t)=>t.split(vd.separator).reduce(((e,t)=>null==e?void 0:e[t]),e),wd=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(wd)):0,Cd=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const l=t?`${t}${vd.separator}${r}`:r;if(n.push(l),Array.isArray(e[r]))return n;const i=Cd(e[r],l);return n.concat(i)}),[]),Sd=(e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:l}]=t,i=Object.keys(t[0])[0],a=t.slice(1),o=Object.groupBy(e,(e=>n(e,i))),s=Object.keys(o).sort(((e,t)=>{const n=(r=e,i=t,Number.isNaN(r-i)?r.toString().localeCompare(i.toString()):r-i);var r,i;return"ascend"===l?n:-n})),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],a)})),c};return r(e,t)},Nd={sum:e=>Ea(e.reduce(((e,t)=>e+t),0)),avg:e=>e.length>0?(e.reduce(((e,t)=>e+t),0)/e.length).toFixed(2):0,max:e=>e.length>0?Math.max(...e):void 0,min:e=>e.length>0?Math.min(...e):void 0,count:e=>Ea(e.length),unique:e=>new Set(e).size,empty:e=>e.filter((e=>Gn(e))).length,notEmpty:e=>e.filter((e=>!Gn(e))).length},Td=t.createContext(void 0),Id=e=>{const{prefixCls:n,pivotProps:r,size:l,getRowKey:i,flatColumns:a,tableData:o}=e,{initialGroup:s,initialCount:c}=r,d=e=>{const t=new Map;return sa(e).forEach((e=>t.set(i(e,e.index),e))),t},u=t.useRef({props:r,originGridData:o,flatGroupData:[],isTree:bd(o),keyRecordMap:d(o)}),[m,p]=t.useState({pivotRef:u,prefixCls:n,size:l,viewMode:"table",columns:a,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=a.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:[],sorterList:[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=a.map((e=>e.dataIndex)),r={};for(const l in e)n.includes(l)&&t.includes(e[l])&&(r[l]=e[l]);return r})(c):{},summationData:{}}),h=e=>{p((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((l=>{const i=l;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};hn((()=>{v(o),f("originGridData",o),f("isTree",bd(o)),f("keyRecordMap",d(o))}),[o]),hn((()=>{g(a)}),[a]),hn((()=>{h({size:l})}),[l]);const f=(e,t)=>{m.pivotRef.current[e]=t};f("props",r);const g=e=>{h({columns:e})},v=e=>{h({gridData:e})},y=e=>{h({groupGridData:e})},b=e=>{h({groupList:e})},x=e=>{h({filterList:e})},E=e=>{h({sorterList:e})},w=e=>{h({colorList:e})},C=e=>{h({expandedKeys:e})},S=e=>{h({searchResults:e})},N=e=>{h({switchIndex:e})},T=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),h({fillColorCells:t})},I=e=>{var t;h({countMethod:(t=Object.assign({},m.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},R=e=>{h({summationData:e})},O=t.useMemo((()=>Object.assign(Object.assign({},m),{setContext:h,getRowKey:i,setPivotGridRef:f,setColumns:g,setGridData:v,setGroupGridData:y,setGroupList:b,setFilterList:x,setSorterList:E,setColorList:w,setExpandedKeys:C,setSearchResults:S,setSwitchIndex:N,setFillColor:T,setCountMethod:I,setSummationData:R})),[m]);return t.createElement(Td.Provider,{value:O},e.children)},Rd=()=>t.useContext(Td),Od=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:l,gridData:i,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=Rd(),{originGridData:d}=n.current,{onGroupChange:u,onDataChange:m}=n.current.props,{t:p}=Mn(),h=t.useRef([]),f=t.useRef([]),g=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),v=t.useMemo((()=>l.map((e=>({label:Ia(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,l]),y=t.useMemo((()=>{const e=g.map((e=>({[e.fieldName]:e.order})));return he(e,h.current)?h.current:(h.current=e,e)}),[g]),b=[{label:p("qm.pivotGrid.group.ascend"),value:"ascend"},{label:p("qm.pivotGrid.group.descend"),value:"descend"}];t.useEffect((()=>{o(f.current)}),[y,d]),t.useLayoutEffect((()=>{const e=Sd(i,y,((e,t)=>{let n=va(e,t);return ae(n)&&(n=Object.values(n)),Array.isArray(n)&&(n=n.join(",")),Gn(n)?p("qm.pivotGrid.group.empty"):n}));var t;s(e),t=Cd(e),f.current=t,c("flatGroupData",((e,t=[])=>{const n=[];return function e(r,l,i=""){if(Array.isArray(r))r.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),n.push(...sa(r));else for(const a in r){const o=i?`${i}${vd.separator}${a}`:a,s=Object.keys(t[l])[0];n.push({id:o,_fieldName:s,_groupLevel:l}),e(r[a],l+1,o)}}(e,0),n})(e,y))}),[y,i]),Hl((()=>{null==u||u(g)}),[y]),Hl((()=>{null==m||m(i)}),[i]);const x=()=>{a([...r,{fieldName:"",order:"ascend"}])},E=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},w=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(D,{value:e.fieldName||void 0,placeholder:p("qm.table.editable.selectPlaceholder"),options:v,style:{width:160,margin:"0 10px"},onChange:t=>E("fieldName",e,t)}),t.createElement(D,{value:e.order,options:b,placeholder:p("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>E("order",e,t)}),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,p("qm.pivotGrid.group.title")),!!g.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},p("qm.pivotGrid.group.foldAll")),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(f.current)},p("qm.pivotGrid.group.unfoldAll")))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));he(t,n)||a(e)}},r.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},w(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:x},t.createElement(rt,{className:"icon"}),p("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!g.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(nt,{className:"icon"}),p("qm.pivotGrid.group.text"),g.length?`(${g.length})`:null))},kd=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:l,setFilterList:i,setGridData:a}=Rd(),{originGridData:o,isTree:s}=n.current,{onFilterChange:c}=n.current.props,{t:d}=Mn(),u=t.useRef([]),m=t.useMemo((()=>l.filter((e=>e.fieldName&&($a(e.expression)||!Gn(e.value))))),[l]),p=t.useMemo((()=>r.map((e=>({label:Ia(e.title),value:e.dataIndex})))),[r]),[h,f]=t.useState("and"),g=t.useMemo((()=>{const e=m.map((e=>{var t;return`${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}));return he(e,u.current)?u.current:(u.current=e,e)}),[m]);Hl((()=>{i(l.map((e=>Object.assign(Object.assign({},e),{logic:h}))))}),[h]),Hl((()=>{v(),null==c||c(m)}),[g]);const v=ci((()=>{const e=ka(m.map((e=>Object.assign(Object.assign({},Xn(e,["value"])),{condition:e.value}))));a(e?Zi(o,e,s):o)}),200),y=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],b=()=>{i([...l,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:h}])},x=(e,t,n)=>{var a;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(a=r.find((e=>e.dataIndex===n)).filter)||void 0===a?void 0:a.type)||"text";Object.assign(t,{type:e,expression:w(e)[0].value,value:""})}"expression"===e&&$a(n)&&Object.assign(t,{value:""}),i([...l])},E=e=>t.createElement(t.Fragment,null,t.createElement(D,{value:e.fieldName||void 0,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>x("fieldName",e,t)}),t.createElement(D,{value:e.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:w(e.type),style:{width:100,margin:"0 10px"},onChange:t=>x("expression",e,t)}),C(e),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{i(l.filter((t=>t!==e)))})(e)})),w=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",text:d("qm.table.highSearch.nullText")},{value:"nnil",text:d("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",text:d("qm.table.highSearch.nullText")},{value:"nnil",text:d("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.inText")},{value:"nlike",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"^=",label:d("qm.table.highSearch.startsWithText")},{value:"=$",label:d("qm.table.highSearch.endsWithText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}]}return t},C=e=>{var n,l;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{x("value",e,Gn(t)?"":t)}});case"date":return t.createElement(In,{popupClassName:is.popupClassName,defaultValue:null!==(n=Ca(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{x("value",e,Sa(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(l=r.find((t=>t.dataIndex===e.fieldName)))||void 0===l?void 0:l.dictItems)||[];return t.createElement(D,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{x("value",e,t)}},n.map((e=>t.createElement(D.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:$a(e.expression),onChange:t=>{x("value",e,t.target.value)}})}};return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&t.createElement(D,{value:h,options:y,style:{width:130},onChange:e=>f(e)})),t.createElement("div",{className:"list"},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},E(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:b},t.createElement(rt,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(it,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},Ld=()=>{const{prefixCls:e,pivotRef:n,columns:r,gridData:l,sorterList:i,setSorterList:a,setGridData:o}=Rd(),{onSorterChange:s}=n.current.props,{t:c}=Mn(),d=t.useMemo((()=>i.filter((e=>e.fieldName&&e.order))),[i]),u=t.useMemo((()=>r.map((e=>({label:Ia(e.title),value:e.dataIndex,disabled:i.some((t=>t.fieldName===e.dataIndex))})))),[i,r]);Hl((()=>{h(),null==s||s(d)}),[t.useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,h=()=>{var e;o((e=d,l.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:l}=r,i=va(t,e),a=va(n,e),o=p(i,a);if(0!==o)return"ascend"===l?o:-o}return 0})).slice(0)))},f=()=>{a([...i,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...i])},v=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(D,{value:e.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(D,{value:e.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)}));return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.sorter.title"))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.fieldName)),n=i.map((e=>e.fieldName));he(t,n)||a(e)}},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(rt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(at,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},Ad=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:l,searchResults:i,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=Rd(),{t:c}=Mn(),{getTitleFromCellValue:d}=gs(),[u,m]=t.useState(!1),p=t.useMemo((()=>i.length),[i]);Hl((()=>{u||setTimeout((()=>{s(0),o([])}),200)}),[u]);const h=(e,t)=>{const r=[];return e.forEach(((e,i)=>{l.forEach(((l,a)=>{const o=d(e,l,i,a)+"";o.includes(t)&&r.push({value:o,rowKey:n(e,e.index),dataIndex:l.dataIndex})})),Array.isArray(e.children)&&r.push(...h(e.children,t))})),r},f=ci((e=>{const t=e.target.value.trim();s(0),o(t?h(r,t):[])}),200),g=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&v()},v=()=>{if(!p)return;s((a+1)%p)},y=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!p)return;s((a-1+p)%p)})()},t.createElement(ot,null)),t.createElement("span",{className:"num"},p>0?a+1:a,"/",p),t.createElement("button",{className:"button-icon",onClick:()=>v()},t.createElement(st,null)));return t.createElement(H,{open:u,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.search.title")),t.createElement("button",{className:"button-icon",onClick:()=>m(!1)},t.createElement(lt,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:y(),onChange:f,onKeyUp:g}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>m(!u)},t.createElement(tt,{className:"icon"}),c("qm.pivotGrid.search.text")))},Pd=(e,t)=>e.map((e=>(e.children&&(e.children=Pd(e.children,t)),t(e)))),Fd=()=>{const{prefixCls:e,pivotRef:n,columns:r,setColumns:l}=Rd(),{uniqueKey:i,onColumnsChange:a}=n.current.props,{t:o}=Mn(),s=t.useMemo((()=>i?`grid_field_${i}`:""),[i]);t.useLayoutEffect((()=>{c()}),[]),Hl((()=>{u(r)}),[r]);const c=()=>{const e=m();e&&(null==a||a(e))},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),Object.assign({dataIndex:e.dataIndex},t)})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));he(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));if(!e)return;return fe(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Pd(r,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Pd(e,(e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},p=t.useMemo((()=>{let e=0;for(let t=0;t<r.length-1&&("left"!==r[t].fixed||r[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let n=0;n<r.length;n++)n===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(r[n]);return t}),[r]),h=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,o("qm.pivotGrid.field.title"))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:p,setList:e=>{const t=e.map((e=>e.dataIndex)),n=p.map((e=>e.dataIndex));he(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const l=e[r];r<t?l.fixed="left":delete l.fixed,r!==t&&n.push(l)}l(n),null==a||a(n)})(Ma(e))}},p.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Be,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},Ia(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...r];l(t),null==a||a(t)})(e)},e.hidden?t.createElement(ct,null):t.createElement(qe,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(H,{trigger:["click"],dropdownRender:()=>h(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(Qe,{className:"icon"}),o("qm.pivotGrid.field.text")))},_d=()=>{const{prefixCls:e,size:n,setContext:r}=Rd(),{t:l}=Mn(),i=[{label:l("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:l("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:l("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},i.map((e=>t.createElement("li",{key:e.value,className:Pe("ant-dropdown-menu-item check-item",{active:n===e.value}),onClick:()=>r({size:e.value})},t.createElement("span",{className:"label"},e.label),t.createElement("i",{className:"icon"},t.createElement($e,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},t.createElement("span",null,t.createElement(dt,{className:"icon"}),l("qm.pivotGrid.lineHeight.text")))},Dd="606060",Md="thin",Hd="d4d4d4",$d=(e,t)=>{t&&(e.height=Math.floor(.75*t))},qd=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Kd=()=>({top:{style:Md,color:{argb:Hd}},left:{style:Md,color:{argb:Hd}},bottom:{style:Md,color:{argb:Hd}},right:{style:Md,color:{argb:Hd}}}),jd=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Vd=()=>{const{prefixCls:e,pivotRef:n,columns:r,countMethod:l,summationData:i}=Rd(),{t:a}=Mn(),{exportXLSX:o}=(()=>{const{size:e}=Rd(),{t:t}=Mn(),{rowHeightMaps:n}=is,r=(e,t)=>{var n,r,l;return null!==(l=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==l?l:""};return{exportXLSX:(r,l,i,a)=>Dn(void 0,void 0,void 0,(function*(){const{columns:o,footSummation:s}=r,c=n[e],d=Ji(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=Ia(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const g=l.map(((e,t)=>{const n={};return d.forEach(((r,l)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?va(e,r.dataIndex):a(e,t,r,l)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=g.length,s&&i(d,l).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:a,summation:o}=n,s=(null==o?void 0:o.render)?o.render(l):va(e,a);r[a]=0===i&&""===s?t("qm.table.config.summaryText"):Kn(s)?Ta(s).join(""):s})),m.push(r)}));const{sheetName:v,useStyle:y}=r,b=new Xt.Workbook,x=b.addWorksheet(v);x.columns=p,x.addRows(u).forEach((e=>{y&&$d(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=ra(o,t.key),{align:r,theadAlign:l}=n;qd(e,l||r),y&&Object.assign(e,{font:{bold:!0,color:{argb:Dd}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Kd()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];y&&$d(e,c),e.eachCell(((e,t)=>{const l=x.getColumn(e.col),i=ra(o,l.key),{align:a}=i;qd(e,1===t||void 0===r?a:"right"),Object.assign(e,jd(i)),y&&Object.assign(e,{font:{color:{argb:Dd}},border:Kd()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),s&&x.addRows(m).forEach((e=>{y&&$d(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=ra(o,n.key),{align:l}=r;qd(e,1===t?l:"right"),Object.assign(e,jd(r)),y&&Object.assign(e,{font:{color:{argb:Dd}},border:Kd()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=yield b.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})})),importXLSX:(e,n)=>{const{columns:l,file:i}=e,a=Ji(l),o=new FileReader;o.onerror=()=>{R.error(t("qm.table.import.error"))},o.onload=e=>{const l=a.map((e=>Ia(e.title))),i=new Xt.Workbook,o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(l,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let l=e;Array.isArray(null==l?void 0:l.richText)&&(l=l.richText.map((e=>e.text)).join("")),ae(l)&&"text"in l&&(l=l.text),Ce(l)&&(l=Sa(l,Yo)),(null==l?void 0:l.formula)&&(l=null!==(r=l.result)&&void 0!==r?r:l.value),t[s[n]]=l}));const n={};return l.forEach(((e,l)=>{var i;const{dataIndex:o,dictItems:s}=a[l];Array.isArray(s)&&((null===(i=t[e])||void 0===i?void 0:i.toString().includes(","))?t[e]=t[e].split(",").map((e=>r(s,e))).filter((e=>""!==e)):t[e]=r(s,t[e])),ya(n,o,t[e])})),n}));null==n||n(t)}else R.error(t("qm.table.import.error"))}else R.error(t("qm.table.import.error"))})):R.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:s}=gs(),c=[{text:a("qm.pivotGrid.count.records"),value:"count"},{text:a("qm.pivotGrid.count.unique"),value:"unique"},{text:a("qm.pivotGrid.count.empty"),value:"empty"},{text:a("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:a("qm.pivotGrid.count.sum"),value:"sum"},{text:a("qm.pivotGrid.count.max"),value:"max"},{text:a("qm.pivotGrid.count.min"),value:"min"},{text:a("qm.pivotGrid.count.avg"),value:"avg"}],d={columns:ea(r),fileName:p().format(Xo),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},u=(e,t,n,r)=>{const{dataIndex:l,precision:i,formatType:a}=n;if(xd(e))return va(e,l);let o=s(e,n,t,r);return i>=0&&!a&&""!==o&&(o=Number(o)),o},m=()=>{if(!l||!Object.keys(l).length)return[];const e={};return d.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";(null==l?void 0:l[t])&&(n=c.find((e=>e.value===l[t])).text+" "+i.total[t]),ya(e,t,n)}})),[e]},h=e=>Dn(void 0,void 0,void 0,(function*(){const t=yield o(Object.assign(Object.assign({},d),{footSummation:!!Object.keys(l).length}),e,m,u);wi(t,`${p().format(Xo)}.xlsx`)})),f=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(ut,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.group")),onClick:()=>{h((()=>{const e=[];let t=0;return n.current.flatGroupData.forEach((n=>{const a=Object.assign({},n);xd(n)?(a._level=n._groupLevel,d.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(0===t)ya(a,e,s(n._record,r.find((e=>e.dataIndex===n._fieldName)),0,0));else{let t="";(null==l?void 0:l[e])&&(t=c.find((t=>t.value===l[e])).text+" "+Ed(i,n.id).subtotal[e]),ya(a,e,t)}})),t=n._groupLevel):t>0&&(a._level=n._level+t+1),e.push(a)})),e})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(mt,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.list")),onClick:()=>{h(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(H,{trigger:["click"],menu:{items:f},className:Pe("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(Ke,{className:"icon"}),a("qm.pivotGrid.export.text")))},zd=()=>{const{prefixCls:e,pivotRef:n,groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o,setContext:s}=Rd(),{uniqueKey:c}=n.current.props,{t:d}=Mn(),u=t.useMemo((()=>c?`grid_conf_${c}`:""),[c]),m=t.useRef({}),[h,f]=t.useState([]),[g,v]=t.useState({}),[y,b]=t.useState(""),x=(e,t)=>{v((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))};t.useLayoutEffect((()=>{E()}),[]),Hl((()=>{w()}),[h]);const E=()=>Dn(void 0,void 0,void 0,(function*(){try{if(!u)return;const e=yield Qt.getItem(u);Array.isArray(e)&&(f(e),v(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}})),w=()=>Dn(void 0,void 0,void 0,(function*(){try{if(!u)return;yield Qt.setItem(u,h)}catch(e){}})),C=()=>{const e=Na();f([{id:e,label:p().format(Xo),value:{groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o}},...h]),Bn((()=>x(e,!0)))},S=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,d("qm.pivotGrid.saved.title"))),t.createElement("div",{className:"list"},t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.id,className:Pe("ant-dropdown-menu-item sort-item",{active:e.id===y}),onClick:()=>(e=>{if(g[e.id])return;const t=y!==e.id,n=t?e.value:m.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),b(t?e.id:"")})(e)},t.createElement("div",{className:"label",style:{width:200}},g[e.id]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,f([...h])),x(e.id,!1)}}):t.createElement("span",null,e.label)),t.createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?t.createElement($e,null):t.createElement(He,null)),t.createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(h.filter((e=>e.id!==n)))}},t.createElement(lt,null))))))),t.createElement("div",{className:"add-record",style:{padding:10}},t.createElement("span",{className:"insert",onClick:C},t.createElement(rt,{className:"icon"}),d("qm.pivotGrid.saved.add"))));return t.createElement(H,{trigger:["click"],dropdownRender:()=>S(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o}:{},m.current=t}},t.createElement("span",null,t.createElement(pt,{className:"icon"}),d("qm.pivotGrid.saved.text")))},Wd=()=>{const{gridData:e}=Rd(),{t:n}=Mn();return t.createElement("div",{className:"alert-info"},t.createElement(ht,{className:"icon"}),n("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Bd=8;const Ud={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},Gd={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Yd=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Xd(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:l,borderRadius:i,visibleFirst:a}=e,o=t/2,s={};return Object.keys(Ud).forEach((e=>{const c=r&&Gd[e]||Ud[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,Yd.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-o-l;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=o+l;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-o-l;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=o+l}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?Bd:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":d.offset[1]=2*-u.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":d.offset[1]=2*u.arrowOffsetHorizontal-o}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const l=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,i.shiftX=!0,i.adjustX=!0}const a=Object.assign(Object.assign({},i),l);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,u,t,n),a&&(d.htmlRegion="visibleFirst")})),s}const Qd=e=>{const{value:n,defaultValue:r,disabled:l,disabledAlpha:i,className:a,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=os("",{value:n,defaultValue:r}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Xd({offset:0,arrowWidth:16,borderRadius:6}),h=ir("color-picker");return t.createElement(Zt,{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>t.createElement(Jt,{prefixCls:h,value:d,disabled:l,disabledAlpha:i,onChange:(e,t)=>{u(e.toRgbString()),null==s||s(m(e),t)},onChangeComplete:(e,t)=>{null==c||c(m(e),t)}})},t.createElement("div",{className:Pe(`${h}-btn`,a),style:o},t.createElement(en,{color:d,prefixCls:h})))};Qd.displayName="ColorPicker";const Zd=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,columns:l,colorList:i,setColorList:a,setFillColor:o}=Rd(),{flatGroupData:s}=n.current,{t:c}=Mn(),d=t.useRef([]),u=t.useMemo((()=>i.filter((e=>e.fieldName&&e.color&&($a(e.expression)||!Gn(e.value)||"col"===e.mode)))),[i]),m=t.useMemo((()=>l.map((e=>({label:Ia(e.title),value:e.dataIndex})))),[l]),p=t.useMemo((()=>yd(l)),[l]),h=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"},{label:c("qm.pivotGrid.fillColor.col"),value:"col"}];Hl((()=>{f()}),[t.useMemo((()=>{const e=u.map((e=>{var t;return{[e.color]:`${e.mode},${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}}));return he(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=ci((()=>{const e=[];u.forEach((t=>{const n=ka([Object.assign(Object.assign({},Xn(t,["value"])),{condition:t.value})]),l=Zi(s.filter((e=>!xd(e))),n);if("cell"===t.mode||"col"===t.mode)for(let n=0;n<l.length;n++)e.push({color:t.color,rowKey:r(l[n],l[n].index),dataIndex:t.fieldName});if("row"===t.mode)for(let n=0;n<l.length;n++){const i=r(l[n],l[n].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),g=()=>{a([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},v=(e,t,n)=>{var r;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(r=l.find((e=>e.dataIndex===n)).filter)||void 0===r?void 0:r.type)||"text";Object.assign(t,{type:e,expression:y(e)[0].value,value:""})}"expression"===e&&$a(n)&&Object.assign(t,{value:""}),a([...i])},y=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",text:c("qm.table.highSearch.nullText")},{value:"nnil",text:c("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",text:c("qm.table.highSearch.nullText")},{value:"nnil",text:c("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.inText")},{value:"nlike",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"^=",label:c("qm.table.highSearch.startsWithText")},{value:"=$",label:c("qm.table.highSearch.endsWithText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}]}return t},b=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(Qd,{defaultValue:e.color,style:{marginLeft:5},onChangeComplete:t=>v("color",e,t.hex)}),t.createElement(D,{value:e.mode,options:h,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:t=>v("mode",e,t)}),t.createElement(D,{value:e.fieldName||void 0,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>v("fieldName",e,t)}),"col"!==e.mode&&t.createElement(D,{value:e.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:y(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),"col"!==e.mode&&(e=>{var n,r;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,Gn(t)?"":t)}});case"date":return t.createElement(In,{popupClassName:is.popupClassName,defaultValue:null!==(n=Ca(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,Sa(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(r=l.find((t=>t.dataIndex===e.fieldName)))||void 0===r?void 0:r.dictItems)||[];return t.createElement(D,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(D.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:$a(e.expression),onChange:t=>{v("value",e,t.target.value)}})}})(e),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)}));return t.createElement(H,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.fillColor.title"))),t.createElement("div",{className:"list"},t.createElement(Gt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.fieldName)),n=i.map((e=>e.fieldName));he(t,n)||a(e)}},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},b(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(rt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(ft,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Jd=()=>t.createElement("div",{className:"top-bar"},t.createElement(lr,{size:4},t.createElement(Wd,null),t.createElement(q,{type:"vertical"}),t.createElement(Fd,null),t.createElement(Od,null),t.createElement(kd,null),t.createElement(Ld,null),t.createElement(q,{type:"vertical"}),t.createElement(_d,null),t.createElement(Zd,null),t.createElement(Ad,null),t.createElement(q,{type:"vertical"}),t.createElement(Vd,null)),t.createElement(lr,{size:4},t.createElement(zd,null))),eu=t.createContext(void 0),tu=e=>{var n,r;const{scrollbar:l}=e,{pivotRef:i,getRowKey:a,columns:o,groupGridData:s,setPivotGridRef:c}=Rd(),{rowSelection:d,treeExpandable:u,rowHighlight:m}=i.current.props,p=null===(n=null==u?void 0:u.defaultExpandAllRows)||void 0===n||n,h=t.useRef({bodyEl:null,rowVirtualizer:null}),[f,g]=t.useState({gridRef:h,scrollbarRef:l,selectionKeys:null!==(r=null==d?void 0:d.defaultSelectedRowKeys)&&void 0!==r?r:[],treeExpandKeys:p?ca(i.current.originGridData,(e=>a(e,e.index))):[],highlightKey:"",checkedColumnKey:"",updateLayout:0,clicked:[],isPingLeft:!1}),v=t.useMemo((()=>Math.max(0,wd(s)-1)),[s]),y=e=>{g((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((l=>{const i=l;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))},b=(e,t)=>{f.gridRef.current[e]=t};t.useLayoutEffect((()=>{I(),S()}),[o]),t.useLayoutEffect((()=>{(null==d?void 0:d.selectedRowKeys)&&y({selectionKeys:d.selectedRowKeys})}),[null==d?void 0:d.selectedRowKeys]),t.useLayoutEffect((()=>{void 0!==(null==m?void 0:m.currentRowKey)&&y({highlightKey:m.currentRowKey})}),[null==m?void 0:m.currentRowKey]);const x=e=>{Array.isArray(null==d?void 0:d.selectedRowKeys)||y({selectionKeys:e})},E=e=>{y({treeExpandKeys:e})},w=e=>{void 0===(null==m?void 0:m.currentRowKey)&&y({highlightKey:e})},C=e=>{y({checkedColumnKey:e})},S=()=>{y({updateLayout:f.updateLayout+1})},N=e=>{Ha(e,f.clicked,!0)||y({clicked:e})},T=e=>{y({isPingLeft:e})},I=()=>{const e=l.current.container.clientWidth,{defaultColumnWidth:t}=is,n=[];let r=0;if(o.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,r+=e.width):(e.renderWidth=void 0,n.push(e))})),n.length>0){const r=o.reduce(((e,n)=>e+(n.width||n.minWidth||t)),0);if(r<=e){const l=e-r;if(1===n.length)n[0].renderWidth=(n[0].minWidth||t)+l;else{const e=l/n.reduce(((e,n)=>e+(n.minWidth||t)),0);let r=0;n.forEach(((n,l)=>{if(0===l)return;const i=Math.floor((n.minWidth||t)*e);r+=i,n.renderWidth=(n.minWidth||t)+i})),n[0].renderWidth=(n[0].minWidth||t)+l-r}}else n.forEach((e=>{e.renderWidth=e.minWidth||t}))}else r=o.reduce(((e,n)=>e+(n.renderWidth=n.width||n.minWidth||t)),0)},R=t.useMemo((()=>Object.assign(Object.assign({},f),{indentDepth:v,setContext:y,setGridLayoutRef:b,setSelectionKeys:x,setTreeExpandKeys:E,setHighlightKey:w,setCheckColumnKey:C,forceUpdateLayout:S,setClicked:N,setPingLeft:T,updateColumnsWidth:I})),[f,v]);return t.createElement(eu.Provider,{value:R},e.children)},nu=()=>t.useContext(eu),ru=e=>{var n;const{column:r}=e,{columns:l,setColumns:i}=Rd(),{scrollbarRef:a}=nu(),o=t.useRef(null),[s,c]=t.useState(!1),d=t.useRef(document.onselectstart),u=t.useRef({startX:0,originSizeX:0,columnWidth:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const t=e.clientX-u.current.startX,n=(r.width||r.renderWidth)+t;n<(r.minWidth||is.defaultColumnWidth)||(m({columnWidth:n}),o.current.style.left=`${u.current.originSizeX+t}px`)},h=()=>{a.current.container.style.cursor="",r.width=u.current.columnWidth,i([...l]),Bn((()=>c(!1))),ql(document,"mousemove",p),ql(document,"mouseup",h),m({startX:0,originSizeX:0,columnWidth:0}),f()},f=()=>{document.onselectstart!==d.current&&(document.onselectstart=d.current)};return t.createElement(t.Fragment,null,t.createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),a.current.container.style.cursor="col-resize";const t=ha(e.target,a.current.container).left-a.current.scrollLeft+3;m({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),$l(document,"mousemove",p),$l(document,"mouseup",h),c(!0),Bn((()=>o.current.style.left=`${t}px`)),d.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(tn,{open:s,getContainer:null===(n=a.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},lu=e=>{var n;const{left:r}=e,{scrollbarRef:l,isPingLeft:i,setPingLeft:a}=nu(),o=Hn((e=>{a(e.target.scrollLeft>1)}));return t.useEffect((()=>{const e=l.current.container.children[0];return e.addEventListener("scroll",o),()=>{e.removeEventListener("scroll",o)}}),[]),t.createElement(tn,{open:!0,getContainer:null===(n=l.current)||void 0===n?void 0:n.container},t.createElement("div",{className:Pe("fixed-line",{active:i}),style:{left:r}}))},iu=()=>{const{pivotRef:e,columns:n}=Rd(),{indentDepth:r,updateLayout:l,checkedColumnKey:i,selectionKeys:a,setSelectionKeys:o,setCheckColumnKey:s}=nu(),{rowSelection:c}=e.current.props,{selectionColumn:d}=is,{indentWidth:u,selectionColumnDefine:m}=vd,p=t.useMemo((()=>yd(n)),[n]),h=t.useMemo((()=>p.filter((e=>"left"===e.fixed))),[p]),f=t.useMemo((()=>p.filter((e=>"left"!==e.fixed))),[p]),g=t.useMemo((()=>"radio"!==(null==c?void 0:c.type)),[c]),v=t.useMemo((()=>h.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?r*u:0)),0)),[r,l,h]),y=t.useMemo((()=>a.length>0&&a.length===e.current.keyRecordMap.size),[a]),b=t.useMemo((()=>a.length>0&&a.length<e.current.keyRecordMap.size),[a]),x=(n,l)=>t.createElement("div",{className:Pe(l?"fixed-left":"no-fixed"),style:{width:l?v:""}},n.map(((a,p)=>{const{dataIndex:h,title:f,align:v,width:x,renderWidth:E}=a,w={"selection-column":h===d,"col--center":"center"===v,"col--right":"right"===v,"col--checked":i===h},C=l&&1===p||!l&&p===n.length-1?r*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return t.createElement("div",{key:h,className:Pe("table-cell",w),style:S,onClick:()=>{return e=h,void([m.dataIndex].includes(e)||s(i!==e?e:""));var e}},h!==d?t.createElement("span",{className:"cell"},f):c&&g?t.createElement(M,{checked:y,indeterminate:b,onChange:t=>(t=>{var n;const r=t?Array.from(e.current.keyRecordMap.keys()):[];o(r),null===(n=null==c?void 0:c.onChange)||void 0===n||n.call(c,r,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",h!==d&&t.createElement(ru,{column:a}))})));return t.createElement("div",{className:"header"},x(h,!0),(e=>x(e))(f),t.createElement(lu,{left:v}))};function au(e,t,n){var r;let l,i=null!==(r=n.initialDeps)&&void 0!==r?r:[];function a(){var r,a,o,s,c;let d;n.key&&(null===(r=n.debug)||void 0===r?void 0:r.call(n))&&(d=Date.now());const u=e(),m=u.length!==i.length||u.some(((e,t)=>i[t]!==e));if(!(null===(a=n.noCache)||void 0===a?void 0:a.call(n))&&!m)return l;let p;if(i=u,n.key&&(null===(o=n.debug)||void 0===o?void 0:o.call(n))&&(p=Date.now()),l=t(...u),n.key&&(null===(s=n.debug)||void 0===s?void 0:s.call(n))){const e=Math.round(100*(Date.now()-d))/100,t=Math.round(100*(Date.now()-p))/100,r=t/16,l=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${l(t,5)} /${l(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return null===(c=null==n?void 0:n.onChange)||void 0===c||c.call(n,l),l}return a.updateDeps=e=>{i=e},a}function ou(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const su=(e,t,n)=>{let r;return function(...l){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,l)),n)}},cu=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},du=e=>e,uu=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},mu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const l=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(l(cu(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((t=>{const r=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void l({width:t.inlineSize,height:t.blockSize})}l(cu(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},pu={passive:!0},hu="undefined"==typeof window||"onscrollend"in window,fu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let l=0;const i=e.options.useScrollendEvent&&hu?()=>{}:su(r,(()=>{t(l,!1)}),e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:o}=e.options;l=a?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(l,r)},o=a(!0),s=a(!1);s(),n.addEventListener("scroll",o,pu);const c=e.options.useScrollendEvent&&hu;return c&&n.addEventListener("scrollend",s,pu),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",s)}},gu=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e){return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},vu=(e,{adjustments:t=0,behavior:n},r)=>{var l,i;const a=e+t;null===(i=null===(l=r.scrollElement)||void 0===l?void 0:l.scrollTo)||void 0===i||i.call(l,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class yu{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver((e=>{e.forEach((e=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()}))})):null);return{disconnect:()=>{var n;null===(n=t())||void 0===n||n.disconnect(),e=null},observe:e=>{var n;return null===(n=t())||void 0===n?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null===(n=t())||void 0===n?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options=Object.assign({debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:du,rangeExtractor:uu,onChange:()=>{},measureElement:gu,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1},e)},this.notify=e=>{var t,n;null===(n=(t=this.options).onChange)||void 0===n||n.call(t,this,e)},this.maybeNotify=au((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e,t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=null!==(t=null===(e=this.scrollElement)||void 0===e?void 0:e.window)&&void 0!==t?t:null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}},this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=null!==(e=this.scrollRect)&&void 0!==e?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=null!==(e=this.scrollOffset)&&void 0!==e?e:"function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let l=t-1;l>=0;l--){const t=e[l];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0},this.getMeasurementOptions=au((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,l)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:l})),{key:!1}),this.getMeasurements=au((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:l},i)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,a);for(let l=a;l<e;l++){const e=r(l),a=1===this.options.lanes?o[l-1]:this.getFurthestMeasurement(o,l),s=a?a.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(l),u=s+d,m=a?a.lane:l%this.options.lanes;o[l]={index:l,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=au((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const l=e.length-1,i=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:l};let a=bu(0,l,i,n),o=a;if(1===r)for(;o<l&&e[o].end<n+t;)o++;else if(r>1){const i=Array(r).fill(0);for(;o<l&&i.some((e=>e<n+t));){const t=e[o];i[t.lane]=t.end,o++}const s=Array(r).fill(n+t);for(;a>=0&&s.some((e=>e>=n));){const t=e[a];s[t.lane]=t.start,a--}a=Math.max(0,a-a%r),o=Math.min(l,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null),{key:"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=au((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,l)=>null===r||null===l?[]:e({startIndex:r,endIndex:l,overscan:t,count:n})),{key:"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const l=r.key,i=this.elementsCache.get(l);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(l,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{var n;const r=this.measurementsCache[e];if(!r)return;const l=t-(null!==(n=this.itemSizeCache.get(r.key))&&void 0!==n?n:r.size);0!==l&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,l,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(this.options.debug&&console.info("correction",l),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.measureElement=e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))},this.getVirtualItems=au((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,l=e.length;r<l;r++){const l=t[e[r]];n.push(l)}return n}),{key:"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return ou(t[bu(0,t.length-1,(e=>ou(t[e]).start),e)])},this.getOffsetForAlignment=(e,t,n=0)=>{const r=this.getSize(),l=this.getScrollOffset();"auto"===t&&(t=e>=l+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const i=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),l=this.getScrollOffset();if("auto"===t)if(n.end>=l+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=l+this.options.scrollPaddingStart))return[l,t];t="start"}const i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:t="auto",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const l=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[l,a]=r;this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame((()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,a);var r,l;n?(r=n[0],l=t,Math.abs(r-l)<1.01||i(a)):console.warn("Failed to get offset for index:",e)}))},i=t=>{this.targetWindow&&(r++,r<10?(this.options.debug&&console.info("Schedule retry",r,10),this.targetWindow.requestAnimationFrame((()=>l(t)))):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};l(t)},this.scrollBy=(e,{behavior:t}={})=>{"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e,t;const n=this.getMeasurements();let r;if(0===n.length)r=this.options.paddingStart;else if(1===this.options.lanes)r=null!==(t=null===(e=n[n.length-1])||void 0===e?void 0:e.end)&&void 0!==t?t:0;else{const e=Array(this.options.lanes).fill(null);let t=n.length-1;for(;t>=0&&e.some((e=>null===e));){const r=n[t];null===e[r.lane]&&(e[r.lane]=r.end),t--}r=Math.max(...e.filter((e=>null!==e)))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const bu=(e,t,n,r)=>{for(;e<=t;){const l=(e+t)/2|0,i=n(l);if(i<r)e=l+1;else{if(!(i>r))return l;t=l-1}}return e>0?e-1:0};const xu="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function Eu(t){return function(t){const n=e.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},t),{onChange:(e,r)=>{var l;r?Ht(n):n(),null===(l=t.onChange)||void 0===l||l.call(t,e,r)}}),[l]=e.useState((()=>new yu(r)));return l.setOptions(r),xu((()=>l._didMount()),[]),xu((()=>l._willUpdate())),l}(Object.assign({observeElementRect:mu,observeElementOffset:fu,scrollToFn:vu},t))}const wu=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Cu=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Su=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!wu(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Nu({ref:t,handler:n,enabled:r=!0,omitClassNames:l=[]}){const i=Hn(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{Su(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&Su(e,t)&&Cu(e,l)&&(a.current.isPointerDown=!1,i(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&Su(e,t)&&Cu(e,l)&&(a.current.isPointerDown=!1,i(e))},c=wu(t.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[n,t,i,a,r])}const Tu=e=>{const{pivotRef:n,getRowKey:r,size:l}=Rd(),{scrollbarRef:i,clicked:a,setHighlightKey:o,setClicked:s}=nu(),{flatGroupData:c}=n.current,{rowHighlight:d}=n.current.props,u=t.useMemo((()=>2*is.rowHeightMaps[l]),[l]),m=t.useMemo((()=>c.filter((e=>!xd(e)))),[c]),p=Hn((t=>{var n,l;const{keyCode:c}=t;if(!Gn(a)&&(27===c&&(o(""),s([])),38===c||40===c)){Kl(t);const p=m.length;let h=m.findIndex((e=>r(e,e.index)===a[0]));const f=38===c?(--h+p)%p:++h%p,g=m[f],v=r(g,g.index);d&&!(null===(n=d.disabled)||void 0===n?void 0:n.call(d,g))&&(o(v),null===(l=d.onChange)||void 0===l||l.call(d,v,g)),((t,n,r)=>{const l=m.length,a=e.find((e=>e.key===r)),o=i.current.scrollTop,s=i.current.container.offsetHeight,c=a.top,d=a.height;"top"===t?c<o?i.current.SET_SCROLL_TOP(c):n===l-1&&i.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?i.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&i.current.SET_SCROLL_TOP(c)})(38===c?"top":"bottom",f,v),s([v,a[1]])}}));t.useLayoutEffect((()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p))),[])},Iu=e=>{const{column:n,keyPath:r,type:l}=e,{prefixCls:i,countMethod:a,summationData:o,setCountMethod:s}=Rd(),{t:c}=Mn(),{dataIndex:d,filter:u}=n,[m,p]=t.useState(!1),h=t.useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:Nd.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:Nd.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:Nd.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:Nd.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:Nd.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:Nd.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:Nd.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:Nd.avg}];return"number"===(null==u?void 0:u.type)?e:e.slice(0,-4)}),[]),f=t.useMemo((()=>{var e,t,n;const i=a[d];if(!i)return c("qm.pivotGrid.count.statistic");return`${h.find((e=>e.value===i)).text} ${null!==(n=null===(t=null===(s=o,u=r,e=u?Ed(s,u):s)||void 0===e?void 0:e[l])||void 0===t?void 0:t[d])&&void 0!==n?n:""}`;var s,u}),[o,a]);return t.createElement(H,{open:m,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},h.map((e=>{const n=e.value===a[d];return t.createElement("li",{key:e.value,className:Pe("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[d]:n?void 0:e.value}),p(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement($e,null)))})))),className:Pe("count-select",{show:!!a[d]}),overlayClassName:`${i}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},t.createElement("span",null,f," ",t.createElement(gt,{className:"icon"})))},Ru=(e,n)=>{const{pivotRef:r,columns:l,expandedKeys:i,searchResults:a,switchIndex:o,fillColorCells:s,setExpandedKeys:c}=Rd(),{gridRef:d,indentDepth:u,highlightKey:m,checkedColumnKey:p,selectionKeys:h,treeExpandKeys:f,setSelectionKeys:g,setTreeExpandKeys:v,setHighlightKey:y,setClicked:b}=nu(),{keyRecordMap:x,isTree:E}=r.current,{bodyEl:w,rowVirtualizer:C}=d.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,onRowEdit:I,onRowClick:R}=r.current.props,{t:O}=Mn(),{renderText:k,getTitleFromCellNode:L}=gs(),{selectionColumn:A,treeTable:P}=is,{indentWidth:F}=vd,_=t.useMemo((()=>n?0:yd(l).length-e.length),[l,e]),D=t.useMemo((()=>"radio"!==(null==S?void 0:S.type)),[S]),H=(e,t)=>{var n,r;null==S||S.checkStrictly;const l=D?e?[...h,t]:h.filter((e=>e!==t)):[t];g(l),null===(n=null==S?void 0:S.onSelect)||void 0===n||n.call(S,e,x.get(t)),null===(r=null==S?void 0:S.onChange)||void 0===r||r.call(S,l,$(l))},$=e=>{const t=[];return e.forEach((e=>t.push(x.get(e)))),t},q=(e,t)=>{var n,r;return(null===(n=a[o])||void 0===n?void 0:n.rowKey)===e&&(null===(r=a[o])||void 0===r?void 0:r.dataIndex)===t},j=(e,t)=>{const n=w.querySelectorAll(`li.table-row[data-row-key='${e}']`);Array.from(n).forEach((e=>{e.classList[t&&!(null==C?void 0:C.isScrolling)?"add":"remove"]("row--hover")}))},V=e=>t.createElement("button",{className:Pe("button-icon",{expand:i.includes(e.id)}),onClick:()=>{return t=e.id,void c(i.includes(t)?i.filter((e=>e!==t)):[...i,t]);var t}},t.createElement(yt,null)),z=(e,n,r,i)=>{const{dataIndex:a,width:o,renderWidth:s}=e,c={"expandable-column":a===A},d=1===n?(u-r._groupLevel)*F:0,m={width:`${(o||s||0)+d}px`,minWidth:`${(o||s||0)+d}px`};return t.createElement("div",{key:a,className:Pe("label-cell",c),style:m},a!==A?t.createElement(t.Fragment,null,1===n&&t.createElement("span",{className:"title"},(e=>{const{_record:n,_fieldName:r}=e,i=va(n,r),a=l.find((e=>e.dataIndex===r));return Gn(i)||!a?t.createElement("span",{className:"empty"},O("qm.pivotGrid.group.empty")):a.render?a.render(i,n,a,0,0):k(i,a,n)})(r)),t.createElement(Iu,{column:e,keyPath:r.id,type:"subtotal"})):V(r))},W=(e,n)=>{var r,l;const i=null===(r=null==N?void 0:N.rowExpandable)||void 0===r?void 0:r.call(N,e);return t.createElement(_e,{className:Pe("cell--expand",{fold:!f.includes(n),disabled:i}),style:{visibility:(null===(l=e.children)||void 0===l?void 0:l.length)>0?"visible":"hidden"},onClick:()=>{i||(e=>{var t,n;const r=f.includes(e),l=r?f.filter((t=>t!==e)):[...f,e];v(l),null===(t=null==N?void 0:N.onExpand)||void 0===t||t.call(N,!r,x.get(e)),null===(n=null==N?void 0:N.onChange)||void 0===n||n.call(N,l)})(n)}})},B=(e,n,r,l,i)=>{var a,o;const{dataIndex:c,width:d,renderWidth:u,align:m,render:f}=e,g=va(r,c),v=f?f(g,r,e,r.index,n):k(g,e,r),x=L(v),w=h.includes(i),C={"selection-column":c===A,"col--center":"center"===m,"col--right":"right"===m,"col--checked":p===c,active:q(i,c)},N={width:`${d||u||0}px`,minWidth:`${d||u||0}px`,backgroundColor:s.get(`${i}|${c}`)};return t.createElement("div",{key:c,"data-col-index":n,title:x,className:Pe("table-cell",C),style:N,onClick:t=>{var n,l;c!==A&&(b([i,c]),T&&!(null===(n=T.disabled)||void 0===n?void 0:n.call(T,r))&&(y(i),null===(l=T.onChange)||void 0===l||l.call(T,i,r)),null==R||R(r,e,t))}},c!==A?t.createElement(t.Fragment,null,E&&1===n&&t.createElement(t.Fragment,null,(O=r._level)?t.createElement("span",{key:O,className:`cell--indent indent-level-${O}`,style:{paddingLeft:O*P.textIndent+"px"}}):null,W(r,i)),t.createElement("span",{className:"cell"},v)):t.createElement("div",{className:"action"},t.createElement("span",{className:"drag-icon"}),t.createElement("div",{className:"middle"},t.createElement("span",{className:"order"},((e,t)=>E?0===e._level?e._varIndex+1:null:t+1)(r,l)),S&&t.createElement(t.Fragment,null,D?t.createElement(M,{className:"checkbox",checked:w,disabled:null===(a=null==S?void 0:S.disabled)||void 0===a?void 0:a.call(S,r),onChange:e=>H(e.target.checked,i)}):t.createElement(K,{className:"checkbox",checked:w,disabled:null===(o=null==S?void 0:S.disabled)||void 0===o?void 0:o.call(S,r),onChange:e=>H(e.target.checked,i)}))),t.createElement("span",{className:"expand-icon",onClick:()=>null==I?void 0:I(r,l)},I?t.createElement(vt,null):null)));var O};return{renderGroupRow:(n,r)=>t.createElement("div",{className:"label-row"},e.map(((e,t)=>z(e,_+t,n)))),renderRow:(n,r,l)=>{const i={"row--selection":h.includes(l),"row--highlight":m===l};return t.createElement("li",{key:l,"data-row-key":l,className:Pe("table-row",i),onMouseEnter:()=>j(l,!0),onMouseLeave:()=>j(l)},e.map(((e,t)=>B(e,_+t,n,r,l))))}}},Ou=e=>{const{tbodyColumns:n,layout:r,displayList:l,virtualRows:i,notGroup:a}=e,{indentDepth:o,updateLayout:s}=nu(),{indentWidth:c}=vd,d=t.useMemo((()=>n.filter((e=>"left"===e.fixed))),[n]),u=t.useMemo((()=>d.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?o*c:0)),0)),[o,s,d]),{renderGroupRow:m,renderRow:p}=Ru(d,!0);return t.createElement("div",{className:"left-panel",style:{width:u}},t.createElement("div",{className:Pe("container",{"no-group":a})},i.map((e=>{const n=e.index,i=r[n],a=l[n];if(xd(a))return t.createElement("div",{key:a.id,className:Pe("group-label",`level${a._groupLevel}`),style:{top:i.top,left:i.left,right:0,height:i.height}},m(a,i.key));const o=n===r.length-1||xd(l[n+1]);return t.createElement("div",{key:i.key,className:Pe("row-item",{last:o}),style:{top:i.top,left:i.left,right:0,height:i.height}},p(a,a._varIndex,i.key))}))))},ku=e=>{const{tbodyColumns:n,layout:r,displayList:l,virtualRows:i,notGroup:a}=e;Rd();const o=t.useMemo((()=>n.filter((e=>"left"!==e.fixed))),[n]),{renderGroupRow:s,renderRow:c}=Ru(o);return t.createElement("div",{className:"main-panel"},t.createElement("div",{className:Pe("container",{"no-group":a})},i.map((e=>{const n=e.index,i=r[n],a=l[n];if(xd(a))return t.createElement("div",{key:a.id,className:Pe("group-label",`level${a._groupLevel}`),style:{top:i.top,left:0,right:i.right,height:i.height}},s(a,i.key));const o=n===r.length-1||xd(l[n+1]);return t.createElement("div",{key:i.key,className:Pe("row-item",{last:o}),style:{top:i.top,left:0,right:i.right,height:i.height}},c(a,a._varIndex,i.key))}))))},Lu=()=>{const{pivotRef:e,getRowKey:n,prefixCls:r,size:l,columns:i,groupGridData:a,expandedKeys:o,searchResults:s,switchIndex:c}=Rd(),{scrollbarRef:d,treeExpandKeys:u,setGridLayoutRef:m}=nu(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:f}=vd,{rowHeightMaps:g}=is,v=t.useRef(null),y=t.useMemo((()=>yd(i)),[i]),b=t.useMemo((()=>Array.isArray(a)),[a]),{contextMenu:x,closeMenu:E}=(({ref:e,popup:n,getTriggerContainer:r,prevent:l,prefixCls:i="",enabled:a=!0})=>{const o=t.useRef(null),s=t.useRef(null),c=e=>{s.current=e},[d,u]=t.useState(!1),[m,p]=t.useState(null),h={width:150,height:200,zIndex:9999};Nu({ref:o,handler:()=>f()});const f=()=>{u(!1),p(null),c(null)},g=Hn((e=>{if(e.preventDefault(),null==l?void 0:l(e.target))return f();c(e),u(!0),Bn((()=>{var t;const{width:n,height:r}=(null===(t=o.current)||void 0===t?void 0:t.getBoundingClientRect())||h,l=n,i=r,a=window.innerWidth,s=window.innerHeight;let c=e.clientX,d=e.clientY;c+l>a&&(c=Math.max(c-l,0)),d+i>s&&(d=Math.max(d-i,0)),p({x:c,y:d})}))}));t.useEffect((()=>{const t=(null==r?void 0:r(e.current))||e.current;return a&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const v={position:"fixed",top:`${(null==m?void 0:m.y)||0}px`,left:`${(null==m?void 0:m.x)||0}px`,zIndex:h.zIndex};return{contextMenu:t.createElement(tn,{open:d},t.createElement("div",{ref:o,className:`${i}__context-menu`,style:v},s.current?n(s.current):null)),closeMenu:f}})({ref:v,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:r,enabled:!!h,popup:e=>{var r;const l=Ul(e.target,"table-cell"),i=(null===(r=null==l?void 0:l.parentNode)||void 0===r?void 0:r.getAttribute("data-row-key"))||"",a=p.find((e=>n(e,e.index)==i)),o=Number((null==l?void 0:l.getAttribute("data-col-index"))||-1),s=y[o];return t.createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{var n;const r=(null===(n=e.disabled)||void 0===n?void 0:n.call(e,a,s))||!1;return t.createElement("li",{key:e.key,className:Pe("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":r}),onClick:()=>{var t;r||(Bn((()=>E())),null===(t=e.onClick)||void 0===t||t.call(e,a,s))}},e.prefix&&t.createElement("span",{className:"prefix"},e.prefix),t.createElement("span",{className:"label"},e.label),e.suffix&&t.createElement("span",{className:"suffix"},e.suffix))})))}}),w=e=>{var t;const n=p[e];for(let r=e+1;r<p.length;r++)if(null===(t=p[r]._parentRowKey)||void 0===t?void 0:t.startsWith(n.id)){Object.assign(n,{_record:p[r]});break}},C=t.useMemo((()=>{const e=new Map,t=[];return p.forEach(((r,l)=>{if(xd(r)){if(0===r._groupLevel)return e.set(r.id,o.includes(r.id)),w(l),void t.push(r);const n=r.id.slice(0,r.id.lastIndexOf(vd.separator));return void(o.includes(n)&&e.get(n)&&(e.set(r.id,o.includes(r.id)),w(l),t.push(r)))}const i=n(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(i,u.includes(i)),t.push(r))})),e.clear(),t}),[a,o,u]),S=t.useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],l=[],i=n,a=vd.indentWidth,o=vd.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;l.length>0&&l[l.length-1]._level>=e._groupLevel;){const e=l.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,l.length>0){const t=l[l.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}l[l.length-1];const t={key:e.id,top:s,left:a*e._groupLevel,right:a*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),l.push(t),s+=i}else{const n=l[l.length-1]||{left:0,right:0},a={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(a),s+=i,l.length>0&&(n._childHeight+=i)}}));l.length>0;){const e=l.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,l.length>0){const t=l[l.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(C,{getRowKey:n,rowHeight:g[l]})),[C,l]);Tu(S);const N=t.useMemo((()=>{if(b)return S.reduce(((e,t)=>e+t.height),0)+2*f;const e=S.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*f+2*f}),[b,S]),{rowVirtualizer:T,virtualRows:I}=(e=>{const{layout:n,isGroup:r}=e,{size:l}=Rd(),{scrollbarRef:i}=nu(),{rowHeightMaps:a}=is,o=t.useMemo((()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[i.current]),s=Eu({count:n.length,getScrollElement:()=>o,estimateSize:e=>n[e].height,overscan:1,noCache:r,rangeExtractor:e=>{var t;if(!r)return uu(e);const c=i.current.scrollTop,d=(null===(t=s.scrollElement)||void 0===t?void 0:t.offsetHeight)||o.offsetHeight,u=[];for(let e=0;e<n.length;e++){const t=n[e];c>t.top+t.height+a[l]||c+d+a[l]<t.top||u.push(e)}return u}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:S,isGroup:!b});Hl((()=>{const e=p.findIndex((e=>{var t;return n(e,e.index)===(null===(t=s[c])||void 0===t?void 0:t.rowKey)}));e>=0&&d.current.SET_SCROLL_TOP(e*g[l]);const t=y.findIndex((e=>{var t;return e.dataIndex===(null===(t=s[c])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=y.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);d.current.SET_SCROLL_LEFT(e)}}),[c,s]),t.useLayoutEffect((()=>{m("bodyEl",v.current),m("rowVirtualizer",T)}),[]);const R={tbodyColumns:y,layout:S,displayList:C,virtualRows:I,notGroup:b};return t.createElement("div",{ref:v,className:"body",style:{height:N}},t.createElement(Ou,R),t.createElement(ku,R),x)},Au=()=>{const{columns:e,groupGridData:n,countMethod:r,setSummationData:l}=Rd(),{indentDepth:i,updateLayout:a}=nu(),{selectionColumn:o}=is,{indentWidth:s}=vd,c=t.useMemo((()=>yd(e)),[e]),d=t.useMemo((()=>c.filter((e=>"left"===e.fixed))),[c]),u=t.useMemo((()=>c.filter((e=>"left"!==e.fixed))),[c]),m=t.useMemo((()=>d.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?i*s:0)),0)),[i,a,d]);Hl((()=>{l(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const l=e.map((e=>Yn(e,r)||0));n[r]=t[r](l)}return n},l=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},a={};Object.keys(t).forEach((e=>{a[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>Yn(e,n)||0));e[n]=t[n](r),a[n].push(...r)}i[r]={subtotal:e}}else{const e=l(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&a[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](a[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:l(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(n,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:Nd[e[n]]});return t})(r)))}),[r,n]);const p=(e,n)=>t.createElement("div",{className:Pe(n?"fixed-left":"no-fixed"),style:{width:n?m:""}},e.map(((r,l)=>{const{dataIndex:a,width:c,renderWidth:d}=r,u={"selection-column":a===o,"col--right":!0},m=n&&1===l||!n&&l===e.length-1?i*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return t.createElement("div",{key:a,className:Pe("table-cell",u),style:p},a!==o?t.createElement(Iu,{column:r,keyPath:"",type:"total"}):null)})));return t.createElement("div",{className:"footer"},p(d,!0),(e=>p(e))(u))},Pu=()=>{const{prefixCls:e,size:n}=Rd(),r=t.useRef(null);return t.createElement(tu,{scrollbar:r},t.createElement(Ei,{ref:r,wrapStyle:{height:"100%",maxHeight:"inherit"},className:Pe(`${e}__layout`,n)},t.createElement(iu,null),t.createElement(Lu,null),t.createElement(Au,null)))},Fu=()=>t.createElement("div",{className:"wrapper"},t.createElement(Pu,null)),_u={rowKey:"id",columns:[],dataSource:[]},Du=e=>{const n=mn(_u,e),{rowKey:r,fromTable:l,columns:i,dataSource:a,height:o,maxHeight:s,className:c,style:d}=n,{$size:u}=$n(n),m=Hn(((e,t)=>{const n="function"==typeof r?r(e,t):null==e?void 0:e[r];return void 0===n?(tr("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),p=(e,t="",n=0)=>e.map(((e,r)=>{const l=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,l,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),h=e=>{let t=!1;const n=(e=>e.filter((e=>![is.expandableColumn,is.selectionColumn,"index","pageIndex",is.operationColumn].includes(e.dataIndex))))(e).map((e=>{"left"===e.fixed&&(t=!0);const n=Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0});return l&&(void 0===n.fixed&&delete n.fixed,delete n.editRender),n}));return!t&&n.length&&(n[0].fixed="left",tr("PivotGrid","至少需要有一项 `fixed: left` 的固定列")),n},f=t.useMemo((()=>h(i)),[i]),g=t.useMemo((()=>p(a)),[a]),v=ir("pivot-grid"),y={[v]:!0,"is-from-table":l},b={height:o,maxHeight:o||s?s:500},x={prefixCls:v,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:Xn(n,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return t.createElement("div",{className:Pe(y,c),style:Object.assign(Object.assign({},d),b)},t.createElement(Id,x,t.createElement(Jd,null),t.createElement(Fu,null)))};Du.displayName="PivotGrid";const Mu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:l,prefixCls:i,flattenColumns:a}=t.useContext(jo),{rowKey:o,uniqueKey:s}=l.current.props,{t:c}=Mn(),{tableFullData:d}=l.current,[u,m]=t.useState(!1),p=()=>{m(!0)};t.useImperativeHandle(n,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},t.createElement("i",{className:"svgicon icon"},t.createElement(bt,null))),t.createElement(Mi,h,t.createElement(Du,{fromTable:!0,rowKey:o,uniqueKey:s,columns:a,dataSource:d})))}));Mu.displayName="PivotGrid";const Hu=e=>{const{columns:n,group:r,summary:l}=e,{tableRef:i,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(jo),{fetch:d}=i.current.props,{t:u}=Mn(),m=e=>{var t;const r=n.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:null!==(t=r.dictItems)&&void 0!==t?t:[]}},h=r.map((e=>Object.assign({dataIndex:e.group},m(e.group)))),f=l.map((e=>e.summary===is.groupSummary.total.value?{dataIndex:e.summary,title:is.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},m(e.summary)),{formula:e.formula}))),g=t.useMemo((()=>Object.assign({},s,{[is.sorterFieldName]:void 0,[is.groupSummary.summaryFieldName]:l.map((e=>`${e.formula}|${e.summary}`)).join(","),[is.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[is.currentPageName]:1})),[s,r,l]),[v,y]=t.useState(((e,t)=>[{title:u("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{var t;const r=null===(t=n.find((t=>t.dataIndex===e.dataIndex)))||void 0===t?void 0:t.groupSummary;let l=r?{summation:r}:null;return e.dataIndex===is.groupSummary.total.value&&(l={dataIndex:is.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?l:null)}))])(h,f)),[b]=t.useState(c?[]:(e=>{const t=La(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&ya(t,r,va(e[0],r))})),l.forEach((n=>{const r=n.summary!==is.groupSummary.total.value?n.summary:is.groupSummary.recordTotalIndex,l=n.formula;"count"===l&&ya(t,r,e.length),"sum"===l&&ya(t,r,Se(e,r)),"max"===l&&ya(t,r,Ne(e,r)[r]),"min"===l&&ya(t,r,Te(e,r)[r]),"avg"===l&&ya(t,r,(Se(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(i.current.tableFullData)),x=Object.assign(Object.assign({size:a,height:400},c?{fetch:{api:d.api,params:g,dataKey:null==d?void 0:d.dataKey}}:{dataSource:b}),{columns:v,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${p().format(Xo)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(lp,x)},$u=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:l,prefixCls:i,$size:a,flattenColumns:o}=t.useContext(jo),{uniqueKey:s}=l.current.props,{t:c}=Mn(),d=t.useRef(null),u=t.useRef(null),[m,p]=t.useState(!1),[h,f]=t.useState([]),[g,v]=t.useState(""),[y,b]=t.useState("");Hl((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;T(e),L(t)}else{const e=D();T((null==e?void 0:e.group)||[]),L((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{M()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![is.expandableColumn,is.selectionColumn,"index","pageIndex",is.operationColumn].includes(e.dataIndex)))),[o]),w=E.filter((e=>!e.groupSummary)).map((e=>({text:Ia(e.title),value:e.dataIndex}))),C=[is.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:Ia(e.title),value:e.dataIndex})))],S=[{text:c("qm.table.groupSummary.sumText"),value:"sum"},{text:c("qm.table.groupSummary.maxText"),value:"max"},{text:c("qm.table.groupSummary.minText"),value:"min"},{text:c("qm.table.groupSummary.avgText"),value:"avg"},{text:c("qm.table.groupSummary.countText"),value:"count"}],[N,T]=t.useState([]),[I,R]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(nr,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>Object.assign(Object.assign({},e),{disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[k,L]=t.useState([]),[A,P]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(nr,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>Object.assign(Object.assign({},e),{disabled:k.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===is.groupSummary.total.value?S.slice(S.length-1):S})}]),F=t.useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=k.length&&k.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,k]),_=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}))},D=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},M=()=>Dn(void 0,void 0,void 0,(function*(){if(!x)return;const e=D();if(e){const{group:t,summary:n}=e;T(t),L(n)}let t=yield Qt.getItem(x);t||(t=yield H(x),Array.isArray(t)&&(yield Qt.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),H=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),$=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),q={visible:m,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return t.createElement("div",{className:`${i}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(lp,{ref:d,size:a,columns:I,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{T(e)}},t.createElement(nr,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(lp,{ref:u,size:a,columns:A,dataSource:k,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{L(e)}},t.createElement(nr,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:F,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(nr,{type:"primary",disabled:!g||F,style:{marginLeft:"10px"},onClick:()=>Dn(void 0,void 0,void 0,(function*(){if(!x)return tr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Na(),t=[...h,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}}];f(t),b(e),v(""),yield Qt.setItem(x,t),yield $(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${is.rowHeightMaps[a]}px`}},t.createElement("span",null,c("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===y}),title:e.text,onClick:()=>{return t=e.value,void b(t!==y?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:c("qm.table.groupSummary.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Dn(void 0,void 0,void 0,(function*(){if(!n)return;const e=h.filter((e=>e.value!==n));f(e),n===y&&b(""),yield Qt.setItem(x,e),yield $(x,e)}))}},t.createElement(et,null))))),!h.length&&t.createElement("div",{style:{padding:Wo}},t.createElement(ti,null)))))),t.createElement(Mi,q,t.createElement(Hu,{columns:E,group:N,summary:k})),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(nr,{type:"primary",disabled:F,onClick:()=>(_(),void p(!0))},c("qm.table.groupSummary.confirmButton"))))},qu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l}=t.useContext(jo),{t:i}=Mn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:i("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-group-summary`,title:i("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(xt,null))),t.createElement(Mi,c,t.createElement($u,{onClose:()=>o(!1)})))}));qu.displayName="GroupSummary";const Ku=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:l,$size:i,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c,clearPagerFilter:d}=t.useContext(jo),{uniqueKey:u}=l.current.props,{t:m}=Mn(),p=t.useRef(null),[h,f]=t.useState([]),[g,v]=t.useState([]),[y,b]=t.useState(""),[x,E]=t.useState("");Hl((()=>{f(x?g.find((e=>e.value===x)).list:M()||[])}),[x]),t.useEffect((()=>{H()}),[]);const w=t.useMemo((()=>u?`superSearch_${u}`:""),[u]),C=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),S=ka(h),N=t.useMemo((()=>!(S&&Qi(S))),[S]),T=t.useMemo((()=>!!h.length&&N),[h,N]),I=[{value:"and",text:m("qm.table.highSearch.andText")},{value:"or",text:m("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Ia(e.title)}))),k=e=>["in","nin"].includes(e),L=(e,t)=>{let n;switch(e){case"number":n="number";break;case"date":n="date";break;case"checkbox":case"radio":n=t?"select-multiple":"select";break;default:n="text"}return n},A=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:m("qm.table.highSearch.gtText")},{value:"<",text:m("qm.table.highSearch.ltText")},{value:">=",text:m("qm.table.highSearch.gteText")},{value:"<=",text:m("qm.table.highSearch.lteText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:m("qm.table.highSearch.inText")},{value:"nin",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",text:m("qm.table.highSearch.inText")},{value:"nlike",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"^=",text:m("qm.table.highSearch.startsWithText")},{value:"=$",text:m("qm.table.highSearch.endsWithText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}]}return t},[P,F]=t.useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(nr,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(n)}},m("qm.table.highSearch.removeText")))},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:R,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:m("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const l=Object.values(t)[0],i=null===(n=C.find((e=>e.dataIndex===l)))||void 0===n?void 0:n.filter.type,a=A(i);e.fieldType=i,e.expression=l?null===(r=a[0])||void 0===r?void 0:r.value:"",e.condition=k(e.expression)?[]:"",l||(e.bracketLeft=e.bracketRight="")}})},{title:m("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:m("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{var t;const n=null===(t=C.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:A(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=k(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const l=C.find((t=>t.dataIndex===e.fieldName)),i=null==l?void 0:l.filter.type,a=null!==(r=null!==(n=null===(t=null==l?void 0:l.filter)||void 0===t?void 0:t.items)&&void 0!==n?n:null==l?void 0:l.dictItems)&&void 0!==r?r:[];return{type:L(i,k(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName||$a(e.expression),cornerSign:!1}}}},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{c(),d(),s(h.map((e=>Xn(e,["index","pageIndex"])))),D(),n()},D=()=>{w&&sessionStorage.setItem(w,JSON.stringify(h.filter((e=>!!e.fieldName))))},M=()=>{if(!w)return;const e=sessionStorage.getItem(w);return e?JSON.parse(e):null},H=()=>Dn(void 0,void 0,void 0,(function*(){if(!w)return;const e=M();e&&f(e);let t=yield Qt.getItem(w);t||(t=yield $(w),Array.isArray(t)&&(yield Qt.setItem(w,t))),Array.isArray(t)&&t.length&&(v(t),!e&&E(t[0].value))})),$=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),q=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(lp,{ref:p,size:i,columns:P,dataSource:h,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(n)&&("bracketLeft"===n&&(e[n]=e[n]?"":"("),"bracketRight"===n&&(e[n]=e[n]?"":")"),f([...h]))},onDataChange:e=>{f(e)}},t.createElement(nr,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),is.highSearch.showSQL&&S&&t.createElement("code",{className:"lang-js"},S)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:i,value:y,placeholder:m("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;b(t)}}),t.createElement(nr,{type:"primary",disabled:!y||N,style:{marginLeft:"10px"},onClick:()=>Dn(void 0,void 0,void 0,(function*(){if(!w)return tr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Na(),t=[...g,{text:y,value:e,list:h.filter((e=>!!e.fieldName))}];v(t),E(e),b(""),yield Qt.setItem(w,t),yield q(w,t)}))},m("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${is.rowHeightMaps[i]}px`}},t.createElement("span",null,m("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,g.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===x}),title:e.text,onClick:()=>{return t=e.value,void E(t!==x?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:m("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Dn(void 0,void 0,void 0,(function*(){if(!n)return;const e=g.filter((e=>e.value!==n));v(e),n===x&&E(""),yield Qt.setItem(w,e),yield q(w,e)}))}},t.createElement(et,null))))),!g.length&&t.createElement("div",{style:{padding:Wo}},t.createElement(ti,null)))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),t.createElement(nr,{type:"primary",disabled:T,onClick:()=>_()},m("qm.table.highSearch.searchButton"))))},ju=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l}=t.useContext(jo),{t:i}=Mn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:i("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-super-search`,title:i("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(Et,null))),t.createElement(Mi,c,t.createElement(Ku,{onClose:()=>o(!1)})))}));ju.displayName="SuperSearch";const Vu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:l,showReload:i,showPrint:a,showImport:o,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:m,showPivotGrid:p,showGroupSummary:h,showToolBox:f}=e,{global:g}=t.useContext(on),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(jo),{uniqueKey:E,exportExcel:w}=v.current.props,{t:C}=Mn(),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(null),F=t.useRef(null),_=t.useRef(!1),D=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[$,q]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),K={fullScreen:l,reload:i,print:a,import:o,export:s&&!(null==w?void 0:w.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:m,pivotGrid:p,groupSummary:h},[V,z]=t.useState(!1);Hl((()=>{_.current&&(B(),_.current=!1)}),[$]),t.useEffect((()=>{W()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return tr("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const W=()=>{if(!D||!f)return;const e=JSON.parse(localStorage.getItem(D));e||U(D).then((e=>{e&&(q(Object.assign({},$,e)),localStorage.setItem(D,JSON.stringify(e)))})).catch((()=>{})),e&&q(Object.assign({},$,e))},B=()=>{if(!D||!f)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(D,JSON.stringify(e)),G(D,e)},U=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==g?void 0:g.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),G=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==g?void 0:g.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),Y=e=>Dn(void 0,void 0,void 0,(function*(){z(!1),yield Wn(100),e.current.clickHandle()})),X=(e,t)=>{_.current=!0,q(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${b}--lg`]:"large"===y,[`${b}--sm`]:"small"===y};return t.createElement(t.Fragment,null,l&&t.createElement(hs,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),i&&t.createElement(fs,{ref:N,open:!f||$.reload}),a&&t.createElement(vs,{ref:T,tableColumns:r,open:!f||$.print}),o&&t.createElement(Os,{ref:I,tableColumns:r,open:!f||$.import}),s&&t.createElement(dd,{ref:R,tableColumns:r,open:(!f||$.export)&&!(null==w?void 0:w.hideIcon)}),c&&t.createElement(md,{ref:O,open:!f||$.clipboard}),d&&t.createElement(hd,{ref:k,columns:r,open:!f||$.collection}),u&&t.createElement(gd,{ref:L,open:!f||$.fastSearch}),p&&t.createElement(Mu,{ref:A,open:!f||$.pivotGrid}),h&&t.createElement(qu,{ref:P,open:!f||$.groupSummary}),m&&t.createElement(ju,{ref:F,open:!f||$.superSearch}),f&&t.createElement(H,{open:V,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.screen.full"))),onClick:()=>Y(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.refresh.text"))),onClick:()=>Y(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.print.text"))),onClick:()=>Y(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.import.textNoSpace"))),onClick:()=>Y(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.export.textNoSpace"))),onClick:()=>Y(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.clipboard.textNoSpace"))),onClick:()=>Y(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.selectCollection.text"))),onClick:()=>Y(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.fastSearch.text"))),onClick:()=>Y(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.pivotGrid.text"))),onClick:()=>Y(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.groupSummary.text"))),onClick:()=>Y(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.highSearch.text"))),onClick:()=>Y(F)}];return t.createElement(j,{items:e.filter((e=>K[e.key]))})})(),overlayClassName:Pe(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{z(e)}},t.createElement("span",{className:`${b}-toolbox`,title:C("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(wt,null)))))}));Vu.displayName="ToolBox";const zu=(e,t)=>e.map((e=>(e.children&&(e.children=zu(e.children,t)),t(e)))),Wu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:l}=t.useContext(on),{tableRef:i,prefixCls:a,$size:o}=t.useContext(jo),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=i.current.props,{t:m}=Mn(),p=t.useRef([]),[h,f]=t.useState(!1),g=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),v=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),b=t.useMemo((()=>c?`table_${c}`:""),[c]);Hl((()=>{w(r)}),[r]),t.useLayoutEffect((()=>{C()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:C})));const x=()=>{if(!b)return;const e=JSON.parse(localStorage.getItem(b));var t;if(e||(t=b,Dn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(b,JSON.stringify(e)),C()):(null==l?void 0:l.getComponentConfigApi)&&w(r)})).catch((()=>{})),!e)return;return fe(ta(e).map((e=>e.dataIndex)),ta(r).map((e=>e.dataIndex))).length>0?zu(r,(t=>{const n=ra(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):zu(e,(e=>{const t=ra(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},E=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=E(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),Object.assign({dataIndex:e.dataIndex},t)})),w=e=>{if(!b)return;const t=E(e),n=JSON.parse(localStorage.getItem(b));var r,a;i.current.columnsDefined&&!he(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,Dn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},C=()=>{const e=x();var t;e&&(t=S(e),p.current=t,null==u||u(e))},S=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const l=n.colSpan;l>1&&e.slice(r+1,r+l).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+l))})),t},N=()=>{const e=t=>t.map((t=>{const n=ra(r,t.dataIndex)||Qn(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));null==u||u(e(i.current.originColumns))},T=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:l}=n;if(0===r)return;if(1===r)return t.push(n);const i=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(l)));if(-1===i)return t.push(n);t.push(...p.current[i].map((({dataIndex:t},r)=>{const l=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(l.hidden=n.hidden),void 0!==n.fixed?l.fixed=n.fixed:l.fixed&&delete l.fixed),l})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==u||u(t)},I=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,T(r))},R=(e,n)=>{var l;const{colSpan:i,noFixed:a}=e;if(0===i)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=Ia(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,T(r)}}),t.createElement("i",{className:Pe(s),title:m("qm.table.columnFilter.draggable")},t.createElement(Be,null)),t.createElement("span",{className:"text",title:o},o),"main"===n?t.createElement("span",{className:Pe("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedLeft"),onClick:()=>I(e,"left")},t.createElement(Ct,null)),t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},t.createElement(St,null))):"sub"!==n?t.createElement("span",{className:Pe("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.cancelFixed"),onClick:()=>I(e)},t.createElement(et,null))):null);return!e.hidden&&(null===(l=e.children)||void 0===l?void 0:l.length)?t.createElement(V,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:O(e.children,e.dataIndex)},c):c},O=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement(Gt,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const l=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));he(l,i)||((e,t)=>{ra(r,t).children=e,null==u||u([...r])})(Ma(t),n)}},e.map((e=>R(e,"sub"))))),k={[`${a}__popper`]:!0,"column-filter__popper":!0,[`${a}--lg`]:"large"===o,[`${a}--sm`]:"small"===o},L=[`${a}-column-filter`,{selected:h}];return s?t.createElement(od,{action:["click"],popupVisible:h,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(nr,{type:"text",size:"small",onClick:N},m("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(Gt,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),n=g.map((e=>e.dataIndex));he(t,n)||T([...Ma(e),...y,...v])}},g.map((e=>R(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(Gt,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));he(t,n)||T([...g,...Ma(e),...v])}},y.map((e=>R(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(Gt,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));he(t,n)||T([...g,...y,...Ma(e)])}},v.map((e=>R(e,"right")))))),popupClassName:Pe(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Qo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Pe(L),title:d?m("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null)),!d&&t.createElement("span",null,m("qm.table.columnFilter.text")))):null}));Wu.displayName="ColumnFilter";const Bu=t.createContext({}),Uu=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"})),Gu=t.forwardRef(((e,n)=>{const{dataIndex:r,className:l,style:i}=e;return t.createElement("li",{ref:n,"data-index":r,className:Pe("list-item",l),style:i},e.children)}));Gu.displayName="ListItem";const Yu=t.forwardRef(((e,n)=>{var r,l;const{dataSource:i=[],height:a,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,m=t.useRef(null),p=Eu({count:i.length,getScrollElement:()=>{var e,t;return null!==(t=null===(e=m.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null},estimateSize:()=>s||40,overscan:3,onChange:(e,t)=>null==d?void 0:d(e,t)}),h=p.getVirtualItems();t.useImperativeHandle(n,(()=>({SCROLL_TO_INDEX:e=>p.scrollToIndex(e),SCROLL_TO_OFFSET:e=>p.scrollToOffset(e)})));const f=ir("virtual-list");return t.createElement(Ei,{ref:m,wrapStyle:{height:a,maxHeight:o},className:Pe(f,u),style:e.style},t.createElement("div",{className:"container",style:{height:p.getTotalSize()}},t.createElement("ul",{style:{transform:`translateY(${null!==(l=null===(r=h[0])||void 0===r?void 0:r.start)&&void 0!==l?l:0}px)`}},h.map((e=>t.createElement(Gu,{ref:p.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(i[e.index],e.index)))))))}));Yu.displayName="VirtualList";const Xu=e=>{const{column:n,isEnum:r,style:l,onChange:i}=e,{tableRef:a,$size:o,isWebPagination:s,flattenColumns:c,tableFlatData:d,pagerFilter:u,setPagerFilter:m,createWebPageData:p}=t.useContext(jo),{dataKey:h,inputCache:f,filterValue:g={}}=t.useContext(Bu),{t:v}=Mn(),{getTitleFromCellValue:y}=gs(),b=h.split("|")[0],{isTreeTable:x}=a.current,E=u,w=b;E[w];const C=Fn(E,["symbol"==typeof w?w:w+""]),S=t.useRef(!1),N=t.useMemo((()=>c.indexOf(n)),[c,n]),T=t.useRef(0),I=t.useMemo((()=>x?a.current.filteredTreeData.length:d.length),[d]),R=e=>{let t=s?sa(p()):Array.from(a.current.recordsMap.values());var r;e||(t=qa(t,C),r=t.length,T.current=r);const l=new Map;return t.forEach((e=>{const t=va(e,b);l.has(t)||l.set(t,y(e,n,e.index,N))})),l},k=e=>r?[{text:v("qm.table.highSearch.nullText"),value:""},...n.filter.items||n.dictItems||[]]:Array.from(R(e).entries()).map((([e,t])=>({text:t,value:e}))),L=t.useMemo((()=>k()),[]),A=t.useMemo((()=>Gn(C)?L:k(!0)),[]),[P,F]=t.useState(L),_=t.useMemo((()=>new Map(P.map((e=>[e.value,null])))),[P]),[D,H]=t.useState(f.current||""),[$,q]=t.useState((r?g.in:u[b])||A.map((e=>e.value))),K=t.useMemo((()=>Array.from(_.keys()).every((e=>$.includes(e)))),[$,_]),j=t.useMemo((()=>{const e=Array.from(_.keys()).filter((e=>$.includes(e)));return e.length>0&&e.length<P.length}),[$,P,_]),V=t.useMemo((()=>$.length===A.length),[$]);t.useEffect((()=>{D&&z(D)}),[]),Hl((()=>{null==i||i($,V)}),[$]),Hl((()=>{const e=V?null:$;if(!he(e,u[b]))return e?void m(Object.assign(Object.assign({},u),{[b]:e})):m(C)}),[P,$]);const z=e=>{F(L.filter((t=>t.text.includes(e))))},W=ci(z,200),B=e=>{var t;H(e),t=e,f.current=t,S.current||W(e)};return t.createElement("div",{className:"list-panel",style:l},t.createElement(O,{value:D,size:o,style:{width:200},placeholder:v("qm.table.filter.keywordSearch"),suffix:t.createElement(Nt,null),autoFocus:!0,allowClear:!0,onCompositionStart:()=>{S.current=!0},onCompositionEnd:e=>{S.current=!1,B(e.target.value)},onChange:e=>B(e.target.value)}),t.createElement("div",{className:"select-all"},t.createElement("div",{className:"action"},t.createElement(M,{checked:K,indeterminate:j,disabled:!P.length,onChange:e=>{q((t=>e.target.checked?[...new Set([...t,...Array.from(_.keys())])]:t.filter((e=>!_.has(e)))))}},v("qm.table.filter.selectAll")),t.createElement("i",{className:"divider"},"|"),t.createElement("button",{className:"btn invert",disabled:!P.length,onClick:()=>{q((e=>[...Array.from(_.keys()).filter((t=>!e.includes(t))),...e.filter((e=>!_.has(e)))]))}},v("qm.table.filter.invert"))),t.createElement("div",{className:"total"},r?null:`${I}/${T.current}`)),t.createElement(Yu,{className:"select-list",maxHeight:180,itemHeight:26,dataSource:P,renderItem:(e,n)=>t.createElement(t.Fragment,null,t.createElement(M,{key:n,checked:$.includes(e.value),onChange:t=>{q((n=>t.target.checked?[...n,e.value]:n.filter((t=>t!==e.value))))}},e.text),t.createElement("button",{className:"btn right",onClick:()=>{q((t=>he(t,[e.value])?t:[e.value]))}},v("qm.table.filter.onlyItem")))}))},Qu=t.forwardRef(((e,n)=>{const{value:r,style:l}=e,{$size:i,filters:a,pagerFilter:o,setPagerFilter:s}=t.useContext(jo),{dataKey:c,onChange:d}=t.useContext(Bu),{t:u}=Mn(),m=c.split("|")[0],p=e=>{if(!e){const e=a,t=c;e[t];return Fn(e,["symbol"==typeof t?t:t+""])}const t=Object.assign({},e);for(const e in t)(""===(n=t[e])||null==n)&&delete t[e];var n;return Object.keys(t).length?Object.assign({},a,{[c]:t}):p()},h=(e,t)=>{d(p(null!=e?e:r),null==t||t)};return t.useImperativeHandle(n,(()=>({doFinish:h}))),t.createElement(S,{className:"footer",style:Object.assign(Object.assign({},l),{justifyContent:"flex-end"})},t.createElement(nr,{size:i,onClick:()=>(()=>{if(o[m]){const e=o,t=m;e[t];const n=Fn(e,["symbol"==typeof t?t:t+""]);s(n)}d(p(),!0)})()},u("qm.table.filter.reset")),t.createElement(nr,{type:"primary",size:i,onClick:()=>h()},u("qm.table.filter.search")))}));Qu.displayName="FooterPanel";const Zu=e=>{const{column:n}=e,{$size:r}=t.useContext(jo),{filterValue:l={}}=t.useContext(Bu),{t:i}=Mn(),a=t.useRef(null),[o,s]=t.useState(Object.keys(l)[0]||"like"),[c,d]=t.useState(l[o]&&!$a(o)?l[o]:""),u=t.useMemo((()=>c?{[o]:c}:$a(o)?{[o]:1}:null),[o,c]),m=[{value:"like",label:i("qm.table.highSearch.inText")},{value:"nlike",label:i("qm.table.highSearch.ninText")},{value:"==",label:i("qm.table.highSearch.eqText")},{value:"!=",label:i("qm.table.highSearch.neqText")},{value:"^=",label:i("qm.table.highSearch.startsWithText")},{value:"=$",label:i("qm.table.highSearch.endsWithText")},{value:"nil",label:i("qm.table.highSearch.nullText")},{value:"nnil",label:i("qm.table.highSearch.notNullText")}];return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(D,{value:o,options:m,size:r,className:"condition",style:{width:70,marginRight:6},onChange:e=>{s(e),$a(e)&&d("")}}),t.createElement(O,{value:c,size:r,autoFocus:!0,style:{width:124,paddingLeft:6,paddingRight:2},placeholder:i("qm.table.filter.searchText",{text:Ia(n.title)}),disabled:$a(o),onChange:e=>{d(e.target.value)},onKeyDown:e=>{13===e.keyCode&&a.current.doFinish()}})),t.createElement(Xu,{column:n,style:{marginTop:6}}),t.createElement(Qu,{ref:a,value:u}))},Ju=e=>{var n,r;const{onChange:l}=e,{filterValue:i={}}=t.useContext(Bu),{t:a}=Mn(),[o,s]=t.useState({nil:null!==(n=i.nil)&&void 0!==n?n:0,nnil:null!==(r=i.nnil)&&void 0!==r?r:0});return Hl((()=>{const e={};for(const t in o)o[t]&&(e[t]=1);l(e)}),[o]),t.createElement("div",{style:e.style},t.createElement(M,{checked:!!o.nil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nnil:0}:null,{nil:t})))}},a("qm.table.highSearch.nullText")),t.createElement(M,{checked:!!o.nnil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nil:0}:null,{nnil:t})))}},a("qm.table.highSearch.notNullText")))},em=e=>{var n;const{column:r}=e,{$size:l}=t.useContext(jo),{filterValue:i={}}=t.useContext(Bu),{t:a}=Mn(),o=t.useRef(null),s="likes",[c,d]=t.useState(null!==(n=i[s])&&void 0!==n?n:""),[u,m]=t.useState({}),p=t.useMemo((()=>Object.keys(u).length?u:c?{[s]:c}:null),[c,u]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(O.TextArea,{value:c,size:l,autoFocus:!0,placeholder:a("qm.table.filter.searchAreaText",{text:Ia(r.title)}),style:{width:200},disabled:!!Object.keys(u).length,onChange:e=>{d(e.target.value)},onKeyDown:e=>{13===e.keyCode&&o.current.doFinish()}})),t.createElement(Ju,{style:{marginTop:6},onChange:e=>{Object.keys(e).length&&d(""),m(e)}}),t.createElement(Xu,{column:r,style:{marginTop:6}}),t.createElement(Qu,{ref:o,value:p}))},tm=e=>{const{$size:n}=t.useContext(jo),{filterValue:r={}}=t.useContext(Bu),{t:l}=Mn(),i=t.useRef(null),[a,o]=t.useState(r),s=e=>({value:a[e],size:n,disabled:Object.keys(a).some((e=>$a(e))),onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o((n=>Object.assign({},n,{[e]:t})))},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement($,Rn({},s(">"),{placeholder:l("qm.table.highSearch.gtText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement($,Rn({},s("<"),{placeholder:l("qm.table.highSearch.ltText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement($,Rn({},s("=="),{placeholder:l("qm.table.highSearch.eqText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement($,Rn({},s("!="),{placeholder:l("qm.table.highSearch.neqText"),style:{width:150}}))))),t.createElement(Ju,{style:{paddingLeft:20},onChange:e=>o(e)}),t.createElement(Qu,{ref:i,value:a}))},nm=e=>{const{$size:n}=t.useContext(jo),{filterValue:r={}}=t.useContext(Bu),{t:l}=Mn(),[i,a]=t.useState(r),o=e=>({value:Ca(i[e],Go),format:Go,size:n,disabled:Object.keys(i).some((e=>$a(e))),onChange:t=>{a((n=>Object.assign({},n,{[e]:Sa(t,Go)})))}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement(In,Rn({},o(">"),{placeholder:l("qm.table.highSearch.gtText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement(In,Rn({},o("<"),{placeholder:l("qm.table.highSearch.ltText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement(In,Rn({},o("=="),{placeholder:l("qm.table.highSearch.eqText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement(In,Rn({},o("!="),{placeholder:l("qm.table.highSearch.neqText"),style:{width:"150px"}}))))),t.createElement(Ju,{style:{paddingLeft:20},onChange:e=>a(e)}),t.createElement(Qu,{value:i}))},rm=e=>{const{column:n}=e,r=t.useRef(null);return t.createElement(t.Fragment,null,t.createElement(Xu,{column:n,isEnum:!0,onChange:(e,t)=>{r.current.doFinish(t?null:{in:e},!1)}}),t.createElement(Qu,{ref:r,style:{display:"none"}}))},lm=(e,t,n)=>{let r;for(let l=0;l<e.length;l++){const i=e[l];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=lm(i.children,t,n);e&&(r=e)}}return r},im=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&im(e.children,t),t(e)||e.children&&e.children.length))),am=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...am(e.children,t)),t(e)&&n.push(e)})),n},om=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=om(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},sm=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:sm(e.children,t,n,r)}):e)),cm=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...cm(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},dm=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][n]===t)return[t];if(Array.isArray(e[r].children)){const l=dm(e[r].children,t,n);if(l)return[e[r][n],l].flat()}}},um=(e,t)=>{var n;const r=(null===(n=e.children)||void 0===n?void 0:n.map((e=>e[t])))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...um(e,t)))),r},mm=t.forwardRef(((e,n)=>{const{className:r,style:l,filterable:i=!0,multiple:a,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:m,checkStrategy:p="SHOW_CHILD",placeholder:h,fieldsDefine:f,value:g,height:v,defaultSelectedKeys:y=[],defaultExpandedKeys:b=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:w=!0,onSelectChange:C,onCheckChange:S,onDragStart:N,onDragChange:T,onExpand:I}=e,{$size:R}=$n(e),{t:k}=Mn(),L=(null==f?void 0:f.valueKey)||"value",A=(null==f?void 0:f.textKey)||"text";null==f||f.children;const P=t.useRef(null),F=t.useRef(null),_=si(P),[D,M]=os(v,{value:v}),[H,$]=t.useState(!1),q=ci((()=>{M(P.current.offsetHeight-ee.current.offsetHeight-10)}),5);hn((()=>{v||q()}),[_.height]);const[K,j]=t.useState([]),[V,W]=t.useState({}),[B,U]=t.useState([]),[G,Y]=t.useState([]),[X,Q]=t.useState(""),[Z,J]=t.useState(x),ee=t.useRef(null),te=t.useRef([]),ne=t.useRef([]);t.useEffect((()=>{Array.isArray(s)&&(re(s),U(le(s)),W({}))}),[s]),t.useEffect((()=>{var e;oe(),d&&(null===(e=F.current)||void 0===e||e.focus())}),[]),Hl((()=>{oe()}),[null==c?void 0:c.params]),Hl((()=>{Y(ae())}),[V]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=om(K,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],re([...K]))},REMOVE_RECORD:e=>{var t;const n=lm(K,e,L);if(void 0===n&&K.find((t=>t[L]===e)))re(K.filter((t=>t[L]!==e)));else{const r=om(K,(e=>n===e[L]));if(!r)return;const l=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[L]));l>=0&&(r.children.splice(l,1),re([...K]))}},UPDATE_RECORD:(e,t)=>{const n=om(K,(t=>e===t[L]));n&&(Ie(n,t),re([...K]))}})));const re=e=>{j(e),te.current=e,ne.current=cm(e,L)},le=e=>{if(a)return y;const t=am(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},ie=e=>{var t;return(null===(t=dm(K,e,L))||void 0===t?void 0:t.slice(0,-1))||[]},ae=()=>{if(x)return ne.current;const e=[];return B.forEach((t=>{if(a){if("SHOW_ALL"===p&&!ne.current.includes(t)&&e.push(...ie(t)),"SHOW_CHILD"===p&&e.push(...ie(t)),"SHOW_PARENT"===p){const n=oo(K,t);if(n){const r=ie(t),l=um(n,L);e.push(...r,...[t,...l].filter((e=>ne.current.includes(e))))}}}else e.push(...ie(t))})),[...new Set([...b,...e])]},oe=()=>Dn(void 0,void 0,void 0,(function*(){var e;if(!c)return;const{api:t,params:n,dataKey:r,afterFetch:l,callback:i}=c;try{$(!0);const a=yield t(n);if(200===a.code){let t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[];t="function"==typeof l?yield l(t):t,re(t),U(le(t)),W({}),null==i||i(t)}}catch(e){}$(!1)})),se=e=>`${e}|${So.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ce=ir("search-tree"),de={[ce]:!0,[`${ce}--lg`]:"large"===R,[`${ce}--sm`]:"small"===R};return t.createElement("div",{ref:P,className:Pe(de,r),style:l},t.createElement("div",{ref:ee,className:"topper",style:{display:E||w?"":"none"}},E&&t.createElement(O,{ref:F,value:X,size:R,placeholder:h||k("qm.form.inputPlaceholder"),suffix:t.createElement(Nt,null),allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=im(te.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==se(n).indexOf(e)}));Q(e),j(t),Y(x||e?cm(t,L):ae())})(e.target.value)}),w&&t.createElement("a",{className:"trigger",onClick:()=>{J(!Z),Y(Z?[]:ne.current)}},Z?t.createElement(Fe,null):t.createElement(_e,null)," ",k(Z?"qm.form.collect":"qm.form.spread"))),t.createElement(ni,{spinning:H},t.createElement(z,{fieldNames:{title:A,key:L,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:D,disabled:e.disabled,checkStrictly:m,selectedKeys:null!=g?g:B,checkedKeys:null!=g?g:B,expandedKeys:G,treeData:K,loadData:u?({key:e,children:t})=>Dn(void 0,void 0,void 0,(function*(){var n;if(!c||t)return;const{api:r,params:l,dataKey:i,formatter:a=(e=>e),afterFetch:o}=c;try{const t=yield r(a(Object.assign(Object.assign({},l),{[L]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,i))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const l=sm(te.current,e,L,r);re(l)}}catch(e){}})):void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!X)return!1;const t=e[A]||"";return-1!==se(t).indexOf(X)},onDragStart:N,onDragEnter:e=>{Y(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),l=e.dropPosition-Number(r[r.length-1]),i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][L]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},a=[...K];let o;if(i(a,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===l)i(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];i(a,t,((t,r,l)=>{n=l,e=r})),-1===l?n.splice(e,0,o):n.splice(e+1,0,o)}else i(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(a)},onDragEnd:e=>{null==T||T(e,K)},onExpand:(e,t)=>{Gn(e)&&J(!1),ne.current.every((t=>e.includes(t)))&&J(!0),Y(e),null==I||I(e,t)},onSelect:e=>{U(e);const t=am(te.current,(t=>e.includes(ue(t,L))));null==C||C(a?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),m||("SHOW_CHILD"===p&&(e=e.filter((e=>!ne.current.includes(e)))),"SHOW_PARENT"===p&&(e=e.filter(((e,t,n)=>!n.includes(lm(K,e,L))))));const t=am(te.current,(t=>e.includes(ue(t,L))));null==S||S(a?t:t[0])}})))}));mm.displayName="QmSearchTree";const pm=e=>{var n;const{column:r}=e,{$size:l}=t.useContext(jo),{filterValue:i={}}=t.useContext(Bu),a=t.useMemo((()=>r.filter.items||r.dictItems||[]),[]),o=t.useMemo((()=>{const e=[];return function t(n){n.forEach((n=>{Array.isArray(n.children)?t(n.children):e.push(n.value)}))}(a),e}),[a]),[s,c]=t.useState(null!==(n=i.in)&&void 0!==n?n:o),[d,u]=t.useState({}),m=t.useMemo((()=>Object.keys(d).length?d:s.length===o.length?null:{in:s}),[s,d]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"tree-panel",style:r.filter.style},t.createElement(mm,{multiple:!0,value:s,dataSource:a,disabled:!!Object.keys(d).length,size:l,style:{height:238},onCheckChange:e=>{c(e.map((e=>e.value)))}})),t.createElement(Ju,{style:{marginLeft:-10,marginRight:-10,padding:"6px 0 0 20px",borderTop:"1px solid #e8e8e8"},onChange:e=>{Object.keys(e).length&&c([]),u(e)}}),t.createElement(Qu,{value:m}))},hm=e=>{const{column:n,filters:r}=e,{$size:l,prefixCls:i,pagerFilter:a,setFilters:o,clearSuperFilters:s}=t.useContext(jo),{t:c}=Mn(),[d,u]=t.useState(!1),m=t.useRef(""),p=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),h=t.useMemo((()=>!!Object.keys(r[p]||{}).length||!!a[n.dataIndex]),[r,a]),f=(e,t)=>{s(),o(e),t&&u(!1)},g=t.useMemo((()=>({dataKey:p,inputCache:m,filterValue:r[p],onChange:f})),[r]);t.useEffect((()=>{"radio"===n.filter.type&&tr("Table","表头筛选类型 `radio` 即将被弃用,请使用 `checkbox` 替代")}),[]);const v={text:e=>t.createElement(Zu,{column:e}),textarea:e=>t.createElement(em,{column:e}),number:e=>t.createElement(tm,{column:e}),date:e=>t.createElement(nm,{column:e}),radio:e=>v.checkbox(e),checkbox:e=>t.createElement(rm,{column:e}),tree:e=>t.createElement(pm,{column:e})},y={"head-filter__popper":!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l},b=["cell--filter",{selected:d,actived:h}];return t.createElement(od,{action:["click"],popupVisible:d,popup:(()=>{const e=v[n.filter.type];return e?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement(Bu.Provider,{value:g},e(n))):(tr("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Pe(y),popupStyle:{minWidth:150},onPopupVisibleChange:e=>u(e),builtinPlacements:Qo,destroyPopupOnHide:!0,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:Pe(b),title:c("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(Uu,null))))},fm=e=>{const{column:n}=e,{tableRef:r,bordered:l}=t.useContext(jo),{columns:i,resizable:a,columnsChange:o=Vn}=r.current.props,s=t.useMemo((()=>ia(n)),[n]),c={resizable:!0,"is--line":a&&!l};return t.createElement("div",{className:Pe(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:l}=r.current,a=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=ha(t,n.$table).left-l.current.scrollLeft+c;n.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||is.defaultColumnWidth)||(p=Math.floor(n),a.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(ra(i,s.dataIndex).width=p,o([...i]))},!1}})},gm=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:l,fetchParams:i,setSelectionKeysEffect:a,setInvalidRowKeys:o,setSpinning:s,pagination:c,isFetch:d,isWebPagination:u,createWebPageData:m}=t.useContext(jo),{t:p}=Mn(),{selectionRows:h,recordsMap:f}=r.current,{rowSelection:g}=r.current.props,{fetchAllRowKeys:v,selectAllOnCurrentPage:y,filterable:b,onSelectAll:x}=g,E=t.useRef([]),C=t.useMemo((()=>d&&!!v),[d,v]),S=t.useMemo((()=>!C&&!!y),[C,y]),N=t.useMemo((()=>(null==b||b)&&!S),[b,S]),T=()=>{const{disabled:e}=g;return(e?h.filter((t=>!e(t))):h).map((e=>l(e,e.index)))},I=()=>u?sa(m()):Array.from(f.values()),R=t.useMemo((()=>(()=>{const{disabled:e}=g;if(C)return E.current.length?E.current:Re(Array.from(f.keys()),T());if(!S)return e?Array.from(f.keys()).filter((t=>!e(f.get(t)))):Array.from(f.keys());const t=e?I().filter((t=>!e(t))).map((e=>l(e,e.index))):I().map((e=>l(e,e.index)));return Re(t,T())})()),[f,E,h,c]),O=n.filter((e=>!R.includes(e))),k=n.length-O.length,L=k>0&&k<R.length,A=!!k&&k===R.length;o(O);const P=()=>Dn(void 0,void 0,void 0,(function*(){var e;const t=v;let n=[];s(!0);try{const r=yield t.api(i);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:i}=g;i&&(n=fe(n,I().filter((e=>i(e))).map((e=>l(e,e.index))))),E.current=n}}catch(e){}return s(!1),n})),F=e=>Dn(void 0,void 0,void 0,(function*(){let t=[];t=C?e?yield P():[]:e?R.slice(0):[],t=[...new Set([...t,...O])],a(t),null==x||x(e,t)})),_=()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{F(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>Dn(void 0,void 0,void 0,(function*(){let e=[];e=fe(n,C?yield P():R),e=[...new Set([...e,...O])],a(e)}))},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{F(!1)}}];return t.createElement(j,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(M,{checked:A,indeterminate:L,disabled:!R.length,onChange:e=>F(e.target.checked)}),N&&t.createElement(H,{overlayClassName:"all-selection__popper",dropdownRender:()=>_()},t.createElement(_e,{className:"svgicon icon"})),S&&t.createElement(w,{placement:"top",title:p("qm.table.selection.currentPage")},t.createElement(ht,{className:"info"})))},vm=e=>{const{style:n}=e,{tableRef:r,getRowKey:l,rowExpandedKeys:i,setRowExpandedKeys:a,createAllExpandedKeys:o,filters:s,pagerFilter:c,superFilters:d}=t.useContext(jo),{expandable:u}=r.current.props,[m,p]=t.useState((null==u?void 0:u.defaultExpandAllRows)||!1);Hl((()=>{h(i)!==m&&p(!m)}),[i]),Hl((()=>{const{isTreeTable:e,filteredTreeData:t}=r.current;e&&(Gn(s)&&Gn(c)&&Gn(d)||!h(i)&&a([...t.map((e=>l(e,e.index)))]))}),[s,c,d]);const h=e=>o().every((t=>e.includes(t))),f={[`${ir("expand")}--icon`]:!0,expanded:m,collapsed:!m};return t.createElement("span",{className:Pe(f),title:"",onClick:e=>{e.stopPropagation(),p(!m),a(m?[]:o())},style:n})},ym=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),bm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),xm=e=>{const{tableColumns:n}=e,{tableRef:r,prefixCls:l,layout:i,flattenColumns:a,sorter:o,filters:s,superFilters:c,pagerFilter:d,selectionKeys:u,isFetch:m,isGroupSubtotal:p,treeExpandIndex:h,tableChange:f,setSorter:g,setElementStore:v,resetTableScroll:y,getStickyLeft:b,getStickyRight:x,createGroupData:E,createTableFullData:C,createTableFlatData:S}=t.useContext(jo),{ellipsis:N,resizable:T,multipleSort:I,rowSelection:R,expandable:O,tableConfig:k}=r.current.props,[L,A]=is.sortDirections,{t:P}=Mn(),{tableOriginData:F}=r.current,_=t.useRef(null),D=t.useMemo((()=>F.some((e=>Array.isArray(e.children)))),[F]),M=t.useMemo((()=>!m),[m]),H=t.useMemo((()=>!(null==O?void 0:O.hideExpandAll)),[O]),$=t.useMemo((()=>!!R&&(m?!(!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys):!R.hideSelectAll)),[m,R]);Hl((()=>{B(),f(),y()}),[o]),Hl((()=>{X(),f(),y()}),[s]),Hl((()=>{X(),f(),y()}),[c]),Hl((()=>{Z(),y()}),[d]),t.useEffect((()=>{!Gn(o)&&Bn((()=>B())),!Gn(s)&&Bn((()=>X()))}),[]),t.useLayoutEffect((()=>{q()}),[]);const q=()=>{v("$header",_.current)},K=(e,n,l)=>{var i,a,s;const{dataIndex:c,colSpan:d,rowSpan:u,fixed:m,align:p,theadAlign:h,theadClassName:f="",sorter:g,filter:v,required:y,headRender:E}=e;if(0===d)return null;const w=h||p,C=["header--column",{"col--ellipsis":null!==(i=e.ellipsis)&&void 0!==i?i:N,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!y,"column-has-sorter":g,"column-has-filter":v,"column--sort":!!o[c],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&!(null===(a=l[n+(null!=d?d:1)])||void 0===a?void 0:a.fixed),"cell-fix-right-first":"right"===m&&!(null===(s=l[n-1])||void 0===s?void 0:s.fixed),[f]:!!f}],S={left:"left"===m?`${b(c)}px`:"",right:"right"===m?`${x(c,"thead")}px`:""},I=T&&![is.expandableColumn,is.selectionColumn].includes(c);return t.createElement("th",{key:c,className:Pe(C),colSpan:d,rowSpan:u,style:Object.assign({},S),onClick:t=>W(t,e)},t.createElement("div",{className:"cell--wrapper"},E?t.createElement("div",{className:"cell--text cell"},E(e,r.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},j(e)),v?z(e):null)),I&&t.createElement(fm,{column:e}))},j=e=>{const{dataIndex:n,type:l,sorter:i,title:a,description:s}=e;if(n===is.selectionColumn&&"checkbox"===l){if("checkbox"===l)return t.createElement("div",{className:"cell"},$?t.createElement(gm,{selectionKeys:u}):P("qm.table.config.selectionText"));if("radio"===l)return t.createElement("div",{className:"cell"},a)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:Ia(a)},r.current.isTreeTable&&n===h&&H?t.createElement(vm,null):null,n===is.expandableColumn&&H?t.createElement(vm,null):a)),s&&c.push(t.createElement(w,{key:1,placement:"top",title:s},t.createElement(ht,{className:"tip"}))),i&&c.push(V(o[n])),c},V=e=>{const n=["svgicon cell--sorter__asc",{actived:e===L}],r=["svgicon cell--sorter__desc",{actived:e===A}];return t.createElement("div",{key:2,className:"cell--sorter",title:P("qm.table.sorter.text")},t.createElement("span",{className:Pe(n)},t.createElement(ym,null)),t.createElement("span",{className:Pe(r)},t.createElement(bm,null)))},z=e=>t.createElement(hm,{column:e,filters:s}),W=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===A?null:A:L;I?(delete o[r],g(Object.assign({},o,{[r]:t}))):g(Object.assign({},{[r]:t}))}},B=()=>{M&&U()},U=e=>{const t=Oe(o,(e=>null!==e));Y(t),e||Object.keys(t).length||Y({index:L})},G=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,Y=e=>{const{tableFullData:t}=r.current,n=((e,t)=>e.sort(((e,n)=>{for(const r in t){const l=a.find((e=>e.dataIndex===r)),i=t[r],o=va(e,r),s=va(n,r),c="function"!=typeof(null==l?void 0:l.sorter)?G(o,s):l.sorter(e,n);if(0!==c)return"ascend"===i?c:-c}return 0})).slice(0))(p?E(Ra(t)):t,e);C(n)},X=()=>{M&&Q()},Q=()=>{const e=c.length?ka(c):ka(s),t=""!==e?p?E(Zi(Ra(F),e,D)):Zi(F,e,D):F;C(t),U(!0)},Z=()=>{!M&&(null==k?void 0:k.openFetchFilterList)||S()},J=da(n),{tableBodyWidth:ee}=i;return t.createElement("div",{ref:_,className:`${l}--header-wrapper`},t.createElement("table",{className:`${l}--header`,cellSpacing:"0",cellPadding:"0",style:{width:ee?`${ee}px`:""}},t.createElement("colgroup",null,a.map((e=>{const{dataIndex:n,width:r,renderWidth:l}=e;return t.createElement("col",{key:n,style:{width:`${r||l}px`,minWidth:`${r||l}px`}})}))),t.createElement("thead",null,(e=>e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>K(t,n,e)))))))(J))))},Em=t.createContext([]),wm=(e,t,n,r,l,i,a,o,s,c)=>{var d;const{clientX:u,clientY:m}=e,{top:p,height:h}=e.target.getBoundingClientRect(),f=(((null==l?void 0:l.x)||0)-u-12)/r,g=s.filter((e=>{var t,n;return null===(n=null===(t=o[e])||void 0===t?void 0:t.children)||void 0===n?void 0:n.length}));let v=Cm(o,n.eventKey);if(m<p+h/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=Cm(o,t)}const y=v.key,b=v,x=v.key;let E=0,w=0;if(!g.includes(y))for(let e=0;e<f&&Nm(v);e+=1)v=v.parent,w+=1;const C=t.data,S=v.node;let N=!0;return Tm(v)&&0===v.level&&m<p+h/2&&i({dragNode:C,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?i({dragNode:C,dropNode:S,dropPosition:0})?E=0:N=!1:0===w?f>-1.5?i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:i({dragNode:C,dropNode:S,dropPosition:0})?E=c?1:0:i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:w,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:x,dropContainerKey:0===E?null:(null===(d=v.parent)||void 0===d?void 0:d.key)||null,dropAllowed:N}},Cm=(e,t)=>e[t],Sm=e=>e.split("-"),Nm=e=>{if(e.parent){const t=Sm(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Tm=e=>{const t=Sm(e.pos);return 0===Number(t[t.length-1])},Im=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:l,setRowExpandedKeys:i,createTableFullData:a,dataChange:o}=t.useContext(jo),{tableFullData:s,recordsMap:c,isTreeTable:d}=n.current,u=zn,m=t.useRef(null),p=t.useRef(null),h=t.useRef(null),f=t.useRef(),[g,v]=t.useState({}),[y,b]=t.useState(null),[x,E]=t.useState([]),[w,C]=t.useState(0),[S,N]=t.useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),T=e=>{N((t=>Object.assign({},t,e)))};t.useLayoutEffect((()=>{e&&v((e=>{const t={},n=(e,l=null,i=0)=>{const a=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:i,node:e,parent:l,pos:(d=(null==l?void 0:l.pos)||"0",u=o,`${d}-${u}`),nodes:[...(null==l?void 0:l.nodes)||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,i+1)),t[s]=c,a.push(c)})),a};return n(e),t})(s))}),[s]),t.useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const I=()=>{T({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==y&&(b(null),T({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),p.current=null,h.current=null},O=e=>{k(),window.removeEventListener("dragend",O)},k=(e,t,n)=>{T({dragOverNodeKey:null}),R(),m.current=null,window.removeEventListener("dragend",O)},L=e=>{const t=e.node.eventKey,n=e.dragNode.eventKey,l=e.node.pos.split("-"),i=e.dropPosition-Number(l[l.length-1]),c=(e,t,n)=>{for(let l=0;l<e.length;l++){if(r(e[l],e[l].index)===t)return n(e[l],l,e);e[l].children&&c(e[l].children,t,n)}},d=[...s];let u;if(c(d,n,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,l)=>{n=l,e=r})),-1===i?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));a(d),o()};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;m.current=t,p.current={x:e.clientX,y:e.clientY};const r=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(l,n);b(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Cm(t,e).children),n})(n,g)),C(2*is.treeTable.textIndent),i(r),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(h.current!==n&&(h.current=n),!m.current)return void I();const{dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b,dragOverNodeKey:E}=wm(e,m.current,t,w,p.current,u,Array.from(c.keys()),g,l,!d);-1===x.indexOf(o)&&b?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),m.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{var e;if(null===y)return;let t=[...l];const r=Cm(g,n);r&&(null===(e=r.children)||void 0===e?void 0:e.length)&&(t=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(l,n)),i(t)}),800)),m.current.eventKey!==o||0!==a?T({dragOverNodeKey:E,dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b}):I()):I()},onNodeDragOver:(e,t)=>{if(!m.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:i,dropContainerKey:a,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:h}=wm(e,m.current,t,w,p.current,u,Array.from(c.keys()),g,l,!d);-1===x.indexOf(i)&&o&&(m.current.eventKey===i&&0===r?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||I():n===S.dropPosition&&r===S.dropLevelOffset&&i===S.dropTargetKey&&a===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&h===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:r,dropTargetKey:i,dropContainerKey:a,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:h}))},onNodeDragLeave:(e,t)=>{h.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(I(),h.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,n=!1)=>{const{dropPosition:r,dropTargetKey:l,dropTargetPos:i,dropAllowed:a,dragOverNodeKey:o}=S;if(!a)return;if(T({dragOverNodeKey:null}),R(),null===l)return;const s=Object.assign(Object.assign({},((e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const l=Cm(r,e);return{eventKey:e,pos:l?l.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}})(l,{dropPosition:r,dragOverNodeKey:o,keyEntities:g})),{data:Cm(g,l).node});-1!==x.indexOf(l)&&tr("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=Sm(i),d={event:e,node:s,dragNode:m.current,dragNodesKeys:[m.current.eventKey].concat(x),dropToGap:0!==r,dropPosition:r+Number(c[c.length-1])};n||L(d),m.current=null},indent:w,dropOptions:S}};function Rm(){const[,t]=e.useReducer((e=>e+1),0);return t}const Om=t.forwardRef(((e,n)=>{const{rowKey:r,rowIndex:l,row:i,className:a,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,v=t.useRef({eventKey:r,data:i,props:e}),y=t.useRef(!1),[b,x]=t.useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===r&&0===E,I=C===r&&-1===E,R=C===r&&1===E,O=i._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const L={"body--row-draggable":!0,"body--row-dragging":b,"drop-target":S===r,"drop-container":N===r,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return t.createElement("tr",{ref:n,"data-row-key":r,"data-row-index":l,className:Pe(a,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),y.current=t)},onDragStart:e=>{if(e.stopPropagation(),y.current)return e.preventDefault();x(!0),u(e,v.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,v.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,v.current)},onDragLeave:e=>{e.stopPropagation(),h(e,v.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,v.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,v.current)}},e.children,C===r&&null!==E&&null!==w&&t.createElement("td",{className:"drop-indicator",style:k}))}));Om.displayName="DraggableTr";const km=e=>{const{selectionKeys:n,column:r,record:l,rowKey:i}=e,{tableRef:a}=t.useContext(jo),{rowSelection:o}=a.current.props,s=t.useMemo((()=>r.type||""),[r.type]),c=e=>{var t,r;const l=null===(t=o.checkStrictly)||void 0===t||t;if(!a.current.isTreeTable||l)return!1;const i=oa(a.current.deriveRowKeys,e);return((e,t)=>{const n=new Set(t);let r=!1,l=!1;for(const t of e)if(n.has(t)?r=!0:l=!0,r&&l)break;return r&&l})(_a(null!==(r=null==i?void 0:i.children)&&void 0!==r?r:[]),n)};return"radio"===s?(()=>{const e=o.disabled,r=null==e?void 0:e(l),a=!r&&n[0]===i;return t.createElement(K,{checked:a,disabled:r})})():(()=>{const e=o.disabled,r=null==e?void 0:e(l),a=!!n.includes(i);return t.createElement(M,{checked:a,indeterminate:c(i),disabled:r})})()},Lm=e=>{const{record:n,rowKey:r,style:l}=e,{tableRef:i,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(jo),{expandable:s={}}=i.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);Hl((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${ir("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:Pe(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];o(t)},style:l})},Am=t.createContext({}),Pm=t.forwardRef(((e,n)=>{var r;const{$size:l,doFieldValidate:i}=t.useContext(jo),{dataKey:a,doFieldUpdate:o,cellValueChange:s}=t.useContext(Am),{column:c,row:d,rowKey:u,columnKey:m,options:p,isTextArea:h}=e,{t:f}=Mn(),g=Rm(),v=t.useRef(!1),{dataIndex:y}=c,{type:b,extra:x={},rules:E=[],onInput:w,onChange:C,onEnter:S,onBlur:N}=p,T=va(d,y),I=Object.assign({},{minRows:1,maxRows:4},x.autoSize),R=h?{rows:I.minRows,autoSize:I}:null,k=x.password?O.Password:h?O.TextArea:O;return t.createElement(k,Rn({ref:n,size:l,value:T,maxLength:x.maxLength,showCount:x.showCount},R,{autoComplete:x.password?"new-password":"off",placeholder:null!==(r=x.placeholder)&&void 0!==r?r:f("qm.table.editable.inputPlaceholder"),allowClear:x.allowClear,readOnly:x.readOnly,disabled:x.disabled,suffix:x.suffix,onChange:e=>{var t;const n=null!==(t=e.target.value)&&void 0!==t?t:"";ya(d,y,n),i(E,n,u,m,Ia(c.title)),g(),null==w||w({[a]:n}),v.current=!0},onBlur:e=>{var t;const n=null!==(t=e.target.value)&&void 0!==t?t:"";v.current&&(v.current=!1,o(d,u,m),null==C||C({[a]:n},d),null==N||N({[a]:n},d),s())},onKeyUp:e=>{var t;if(13===e.keyCode&&!e.shiftKey){const n=null!==(t=e.target.value)&&void 0!==t?t:"";null==S||S({[a]:n},d)}},onKeyDown:e=>{h&&13===e.keyCode&&!e.shiftKey&&S&&e.preventDefault()}}))}));Pm.displayName="TextCell";const Fm=t.forwardRef(((e,n)=>{const{size:r,defaultValue:l,value:i,min:a,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:p,allowClear:h,readOnly:f,disabled:g,formatter:v=(e=>e.toString()),parser:y=(e=>e),onFocus:b}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<a&&(t=a.toString()),m>=0&&""!==t&&(t=new Yt(t).toFixed(m)),t},E=void 0!==i,[w,C]=t.useState(null!=l?l:""),S=v(E?i:w),N=y(S);Hl((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[w]);return t.createElement(O,{ref:n,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const n=y(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===m&&n.includes(".")&&(r=!1),a>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):C(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(N);null===(t=e.onBlur)||void 0===t||t.call(e,n,N)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(N),N))}})}));Fm.displayName="InputNumber";const _m=t.forwardRef(((e,n)=>{var r,l;const{$size:i,doFieldValidate:a}=t.useContext(jo),{dataKey:o,doFieldUpdate:s,cellValueChange:c}=t.useContext(Am),{column:d,row:u,rowKey:m,columnKey:p,options:h}=e,{t:f}=Mn(),g=Rm(),v=t.useRef(!1),{dataIndex:y,precision:b,formatType:x}=d,{type:E,extra:w={},rules:C=[],onInput:S,onChange:N,onEnter:T,onBlur:I}=h,R=va(u,y);let O,k;"finance"===x&&(O=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},k=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===x&&(O=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Yt(e).times(100).toNumber()}`,k=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Yt(e).times(.01).toString());const L=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"";return t.createElement(Fm,{ref:n,size:i,value:R,min:w.min,max:w.max,precision:b,stringMode:w.stringMode,prefix:w.prefix,suffix:null!==(r=w.suffix)&&void 0!==r?r:"percent"===x?"%":void 0,placeholder:null!==(l=w.placeholder)&&void 0!==l?l:f("qm.table.editable.inputPlaceholder"),maxLength:w.maxLength,allowClear:w.allowClear,readOnly:w.readOnly,disabled:w.disabled,formatter:O,parser:k,onChange:e=>{ya(u,y,e),a(C,e,m,p,Ia(d.title)),g(),null==S||S({[o]:e}),v.current=!0},onBlur:(e,t)=>{if(!v.current)return;v.current=!1;let n=w.stringMode?e:L(e);"percent"===x&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),ya(u,y,n),s(u,m,p),null==N||N({[o]:n},u),null==I||I({[o]:n},u),c()},onEnter:(e,t)=>{let n=w.stringMode?e:L(e);"percent"===x&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),null==T||T({[o]:n},u)}})}));_m.displayName="NumberCell";const Dm=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext(jo),{dataKey:a,doFieldUpdate:o,cellValueChange:s}=t.useContext(Am),{column:c,row:d,rowKey:u,columnKey:m,options:p,isMultiple:h}=e,{t:f}=Mn();Rm();const{dataIndex:g,dictItems:v=[]}=c,{type:y,extra:b={},rules:x=[],items:E,onChange:w,onEnter:C}=p,S=E||v,N=va(d,g);let T=N;return t.createElement(D,{mode:h?"multiple":void 0,size:l,popupClassName:is.popupClassName,value:N||void 0,placeholder:null!==(n=b.placeholder)&&void 0!==n?n:f("qm.table.editable.selectPlaceholder"),allowClear:b.allowClear,listHeight:b.listHeight,maxTagCount:b.collapseTags?"responsive":void 0,maxTagTextLength:b.maxTagTextLength,disabled:b.disabled,style:{width:"100%"},showSearch:null===(r=b.filterable)||void 0===r||r,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{ya(d,g,e),i(x,e,u,m,Ia(c.title)),o(d,u,m),null==w||w({[a]:e},d),s()},onSelect:e=>{T=e},onInputKeyDown:e=>{13===e.keyCode&&Bn((()=>null==C?void 0:C({[a]:T},d)))}},S.map((e=>t.createElement(D.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},Mm=e=>{var n;const{$size:r,doFieldValidate:l}=t.useContext(jo),{dataKey:i,doFieldUpdate:a,cellValueChange:o}=t.useContext(Am),{column:s,row:c,rowKey:d,columnKey:u,options:m,dateType:p}=e;Mn(),Rm();const{dataIndex:h}=s,{type:f,extra:g={},rules:v=[],onChange:y}=m,b=va(c,h);return t.createElement(In,{size:r,popupClassName:is.popupClassName,value:null!==(n=Ca(b,Xa[p]))&&void 0!==n?n:void 0,picker:Ya[p],format:g.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=g;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:g.placeholder,allowClear:g.allowClear,disabled:g.disabled,style:{width:"100%"},onChange:e=>{const t=Sa(e,Xa[p]);ya(c,h,t),l(v,t,d,u,Ia(s.title)),a(c,d,u),null==y||y({[i]:t},c),o()}})},Hm=e=>{var n;const{$size:r,doFieldValidate:l}=t.useContext(jo),{dataKey:i,doFieldUpdate:a,cellValueChange:o}=t.useContext(Am),{column:s,row:c,rowKey:d,columnKey:u,options:m}=e;Mn(),Rm();const{dataIndex:p}=s,{type:h,extra:f={},rules:g=[],onChange:v}=m,y="HH:mm:ss",b=va(c,p);return t.createElement(On,{size:r,popupClassName:is.popupClassName,value:null!==(n=Ca(b,y))&&void 0!==n?n:void 0,format:f.format||y,placeholder:f.placeholder,allowClear:f.allowClear,disabled:f.disabled,style:{width:"100%"},onChange:e=>{const t=Sa(e,y);ya(c,p,t),l(g,t,d,u,Ia(s.title)),a(c,d,u),null==v||v({[i]:t},c),o()}})},$m=e=>{const{$size:n,doFieldValidate:r}=t.useContext(jo),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Am),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e;Mn(),Rm();const{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],onChange:g}=u,{trueValue:v=Bo,falseValue:y=Uo,disabled:b}=h,x=va(s,m);return t.createElement(M,{checked:x===v,disabled:b,onChange:e=>{const t=e.target.checked?v:y;ya(s,m,t),r(f,t,c,d,Ia(o.title)),i(s,c,d),null==g||g({[l]:t},s),a()}})},qm=e=>{const{$size:n,doFieldValidate:r}=t.useContext(jo),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Am),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e;Mn(),Rm();const{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],onChange:g}=u,{trueValue:v=Bo,falseValue:y=Uo,disabled:b}=h,x=va(s,m);return t.createElement(W,{checked:x===v,disabled:b,onChange:e=>{const t=e?v:y;ya(s,m,t),r(f,t,c,d,Ia(o.title)),i(s,c,d),null==g||g({[l]:t},s),a()}})},Km=e=>{const{$size:n,doFieldValidate:r}=t.useContext(jo),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Am),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],render:g,onChange:v}=u;if(!g)return tr("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const y=va(s,m),b=e=>{ya(s,m,e),r(f,e,c,d,Ia(o.title)),i(s,c,d),null==v||v({[l]:e},s),a()},x=g(s,o,b);return t.isValidElement(x)?t.cloneElement(x,{value:y,disabled:h.disabled,readOnly:h.readOnly,popupClassName:is.popupClassName,onChange:b}):null},jm=e=>{var n,r,l;const{multiple:i,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=$n(e),{t:m}=Mn(),[p,h]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${ir("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Xn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:Pe(g,s),style:c},t.createElement(mm,{multiple:i,fetch:v,fieldsDefine:{valueKey:null===(r=a.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(l=a.fetch)||void 0===l?void 0:l.textKey},autoFocus:!0,asyncLoad:a.asyncLoad,checkStrictly:a.checkStrictly,checkStrategy:a.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:a.defaultExpandAll,onSelectChange:e=>h(e),onCheckChange:e=>h(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ko[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>d(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!p,onClick:()=>d(p)},m("qm.dialog.confirm"))))};jm.displayName="TreeHelper";const Vm=t.forwardRef(((e,n)=>{var r,l,i,a;const{$size:o,flattenColumns:s,doFieldValidate:c}=t.useContext(jo),{dataKey:d,visible:u,setVisible:m,doFieldUpdate:p,cellValueChange:h}=t.useContext(Am),{column:f,row:g,rowKey:v,columnKey:y,options:b}=e,{t:x}=Mn();Rm();const E=!!(null===(r=b.helper)||void 0===r?void 0:r.combinedDataIndex),{dataIndex:w,precision:C}=f,{type:S,extra:N={},rules:T=[],helper:I={},onChange:R,onEnter:k}=b,L=ba(g,E?I.combinedDataIndex:w),A=I.fieldAliasMap;A||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes(w)||tr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),E&&(I.combinedDataIndex.split("|").every((e=>Object.keys(P).includes(e)))||tr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),P[w].includes("|")&&tr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const F=e=>{const{beforeOpen:t}=I,n=(null!=t?t:zn)({[d]:L},g,f);(null==n?void 0:n.then)?n.then((()=>{m(!0),null==e||e()})).catch((()=>{})):!1!==n&&(m(!0),null==e||e())},_=()=>{m(!1)},D=(e="",t)=>{var n;if(ae(t)&&Object.keys(t).length)for(const e in t){const r=t[e],l=s.find((t=>t.dataIndex===e));if(l){ya(g,e,r,l.precision);const t=null===(n=l.editRender)||void 0===n?void 0:n.call(l,g,l);t&&Array.isArray(t.rules)&&c(t.rules,r,v,e,Ia(l.title))}else ya(g,e,r)}ya(g,w,e,C),c(T,e,v,y,Ia(f.title)),p(g,v,y),null==R||R({[d]:e},g),h()},M={visible:u,title:x("qm.searchHelper.text"),width:null!==(l=I.width)&&void 0!==l?l:"40%",loading:!1,wrapClassName:is.popupClassName,bodyStyle:{paddingBottom:`${Ko[o]+20}px`},onClose:()=>{_()}},H=Object.assign(Object.assign({},I),{defaultSelectedKeys:[L],size:o,onClose:e=>{e?(e=>{const t={};for(const n in P){const r=P[n];n!==w&&(t[n]=ba(e,r))}const n=P[w]?ba(e,P[w]):"";D(n,t);const{closed:r}=I;m(!1),null==r||r(e)})(e):_()}});return t.createElement(t.Fragment,null,t.createElement(O.Search,{ref:n,value:L,allowClear:null===(i=N.allowClear)||void 0===i||i,readOnly:N.readOnly,disabled:N.disabled,placeholder:null!==(a=N.placeholder)&&void 0!==a?a:x("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!u&&F())},onDoubleClick:()=>{F()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?F():D(""))}}),t.createElement(Mi,M,t.createElement(jm,H)))}));Vm.displayName="TreeHelperCell";const zm=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext(jo),{dataKey:a,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=t.useContext(Am),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=Mn();Rm(),t.useLayoutEffect((()=>{f.items&&w(f.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const[v,y]=t.useState(f.items||[]),b=t.useRef({}),x=t.useRef([]),w=e=>x.current=e,{dataIndex:C}=u,{type:S,extra:N={},items:T=[],rules:I=[],helper:R={},onInput:O,onChange:k,onEnter:L}=f,A=va(m,C),P=R.fieldAliasMap;P||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const F="function"==typeof P?P():P||{};Object.keys(F).includes("valueKey")&&Object.keys(F).includes("textKey")||tr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=F;const _=e=>{const{beforeOpen:t}=R,n=(null!=t?t:zn)({[a]:A},m,u);(null==n?void 0:n.then)?n.then((()=>{s(!0),null==e||e()})).catch((()=>{})):!1!==n&&(s(!0),null==e||e())},M=()=>{s(!1)},H=e=>{ya(m,C,e),i(I,e,p,h,Ia(u.title)),c(m,p,h),null==k||k({[a]:e},m,x.current),d()},$={visible:o,title:g("qm.searchHelper.text"),width:null!==(n=R.width)&&void 0!==n?n:"40%",loading:!1,wrapClassName:is.popupClassName,bodyStyle:{paddingBottom:`${Ko[l]+20}px`},onClose:()=>{M()}},q=Object.assign(Object.assign({},R),{size:l,multiple:!0,initialValue:Ie({},R.initialValue),defaultSelectedKeys:A,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=F;w(e);const r=x.current.map((e=>({text:e[t],value:e[n]})));y(r),H(r.map((e=>e.value)));const{closed:l}=R;s(!1),null==l||l(x.current)})(e):M()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(D,{mode:"multiple",open:!1,value:A,placeholder:null!==(r=N.placeholder)&&void 0!==r?r:g("qm.table.editable.selectPlaceholder"),allowClear:N.allowClear,maxTagCount:N.collapseTags?"responsive":void 0,maxTagTextLength:N.maxTagTextLength,disabled:N.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!o&&_()},onDoubleClick:()=>{N.disabled||_()},onChange:e=>{const{valueKey:t}=F;w(x.current.filter((n=>e.includes(n[t])))),H(e)}},v.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:N.disabled,icon:t.createElement(Nt,null),onClick:()=>{_()}})))),t.createElement(Mi,$,t.createElement(jm,q)))},Wm=t.forwardRef(((e,n)=>{var r,l,i;const{$size:a,flattenColumns:o,doFieldValidate:s}=t.useContext(jo),{dataKey:c,visible:d,setVisible:u,setMatching:m,doFieldUpdate:p,cellValueChange:h}=t.useContext(Am),{column:f,row:g,rowKey:v,columnKey:y,options:b}=e,{t:x}=Mn();Rm();const E=!!(null===(r=b.helper)||void 0===r?void 0:r.combinedDataIndex),w=t.useRef(!1),C=t.useRef({}),[S,N]=t.useState(),{dataIndex:T,precision:I}=f,{type:R,extra:k={},rules:L=[],helper:A={},onInput:P,onChange:F,onEnter:_}=b,D=ba(g,E?A.combinedDataIndex:T),M=A.fieldAliasMap;M||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const H="function"==typeof M?M():M||{};Object.keys(H).includes(T)||tr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),E&&(A.combinedDataIndex.split("|").every((e=>Object.keys(H).includes(e)))||tr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),H[T].includes("|")&&tr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const $=e=>{const{filterAliasMap:t}=A,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],l={[T]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(ae(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},q=e=>{const{autoQueryAssign:t=!0}=A;t&&(C.current=$(e)),u(!0)},K=(e,t)=>{const{beforeOpen:n}=A,r=(null!=n?n:zn)({[c]:D},g,f);(null==r?void 0:r.then)?r.then((()=>{q(e),null==t||t()})).catch((()=>{})):!1!==r&&(q(e),null==t||t())},j=e=>{const t={};for(const n in H){const r=H[n];n!==T&&(t[n]=ba(e,r))}const n=H[T]?ba(e,H[T]):"";z(n,t);const{closed:r}=A;u(!1),null==r||r(e)},V=()=>{const{onlySelect:e=!0}=A;w.current&&z(e?"":D),u(!1)},z=(e="",t)=>{var n;if(ae(t)&&Object.keys(t).length)for(const e in t){const r=t[e],l=o.find((t=>t.dataIndex===e));if(l){ya(g,e,r,l.precision);const t=null===(n=l.editRender)||void 0===n?void 0:n.call(l,g,l);t&&Array.isArray(t.rules)&&s(t.rules,r,v,e,Ia(l.title))}else ya(g,e,r)}E&&!e&&((e,t,n,r)=>{if(!t.includes("|"))return ya(e,t,n,r);const l=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&ya(e,t,null===(r=l[n])||void 0===r?void 0:r.trim())}))})(g,A.combinedDataIndex,""),ya(g,T,e,I),s(L,e,v,y,Ia(f.title)),p(g,v,y),null==F||F({[c]:e},g),h(),C.current={},w.current=!1,N(void 0)},W={visible:d,title:x("qm.searchHelper.text"),width:null!==(l=A.width)&&void 0!==l?l:"60%",loading:!1,wrapClassName:is.popupClassName,bodyStyle:{paddingBottom:`${Ko[a]+20}px`},onClose:()=>{V()}},B=Object.assign(Object.assign({},A),{size:a,initialValue:Object.assign({},C.current,A.initialValue),onClose:e=>{e?j(e):V()}});return t.createElement(t.Fragment,null,t.createElement(O.Search,{ref:n,value:null!=S?S:D,placeholder:null!==(i=k.placeholder)&&void 0!==i?i:x("qm.table.editable.selectPlaceholder"),allowClear:k.allowClear,readOnly:k.readOnly,disabled:k.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:l}=A;if(w.current&&!d)return n&&r&&(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=A,{beforeFetch:r=zn}=t.fetch;return new Promise(((l,i)=>Dn(void 0,void 0,void 0,(function*(){var a;const o=Ie({},t.fetch.params,Object.assign(Object.assign({},n),$(e)),{currentPage:1,pageSize:500});if(!r(o))return i();m(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=ue(e.data,t.fetch.dataKey))&&void 0!==a?a:[];l(n)}else i()}catch(e){i(e)}finally{Bn((()=>m(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>ba(e,H[T]).toString().includes(t)));if(1===n.length)return j(n[0]);K(t)})(e,n))).catch((()=>z(""))):void z(n)},onChange:e=>{const{value:t}=e.target;null==P||P({[c]:t}),w.current=!0,N(t)},onKeyDown:e=>{var t;if(13===e.keyCode){const n=null!==(t=e.target.value)&&void 0!==t?t:"";!d&&K(n)}},onDoubleClick:e=>{const{value:t}=e.target;K(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&K(e)}}),t.createElement(Mi,W,t.createElement(ip,B)))}));Wm.displayName="SearchHelperCell";const Bm=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext(jo),{dataKey:a,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=t.useContext(Am),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=Mn();Rm();const[v,y]=t.useState(f.items||[]),b=t.useRef({}),x=t.useRef([]),w=e=>x.current=e;t.useLayoutEffect((()=>{f.items&&w(f.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const{dataIndex:C}=u,{type:S,items:N=[],extra:T={},rules:I=[],helper:R={},onInput:O,onChange:k,onEnter:L}=f,A=va(m,C),P=R.fieldAliasMap;P||tr("Table","helper 需要配置 `fieldAliasMap` 选项");const F="function"==typeof P?P():P||{};Object.keys(F).includes("valueKey")&&Object.keys(F).includes("textKey")||tr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=F;const _=e=>{const{beforeOpen:t}=R,n=(null!=t?t:zn)({[a]:A},m,u);(null==n?void 0:n.then)?n.then((()=>{s(!0),null==e||e()})).catch((()=>{})):!1!==n&&(s(!0),null==e||e())},M=()=>{s(!1)},H=e=>{ya(m,C,e),i(I,e,p,h,Ia(u.title)),c(m,p,h),null==k||k({[a]:e},m,x.current),d()},$={visible:o,title:g("qm.searchHelper.text"),width:null!==(n=R.width)&&void 0!==n?n:"60%",loading:!1,wrapClassName:is.popupClassName,bodyStyle:{paddingBottom:`${Ko[l]+20}px`},onClose:()=>{M()}},q=Object.assign(Object.assign({},R),{size:l,multiple:!0,initialValue:Ie({},R.initialValue),defaultSelectedKeys:A,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=F;w(ke([...x.current.filter((e=>t.includes(e[r]))),...e],r));const l=x.current.map((e=>({text:e[n],value:e[r]}))),i=ke([...l,...N],"value").filter((e=>t.includes(e.value)));y(i),H(i.map((e=>e.value)));const{closed:a}=R;s(!1),null==a||a(x.current)})(e,t):M()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(D,{mode:"multiple",open:!1,value:A,placeholder:null!==(r=T.placeholder)&&void 0!==r?r:g("qm.table.editable.selectPlaceholder"),allowClear:T.allowClear,maxTagCount:T.collapseTags?"responsive":void 0,maxTagTextLength:T.maxTagTextLength,disabled:T.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!o&&_()},onDoubleClick:()=>{T.disabled||_()},onChange:e=>{const{valueKey:t}=F;w(x.current.filter((n=>e.includes(n[t])))),H(e)}},v.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:T.disabled,icon:t.createElement(Nt,null),onClick:()=>{_()}})))),t.createElement(Mi,$,t.createElement(ip,q)))},Um=t.forwardRef(((e,n)=>{var r,l,i,a;const{column:o,record:s,rowKey:c,columnKey:d}=e,{tableRef:u,updateTableFlatData:m,dataChange:p}=t.useContext(jo),h=t.useContext(Em),{store:f,fieldAuth:g}=u.current,v=(null===(r=o.editRender)||void 0===r?void 0:r.call(o,s,o))||{},y=t.useRef(null),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),[w,C]=t.useState(!1),[S,N]=t.useState(!1),T=`${c}|${d}`,I=2===h.length?`${h[0]}|${h[1]}`:"",R=(v.editable||Ha(h,[c,d],!0))&&!v.disabled&&!(null===(l=g[d])||void 0===l?void 0:l.disabled),O=![...f.state.required,...f.state.validate].some((({x:e,y:t})=>e===c&&t===d)),k=(null===(i=f.state.required.find((({x:e,y:t})=>e===c&&t===d)))||void 0===i?void 0:i.text)||"",L=(null===(a=f.state.validate.find((({x:e,y:t})=>e===c&&t===d)))||void 0===a?void 0:a.text)||"",A=f.state.edited.some((({x:e,y:t})=>e===c&&t===d)),P=R||!O||w||S;t.useEffect((()=>{P&&I===T&&F()}),[h]);const F=()=>{var e,t,n,r;const{type:l}=v;switch(l){case"text":null===(e=y.current)||void 0===e||e.focus();break;case"number":null===(t=b.current)||void 0===t||t.select();break;case"search-helper":null===(n=x.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=E.current)||void 0===r||r.focus()}},_=()=>{var e,t,n,r;const{type:l}=v;switch(l){case"text":null===(e=y.current)||void 0===e||e.blur();break;case"number":null===(t=b.current)||void 0===t||t.blur();break;case"search-helper":null===(n=x.current)||void 0===n||n.blur();break;case"tree-helper":null===(r=E.current)||void 0===r||r.blur()}},D=()=>{m(),p()},M=(e,t,n)=>{const{cornerSign:r=!0}=v.extra||{};f.addToUpdated(e),r&&f.addToEdited({x:t,y:n})};t.useImperativeHandle(n,(()=>({focus:F,blur:_,isEditable:()=>!v.disabled,isOpening:()=>w})));const H=t.useMemo((()=>({dataKey:T,visible:w,matching:S,setVisible:C,setMatching:N,doFieldUpdate:M,cellValueChange:D})),[w,S]),$={text:()=>t.createElement(Pm,{ref:y,column:o,row:s,rowKey:c,columnKey:d,options:v}),textarea:()=>t.createElement(Pm,{ref:y,column:o,row:s,rowKey:c,columnKey:d,options:v,isTextArea:!0}),number:()=>t.createElement(_m,{ref:b,column:o,row:s,rowKey:c,columnKey:d,options:v}),select:()=>t.createElement(Dm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),"select-multiple":()=>t.createElement(Dm,{column:o,row:s,rowKey:c,columnKey:d,options:v,isMultiple:!0}),date:()=>t.createElement(Mm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"exactdate"}),datetime:()=>t.createElement(Mm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"datetime"}),month:()=>t.createElement(Mm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"month"}),year:()=>t.createElement(Mm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"year"}),time:()=>t.createElement(Hm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),checkbox:()=>t.createElement($m,{column:o,row:s,rowKey:c,columnKey:d,options:v}),switch:()=>t.createElement(qm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),"search-helper":()=>t.createElement(Wm,{ref:x,column:o,row:s,rowKey:c,columnKey:d,options:v}),"search-helper-multiple":()=>t.createElement(Bm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),"tree-helper":()=>t.createElement(Vm,{ref:E,column:o,row:s,rowKey:c,columnKey:d,options:v}),"tree-helper-multiple":()=>t.createElement(zm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),custom:()=>t.createElement(Km,{column:o,row:s,rowKey:c,columnKey:d,options:v})};return t.createElement(t.Fragment,null,P?(()=>{const{type:e}=v,n=$[e];if(!n)return tr("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!O}];return t.createElement("div",{className:Pe(r)},t.createElement(Am.Provider,{value:H},n()),!O&&t.createElement("div",{className:"cell-error"},k||L))})():(()=>{const{disabled:n,extra:r={}}=v,{disabledColor:l,disabledBgColor:i}=r,a=["cell--show",{"is-cell-bg":n&&i}];return t.createElement(t.Fragment,null,t.createElement("span",{className:Pe(a),style:{color:n?l:""}},e.children),n&&i&&t.createElement("i",{className:"cell--bg",style:{background:i}}))})(),A&&t.createElement("i",{className:"cell--sign"}))}));Um.displayName="CellEdit";const Gm=e=>{const{text:n,options:r,showMessage:l=!0,onCopy:i}=e,{t:a}=Mn();return di(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=nn(n,r);null==i||i(n,c),c&&l&&R.success(a("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Gm.displayName="QmCopyToClipboard";const Ym=t.forwardRef(((n,r)=>{const{column:l,row:i,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c,onUnmount:d}=n,{tableRef:u,selectionKeys:m,treeExpandIndex:p,updateMark:h}=t.useContext(jo),{dataIndex:f,canCopy:g,render:v,editRender:y,shouldCellUpdate:b}=l,{t:x}=Mn(),{renderText:E,getTitleFromCellNode:w}=gs(),C=t.useRef(null),S=va(i,f),[N,T]=function(t,n,r){const l=e.useRef({});return"value"in l.current&&!r(l.current.condition,n)||(l.current.value=t(),l.current.condition=n),l.current.value}((()=>{const e=v?v(S,i,l,a,o):E(S,l,i);return[e,y?t.createElement(Um,{ref:r,column:l,record:i,rowKey:s,columnKey:f},e):null]}),[h,i,S,v,y],((e,t)=>{if(b){const[,n]=e,[,r]=t;return b(r,n,i)}return!Ha(e,t,!0)}));t.useEffect((()=>()=>null==d?void 0:d()),[]),t.useEffect((()=>{if([is.expandableColumn,is.selectionColumn,is.operationColumn].includes(f))return;const e=C.current.parentNode;c?e.title=w(N):e.removeAttribute("title")}),[c,N]);const I=e=>Array.isArray(e.children);return t.createElement("div",{ref:C,className:"cell"},(()=>{if(f===is.expandableColumn)return t.createElement(Lm,{record:i,rowKey:s});if(f===is.selectionColumn)return t.createElement(km,{selectionKeys:m,column:l,record:i,rowKey:s});if(T)return T;if(u.current.isTreeTable&&f===p)return t.createElement(t.Fragment,null,(e=i._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*is.treeTable.textIndent+"px"}}):null,t.createElement(Lm,{key:"expand",record:i,rowKey:s,style:I(i)?{}:{visibility:"hidden"}}),N);var e;if(g){const e=w(N);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},N),e&&t.createElement(Gm,{text:e},t.createElement(Ze,{className:"icon",title:x("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return N})())}));Ym.displayName="Cell";const Xm={open:!1,offsetX:0,offsetY:0},Qm=t.forwardRef(((e,n)=>{const{rowVirtualize:r}=e,{tableRef:l,getRowKey:i,prefixCls:a,tableFlatData:o,flattenColumns:s,mergedTdCells:c,setMergedCells:d}=t.useContext(jo),{areaSelection:u={}}=l.current.props,{elementStore:m,scrollYLoad:p}=l.current,{t:h}=Mn(),f=t.useRef(document.onselectstart),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=e=>{y.current=e},[x,E]=t.useState(null),[w,C]=t.useState(null),[S,N]=t.useState(null),T=e=>{if(!e)return N(null);let t=!1;for(const n in e)if((null==S?void 0:S[n])!==e[n]){t=!0;break}t&&N(Object.assign({},S,e))};Nu({ref:g,handler:()=>j()}),t.useEffect((()=>{const e=jt(m.$tableBody,"mousedown",D),t=jt(m.$tableBody,"contextmenu",F),n=jt(document,"keydown",_);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const I=()=>{E(null),T(null),b(null),C(null)};t.useImperativeHandle(n,(()=>({blur:I})));const R=e=>{let t=e;for(;t;){if(!m.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},O=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),k=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),L=e=>{let[t,n,r,l]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),l=Math.max(l,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:l}},A=ci((e=>{let t=L([k(e),y.current]);c.forEach((e=>{const n=o.findIndex((t=>i(t,t.index)===e.rowKey)),r=s.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+e.colSpan};var a,c;c=l,(a=t).rowEnd<=c.rowStart||a.rowStart>=c.rowEnd||a.colEnd<=c.colStart||a.colStart>=c.colEnd||(t=L([t,l]))})),T(t)}),5),P=e=>{var t;d(e),null===(t=u.onCellMerge)||void 0===t||t.call(u,e),Bn((()=>I()))},F=Hn((e=>{u.cellMerge&&x&&q(e.clientX,e.clientY)?(e.preventDefault(),K(e)):(null==w?void 0:w.open)&&j()})),_=Hn((e=>{27===e.keyCode&&I()})),D=Hn((e=>{e.stopPropagation();const t=R(e.target);if(1!==e.buttons||!t)return;j();const n=O(t);E(n);const r=k(n);b(r),T(r),document.addEventListener("mousemove",M),document.addEventListener("mouseup",H),f.current=document.onselectstart,document.onselectstart=()=>!1})),M=Hn((e=>{const t=R(e.target);t&&A(O(t))})),H=Hn((()=>{var e;null===(e=u.onSelectChange)||void 0===e||e.call(u,(()=>{const e=[];if(!x||!S)return e;for(let t=S.rowStart;t<S.rowEnd;t++)for(let n=S.colStart;n<S.colEnd;n++)e.push({rowKey:i(o[t],o[t].index),dataIndex:s[n].dataIndex,cellValue:va(o[t],s[n].dataIndex)});return e})()),document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",H),$()})),$=()=>{document.onselectstart!==f.current&&(document.onselectstart=f.current)},q=(e,t)=>{const{top:n,left:r}=m.$tableBody.parentNode.getBoundingClientRect(),[l,i]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=U();return!(l<a||l>a+s||i<o||i>o+c)},K=e=>{const{top:t,left:n,height:r}=v.current.getBoundingClientRect();C({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},j=()=>{C((e=>Object.assign(Object.assign({},e),{open:!1})))},V=e=>({rowIndex:o.findIndex((t=>i(t,t.index)===e.rowKey)),colIndex:s.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),z=()=>{if(!x||!S||(t=S,(e=x).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return I();var e,t;const n={rowKey:i(o[S.rowStart],o[S.rowStart].index),dataIndex:s[S.colStart].dataIndex,rowSpan:S.rowEnd-S.rowStart,colSpan:S.colEnd-S.colStart};P([...c.filter((e=>!((e,t)=>{const n=V(e),r=V(t),[l,i,a,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return l<=s&&i<=c&&a>=d&&o>=u||s<=l&&c<=i&&d>=a&&u>=o})(e,n))),n])},W=()=>{const e=i(o[S.rowStart],o[S.rowStart].index),t=s[S.colStart].dataIndex;P(c.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},B=e=>{if(p){return r.measurementsCache.slice(0,e).map((e=>e.size)).reduce(((e,t)=>e+t),0)}if(e>=o.length)return m.$tableBody.parentNode.offsetHeight;const t=i(o[e],o[e].index),n=m.$tableBody.querySelector(`tbody > tr[data-row-key="${t}"]`);return n?n.offsetTop:l.current.rowHeight*e},U=()=>{const{w:e,h:t,l:n,t:r}=x,l=s.slice(0,S.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=B(S.rowStart);return{sl:n,st:r,sw:e,sh:t,el:l,et:i,ew:s.slice(0,S.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-l,eh:B(S.rowEnd)-i}};return t.createElement("div",{className:`${a}--area-select`},(()=>{if(!x||!S)return null;const{sl:e,st:n,sw:r,sh:l,el:i,et:a,ew:o,eh:s}=U(),{open:c,offsetX:d,offsetY:u}=w||Xm,m=t.createElement("ul",{ref:g,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:z},h("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:W},h("qm.table.areaSelect.cancelMerge")));return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:l}}),t.createElement(od,{popupVisible:c,popup:m,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:is.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:v,className:"checked-area",style:{left:i,top:a,width:o,height:s}})))})())}));Qm.displayName="AreaSelect";const Zm=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:l,prefixCls:i,tableFlatData:a,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:m,layout:p,showFooter:h,selectionKeys:f,rowExpandedKeys:g,highlightKey:v,activedCell:y,isPingLeft:b,isPingRight:x,isTableEmpty:E,isGroupSubtotal:w,setElementStore:C,setSelectionKeysEffect:S,setHighlightKey:N,setActivedCell:T,getStickyLeft:I,getStickyRight:R,setPingLeft:O,setPingRight:k,setFullScreen:L,scrollBottomDebouncer:A}=t.useContext(jo),{height:P,minHeight:F,maxHeight:_,rowHeight:D,rowSelection:M,rowHighlight:H,expandable:$,stripe:q,summation:K,rowStyle:j,cellStyle:V,spanMethod:z,tableConfig:W,areaSelection:B,ellipsis:U,showHeader:G,rowDraggable:Y,onRowClick:X,onRowDblclick:Q,onRowContextmenu:Z,onRowEnter:J}=r.current.props,ee=t.useRef(null),te=t.useRef(new Map),ne=t.useRef(null),re=t.useRef({prevST:0,prevSL:0}),{onNodeDragStart:le,onNodeDragEnter:ie,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de,indent:ue,dropOptions:me}=Im({openDragSort:Y}),{rowVirtualizer:pe,columnVirtualizer:fe,virtualRows:ge,virtualColumns:ve,resetItemXSize:ye,getYIndexes:be,virtualTranslateY:xe,virtualTranslateX:Ee,calcVirtualYSize:we,calcVirtualXSize:Ce,scrollToYIndex:Se}=((e,n)=>{var r;const{tableRef:l}=t.useContext(jo),{props:i,scrollBarRef:a,rowHeight:o}=l.current,s=(null===(r=i.tableConfig)||void 0===r?void 0:r.overscan)||1,c=t.useMemo((()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[a.current]),d=t.useMemo((()=>{const e=[],t=[];return n.forEach(((n,r)=>{"left"===n.fixed&&e.push(r),"right"===n.fixed&&t.push(r)})),[e,t]}),[n]),u=Eu({count:e.length,getScrollElement:()=>c,estimateSize:()=>o,indexAttribute:"data-row-index",overscan:s,enabled:l.current.scrollYLoad}),m=u.getVirtualItems(),p=Eu({horizontal:!0,count:n.length,getScrollElement:()=>c,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:s,enabled:l.current.scrollXLoad,rangeExtractor:e=>[...new Set([...d[0],...uu(e),...d[1]])]}),h=p.getVirtualItems();return{rowVirtualizer:u,columnVirtualizer:p,virtualRows:m,virtualColumns:h,resetItemXSize:e=>{e.forEach(((e,t)=>{p.resizeItem(t,e.width||e.renderWidth||is.defaultColumnWidth)}))},getYIndexes:()=>u.getVirtualIndexes()||[],getXIndexes:()=>p.getVirtualIndexes()||[],virtualTranslateY:()=>{var e,t;return null!==(t=null===(e=m[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},virtualTranslateX:()=>{var e,t,n,r,l,i,a;const o=d[0].length;return o?(null===(n=h[o])||void 0===n?void 0:n.index)===o?null!==(l=null===(r=h[0])||void 0===r?void 0:r.start)&&void 0!==l?l:0:(null!==(a=null===(i=h[o])||void 0===i?void 0:i.start)&&void 0!==a?a:0)-h.slice(0,o).reduce(((e,t)=>e+t.size),0):null!==(t=null===(e=h[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},calcVirtualYSize:()=>u.getTotalSize()||void 0,calcVirtualXSize:()=>p.getTotalSize()||void 0,scrollToYIndex:e=>{u.scrollToIndex(e)},scrollToXIndex:e=>{p.scrollToIndex(e)}}})(a,o),Ne=be(),Te=e=>{if(e&&!U)return pe.measureElement(e)},Ie=t.useMemo((()=>u.length&&r.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:l,colSpan:i})=>{const a=e+l-1,o=[];for(let t=e;t<=a;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let l=t;l<t+i;l++)0===r&&l===t||n.push({row:e,col:l,rowSpan:0,colSpan:0})}))})),n})(u,Ne):u),[u,Ne.join(",")]),[Re,Oe]=t.useState([]),ke=Rm();Nu({ref:ee,omitClassNames:[`.${is.popupClassName}`],handler:()=>{var e;Be([]),null===(e=ne.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Be,createFocus:qe,forceUpdate:ke,resetItemXSize:ye,scrollToYIndex:Se}))),Hl((()=>{Re.length&&r.current.tableManager.focus(r.current.uid)}),[Re]),t.useLayoutEffect((()=>{$e();const e=jt(document,"keydown",Fe);return()=>e.remove()}),[]);const Le=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:l}=p,i={};return E&&Object.assign(i,{minHeight:"100px"}),F&&Object.assign(i,{minHeight:fa(F)-e-n+"px"}),_&&Object.assign(i,{maxHeight:fa(_)-e-n+"px"}),P||r||l?Object.assign(Object.assign({},i),{maxHeight:"",minHeight:"",height:`${t}px`}):i}),[P,_,F,E,p]),Ae=Hn((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:l}=re.current,{scrollTop:i,scrollLeft:a}=e;if(a!==l){G&&(t.$header.scrollLeft=a),h&&(t.$footer.scrollLeft=a);const e=a>0,n=Math.ceil(a)+p.tableWidth<p.tableBodyWidth;b!==e&&O(e),x!==n&&k(n)}i!==n&&Math.ceil(i)+p.viewportHeight>=ee.current.parentNode.offsetHeight&&A({type:"scroll",target:e,preventDefault:Vn,stopPropagation:Vn}),re.current={prevST:i,prevSL:a}})),Fe=Hn((e=>{var t,n,i,o,s;if(r.current.uid!==(null===(t=r.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id))return;const{keyCode:c}=e;if(27===c&&(Be([]),N(""),T({}),L(!1)),Re.length&&(Gl(document.activeElement,ee.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName))){if(13===c&&("radio"===(null==M?void 0:M.type)||H)){const t=null!==(o=null!==(i=f[0])&&void 0!==i?i:v)&&void 0!==o?o:null,n=null!==(s=a.find((e=>l(e,e.index)===t)))&&void 0!==s?s:null;n&&(null==J||J(n,e))}Ve(Re[0],Re[1])||(38!==c&&40!==c||(Kl(e),_e(e)),(9===c||e.shiftKey&&9===c)&&(Kl(e),De(e)))}})),_e=Ri((e=>{var t,n;if(!Re.length)return;const r=a.length;let i=a.findIndex((e=>l(e,e.index)===Re[0]));const o=38===e.keyCode?(--i+r)%r:++i%r,s=a[o],c=l(s,s.index),d=je(c,Re[1]);"radio"!==(null==M?void 0:M.type)||(null===(t=M.disabled)||void 0===t?void 0:t.call(M,s))||d||S([c]),!H||(null===(n=H.disabled)||void 0===n?void 0:n.call(H,s))||d||N(c),Me(38===e.keyCode?"top":"bottom",o),Ke(...Re),Be([c,Re[1]])}),100),De=Ri((e=>{if(!Re.length)return;if(!s.length)return Be([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Re[1]));const r=e.shiftKey&&9===e.keyCode?(--n+t)%t:++n%t;Ke(...Re),He(e.shiftKey&&9===e.keyCode?"left":"right",r),Be([Re[0],s[r].dataIndex])}),100),Me=(e,t)=>{const{scrollBarRef:n,scrollYLoad:l}=r.current;if(l)return pe.scrollToIndex(t);const i=a.length,o=t,s=ee.current.querySelectorAll("tbody > tr"),c=a.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<n.current.scrollTop?n.current.SET_SCROLL_TOP(c):t===i-1&&n.current.SET_SCROLL_TOP(c-(p.viewportHeight-d)):c+d>n.current.scrollTop+p.viewportHeight?n.current.SET_SCROLL_TOP(c-(p.viewportHeight-d)):0===t&&n.current.SET_SCROLL_TOP(c)},He=(e,t)=>{const{scrollBarRef:n}=r.current,l=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),a=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),h=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?a<n.current.scrollLeft+m?n.current.SET_SCROLL_LEFT(a-m):t===l-1&&n.current.SET_SCROLL_LEFT(a-(p.tableWidth-u)+h):a+u>n.current.scrollLeft+(p.tableWidth-h)?n.current.SET_SCROLL_LEFT(a-(p.tableWidth-u)+h):0===t&&n.current.SET_SCROLL_LEFT(a-m)},$e=()=>{C("$tableBody",ee.current)},qe=(e,t)=>{var n;null===(n=te.current.get(`${e}-${t}`))||void 0===n||n.focus()},Ke=(e,t)=>{var n;null===(n=te.current.get(`${e}-${t}`))||void 0===n||n.blur()},je=(e,t)=>{var n,r;return null!==(r=null===(n=te.current.get(`${e}-${t}`))||void 0===n?void 0:n.isEditable())&&void 0!==r&&r},Ve=(e,t)=>{var n,r;return null!==(r=null===(n=te.current.get(`${e}-${t}`))||void 0===n?void 0:n.isOpening())&&void 0!==r&&r},ze=e=>{const t=K.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},We=(e,t,n)=>{var i;const{dataIndex:a}=n;if([is.expandableColumn,is.operationColumn].includes(a))return;const o=l(t,t.index);Be([o,a]);const s=je(o,a),{type:c,selectByClickRow:d=!0,disabled:u=Vn}=M||{};!c||u(t)||s||(d||a===is.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:l=!0,onSelect:i}=M||{};if("radio"===n&&S([e]),"checkbox"===n){const n=!f.includes(e),a=r.current.isTreeTable&&!l?Ge(e,f,n):Ue(e,f,n);S(a),null==i||i(n,t,a)}})(o,t),[is.selectionColumn].includes(a)||(!H||(null===(i=H.disabled)||void 0===i?void 0:i.call(H,t))||s||N(o),null==X||X(t,n,e))},Be=e=>{he(e,Re)||Oe(e)},Ue=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Ge=(e,t,n)=>{var l;const{disabled:i}=M||{},{deriveRowKeys:a,recordsMap:o}=r.current,s=oa(a,e);let c=[],d=_a((null==s?void 0:s.children)||[]);i&&(d=d.filter((e=>!o.has(e)||!i(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(l=Pa(a,e))||void 0===l?void 0:l.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=oa(a,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>c.includes(e.rowKey)));c=r?[...c,e]:c.filter((t=>t!==e))})),c},Ye=(e,n,l)=>{const{scrollXLoad:i}=r.current,{disabled:a}=M||{},s=["body--row",Object.assign({"body--row-striped":q&&n%2!=0,"body--row-selected":f.includes(l)&&!(null==a?void 0:a(e)),"body--row-current":v===l},w?ze(e._group):null)],c=(i?ve:o).map(((t,r)=>Xe(i?o[t.index]:t,i?t.index:r,e,n,l)));return Y?t.createElement(Om,{key:l,ref:Te,className:Pe(s),rowKey:l,rowIndex:n,row:e,indent:ue,filter:".cell--edit input",dropOption:me,onNodeDragStart:le,onNodeDragEnter:ie,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de},c):t.createElement("tr",{key:l,ref:Te,"data-row-key":l,"data-row-index":n,className:Pe(s)},c)},Xe=(e,n,r,l,i)=>{var a,o,s;const{dataIndex:u,fixed:p,align:h,className:f=""}=e,{rowSpan:g,colSpan:v}=Qe(r,e,l,n);if(!g||!v)return null;const b=null!==(a=e.ellipsis)&&void 0!==a?a:U,x=["body--column",{"col--ellipsis":b,"col--center":"center"===h,"col--right":"right"===h,"col-active":y.rowKey===i&&y.dataIndex===u,"column--sort":!!m[u],"cell-fix-left":"left"===p,"cell-fix-right":"right"===p,"cell-fix-left-last":"left"===p&&(null===(o=c[c.length-v])||void 0===o?void 0:o.dataIndex)===u,"cell-fix-right-first":"right"===p&&(null===(s=d[0])||void 0===s?void 0:s.dataIndex)===u,[f]:!!f}],E={left:"left"===p?`${I(u)}px`:"",right:"right"===p?`${R(u)}px`:""},C=j?"function"==typeof j?j(r,l):j:null,S=V?"function"==typeof V?V(r,e,l,n):V:null,N=w?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=K.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,T=Object.assign({},E,{height:D},N,C,S);return t.createElement("td",{key:u,"data-col-index":n,rowSpan:g>1?g:void 0,colSpan:v>1?v:void 0,className:Pe(x),style:T,onClick:t=>We(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[is.expandableColumn,is.selectionColumn,is.operationColumn].includes(r)||null==Q||Q(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[is.expandableColumn,is.selectionColumn,is.operationColumn].includes(r)||null==Z||Z(t,n,e)})(t,r,e)},t.createElement(Ym,{ref:e=>{e&&te.current.set(`${i}-${u}`,e)},row:r,column:e,rowIndex:l,columnIndex:n,rowKey:i,showTitle:b,onUnmount:()=>te.current.delete(`${i}-${u}`)}))},Qe=(e,t,n,r)=>{var l;let i=1,o=1;const s=z;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(c)?(i=c[0],o=c[1]):ae(c)&&(i=c.rowSpan,o=c.colSpan);const d=null!==(l=Ne[0])&&void 0!==l?l:0;if(e===a[d]&&0===i)for(let e=d;e<a.length;e++){const n=s({row:a[e],column:t,rowIndex:e,columnIndex:r,tableData:a});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;i++}}if(Ie.length>0){const e=Ie.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}};return t.createElement(Ei,{ref:r.current.scrollBarRef,wrapClassName:`${i}--body-wrapper`,wrapStyle:Le,innerStyle:{height:we(),width:Ce()},showTopScrollbar:null==W?void 0:W.doubleXScrollbar,onScroll:Ae},t.createElement(Em.Provider,{value:Re},t.createElement("table",{ref:ee,style:{width:0,marginTop:xe(),marginLeft:Ee()},className:Pe(`${i}--body`,{"virtual-container":r.current.scrollYLoad||r.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=r.current;return t.createElement("colgroup",null,(e?ve:o).map((n=>{const{dataIndex:r,width:l,renderWidth:i}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${l||i}px`,minWidth:`${l||i}px`}})})))})(),t.createElement("tbody",null,(e=>{const{scrollYLoad:n,scrollXLoad:i}=r.current,s=[];return(n?e:a).forEach(((e,r)=>{const c=n?a[e.index]:e,d=n?e.index:r,u=l(c,c.index);if(s.push(Ye(c,d,u)),null==$?void 0:$.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=zn}=$;g.includes(u)&&n(c)&&s.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:(i?ve:o).length,className:"body--column",style:{paddingLeft:M?2*is.selectionColumnWidth:is.selectionColumnWidth}},t.createElement("div",{className:Pe("cell",e)},$.expandedRowRender(c,d)))))}})),s})(ge)))),!!B&&t.createElement(Qm,{ref:ne,rowVirtualize:pe}))}));Zm.displayName="TableBody";const Jm=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:l,flattenColumns:i,leftFixedColumns:a,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=t.useContext(jo),{footRender:m}=e.current.props,{t:p}=Mn(),h=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},g=(n,l,i)=>{var s,c;const{dataIndex:m,fixed:h,align:f,summation:g}=n,v=["footer--column","col--ellipsis",{"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!r[m],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(s=a[a.length-1])||void 0===s?void 0:s.dataIndex)===m,"cell-fix-right-first":"right"===h&&(null===(c=o[0])||void 0===c?void 0:c.dataIndex)===m}],y={left:"left"===h?`${d(m)}px`:"",right:"right"===h?`${u(m)}px`:""},b=(null==g?void 0:g.render)?g.render(e.current.tableFullData):va(l,`${m}_text`),x=0===i&&""===b?p("qm.table.config.summaryText"):b;return t.createElement("td",{key:m,title:x,className:Pe(v),style:Object.assign({},y)},t.createElement("div",{className:"cell"},x))},{tableBodyWidth:v}=l;return t.createElement("div",{ref:h,className:`${n}--footer-wrapper`},m?m(i,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}px`:""}},t.createElement("colgroup",null,i.map((e=>{const{dataIndex:n,width:r,renderWidth:l}=e;return t.createElement("col",{key:n,style:{width:`${r||l}px`,minWidth:`${r||l}px`}})}))),t.createElement("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},i.map(((t,n)=>g(t,e,n)))))))))};var ep;!function(e){e.small="small",e.middle="default",e.large="default"}(ep||(ep={}));const tp=e=>{var n,r,l,i;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(on),{tableRef:u,prefixCls:m,$size:p,setElementStore:h}=t.useContext(jo),{uniqueKey:f,paginationConfig:g,infoBarConfig:v}=u.current.props,y=t.useRef(null),b=t.useMemo((()=>f?`tablePager_${f}`:""),[f]);t.useLayoutEffect((()=>{x(),S()}),[]);const x=()=>{h("$pager",y.current)},E=null!==(n=null==g?void 0:g.showSizeChanger)&&void 0!==n?n:is.pagination.showSizeChanger,w=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:is.pagination.showQuickJumper,C=(null==g?void 0:g.pageSizeOptions)||(null===(i=null===(l=null==d?void 0:d.table)||void 0===l?void 0:l.pagination)||void 0===i?void 0:i.pageSizeOptions)||is.pagination.pageSizeOptions,S=()=>Dn(void 0,void 0,void 0,(function*(){if(!b)return;const e=yield N(b);e&&e!==o&&(c(a,e),localStorage.setItem(b,e.toString()))})),N=e=>Dn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t&&!localStorage.getItem(b))try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),T=(e,t)=>Dn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),I={[`${m}-pager`]:!0};return t.createElement("div",{ref:y,className:Pe(I)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==v?void 0:v.position)&&t.createElement(ps,{total:s})),t.createElement(B,{size:ep[p],showSizeChanger:E,showQuickJumper:w,pageSizeOptions:C,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},np=()=>{const{prefixCls:e,layout:n}=t.useContext(jo),r=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t}=n;return{top:`${e}px`,height:`${t}px`}}),[n]);return t.createElement("div",{className:`${e}--empty`,style:r},t.createElement(ti,null))},rp=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(jo),r=t.useRef(null);t.useLayoutEffect((()=>{l()}),[]);const l=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},lp=t.forwardRef(((e,n)=>{const r=mn(zo,e),{rowKey:l,columns:i,loading:a,resizable:o,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:m,topSpaceAlign:p,showTableInfo:h,showFullScreen:f,showRefresh:g,showToolBox:v,showHeader:y,className:b,style:x}=r,{$size:E}=$n(r),w=t.useRef(null),C=t.useRef(null),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=ir("table"),R=Hn(((e,t)=>{const n="function"==typeof l?l(e,t):null==e?void 0:e[l];return void 0===n?(tr("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:O,tableFullData:k,setElementStore:L,setOriginColumns:A,setTableFullData:P,setTableOriginData:F,setTableDataMaps:_,setDeriveRowKeys:D,setInvalidRowKeys:M,setFieldAuth:H,setColumnsDefined:$,setScrollXLoad:q,setScrollYLoad:K,setResizeState:j,setHandleState:V,setSummaries:z,setSelectionRows:W,setFilteredTreeData:B,setUnMounted:U,clearElementStore:G}=((e,{getRowKey:n,$size:r})=>{const{rowHeight:l,dynamicThead:i}=e,a=t.useRef({props:e,uid:ts(),tableManager:rs,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!i,scrollBarRef:t.createRef(),rowHeight:l||is.rowHeightMaps[r],store:new ls,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!1,scrollXLoad:!1,scrollYLoad:!1,selectionRows:[],recordsMap:new Map,filteredTreeData:[],unMounted:!1,isIE:!qn&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,a.current.props=o;const s=(e,t,r="",l=0)=>e.map((e=>{const i=n(e,e.index),a=r?`${r}.${e.index+1}`:`${e.index+1}`,o={level:l,rowKey:i,indexPath:a,parentRowKey:l?t:null};return e.indexPath=a,e._level=l,e._rowKey=i,e._parentRowKey=l?t:null,Array.isArray(e.children)&&(o.children=s(e.children,i,a,l+1)),e.children&&e.children.length||(o.isLeaf=1,e._isLeaf=1),o}));return Object.assign(Object.assign({tableRef:a},a.current),{setElementStore:(e,t)=>{a.current.elementStore[e]=t},setOriginColumns:e=>{a.current.originColumns=e},setTableFullData:e=>{a.current.tableFullData=e},setTableOriginData:e=>{a.current.tableOriginData=e},setTableDataMaps:e=>{const t=sa(e);a.current.recordsMap=new Map(t.map(((e,r)=>[n(e,e.index),t[r]])))},setDeriveRowKeys:e=>{const t=e.some((e=>Array.isArray(e.children)));a.current.isTreeTable=t,a.current.deriveRowKeys=t?s(e,""):[]},setInvalidRowKeys:e=>{a.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{a.current.fieldAuth[e]=t},setColumnsDefined:e=>{a.current.columnsDefined=e},setResizeState:e=>{a.current.resizeState=e},setHandleState:e=>{a.current.handleState=e},setSummaries:e=>{a.current.summaries=e},setScrollXLoad:e=>{a.current.scrollXLoad=e},setScrollYLoad:e=>{a.current.scrollYLoad=e},setSelectionRows:e=>{a.current.selectionRows=e},setFilteredTreeData:e=>{a.current.filteredTreeData=e},setUnMounted:e=>{a.current.unMounted=e},clearElementStore:()=>{for(const e in a.current.elementStore)a.current.elementStore[e]=null}})})(r,{getRowKey:R,$size:E}),{tableFlatData:Y,setTableFlatData:X,filters:Q,setFilters:Z,sorter:J,setSorter:ee,superFilters:te,setSuperFilters:ne,pagerFilter:re,setPagerFilter:le,pagination:ie,setPagination:oe,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:pe,setHighlightKey:fe,updateMark:ge,forceUpdate:ve,activedCell:ye,setActivedCell:be,mergedTdCells:xe,setMergedCells:Ee,layout:we,setLayout:Ce,permission:Se,setPermission:Ne,spinning:Te,setSpinning:Ie,isPingLeft:Re,setPingLeft:Oe,isPingRight:ke,setPingRight:Le,isFullScreen:Ae,setFullScreen:Fe,updateTableFlatData:_e}=(e=>{var n,r,l,i,a,o,s,c,d,u,m;const{uniqueKey:p,initialSorter:h={},initialFilter:f={},paginationConfig:g,rowSelection:v,expandable:y,rowHighlight:b,mergedCells:x}=e,{global:E}=t.useContext(on),w={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:is.pagination.current,pageSize:null!==(o=null!==(l=null!==(r=(()=>{if(p)return Number(localStorage.getItem(`tablePager_${p}`))||void 0})())&&void 0!==r?r:null==g?void 0:g.pageSize)&&void 0!==l?l:null===(a=null===(i=null==E?void 0:E.table)||void 0===i?void 0:i.pagination)||void 0===a?void 0:a.pageSize)&&void 0!==o?o:is.pagination.pageSize,total:0},C=null!==(c=null!==(s=null==v?void 0:v.selectedRowKeys)&&void 0!==s?s:null==v?void 0:v.defaultSelectedRowKeys)&&void 0!==c?c:[],S=null!==(u=null!==(d=null==y?void 0:y.expandedRowKeys)&&void 0!==d?d:null==y?void 0:y.defaultExpandedRowKeys)&&void 0!==u?u:[],[N,T]=t.useState([]),[I,R]=t.useReducer(((e,t)=>he(e,t)?e:t),f),[O,k]=t.useReducer(((e,t)=>he(e,t)?e:t),h),[L,A]=t.useReducer(((e,t)=>he(e,t)?e:t),[]),[P,F]=t.useReducer(((e,t)=>he(e,t)?e:t),{}),[_,D]=t.useState(w),[M,H]=t.useReducer(((e,t)=>he(e,t)?e:t),C),[$,q]=t.useReducer(((e,t)=>he(e,t)?e:t),S),[K,j]=t.useState(null!==(m=null==b?void 0:b.currentRowKey)&&void 0!==m?m:""),[V,z]=t.useReducer((e=>e+1),0),[W,B]=t.useReducer(((e,t)=>he(e,t)?e:t),{}),[U,G]=os([],{value:x}),[Y,X]=t.useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[Q,Z]=t.useState({export:!0,import:!0,print:!0}),[J,ee]=t.useState(!1),[te,ne]=t.useState(!1),[re,le]=t.useState(!1),[ie,ae]=t.useState(!1);return{tableFlatData:N,setTableFlatData:T,filters:I,setFilters:R,sorter:O,setSorter:k,superFilters:L,setSuperFilters:A,pagerFilter:P,setPagerFilter:F,pagination:_,setPagination:D,selectionKeys:M,setSelectionKeys:H,rowExpandedKeys:$,setRowExpandedKeys:q,highlightKey:K,setHighlightKey:j,updateMark:V,forceUpdate:z,activedCell:W,setActivedCell:B,mergedTdCells:U,setMergedCells:G,layout:Y,permission:Q,setPermission:Z,setLayout:X,spinning:J,setSpinning:ee,isPingLeft:te,setPingLeft:ne,isPingRight:re,setPingRight:le,isFullScreen:ie,setFullScreen:ae,updateTableFlatData:()=>T([...N])}})(r),{isFetch:De,isWebPagination:Me,isScrollPagination:He,showPagination:$e,tableColumns:qe,flattenColumns:Ke,editableColumns:je,summationColumns:Ve,leftFixedColumns:ze,rightFixedColumns:We,derivedMergeCells:Be,treeExpandIndex:Ue,showSummary:Ge,showFooter:Ye,isHeadGroup:Xe,bordered:Qe,isHeadSorter:Ze,isHeadFilter:Je,isServiceSummation:et,isSelectCollection:tt,isTableImport:nt,isTableClipboard:rt,isSuperSearch:lt,isFastSearch:it,isPivotGrid:at,isGroupSummary:ot,isGroupSubtotal:st,isTableEmpty:ct,summationRows:dt,fetchParams:ut}=cs(r,{getRowKey:R,tableRef:O,tableFullData:k,tableFlatData:Y,updateMark:ge,sorter:J,filters:Q,superFilters:te,selectionKeys:se,pagination:ie,mergedTdCells:xe}),{createElementStore:mt,tableStyles:pt,getSpan:ht,getStickyLeft:ft,getStickyRight:gt,scrollXToColumn:vt,scrollYToRecord:yt,calcTableHeight:bt,resetTableScroll:xt,doLayout:Et}=us(r,{getRowKey:R,tableRef:O,topElementRef:w,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:qe,flattenColumns:Ke,leftFixedColumns:ze,derivedMergeCells:Be,tableFlatData:Y,layout:we,showFooter:Ye,showPagination:$e,isFullScreen:Ae,setLayout:Ce,setElementStore:L}),{initialTable:wt,checkDataIndex:Ct,createTableFullData:St,createWebPageData:Nt,getTableData:Tt,createTableData:It,createTableFlatData:Rt,createGroupData:Ot,createAllExpandedKeys:kt,setSelectionKeysEffect:Lt,doFieldValidate:At,getTableLog:Pt,dataChange:Ft,tableChange:_t,toLastPage:Dt,toFirstPage:Mt,getPageCount:Ht,pagerChangeHandle:$t,scrollBottomDebouncer:qt,clearTableSorter:Kt,clearTableFilter:jt,clearSuperFilters:Vt,clearPagerFilter:zt,clearRowSelection:Wt,clearRowHighlight:Bt,clearTableLog:Ut,destroy:Gt}=ds(r,{getRowKey:R,tableRef:O,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:qe,flattenColumns:Ke,tableFullData:k,pagination:ie,layout:we,filters:Q,sorter:J,superFilters:te,pagerFilter:re,fetchParams:ut,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,summationColumns:Ve,isFetch:De,isWebPagination:Me,isScrollPagination:He,isServiceSummation:et,isGroupSubtotal:st,doLayout:Et,setTableFlatData:X,setTableFullData:P,setTableOriginData:F,setTableDataMaps:_,setDeriveRowKeys:D,setPagination:oe,setPingRight:Le,setPingLeft:Oe,setSpinning:Ie,setSorter:ee,setFilters:Z,setSuperFilters:ne,setPagerFilter:le,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setFilteredTreeData:B,setScrollXLoad:q,setScrollYLoad:K,setFieldAuth:H,setResizeState:j,setSummaries:z,setPermission:Ne,resetTableScroll:xt,clearElementStore:G});((e,n)=>{const{columns:r,summation:l,rowSelection:i,expandable:a,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,summationRows:f,showSummary:g,isWebPagination:v,isScrollPagination:y,checkDataIndex:b,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,initialTable:A,destroy:P}=n,F=t.useRef(f);Hl((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),ma(m)||null==e||e(m,s.current.selectionRows),pa(m)}),[m]),Hl((()=>{if(!a)return;const{onChange:e}=a;ma(p)||null==e||e(p,p.map((e=>s.current.recordsMap.get(e)))),pa(p)}),[p]),Hl((()=>{var e,t;o&&(c.current.setClickedValues(h?[h,""]:[]),null===(e=o.onChange)||void 0===e||e.call(o,h,null!==(t=s.current.recordsMap.get(h))&&void 0!==t?t:null))}),[h]),Hl((()=>{var e;he(f,F.current)||(F.current=f,g&&l&&(null===(e=l.onChange)||void 0===e||e.call(l,f)))}),[f]),Hl((()=>{const e=i.selectedRowKeys||[];he(e,m)||N(ua(e))}),[null==i?void 0:i.selectedRowKeys]),Hl((()=>{const e=a.expandedRowKeys||[];he(e,p)||I(ua(e))}),[null==a?void 0:a.expandedRowKeys]),Hl((()=>{const{currentRowKey:e}=o;e!==h&&R(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),Hl((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),Hl((()=>{L()}),[d]),Hl((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||tr("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),ms({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),L())},delay:16}),t.useEffect((()=>(T(Qn(r)),A(),b(),Bn((()=>L())),()=>{P(),k(!0)})),[])})(r,{tableRef:O,tableBodyRef:S,$size:E,pagination:ie,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,showSummary:Ge,summationRows:dt,isWebPagination:Me,isScrollPagination:He,checkDataIndex:Ct,toLastPage:Dt,toFirstPage:Mt,getPageCount:Ht,setHandleState:V,scrollYToRecord:yt,setOriginColumns:A,setSelectionKeysEffect:Lt,setRowExpandedKeys:ue,setHighlightKey:fe,setResizeState:j,setUnMounted:U,calcTableHeight:bt,initialTable:wt,destroy:Gt});const Yt=t.useMemo((()=>({getRowKey:R,tableRef:O,tableBodyRef:S,prefixCls:I,$size:E,tableFlatData:Y,flattenColumns:Ke,editableColumns:je,leftFixedColumns:ze,rightFixedColumns:We,treeExpandIndex:Ue,sorter:J,filters:Q,superFilters:te,pagerFilter:re,layout:we,bordered:Qe,showFooter:Ye,showSummary:Ge,summationRows:dt,pagination:ie,fetchParams:ut,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,activedCell:ye,mergedTdCells:xe,derivedMergeCells:Be,updateMark:ge,isFetch:De,isPingLeft:Re,isPingRight:ke,isHeadSorter:Ze,isHeadFilter:Je,isFullScreen:Ae,isTableEmpty:ct,isHeadGroup:Xe,isGroupSubtotal:st,isWebPagination:Me,dataChange:Ft,tableChange:_t,getTableData:Tt,setElementStore:L,createTableFullData:St,createTableFlatData:Rt,createWebPageData:Nt,createAllExpandedKeys:kt,updateTableFlatData:_e,setSorter:ee,setFilters:Z,setSuperFilters:ne,setPagerFilter:le,setHighlightKey:fe,setRowExpandedKeys:ue,setSelectionRows:W,setSelectionKeysEffect:Lt,setInvalidRowKeys:M,setActivedCell:be,setMergedCells:Ee,getSpan:ht,getStickyLeft:ft,getStickyRight:gt,scrollXToColumn:vt,scrollYToRecord:yt,setPagination:oe,setPingLeft:Oe,setPingRight:Le,setSpinning:Ie,setFullScreen:Fe,doFieldValidate:At,createTableData:It,createGroupData:Ot,scrollBottomDebouncer:qt,resetTableScroll:xt,clearTableSorter:Kt,clearTableFilter:jt,clearSuperFilters:Vt,clearPagerFilter:zt,clearRowSelection:Wt,clearRowHighlight:Bt})),[E,Y,Ke,J,Q,te,re,we,Qe,Ye,Ge,dt,ie,ut,se,de,pe,ye,Be,ge,De,Re,ke,Ze,Je,Ae,ct,Xe,st,Me]);((e,n)=>{const{getRowKey:r,tableRef:l,toolBoxRef:i,tableBodyRef:a,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,isFetch:f,dataChange:g,getTableData:v,createTableData:y,createTableFullData:b,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:F,clearRowHighlight:_,clearTableSorter:D,clearTableFilter:M,clearSuperFilters:H,clearPagerFilter:$,clearTableLog:q}=n,{columns:K,columnsChange:j}=l.current.props,V=(e,t,n)=>e.filter((e=>{const l=r(e,e.index);e.children&&(e.children=V(e.children,t,n));const i=t.includes(l);return i&&(null==n||n(e,l)),!i}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:e=>Dn(void 0,void 0,void 0,(function*(){f&&(yield Wn(0),yield v(),null==e||e())})),GET_LOG:()=>P(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(F(),_(),D(),M(),H(),$(),q(),y([]))},CLEAR_LOG:()=>{q(),A()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?ua([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?ua([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=ra(K,e);if(!r)return tr("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!ae(t))return tr("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return tr("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&me(r,e,t[e]);n&&(j?j([...K]):tr("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:i}=l.current,a=(Array.isArray(e)?e:[e]).filter((e=>ae(e)));if(!a.length)return;a.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[is.expandableColumn,is.selectionColumn,is.operationColumn].includes(n)||ya(e,n,va(e,n))})),n.addToInserted(e)}));const o="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=i;if(c)o?d.unshift(...a):d.push(...a);else{const e=Fa(i,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...a):e.children.push(...a):e.children=a)}c&&N(Object.assign({},l.current.handleState,{insert:o?"before":"after"})),y(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=l.current,i=(Array.isArray(e)?e:[e]).map((e=>ae(e)?r(e,e.index):e));if(!i.length)return;let a=!1;const o=V(n,i,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:l,editRender:i}=r,a=null==i?void 0:i(e,r);if(!a)return;const{rules:o=[],disabled:s}=a;!s&&o.length&&(t.removeFromRequired({x:n,y:l}),t.removeFromValidate({x:n,y:l}),t.removeFromEdited({x:n,y:l}))})),a=!0}));a&&(N(Object.assign({},l.current.handleState,{remove:!0})),b(o),I(m.filter((e=>!i.includes(e)))),i.includes(h)&&_(),R(p.filter((e=>!i.includes(e)))),g(),Bn((()=>{S(V(l.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{Array.from(l.current.recordsMap.values()).forEach((n=>{c.forEach((l=>{const{dataIndex:i,title:a,editRender:o}=l,s=null==o?void 0:o(n,l);if(!s)return;const c=r(n,n.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||C(d,va(n,i),c,i,Ia(a))}))}));const{required:n,validate:i}=P(),a=[...n,...i];return a.length&&w(a[0].rowKey),A(),{required:n,validate:i}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:Ke,editableColumns:je,pagination:ie,fetchParams:ut,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,isFetch:De,dataChange:Ft,getTableData:Tt,createTableData:It,createTableFullData:St,calcTableHeight:bt,scrollXToColumn:vt,scrollYToRecord:yt,doFieldValidate:At,setTableOriginData:F,setHandleState:V,setColumnsDefined:$,setSelectionKeysEffect:Lt,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setOriginColumns:A,forceUpdate:ve,getTableLog:Pt,clearRowSelection:Wt,clearRowHighlight:Bt,clearTableSorter:Kt,clearTableFilter:jt,clearSuperFilters:Vt,clearPagerFilter:zt,clearTableLog:Ut}),t.useLayoutEffect((()=>{mt(),O.current.tableManager.register(O.current.uid,null!=n?n:{current:null})}),[]);const Xt={[`${I}--wrapper`]:!0,[`${I}--lg`]:"large"===E,[`${I}--sm`]:"small"===E,[`${I}--maximize`]:Ae,[s]:!!s},Qt={[I]:!0,"is--border":Qe,"is--fixed":ze.length||We.length,"is--sortable":Ze,"is--filterable":Je,"is--head-group":Xe,"is--area-select":!!c,"is--ping-left":Re,"is--ping-right":ke};return t.createElement(jo.Provider,{value:Yt},t.createElement("div",{className:Pe(Xt,b),style:x},h&&t.createElement("div",{ref:w,className:`${I}-top`},t.createElement("div",{className:`${I}-top__space`},"bottom"!==(null==m?void 0:m.position)&&t.createElement(ps,{total:ie.total}),t.createElement("div",{className:`${I}-top__space-slot`,style:{justifyContent:Zo[p]}},r.children)),t.createElement("div",{className:`${I}-top__actions`},t.createElement(Vu,{ref:N,showFullScreen:f,showReload:g&&De,showPrint:Se.print&&!!d,showImport:Se.import&&nt,showExport:Se.export&&!!u,showClipboard:rt,showCollection:tt,showFastSearch:it,showSuperSearch:lt,showPivotGrid:at,showGroupSummary:ot,showToolBox:v,tableColumns:qe}),t.createElement(Wu,{ref:T,columns:i}))),t.createElement(ni,{spinning:null!=a?a:Te},t.createElement("div",{ref:C,className:Pe(Qt),style:pt},t.createElement("div",{className:`${I}--main-wrapper`},y&&t.createElement(xm,{tableColumns:qe}),t.createElement(Zm,{ref:S}),Ye&&t.createElement(Jm,null)),Qe&&t.createElement("div",{className:`${I}--border-line`}),ct&&t.createElement(np,null),o&&t.createElement(rp,null))),$e&&t.createElement(tp,Rn({},ie,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));lp.displayName="QmTable";const ip=e=>{var n;const{uniqueKey:r,multiple:l,initialValue:i,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:m}=e,{$size:p}=$n(e),{t:h}=Mn(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=si(f),[b,x]=t.useState(c),[E,w]=t.useState(),[C,S]=t.useState(o),[N,T]=t.useState(!1),[I,R]=t.useState(300),[O,k]=t.useState(s),[L,A]=t.useState((e=>[{title:h("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[P,F]=t.useState(Ie({},null===(n=c.fetch)||void 0===n?void 0:n.params,i)),[_,D]=t.useState([]),M=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Ko[p]-30)},H=ci(M,5);hn((()=>{H()}),[y.width]),Hl((()=>{he(s,O)||k(s)}),[s]),t.useEffect((()=>{$()}),[P]),t.useEffect((()=>{a&&v.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;i&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(i))}),[]);const $=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=b;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:a=zn}=n;if(a(P)){T(!0);try{const t=yield r(P);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[];l||(S([]),yield Wn(0)),D(n)}}catch(e){}T(!1)}})),q=e=>{l||(w(e),m(e))},K=e=>{F(Object.assign({},P,e))},j={[`${ir("search-helper")}--wrapper`]:!0},V=b.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:P})};return t.createElement("div",{ref:f,className:Pe(j,d),style:u},t.createElement("div",{className:"form-wrap"},O.length?t.createElement(Hh,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>M(),onFinish:e=>K(e),onReset:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||K(t)}))}):null),t.createElement("div",null,t.createElement(lp,Rn({ref:v,uniqueKey:r,height:I,columns:L,rowKey:b.rowKey||"pageIndex"},V,{rowSelection:{type:l?"checkbox":"radio",clearableAfterFetched:!l,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(l?t:t[0])}},topSpaceAlign:"left",paginationConfig:b.paginationConfig,columnsChange:e=>A(e),onRowDblclick:q,onRowEnter:q}),b.topBarExtra)),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ko[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!E,onClick:()=>m(E,l?C:void 0)},h("qm.dialog.confirm"))))};ip.displayName="QmSearchHelper";const{Search:ap}=O;class op extends d{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||tr("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||tr("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&tr("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Dn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Gn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&lo(e,this.alias,c),d&&io(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=ro(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==i||i([e])}}}catch(e){}this.setState({loading:!1})}})),this.todoOpen=e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)},this.createFilters=e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,r=""!==e?e:void 0,l=("function"==typeof n?n():n)||[],i={[t]:r};return(Array.isArray(l)?l:[l]).forEach((e=>{if(ae(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=zn,formatter:l=(e=>e)}=t.fetch;return new Promise(((i,a)=>Dn(this,void 0,void 0,(function*(){var o;const s=Ie({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),l(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return a();this.setState({loading:!0});try{const e=yield t.fetch.api(s);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];i(n)}else a()}catch(e){a(e)}finally{Bn((()=>this.setState({loading:!1})))}}))))},this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const l=ro(e,this.alias[r]);void 0!==l&&(t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l))}for(const n in this.extras){const r=ro(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>Dn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=ro(e,this.alias[n]))||void 0===r?void 0:r.toString().toLowerCase().includes(t.toLowerCase())}));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),this.openSearchHelper=(e,t)=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,l=(null!=r?r:zn)(n.state.formData);(null==l?void 0:l.then)?l.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==l&&(this.todoOpen(e),null==t||t())})),this.closeSearchHelper=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const l=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])});const r=ro(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(e)),200)}))},this.closeButNotSelect=()=>{const{onlySelect:e=!0}=this.searchHelper;this._is_change&&(e?this.clearSearchHelperValue():this.searchHelperChangeHandle(this.props.value)),this._is_change=!1,this.setVisible(!1)},this.clearSearchHelperValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}},this.searchHelperChangeHandle=e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,null==t||t(e,this._record)},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},this.focus=()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:l}=this.state,{value:i}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=un("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ko[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:Object.assign({},this.deriveParams,c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(To,{value:i,bordered:m}):t.createElement(t.Fragment,null,t.createElement(ap,{ref:e=>this[`${a}_Ref`]=e,value:i,title:i,loading:l,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:m,allowClear:p,readOnly:h,disabled:f,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:l=!0,table:i}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?l?(null===(t=null==i?void 0:i.fetch)||void 0===t?void 0:t.api)&&this.getSearchHelperTableData(n).then((e=>this.resetSearchHelperValue(e,n))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(n):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!r&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):Bn((()=>this.clearSearchHelperValue())))}}),t.createElement(Mi,b,t.createElement(ip,x)))}}op.contextType=Hi;class sp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=mo(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[]}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(op,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),m&&t.createElement(_,null,e.renderFormItemButton(a,m)),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}sp.contextType=Hi;const cp=e=>{class n extends d{constructor(){super(...arguments),this.event1=null,this.event2=null,this.$el=null,this.omitClassNames=[],this.state={clickOutside:!1},this.mousedownHandler=e=>{this.startClick=e},this.mouseupHandler=e=>{this.documentHandler(e,this.startClick)},this.documentHandler=(e,t)=>{var n,r;const l=e.target,i=null==t?void 0:t.target,a=!l||!i,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(l))||(null===(r=this.$el)||void 0===r?void 0:r.contains(i)),s=this.$el===l,c=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),d=c.some((e=>null==e?void 0:e.contains(l)))||c.includes(i);let u;u=!(a||o||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=(e=[])=>{this.omitClassNames=e}}componentDidMount(){this.event1=jt(document,"mousedown",this.mousedownHandler),this.event2=jt(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:n}=this.props,{clickOutside:r}=this.state;return t.createElement(e,Rn({ref:n},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return n.displayName=`OutsideClick(${e.displayName||e.name})`,t.forwardRef(((e,r)=>t.createElement(n,Rn({},e,{forwardedRef:r}))))};let dp=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||tr("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||tr("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ke([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||t(e),n(e,this.createViewText(e),this._records)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:l}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),l&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:l,params:i={},formatter:a=(e=>e),dataKey:o,callback:s,fieldAliasMap:c}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},d="function"==typeof c?c():c||{},{value:u}=this.props;if(l){if(Gn(u))return this.setRecords([]);this.setState({loading:!0});try{const e=yield l(a(Object.assign(Object.assign({},i),{keys:u})));if(200===e.code){let l=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];l.forEach((e=>{(null==d?void 0:d.valueKey)&&d.valueKey!==r&&(e[r]=e[d.valueKey]),(null==d?void 0:d.textKey)&&d.textKey!==n&&(e[n]=e[d.textKey])})),l=l.filter((e=>u.includes(e[r])));const i=l.map((e=>({value:e[r],text:e[n]})));this.setRecords(l),this.setItemList(i),this.setViewValue(u),null==s||s(l)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:l}=this.context,{visible:i,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:p={},placeholder:h=un("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:i,title:un("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Ko[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:Ie({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},un("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=ir("form-multiple-search-helper"),{size:R}=l.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t.createElement(To,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(od,{popupVisible:!y&&a,popup:N,popupClassName:Pe(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ga,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(D,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:h,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},p),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Nt,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Mi,w,t.createElement(ip,C)))}};dp.contextType=Hi,dp=_n([cp],dp);class up extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=mo(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(dp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(_,null,e.renderFormItemButton(a,m)),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}up.contextType=Hi;const mp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...mp(e.children)),e.children&&t.push(e.value)})),t},pp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=pp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},hp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&hp(e.children,t),t(e)||e.children&&e.children.length))),fp=e=>{var n;const{uniqueKey:r,multiple:l,initialValue:i,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:m,onClose:p}=e,{$size:h}=$n(e),{t:f}=Mn(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=si(g),[x,E]=t.useState(c),[w,C]=t.useState(),[S,N]=t.useState(o),[T,I]=t.useState(!1),[R,k]=t.useState(300),[L,A]=t.useState(300),[P,F]=t.useState(s),[_,D]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[M,H]=t.useState(Ie({},null===(n=c.fetch)||void 0===n?void 0:n.params,i)),[$,q]=t.useState([]),K=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Ko[h]-30)},j=ci(K,5);hn((()=>{j()}),[b.width]),Hl((()=>{he(s,P)||F(s)}),[s]),t.useEffect((()=>{V()}),[M]),t.useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;i&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(i)),te()}),[]);const V=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=x;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:a=zn}=n;if(a(M)){I(!0);try{const t=yield r(M);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[];l||(N([]),yield Wn(0)),q(n)}}catch(e){}I(!1)}})),W=e=>{l||(C(e),p(e))},B=e=>{H(Object.assign({},M,e))},[U,G]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),J=t.useRef(U),ee=t.useRef([]);Hl((()=>{X(mp(U))}),[U]);const te=()=>Dn(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:l="value",textKey:i="text"}=d.fetch;try{const a=yield t(n);if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[],n=ao(t,l,i);G(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${So.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${ir("tree-table-helper")}--wrapper`]:!0},le=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:M})};return t.createElement("div",{ref:g,className:Pe(re,u),style:m},t.createElement(Jl,{defaultValue:200,style:{height:"100%"}},t.createElement(Jl.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(O,{className:"input-wrap",value:Q,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:t.createElement(Nt,null),allowClear:!0,onChange:e=>(e=>{const t=hp(J.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==ne(n).indexOf(e)}));Z(e),G(t)})(e.target.value)}),t.createElement(z,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:Y,treeData:U,filterTreeNode:e=>{if(!Q)return!1;const t=e.text||"";return-1!==ne(t).indexOf(Q)},onExpand:e=>{X(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return tr("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=ue(e,t[r]);B(n)})(pp(ee.current,(n=>ue(n,t)===e[0]))||{})}})),t.createElement(Jl.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},P.length?t.createElement(Hh,{ref:v,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>K(),onFinish:e=>B(e),onReset:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||B(t)}))}):null),t.createElement("div",null,t.createElement(lp,Rn({ref:y,uniqueKey:r,height:L,columns:_,rowKey:x.rowKey||"pageIndex"},le,{rowSelection:{type:l?"checkbox":"radio",clearableAfterFetched:!l,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(l?t:t[0])}},topSpaceAlign:"left",paginationConfig:x.paginationConfig,columnsChange:e=>D(e),onRowDblclick:W,onRowEnter:W}),x.topBarExtra)))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ko[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!w,onClick:()=>p(w,l?S:void 0)},f("qm.dialog.confirm"))))};fp.displayName="TreeTableHelper";const{Search:gp}=O;class vp extends d{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||tr("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||tr("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&tr("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Dn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Gn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&lo(e,this.alias,c),d&&io(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=ro(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==i||i([e])}}}catch(e){}this.setState({loading:!1})}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const l=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])})},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const l=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])});const r=ro(e,this.alias[n]);this.triggerChange(r);const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(e)),200)}))},this.clearSearchHelperValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:l}=this.state,{value:i=""}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=un("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ko[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:Ie({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(To,{value:i,bordered:m}):t.createElement(t.Fragment,null,t.createElement(gp,{ref:e=>this[`${a}_Ref`]=e,value:i,title:i,loading:l,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:m,allowClear:p,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t.createElement(Mi,b,t.createElement(fp,x)))}}vp.contextType=Hi;class yp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=mo(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(vp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(_,null,e.renderFormItemButton(a,m)),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}yp.contextType=Hi;let bp=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||tr("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||tr("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ke([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||t(e),n(e,this.createViewText(e),this._records)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:l}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),l&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:l,params:i={},formatter:a=(e=>e),dataKey:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(l){if(Gn(d))return this.setRecords([]);this.setState({loading:!0});try{const e=yield l(a(Object.assign(Object.assign({},i),{keys:d})));if(200===e.code){let l=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];l.forEach((e=>{(null==c?void 0:c.valueKey)&&c.valueKey!==r&&(e[r]=e[c.valueKey]),(null==c?void 0:c.textKey)&&c.textKey!==n&&(e[n]=e[c.textKey])})),l=l.filter((e=>d.includes(e[r])));const i=l.map((e=>({value:e[r],text:e[n]})));this.setRecords(l),this.setItemList(i),this.setViewValue(d)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:l}=this.context,{visible:i,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:p={},placeholder:h=un("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:i,title:un("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Ko[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:Ie({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},un("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=ir("form-multiple-tree-table-helper"),{size:R}=l.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t.createElement(To,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(od,{popupVisible:!y&&a,popup:N,popupClassName:Pe(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ga,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(D,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:h,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},p),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Nt,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Mi,w,t.createElement(fp,C)))}};bp.contextType=Hi,bp=_n([cp],bp);class xp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=mo(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(bp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(_,null,e.renderFormItemButton(a,m)),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}xp.contextType=Hi;const Ep="_startSign",wp="_endSign",Cp=e=>{var n;const{uniqueKey:r,initialValue:l,filters:i=[],table:a={},onClose:o}=e,{$size:s}=$n(e),{t:c}=Mn(),d=t.useRef(null),u=t.useRef(null),m=t.useRef(null),p=si(d),[h,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[w,C]=t.useState(i),[S,N]=t.useState((e=>[{title:c("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},{title:c("qm.form.rangeSearchHelper")[0],dataIndex:Ep,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:wp,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[T,I]=t.useState(Ie({},null===(n=a.fetch)||void 0===n?void 0:n.params,l)),[O,k]=t.useState([]),L=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),A=t.useMemo((()=>2===L.length&&L.every((e=>void 0!==e))),[L]),P=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Ko[s]-30)},F=ci(P,5);hn((()=>{F()}),[p.width]),Hl((()=>{he(i,w)||C(i)}),[i]),t.useEffect((()=>{_()}),[T]);const _=()=>Dn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=h;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:i=zn}=n;if(i(T)){v(!0);try{const t=yield r(T);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];k(n)}}catch(e){}v(!1)}})),D=(e,t)=>{delete e[t]},M=()=>{y.forEach((e=>{e&&(D(e,Ep),D(e,wp))})),b([])},H=e=>{M(),I(Object.assign({},T,e))},$=ir("range-helper"),q=h.webPagination?{dataSource:O,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},h.fetch),{params:T})};return t.createElement("div",{ref:d,className:`${$}--wrapper`},t.createElement("div",{className:"form-wrap"},w.length?t.createElement(Hh,{ref:u,items:w,initialValues:l,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>P(),onFinish:e=>H(e),onReset:()=>Dn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||H(t)}))}):null),t.createElement("div",null,t.createElement(lp,Rn({ref:m,height:x,columns:S,rowKey:h.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},q,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Ep,wp].includes(n)&&(n===Ep&&(e[n]?(D(e,n),b([void 0,y[1]])):e.pageIndex>L[1]?R.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&D(y[0],n),e[n]="[",b([e,y[1]]))),n===wp&&(e[n]?(D(e,n),b([y[0],void 0])):e.pageIndex<L[0]?R.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&D(y[1],n),e[n]="]",b([y[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[Ep]="["),e.pageIndex===L[1]&&(e[wp]="]")}))}}),t.createElement(nr,{type:"primary",icon:t.createElement(Tt,null),title:c("qm.table.alert.clear"),onClick:()=>M()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ko[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(nr,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(nr,{type:"primary",disabled:!A,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[Ep,wp].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};Cp.displayName="RangeTableHelper";const Sp=new Array(2).fill("");class Np extends d{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:Sp},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||tr("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||tr("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setItemList=e=>{this.setState({itemList:e})},this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setTextValue=e=>{this.setState({textValue:e})},this.setRecords=e=>{this._records=e},this.setViewValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,null==t||t(e),n(e,this.createViewText(),this._records)},this.clearSearchHelperValue=()=>{this.setRecords([]),this.setTextValue(Sp),this.triggerChange([])},this.closeSearchHelper=e=>{const{valueKey:t,textKey:n}=this.alias,r=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(r),this.setTextValue(r.map((e=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.triggerChange(e.map((e=>e[t])));const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(this._records)),200)}))},this.openSearchHelper=e=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:zn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.createFilters=e=>{const{fieldName:t}=this.props.option;return{[t]:Gn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=zn,formatter:l=(e=>e)}=t.fetch;return new Promise(((i,a)=>Dn(this,void 0,void 0,(function*(){var o;const s=Ie({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),l(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return a();this.setState({loading:!0});const e=yield t.fetch.api(s);if(Bn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return i(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>Dn(this,void 0,void 0,(function*(){const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{var r;const l=null===(r=e[n])||void 0===r?void 0:r.toString().toLowerCase();return t.some((e=>null==l?void 0:l.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),this.closeButNotSelect=()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)},this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:n=[]}=this.props;he(t,n)||he(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:l}=this.props.option;if(!he(r[l],this._ceho_data)&&(this._ceho_data=r[l],this.setItemList(r[l]),n.length)){const e=Sp.map(((e,t)=>{var i,a;return null!==(a=null===(i=r[l].find((e=>e.value===n[t])))||void 0===i?void 0:i.text)&&void 0!==a?a:""}));this.setTextValue(e)}}getItemList(){var e;return Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:l={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(Gn(c))return this.setRecords([]);this.setState({loading:!0});try{const o=yield r(i(Object.assign(Object.assign({},l),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,a))&&void 0!==e?e:[];r.forEach((e=>{(null==s?void 0:s.valueKey)&&s.valueKey!==n&&(e[n]=e[s.valueKey]),(null==s?void 0:s.textKey)&&s.textKey!==t&&(e[t]=e[s.textKey])})),r=r.filter((e=>c.includes(e[n]))).slice(0,2);const l=r.map((e=>({value:e[n],text:e[t]})));this.setRecords(r),this.setItemList(l),this.setTextValue(l.map((e=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}))}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){var e;const{$$form:n}=this.context;this.props;const{visible:r,loading:l,textValue:i}=this.state,{fieldName:a,options:o={},searchHelper:s={},placeholder:c=un("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:p=!0}=this.searchHelper||s,h=i.every((e=>no(e)))?"":i.join(" - "),f={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Ko[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:Ie({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(To,{value:h,bordered:d}):t.createElement(t.Fragment,null,t.createElement(O.Group,null,t.createElement(O,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:l}=e.target;this._is_change&&!r&&(l?i.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;p||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),t.createElement(O.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:l,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:l}=e.target;this._is_change&&!r&&(l?i.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:p||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t.createElement(Mi,f,t.createElement(Cp,g)))}}Np.contextType=Hi;class Tp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=mo(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Np,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Tp.contextType=Hi;const Ip=e=>{const{$$form:n}=t.useContext(Hi),{value:r,items:l,onChange:i,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=Gn(m)?l:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(To,{value:h(r),bordered:c}):t.createElement(M.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==i||i(e),a(e,h(e))})(e)}},p.map((e=>t.createElement(M,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Rp extends d{constructor(){super(...arguments),this.state={itemList:[]}}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,l)||this.getItemList()}getItemList(){var e;return Dn(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Ip,{option:this.props.option,items:n,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Rp.contextType=Hi;const Op=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:p}=a,h=e=>p?p[Math.ceil(e)-1]:e.toString();return t.createElement(U,{value:r,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==l||l(e),i(e,h(e))})(e)}})};class kp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Op,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}kp.contextType=Hi;const Lp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,items:l,onChange:i,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:m=[]}=o,p=Gn(m)?l:m,h=e=>{var t,n;return null!==(n=null===(t=p.find((t=>t.value===e)))||void 0===t?void 0:t.text)&&void 0!==n?n:""};return n.isOnlyShow?t.createElement(To,{value:h(r),bordered:c}):t.createElement(K.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),a(e,h(e))})(t)}},p.map((e=>t.createElement(K,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ap extends d{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Lp,{option:this.props.option,items:n,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ap.contextType=Hi;const Pp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=Wa,trueValue:p=za}=o,{t:h}=Mn();return t.createElement(t.Fragment,null,t.createElement(W,{checked:r===p,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement($e,null),unCheckedChildren:t.createElement(lt,null),onChange:e=>{(e=>{null==l||l(e),i(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(e?p:m)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class Fp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option,{labelToSwitch:h}=o;return t.createElement(P.Item,{label:h?" ":e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Pp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Fp.contextType=Hi;const _p=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{options:o={},style:s={},placeholder:c=a("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{showCount:v,maxLength:y,autoSize:b}=o,x=Object.assign({},{minRows:1,maxRows:3},b);return t.createElement(O.TextArea,{value:r,placeholder:c,style:s,maxLength:y,showCount:v,autoSize:x,bordered:d,allowClear:u,readOnly:m||n.isOnlyShow,disabled:p,onFocus:e=>{null==h||h(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),null==f||f(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;null==g||g(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{null==l||l(e),i(e)})(t)}})};class Dp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(_p,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Dp.contextType=Hi;const Mp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.datePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:v,disabledDate:y,minDateTime:b,maxDateTime:x,shortCuts:E=!0}=s,w=t.createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==l||l(e),i(e,S(e))},S=e=>no(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=to(p().subtract(e,"day"),Xa[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return n.isOnlyShow?t.createElement(To,{value:S(r),bordered:u}):t.createElement(In,{ref:w,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ya[g],format:v,bordered:u,showToday:!1,showTime:"datetime"===g&&{defaultValue:p("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:h,disabledDate:null!=y?y:e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[b,x]),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():t.createElement(t.Fragment,null,t.createElement(G,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(G,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(G,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(G,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:eo(r,Xa[g]),onChange:(e,t)=>{C(to(e,Xa[g]))}})};class Hp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Mp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Hp.contextType=Hi;const $p=e=>[p().subtract(e,"day"),p()],qp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f=n.isFormDisabled}=e.option,{dateType:g="date",format:v,disableds:y=[!1,!1],allowEmpty:b,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:$p(7),[a("qm.form.dateRangePickers")[1]]:$p(30),[a("qm.form.dateRangePickers")[2]]:$p(90),[a("qm.form.dateRangePickers")[3]]:$p(180)},N=e=>no(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(To,{value:N(r),bordered:u}):t.createElement(In.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ya[g],format:v,bordered:u,showTime:"datetime"===g&&{defaultValue:[p("00:00:00","HH:mm:ss"),p("23:59:59","HH:mm:ss")]},allowClear:m,allowEmpty:b,disabled:f?[!0,!0]:y,inputReadOnly:h,disabledDate:null!=x?x:e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w]),ranges:C&&g.includes("date")?S:void 0,value:Gn(r)?null:[eo(null==r?void 0:r[0],Xa[g]),eo(null==r?void 0:r[1],Xa[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),null==l||l(e),i(e,N(e))})([to(null==e?void 0:e[0],Xa[g]),to(null==e?void 0:e[1],Xa[g])])}})};class Kp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(qp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Kp.contextType=Hi;const jp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:v=1,secondStep:y=1}=s;return n.isOnlyShow?t.createElement(To,{value:r,bordered:u}):t.createElement(On,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:v,secondStep:y,allowClear:m,disabled:h,inputReadOnly:p,format:Qa[f],value:eo(r,Qa[f]),onChange:(e,t)=>{(e=>{const t=to(e,Qa[f]);null==l||l(t),i(t)})(e)}})};class Vp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(jp,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Vp.contextType=Hi;const zp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h=n.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:v,hourStep:y=1,minuteStep:b=1,secondStep:x=1}=s,E=e=>no(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(To,{value:E(r),bordered:u}):t.createElement(On.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:b,secondStep:x,allowClear:m,allowEmpty:v,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Qa[f],value:Gn(r)?null:[eo(null==r?void 0:r[0],Qa[f]),eo(null==r?void 0:r[1],Qa[f])],onChange:(e,t)=>{(e=>{const t=[to(null==e?void 0:e[0],Qa[f]),to(null==e?void 0:e[1],Qa[f])];null==l||l(t),i(t,E(t))})(e)}})};class Wp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(zp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Wp.contextType=Hi;class Bp extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._clicking=!1,this._prevValue=null,this.state={itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0},this.getSearchHelper=Wt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting(),he(e,t)||this.getItemList()})),this.echoSearchHelper=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>Dn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:l,echoRequest:i}=this.searchHelper;if(r||tr("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),l){const e=["valueKey","displayKey","extraKey"];for(const t in l)e.includes(t)&&(this[t]=l[t])}Object.keys(this.alias).includes(e)||tr("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&tr("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&tr("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>Dn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Gn(u))try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&lo(e,this.alias,c),d&&io(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=ro(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==i||i([e])}}}catch(e){}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const l=ro(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:ro(e,this.extras[n])})},this.fetchHandle=Le(this.getItemList,200),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},this.clickHandle=(e,t)=>{const{$$form:n}=this.context,{fieldName:r}=this.props.option;for(const t in this.alias){if(t===r)continue;const l=ro(e,this.alias[t]);n.SET_FIELDS_VALUE({[t]:l}),t===this.valueKey&&(this._prevValue=e?l:null)}for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:ro(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const l=ro(e,this.alias[r]);this.triggerChange(l),this.setState({inputText:void 0}),t&&t()},this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(e){var t,n,r,l,i,a;const o=(null===(n=null===(t=e.option.searchHelper)||void 0===t?void 0:t.request)||void 0===n?void 0:n.params)||(null===(r=e.option.request)||void 0===r?void 0:r.params),s=(null===(i=null===(l=this.props.option.searchHelper)||void 0===l?void 0:l.request)||void 0===i?void 0:i.params)||(null===(a=this.props.option.request)||void 0===a?void 0:a.params);this.paramsChangeHandler(s,o),this.echoSearchHelper()}getItemList(e){var t;return Dn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:l={},formatter:i=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(i(Object.assign(Object.assign({},l),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=ue(o.data,a))&&void 0!==t?t:[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}))}render(){const{$$form:e}=this.context,{visible:n,loading:r,itemList:l,inputText:i}=this.state,{value:a}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=un("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=this.props.option,{listHeight:f=Ba}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=ir("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t.createElement(T,{spinning:r},l.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:Pe("table")},!g&&t.createElement("thead",null,t.createElement("tr",null,y.filter((e=>!e.hidden)).map((e=>t.createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t.createElement("tbody",null,l.map(((e,n)=>t.createElement("tr",{key:n,className:this.state.activeIndex===n?"active":"",onMouseEnter:()=>{this.setState({activeIndex:n})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},y.filter((e=>!e.hidden)).map((n=>t.createElement("td",{key:n.dataIndex},ue(e,n.dataIndex))))))))):t.createElement(ti,null));return t.createElement(on.Consumer,null,(r=>{const s={[b]:!0,[`${b}--lg`]:"large"===(null==r?void 0:r.size),[`${b}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(To,{value:a,bordered:u}):t.createElement(od,{action:h?[]:["click"],popupVisible:!h&&n,popup:E,popupClassName:Pe(s,`form-popper__${o}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ga,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:d,allowClear:m,bordered:u,readOnly:p,disabled:h,style:Object.assign({width:"100%"},c),value:null!=i?i:a,title:a,onFocus:()=>{!l.length&&this.fetchHandle(a)},onBlur:e=>{v&&!this._clicking&&i!==a&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(l[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const n=40===e.keyCode?++t%l.length:(--t+l.length)%l.length;this.setState({activeIndex:n})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),v?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}))}}Bp.contextType=Hi;class Up extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Dn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){er("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return tr("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=mo(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Zn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Bp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(_,null,e.renderFormItemButton(a,m)),u&&t.createElement(_,{flex:Zn(u.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Up.contextType=Hi;class Gp extends d{render(){var e;const{$$form:n}=this.context,{type:r,label:l,fieldName:i,className:a,style:o={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:m=Vn}=s,p=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===i)))&&void 0!==e?e:[],r=null!=d?d:t.length-1;t.slice(r+1).forEach((e=>{var t;const r=u.find((t=>t.fieldName===e.fieldName));if(!r)return;const l=r.showLabel?`${e.label}:`:"",i=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==i&&p.push(Object.assign(Object.assign({},e),{text:`${l}${i}`}))}))}return t.createElement(P.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(ar,{id:i,label:l,className:a,extra:p.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[i],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[i]:e})}))),m(e)}}))}}Gp.contextType=Hi;const Yp=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:Yp(e.children,t,n,r)}):e)),Xp=e=>{var n;const{$$form:r}=t.useContext(Hi),{value:l,items:i,multiple:a,loading:o,onChange:s,onValuesChange:c}=e,{t:d}=Mn(),{fieldName:u,options:m={},style:p={},placeholder:h=d("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,asyncLoad:v,readOnly:y,disabled:b}=e.option,{itemList:x,filterable:E=!0,listHeight:w=Ba,checkStrictly:C,checkStrategy:S="SHOW_CHILD",collapseTags:N,echoRequest:T,defaultExpandAll:I=!v,defaultExpandedKeys:R,dropdownStyle:O,openPyt:k=!0}=m,[L,A]=t.useState(Gn(x)?i:x),[P,F]=t.useState([]),[_,D]=t.useState(!1),[M,H]=t.useState(!1),$=t.useRef(null),q=t.useRef(null),K=t.useRef(L),j=t.useRef(M),V=t.useRef(null),z=e=>{H(e),j.current=e};Nu({ref:q,handler:()=>z(!1)}),t.useEffect((()=>{l!==V.current&&(U(),V.current=l),(()=>{var e;q.current=(null===(e=$.current)||void 0===e?void 0:e.querySelector(".ant-select-selection-overflow-item-rest"))||null})()}),[l]),Hl((()=>{const e=Gn(x)?i:x;v?he(e,K.current)||(A((t=>[...e,...t.filter((e=>!!e.style))])),K.current=e):A(e)}),[x,i]),Hl((()=>{A((e=>[...e,...P.filter((t=>!e.some((e=>e.value===t.value))))]))}),[P]);const W=e=>{var t;return(null===(t=oo(L,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},B=e=>(C&&Array.isArray(l)&&l.every((e=>ae(e)))&&(e=e.map((e=>e.value))),a?(null==e?void 0:e.map((e=>W(e))).join(","))||"":W(e)),U=()=>Dn(void 0,void 0,void 0,(function*(){var e;if(!T)return;if(!v)return tr("Form","TREE_SELECT 的 echoRequest 选项必须组合 `asyncLoad` 一起使用");const{fetchApi:t,params:n,dataKey:r,callback:i,formatter:a=(e=>e)}=T||{},{textKey:o="text",valueKey:s="value"}=v;if(t&&!Gn(l))try{const c=yield t(a(Object.assign(Object.assign({},n),{[s]:l})));if(200===c.code){const t=Array.isArray(c.data)?c.data:null!==(e=ue(c.data,r))&&void 0!==e?e:[];if(t.length){const e=ao(t,s,o);F(e.map((e=>Object.assign(Object.assign({},e),{style:{display:"none"}})))),null==i||i(t)}}}catch(e){}}));return r.isOnlyShow?t.createElement(To,{value:B(l),bordered:f}):t.createElement(od,{popupVisible:!b&&M,popup:(()=>{if(!a)return null;const e=(null==l?void 0:l.map((e=>W(e))))||[];return t.createElement("ul",{className:"ant-dropdown-menu"},e.length?e.map(((e,n)=>t.createElement("li",{key:`${e}-${n}`,className:"ant-dropdown-menu-item"},e))):t.createElement("li",{className:"ant-dropdown-menu-item"},d("qm.table.config.emptyText")))})(),popupStyle:{minWidth:null===(n=$.current)||void 0===n?void 0:n.offsetWidth},onPopupVisibleChange:e=>z(e),builtinPlacements:Ga,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",{ref:$,style:{width:"100%"}},t.createElement(Y,Rn({open:_,fieldNames:{label:"text",value:"value",children:"children"},value:l,multiple:a,treeCheckable:a,treeCheckStrictly:C,showCheckedStrategy:Y[S],popupClassName:`form-popper__${u}`,dropdownStyle:O,placeholder:h,listHeight:w,style:p,loading:o,bordered:f,allowClear:g,disabled:b,treeDefaultExpandAll:I,treeDefaultExpandedKeys:R,showSearch:E,maxTagCount:N?"responsive":void 0,loadData:v?({key:e,children:t})=>Dn(void 0,void 0,void 0,(function*(){var n;if(!v||t)return;const{fetchApi:r,params:l,dataKey:i,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=v;if(r)try{const t=yield r(c(Object.assign(Object.assign({},l),{[o]:e})));if(200===t.code){const r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,i))&&void 0!==n?n:[],l=Yp(L,e,o,ao(r,o,a));A(l),null==s||s(r)}}catch(e){}})):void 0,treeData:L},a?{title:B(l)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",l=So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(k?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onMouseDown:e=>{e.target.classList.contains("ant-select-selection-overflow-item-rest")&&(z(!0),D(!1))},onDropdownVisibleChange:e=>{if(!e)return D(e);Bn((()=>{j.current||D(e)}))},onChange:e=>{(e=>{null==s||s(e),c(e,B(e),L)})(e),V.current=e}}))))};class Qp extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[],r=ao(n,i,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Zn(d)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Xp,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(_,{flex:Zn(m.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}Qp.contextType=Hi;const Zp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,multiple:l,items:i}=e,{t:a}=Mn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:p,readOnly:h,disabled:f}=e.option,{itemList:g,changeOnSelect:v,checkStrictly:y,checkStrategy:b="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:w=!0}=s,[C,S]=t.useState(Gn(g)?i:g),N=t.useRef(C);Hl((()=>{const e=Gn(g)?i:g;p?he(e,N.current)||(S(e),N.current=e):S(e)}),[g,i]);const T=e=>so(C,null!=e?e:"").map((e=>e.text)).join("/"),I=e=>l?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement(To,{value:I(r),bordered:u}):t.createElement(X,Rn({value:(e=>Gn(e)?[]:l?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:l,maxTagCount:"responsive",changeOnSelect:v||y,showCheckedStrategy:X[b],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:m,disabled:f,showSearch:x&&!p&&{filter:(e,t)=>t.some((t=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",l=So.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?e=>Dn(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!p||n.children)return;const{fetchApi:r,params:l,dataKey:i,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=p;if(r)try{const e=yield r(c(Object.assign(Object.assign({},l),{[o]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,i))&&void 0!==t?t:[],l=Yp(C,n.value,o,ao(r,o,a));S(l),null==s||s(r)}}catch(e){}})):void 0},l?{title:I(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,I(t),C)})(((e=[])=>l?e.map((e=>e.join(","))):e.join(","))(t))}}))};class Jp extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Dn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[],r=ao(n,i,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Zn(d)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Zp,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(_,{flex:Zn(m.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}Jp.contextType=Hi;const eh=["110000","120000","310000","500000"],th=["810000","820000"],nh=[{text:"A",value:"A"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"L",value:"L"},{text:"N",value:"N"},{text:"Q",value:"Q"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],rh=[{text:"A",value:"A"},{text:"B",value:"B"},{text:"C",value:"C"},{text:"D",value:"D"},{text:"E",value:"E"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"K",value:"K"},{text:"L",value:"L"},{text:"M",value:"M"},{text:"N",value:"N"},{text:"P",value:"P"},{text:"Q",value:"Q"},{text:"R",value:"R"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"W",value:"W"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],lh=e=>So.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),ih=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...eh,...th].includes(e))):Object.keys(e[t])).map((r=>({l:lh(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:ih(e,r,n+1)})))},ah=(e,t)=>t.map((t=>({l:lh(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class oh extends d{constructor(e){super(e),this.searchRef=t.createRef(),this.scrollRef=t.createRef(),this.state={visible:!1,select_type:"0",active_key:""},this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)},this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Vt(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){var t;return(null===(t=this.allCities.find((t=>t.c===e)))||void 0===t?void 0:t.n)||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:ah(rn,eh)},{l:"Z2",n:"港澳",c:"",p:"",children:ah(rn,th)}]}createProvince(){var e;return(null!==(e=ih(rn,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return rh.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...eh,...th].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(K.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},t.createElement(K.Button,{value:"0"},un("qm.form.citySelectType.0")),t.createElement(K.Button,{value:"1"},un("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?nh:rh).map((n=>t.createElement("li",{key:n.value,className:Pe({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement(D,{size:"small",placeholder:un("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>{var n;return((null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"").toLowerCase().indexOf(e.toLowerCase())>=0},value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t.createElement(D.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:n}=this.state;return("0"===n?this.provinces:this.letterCities).map(((n,r)=>{var l;return t.createElement("div",{key:r},t.createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t.createElement("dd",null,null===(l=n.children)||void 0===l?void 0:l.map((n=>t.createElement("li",{key:n.c,className:Pe({actived:n.c===e}),onClick:()=>this.clickHadnle(n.c)},n.n)))))}))}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:l,options:i={},style:a={},placeholder:o=un("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=ir("form-city-select"),p=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,h=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},a)},t.createElement("div",{className:"city-drop"},t.createElement("div",{className:"city-drop-toper"},t.createElement("div",{className:"city-drop-toper__type"},this.renderType()),t.createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t.createElement("div",{className:"city-drop-letter"},this.renderLetter()),t.createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t.createElement("dl",null,this.renderCity(r)))));return t.createElement(on.Consumer,null,(r=>{const i={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(To,{value:h,bordered:s}):t.createElement(od,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:Pe(i,`form-popper__${l}`),popupStyle:{minWidth:p},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ga,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},a),value:h,title:h,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}oh.contextType=Hi;class sh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(oh,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}sh.contextType=Hi;const ch=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:ch(e,n)})))};class dh extends d{constructor(e){super(e),this.searchRef=t.createRef(),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)};const n=ch(rn,"86")||[];this.state={results:n,visible:!1,values:[],tabs:[n.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.state.values.join(",")!==(null!=n?n:"")&&this.initial()}get isFetch(){var e;return!!(null===(e=this.props.option.request)||void 0===e?void 0:e.fetchApi)}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>{var n,r;return null===(r=null===(n=this.state.tabs[t])||void 0===n?void 0:n.find((t=>t.value===e)))||void 0===r?void 0:r.text})).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const n=this.state.tabs.slice(0,1);for(let r=0;r<t.length;r++){const l=oo(e,t[r]);if(l&&Gn(l.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(null==l?void 0:l.children)&&(n[r+1]=null==l?void 0:l.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}getStreetList(e){var t;return Dn(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:l=(e=>e),dataKey:i,valueKey:a="value",textKey:o="text"}=n;if(r)try{const n=yield r(l({code:e}));if(200===n.code){const e=Array.isArray(n.data)?n.data:null!==(t=ue(n.data,i))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var l;const i=(null===(l=n.find((t=>t.value===e[r])))||void 0===l?void 0:l.text)||`${un("qm.form.selectPlaceholder").replace("...","")}(${un("qm.form.regionSelectLabel")[r]})`;return t.createElement(Pi.TabPane,{key:r.toString(),tab:i},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:Pe({"region-box__item":!0,actived:e.includes(n.value.toString())}),title:n.text,onClick:()=>{let{values:e}=this.state;e[r]=n.value.toString(),e=e.slice(0,r+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(r+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(r+1)}))}},n.text)))))}));return n.length?t.createElement(Pi,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(ti,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:l,options:i={},style:a={},placeholder:o=un("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=ir("form-region-select"),p=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,h=t.createElement("div",{className:"container"},this.renderTabs());let f=this.prevText;if(!n){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(f=e,this.prevText=f)}return t.createElement(on.Consumer,null,(r=>{const i={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(To,{value:f,bordered:s}):t.createElement(od,{action:u?[]:["click"],popupVisible:!u&&n,popup:h,popupClassName:Pe(i,`form-popper__${l}`),popupStyle:{minWidth:p},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ga,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:Object.assign({width:"100%"},a),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&Bn((()=>this.initial()))}})))}))}}dh.contextType=Hi;class uh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(dh,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(i,n)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}uh.contextType=Hi;const mh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:v,onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w}=a,{action:C,headers:S,params:N,withCredentials:T=!1,dataKey:I="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:A}=o,P="function"==typeof k?k():k||{},{t:F}=Mn();return t.createElement(Ti,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:T,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(Ke,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const l in P)r[l]=e[l]||(null===(t=n.data)||void 0===t?void 0:t[P[l]])||"";return e.response&&200!==n.code&&R.error(n.message||F("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(I?ue(n.data,I):n.data)||"",status:e.status})}));null==l||l(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(e)},onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w})};class ph extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(mh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,"")}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}ph.contextType=Hi;const hh=t.forwardRef(((e,n)=>{const r=mn({src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0},e),{className:l,style:i,src:a,alt:o,imgStyle:s}=r,c=Fn(r,["className","style","src","alt","imgStyle"]),d=t.useRef(null),u=t.useRef(null);t.useEffect((()=>{const e={};for(const t in c)void 0!==r[t]&&(e[t]=r[t]);return u.current=new ln(d.current,e),()=>{y(),u.current=null}}),[]);const m=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.reset()},p=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},h=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.crop()},f=(e,t=!1)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.replace(e,t)},g=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.enable()},v=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.disable()},y=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.destroy()},b=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.move(e,t)},x=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.moveTo(e,t)},E=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoom(e)},w=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},C=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotate(e)},S=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotateTo(e)},N=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleX(e)},T=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleY(e)},I=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.scale(e,t)},R=(e=!1)=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getData(e)},O=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setData(e)},k=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getContainerData()},L=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getImageData()},A=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCanvasData()},P=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCanvasData(e)},F=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},_=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},D=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},M=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},H=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setDragMode(e)};t.useImperativeHandle(n,(()=>({reset:m,clear:p,initCrop:h,replace:f,enable:g,disable:v,destroy:y,move:b,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:F,setCropBoxData:_,getCroppedCanvas:D,setAspectRatio:M,setDragMode:H})));const $={[ir("cropper")]:!0};return t.createElement("div",{className:Pe($,l),style:i},t.createElement("img",{ref:d,src:a,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));hh.displayName="Cropper";const fh=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:l,quality:i,beforeCrop:a,className:o}=e,{t:s}=Mn(),c=t.useRef(null),d=t.useRef(),u=t.useRef(),m=t.useRef(),p=t.useRef(),[h,f]=t.useState(""),g=e=>{c.current.relativeZoom(e)},v=e=>{c.current.rotate(e)},y=()=>{f("")},b=ir("cropper-preview");return t.createElement(t.Fragment,null,(()=>{const n=Array.isArray(e.children)?e.children[0]:e.children;if(!n)return null;const r=n.props,{beforeUpload:l}=r,i=Fn(r,["beforeUpload"]);return d.current=l,t.createElement(n.type,Object.assign(Object.assign({},i),{beforeUpload:(e,t)=>new Promise(((n,r)=>Dn(void 0,void 0,void 0,(function*(){const r=()=>n(I.LIST_IGNORE);if(a&&!(yield a(e,t)))return void r();u.current=e,m.current=n,p.current=r;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))))}))})(),h&&t.createElement(A,{open:!0,wrapClassName:Pe(b,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{Dn(void 0,void 0,void 0,(function*(){const{type:e,name:t,uid:r}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((l=>Dn(void 0,void 0,void 0,(function*(){let i=new File([l],t,{type:e});if(Object.assign(i,{uid:r}),n.length&&!n.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return R.warning(s("qm.upload.tooltip",{type:n.join(",")})),p.current("file type is error");if("function"!=typeof d.current)return m.current(i);const a=d.current(i,[i]);if("boolean"==typeof a||a){if(!0===a)return m.current(i);if(!1===a)return p.current("not upload");if(a&&"function"==typeof a.then)try{const e=yield a,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),m.current(i)}catch(e){p.current(e)}}else tr("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,i),yield Wn(100),y()}))},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:l?`calc(380px * ${l[1]/l[0]})`:"auto"};return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(hh,{ref:c,aspectRatio:l?l[0]/l[1]:l,src:h,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(S,{size:"small"},t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(It,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Rt,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Ot,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(kt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},gh=e=>{const n=mn({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:l=!0,fixedSize:i,quality:a=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:p,popupClassName:h,beforeCrop:f,onSortChange:g,onChange:v}=n,{t:y}=Mn(),{$size:b}=$n(n),x=t.useRef(null),E=t.useRef(null),w=t.useRef(!1),[C,S]=t.useState(!1),[N,T]=t.useState(0),O=t.useMemo((()=>u||m),[u,m]),k=t.useMemo((()=>!c||r.length<c),[r,c]);t.useEffect((()=>(A(),document.addEventListener("paste",F),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",F)})),[]),Hl((()=>{k||(w.current=!1)}),[r]);const L=Hn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[l]=e.splice(t,1);e.splice(n,0,l),null==g||g(e),null==v||v({file:r[t],fileList:e})}})),A=()=>{d&&(E.current=Kt.create(Ul(x.current,ir("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:L}))},P=(e,t)=>new Promise(((r,l)=>Dn(void 0,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:a,beforeUpload:o}=n,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!a||e.size/1024/1024<a,d=s&&c;if(s||R.warning(y("qm.upload.tooltip",{type:i.join(",")})),c||R.warning(y("qm.upload.sizeLimit",{size:a})),!d)return I.LIST_IGNORE;if(o){const n=o(e,t);if(!0===n)return r(e);if(!1===n)return l("not upload");if(n&&"function"==typeof n.then)try{const e=yield n;r(e)}catch(e){l(e)}}else r(e)})))),F=Hn((e=>Dn(void 0,void 0,void 0,(function*(){const{action:t,data:l,headers:i}=n;if(w.current&&k&&t)for(const n of e.clipboardData.items)if("file"===n.kind&&n.type.startsWith("image/")){const e=n.getAsFile(),a=Date.now(),o=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${a}`});try{yield P(o,[...r,o]);const e=new FormData;if(e.append("file",o),l)for(const t in l)e.append(t,l[t]);const n="string"==typeof t?t:yield t(o),a=yield fetch(n,{method:"POST",body:e,headers:i});if(!a.ok)throw new Error(y("qm.upload.uploadError"));const s=yield a.json();null==v||v({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})))),_=ir("upload-img"),D={[_]:!0,[`${_}--lg`]:"large"===b,[`${_}--sm`]:"small"===b},M=t.createElement(I,Rn({className:Pe(D,p)},Xn(n,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:P,disabled:O,onPreview:e=>{const t=r.findIndex((t=>t.url===e.url));t<0||(T(t),S(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,n,r,l)=>t.createElement("div",{className:Pe("upload-item",{handle:d})},e,!O&&t.createElement(lt,{title:y("qm.upload.remove"),className:"icon",onClick:()=>l.remove()}))}),t.createElement("span",{className:"inner",ref:x},k&&!(m&&r.length)&&t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(Lt,null)),t.createElement("p",{className:"ant-upload-text"},y("qm.uploadCropper.dragableText")),t.createElement("button",{className:Pe("ant-upload-button",{disabled:O}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,l?t.createElement(fh,{className:h,fixedSize:i,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},M):M,t.createElement("div",{style:{display:"none"}},t.createElement(Q.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:N,rootClassName:h,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(Q,{key:e.uid||n,src:e.url,alt:""}))))))};gh.displayName="QmUploadImg";const vh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:v,onRemove:y,onSortChange:b}=a,{action:x,headers:E,params:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=Mn();return t.createElement(gh,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:u,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const l in O)r[l]=e[l]||(null===(t=n.data)||void 0===t?void 0:t[O[l]])||"";return e.response&&200!==n.code&&R.error(n.message||k("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(S?ue(n.data,S):n.data)||"",status:e.status})}));null==l||l(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(e)},onRemove:y,onSortChange:b})};class yh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(vh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,"")}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}yh.contextType=Hi;const bh={onActivate:Bt.func,onAddUndo:Bt.func,onBeforeAddUndo:Bt.func,onBeforeExecCommand:Bt.func,onBeforeGetContent:Bt.func,onBeforeRenderUI:Bt.func,onBeforeSetContent:Bt.func,onBeforePaste:Bt.func,onBlur:Bt.func,onChange:Bt.func,onClearUndos:Bt.func,onClick:Bt.func,onContextMenu:Bt.func,onCommentChange:Bt.func,onCopy:Bt.func,onCut:Bt.func,onDblclick:Bt.func,onDeactivate:Bt.func,onDirty:Bt.func,onDrag:Bt.func,onDragDrop:Bt.func,onDragEnd:Bt.func,onDragGesture:Bt.func,onDragOver:Bt.func,onDrop:Bt.func,onExecCommand:Bt.func,onFocus:Bt.func,onFocusIn:Bt.func,onFocusOut:Bt.func,onGetContent:Bt.func,onHide:Bt.func,onInit:Bt.func,onKeyDown:Bt.func,onKeyPress:Bt.func,onKeyUp:Bt.func,onLoadContent:Bt.func,onMouseDown:Bt.func,onMouseEnter:Bt.func,onMouseLeave:Bt.func,onMouseMove:Bt.func,onMouseOut:Bt.func,onMouseOver:Bt.func,onMouseUp:Bt.func,onNodeChange:Bt.func,onObjectResizeStart:Bt.func,onObjectResized:Bt.func,onObjectSelected:Bt.func,onPaste:Bt.func,onPostProcess:Bt.func,onPostRender:Bt.func,onPreProcess:Bt.func,onProgressState:Bt.func,onRedo:Bt.func,onRemove:Bt.func,onReset:Bt.func,onSaveContent:Bt.func,onSelectionChange:Bt.func,onSetAttrib:Bt.func,onSetContent:Bt.func,onShow:Bt.func,onSubmit:Bt.func,onUndo:Bt.func,onVisualAid:Bt.func,onSkinLoadError:Bt.func,onThemeLoadError:Bt.func,onModelLoadError:Bt.func,onPluginLoadError:Bt.func,onIconsLoadError:Bt.func,onLanguageLoadError:Bt.func},xh=Object.assign({apiKey:Bt.string,id:Bt.string,inline:Bt.bool,init:Bt.object,initialValue:Bt.string,onEditorChange:Bt.func,value:Bt.string,tagName:Bt.string,cloudChannel:Bt.string,plugins:Bt.oneOfType([Bt.string,Bt.array]),toolbar:Bt.oneOfType([Bt.string,Bt.array]),disabled:Bt.bool,textareaName:Bt.string,tinymceScriptSrc:Bt.string,rollback:Bt.oneOfType([Bt.number,Bt.oneOf([!1])]),scriptLoading:Bt.shape({async:Bt.bool,defer:Bt.bool,delay:Bt.number})},bh),Eh=e=>"function"==typeof e,wh=e=>e in bh,Ch=e=>e.substr(2),Sh=(e,t,n,r,l)=>((e,t,n,r,l,i,a)=>{const o=Object.keys(l).filter(wh),s=Object.keys(i).filter(wh),c=o.filter((e=>void 0===i[e])),d=s.filter((e=>void 0===l[e]));c.forEach((e=>{const t=Ch(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const l=r(e,n),i=Ch(n);a[i]=l,t(i,l)}))})(l,e.on.bind(e),e.off.bind(e),((t,n)=>r=>{var l;return null===(l=t(n))||void 0===l?void 0:l(r,e)}),t,n,r);let Nh=0;const Th=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return Nh++,e+"_"+n+Nh+String(t)},Ih=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Rh=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Oh=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},kh=()=>({listeners:[],scriptId:Th("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Lh=(()=>{let e=kh();return{load:(t,n,r,l,i,a)=>{const o=()=>((e,t,n,r,l,i)=>{const a=t.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=e,a.src=n,a.async=r,a.defer=l;const o=()=>{a.removeEventListener("load",o),i()};a.addEventListener("load",o),t.head&&t.head.appendChild(a)})(e.scriptId,t,n,r,l,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?a():(e.listeners.push(a),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=kh()}}})(),Ah=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Ph extends e.Component{constructor(t){var n,r,l;super(t),this.rollbackTimer=void 0,this.valueCursor=void 0,this.rollbackChange=()=>{const e=this.editor,t=this.props.value;e&&t&&t!==this.currentContent&&e.undoManager.ignore((()=>{if(e.setContent(t),this.valueCursor&&(!this.inline||e.hasFocus()))try{e.selection.moveToBookmark(this.valueCursor)}catch(e){}})),this.rollbackTimer=void 0},this.handleBeforeInput=e=>{if(void 0!==this.props.value&&this.props.value===this.currentContent&&this.editor&&(!this.inline||this.editor.hasFocus()))try{this.valueCursor=this.editor.selection.getBookmark(3)}catch(e){}},this.handleBeforeInputSpecial=e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)},this.handleEditorChange=e=>{const t=this.editor;if(t&&t.initialized){const e=t.getContent();void 0!==this.props.value&&this.props.value!==e&&!1!==this.props.rollback&&(this.rollbackTimer||(this.rollbackTimer=window.setTimeout(this.rollbackChange,"number"==typeof this.props.rollback?this.props.rollback:200))),e!==this.currentContent&&(this.currentContent=e,"function"==typeof this.props.onEditorChange&&this.props.onEditorChange(e,t))}},this.handleEditorChangeSpecial=e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)},this.initialise=(e=0)=>{var t,n,r;const l=this.elementRef.current;if(!l)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,n=e.parentNode;for(;null!=n;)t=n,n=t.parentNode;return t===e.ownerDocument}return e.isConnected})(l)){if(0===e)setTimeout((()=>this.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>this.initialise(e+1)),100)}return}const i=Ah(this.view);if(!i)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},this.props.init),{selector:void 0,target:l,readonly:this.props.disabled,inline:this.inline,plugins:(o=null===(t=this.props.init)||void 0===t?void 0:t.plugins,s=this.props.plugins,Rh(o).concat(Rh(s))),toolbar:null!==(n=this.props.toolbar)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!Ih(l)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&Eh(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{var t,n;const r=this.getInitialValue();this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:e.getContent(),this.currentContent!==r&&(this.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const l=null!==(n=this.props.disabled)&&void 0!==n&&n;Oh(this.editor,l?"readonly":"design"),this.props.init&&Eh(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(l.style.visibility=""),Ih(l)&&(l.value=this.getInitialValue()),i.init(a)},this.id=this.props.id||Th("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(l=null!==(n=this.props.inline)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.inline)&&void 0!==l&&l,this.boundHandlers={}}get view(){var e,t;return null!==(t=null===(e=this.elementRef.current)||void 0===e?void 0:e.ownerDocument.defaultView)&&void 0!==t?t:window}componentDidUpdate(e){var t,n;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const n=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const r of[t,n])if(r)try{e.selection.moveToBookmark(r),this.valueCursor=r;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=null!==(n=this.props.disabled)&&void 0!==n&&n;Oh(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,l,i;null!==Ah(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Lh.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),null!==(t=null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)&&void 0!==t&&t,null!==(r=null===(n=this.props.scriptLoading)||void 0===n?void 0:n.defer)&&void 0!==r&&r,null!==(i=null===(l=this.props.scriptLoading)||void 0===l?void 0:l.delay)&&void 0!==i?i:0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){var e,t,n;return(null===(n=null===(t=null===(e=Ah(this.view))||void 0===e?void 0:e.Env)||void 0===t?void 0:t.browser)||void 0===n?void 0:n.isIE())?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Sh(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,n=t(e),r=t(this.props);!n&&r?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):n&&!r&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}var Fh;Ph.propTypes=xh,Ph.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Fh||(Fh={}));const _h=e=>{var n;const{className:r,style:l,tinymce:i={},upload:a={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:p}=t.useContext(on),{$size:h}=$n(e),{$locale:f,t:g}=Mn(),v=400,y="preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",b="file edit view insert format tools table help",x="undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",E=Object.assign(Object.assign({height:i.height||v,plugins:i.plugins||y,toolbar:i.toolbar||x,menubar:i.menubar||b,font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:Fh[f],skin:"tinymce-5"},Xn(i,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>{const{action:t,headers:n,dataKey:r,customHandler:l}=a;return l?l(e):new Promise(((l,i)=>Dn(void 0,void 0,void 0,(function*(){const a=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(t&&c/1024/1024>o)try{const e=yield fetch(t,{method:"POST",body:s,headers:n});if(!e.ok)throw i(""),new Error(g("qm.upload.uploadError"));const a=yield e.json();if(200===a.code){const e=r?ue(a.data,r):a.data;l(e)}}catch(e){R.error(g("qm.uploadCropper.uploadError"))}else l(a)}))))},setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),w=ir("tinymce"),C={[w]:!0,[`${w}--lg`]:"large"===h,[`${w}--sm`]:"small"===h},S={init:E,value:d,disabled:c,tinymceScriptSrc:s||(null===(n=null==p?void 0:p.tinymce)||void 0===n?void 0:n.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==m||m(t.getContent(),t)}};return t.createElement("div",{className:Pe(C,r),style:l},t.createElement(Ph,S))};_h.displayName="QmTinymce";const Dh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:p}=a;return t.createElement(_h,{value:r,tinymce:u,upload:o,thresholdSize:m,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{null==l||l(e),i(e)})(e)}})};class Mh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Zn(s)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Dh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(_,{flex:Zn(d.labelWidth||Va)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Mh.contextType=Hi;class Hh extends d{constructor(e){var n;super(e),this.provide={$$form:this,echo_data:{}},this._fieldAuth={},this.wrapperRef=t.createRef(),this.formRef=t.createRef(),this.originItems=[],this.state={formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:null!==(n=this.props.cols)&&void 0!==n?n:4,collapse:!!this.props.defaultExpand},this.resizeObserveHandler=()=>{var e;const t=null===(e=this.wrapperRef.current)||void 0===e?void 0:e.offsetWidth;if(void 0===t||0===t||this.props.cols>0)return;let n=Math.floor(t/300);n=24%n==0?n:n-1,n=n<1?1:n,n=n>8?8:n,n!==this.state.flexCols&&this.setState({flexCols:n})},this.resizeListenerHandle=Le(this.resizeObserveHandler,10),this.getFormItems=Wt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=Wt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{ae(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t})),this.valuesChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onValuesChange)||void 0===r||r.call(n,e,this._initialValues)},this.fieldsChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onFieldsChange)||void 0===r||r.call(n,e,t)},this.finishHandle=e=>{var t,n;null===(n=(t=this.props).onFinish)||void 0===n||n.call(t,Object.assign({},this.get_fields_other(),this.formatFormValue(e)))},this.finishFailedHandle=({values:e,errorFields:t})=>{var n,r;null===(r=(n=this.props).onFinishFailed)||void 0===r||r.call(n,t)},this.openValidateInfo=e=>{const n=t.createElement("ul",null,e.map((e=>{const{label:n}=this.formItems.find((t=>t.fieldName===e.name[0]));return t.createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof n?`${n}: `:"")+e.errors.join(","),"]")})));Z.error({message:un("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Vt(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})},this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){var e,t;return null!==(t=null!==(e=this.props.size)&&void 0!==e?e:this.context.size)&&void 0!==t?t:""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){var e;const t=this.context.global;return null!==(e=this.props.compactMode)&&void 0!==e?e:"small"===this.$size&&!!(null==t?void 0:t.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){ai(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){oi(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&tr("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(e=[]){return e.some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>ae(e.extra))).forEach((n=>{var r;t[n.fieldName]=null!==(r=e[n.fieldName])&&void 0!==r?r:""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>ae(e.collapse))).forEach((t=>{var n;e[t.fieldName]=null!==(n=t.collapse.defaultExpand)&&void 0!==n&&n})),Object.assign({},e)}getInitialValue(e,t){var n;const{type:r,options:l}=e;return t=null!=t?t:void 0,Ua.includes(r)&&(t=null!=t?t:[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=null!==(n=null!=t?t:null==l?void 0:l.falseValue)&&void 0!==n?n:Wa),t}createFormValue(e){const t={};return this.flattenItems.forEach((n=>{t[n.fieldName]=this.getInitialValue(n,e[n.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}createOriginItems(){this.originItems=Qn(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.viewData,{[e]:t})})))}getViewValue(e){var t;return null!==(t=this.state.viewData[e])&&void 0!==t?t:""}setExpandHandle(e){e!==this.state.collapse&&this.setState({collapse:e},(()=>{var t,n;return null===(n=(t=this.props).onCollapse)||void 0===n?void 0:n.call(t,e)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:n}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!n||setTimeout((()=>this.CREATE_FOCUS(n)))}getFormItemLabel(e){var t,n,r,l,i;if(co(e))return uo(e);if(ae(e)){const{fieldName:a,label:o,options:s={}}=e;if(co(o))return uo(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([a])[a])&&void 0!==n?n:this._initialValues[a])&&void 0!==r?r:null===(l=c[0])||void 0===l?void 0:l.value;return(null===(i=c.find((e=>e.value===d)))||void 0===i?void 0:i.text)||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){var n,r;if("DIVIDER"===e)return!0;const l=this.getBlockDerivedItems();for(let e=0,i=l.length;e<i;e++){const i=l[e],a=this.dividers.find((e=>e.fieldName===i[0].fieldName)),o=null!==(r=null===(n=null==a?void 0:a.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:i.length-1;for(let e=1;e<i.length;e++){if(i[e].fieldName===t&&e>o)return this.state.expand[i[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const l=e[r];if(no(l)&&(e[r]=""),Array.isArray(l)&&l.forEach(((t,n)=>{no(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(l)){const[i,a]=r.split("|");e[i]=null!==(t=l[0])&&void 0!==t?t:"",e[a]=null!==(n=l[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)Gn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return Dn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let l=Xn(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:i}=r.fetch;try{const r=yield t(n);200===r.code&&(l=null!==(e=i?ue(r.data,i):r.data)&&void 0!==e?e:{})}catch(e){}}if(Array.isArray(l.fieldList)){const e=this.props.items.map((e=>{const{fieldName:t}=e,n=l.fieldList.find((e=>e.dataIndex===t));if(n){const r=this.originItems.find((e=>e.fieldName===t)),{visible:l=1,disabled:i,secretName:a}=n;l||(e.noAuth=!0,r.noAuth=!0),i&&(e.disabled=!0,r.disabled=!0),a&&(e.options?e.options.secretType=a:e.options={secretType:a},r.options=Object.assign({},r.options,{secretType:a})),this.setFieldAuth(t,{visible:l,disabled:i,secretName:a})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(Fo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(Do,{option:e})}INPUT_NUMBER(e){return t.createElement(Ho,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(qo,{option:e})}SEARCH_HELPER(e){return t.createElement(sp,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(up,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(yp,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(xp,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(Tp,{option:e})}CHECKBOX(e){return t.createElement(Lo,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Rp,{option:e})}RATE(e){return t.createElement(kp,{option:e})}RADIO(e){return t.createElement(Ap,{option:e})}SWITCH(e){return t.createElement(Fp,{option:e})}TEXT_AREA(e){return t.createElement(Dp,{option:e})}DATE(e){return t.createElement(Hp,{option:e})}RANGE_DATE(e){return t.createElement(Kp,{option:e})}TIME(e){return t.createElement(Vp,{option:e})}RANGE_TIME(e){return t.createElement(Wp,{option:e})}SELECT(e){return t.createElement(Oo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(Oo,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Up,{option:e})}DIVIDER(e){return t.createElement(Gp,{option:e})}TREE_SELECT(e){return t.createElement(Qp,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(Qp,{option:e,multiple:!0})}CASCADER(e){return t.createElement(Jp,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(Jp,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(sh,{option:e})}REGION_SELECT(e){return t.createElement(uh,{option:e})}UPLOAD_FILE(e){return t.createElement(ph,{option:e})}UPLOAD_IMG(e){return t.createElement(yh,{option:e})}TINYMCE(e){return t.createElement(Mh,{option:e})}renderFormLabel(e){if(co(e)||!ae(e))return e;const{type:n,fieldName:r,label:l,options:i={},onChange:a=Vn}=e,{itemList:o=[]}=i;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(Ro,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{style:{paddingRight:5}},l),t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(ko,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:l={},render:i}=e,{extra:a}=this.state;if(r)return t.createElement(w,{className:"extra-tooltip",title:a[n]},t.createElement(At,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:i?"":a[n],style:l},t.createElement("span",{className:"extra-overflow-cut"},i?i(o,this):a[n]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:n,fieldName:r,invisible:l,tooltip:i,className:a,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return t.createElement(P.Item,{label:this.renderFormLabel(n),name:r,rules:c,tooltip:i,hidden:l,className:Pe(a),style:Object.assign({width:"100%"},d),labelCol:{flex:this.verticalLayout?"initial":Zn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):t.createElement(t.Fragment,null))}createFormItem(e){return se(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(tr("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:l}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<n;e++)i.push({})}));const a=24/e,o=[],s=i.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=i.map(((n,r)=>{let{selfCol:l=1}=n;const{type:i,fieldName:s}=n;l=l>=24||"DIVIDER"===i||"TINYMCE"===i?e:l;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[r]),t.createElement(_,{key:null!=s?s:r,className:s,span:l*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},i?this.createFormItem(Qn(n)):null)}));return l&&"default"===n&&u.push(t.createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:n,collapse:r}=this.state,{searchButtonCols:l,isSearchBtn:i,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=l||1,c=n-e%n-s;return i?t.createElement(_,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(S,{style:{marginBottom:12}},t.createElement(nr,{type:"primary",size:this.$size,icon:t.createElement(Nt,null),onClick:()=>this.SUBMIT_FORM()},un("qm.form.search")),t.createElement(nr,{size:this.$size,icon:t.createElement(Ge,null),onClick:()=>this.RESET_FORM()},un("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Fe,null):t.createElement(_e,null)," ",un(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:n,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const l=24/e;return r&&"default"===n?t.createElement(F,{gutter:0},t.createElement(_,{key:"-",span:l},t.createElement(P.Item,null,t.createElement(S,{style:{marginBottom:12}},t.createElement(nr,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},un("qm.form.save")),t.createElement(nr,{size:this.$size,onClick:()=>this.RESET_FORM()},un("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(Ao,{uniqueKey:e,items:n,fieldsChange:r})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise(((e,t)=>Dn(this,void 0,void 0,(function*(){const[n,r]=yield this.VALIDATE_FIELDS(),l=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>{var t;return null===(t=this[`${e.fieldName}_Ref`])||void 0===t?void 0:t.searchRef._is_change})).map((e=>({name:[e.fieldName],errors:[un("qm.form.searchHelperTips")],warnings:[]})));n||l.length?t((n||[]).concat(l)):e(r)}))))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}GET_FORM_DATA(){return Dn(this,void 0,void 0,(function*(){try{const e=yield this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}))}VALIDATE_FIELDS(e){return Dn(this,void 0,void 0,(function*(){try{return[null,yield this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}))}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}SUBMIT_FORM(){return Dn(this,void 0,void 0,(function*(){try{yield this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}))}RESET_FORM(){var e,t;const n=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),r=this.flattenItems.map((e=>e.fieldName)).filter((e=>!n.includes(e)));r.length&&this.formRef.current.resetFields(r),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),l={};return r.forEach((e=>l[e]=void 0)),{other:Object.assign({},this._initialOthers,l)}})),this.setState({extra:Object.assign({},this._initialExtras)}),null===(t=(e=this.props).onReset)||void 0===t||t.call(e)}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){tr("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:l}=this.props,i=r.find((t=>t.fieldName===e));if(!i)return tr("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!ae(t))return tr("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return tr("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||me(i,n,t[n]));n&&(l?l([...r]):tr("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:l,labelWidth:i,labelAlign:a,labelWrap:o,customClass:s}=this.props,c=ir("form"),d={required:"${label}"+un("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t.createElement("div",{ref:this.wrapperRef,className:Pe(u,e),style:n},t.createElement(P,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:a,labelWrap:o,colon:!1,disabled:l,labelCol:{flex:this.verticalLayout?"initial":Zn(i)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Hi.Provider,{value:this.provide},t.createElement(F,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Hh.contextType=on,Hh.propTypes=Za,Hh.defaultProps=Ja;const $h=e=>null!=e;function qh(e,n,r,l){const[i,a]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[o,s]=t.useState(null),c=()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:l,bottom:i,left:a}=e.getBoundingClientRect();return r>=0&&a>=0&&l<=t&&i<=n})(i)&&n&&i.scrollIntoView(l);const{left:e,top:t,width:r,height:a}=i.getBoundingClientRect(),o={left:e,top:t,width:r,height:a,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[i,n]),ms({handler:c});return[t.useMemo((()=>{if(!o)return o;const e=(null==r?void 0:r.offset)||6,t=(null==r?void 0:r.radius)||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,r]),i]}const Kh={fill:"transparent",pointerEvents:"auto"},jh=e=>{const{prefixCls:n,rootClassName:r,pos:l,showMask:i,style:a={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${ts()}`,m="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(tn,{open:s,autoLock:!0},t.createElement("div",{className:Pe(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},a)},i?t.createElement("svg",{style:{width:"100%",height:"100%"}},t.createElement("defs",null,t.createElement("mask",{id:u},t.createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),l&&t.createElement("rect",{x:l.left,y:l.top,rx:l.radius,width:l.width,height:l.height,fill:"black",className:m?`${n}-placeholder-animated`:""}))),t.createElement("rect",Rn({},l?null:Kh,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),l&&t.createElement(t.Fragment,null,t.createElement("rect",Rn({},Kh,{x:"0",y:"0",width:"100%",height:`${l.top}px`})),t.createElement("rect",Rn({},Kh,{x:"0",y:"0",width:l.left,height:"100%"})),t.createElement("rect",Rn({},Kh,{x:"0",y:l.top+l.height,width:"100%",height:`calc(100vh - ${l.top+l.height}px)`})),t.createElement("rect",Rn({},Kh,{x:l.left+l.width,y:"0",width:`calc(100vw - ${l.left+l.width}px)`,height:"100%"})))):null))},Vh=e=>{const{prefixCls:n,zIndex:r,open:l,onPause:i,onPlay:a}=e,[o,s]=os(void 0,{value:l,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=Hn((e=>{m(e),e.shiftKey&&32===e.keyCode&&p()}));t.useEffect((()=>{const e=jt(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{d.current?d.current=!1:(s(!o),o?null==i||i():null==a||a())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,l=window.innerWidth,i=window.innerHeight,a=e.clientX-Bl(t).x,o=e.clientY-Bl(t).y;return document.onmousemove=e=>{let s=e.clientX-a,c=e.clientY-o;s<0&&(s=0),s>l-n-1&&(s=l-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),Vl(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>p()},o?t.createElement(Pt,null):t.createElement(yt,null))},zh=e=>{const{prefixCls:n,current:r,total:l=0,cover:i,title:a,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:p,onFinish:h,className:f,indicatorsRender:g}=e,{t:v}=Mn(),y="primary"!==c?"primary":"default",b=Hn((e=>{C(e),40===e.keyCode&&(r<l-1?null==p||p():null==h||h()),38===e.keyCode&&r>0&&(null==m||m())}));t.useEffect((()=>{const e=jt(document,"keyup",b);return()=>e.remove()}),[]);const x=$h(i)?t.createElement("div",{className:`${n}-cover`},i):null,E=$h(o)?t.createElement("div",{className:`${n}-description`},o):null;let w;w=g?g(r,l):[...Array.from({length:l}).keys()].map(((e,l)=>t.createElement("span",{key:e,className:Pe(l===r&&`${n}-indicator-active`,`${n}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:Pe(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(lt,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(V,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(Ft,{className:Pe(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},a)),E,t.createElement("div",{className:`${n}-footer`},l>1&&t.createElement("div",{className:`${n}-indicators`},w),t.createElement(lr,{className:`${n}-buttons`},0!==r?t.createElement(nr,{className:`${n}-prev-btn`,size:"small",onMouseDown:C,onClick:m},v("qm.tour.prevStep")):null,r===l-1?t.createElement(nr,{className:`${n}-finish-btn`,type:y,size:"small",onClick:h},v("qm.tour.finish")):t.createElement(nr,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:p},v("qm.tour.nextStep"))))))},Wh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(zh,e))},Bh={left:"50%",top:"50%",width:1,height:1},Uh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:l,current:i,onChange:a,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:p=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0}=e,S=Fn(e,["steps","defaultCurrent","current","onChange","onClose","onFinish","open","type","mask","arrow","control","overlayClassName","overlayStyle","placement","helper","zIndex","renderPanel","indicatorsRender","gap","animated","scrollIntoViewOptions"]),N=t.useRef(),[T,I]=os(0,{value:i,defaultValue:l}),[R,O]=os(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=os(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),F=t.useRef(R);t.useLayoutEffect((()=>{R&&!F.current&&I(0),F.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:_,type:D,placement:M,trigger:H,delay:$,style:q,arrow:K,className:j,mask:V,scrollIntoViewOptions:z,zIndex:W,action:B}=r[T]||{},U=W||k,G=D||d,Y=R&&(null!=V?V:u),X=null!=z?z:C,[Q,Z]=qh(_,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Z,g,M),ee=!!Z&&(void 0===K?m:K),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),Hl((()=>{R&&(le(),null==B||B(Z,T))}),[R,Z]);const ne=e=>{I(e),null==a||a(e)},re=()=>{O(!1),null==o||o(T)},le=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===jl(r=n,"display")||"hidden"===jl(r,"visibility")||"0"===jl(r,"opacity"))||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const ie=()=>Dn(void 0,void 0,void 0,(function*(){if(!H||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[l,i]=[e+n/2,t+r/2],a=new MouseEvent(H,{bubbles:!0,cancelable:!0,button:0,clientX:l,clientY:i}),o=document.elementFromPoint(l,i);o&&(o.dispatchEvent(a),yield Wn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=ir("tour"),de=[{[`${ce}-primary`]:"primary"===G},h,j],ue=Xd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(jh,{zIndex:U,prefixCls:ce,pos:Q,showMask:ae,style:null==oe?void 0:oe.style,fill:null==oe?void 0:oe.color,open:A,animated:w,rootClassName:h}),t.createElement(tn,{open:A,autoLock:!0},t.createElement(Zt,Rn({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:Pe(de),prefixCls:ce,popup:()=>t.createElement(Wh,Rn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>Dn(void 0,void 0,void 0,(function*(){yield ie(),ne(T-1)})),onNext:()=>Dn(void 0,void 0,void 0,(function*(){yield ie(),ne(T+1)})),onClose:re,current:T,onFinish:()=>{re(),null==s||s()}},Object.assign({},r[T],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),t.createElement("div",{className:Pe(h,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Q||Bh),{position:"fixed",pointerEvents:"none"})}))),p&&t.createElement(tn,{open:R},t.createElement(Vh,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));Uh.displayName="QmTour";var Gh={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Yh=n(void 0);var Xh=null;function Qh(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),n=e.match(/MSIE\D?\d+/i),r=e.match(/OPR\D?\d+/i),l=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(l){if((l=l[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var a=e.match(/Chrome\D?\d+/i);if(a&&(a=a[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Zh(e,t){var n;try{var r=navigator.userAgent,l=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(Qh()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void R.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else{l&&r.match(/x64/i);if(e||t?n=l?e:t:Xh?n=Xh:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),l?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Xh=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&Qh(),n}catch(e){R.error("getLodop 出错:"+e)}}Qh();const Jh=e=>{const t=e/25.4*(()=>{var e;const t=[],{deviceXDPI:n,deviceYDPI:r}=window.screen;if(n&&r)t[0]=n,t[1]=r;else{let n=document.createElement("DIV");n.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(n),t[0]=parseInt(n.offsetWidth.toString()),t[1]=parseInt(n.offsetHeight.toString()),null===(e=n.parentNode)||void 0===e||e.removeChild(n),n=null}return t})()[0];return Math.ceil(t)},ef=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:l}=e,{global:i}=t.useContext(on),{$$preview:a}=t.useContext(Yh),{state:o,isWindowsPrinter:s,pageSize:c}=a,d=t.useRef(null),u=t.useRef({}),m=t.useRef([]),p=t.useRef([]),h=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:L,createPrintHtml:k,SHOW_PREVIEW:A,DIRECT_PRINT:P}))),Hl((()=>{R()}),[o.form.printerType,o.form.setting.direction,o.form.setting.distance,o.form.setting.fixedLogo]),t.useEffect((()=>{u.current.templateEl=d.current.querySelector(".origin-template").children[0],u.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Gh.defaultDistance+10*Gh.defaultDistance:0;return("vertical"===e?c[0]:c[1])-t}),[o,s,c]),y=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Gh.defaultDistance+10*Gh.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Jh(v-10*(e.left-Gh.defaultDistance)-10*(e.right-Gh.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Jh(y-10*(e.top-Gh.defaultDistance)-10*(e.bottom-Gh.defaultDistance))}),[o,y]),E=o.form.scale,w=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:Jh(10*e.left),right:Jh(10*e.right),top:Jh(10*e.top),bottom:Jh(10*e.bottom)}}),[o]),C=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:l}=w,i=b+t+n,a=Gh.previewWidth-i<=0?0:(Gh.previewWidth-i)/2,s=Math.abs((1-E)*i/2);let c=0;return E>1&&(c=s>a?-1*a:-1*s),E<1&&(c=i-2*s>Gh.previewWidth?0:a>0?s:(Gh.previewWidth-(i-2*s))/2),{width:`${b}px`,height:""+("stylus"===e?"auto":x+"px"),paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${l}px`,transform:`translateX(${c}px) scale(${E})`,opacity:f?0:1}}),[o,f,w,E,x,b]);m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const S=()=>{var e,t,n,r;const l=null!==(t=null===(e=null==i?void 0:i.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",a=null!==(r=null===(n=null==i?void 0:i.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Gh.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',l?`<img src="${l}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',a?`<img src="${a}" border="0" height="46" />`:"","</td>","</tr>"].join("")},N=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},T=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=u.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},I=()=>{const e=u.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const l=e[r].clientHeight;e[r].style.height=l+"px",n.push(l),t.push(e[r].outerHTML)}p.current=n,m.current=t},R=()=>{var e;if(!m.current.length)return;const{form:{setting:t,printerType:n}}=o;if(l)return h.current.push([N(),S(),...m.current]);const r=t.fixedLogo?x-Gh.logoHeight:x;let i=[];if(h.current=[],"stylus"===n)h.current.push([N(),...t.fixedLogo?[S()]:[],...m.current]);else{let e=0;for(let n=0,l=p.current.length;n<l;n++){const a=m.current[n],o=p.current[n];t.fixedLogo||0!==n||(e+=Gh.logoHeight),e+=o,e<=r?i.push(a):(h.current.push([N(),...t.fixedLogo?[S()]:[],...i]),i=[],e=0,n-=1),n===l-1&&i.length&&h.current.push([N(),...t.fixedLogo?[S()]:[],...i])}}t.fixedLogo||null===(e=h.current[0])||void 0===e||e.splice(1,0,S());for(let e=0,t=h.current.length;e<t&&e!==t-1;e++)h.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:h.current.length}),O()},O=()=>{var e,t;const{currentPage:n}=o;let r=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;r+=null!==(t=null===(e=h.current[n-1])||void 0===e?void 0:e.join(""))&&void 0!==t?t:"",r+="</table>",u.current.previewEl.innerHTML=r,u.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;if(void 0!==e){t+=[...h.current[e-1]].join("")}else for(let e=0;e<h.current.length;e++)t+=h.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+S()+N()+e.join("")+"</table>"},A=()=>Dn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return F();u.current.previewEl.innerHTML||(T(),yield Wn(0),I(),R(),g(!1))})),P=()=>Dn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return F();T(),yield Wn(0),I(),R(),g(!1),a.doPrint(k()),yield Wn(0),a.doClose()})),F=()=>{tr("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[ir("print-container")]:!0,"no-visible":l};return t.createElement("div",{ref:d,className:Pe(_)},t.createElement(ni,{wrapperClassName:"spin",spinning:f,tip:"Loading..."},t.createElement("div",{className:"preview"},t.createElement("div",{className:"origin-template",style:{width:`${b}px`,marginLeft:`-${Math.floor(b/2)}px`}},null==r?void 0:r()),t.createElement("div",{className:"workspace",style:C}))))}));ef.displayName="Container";class tf extends d{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:un("qm.print.setPanel.printParameter")},{type:"SELECT",label:un("qm.print.setPanel.pagerType"),fieldName:"pageSize",options:{itemList:[{text:"A2",value:"420*594"},{text:"A3",value:"420*297"},{text:"A4",value:"210*297"},{text:"A5",value:"210*148"},{text:un("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:un("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:un("qm.print.setPanel.vertical"),value:"vertical"},{text:un("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:un("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:un("qm.print.setPanel.manualDoublePrint"),value:"manual"}]},disabled:!this.props.setting.doubleSide},options:{trueValue:1,falseValue:0},onChange:e=>{const{formList:t}=this.state;t.find((e=>"doubleSide"===e.fieldName)).label.disabled=!e,this.setState({formList:t})}},{type:"CHECKBOX",label:un("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:un("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Gh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Gh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Gh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Gh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]}],this.getInitialvalue=()=>{const{setting:e}=this.props,{distance:t}=e;return Object.assign({},{disleft:t.left,disright:t.right,distop:t.top,disbottom:t.bottom,pageSize:e.pageSize,direction:e.direction,doubleSide:e.doubleSide,doubleSideType:e.doubleSideType,fixedLogo:e.fixedLogo})},this.getInitialExtra=()=>({disleft:un("qm.print.setPanel.sizeUnit"),disright:un("qm.print.setPanel.sizeUnit"),distop:un("qm.print.setPanel.sizeUnit"),disbottom:un("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>Dn(this,void 0,void 0,(function*(){const[e,t]=yield this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),this.cancelHandle=()=>{this.props.onClose()}}render(){const{formList:e}=this.state;return t.createElement(t.Fragment,null,t.createElement(Hh,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(nr,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},un("qm.dialog.close")),t.createElement(nr,{type:"primary",onClick:()=>this.confirmHandle()},un("qm.dialog.confirm"))))}}tf.contextType=on;class nf extends d{constructor(){var e,n,r;super(...arguments),this.provide={$$preview:this},this.containRef=t.createRef(),this.state={visible:!1,form:{printerName:-1,printerType:(null===(e=this.props.defaultConfig)||void 0===e?void 0:e.printerType)||"laser",copies:(null===(n=this.props.defaultConfig)||void 0===n?void 0:n.copies)||1,scale:1,setting:{distance:{left:Gh.defaultDistance,right:Gh.defaultDistance,top:Gh.defaultDistance,bottom:Gh.defaultDistance},pageSize:"210*297",direction:(null===(r=this.props.defaultConfig)||void 0===r?void 0:r.direction)||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0},this.pageChangeHandle=e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))},this.exportClickHandle=()=>{this.doExport(this.containRef.current.createExportHtml())},this.printClickHandle=()=>Dn(this,void 0,void 0,(function*(){if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e=Object.assign(Object.assign({},this.state.form),{printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text});yield Qt.setItem(this.printerKey,e),yield this.savePrintConfig(this.printerKey,e)}catch(e){}})),this.doClose=()=>{var e,t;null===(t=(e=this.props).onClose)||void 0===t||t.call(e)},this.getPrintConfig=e=>Dn(this,void 0,void 0,(function*(){const t=this.context.global,n=null==t?void 0:t.getComponentConfigApi;if(n)try{const t=yield n({key:e});if(200===t.code)return t.data}catch(e){}})),this.savePrintConfig=(e,t)=>Dn(this,void 0,void 0,(function*(){const n=this.context.global,r=null==n?void 0:n.saveComponentConfigApi;if(r)try{yield r({[e]:t})}catch(e){}})),this.createStyle=()=>'\n <style type="text/css">\n table {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n table-layout: fixed;\n }\n table tr td {\n padding: 2px;\n line-height: 1.2;\n word-wrap: break-word;\n }\n .fs12 {\n font-size: 12px;\n }\n .fs13 {\n font-size: 13px;\n }\n .fs14 {\n font-size: 14px;\n }\n .fw500 {\n font-weight: 500;\n }\n .fw700 {\n font-weight: 700;\n }\n .fl {\n float: left;\n }\n .fr {\n float: right;\n }\n .tc {\n text-align: center;\n }\n .tr {\n text-align: right;\n }\n .bor {\n border: 1px solid #000;\n }\n .bor-t {\n border-top: 1px solid #000;\n }\n .bor-b {\n border-bottom: 1px solid #000;\n }\n .bor-l {\n border-left: 1px solid #000;\n }\n .bor-r {\n border-right: 1px solid #000;\n }\n .no-bor {\n border: none !important;\n }\n </style>\n ',this.doPrint=e=>{const t=Zh();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:l,printerName:i,printerType:a,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Gh,{left:d,right:u,top:m,bottom:p}=l.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),l.doubleSide&&("auto"===l.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===a&&("vertical"===l.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===l.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===a&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*p*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==a?10*(p-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(un("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=Zh();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:l}}=this.state;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(un("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===l.direction?1:2),t.SAVE_TO_FILE(`${p().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:un("qm.print.laserPrinter"),value:"laser"},{text:un("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Zh(),t=[{text:un("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let r=0;r<n;r++)t.push({text:e.GET_PRINTER_NAME(r),value:r})}catch(e){tr("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}componentDidMount(){var e,t;return Dn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Qt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),ae(n)&&(yield Qt.setItem(this.printerKey,n))),ae(n)&&Object.keys(n).length&&Ie(this.state.form,Object.assign(Object.assign({},n),{printerName:null!==(t=null===(e=this.printerItems.find((e=>e.text===n.printerName)))||void 0===e?void 0:e.value)&&void 0!==t?t:-1}))}catch(e){}}))}render(){const{preview:e,templateRender:n}=this.props,{visible:r,form:l,currentPage:i,totalPage:a,printPage:o}=this.state,s=ir("print-preview"),c={visible:r,title:un("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:Pe(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,un("qm.print.printer"),":",t.createElement(D,{value:l.printerName,onChange:e=>{this.setState((t=>Ie({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,un("qm.print.type"),":",t.createElement(D,{value:l.printerType,onChange:e=>{this.setState((t=>Ie({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(D.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,un("qm.print.copies"),":",t.createElement($,{value:l.copies,min:1,precision:0,onChange:e=>{this.setState((t=>Ie({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,un("qm.print.printPage.0"),t.createElement($,{value:o,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),un("qm.print.printPage.1")),t.createElement("span",null,t.createElement(B,{size:"small",current:i,pageSize:1,total:a,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(nr,{type:"text",icon:t.createElement(Qe,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},un("qm.print.setting"))),t.createElement("span",null,t.createElement(nr,{type:"text",icon:t.createElement(Ke,null),className:"text-btn",onClick:()=>this.exportClickHandle()},un("qm.print.export"))),t.createElement("span",null,t.createElement(nr,{icon:t.createElement(Ye,null),type:"primary",onClick:this.printClickHandle},un("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Yh.Provider,{value:this.provide},t.createElement(ef,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,un("qm.print.scale"),":",t.createElement(J,{value:l.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>Ie({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*l.scale)}%`)),t.createElement("span",null,un("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,un("qm.print.pageNumber"),":",un("qm.print.pagination",{currentPage:i,totalPage:a}))))),t.createElement(Mi,c,t.createElement(tf,{setting:l.setting,onChange:e=>{this.setState((t=>Ie({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Yh.Provider,{value:this.provide},t.createElement(ef,{ref:this.containRef,templateRender:n,directPrint:!0}))}}nf.contextType=on;class rf extends d{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>Dn(this,void 0,void 0,(function*(){var e,t;this.setState({loading:!0});try{const n=yield null===(t=(e=this.props).click)||void 0===t?void 0:t.call(e);if(this.setState({loading:!1}),"boolean"==typeof n&&!n)return;yield this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),this.createRender=()=>{const{visible:e}=this.state,{templateRender:n,uniqueKey:r,defaultConfig:l,preview:i,closeAfterPrint:a}=this.props,o={visible:e,title:un("qm.print.preview"),width:`${Gh.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:l,preview:i,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return i?t.createElement(Mi,o,t.createElement(nf,s)):e?t.createElement(nf,s):null},this.DO_PRINT=()=>Dn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield Wn(0),this.setState({visible:!0}),yield Wn(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:n,icon:r,type:l,disabled:i,shape:a}=this.props,o={size:n||this.context.size||"",type:l,shape:a,icon:r,loading:e,disabled:i,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(nr,o,this.props.children),this.createRender())}}function lf(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function af(e){const t=lf(e);return t?t.frameElement:null}function of(e){const t=df(e);return sf([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function sf(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function cf(e,t){const n=af(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let l=n,i=!1;for(;l;){const e=of(l);if(r.push(e),l=af(l),i)break;l&&lf(l)===t&&(i=!0)}return sf(r)}return e.getBoundingClientRect()}function df(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}rf.propTypes={size:(e,t,n)=>{if(!ja(e[t]||""))return er("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Ut.elementType},rf.defaultProps={preview:!0,type:"primary",icon:t.createElement(Ye,null)},rf.contextType=on;const uf=Object.assign;class mf{constructor(e,t){this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=gf.border,this.padding.style.borderColor=gf.padding,this.content.style.backgroundColor=gf.background,uf(this.node.style,{borderColor:gf.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){ff(t,"margin",this.node),ff(t,"border",this.border),ff(t,"padding",this.padding),uf(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),uf(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class pf{constructor(e,t){this.tip=e.createElement("div"),uf(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),uf(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),uf(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,n){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(n)+"px"}updatePosition(e,t){const n=this.tip.getBoundingClientRect(),r=function(e,t,n){const r=Math.max(n.height,20),l=Math.max(n.width,60),i=5;let a;a=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+i:e.top+e.height+i:e.top-r<=t.top+t.height?e.top-r-i<t.top+i?t.top+i:e.top-r-i:t.top+t.height-r-i;let o=e.left+i;e.left<t.left&&(o=t.left+i);e.left+l>t.left+t.width&&(o=t.left+t.width-l-i);return a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:n.width,height:n.height});uf(this.tip.style,r.style)}}class hf{constructor(){const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const n=e.document;this.container=n.createElement("div"),this.container.style.zIndex="10000000",this.tip=new pf(n,this.container),this.rects=[],n.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const n=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>n.length;){const e=this.rects.pop();null==e||e.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new mf(this.window.document,this.container));const r={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};n.forEach(((e,t)=>{const n=cf(e,this.window),l=df(e);r.top=Math.min(r.top,n.top-l.marginTop),r.right=Math.max(r.right,n.left+n.width+l.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+l.marginBottom),r.left=Math.min(r.left,n.left-l.marginLeft);this.rects[t].update(n,l)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const l=cf(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:r.top,left:r.left,height:r.bottom-r.top,width:r.right-r.left},{top:l.top+this.tipBoundsWindow.scrollY,left:l.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function ff(e,t,n){uf(n.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const gf={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let vf=null,yf=null;function bf(){null!=window.document&&(vf=null,null!==yf&&(yf.remove(),yf=null))}class xf{constructor(e){this._lastHoveredNode=null,this.iframesListeningTo=new Set,this.onClick=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onMouseEvent=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onPointerDown=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))},this.onPointerMove=e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Gl(t,window.document.querySelector(e)))))return this._selectIgnore=!0,bf();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var n,r,l;n=[t],r=null,l=!1,null!=window.document?(null!==vf&&clearTimeout(vf),null!=n&&(null===yf&&(yf=new hf),yf.inspect(n,r),l&&(vf=setTimeout((()=>bf()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=Ae((e=>{var t;this._selectIgnore||null===(t=this.onSelect)||void 0===t||t.call(this,e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let n=e;const r=[];for(;n!==t&&null!==n;){let e=n.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,r=Array.from(n.classList).reverse();e<r.length;e++)t.test(r[e])&&n.classList.remove(r[e]);if(n.id&&/^rc-\w+/.test(n.id)&&n.removeAttribute("id"),n.id)e+=`#${n.id}`;else{const t=Array.from(n.parentElement.children).filter((e=>e.tagName===n.tagName)),r=n.className.trim();if(t.filter((e=>e.className.includes(r))).length<=1){if(r){const t=r.split(/\s+/);let n="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(n+=`.${t[e]}`);e+=n}}else n.getAttribute("name")?e+=`[name=${n.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(n)+1})`}n.nodeType!==Node.TEXT_NODE&&r.unshift(e),n=n.parentElement}return r.join(" > ")}(e))}),200,{leading:!1}),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){bf(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function Ef(e){return document.querySelector(e)}const wf=e=>{const{action:n,onConfirm:r,onCancel:l,onFinish:i}=e,{t:a}=Mn();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(lr,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(nr,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.closeButton")),t.createElement(nr,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(nr,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.finishButton"))))},Cf={left:"50%",top:"50%",width:1,height:1},Sf=t.forwardRef(((e,n)=>{const{open:r,current:l,defaultCurrent:i,steps:a=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:p,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=Mn(),E=t.useRef(),w=t.useRef(a.length),[S,N]=os(0,{value:l,defaultValue:i}),[T,I]=os(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=os(1051,{value:p,defaultValue:p}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[F,_]=t.useState(T),[D,M]=t.useState(!1),[$,q]=qh(k.node,!!r),[K,j]=t.useState(22),z=t.useRef(!1),W=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),B=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new xf({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:Na(),node:e,path:t}),N(w.current),P(!0),G(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?U():G(),T?setTimeout((()=>_(!0)),16):_(!1),()=>{G()})),[T]),t.useEffect((()=>{w.current=a.length}),[a]);const U=()=>{E.current.startHandle()},G=()=>{E.current.stopHandle()},Y=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const X=ir("guide-tracker"),Q=[{[`${X}-primary`]:!0}],Z=Xd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(tn,{open:T&&A,autoLock:!0},t.createElement(Zt,{zIndex:R,builtinPlacements:Z,popupPlacement:o,popupVisible:T&&A,popupClassName:Pe(Q,c),popupStyle:d,prefixCls:X,popup:()=>{const e=()=>{P(!1),U()};return t.createElement("div",{className:`${X}-content`},t.createElement("div",{className:`${X}-inner`},t.createElement(lt,{className:`${X}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(H,{open:D,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Gt,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),n=a.map((e=>e.id));if(he(t,n))return;const r=t.findIndex((e=>e===k.id)),l=-1!==r?r:S;N(l),null==v||v(Ma(e),l)}},a.map(((e,n)=>t.createElement("li",{key:n,className:Pe("item",{actived:e.id===k.id})},t.createElement(Be,{className:"handle",title:x("qm.form.draggable")}),t.createElement("span",{className:"box"},t.createElement("span",{className:"title",title:e.title,onClick:()=>{n!==S&&(L({id:e.id,node:Ef(e.selector),path:e.selector}),N(n),j(22===K?K+1:K-1),null==v||v(a,n))}},e.title),t.createElement(C,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=a.filter((t=>t.id!==e.id)),r=n===S;let l=n<=S?S-1:S;if(l=l<0?0:l,l=l>t.length?t.length:l,r&&t[l]){const{id:e,selector:n}=t[l];L({id:e,node:Ef(n),path:n})}N(l),null==v||v(t,l)}},t.createElement(lt,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${X}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>M(e)},t.createElement(_t,{className:Pe(`${X}-close`,"menu-icon"),style:{width:K}})),h.content&&t.createElement(V,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:h.content,title:h.title},t.createElement(Ft,{className:Pe(`${X}-close`,"help-icon")})),t.createElement("div",{className:"panel-label"},t.createElement("span",{className:"title"},x("qm.guideTracker.label")),t.createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),B)),m?m({id:k.id,selector:k.path,actionStatus:W,DO_CLOSE:e},S):t.createElement(wf,{action:W,onConfirm:()=>{null==v||v("add"===W?[...a,{id:k.id,selector:k.path,title:"Guide Title"}]:[...a],S),e()},onCancel:()=>{null==y||y(S),e()},onFinish:()=>{e(),null==y||y(S),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:Pe(`${X}-target-placeholder`),style:Object.assign(Object.assign({},$||Cf),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:Y,onClick:Y}))),s&&t.createElement(tn,{open:F},t.createElement(Vh,{zIndex:R,prefixCls:X,onPause:()=>{z.current=A,P(!1),G()},onPlay:()=>{z.current?P(!0):U()}})))}));Sf.displayName="QmGuideTracker";const Nf=n=>{var r,l,i,a,o,s,c,d;const{content:u,image:m,width:p,height:h,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:w,className:C,style:S}=n,N=t.useRef(null),T=t.useRef(new Map),I=null!==(r=f.fontSize)&&void 0!==r?r:16,R=null!==(l=f.fontWeight)&&void 0!==l?l:"normal",O=null!==(i=f.fontStyle)&&void 0!==i?i:"normal",k=null!==(a=f.fontFamily)&&void 0!==a?a:"sans-serif",L=null!==(o=f.color)&&void 0!==o?o:"rgba(0, 0, 0, 0.15)",A=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],F=g[0],_=g[1],D=F/2,M=_/2,H=null!==(c=v[0])&&void 0!==c?c:D,$=null!==(d=v[1])&&void 0!==d?d:M,q=t.useMemo((()=>{const e=H-D,t=$-M;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:b}}),[D,M,H,$,b]),K=(e,t)=>{var n;if(N.current){const r=T.current.get(N.current);r&&(N.current.contains(r)&&N.current.removeChild(r),T.current.delete(N.current));const l=document.createElement("div");l.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=N.current)||void 0===n||n.append(l),T.current.set(N.current,l)}},j=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const n=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[r,l]=(e=>{let t=120,n=64;if(!m&&e.measureText){e.font=`${I}px ${k}`;const r=P.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),n=I*P.length+3*(P.length-1)}return[null!=p?p:t,null!=h?h:n]})(t),i=r*n,a=l*n,o=(F+r)*n,s=(_+l)*n,c=F/2*n,d=_/2*n,u=o/2,f=s/2,g=2*(F+r);e.width=2*o,e.height=2*s,t.globalAlpha=x,t.save(),t.translate(u,f),t.rotate(Math.PI/180*y),t.translate(-u,-f);const v=()=>{t.restore(),t.drawImage(e,0,0,o,s,o,s,o,s),w&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),K(e.toDataURL(),g)},b=()=>{const e=Number(I)*n;t.font=`${O} normal ${R} ${e}px/${l}px ${k}`,t.fillStyle=L,t.textAlign=A,t.textBaseline="top",t.translate(i/2,0),P.forEach(((r,l)=>{t.fillText(null!=r?r:"",c,d+l*(e+3*n))})),v()};if(m){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,i,a),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=m}else b()},V=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{j()}),[u,m,p,h,f,g,v,y,b,x,E,w]),function(t,n,r={}){const l=window&&"MutationObserver"in window,i=e.useRef(),a=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useLayoutEffect((()=>(a(),l&&t.current&&(i.current=new MutationObserver(n),i.current.observe(t.current,r)),()=>a())),[t])}(N,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>V(e))),n="attributes"===t.type&&V(t.target);if(e||n){j();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=ir("watermark");return t.createElement("div",{ref:N,className:Pe(z,C),style:Object.assign({position:"relative"},S)},n.children)},Tf=new Map,If=new WeakMap;let Rf,Of=0;function kf(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(If.has(n)||(Of+=1,If.set(n,Of.toString())),If.get(n)):"0"):e[t]}`;var n})).toString()}function Lf(e,t,n={},r=Rf){if(void 0===window.IntersectionObserver&&void 0!==r){const l=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:l,observer:i,elements:a}=function(e){const t=kf(e);let n=Tf.get(t);if(!n){const r=new Map;let l=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{var n;const i=t.isIntersecting&&l.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=i),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(i,t)}))}))}),e);l=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Tf.set(t,n)}return n}(n),o=a.get(e)||[];return a.has(e)||a.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(a.delete(e),i.unobserve(e)),0===a.size&&(i.disconnect(),Tf.delete(l))}}const Af=e=>{const{forceRender:n,height:r,placeholder:l=null,unmountIfInvisible:i,className:a,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:l,fallbackInView:i,trackVisibility:a,skip:o,delay:s,onChange:c}={})=>{var d;const[u,m]=t.useState(null),[p,h]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(o||!u)return;let t;return t=Lf(u,((e,n)=>{var r;h({inView:e,entry:n}),null===(r=f.current)||void 0===r||r.call(f,e,n),n.isIntersecting&&l&&t&&(t(),t=void 0)}),{root:e,rootMargin:n,threshold:r,trackVisibility:a,delay:s},i),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,l,o,a,i,s]);const g=null===(d=p.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||l||o||v.current===g||(v.current=g,h({inView:!1,entry:void 0}));const y=[m,p.inView,p.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!i}));t.useEffect((()=>{r||tr("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[ir("lazy-load")]:!0};return t.createElement("div",{ref:s,className:Pe(u,a),style:o},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},l))};class Pf{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Ff{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Ff(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,l=e.y-t.y,i=t.x-n.x,a=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+l*l),m=Math.sqrt(i*i+a*a),p=m/(u+m),h=c+(o-c)*p,f=d+(s-d)*p,g=t.x-h,v=t.y-f;return{c1:new Pf(o+g,s+v),c2:new Pf(c+g,d+v)}}constructor(e,t,n,r,l,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=l,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const l=r/10,i=this.point(l,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(l,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=i-e,l=a-t;n+=Math.sqrt(r*r+l*l)}e=i,t=a}return n}point(e,t,n,r,l){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+l*e*e*e}}class _f{constructor(e,t){this.width=320,this.height=200,this.ratio=Math.max(window.devicePixelRatio||1,1),this.penColor="rgba(0,0,0,1)",this.backgroundColor="rgba(0,0,0,0)",this.canAddHistory=!1,this.openSmooth=!0,this.dotSize=0,this.throttle=16,this.minDistance=5,this.velocityFilterWeight=.7,this.compositeOperation="source-over",this.minWidth=.5,this.maxWidth=2.5,this.fontSize=16,this.eraserSize=20,this.lineHeight=1.25,this.degreeOfBlur=5,this.textInputPos={x:0,y:0},this.onStart=()=>{},this.onEnd=()=>{},this._drawingStroke=!1,this._lastPoints=[],this._data=[],this._historyList=[],this._lastVelocity=0,this._lastWidth=0,this.setCanvasSize=()=>{this.canvas.style.height=`${this.height}px`,this.canvas.style.width=`${this.width}px`,this.canvas.height=this.height*this.ratio,this.canvas.width=this.width*this.ratio,1!==this.ratio&&this.ctx.scale(this.ratio,this.ratio)},this.setTextInput=()=>{this.openSmooth||(this.textInput.setAttribute("class","signature__text-input"),this.textInput.setAttribute("contentEditable","true"),this.textInput.setAttribute("spellCheck","false"),this.canvas.parentNode.appendChild(this.textInput))},this.isTouchEvent=e=>"touches"in e,this.addListener=()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",("ontouchstart"in window||navigator.maxTouchPoints)&&(this.canvas.addEventListener("touchstart",this.onDrawStart,{passive:!1}),this.canvas.addEventListener("touchmove",this.onDrawMove,{passive:!1}),document.addEventListener("touchcancel",this.onDrawEnd,{passive:!1}),document.addEventListener("touchend",this.onDrawEnd,{passive:!1})),this.canvas.addEventListener("mousedown",this.onDrawStart),this.canvas.addEventListener("mousemove",this.onDrawMove),document.addEventListener("mouseup",this.onDrawEnd),this.textInput.addEventListener("blur",this.onInputBlur)},this.removeListener=()=>{this.canvas.style.touchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("touchstart",this.onDrawStart),this.canvas.removeEventListener("touchmove",this.onDrawMove),document.removeEventListener("touchend",this.onDrawEnd),document.removeEventListener("touchcancel",this.onDrawEnd),this.canvas.removeEventListener("mousedown",this.onDrawStart),this.canvas.removeEventListener("mousemove",this.onDrawMove),document.removeEventListener("mouseup",this.onDrawEnd),this.textInput.removeEventListener("blur",this.onInputBlur)},this._isLeftButtonPressed=(e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:1==(1&e.buttons),this._pointerEventToSignatureEvent=e=>{var t,n;return{event:e,type:e.type,x:this.isTouchEvent(e)?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX,y:this.isTouchEvent(e)?null===(n=e.touches[0])||void 0===n?void 0:n.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}},this._getPointGroupOptions=e=>({penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}),this._strokeBegin=e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n=Object.assign(Object.assign({},t),{points:[]});this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)},this._strokeUpdate=(e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const n=this._createPoint(e.x,e.y,e.pressure),r=this._data[this._data.length-1],l=r.points,i=l.length>0&&l[l.length-1],a=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!a){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),l.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}},this._strokeEnd=(e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)},this._reset=e=>{this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this.ctx.fillStyle=e.penColor,this.ctx.globalCompositeOperation=e.compositeOperation},this._drawDot=(e,t)=>{const n=this.ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()},this._drawCurve=(e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,l=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<l;n+=1){const i=n/l,a=i*i,o=a*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*a*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*i*e.control1.y,m+=3*s*a*e.control2.y,m+=o*e.endPoint.y;const p=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()},this._drawCurveSegment=(e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)},this._createPoint=(e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new Pf(e-r.left,t-r.top,n,(new Date).getTime())},this._createPointByEvent=e=>this._createPoint(e.x,e.y,e.pressure),this._addPoint=(e,t)=>{const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=Ff.fromPoints(n,e);return n.shift(),r}return null},this._strokeWidth=(e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth),this._calculateCurveWidths=(e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,l=this._strokeWidth(r,n),i={end:l,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=l,i},this.onDrawStart=e=>{var t;e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),null===(t=this.onStart)||void 0===t||t.call(this,e))},this.onDrawMove=e=>{e.preventDefault(),"text"!==this.mode&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?window.requestAnimationFrame?window.requestAnimationFrame((()=>this.drawHandler(e))):this.drawHandler(e):this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.onDrawEnd=e=>{var t;this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),null===(t=this.onEnd)||void 0===t||t.call(this,e))},this.onInputBlur=e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()},this.drawHandler=e=>{switch(this.mode){case"line":this.drawLine(e);break;case"square":this.drawSquare(e);break;case"round":this.drawRound(e);break;case"arrow":this.drawArrow(e);break;case"mosaic":this.drawMosaic(e);break;case"text":this.drawText(e);break;case"eraser":this.drawEraser(e)}this.canAddHistory=!0},this.drawSquare=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,l-n),this.ctx.stroke(),this.ctx.restore()},this.drawRound=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),a=Math.min(l,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(l,n)-a),c=i+o,d=a+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},this.drawArrow=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-l,t-r)/Math.PI,a=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(a),c=15*Math.sin(a),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,l),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,l);const m=r+s,p=l+c;this.ctx.lineTo(m,p);const h=r+d,f=l+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,l),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,l=e.data,i=[];return i[0]=l[4*(n*r+t)],i[1]=l[4*(n*r+t)+1],i[2]=l[4*(n*r+t)+2],i[3]=l[4*(n*r+t)+3],i},this.setAxisColor=(e,t,n,r)=>{const l=e.width,i=e.data;i[4*(n*l+t)]=r[0],i[4*(n*l+t)+1]=r[1],i[4*(n*l+t)+2]=r[2],i[4*(n*l+t)+3]=r[3]},this.drawMosaic=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),r=this.ctx.getImageData(t*this.ratio,n*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),l=r.width,i=r.height,a=l/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<a;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let l=0;l<this.degreeOfBlur;l++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+l,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)},this.drawText=e=>{const{x:t,y:n}=this.textInputPos;if(0===t&&0===n)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const r=this.fontSize*this.lineHeight,l=this.width-t,i=e.target.innerText,a=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>l&&o.length>0?(a.push(o),o=i[e]):o=t}a.push(o),a.forEach(((e,l)=>{this.ctx.fillText(e,t+1,n+l*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}},this.createPencil=e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)},this.drawPencil=e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()},this.createEraser=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)},this.drawEraser=e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"},this.drawLine=e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)},this.createTextInput=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=n?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())},this.setInputStyle=()=>{if(!this._lastPoints.length)return;const{x:e,y:t}=this._lastPoints[0];this.textInput.style.left=e+"px",this.textInput.style.lineHeight=this.lineHeight.toString(),this.textInput.style.fontSize=this.fontSize+"px",this.textInput.style.color=this.penColor,this.textInput.style.top=t-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:e,y:t}},this.drawBgColor=()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))},this.clearWorkSpace=()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},this.addHistory=()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))},this.getLastHistory=()=>this._historyList[this._historyList.length-1],this.setLastHistory=()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()},this.clear=()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())},this.undo=()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()},this.setDrawMode=e=>{this.mode=e},this.setLineWidth=e=>{this.maxWidth=e},this.setPenColor=e=>{this.penColor=e},this.setFontSize=e=>{this.fontSize=e},this.isEmpty=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,1!==this.ratio&&t.scale(this.ratio,this.ratio),this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)),e.toDataURL()===this.canvas.toDataURL()},this.toDataURL=(e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");n.width=this.width,n.height=this.height;return n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)},this.getPNG=()=>this.toDataURL(),this.getJPG=(e=.8)=>this.toDataURL("image/jpeg",e),this.initial(e,t)}initial(e,t={}){e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this.backgroundColor=this.openSmooth&&t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,l,i=0,a=null;const o=()=>{i=Date.now(),a=null,n=e.apply(r,l),a||(r=null,l=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,l=s,d<=0||d>t?(a&&(clearTimeout(a),a=null),i=c,n=e.apply(r,l),a||(r=null,l=[])):a||(a=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}_f.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),l=r.length,i=new Uint8Array(l);for(let e=0;e<l;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})},_f.canvasToDataURL=e=>e.toDataURL("image/png",1),_f.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const Df=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})),Mf=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M839.111111 269.198222V122.908444A9.159111 9.159111 0 0 0 829.980444 113.777778H208.213333A9.159111 9.159111 0 0 0 199.111111 122.908444v146.289778c0 5.034667 4.124444 9.159111 9.130667 9.159111h64a9.159111 9.159111 0 0 0 9.159111-9.159111V196.067556h192v640h-105.159111a9.159111 9.159111 0 0 0-9.130667 9.130666v64c0 5.034667 4.124444 9.159111 9.130667 9.159111h301.738666a9.159111 9.159111 0 0 0 9.130667-9.159111v-64a9.159111 9.159111 0 0 0-9.130667-9.130666h-105.159111v-640h192v73.130666c0 5.034667 4.124444 9.159111 9.159111 9.159111h64a9.159111 9.159111 0 0 0 9.130667-9.159111z"})),Hf=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M887.65217391 606.59279489a31.26857185 31.26857185 0 0 1-31.26857185-31.26857087v-363.48819946L158.38608696 909.83354065a31.26857185 31.26857185 0 1 1-44.21962762-44.21962761l697.99751609-698.06906805h-363.48819945a31.26857185 31.26857185 0 0 1 0-62.46559075h439.04795087c17.17267109 0 31.26857185 13.95279489 31.26857086 31.19701891v439.04795087a31.26857185 31.26857185 0 0 1-31.3401238 31.26857087z"})),$f=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M606.4 103.424a64 64 0 0 1 0.704 0.64l320.256 280.32a64 64 0 0 1 7.104 89.024l-330.432 398.72 320.448 0.128a32 32 0 0 1 0 64.064H397.632a32.128 32.128 0 0 1-6.208-0.64h-20.736a64 64 0 0 1-42.304-16.064l-238.08-210.112A64 64 0 0 1 83.84 620.16l432.32-509.312a64 64 0 0 1 90.24-7.36zM242.048 537.536l-87.04 101.76a32 32 0 0 0 3.584 45.248l213.12 180.672a32 32 0 0 0 20.736 7.616l-0.64-0.064a32.192 32.192 0 0 1 5.76-0.512h102.016a32 32 0 0 0 18.176-10.496l40.96-47.232-316.672-276.992zM592.96 177.28a32 32 0 0 0-45.12 3.456L283.712 488.96l316.928 277.248 264.512-304.96a32 32 0 0 0 1.024-40.704l-3.904-4.16-268.928-238.72a32 32 0 0 0-0.384-0.32z"})),qf=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.createElement("path",{d:"M607.75537778 291.05948444H223.6416l115.34336-115.41617778a36.37248 36.37248 0 1 0-51.48216889-51.44576L132.61937778 279.04455111c-13.54410667 13.50769778-21.04433778 31.67573333-21.11715556 50.97244444a71.72551111 71.72551111 0 0 0 21.11715556 51.51857778l154.88341333 154.91982222a36.29966222 36.29966222 0 0 0 51.48216889 0 36.37248 36.37248 0 0 0 0-51.48216889l-121.46005333-121.16878222H607.75537778c130.70791111 0 237.02186667 106.16832 237.02186667 236.65777777s-106.31395555 236.65777778-237.02186667 236.65777778h-254.13404445a36.40888889 36.40888889 0 0 0 0 72.81777779h254.13404445c170.83050667 0 309.83964445-138.82709333 309.83964444-309.47555557 0-170.64846222-139.00913778-309.47555555-309.83964444-309.47555555"})),Kf=t.forwardRef(((e,n)=>{const{open:r,width:l,height:i,imageName:a,penColor:o,penMode:s,minWidth:c,maxWidth:d,backgroundColor:u,className:m,style:h,onOk:f,onCancel:g}=e,{t:v}=Mn(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=os(void 0,{value:r,postState:e=>null!=e&&e}),I=t.useMemo((()=>!!e.children),[e.children]),[R,O]=t.useState(s||(I?"square":"line")),[k,L]=t.useState(w[0]),[A,P]=t.useState(I?S[0]:S[4]),[F,_]=t.useState(C[1]),[M,$]=t.useState("bottomLeft"),[q,K]=t.useState(!1),[j,V]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=l?l:null===(e=x.current)||void 0===e?void 0:e.offsetWidth,height:null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetHeight,maxWidth:k,mode:R,penColor:A,fontSize:F,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new _f(b.current,n),()=>y.current.destroy()}),[]);const z=e=>{var t,n;const[r,a]=[null!=l?l:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=i?i:null===(n=x.current)||void 0===n?void 0:n.offsetHeight],{width:o,height:s}=y.current;let c=!1;r&&r!==o&&(y.current.width=r,c=!0),a&&a!==s&&(y.current.height=a,c=!0),(c||e)&&y.current.update()};Hl((()=>{I&&N&&z()}),[N,I]),Hl((()=>{y.current.setDrawMode(R)}),[R]),Hl((()=>{y.current.setLineWidth(k)}),[k]),Hl((()=>{y.current.setPenColor(A)}),[A]),Hl((()=>{y.current.setFontSize(F)}),[F]);const W=()=>Dn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield an(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return _f.canvasToDataURL(t)}catch(e){tr("Signature","生成合成图片失败!")}})),B=()=>{y.current.clear(),null==g||g()};t.useImperativeHandle(n,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>y.current.clear(),UNDO:()=>y.current.undo(),IS_EMPTY:()=>y.current.isEmpty(),UPDATE:z,GET_DATE_URL:W})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},G=e=>t.createElement("div",{className:Pe("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},w.map((e=>t.createElement("span",{key:e,className:Pe("dot",`s${e}`,{active:e===k}),onClick:()=>L(e)})))):t.createElement("div",{className:"fontSize"},t.createElement(D,{size:"small",value:F,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},S.map((e=>t.createElement("span",{key:e,className:Pe("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>P(e)},t.createElement($e,{className:"icon"})))))),Y=ir("signature"),X={[Y]:!0,"is-annotation":I},Q=l?Object.assign(Object.assign({},h),{width:l}):h;return t.createElement("div",{className:Pe(X,m),style:Q},I&&t.createElement(t.Fragment,null,t.createElement("div",{ref:x,className:"content"},e.children),j&&t.createElement(ni,{spinning:!0,className:"spinning"})),t.createElement("div",{className:Pe("signature",{show:N})},t.createElement("canvas",{ref:b,className:R}),I&&t.createElement("div",{ref:E,className:"signature__tool-bar"},t.createElement("div",{className:"wrapper"},t.createElement("div",{className:Pe("actions",{hidden:q})},t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(Dt,null))),t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(Df,null))),t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(Hf,null))),t.createElement(H,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement(He,null))),t.createElement(H,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(Mf,null))),t.createElement("button",{className:"btn",onClick:()=>Dn(void 0,void 0,void 0,(function*(){yield Dn(void 0,void 0,void 0,(function*(){V(!0);const e=yield W();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):p().format(Xo);wi(_f.dataURLToBlob(e),`${t}.png`)}V(!1)})),B()}))},t.createElement(Ke,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement($f,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(qf,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(Tt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(lt,null)),t.createElement("button",{className:"btn",onClick:()=>Dn(void 0,void 0,void 0,(function*(){V(!0),yield Wn(10);const e=yield W();V(!1),B(),null==f||f(e)}))},t.createElement($e,null))),t.createElement("button",{className:"btn btn-fold",title:v(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>K(!q)},q?t.createElement(ot,null):t.createElement(st,null))))))}));Kf.displayName="QmSignature";const jf="1.12.1";export{Tn as Calendar,In as DatePicker,Li as DcpAnchor,nr as DcpButton,Dl as DcpCollapse,Qd as DcpColorPicker,Pn as DcpConfigProvider,Gm as DcpCopyToClipboard,ei as DcpCountup,hh as DcpCropper,ar as DcpDivider,Ii as DcpDownload,Fi as DcpDrawer,ti as DcpEmpty,Hh as DcpForm,Sf as DcpGuideTracker,Af as DcpLazyLoad,Mi as DcpModal,Du as DcpPivotGrid,rf as DcpPrint,Cp as DcpRangeTableHelper,Ei as DcpScrollbar,ip as DcpSearchHelper,mm as DcpSearchTree,Kf as DcpSignature,lr as DcpSpace,ni as DcpSpin,Jl as DcpSplit,lp as DcpTable,Pi as DcpTabs,_h as DcpTinymce,Uh as DcpTour,gi as DcpTransition,jm as DcpTreeHelper,fp as DcpTreeTableHelper,Ti as DcpUploadFile,gh as DcpUploadImg,Yu as DcpVirtualList,Nf as DcpWatermark,Li as QmAnchor,nr as QmButton,Dl as QmCollapse,Qd as QmColorPicker,Pn as QmConfigProvider,Gm as QmCopyToClipboard,ei as QmCountup,hh as QmCropper,ar as QmDivider,Ii as QmDownload,Fi as QmDrawer,ti as QmEmpty,Hh as QmForm,Sf as QmGuideTracker,Af as QmLazyLoad,Mi as QmModal,Du as QmPivotGrid,rf as QmPrint,Cp as QmRangeTableHelper,Ei as QmScrollbar,ip as QmSearchHelper,mm as QmSearchTree,Kf as QmSignature,lr as QmSpace,ni as QmSpin,Jl as QmSplit,lp as QmTable,Pi as QmTabs,_h as QmTinymce,Uh as QmTour,gi as QmTransition,jm as QmTreeHelper,fp as QmTreeTableHelper,Ti as QmUploadFile,gh as QmUploadImg,Yu as QmVirtualList,Nf as QmWatermark,On as TimePicker,So as pinyin,jf as version};