@jiaozhiye/qm-design-react 1.9.26 → 1.9.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{createContext as n,Component as r,version as i,isValidElement as o,useRef as l,useLayoutEffect as a,useEffect as s,createRef as c,forwardRef as d,useImperativeHandle as u,useState as p,useCallback as h}from"react";import*as m from"prop-types";import f from"prop-types";import g from"dayjs";import"dayjs/locale/zh-cn";import v from"dayjs/plugin/localeData";import y from"dayjs/plugin/advancedFormat";import b from"dayjs/plugin/customParseFormat";import x from"dayjs/plugin/quarterOfYear";import E from"dayjs/plugin/weekOfYear";import S from"dayjs/plugin/weekday";import{ConfigProvider as w,Button as C,Popconfirm as T,Space as N,Empty as I,Spin as R,Upload as O,message as k,Tabs as A,Drawer as L,Modal as P,Input as _,Form as H,Row as D,Col as F,Select as $,Checkbox as M,Dropdown as q,InputNumber as j,Rate as V,Radio as K,Switch as z,Tag as W,TreeSelect as B,Cascader as U,notification as G,Tooltip as Y,Image as X,Tree as Z,Menu as Q,Popover as J,Pagination as ee,Slider as te}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 ne from"dayjs/plugin/weekYear";import re from"antd/es/calendar/generateCalendar";import"antd/es/calendar/style";import ie from"antd/es/date-picker/generatePicker";import"antd/es/date-picker/style/index";import oe from"antd/es/locale/zh_CN";import le from"antd/es/locale/en_GB";import{isArray as ae,isPlainObject as se,isNumber as ce,isFunction as de,isString as ue,throttle as pe,isUndefined as he,get as me,transform as fe,isEqual as ge,set as ve,xor as ye,isRegExp as be,merge as xe,uniqBy as Ee,intersection as Se,debounce as we,map as Ce,groupBy as Te,flatten as Ne,spread as Ie,mergeWith as Re,isDate as Oe,omitBy as ke,sumBy as Ae,maxBy as Le,minBy as Pe,union as _e,pickBy as He}from"lodash-es";import De from"classnames";import{UpOutlined as Fe,DownOutlined as $e,UploadOutlined as Me,DownloadOutlined as qe,FullscreenExitOutlined as je,FullscreenOutlined as Ve,HolderOutlined as Ke,UnorderedListOutlined as ze,SearchOutlined as We,CheckOutlined as Be,CloseOutlined as Ue,ExclamationCircleOutlined as Ge,ReloadOutlined as Ye,ZoomInOutlined as Xe,ZoomOutOutlined as Ze,RotateRightOutlined as Qe,RotateLeftOutlined as Je,InboxOutlined as et,InfoCircleFilled as tt,PrinterOutlined as nt,ImportOutlined as rt,SettingOutlined as it,CopyOutlined as ot,CheckSquareOutlined as lt,CloseCircleOutlined as at,MonitorOutlined as st,PlusOutlined as ct,PieChartOutlined as dt,FunnelPlotOutlined as ut,AppstoreAddOutlined as pt,StepBackwardOutlined as ht,StepForwardOutlined as mt,InfoCircleOutlined as ft,ClearOutlined as gt,PauseOutlined as vt,CaretRightOutlined as yt,QuestionCircleOutlined as bt,MenuOutlined as xt,BorderOutlined as Et,EditOutlined as St,RightOutlined as wt,LeftOutlined as Ct}from"@ant-design/icons";import Tt from"react-countup";import Nt from"resize-observer-polyfill";import It from"add-dom-event-listener";import Rt from"scroll-into-view-if-needed";import Ot from"react-draggable";import kt from"memoize-one";import At from"cropperjs";import Lt from"big.js";import Pt from"react-dom";import _t from"copy-to-clipboard";import Ht from"@rc-component/portal";import Dt from"@rc-component/trigger";import Ft from"html2canvas";import{ReactSortable as $t}from"react-sortablejs";import Mt from"localforage";import qt from"exceljs";import jt from"china-area-data";const Vt=n({locale:"zh-cn",size:"middle"});var Kt={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},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:"删除文件"},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},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},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:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};let zt=Kt;function Wt(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const Bt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const[r,i]=t;let o;const l=r.split(".");let a=zt;for(let e=0,t=l.length;e<t;e++){if(o=a[l[e]],e===t-1)return Wt(o,i);if(!o)return"";a=o}return""},Ut=e=>{zt=e||zt,zt.name&&g.locale(zt.name)};class Gt extends Error{constructor(e){super(e),this.name="QmDesignError"}}function Yt(e,t){throw new Gt(`[${e}] ${t}`)}function Xt(e,t){console.warn(new Gt(`[${e}] ${t}`))}const Zt=e=>"number"==typeof e||void 0===e||(["px","rem","em","vw","vh","%"].some((t=>e.endsWith(t)))||e.startsWith("calc")),Qt=e=>["","small","middle","large"].includes(e);g.extend(v),g.extend(y),g.extend(b),g.extend(x),g.extend(E),g.extend(S);var Jt={},en=[];function tn(e,t){if(!e&&void 0!==console){var n=en.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function nn(e,t){if(!e&&void 0!==console){var n=en.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function rn(e,t,n){t||Jt[n]||(e(!1,n),Jt[n]=!0)}function on(e,t){rn(tn,e,t)}function ln(e,t){rn(nn,e,t)}on.preMessage=function(e){en.push(e)},on.resetWarned=function(){Jt={}},on.noteOnce=ln,g.extend(b),g.extend(y),g.extend(S),g.extend(v),g.extend(E),g.extend(ne),g.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 an={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"},sn=function(e){return an[e]||e.split("_")[0]},cn=function(){ln(!1,"Not match any format. Please help to fire a issue about this.")},dn={getNow:function(){return g()},getFixedDate:function(e){return g(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 g().locale(sn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(sn(e)).weekday(0)},getWeek:function(e,t){return t.locale(sn(e)).week()},getShortWeekDays:function(e){return g().locale(sn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return g().locale(sn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(sn(e)).format(n)},parse:function(e,t,n){for(var r=sn(e),i=0;i<n.length;i+=1){var o=n[i],l=t;if(o.includes("wo")||o.includes("Wo")){for(var a=l.split("-")[0],s=l.split("-")[1],c=g(a,"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 cn(),null}var p=g(l,o).locale(r);if(p.isValid())return p}return t&&cn(),null}}};const un=re(dn),pn=ie(dn);function hn(){return hn=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},hn.apply(this,arguments)}const mn=e.forwardRef(((t,n)=>e.createElement(pn,hn({},t,{picker:"time",mode:void 0,ref:n}))));mn.displayName="TimePicker";const fn=e.forwardRef(((t,n)=>e.createElement(pn.RangePicker,hn({},t,{picker:"time",mode:void 0,ref:n}))));fn.displayName="RangePicker",mn.RangePicker=fn;var gn={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},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"},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:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},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",likeText:"fuzzy matching",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?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}};const vn={[gn.name]:{qm:gn,antd:le},[Kt.name]:{qm:Kt,antd:oe}};class yn extends r{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},Ut(Object.assign({},vn,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:n,size:r}=t.value,{locale:i,size:o,global:l}=e;return i!==n&&Ut(Object.assign({},vn,l.langPackage)[i].qm),i!==n||o!==r?{value:Object.assign({},t.value,{locale:i,size:o})}:null}render(){const{global:e}=this.props,{value:n}=this.state,r=Object.assign({},vn,e.langPackage);return t.createElement(Vt.Provider,{value:n},t.createElement(w,{locale:r[n.locale].antd,componentSize:n.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}function bn(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 xn(e,t,n,r){var i,o=arguments.length,l=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(l=(o<3?i(l):o>3?i(t,n,l):i(t,n))||l);return o>3&&l&&Object.defineProperty(t,n,l),l}function En(e,t,n,r){return new(n||(n=Promise))((function(i,o){function l(e){try{s(r.next(e))}catch(e){o(e)}}function a(e){try{s(r.throw(e))}catch(e){o(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(l,a)}s((r=r.apply(e,t||[])).next())}))}yn.propTypes={locale:f.string,size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Divider","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},theme:f.string,global:f.object},yn.defaultProps={locale:"zh-cn",size:"middle",global:{}};var Sn="undefined"==typeof window;const wn=e=>t.isValidElement(e),Cn=e=>wn(e)&&e.type===t.Fragment,Tn=()=>{},Nn=()=>!0,In=e=>En(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Rn=e=>{Promise.resolve().then(e)},On=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),kn=e=>!!(!e&&0!==e||ae(e)&&!e.length||se(e)&&!Object.keys(e).length),An=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Ln=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(se(e)||ae(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,o)=>{i&&(o=n),r[o]=Ln(e[o],t)})),r}return e},Pn=e=>ce(e)?`${e}px`:e.toString();class _n extends r{constructor(){super(...arguments),this.state={isLoading:!1},this.clickHandle=e=>En(this,void 0,void 0,(function*(){var t,n;this.setState({isLoading:!0});try{yield null===(n=(t=this.props).click)||void 0===n?void 0:n.call(t,e)}catch(e){Xt("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:n,authConfig:r,click:i,confirm:o}=this.props,{isLoading:l}=this.state,a=e||this.context.size||"",s=de(i)?{onClick:this.clickHandle}:null,c=Object.assign(Object.assign(Object.assign({},An(this.props,["authConfig","click","confirm"])),{size:a,loading:l||n||!1}),s);if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(c.disabled=!0)}return o?t.createElement(T,{title:o.title||Bt("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{var t,n;null===(t=o.onConfirm)||void 0===t||t.call(o),null===(n=c.onClick)||void 0===n||n.call(c,e)},onCancel:e=>{var t;null===(t=o.onCancel)||void 0===t||t.call(o,e)}},t.createElement(C,hn({},c,{onClick:Tn}),this.props.children)):t.createElement(C,c,this.props.children)}}var Hn;_n.propTypes={click:f.func,confirm:f.shape({title:f.node,onConfirm:f.func,onCancel:f.func})},_n.contextType=Vt,function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(Hn||(Hn={}));class Dn extends r{render(){const{size:e}=this.props,n=e||this.context.size||"",r=ce(e)?e:Hn[e||n||"default"],i=Object.assign(Object.assign({},this.props),{size:r});return t.createElement(N,i,this.props.children)}}Dn.contextType=Vt;const Fn=e=>`qm-${e}`;class $n extends r{constructor(){super(...arguments),this.clickHandle=()=>{const{collapse:e,onCollapseChange:t=Tn}=this.props;t(!e)}}render(){const{size:e,label:n,extra:r,collapse:i,bordered:o,disabled:l,id:a,className:s,style:c}=this.props,d=e||this.context.size||"",u=Fn("divider"),p={[u]:!0,[`${u}-borderless`]:!o,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return t.createElement("div",{id:a,className:De(p,s),style:c},t.createElement("span",{className:De(`${u}__title`)},n),t.createElement("div",{className:De(`${u}__extra`)},r),void 0!==i&&t.createElement(C,{type:"link",className:De(`${u}__collapse`),disabled:l,onClick:this.clickHandle},Bt(i?"qm.divider.collect":"qm.divider.spread"),i?t.createElement(Fe,null):t.createElement($e,null)))}}$n.contextType=Vt,$n.propTypes={label:f.string,size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Divider","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},extra:f.oneOfType([f.element,f.string]),collapse:f.bool,bordered:f.bool},$n.defaultProps={bordered:!0};const Mn=()=>({height:0,opacity:0}),qn=(e,t)=>"height"===t.propertyName,jn={motionName:"rc-collapse-motion",onEnterStart:Mn,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Mn,onEnterEnd:qn,onLeaveEnd:qn,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"};function Vn(e){return Vn="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},Vn(e)}function Kn(e){var t=function(e,t){if("object"!==Vn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Vn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Vn(t)?t:String(t)}function zn(e,t,n){return(t=Kn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wn(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 Bn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wn(Object(n),!0).forEach((function(t){zn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Un(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 Gn(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,o,l,a=[],s=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Un(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)?Un(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 Yn(e){return e instanceof HTMLElement||e instanceof SVGElement}function Xn(e){var n,r=function(e){return e&&"object"===Vn(e)&&Yn(e.nativeElement)?e.nativeElement:Yn(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Pt.findDOMNode)||void 0===n?void 0:n.call(Pt,e):null)}var Zn,Qn={exports:{}},Jn={};Qn.exports=(Zn||(Zn=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"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),a=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"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:var f=e.type;switch(f){case r:case o:case i:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case a:case c:case h:case p:case l:return g;default:return m}}case n:return m}}}e=Symbol.for("react.module.reference");var g=a,v=l,y=t,b=c,x=r,E=h,S=p,w=n,C=o,T=i,N=d,I=u,R=!1,O=!1;Jn.ContextConsumer=g,Jn.ContextProvider=v,Jn.Element=y,Jn.ForwardRef=b,Jn.Fragment=x,Jn.Lazy=E,Jn.Memo=S,Jn.Portal=w,Jn.Profiler=C,Jn.StrictMode=T,Jn.Suspense=N,Jn.SuspenseList=I,Jn.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},Jn.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},Jn.isContextConsumer=function(e){return f(e)===a},Jn.isContextProvider=function(e){return f(e)===l},Jn.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Jn.isForwardRef=function(e){return f(e)===c},Jn.isFragment=function(e){return f(e)===r},Jn.isLazy=function(e){return f(e)===h},Jn.isMemo=function(e){return f(e)===p},Jn.isPortal=function(e){return f(e)===n},Jn.isProfiler=function(e){return f(e)===o},Jn.isStrictMode=function(e){return f(e)===i},Jn.isSuspense=function(e){return f(e)===d},Jn.isSuspenseList=function(e){return f(e)===u},Jn.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===o||t===i||t===d||t===u||t===m||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===p||t.$$typeof===l||t.$$typeof===a||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Jn.typeOf=f}()),Jn);var er=function(e,t){"function"==typeof e?e(t):"object"===Vn(e)&&e&&"current"in e&&(e.current=t)},tr=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){er(t,e)}))}},nr=function(e){var t,n,r=Qn.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===Qn.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===Qn.exports.ForwardRef)};function rr(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}Number(i.split(".")[0]);var ir=e.createContext({});function or(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(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,Kn(r.key),r)}}function ar(e,t,n){return t&&lr(e.prototype,t),n&&lr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sr(e,t)}function cr(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&&sr(e,t)}function dr(e){return dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dr(e)}function ur(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pr(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=dr(e);if(t){var i=dr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Vn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ur(e)}(this,n)}}var hr=function(t){cr(r,e.Component);var n=pr(r);function r(){return or(this,r),n.apply(this,arguments)}return ar(r,[{key:"render",value:function(){return this.props.children}}]),r}();function mr(t){var n=e.useRef(!1),r=Gn(e.useState(t),2),i=r[0],o=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[i,function(e,t){t&&n.current||o(e)}]}var fr="none",gr="appear",vr="enter",yr="leave",br="none",xr="prepare",Er="start",Sr="active",wr="end",Cr="prepared";function Tr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Nr(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 Ir,Rr,Or,kr=(Ir=Tr(),Rr="undefined"!=typeof window?window:{},Or={animationend:Nr("Animation","AnimationEnd"),transitionend:Nr("Transition","TransitionEnd")},Ir&&("AnimationEvent"in Rr||delete Or.animationend.animation,"TransitionEvent"in Rr||delete Or.transitionend.transition),Or),Ar={};if(Tr()){var Lr=document.createElement("div");Ar=Lr.style}var Pr={};function _r(e){if(Pr[e])return Pr[e];var t=kr[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var o=n[i];if(Object.prototype.hasOwnProperty.call(t,o)&&o in Ar)return Pr[e]=t[o],Pr[e]}return""}var Hr=_r("animationend"),Dr=_r("transitionend"),Fr=!(!Hr||!Dr),$r=Hr||"animationend",Mr=Dr||"transitionend";function qr(e,t){return e?"object"===Vn(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var jr=function(t){var n=l(),r=l(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function o(e){e&&(e.removeEventListener(Mr,i),e.removeEventListener($r,i))}return e.useEffect((function(){return function(){o(n.current)}}),[]),[function(e){n.current&&n.current!==e&&o(n.current),e&&e!==n.current&&(e.addEventListener(Mr,i),e.addEventListener($r,i),n.current=e)},o]},Vr=Tr()?a:s,Kr=function(e){return+setTimeout(e,16)},zr=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(Kr=function(e){return window.requestAnimationFrame(e)},zr=function(e){return window.cancelAnimationFrame(e)});var Wr=0,Br=new Map;function Ur(e){Br.delete(e)}var Gr=function(e){var t=Wr+=1;return function n(r){if(0===r)Ur(t),e();else{var i=Kr((function(){n(r-1)}));Br.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};Gr.cancel=function(e){var t=Br.get(e);return Ur(e),zr(t)},Gr.ids=function(){return Br};var Yr=[xr,Er,Sr,wr],Xr=[xr,Cr],Zr=!1,Qr=!0;function Jr(e){return e===Sr||e===wr}var ei=function(t,n,r){var i=Gn(mr(br),2),o=i[0],l=i[1],a=function(){var t=e.useRef(null);function n(){Gr.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 o=Gr((function(){i<=1?r({isCanceled:function(){return o!==t.current}}):e(r,i-1)}));t.current=o},n]}(),s=Gn(a,2),c=s[0],d=s[1];var u=n?Xr:Yr;return Vr((function(){if(o!==br&&o!==wr){var e=u.indexOf(o),t=u[e+1],n=r(o);n===Zr?l(t,!0):t&&c((function(e){function r(){e.isCanceled()||l(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,o]),e.useEffect((function(){return function(){d()}}),[]),[function(){l(xr,!0)},o]};var ti=function(t){var n=t;"object"===Vn(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,o=void 0===i||i,a=t.removeOnLeave,c=void 0===a||a,d=t.forceRender,u=t.children,p=t.motionName,h=t.leavedClassName,m=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 o=i.motionEnter,a=void 0===o||o,c=i.motionAppear,d=void 0===c||c,u=i.motionLeave,p=void 0===u||u,h=i.motionDeadline,m=i.motionLeaveImmediately,f=i.onAppearPrepare,g=i.onEnterPrepare,v=i.onLeavePrepare,y=i.onAppearStart,b=i.onEnterStart,x=i.onLeaveStart,E=i.onAppearActive,S=i.onEnterActive,w=i.onLeaveActive,C=i.onAppearEnd,T=i.onEnterEnd,N=i.onLeaveEnd,I=i.onVisibleChanged,R=Gn(mr(),2),O=R[0],k=R[1],A=Gn(mr(fr),2),L=A[0],P=A[1],_=Gn(mr(null),2),H=_[0],D=_[1],F=l(!1),$=l(null);function M(){return r()}var q=l(!1);function j(){P(fr,!0),D(null,!0)}function V(e){var t=M();if(!e||e.deadline||e.target===t){var n,r=q.current;L===gr&&r?n=null==C?void 0:C(t,e):L===vr&&r?n=null==T?void 0:T(t,e):L===yr&&r&&(n=null==N?void 0:N(t,e)),L!==fr&&r&&!1!==n&&j()}}var K=Gn(jr(V),1)[0],z=function(e){var t,n,r;switch(e){case gr:return zn(t={},xr,f),zn(t,Er,y),zn(t,Sr,E),t;case vr:return zn(n={},xr,g),zn(n,Er,b),zn(n,Sr,S),n;case yr:return zn(r={},xr,v),zn(r,Er,x),zn(r,Sr,w),r;default:return{}}},W=e.useMemo((function(){return z(L)}),[L]),B=Gn(ei(L,!t,(function(e){if(e===xr){var t=W[xr];return t?t(M()):Zr}var n;return G in W&&D((null===(n=W[G])||void 0===n?void 0:n.call(W,M(),null))||null),G===Sr&&(K(M()),h>0&&(clearTimeout($.current),$.current=setTimeout((function(){V({deadline:!0})}),h))),G===Cr&&j(),Qr})),2),U=B[0],G=B[1],Y=Jr(G);q.current=Y,Vr((function(){k(n);var e,r=F.current;F.current=!0,!r&&n&&d&&(e=gr),r&&n&&a&&(e=vr),(r&&!n&&p||!r&&m&&!n&&p)&&(e=yr);var i=z(e);e&&(t||i[xr])?(P(e),U()):P(fr)}),[n]),s((function(){(L===gr&&!d||L===vr&&!a||L===yr&&!p)&&P(fr)}),[d,a,p]),s((function(){return function(){F.current=!1,clearTimeout($.current)}}),[]);var X=e.useRef(!1);s((function(){O&&(X.current=!0),void 0!==O&&L===fr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,L]);var Z=H;return W[xr]&&G===Er&&(Z=Bn({transition:"none"},Z)),[L,G,Z,null!=O?O:n]}(f,o,(function(){try{return g.current instanceof HTMLElement?g.current:Xn(v.current)}catch(e){return null}}),t),b=Gn(y,4),x=b[0],E=b[1],S=b[2],w=b[3],C=e.useRef(w);w&&(C.current=!0);var T,N=e.useCallback((function(e){g.current=e,er(r,e)}),[r]),I=Bn(Bn({},m),{},{visible:o});if(u)if(x===fr)T=w?u(Bn({},I),N):!c&&C.current&&h?u(Bn(Bn({},I),{},{className:h}),N):d||!c&&!h?u(Bn(Bn({},I),{},{style:{display:"none"}}),N):null;else{var R,O;E===xr?O="prepare":Jr(E)?O="active":E===Er&&(O="start");var k=qr(p,"".concat(x,"-").concat(O));T=u(Bn(Bn({},I),{},{className:De(qr(p,x),(R={},zn(R,k,k&&O),zn(R,p,"string"==typeof p),R)),style:S}),N)}else T=null;e.isValidElement(T)&&nr(T)&&(T.ref||(T=e.cloneElement(T,{ref:N})));return e.createElement(hr,{ref:v},T)}));return r.displayName="CSSMotion",r}(Fr);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 ri="add",ii="keep",oi="remove",li="removed";function ai(e){var t;return Bn(Bn({},t=e&&"object"===Vn(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function si(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(ai)}var ci=["component","children","onVisibleChanged","onAllRemoved"],di=["status"],ui=["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]:ti,r=function(t){cr(i,e.Component);var r=pr(i);function i(){var e;or(this,i);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return zn(ur(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),zn(ur(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:Bn(Bn({},e),{},{status:li})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==li})).length})),e}return ar(i,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,i=this.props,o=i.component,l=i.children,a=i.onVisibleChanged,s=i.onAllRemoved,c=rr(i,ci),d=o||e.Fragment,u={};return ui.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,o=rr(r,di),c=i===ri||i===ii;return e.createElement(n,ni({},u,{key:o.key,visible:c,eventProps:o,onVisibleChanged:function(e){(null==a||a(e,{key:o.key}),e)||0===t.removeKey(o.key)&&s&&s()}}),l)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=si(n),o=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,o=si(e),l=si(t);o.forEach((function(e){for(var t=!1,o=r;o<i;o+=1){var a=l[o];if(a.key===e.key){r<o&&(n=n.concat(l.slice(r,o).map((function(e){return Bn(Bn({},e),{},{status:ri})}))),r=o),n.push(Bn(Bn({},a),{},{status:ii})),r+=1,t=!0;break}}t||n.push(Bn(Bn({},e),{},{status:oi}))})),r<i&&(n=n.concat(l.slice(r).map((function(e){return Bn(Bn({},e),{},{status:ri})}))));var a={};return n.forEach((function(e){var t=e.key;a[t]=(a[t]||0)+1})),Object.keys(a).filter((function(e){return a[e]>1})).forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==oi}))).forEach((function(t){t.key===e&&(t.status=ii)}))})),n}(r,i);return{keyEntities:o.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==li||e.status!==oi}))}}}]),i}();zn(r,"defaultProps",{component:"div"})}(Fr);const pi=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:o,boxStyle:l,isActive:a}=e,[s,c]=t.useState(a||r);if(t.useEffect((()=>{(r||a)&&c(!0)}),[r,a]),!s)return null;const d=Fn("collapse");return t.createElement("div",{ref:n,className:De(`${d}-content`,{[`${d}-content-active`]:a,[`${d}-content-inactive`]:!a},i),style:o},t.createElement("div",{className:`${d}-content-box`,style:l},e.children))}));pi.displayName="PanelContent";const hi=e=>{const{defaultActive:n,label:r,extra:i,className:o,style:l,containerStyle:a,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=t.useState(!!n),f=Fn("collapse"),g=De({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},o);return t.createElement("div",{className:g,style:l},t.createElement($n,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),null==p||p(e)}}),t.createElement(ti,hn({visible:h},jn,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((n,r)=>{let{className:i,style:o}=n;return t.createElement(pi,{ref:r,prefixCls:f,className:i,style:o,boxStyle:a,isActive:h,forceRender:d},e.children)})))};hi.displayName="QmCollapse";const mi=t.createContext(void 0);function fi(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 gi=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},vi=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},yi=e=>e.stopPropagation(),bi=e=>e.preventDefault(),xi=(e,t)=>{if(Sn||!e||!t)return null;"float"===(t=On(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]}},Ei=(e,t,n)=>{!Sn&&e&&t&&(se(t)?Object.keys(t).forEach((n=>{Ei(e,n,t[n])})):(t=On(t),e.style[t]=n))},Si=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},wi=(e,t)=>Math.abs(Si(e)-Si(t)),Ci=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}},Ti=(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},Ni=(e,t)=>{if(Sn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ii=e=>Math.pow(e,3),Ri=e=>e<.5?Ii(2*e)/2:1-Ii(2*(1-e))/2,Oi=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:o,direction:l}=t.useContext(mi),a=t.useRef(Sn?null:document.onselectstart),s=t.useMemo((()=>"horizontal"===l),[l]),c=t.useMemo((()=>s?"X":"Y"),[s]),d=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),u=e=>{d.current=Object.assign({},d.current,e)},p=e=>{if(1!==e.buttons)return h();const t=e[`page${c}`]-d.current[`start${c}`],r=[n[0],d.current[`containerSize${c}`]-n[1]];let o=d.current[`firstElementSize${c}`]+t;o=Math.max(r[0],o),o=Math.min(r[1],o),i(o)},h=()=>{u({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),vi(document,"mousemove",p),vi(document,"mouseup",h),m()},m=()=>{document.onselectstart!==a.current&&(document.onselectstart=a.current)},f={[`${Fn("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t.createElement("div",{className:De(f),title:Bt("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=o.current,n=t.children[0];u({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),gi(document,"mousemove",p),gi(document,"mouseup",h),r(!0),a.current=document.onselectstart,document.onselectstart=()=>!1}})};Oi.displayName="ResizeBar";const ki=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:o}=e,{direction:l,dragging:a}=t.useContext(mi),s="vertical"===l?"height":"width",c={[Fn("split-pane")]:!0,isLocked:a,horizontal:"horizontal"===l,vertical:"vertical"===l,[i]:!!i},d=void 0!==r?{[s]:Pn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:De(c),style:Object.assign(Object.assign({},d),o)},e.children)}));ki.displayName="QmSplitPane";const Ai=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:o,style:l,onDragStart:a,onDrag:s=Tn,onDragEnd:c}=e,{global:d}=t.useContext(Vt),u=t.useRef(null),p=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`,m=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));fi((()=>{v?null==a||a(m(b)):(null==c||c(m(b)),localStorage.setItem(g,b),w(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):S(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},S=e=>En(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){}})),w=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),C=t.useMemo((()=>({splitRef:u,direction:n,dragging:v})),[n,v]),T=[];t.Children.map(e.children,(e=>{var t;wn(e)&&!Cn(e)&&"QmSplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&T.push(e)}));const[N,I]=T,R=t.useMemo((()=>[f(N),f(I)]),[N,I]),O={[Fn("split")]:!0,vertical:"vertical"===n};return t.createElement(mi.Provider,{value:C},t.createElement("div",{ref:u,className:De(O,o),style:l},t.createElement(ki,hn({},N.props,{ref:p,offset:b})),t.createElement(Oi,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(ki,I.props)))};Ai.Pane=ki,Ai.displayName="QmSplit";class Li extends r{render(){const{size:e,className:n,style:r}=this.props,i=e||this.context.size||"",o=Fn("countup"),l={[o]:!0,[`${o}--lg`]:"large"===i,[`${o}--sm`]:"small"===i};return t.createElement(Tt,hn({},this.props,{className:De(l,n),style:r}),this.props.children)}}Li.defaultProps={duration:2},Li.contextType=Vt;class Pi extends r{render(){const{size:e,className:n}=this.props,r=e||this.context.size||"",i=Fn("empty"),o=Object.assign(Object.assign({},this.props),{image:I.PRESENTED_IMAGE_SIMPLE}),l={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(I,hn({},o,{className:De(l,n)}))}}Pi.contextType=Vt,Pi.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")}};class _i extends r{render(){const{fullHeight:e,className:n,style:r={}}=this.props,i={[`${Fn("spin")}-full-height`]:e},o=Object.assign(Object.assign({wrapperClassName:De(i,n)},An(this.props,["fullHeight"])),{style:Object.assign(Object.assign({},r),{maxHeight:"none"})});return t.createElement(R,o,this.props.children)}}_i.defaultProps={tip:"Loading...",fullHeight:!1};const Hi=t.createContext(void 0),Di=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},Fi=function(e,t){!Sn&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new Nt(Di),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},$i=function(e,t){var n;e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||null===(n=e.__ro__)||void 0===n||n.disconnect())};function Mi(t){const[n,r]=e.useState({width:0,height:0});return e.useLayoutEffect((()=>{const e=t.current,n=e=>{const{width:t,height:n}=e.contentRect;r({width:t,height:n})};return e&&Fi(e,n),()=>{e&&$i(e,n)}}),[t]),n}const qi=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function ji(e,t){qi((t=>{if(!t)return e()}),t)}function Vi(t,n){var r=this;const i=e.useRef(null);e.useEffect((()=>()=>{clearTimeout(i.current),i.current=null}),[]);const o=e.useCallback((function(){for(var e=arguments.length,o=new Array(e),l=0;l<e;l++)o[l]=arguments[l];i.current&&clearTimeout(i.current),i.current=setTimeout((()=>t.apply(r,o)),n)}),[t,n]);return o}const Ki=6,zi={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"}},Wi=e=>{const{thumb:n,always:r,className:i,barSize:o=Ki,direction:l="vertical",onDrag:a=Tn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(Hi),u=zi[l],p=t.useRef(n),h=t.useRef(null),m=t.useRef(null),f=t.useRef({}),g=t.useRef(!1),v=t.useRef(!1),y=t.useRef(Sn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{p.current=n}),[n]),t.useEffect((()=>{const e=c.current;return gi(e,"mousemove",C),gi(e,"mouseleave",T),()=>{w(),vi(document,"mouseup",S),vi(e,"mousemove",C),vi(e,"mouseleave",T)}}),[]);const E=e=>{if(!h.current||!m.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])-(m.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,a(!0)},S=()=>{g.current=!1,f.current={[u.axis]:0},vi(document,"mousemove",E),vi(document,"mouseup",S),w(),v.current&&x(!1),a(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},C=()=>{v.current=!1,x(!!p.current.size)},T=()=>{v.current=!0,x(g.current)},N=Fn("scrollbar"),I={[`${N}__bar`]:!0,"is-vertical":"vertical"===l,"is-horizontal":"horizontal"===l},R={[u.reverse]:o},O={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(Np,{name:"fade",in:r||s||b,timeout:300},t.createElement("div",{ref:h,className:De(I,i),style:R},t.createElement("div",{ref:m,className:`${N}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),gi(document,"mousemove",E),gi(document,"mouseup",S),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])})}})))},Bi=20,Ui=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,barWidth:o,always:l,native:a,showTopScrollbar:s,minSize:c=Bi,onScroll:d}=e,u=t.useRef(null),p=t.useRef(null),h=t.useRef(null),[m,f]=t.useState({size:0,offset:0,ratio:1}),[g,v]=t.useState({size:0,offset:0,ratio:1}),[y,b]=t.useState(!1),x=Mi(u),E=Mi(h);ji((()=>{!a&&S()}),[E.width,E.height,x.width,x.height]);const S=Vi((()=>{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,i=Math.max(n,c),o=Math.max(r,c),l=n/(e-n)/(i/(e-i)),a=r/(t-r)/(o/(t-o)),s=i+4<e?i:0,d=o+4<t?o:0,u=100*p.current.scrollTop/e*l,h=100*p.current.scrollLeft/t*a;f(Object.assign({},m,{size:d,ratio:a,offset:h})),v(Object.assign({},g,{size:s,ratio:l,offset:u}))}),5),w=e=>{b(e)},C=(e,t)=>{ce(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,i=window.requestAnimationFrame,o=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Ri(l),i(o)):e.scrollTop=t};i(o)})(p.current,e):p.current.scrollTop=e:Xt("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{ce(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,i=window.requestAnimationFrame,o=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Ri(l),i(o)):e.scrollLeft=t};i(o)})(p.current,e):p.current.scrollLeft=e:Xt("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:u.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:C,SET_SCROLL_LEFT:T}}));const N=t.useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:p})),[y]),I=Fn("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!a};return t.createElement("div",{ref:u,className:De(I,e.className),style:e.style},t.createElement("div",{ref:p,className:De(R,r),style:i,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!a&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=100*p.current.scrollTop/e*g.ratio,r=100*p.current.scrollLeft/t*m.ratio;f(Object.assign({},m,{offset:r})),v(Object.assign({},g,{offset:n}))})(),null==d||d({scrollTop:t,scrollLeft:n})}},t.createElement("div",{ref:h,className:`${I}__view`},e.children)),!a&&t.createElement(Hi.Provider,{value:N},s&&t.createElement(Wi,{className:"top",direction:"horizontal",thumb:m,barSize:o,always:l,onDrag:w}),t.createElement(Wi,{direction:"horizontal",thumb:m,barSize:o,always:l,onDrag:w}),t.createElement(Wi,{direction:"vertical",thumb:g,barSize:o,always:l,onDrag:w})))}));Ui.displayName="QmScrollbar";const Gi=(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}},Yi=(e,t)=>{let{fileName:n,headers:r,params:i}=t;return En(void 0,void 0,void 0,(function*(){const t=i?new URLSearchParams(i).toString():"",o=t?e.includes("?")?"&":"?":"",l=yield fetch(e+`${o+t}`,{method:"GET",headers:r});if(!l.ok)throw new Error(Bt("qm.download.error"));const a=yield l.blob(),s=l.headers.get("content-disposition"),c=n||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Gi(a,c)}))};class Xi extends r{constructor(){super(...arguments),this.beforeUpload=(e,t)=>new Promise(((n,r)=>En(this,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:o,maxCount:l,fileList:a=[],beforeUpload:s}=this.props,c=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!o||e.size/1024/1024<o,u=!(l>1)||a.length<l,p=c&&d&&u;if(c||k.warning(Bt("qm.upload.tooltip",{type:i.join(",")})),d||k.warning(Bt("qm.upload.sizeLimit",{size:o})),u||k.warning(Bt("qm.upload.countLimit",{count:l})),!p)return O.LIST_IGNORE;if(s){const i=s(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)})))),this.doDownload=e=>En(this,void 0,void 0,(function*(){const{downloadWithHeaders:t,headers:n}=this.props;try{e.url&&(yield Yi(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){k.error(Bt("qm.download.error"))}}))}get $size(){var e;return null!==(e=this.context.size)&&void 0!==e?e:""}render(){var e,n;const{fileList:r=[],button:i={},fileDirection:o,disabled:l,readOnly:a,className:s,onPreview:c,onChange:d}=this.props,u=Fn("upload-file"),p={[u]:!0,[`${u}--lg`]:"large"===this.$size,[`${u}--sm`]:"small"===this.$size,[`${u}--horizontal`]:"horizontal"===o};return t.createElement(O,hn({className:De(p,s)},An(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:l||a,onChange:d,onPreview:e=>En(this,void 0,void 0,(function*(){if("function"==typeof c)return c(e,(t=>this.doDownload(t||e)));l||(yield this.doDownload(e))})),onDownload:e=>En(this,void 0,void 0,(function*(){yield this.doDownload(e)}))}),this.props.children||a&&r.length?this.props.children:t.createElement(C,{type:null!==(e=i.type)&&void 0!==e?e:"default",icon:null!==(n=i.icon)&&void 0!==n?n:t.createElement(Me,null),disabled:l||a},i.text||Bt("qm.upload.text")))}}Xi.contextType=Vt,Xi.defaultProps={name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}};class Zi extends r{constructor(){super(...arguments),this.state={loading:!1},this.downloadHandle=()=>En(this,void 0,void 0,(function*(){var e,t,n,r;this.setState({loading:!0});try{const{action:n,fileName:r,headers:i,params:o,beforeDownload:l=Nn}=this.props,a=ue(n)?n:yield this.getActionUrl();if(!a)return Xt("Download","参数 `action` 有误!");if(!l(a))return;yield Yi(a,{fileName:r,headers:i,params:o}),yield In(100),null===(t=(e=this.props).onSuccess)||void 0===t||t.call(e),k.success(Bt("qm.download.success"))}catch(e){null===(r=(n=this.props).onError)||void 0===r||r.call(n,e),k.error(Bt("qm.download.error"))}this.setState({loading:!1})}))}getActionUrl(){return En(this,void 0,void 0,(function*(){const e=this.props.action;if(e.api)try{const t=yield e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}))}render(){const{size:e}=this.props,{loading:n}=this.state,r=e||this.context.size||"",i=An(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(C,hn({},i,{size:r,loading:n,onClick:this.downloadHandle}),this.props.children)}}Zi.propTypes={action:f.oneOfType([f.string,f.shape({api:f.func.isRequired,params:f.object})]),size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},fileName:f.string,headers:f.object,withCredentials:f.bool,params:f.object,beforeDownload:f.func,onSuccess:f.func,onError:f.func},Zi.defaultProps={icon:t.createElement(qe,null),children:Bt("qm.download.text"),withCredentials:!1},Zi.contextType=Vt;class Qi extends r{renderLabel(){const{activeKey:e,labels:n,onTabClick:r}=this.props;return n.map(((n,i)=>{const o={item:!0,actived:i===e};return t.createElement("div",{key:i,className:De(o),onClick:e=>r(i,e)},t.createElement("span",null,n))}))}render(){return t.createElement(t.Fragment,null,this.renderLabel())}}class Ji extends r{render(){const{label:e,showDivider:n,className:r,style:i}=this.props,o={[Fn("anchor-item")]:!0};return t.createElement("div",{className:De(o,r),style:i},n&&t.createElement($n,{label:e,style:{marginBottom:10}}),this.props.children)}}Ji.displayName="QmAnchorItem";class eo extends r{get __is_conf(){var e;return!!(null===(e=this.props.labelList)||void 0===e?void 0:e.length)}constructor(e){super(e),this.currentState="ready",this.scrollRef=c(),this.onScrollHandle=e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})},this.onTabClickHandle=e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Rt(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))},this.SCROLL_TO_ITEM=e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)},this.state={activeKey:e.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=It(this.scrollRef.current,"scroll",pe(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=wi(this.getTargetElement(e),this.scrollRef.current))}createDistances(){var e;const{labelList:t=[]}=this.props;return(this.__is_conf?t.map((e=>document.getElementById(e.id))):Array.from((null===(e=this.scrollRef.current)||void 0===e?void 0:e.children)||[])).map((e=>wi(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),n=this.createDistances();let r=-1;for(let e=0;e<n.length;e++){const i=n[e],o=n[e+1]||1e4;t>=i-1&&t<o&&(r=e)}return r}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:n,labelWidth:r,tabPosition:i,labelList:o=[],onTabClick:l,className:a,style:s}=this.props,c=n||this.context.size||"",d=Fn("anchor"),u={[d]:!0,[`${d}-left`]:"left"===i,[`${d}-top`]:"top"===i,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];t.Children.map(this.props.children,(e=>{var t;wn(e)&&!Cn(e)&&"QmAnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&p.push(e)}));const h=this.__is_conf?o.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?o.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,t.createElement("div",{className:De(u,a),style:s},t.createElement("div",{className:De("anchor-nav"),style:{width:r?Pn(r):""}},t.createElement(Qi,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),null==l||l({label:h[e],id:m[e]},t)}})),t.createElement("div",{ref:this.scrollRef,className:De("anchor-container")},this.__is_conf?this.props.children:p))}}eo.Item=Ji,eo.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},labelWidth:(e,t,n)=>{if(!Zt(e[t]))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},labelList:f.arrayOf(f.shape({id:f.string,label:f.string}))},eo.defaultProps={tabPosition:"left"},eo.contextType=Vt;class to extends r{render(){return t.createElement(A.TabPane,this.props,this.props.children)}}to.displayName="QmTabPane";class no extends r{render(){const{items:e,size:n,tabPosition:r,tabBarGutter:i,className:o,authConfig:l}=this.props,a=n||this.context.size||"",s=Fn("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===a,[`${s}--sm`]:"small"===a},d=Object.assign(Object.assign({},An(this.props,["items","authConfig"])),{size:a,tabBarGutter:null!=i?i:["top","bottom"].includes(r)?30:0}),u=[];t.Children.map(this.props.children,(e=>{var t;wn(e)&&!Cn(e)&&"QmTabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:n}=e;return{key:t,label:n.tab,disabled:n.disabled,closable:n.closable,forceRender:n.forceRender,children:n.children}}));if(l){const{fieldList:e=[]}=l||{};for(let t=0;t<p.length;t++){const n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:i=1,disabled:o}=r||{};i?o&&(n.disabled=!0):(p.splice(t,1),t--)}}return t.createElement(A,hn({},d,{items:p,className:De(c,o)}))}}no.TabPane=to,no.contextType=Vt,no.defaultProps={tabPosition:"top"};class ro extends r{constructor(){super(...arguments),this.titleRef=t.createRef(),this.$drawer=null,this.opened=!1,this.state={fullscreen:!1,spinning:!1,sloading:!1},this.afterVisibleChange=e=>{var t,n;const{loading:r}=this.props;e?(this.opened=!0,he(r)&&setTimeout((()=>this.setState({spinning:!1})),100)):(null===(n=(t=this.props).onClosed)||void 0===n||n.call(t),this.setState({fullscreen:!1}))},this.toggleHandle=()=>{this.$drawer=Ti(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(t=(e=this.props).onFullChange)||void 0===t||t.call(e,this.state.fullscreen)}))},this.START_LOADING=()=>{this.setState({sloading:!0})},this.STOP_LOADING=()=>{this.setState({sloading:!1})}}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){var n;const{visible:r,open:i,loading:o,destroyOnClose:l}=this.props,a=null!=i?i:r,s=null!==(n=e.open)&&void 0!==n?n:e.visible,{fullscreen:c}=this.state;a&&a!==s&&(!l&&this.opened||he(o)&&this.setState({spinning:!0})),this.$drawer&&c!==t.fullscreen&&Ei(this.$drawer,c?{width:"100%"}:{width:Pn(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:n,showHeader:r,showFullScreen:i}=this.props;return t.createElement(t.Fragment,null,t.createElement("span",{ref:this.titleRef,className:De("text")},r&&n),i&&t.createElement("button",{type:"button",className:De("full-screen"),onClick:this.toggleHandle},t.createElement(e?je:Ve)))}render(){var e;const{spinning:n,sloading:r}=this.state,{visible:i,open:o,size:l,className:a,loading:s,showHeader:c,maskClosable:d,onClose:u}=this.props,p=this.context.global,h=l||this.context.size||"",m=Fn("drawer"),f={[m]:!0,"no-header":!c,[`${m}--lg`]:"large"===h,[`${m}--sm`]:"small"===h};return t.createElement(L,hn({},An(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=o?o:i,maskClosable:null!==(e=null!=d?d:null==p?void 0:p.maskClosable)&&void 0!==e&&e,className:De(f,a),title:this.renderTitle(),footer:null,onClose:u,afterOpenChange:this.afterVisibleChange}),this.props.children,(s||r||n)&&t.createElement(_i,{spinning:!0,className:De("spinning")}))}}ro.contextType=Vt,ro.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Drawer","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},spinning:f.bool},ro.defaultProps={width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null};const io="10vh";var oo;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(oo||(oo={}));class lo extends r{constructor(){super(...arguments),this.$event=null,this.draggleRef=t.createRef(),this.opened=!1,this.state={fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0},this.addMouseDownEvent=()=>{this.$event||(this.$event=It(document.body,"mousedown",yi))},this.removeMouseDownEvent=()=>{var e;this.$event&&(null===(e=this.$event)||void 0===e||e.remove(),this.$event=null)},this.onStart=(e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=this.draggleRef.current.getBoundingClientRect();i&&this.setState({bounds:{left:-i.left+t.x,right:n-(i.right-t.x)-1,top:-i.top+t.y,bottom:r-(i.bottom-t.y)-1}})},this.toggleHandle=e=>{const t=Ti(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body"),{width:r,height:i,showHeader:o}=this.props,{fullscreen:l}=this.state;l?(Ei(t,{width:Pn(r||"60%"),height:"auto",top:io}),Ei(n,{height:i?Pn(i):this.defaultHeight,maxHeight:"auto"===i?this.defaultHeight:""})):(Ei(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ei(n,{height:`calc(100vh - ${oo[o?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(t=(e=this.props).onFullChange)||void 0===t||t.call(e,this.state.fullscreen)}))},this.afterVisibleChange=()=>{const{onClosed:e}=this.props;null==e||e(),this.setState({fullscreen:!1})},this.START_LOADING=()=>{this.setState({sloading:!0})},this.STOP_LOADING=()=>{this.setState({sloading:!1})}}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${io} - ${io} - ${oo[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){var n;const{visible:r,open:i,loading:o,stopMouseDownEvent:l,destroyOnClose:a}=this.props,s=null!=i?i:r,c=null!==(n=e.open)&&void 0!==n?n:e.visible,{fullscreen:d}=this.state;if(s&&s!==c){if(!a&&this.opened||he(o)&&this.setState({spinning:!0}),l&&this.addMouseDownEvent(),!a&&this.opened)return;setTimeout((()=>{this.opened=!0,he(o)&&this.setState({spinning:!1})}),400)}s||this.removeMouseDownEvent(),d!==t.fullscreen&&(d?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:n}=this.state,{title:r,showHeader:i,showFullScreen:o}=this.props;return t.createElement("div",{onMouseOver:()=>{n&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t.createElement("span",{className:De("text")},i&&r),o&&t.createElement("button",{type:"button",className:De("full-screen"),onClick:this.toggleHandle},t.createElement(e?je:Ve)))}render(){var e;const{spinning:n,sloading:r,fullscreen:i,disabled:o,bounds:l,position:a}=this.state,{visible:s,open:c,height:d,className:u,loading:p,draggable:h,showHeader:m,maskClosable:f,bodyStyle:g,onClose:v}=this.props,y=this.context.global,b=Fn("modal"),x={height:d?Pn(d):this.defaultHeight,maxHeight:"auto"===d?this.defaultHeight:"",overflow:"auto"},E={[b]:!0,"no-header":!m,[`${b}--lg`]:"large"===this.$size,[`${b}--sm`]:"small"===this.$size};return t.createElement(P,hn({},An(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:null!=c?c:s,maskClosable:null!==(e=null!=f?f:null==y?void 0:y.maskClosable)&&void 0!==e&&e,className:De(E,u),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},x,g),onCancel:v,afterClose:this.afterVisibleChange,modalRender:e=>t.createElement(Ot,{nodeRef:this.draggleRef,bounds:l,position:a,disabled:!h||o||i,onStart:(e,t)=>this.onStart(e,t)},t.createElement("div",{ref:this.draggleRef},e))}),this.props.children,(p||r||n)&&t.createElement(_i,{spinning:!0,className:De("spinning")}))}}lo.contextType=Vt,lo.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Modal","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},spinning:f.bool},lo.defaultProps={width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:io}};const ao=n(void 0),so=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var co={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)so.includes(t[e])?(n[r]=n[r].join(" "),r++,n[r]=[]):n[r].push(t[e]);return n[r]=n[r].join(" "),n},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";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," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),e=this.find_replace(e," NIN "," nin ")}};const uo=["==","<",">","<=",">=","!=","like","likes","in","nin"];var po=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},ho=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++)uo.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),uo.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const mo=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,fo=["string","number","boolean","symbol"],go=e=>fo.includes(typeof e),vo=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),yo=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(mo,"\\$1"),"i");window.__query__=function(){return((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(yo(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(yo(t))));break;case"in":go(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":go(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(vo(e)?e.slice(0,10):e)!=n;break;case"<":r=(vo(e)?e.slice(0,10):e)<n;break;case"<=":r=(vo(e)?e.slice(0,10):e)<=n;break;case">":r=(vo(e)?e.slice(0,10):e)>n;break;case">=":r=(vo(e)?e.slice(0,10):e)>=n;break;default:r=(vo(e)?e.slice(0,10):e)==n}return r})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const bo=co.stringify,xo=co.array_format,Eo=po,So=(e,t,n)=>{let r=[];t=co.replace_symbols(t);try{if(n){const n=new Function("record",`return ${ho(t,"record")};`);r=el(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${ho(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){Xt("Table","组件 `initialFilter` 参数有误!"),r=e}return r},wo=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...wo(e.children)):t.push(e)})),t},Co=e=>e.filter((e=>(e.children&&(e.children=Co(e.children)),!e.hidden&&!e.noAuth))),To=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...To(e.children))})),t},No=(e,t)=>e.map((e=>(e.children&&(e.children=No(e.children,t)),null==t||t(e),e))),Io=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Io(n.children,t);if(e)return e}}return null},Ro=e=>{const t=e.children;return t?t[0].children?Ro(t[0]):t[0]:e},Oo=e=>{const t=e.children;return t?t[t.length-1].children?Oo(t[t.length-1]):t[t.length-1]:e},ko=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Ao=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Ao(n.children,t);if(e)return e}}return null},Lo=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Lo(e.children))})),t},Po=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 To(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},_o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{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 _o(e.offsetParent,t,n)}return n},Ho=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Do=(e,t)=>fe(e,((e,n,r)=>{ge(n,t[r])||(e[r]=se(n)&&se(t[r])?Do(n,t[r]):n)})),Fo=(e,t)=>{var n;return null!==(n=me(e,t))&&void 0!==n?n:""},$o=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),ve(e,t,null!=n?n:"")},Mo=(e,t)=>{if(!t.includes("|"))return Fo(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Fo(e,t))})),n.every((e=>!e))?"":n.join(" | ")},qo=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),jo=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]}`:""}`},Vo=(e,t)=>{const n=e.toString();if(!qo(n)||0===t)return e;const r=Number.parseFloat(n).toString(),i=r.indexOf(".");if(-1===i)return r+"."+"0".repeat(t);const o=Math.max(0,t-(r.length-i-1));return r+"0".repeat(o)},Ko=(e,t)=>e?g(e,t):null,zo=(e,t)=>e?g(e).format(t):"",Wo=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",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)}))},Bo=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...Bo(e))}))}else n.push(e);return n},Uo=e=>Bo(e).join(""),Go=e=>e.filter((e=>!e._group)),Yo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n="";if(Array.isArray(e)){let r=0;for(let i=0,o=e.length;i<o;i++){const o=e[i];if(!o.fieldName)continue;const l=Array.isArray(o.condition)?xo(o.condition):bo(o.condition,"^");n+=`${o.bracketLeft} ${t?`${o.fieldName}|${o.fieldType}`:o.fieldName} ${o.expression} ${l} ${o.bracketRight} ${o.logic} `,r=o.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[i,o]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l){n+=`${t?`${i}|${o}`:i} ${e} ${Array.isArray(l[e])?xo(l[e]):bo(l[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},Xo=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((n=>{const r=JSON.stringify((t=>{const n=[];return e.forEach((e=>n.push(Fo(t,e)))),n})(n));t[r]=t[r]||[],t[r].push(n)})),Object.keys(t).map((e=>t[e]))},Zo=(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=Zo(e[n].children,t);if(r)return[e[n],r].flat()}}},Qo=(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=Qo(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},Jo=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=Jo(n.children,t);if(e)return e}if(t(n))return n}return null},el=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&el(e.children,t),t(e)||e.children&&e.children.length))),tl=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),nl=80,rl="1",il="0",ol=400,ll=["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"],al={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 sl,cl,dl;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(sl||(sl={})),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"}(cl||(cl={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(dl||(dl={}));const ul={items:f.arrayOf(f.shape({type:f.string.isRequired,fieldName:f.string.isRequired})),initialValues:f.object,initialExtras:f.object,layout:f.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:f.number,customClass:f.string,compactMode:f.bool,labelWidth:f.oneOfType([f.number,f.string]),labelAlign:f.oneOf(["left","right"]),labelWrap:f.bool,formType:f.oneOf(["default","search","onlyShow"]),disabled:f.bool,uniqueKey:f.string,defaultRows:f.number,defaultExpand:f.bool,searchButtonCols:f.number,scrollToFirstError:f.bool,authConfig:f.object,isAutoFocus:f.bool,isCollapse:f.bool,isFieldsDefine:f.bool,isSearchBtn:f.bool,isSubmitBtn:f.bool,fieldsChange:f.func,onValuesChange:f.func,onFieldsChange:f.func,onFinish:f.func,onFinishFailed:f.func,onReset:f.func,onCollapse:f.func},pl={layout:"horizontal",labelWidth:nl,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Tn,onFieldsChange:Tn,onFinish:Tn,onFinishFailed:Tn,onReset:Tn,onCollapse:Tn},hl=(e,t)=>{if(!e)return null;if(t===cl.week){const t=e.match(/^(\d{4})-(\d+)/);return t?g().year(Number(t[1])).week(Number(t[2])):null}if(t===cl.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?g().year(Number(t[1])).quarter(Number(t[2])):null}return g(e,t)},ml=(e,t)=>e?g(e).format(t):"",fl=e=>""===e||null==e,gl=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let i="";for(let t=0,o=r.length;t<o;t++){i+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===o-1?"":" | ")}return i},vl=(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("|"),o=n[r].split("|");i.forEach(((t,n)=>e[t]=e[o[n]]))}else e[t[r]]=e[n[r]]},yl=(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("|"),o=n[r].split("|");i.forEach(((t,n)=>e[t]=e[o[n]]))}else e[t[r]]=e[n[r]]},bl=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),he(e.isLeaf)||(r.isLeaf=!!e.isLeaf),he(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=bl(e.children,t,n)),r})),xl=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=xl(n.children,t);if(e)return e}}return null},El=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...El(e.children,t,n+1))})),r},Sl=e=>wn(e)||"string"==typeof e,wl=e=>wn(e)?Bo(e).join(""):null!=e?e:"",Cl=(e,t,n,r)=>{var i;const o={};return o.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})))||[],o.table={columns:e.columns||[],rowKey:e.valueName},o.fieldsDefine={valueKey:e.valueKey||e.valueName},o.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(o.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(o.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&&(o.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(o.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&&(o.columns=e.emmediateSetting.columns,o.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),o};var Tl={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 Nl="阿",Il="鿿",Rl=1,Ol=2,kl=3;let Al,Ll=null;function Pl(e){return e||null===Ll?("object"==typeof Intl&&Intl.Collator?(Al=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Ll=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Ll=!1,Ll):Ll}function _l(e){const t=Tl.UNIHANS,n=Tl.PINYINS,r=Tl.EXCEPTIONS,i={source:e};if(e in r)return i.type=Ol,i.target=r[e],i;let o,l=-1;if(e.charCodeAt(0)<256)return i.type=Rl,i.target=e,i;if(o=Al.compare(e,Nl),o<0)return i.type=kl,i.target=e,i;if(0===o)i.type=Ol,l=0;else{if(o=Al.compare(e,Il),o>0)return i.type=kl,i.target=e,i;0===o&&(i.type=Ol,l=t.length-1)}if(i.type=Ol,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const i=t[l];if(o=Al.compare(e,i),0===o)break;o>0?n=l+1:r=l-1}}return o<0&&l--,i.target=n[l],i.target||(i.type=kl,i.target=i.source),i}function Hl(e){return"string"==typeof e&&Pl()?e.split("").map((e=>_l(e))):e}var Dl={isSupported:Pl,parse:Hl,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Tl)})))},genToken:_l,convertToPinyin:(e,t,n)=>Hl(e).map((e=>t&&e.type===Ol?e.target.toLowerCase():e.target)).join(n||"")};var Fl={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)}};Dl.isSupported()&&Fl.shouldPatch(Dl.genToken)&&Dl.patchDict(Fl);const $l=e=>{const{value:n,bordered:r}=e;return t.createElement(_,{value:n,title:n,bordered:r,readOnly:!0})};$l.displayName="FormItemView";const{Option:Ml}=$,ql=e=>{const{$$form:n}=t.useContext(ao),{value:r,items:i,multiple:o,loading:l,onChange:a,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=Bt("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:f,disabled:g}=e.option,{itemList:v=[],filterable:y=!0,listHeight:b=ol,collapseTags:x,maxTagTextLength:E,dropdownStyle:S,openPyt:w=!0}=d,C=kn(v)?i:v,T=e=>{var t;return(null===(t=C.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},N=e=>o?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement($l,{value:N(r),bordered:h}):t.createElement($,hn({value:r,mode:o?"multiple":void 0,popupClassName:`form-popper__${c}`,dropdownStyle:S,placeholder:p,style:u,loading:l,bordered:h,allowClear:m,disabled:g,showSearch:y,listHeight:b,maxTagCount:x?"responsive":void 0,maxTagTextLength:E},o?{title:N(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=Dl.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},onChange:e=>{(e=>{null==a||a(e),s(e,N(e),C)})(e)}}),C.map((e=>t.createElement(Ml,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class jl extends r{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:o="value",textKey:l="text",callback:a}=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=me(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[o],text:e[l]})));this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:o,tooltip:l,fieldName:a,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(o),className:De(u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Pn(d)},required:e.getFormItemRequired(f)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:a,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(o)}},t.createElement(ql,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(a,n)}}))),h&&t.createElement(F,null,e.renderFormItemButton(a,h)),p&&t.createElement(F,{flex:Pn(p.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:a},p)))))}}jl.contextType=ao;const Vl=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{label:l,options:a={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=il,trueValue:h=rl}=a,m=e=>Bt(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),o(e,m(e))})(t?h:p)}},u?l:null)};class Kl extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option,{labelToCheckbox:m}=a;return t.createElement(H.Item,{label:m?" ":e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Vl,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Kl.contextType=ao;class zl extends r{constructor(){super(...arguments),this.linkRef=t.createRef(),this.state={visible:!1},this.getFormFieldsConfig=e=>En(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.saveFormFieldsConfig=(e,t)=>En(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.resetFieldsHandle=e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||Ln(e);return Object.assign(t,{hidden:e.hidden})}));this.changeHandle(t),this.setLocalFields(t)}}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));if(e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{var t;e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):(null===(t=this.context.global)||void 0===t?void 0:t.getComponentConfigApi)&&this.setLocalFields(this.props.items)})).catch((()=>{})),!e)return;return ye(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?(he(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName));return Object.assign(Object.assign({},t),e)}))}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return he(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(this.formUniqueKey));ge(t,n)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;null==t||t([...e])}popupRender(){const{items:e}=this.props;return t.createElement(ao.Consumer,null,(n=>{const r=n.$$form;return t.createElement("div",{className:De("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(_n,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(r.getOriginItems())},Bt("qm.table.columnFilter.reset"))),t.createElement($t,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),i=e.map((e=>e.fieldName));if(ge(n,i))return;r.setExpandHandle(!0);const o=tl(t);this.changeHandle(o),this.setLocalFields(o)}},e.map((n=>{var i;return t.createElement("li",{key:n.fieldName,className:"item",style:n.noAuth?{display:"none"}:void 0},t.createElement(M,{disabled:(null===(i=n.rules)||void 0===i?void 0:i.findIndex((e=>e.required)))>-1,checked:!n.hidden,onChange:t=>{const{checked:r}=t.target;n.hidden=!r,this.changeHandle(e),this.setLocalFields(e)}}),t.createElement(Ke,{className:"handle",title:Bt("qm.form.draggable")}),t.createElement("span",{className:"title"},r.getFormItemLabel(n.label)))}))))}))}render(){const{visible:e}=this.state,n=Fn("form-fields-filter");return t.createElement(ao.Consumer,null,(r=>{const{$size:i}=r.$$form,o={[n]:!0,[`${n}--lg`]:"large"===i,[`${n}--sm`]:"small"===i};return t.createElement(q,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:De(o),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},t.createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t.createElement(ze,null)))}))}}zl.contextType=Vt;const Wl=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(ao),{value:i,onChange:o,onValuesChange:l}=e,{options:a={},style:s={},placeholder:c=Bt("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h,onBlur:m=Tn,onEnter:f=Tn}=e.option,{prefix:g,suffix:v,password:y,maxLength:b,pattern:x,toUpper:E,toTrim:S,autoFocus:w,autoComplete:C,secretType:T}=a,N=T&&(p||h),I=t.useRef(),R=e=>{null==o||o(e),l(e)},O=y?_.Password:_,k=N?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return 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,T):i;return r.isOnlyShow?t.createElement($l,{value:(e=>e&&y?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):t.createElement(O,{ref:e=>{I.current=e,"function"==typeof n&&n(e)},value:k,autoComplete:y?"new-password":C,autoFocus:w,placeholder:c,style:s,title:y?"":k,prefix:g,suffix:v,maxLength:b,bordered:d,allowClear:u,readOnly:p,disabled:h,onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(S){const e=r.trim();r!==e&&(r=e,R(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),m(r)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;f(n),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=I.current)||void 0===t||t.blur())}},onChange:e=>{let t=e.target.value;be(x)&&(t=x.test(t)?t:null!=i?i:""),E&&(t=t.toUpperCase()),R(t)}})}));Wl.displayName="VInput";class Bl extends r{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:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Wl,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(o,t)}}))),u&&t.createElement(F,null,e.renderFormItemButton(o,u)),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Bl.contextType=ao;const Ul=e=>{const{$$form:n}=t.useContext(ao),{value:r=[],onChange:i,onValuesChange:o}=e,{options:l={},placeholder:a=Bt("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:p,suffix:h,maxLength:m}=l,f=e=>{const t=e.every((e=>!e))?[]:e;null==i||i(t),o(t,g(t))},g=e=>e.join(" - ");return n.isOnlyShow?t.createElement($l,{value:g(r),bordered:s}):t.createElement(_.Group,null,t.createElement(_,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:a[0],prefix:p,suffix:h,maxLength:m,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;f([t,r[1]])}}),t.createElement(_,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t.createElement(_,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:a[1],prefix:p,suffix:h,maxLength:m,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;f([r[0],t])}}))};class Gl extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,labelWidth:a=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(s),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(a)},required:e.getFormItemRequired(u)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ul,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(o,t)}}))),c&&t.createElement(F,{flex:Pn(c.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},c)))))}}Gl.contextType=ao;const Yl=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(ao),{value:i,onChange:o,onValuesChange:l}=e,{options:a={},style:s={},placeholder:c=Bt("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:p,onBlur:h=Tn,onEnter:m=Tn}=e.option,{step:f=1,min:g,max:v,precision:y,autoFocus:b,stringMode:x,textAlign:E="left",controls:S=!0,formatter:w,parser:C}=a,T=t.useRef(),N=t.useRef(i),I=e=>{const t=fl(e)?"":ce(e)?e.toFixed(y):new Lt(e).toFixed(y);return"function"==typeof w?w(t):t},R={[E]:!0,controls:S};return r.isOnlyShow?t.createElement($l,{value:I(i),bordered:d}):t.createElement(j,{ref:e=>{T.current=e,"function"==typeof n&&n(e)},value:i,className:De(R),placeholder:c,style:Object.assign({width:"100%"},s),step:f,min:g,max:v,controls:S,precision:y,autoFocus:b,stringMode:x,formatter:w,parser:C,bordered:d,readOnly:u,disabled:p,onBlur:()=>{Rn((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(N.current),h(N.current)}))},onKeyUp:e=>{var t;13===e.keyCode&&(m(i),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=T.current)||void 0===t||t.blur()))},onChange:e=>{const t=null!=e?e:"";!x&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{N.current=e,null==o||o(e),l(e,I(e))})(t)}})}));Yl.displayName="VInputNumber";class Xl extends r{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:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Yl,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(o,n)}}))),u&&t.createElement(F,null,e.renderFormItemButton(o,u)),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Xl.contextType=ao;const Zl=e=>{const{$$form:n}=t.useContext(ao),{value:r=[],onChange:i,onValuesChange:o}=e,{options:l={},placeholder:a=Bt("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:p=1,min:h=0,max:m,textAlign:f="left",controls:g=!0,precision:v,formatter:y,parser:b}=l,x=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),E(e)},E=e=>{const t=e.every((e=>null===e))?[]:[...e];null==i||i(t),o(t,S(t))},S=e=>fl(e)?"":e.map((e=>fl(e)?"":Number(e).toFixed(v))),w={[f]:!0,controls:g};return n.isOnlyShow?t.createElement($l,{value:S(r),bordered:s}):t.createElement(_.Group,null,t.createElement(j,{value:r[0],className:De("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:a[0],step:p,min:h,max:m,controls:g,precision:v,formatter:y,parser:b,bordered:s,readOnly:d,disabled:u,onChange:e=>{E([e,r[1]])},onBlur:()=>{x(r)}}),t.createElement(_,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t.createElement(j,{value:r[1],className:De("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:a[1],step:p,min:h,max:m,controls:g,precision:v,formatter:y,parser:b,bordered:s,readOnly:d,disabled:u,onChange:e=>{E([r[0],e])},onBlur:()=>{x(r)}}))};class Ql extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,labelWidth:a=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(s),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(a)},required:e.getFormItemRequired(u)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Zl,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(o,t)}}))),c&&t.createElement(F,{flex:Pn(c.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},c)))))}}var Jl;Ql.contextType=ao,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Jl||(Jl={}));const{Search:ea}=_;class ta extends r{constructor(e){var t;super(e),t=this,this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>En(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||Xt("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)||Xt("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Xt("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>En(this,void 0,void 0,(function*(){var e;yield this.props.waiting();const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:o,triggeredChange:l,fieldAliasMap:a,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof a?a():a||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(!t||kn(u))return this._prevValue=void 0;this.setState({loading:!0});try{const a=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=me(a.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&vl(e,this.alias,c),d&&yl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=gl(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==o||o([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)||[],o={[t]:r};return(Array.isArray(i)?i:[i]).forEach((e=>{if(se(e))for(const t in e)o[t]="function"==typeof e[t]?e[t](r):r;else o[e]=r})),o},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Nn,formatter:i=(e=>e)}=t.fetch;return new Promise(((o,l)=>En(this,void 0,void 0,(function*(){var a;const s=xe({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return l();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!==(a=me(e.data,t.fetch.dataKey))&&void 0!==a?a:[];o(n)}else l()}catch(e){l(e)}finally{Rn((()=>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=gl(e,this.alias[r]);void 0!==i&&(t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i))}for(const n in this.extras){const r=gl(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return En(t,void 0,void 0,(function*(){const{fieldName:t}=this.props.option,r=e.filter((e=>{var r;return null===(r=gl(e,this.alias[t]))||void 0===r?void 0:r.toString().toLowerCase().includes(n.toLowerCase())}));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(n)}))},this.openSearchHelper=(e,t)=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:Nn)(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)r!==n&&t.SET_FIELDS_VALUE({[r]:gl(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:gl(e,this.extras[n])});const r=gl(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});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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){var e;if(null===this._prevValue)return;const t=this.getItemValue();this._prevValue!==t&&t!==(null===(e=this._record)||void 0===e?void 0:e[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=t}render(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:o}=this.props,{type:l,fieldName:a,options:s={},searchHelper:c={},style:d={},placeholder:u=Bt("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:Bt("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Jl[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:Object.assign({},this.deriveParams,c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement($l,{value:o,bordered:p}):t.createElement(t.Fragment,null,t.createElement(ea,{ref:e=>this[`${l}_Ref`]=e,value:o,title:o,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,disabled:f,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:i=!0,table:o}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?i?(null===(t=null==o?void 0:o.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):Rn((()=>this.clearSearchHelperValue())))}}),t.createElement(lo,b,t.createElement(Qu,x)))}}ta.contextType=ao;class na extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:o}=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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:l}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Cl(Object.assign({},n.data,o),l,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(ta,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(l,t)}}))),p&&t.createElement(F,null,e.renderFormItemButton(l,p)),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}na.contextType=ao;const ra=e=>{class n extends r{constructor(){var e;super(...arguments),e=this,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,o=null==t?void 0:t.target,l=!i||!o,a=(null===(n=this.$el)||void 0===n?void 0:n.contains(i))||(null===(r=this.$el)||void 0===r?void 0:r.contains(o)),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(o);let u;u=!(l||a||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}}componentDidMount(){this.event1=It(document,"mousedown",this.mousedownHandler),this.event2=It(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,hn({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,hn({},e,{forwardedRef:r}))))};function ia(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 oa(e,t,n,r){var i=Pt.unstable_batchedUpdates?function(e){Pt.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)}}}var la=d((function(e,t){var n=e.didUpdate,r=e.getContainer,i=e.children,o=l(),a=l();u(t,(function(){return{}}));var c=l(!1);return!c.current&&Tr()&&(a.current=r(),o.current=a.current.parentNode,c.current=!0),s((function(){null==n||n(e)})),s((function(){return null===a.current.parentNode&&null!==o.current&&o.current.appendChild(a.current),function(){var e;null===(e=a.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(a.current)}}),[]),a.current?Pt.createPortal(i,a.current):null}));function aa(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var sa;function ca(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 da(t){var n=t.prefixCls,r=t.visible,i=t.zIndex,o=t.mask,l=t.maskMotion,a=t.maskAnimation,s=t.maskTransitionName;if(!o)return null;var c={};return(l||s||a)&&(c=Bn({motionAppear:!0},ca({motion:l,prefixCls:n,transitionName:s,animation:a}))),e.createElement(ti,ni({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:i},className:De("".concat(n,"-mask"),r)})}))}function ua(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 pa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ua(Object(n),!0).forEach((function(t){ma(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ua(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ha(e){return ha="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},ha(e)}function ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var fa={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function ga(){if(void 0!==sa)return sa;sa="";var e=document.createElement("p").style;for(var t in fa)t+"Transform"in e&&(sa=t);return sa}function va(){return ga()?"".concat(ga(),"TransitionProperty"):"transitionProperty"}function ya(){return ga()?"".concat(ga(),"Transform"):"transform"}function ba(e,t){var n=va();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function xa(e,t){var n=ya();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var Ea,Sa=/matrix\((.*)\)/,wa=/matrix3d\((.*)\)/;function Ca(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Ta(e,t,n){var r=n;if("object"!==ha(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):Ea(e,t);for(var i in t)t.hasOwnProperty(i)&&Ta(e,i,t[i])}function Na(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 Ia(e){return Na(e)}function Ra(e){return Na(e,!0)}function Oa(e){var t=function(e){var t,n,r,i=e.ownerDocument,o=i.body,l=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=l.clientLeft||o.clientLeft||0,top:r-=l.clientTop||o.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=Ia(r),t.top+=Ra(r),t}function ka(e){return null!=e&&e==e.window}function Aa(e){return ka(e)?e.document:9===e.nodeType?e:e.ownerDocument}var La=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),Pa=/^(top|right|bottom|left)$/,_a="currentStyle",Ha="runtimeStyle",Da="left";function Fa(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function $a(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function Ma(e,t,n){"static"===Ta(e,"position")&&(e.style.position="relative");var r=-999,i=-999,o=Fa("left",n),l=Fa("top",n),a=$a(o),s=$a(l);"left"!==o&&(r=999),"top"!==l&&(i=999);var c,d="",u=Oa(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[va()]||"",ba(e,"none")),"left"in t&&(e.style[a]="",e.style[o]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[l]="".concat(i,"px")),Ca(e);var p=Oa(e),h={};for(var m in t)if(t.hasOwnProperty(m)){var f=Fa(m,n),g="left"===m?r:i,v=u[m]-p[m];h[f]=f===m?g+v:g-v}Ta(e,h),Ca(e),("left"in t||"top"in t)&&ba(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=Fa(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}Ta(e,y)}function qa(e,t){var n=Oa(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(ya());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(ya());if(r&&"none"!==r){var i,o=r.match(Sa);o?((i=(o=o[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,xa(e,"matrix(".concat(i.join(","),")"))):((i=r.match(wa)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,xa(e,"matrix3d(".concat(i.join(","),")")))}else xa(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function ja(e,t){for(var n=0;n<e.length;n++)t(e[n])}function Va(e){return"border-box"===Ea(e,"boxSizing")}"undefined"!=typeof window&&(Ea=window.getComputedStyle?function(e,t,n){var r=n,i="",o=Aa(e);return(r=r||o.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[_a]&&e[_a][t];if(La.test(n)&&!Pa.test(t)){var r=e.style,i=r[Da],o=e[Ha][Da];e[Ha][Da]=e[_a][Da],r[Da]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[Da]=i,e[Ha][Da]=o}return""===n?"auto":n});var Ka=["margin","border","padding"],za=-1,Wa=2,Ba=1;function Ua(e,t,n){var r,i,o,l=0;for(i=0;i<t.length;i++)if(r=t[i])for(o=0;o<n.length;o++){var a=void 0;a="border"===r?"".concat(r).concat(n[o],"Width"):r+n[o],l+=parseFloat(Ea(e,a))||0}return l}var Ga={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 Ya(e,t,n){var r=n;if(ka(e))return"width"===t?Ga.viewportWidth(e):Ga.viewportHeight(e);if(9===e.nodeType)return"width"===t?Ga.docWidth(e):Ga.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),l=Va(e),a=0;(null==o||o<=0)&&(o=void 0,(null==(a=Ea(e,t))||Number(a)<0)&&(a=e.style[t]||0),a=Math.floor(parseFloat(a))||0),void 0===r&&(r=l?Ba:za);var s=void 0!==o||l,c=o||a;return r===za?s?c-Ua(e,["border","padding"],i):a:s?r===Ba?c:c+(r===Wa?-Ua(e,["border"],i):Ua(e,["margin"],i)):a+Ua(e,Ka.slice(r),i)}ja(["Width","Height"],(function(e){Ga["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],Ga["viewport".concat(e)](n))},Ga["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,i=r.body,o=r.documentElement[n];return"CSS1Compat"===r.compatMode&&o||i&&i[n]||o}}));var Xa={position:"absolute",visibility:"hidden",display:"block"};function Za(){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=Ya.apply(void 0,t):function(e,t,n){var r,i={},o=e.style;for(r in t)t.hasOwnProperty(r)&&(i[r]=o[r],o[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(o[r]=i[r])}(i,Xa,(function(){r=Ya.apply(void 0,t)})),r}function Qa(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}ja(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);Ga["outer".concat(t)]=function(t,n){return t&&Za(t,e,n?0:Ba)};var n="width"===e?["Left","Right"]:["Top","Bottom"];Ga[e]=function(t,r){var i=r;return void 0!==i?t?(Va(t)&&(i+=Ua(t,["padding","border"],n)),Ta(t,e,i)):void 0:t&&Za(t,e,za)}}));var Ja={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:Aa,offset:function(e,t,n){if(void 0===t)return Oa(e);!function(e,t,n){if(n.ignoreShake){var r=Oa(e),i=r.left.toFixed(0),o=r.top.toFixed(0),l=t.left.toFixed(0),a=t.top.toFixed(0);if(i===l&&o===a)return}n.useCssRight||n.useCssBottom?Ma(e,t,n):n.useCssTransform&&ya()in document.body.style?qa(e,t):Ma(e,t,n)}(e,t,n||{})},isWindow:ka,each:ja,css:Ta,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:Qa,getWindowScrollLeft:function(e){return Ia(e)},getWindowScrollTop:function(e){return Ra(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Ja.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Qa(Ja,Ga);var es=Ja.getParent;function ts(e){if(Ja.isWindow(e)||9===e.nodeType)return null;var t,n=Ja.getDocument(e).body,r=Ja.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:es(e);for(t=es(e);t&&t!==n&&9!==t.nodeType;t=es(t))if("static"!==(r=Ja.css(t,"position")))return t;return null}var ns=Ja.getParent;function rs(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=ts(e),i=Ja.getDocument(e),o=i.defaultView||i.parentWindow,l=i.body,a=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===l||r===a||"visible"===Ja.css(r,"overflow")){if(r===l||r===a)break}else{var s=Ja.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=ts(r)}var c=null;Ja.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Ja.css(e,"position")&&(e.style.position="fixed"));var d=Ja.getWindowScrollLeft(o),u=Ja.getWindowScrollTop(o),p=Ja.viewportWidth(o),h=Ja.viewportHeight(o),m=a.scrollWidth,f=a.scrollHeight,g=window.getComputedStyle(l);if("hidden"===g.overflowX&&(m=o.innerWidth),"hidden"===g.overflowY&&(f=o.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Ja.isWindow(e)||9===e.nodeType)return!1;var t=Ja.getDocument(e),n=t.body,r=null;for(r=ns(e);r&&r!==n&&r!==t;r=ns(r))if("fixed"===Ja.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+p),n.bottom=Math.min(n.bottom,u+h);else{var v=Math.max(m,d+p);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 is(e){var t,n,r;if(Ja.isWindow(e)||9===e.nodeType){var i=Ja.getWindow(e);t={left:Ja.getWindowScrollLeft(i),top:Ja.getWindowScrollTop(i)},n=Ja.viewportWidth(i),r=Ja.viewportHeight(i)}else t=Ja.offset(e),n=Ja.outerWidth(e),r=Ja.outerHeight(e);return t.width=n,t.height=r,t}function os(e,t){var n=t.charAt(0),r=t.charAt(1),i=e.width,o=e.height,l=e.left,a=e.top;return"c"===n?a+=o/2:"b"===n&&(a+=o),"c"===r?l+=i/2:"r"===r&&(l+=i),{left:l,top:a}}function ls(e,t,n,r,i){var o=os(t,n[1]),l=os(e,n[0]),a=[l.left-o.left,l.top-o.top];return{left:Math.round(e.left-a[0]+r[0]-i[0]),top:Math.round(e.top-a[1]+r[1]-i[1])}}function as(e,t,n){return e.left<n.left||e.left+t.width>n.right}function ss(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function cs(e,t,n){var r=[];return Ja.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function ds(e,t){return e[t]=-e[t],e}function us(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function ps(e,t){e[0]=us(e[0],t.width),e[1]=us(e[1],t.height)}function hs(e,t,n,r){var i=n.points,o=n.offset||[0,0],l=n.targetOffset||[0,0],a=n.overflow,s=n.source||e;o=[].concat(o),l=[].concat(l);var c={},d=0,u=rs(s,!(!(a=a||{})||!a.alwaysByViewport)),p=is(s);ps(o,p),ps(l,t);var h=ls(p,t,i,o,l),m=Ja.merge(p,h);if(u&&(a.adjustX||a.adjustY)&&r){if(a.adjustX&&as(h,p,u)){var f=cs(i,/[lr]/gi,{l:"r",r:"l"}),g=ds(o,0),v=ds(l,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(ls(p,t,f,g,v),p,u)||(d=1,i=f,o=g,l=v)}if(a.adjustY&&ss(h,p,u)){var y=cs(i,/[tb]/gi,{t:"b",b:"t"}),b=ds(o,1),x=ds(l,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(ls(p,t,y,b,x),p,u)||(d=1,i=y,o=b,l=x)}d&&(h=ls(p,t,i,o,l),Ja.mix(m,h));var E=as(h,p,u),S=ss(h,p,u);if(E||S){var w=i;E&&(w=cs(i,/[lr]/gi,{l:"r",r:"l"})),S&&(w=cs(i,/[tb]/gi,{t:"b",b:"t"})),i=w,o=n.offset||[0,0],l=n.targetOffset||[0,0]}c.adjustX=a.adjustX&&E,c.adjustY=a.adjustY&&S,(c.adjustX||c.adjustY)&&(m=function(e,t,n,r){var i=Ja.clone(e),o={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+o.width>n.right&&(o.width-=i.left+o.width-n.right),r.adjustX&&i.left+o.width>n.right&&(i.left=Math.max(n.right-o.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+o.height>n.bottom&&(o.height-=i.top+o.height-n.bottom),r.adjustY&&i.top+o.height>n.bottom&&(i.top=Math.max(n.bottom-o.height,n.top)),Ja.mix(i,o)}(h,p,u,c))}return m.width!==p.width&&Ja.css(s,"width",Ja.width(s)+m.width-p.width),m.height!==p.height&&Ja.css(s,"height",Ja.height(s)+m.height-p.height),Ja.offset(s,{left:m.left,top:m.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:i,offset:o,targetOffset:l,overflow:c}}function ms(e,t,n){var r=n.target||t,i=is(r),o=!function(e,t){var n=rs(e,t),r=is(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 hs(e,i,n,o)}ms.__getOffsetParent=ts,ms.__getVisibleRectForElement=rs;var fs=Tr()?e.useLayoutEffect:e.useEffect,gs=function(t,n){var r=e.useRef(!0);fs((function(){return t(r.current)}),n),fs((function(){return r.current=!1,function(){r.current=!0}}),[])};function vs(e,t){var n=null,r=null;var i=new Nt((function(e){var i=Gn(e,1)[0].target;if(document.documentElement.contains(i)){var o=i.getBoundingClientRect(),l=o.width,a=o.height,s=Math.floor(l),c=Math.floor(a);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 ys(e){return"function"!=typeof e?null:e()}function bs(e){return"object"===Vn(e)&&e?e:null}var xs=function(e,n){var r=e.children,i=e.disabled,o=e.target,l=e.align,a=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),p=t.useRef(),h=t.Children.only(r),m=t.useRef({});m.current.disabled=i,m.current.target=o,m.current.align=l,m.current.onAlign=a;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function o(){window.clearTimeout(i.current)}return[function t(l){if(o(),r.current&&!0!==l)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(l))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,o()}]}((function(){var e=m.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,o=p.current;if(!t&&n&&o){var l,a=ys(n),s=bs(n);u.current.element=a,u.current.point=s,u.current.align=r;var c=document.activeElement;return a&&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(),o=i.width,l=i.height;if(o||l)return!0}}return!1}(a)?l=ms(o,a,r):s&&(l=function(e,t,n){var r,i,o=Ja.getDocument(e),l=o.defaultView||o.parentWindow,a=Ja.getWindowScrollLeft(l),s=Ja.getWindowScrollTop(l),c=Ja.viewportWidth(l),d=Ja.viewportHeight(l),u={left:r="pageX"in t?t.pageX:a+t.clientX,top:i="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},p=r>=0&&r<=a+c&&i>=0&&i<=s+d,h=[n.points[0],"cc"];return hs(e,u,pa(pa({},n),{},{points:h}),p)}(o,s,r)),function(e,t){e!==document.activeElement&&ia(t,e)&&"function"==typeof e.focus&&e.focus()}(c,o),i&&l&&i(o,l),!0}return!1}),d),g=Gn(f,2),v=g[0],y=g[1],b=Gn(t.useState(),2),x=b[0],E=b[1],S=Gn(t.useState(),2),w=S[0],C=S[1];return gs((function(){E(ys(o)),C(bs(o))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=w)||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 o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=r.has(t);if(on(!l,"Warning: There may be circular references"),l)return!1;if(t===i)return!0;if(n&&o>1)return!1;r.add(t);var a=o+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],a))return!1;return!0}if(t&&i&&"object"===Vn(t)&&"object"===Vn(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every((function(n){return e(t[n],i[n],a)}))}return!1}(e,t)}(u.current.align,l)||v()})),t.useEffect((function(){return vs(p.current,v)}),[p.current]),t.useEffect((function(){return vs(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return oa(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:tr(h.ref,p)})),h},Es=t.forwardRef(xs);function Ss(){Ss=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:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",a=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 o=t&&t.prototype instanceof p?t:p,l=Object.create(o.prototype),a=new T(i||[]);return r(l,"_invoke",{value:E(e,n,a)}),l}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 p(){}function h(){}function m(){}var f={};s(f,o,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(N([])));v&&v!==t&&n.call(v,o)&&(f=v);var y=m.prototype=p.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,o,l,a){var s=d(e[r],e,o);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==Vn(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,l,a)}),(function(e){i("throw",e,l,a)})):t.resolve(u).then((function(e){c.value=e,l(c)}),(function(e){return i("throw",e,l,a)}))}a(s.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var l=n.delegate;if(l){var a=S(l,n);if(a){if(a===u)continue;return a}}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 S(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,S(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 o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function w(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function N(e){if(e){var t=e[o];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=m,r(y,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:h,configurable:!0}),h.displayName=s(m,a,"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,m):(e.__proto__=m,s(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,l,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var l=new x(c(t,n,r,i),o);return e.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},b(y),s(y,a,"Generator"),s(y,o,(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=N,T.prototype={constructor:T,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(C),!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 l.type="throw",l.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 o=this.tryEntries[i],l=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.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 o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var l=o?o.completion:{};return l.type=e,l.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(l)},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),C(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;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function ws(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(r,i)}function Cs(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function l(e){ws(o,r,i,l,a,"next",e)}function a(e){ws(o,r,i,l,a,"throw",e)}l(void 0)}))}}Es.displayName="Align";var Ts=["measure","alignPre","align",null,"motion"],Ns=e.forwardRef((function(t,n){var r=t.visible,i=t.prefixCls,o=t.className,a=t.style,c=t.children,d=t.zIndex,u=t.stretch,h=t.destroyPopupOnHide,m=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,S=t.onMouseDown,w=t.onTouchStart,C=t.onClick,T=l(),N=l(),I=Gn(p(),2),R=I[0],O=I[1],k=function(t){var n=Gn(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(),o=r.width,l=r.height;Math.abs(t-o)<1&&Math.abs(n-l)<1&&(t=o,n=l),i({width:t,height:n})}]}(u),A=Gn(k,2),L=A[0],P=A[1];var _=function(e,t){var n=Gn(mr(null),2),r=n[0],i=n[1],o=l();function a(e){i(e,!0)}function c(){Gr.cancel(o.current)}return s((function(){a("measure")}),[e]),s((function(){"measure"===r&&t(),r&&(o.current=Gr(Cs(Ss().mark((function e(){var t,n;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Ts.indexOf(r),(n=Ts[t+1])&&-1!==t&&a(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),s((function(){return function(){c()}}),[]),[r,function(e){c(),o.current=Gr((function(){a((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){u&&P(v())})),H=Gn(_,2),D=H[0],F=H[1],$=Gn(p(0),2),M=$[0],q=$[1],j=l();function V(){var e;null===(e=T.current)||void 0===e||e.forceAlign()}function K(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===D&&(null==b||b(e,t))}gs((function(){"alignPre"===D&&q(0)}),[D]),gs((function(){"align"===D&&(M<3?V():F((function(){var e;null===(e=j.current)||void 0===e||e.call(j)})))}),[M]);var z=Bn({},ca(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 F(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==D||F()}),[z.motionName,D]),e.useImperativeHandle(n,(function(){return{forceAlign:V,getElement:function(){return N.current}}}));var B=Bn(Bn({},L),{},{zIndex:d,opacity:"motion"!==D&&"stable"!==D&&r?0:void 0,pointerEvents:r||"stable"===D?void 0:"none"},a),U=!0;null==f||!f.points||"align"!==D&&"stable"!==D||(U=!1);var G=c;return e.Children.count(c)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},c)),e.createElement(ti,ni({visible:r,ref:N,leavedClassName:"".concat(i,"-hidden")},z,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:h,forceRender:m}),(function(t,n){var r=t.className,l=t.style,a=De(i,o,R,r);return e.createElement(Es,{target:g||v,key:"popup",ref:T,monitorWindowResize:!0,disabled:U,align:f,onAlign:K},e.createElement("div",{ref:n,className:a,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:S,onTouchStartCapture:w,onClick:C,style:Bn(Bn({},l),B)},G))}))}));Ns.displayName="PopupInner";var Is=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,o=t.zIndex,l=t.children,a=t.mobile,s=(a=void 0===a?{}:a).popupClassName,c=a.popupStyle,d=a.popupMotion,u=void 0===d?{}:d,p=a.popupRender,h=t.onClick,m=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return m.current}}}));var f=Bn({zIndex:o},c),g=l;return e.Children.count(l)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},l)),p&&(g=p(g)),e.createElement(ti,ni({visible:i,ref:m,removeOnLeave:!0},u),(function(t,n){var i=t.className,o=t.style,l=De(r,s,i);return e.createElement("div",{ref:n,className:l,onClick:h,style:Bn(Bn({},o),f)},g)}))}));Is.displayName="MobilePopupInner";var Rs=["visible","mobile"],Os=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,o=rr(t,Rs),l=Gn(p(r),2),a=l[0],c=l[1],d=Gn(p(!1),2),u=d[0],h=d[1],m=Bn(Bn({},o),{},{visible:a});s((function(){c(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=u?e.createElement(Is,ni({},m,{mobile:i,ref:n})):e.createElement(Ns,ni({},m,{ref:n}));return e.createElement("div",null,e.createElement(da,m),f)}));Os.displayName="Popup";var ks=e.createContext(null);function As(){}function Ls(){return""}function Ps(e){return e?e.ownerDocument:window.document}var _s=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var Hs=function(t){var n=function(n){cr(i,e.Component);var r=pr(i);function i(t){var n,o;return or(this,i),zn(ur(n=r.call(this,t)),"popupRef",e.createRef()),zn(ur(n),"triggerRef",e.createRef()),zn(ur(n),"portalContainer",void 0),zn(ur(n),"attachId",void 0),zn(ur(n),"clickOutsideHandler",void 0),zn(ur(n),"touchOutsideHandler",void 0),zn(ur(n),"contextMenuOutsideHandler1",void 0),zn(ur(n),"contextMenuOutsideHandler2",void 0),zn(ur(n),"mouseDownTimeout",void 0),zn(ur(n),"focusTime",void 0),zn(ur(n),"preClickTime",void 0),zn(ur(n),"preTouchTime",void 0),zn(ur(n),"delayTimer",void 0),zn(ur(n),"hasPopupMouseDown",void 0),zn(ur(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),zn(ur(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),zn(ur(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),zn(ur(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),zn(ur(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&ia(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),zn(ur(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),zn(ur(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),zn(ur(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),zn(ur(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),zn(ur(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),zn(ur(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),zn(ur(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)})),zn(ur(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)})),zn(ur(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();ia(r,t)&&!n.isContextMenuOnly()||ia(i,t)||n.hasPopupMouseDown||n.close()}})),zn(ur(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=Xn(n.triggerRef.current);if(t)return t}catch(e){}return Pt.findDOMNode(ur(n))})),zn(ur(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,o=r.builtinPlacements,l=r.prefixCls,a=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&o&&t.push(function(e,t,n,r){for(var i=n.points,o=Object.keys(e),l=0;l<o.length;l+=1){var a=o[l];if(aa(e[a].points,i,r))return"".concat(t,"-placement-").concat(a)}return""}(o,l,e,a)),s&&t.push(s(e)),t.join(" ")})),zn(ur(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,o=t.popupClassName,l=t.onPopupAlign,a=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,p=t.maskAnimation,h=t.maskTransitionName,m=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,S=n.state,w=S.popupVisible,C=S.point,T=n.getPopupAlign(),N={};return n.isMouseEnterToShow()&&(N.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(N.onMouseLeave=n.onPopupMouseLeave),N.onMouseDown=n.onPopupMouseDown,N.onTouchStart=n.onPopupMouseDown,e.createElement(Os,ni({prefixCls:r,destroyPopupOnHide:i,visible:w,point:y&&C,className:o,align:T,onAlign:l,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},N,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:p,maskTransitionName:h,maskMotion:m,ref:n.popupRef,motion:a,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),zn(ur(n),"attachParent",(function(e){Gr.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,o=r.getDocument,l=n.getRootDomNode();i?(l||0===i.length)&&(t=i(l)):t=o(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=Gr((function(){n.attachParent(e)}))})),zn(ur(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})),zn(ur(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),zn(ur(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),zn(ur(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),o="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:o,popupVisible:o},_s.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return ar(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=oa(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=oa(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=oa(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=oa(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),Gr.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 Bn(Bn({},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 o=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,o),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,o=r.forceRender,l=r.alignPoint,a=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,l&&(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=De(c&&c.props&&c.props.className,a);u&&(d.className=u);var p=Bn({},d);nr(c)&&(p.ref=tr(this.triggerRef,c.ref));var h,m=e.cloneElement(c,p);return(n||this.popupRef.current||o)&&(h=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(h=null),e.createElement(ks.Provider,{value:this.triggerContextValue},m,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 zn(n,"contextType",ks),zn(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Ls,getDocument:Ps,onPopupVisibleChange:As,afterPopupVisibleChange:As,onPopupAlign:As,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}(la);let Ds=class extends r{constructor(e){var n;super(e),n=this,this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>En(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Xt("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Xt("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=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:r}=n.alias;n.setRecords(Ee([...n._records.filter((e=>t.includes(e[r]))),...e],r));const i=n.recordsToDict();n.setItemList(i),n.triggerChange(i.map((e=>e.value)));const{closed:o}=n.searchHelper;n.setVisible(!1,(()=>{setTimeout((()=>null==o?void 0:o(n._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;ge(Se(n,r),r)||ge(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return En(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:o={},formatter:l=(e=>e),dataKey:a,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&&!kn(u)){this.setState({loading:!0});try{const e=yield i(l(Object.assign(Object.assign({},o),{keys:u})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=me(e.data,a))&&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 o=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(o),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:o,visible2:l,loading:a,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=Bt("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:o,title:Bt("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Jl[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},S=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:xe({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),w=s.filter((e=>null==c?void 0:c.includes(e.value))),T=t.createElement("ul",{className:"ant-dropdown-menu"},w.length?w.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},Bt("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=Fn("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($l,{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(Hs,{popupVisible:!y&&l,popup:T,popupClassName:De(O),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:al,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement($,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:a,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($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:y,icon:t.createElement(We,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(lo,E,t.createElement(Qu,S)))}};Ds.contextType=ao,Ds=xn([ra],Ds);class Fs extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:o}=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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:l}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Cl(Object.assign({},n.data,o),l,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ds,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(l,n)}}))),p&&t.createElement(F,null,e.renderFormItemButton(l,p)),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Fs.contextType=ao;const{Search:$s}=_;class Ms extends r{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>En(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||Xt("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)||Xt("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Xt("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>En(this,void 0,void 0,(function*(){var e;yield this.props.waiting();const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:o,triggeredChange:l,fieldAliasMap:a,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof a?a():a||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(!t||kn(u))return this._prevValue=void 0;this.setState({loading:!0});try{const a=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=me(a.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&vl(e,this.alias,c),d&&yl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=gl(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==o||o([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=gl(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:gl(e,this.extras[n])})},this.openSearchHelper=e=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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)r!==n&&t.SET_FIELDS_VALUE({[r]:gl(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:gl(e,this.extras[n])});const r=gl(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});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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){var e;if(null===this._prevValue)return;const t=this.getItemValue();this._prevValue!==t&&t!==(null===(e=this._record)||void 0===e?void 0:e[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=t}render(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:o=""}=this.props,{type:l,fieldName:a,options:s={},searchHelper:c={},style:d={},placeholder:u=Bt("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:Bt("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Jl[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:xe({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement($l,{value:o,bordered:p}):t.createElement(t.Fragment,null,t.createElement($s,{ref:e=>this[`${l}_Ref`]=e,value:o,title:o,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,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(lo,b,t.createElement(np,x)))}}Ms.contextType=ao;class qs extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:o}=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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:l}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Cl(Object.assign({},n.data,o),l,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ms,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(l,t)}}))),p&&t.createElement(F,null,e.renderFormItemButton(l,p)),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}qs.contextType=ao;let js=class extends r{constructor(e){var n;super(e),n=this,this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>En(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Xt("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Xt("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=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:r}=n.alias;n.setRecords(Ee([...n._records.filter((e=>t.includes(e[r]))),...e],r));const i=n.recordsToDict();n.setItemList(i),n.triggerChange(i.map((e=>e.value)));const{closed:o}=n.searchHelper;n.setVisible(!1,(()=>{setTimeout((()=>null==o?void 0:o(n._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;ge(Se(n,r),r)||ge(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return En(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:o={},formatter:l=(e=>e),dataKey:a,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&&!kn(d)){this.setState({loading:!0});try{const e=yield i(l(Object.assign(Object.assign({},o),{keys:d})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=me(e.data,a))&&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 o=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(o),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:o,visible2:l,loading:a,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=Bt("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:o,title:Bt("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Jl[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},S=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:xe({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),w=s.filter((e=>null==c?void 0:c.includes(e.value))),T=t.createElement("ul",{className:"ant-dropdown-menu"},w.length?w.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},Bt("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=Fn("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($l,{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(Hs,{popupVisible:!y&&l,popup:T,popupClassName:De(O),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:al,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement($,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:a,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($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:y,icon:t.createElement(We,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(lo,E,t.createElement(np,S)))}};js.contextType=ao,js=xn([ra],js);class Vs extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:o}=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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:l}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Cl(Object.assign({},n.data,o),l,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(js,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(l,n)}}))),p&&t.createElement(F,null,e.renderFormItemButton(l,p)),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Vs.contextType=ao;const Ks=new Array(2).fill("");class zs extends r{constructor(e){var t;super(e),t=this,this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:Ks},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>En(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Xt("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Xt("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(Ks),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=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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]:kn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Nn,formatter:i=(e=>e)}=t.fetch;return new Promise(((o,l)=>En(this,void 0,void 0,(function*(){var a;const s=xe({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return l();this.setState({loading:!0});const e=yield t.fetch.api(s);if(Rn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=me(e.data,t.fetch.dataKey))&&void 0!==a?a:[];return o(n)}}catch(e){this.setState({loading:!1})}l()}))))},this.resetSearchHelperValue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return En(t,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;ge(Se(t,n),n)||ge(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!ge(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=Ks.map(((e,t)=>{var o,l;return null!==(l=null===(o=r[i].find((e=>e.value===n[t])))||void 0===o?void 0:o.text)&&void 0!==l?l:""}));this.setTextValue(e)}}getItemList(){var e;return En(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:i={},formatter:o=(e=>e),dataKey:l,fieldAliasMap:a}=this.searchHelper.echoRequest||{},s="function"==typeof a?a():a||{},{value:c}=this.props;if(r&&!kn(c)){this.setState({loading:!0});try{const a=yield r(o(Object.assign(Object.assign({},i),{keys:c})));if(200===a.code){let r=Array.isArray(a.data)?a.data:null!==(e=me(a.data,l))&&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:o}=this.state,{fieldName:l,options:a={},searchHelper:s={},placeholder:c=Bt("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=o.every((e=>fl(e)))?"":o.join(" - "),f={visible:r,title:Bt("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${Jl[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:xe({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement($l,{value:m,bordered:d}):t.createElement(t.Fragment,null,t.createElement(_.Group,null,t.createElement(_,{value:o[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?o.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(o).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):o.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,o[1]]))}}),t.createElement(_,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),t.createElement(_.Search,{value:o[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:i,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?o.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(o).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):o.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([o[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(lo,f,t.createElement(lp,g)))}}zs.contextType=ao;class Ws extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:o}=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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:l}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Cl(Object.assign({},n.data,o),l,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(c),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(zs,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{m(t,r),e.setViewValue(l,n)}}))),u&&t.createElement(F,null,e.renderFormItemButton(l,u)),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Ws.contextType=ao;const Bs=e=>{const{$$form:n}=t.useContext(ao),{value:r,items:i,onChange:o,onValuesChange:l}=e,{options:a={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=a,h=kn(p)?i:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement($l,{value:m(r),bordered:c}):t.createElement(M.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==o||o(e),l(e,m(e))})(e)}},h.map((e=>t.createElement(M,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Us extends r{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;ge(r,i)||this.getItemList()}getItemList(){var e;return En(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:o="value",textKey:l="text",callback:a}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[o],text:e[l]})));this.setState({itemList:r},(()=>null==a?void 0:a(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Bs,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Us.contextType=ao;const Gs=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{options:l={},style:a={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=l,m=e=>h?h[Math.ceil(e)-1]:e.toString();return t.createElement(V,{value:r,count:p,style:a,allowHalf:u,allowClear:s,tooltips:h,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==i||i(e),o(e,m(e))})(e)}})};class Ys extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Gs,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Ys.contextType=ao;const Xs=e=>{const{$$form:n}=t.useContext(ao),{value:r,items:i,onChange:o,onValuesChange:l}=e,{options:a={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:p=[]}=a,h=kn(p)?i:p,m=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($l,{value:m(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==o||o(e),l(e,m(e))})(t)}},h.map((e=>t.createElement(K,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Zs extends r{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:o="value",textKey:l="text",callback:a}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[o],text:e[l]})));this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Xs,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Zs.contextType=ao;const Qs=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{label:l,options:a={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=il,trueValue:h=rl}=a;return t.createElement(t.Fragment,null,t.createElement(z,{checked:r===h,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement(Be,null),unCheckedChildren:t.createElement(Ue,null),onChange:e=>{(e=>{null==i||i(e),o(e,Bt(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class Js extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option,{labelToSwitch:m}=a;return t.createElement(H.Item,{label:m?" ":e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Qs,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Js.contextType=ao;const ec=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{options:l={},style:a={},placeholder:s=Bt("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p,onBlur:h=Tn,onEnter:m=Tn}=e.option,{showCount:f,maxLength:g,autoSize:v}=l,y=Object.assign({},{minRows:1,maxRows:3},v);return t.createElement(_.TextArea,{value:r,placeholder:s,style:a,maxLength:g,showCount:f,autoSize:y,bordered:c,allowClear:d,readOnly:u||n.isOnlyShow,disabled:p,onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),h(n)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;m(t)}},onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),o(e)})(t)}})};class tc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ec,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(o,t)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}tc.contextType=ao;const nc=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{fieldName:l,options:a={},style:s={},placeholder:c=Bt("qm.form.datePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{dateType:m="date",format:f,disabledDate:v,minDateTime:y,maxDateTime:b,shortCuts:x=!0}=a,E=t.createRef(),S=e=>{e&&"date"===m&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),o(e,w(e))},w=e=>fl(e)?"":["date","exactdate"].includes(m)?e.slice(0,10):e,C=e=>{let t=ml(g().subtract(e,"day"),cl[m]);"date"===m&&(t=t.slice(0,10)),S(t),E.current.blur(),E.current.focus()};return n.isOnlyShow?t.createElement($l,{value:w(r),bordered:d}):t.createElement(pn,{ref:E,style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${l}`,picker:sl[m],format:f,bordered:d,showToday:!1,showTime:"datetime"===m&&{defaultValue:g("00:00:00","HH:mm:ss")},allowClear:u,disabled:h,inputReadOnly:p,disabledDate:null!=v?v:e=>((e,t)=>{let[n,r]=t;return n&&r?e.isBefore(n,"day")||e.isAfter(r,"day"):n?e.isBefore(n,"day"):!!r&&e.isAfter(r,"day")})(e,[y,b]),renderExtraFooter:x&&m.includes("date")?()=>"function"==typeof x?x():t.createElement(t.Fragment,null,t.createElement(W,{color:"processing",onClick:()=>C(0)},Bt("qm.form.datePickers")[0]),t.createElement(W,{color:"processing",onClick:()=>C(1)},Bt("qm.form.datePickers")[1]),t.createElement(W,{color:"processing",onClick:()=>C(7)},Bt("qm.form.datePickers")[2]),t.createElement(W,{color:"processing",onClick:()=>C(30)},Bt("qm.form.datePickers")[3])):void 0,value:hl(r,cl[m]),onChange:(e,t)=>{S(ml(e,cl[m]))}})};class rc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(nc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}rc.contextType=ao;const ic=e=>[g().subtract(e,"day"),g()],oc=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{fieldName:l,options:a={},style:s={},placeholder:c=Bt("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=n.isFormDisabled}=e.option,{dateType:m="date",format:f,disableds:v=[!1,!1],allowEmpty:y,disabledDate:b,minDateTime:x,maxDateTime:E,shortCuts:S=!0}=a,w={[Bt("qm.form.dateRangePickers")[0]]:ic(7),[Bt("qm.form.dateRangePickers")[1]]:ic(30),[Bt("qm.form.dateRangePickers")[2]]:ic(90),[Bt("qm.form.dateRangePickers")[3]]:ic(180)},C=e=>fl(e)?"":e.map((e=>["date","exactdate"].includes(m)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement($l,{value:C(r),bordered:d}):t.createElement(pn.RangePicker,{style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${l}`,picker:sl[m],format:f,bordered:d,showTime:"datetime"===m&&{defaultValue:[g("00:00:00","HH:mm:ss"),g("23:59:59","HH:mm:ss")]},allowClear:u,allowEmpty:y,disabled:h?[!0,!0]:v,inputReadOnly:p,disabledDate:null!=b?b:e=>((e,t)=>{let[n,r]=t;return n&&r?e.isBefore(n,"day")||e.isAfter(r,"day"):n?e.isBefore(n,"day"):!!r&&e.isAfter(r,"day")})(e,[x,E]),ranges:S&&m.includes("date")?w:void 0,value:kn(r)?null:[hl(null==r?void 0:r[0],cl[m]),hl(null==r?void 0:r[1],cl[m])],onChange:(e,t)=>{(e=>{"date"===m&&(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),o(e,C(e))})([ml(null==e?void 0:e[0],cl[m]),ml(null==e?void 0:e[1],cl[m])])}})};class lc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(oc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}lc.contextType=ao;const ac=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{fieldName:l,options:a={},style:s={},placeholder:c=Bt("qm.form.timePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:v=1}=a;return n.isOnlyShow?t.createElement($l,{value:r,bordered:d}):t.createElement(mn,{style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${l}`,bordered:d,showNow:!0,hourStep:f,minuteStep:g,secondStep:v,allowClear:u,disabled:h,inputReadOnly:p,format:dl[m],value:hl(r,dl[m]),onChange:(e,t)=>{(e=>{const t=ml(e,dl[m]);null==i||i(t),o(t)})(e)}})};class sc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ac,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(o,t)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}sc.contextType=ao;const cc=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{fieldName:l,options:a={},style:s={},placeholder:c=Bt("qm.form.timerangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=n.isFormDisabled}=e.option,{timeType:m="hour-minute-second",disableds:f=[!1,!1],allowEmpty:g,hourStep:v=1,minuteStep:y=1,secondStep:b=1}=a,x=e=>fl(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement($l,{value:x(r),bordered:d}):t.createElement(mn.RangePicker,{style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${l}`,bordered:d,showNow:!1,hourStep:v,minuteStep:y,secondStep:b,allowClear:u,allowEmpty:g,disabled:h?[!0,!0]:f,inputReadOnly:p,format:dl[m],value:kn(r)?null:[hl(null==r?void 0:r[0],dl[m]),hl(null==r?void 0:r[1],dl[m])],onChange:(e,t)=>{(e=>{const t=[ml(null==e?void 0:e[0],dl[m]),ml(null==e?void 0:e[1],dl[m])];null==i||i(t),o(t,x(t))})(e)}})};class dc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(cc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}dc.contextType=ao;class uc extends r{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=kt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.initialHandle=()=>En(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:o}=this.searchHelper;if(r||Xt("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)||Xt("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),o&&!this.valueKey&&Xt("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&Xt("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getItemText=()=>En(this,void 0,void 0,(function*(){var e;yield this.props.waiting();const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:o,triggeredChange:l,fieldAliasMap:a,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof a?a():a||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(!t||kn(u))return this._prevValue=void 0;try{const a=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=me(a.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&vl(e,this.alias,c),d&&yl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=gl(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==o||o([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=gl(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:gl(e,this.extras[n])})},this.fetchHandle=we(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)t!==r&&n.SET_FIELDS_VALUE({[t]:gl(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:gl(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=gl(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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){var t,n,r,i,o,l,a;const s=(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),c=(null===(o=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===o?void 0:o.params)||(null===(l=this.props.option.request)||void 0===l?void 0:l.params);if(ge(s,c)||this.getItemList(),null===this._prevValue)return;const d=this.getItemValue();this._prevValue!==d&&d!==(null===(a=this._record)||void 0===a?void 0:a[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=d}getItemList(e){var t;return En(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:i={},formatter:o=(e=>e),dataKey:l}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const a=yield r(o(Object.assign(Object.assign({},i),{[n]:e})));if(200===a.code){const e=Array.isArray(a.data)?a.data:null!==(t=me(a.data,l))&&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:o}=this.state,{value:l}=this.props,{fieldName:a,options:s={},style:c={},placeholder:d=Bt("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=ol}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=Fn("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t.createElement(R,{spinning:r},i.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:De("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},me(e,n.dataIndex))))))))):t.createElement(Pi,null));return t.createElement(Vt.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($l,{value:l,bordered:u}):t.createElement(Hs,{action:m?[]:["click"],popupVisible:!m&&n,popup:E,popupClassName:De(s,`form-popper__${a}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:al,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(_,{ref:this.searchRef,placeholder:d,allowClear:p,bordered:u,readOnly:h,disabled:m,style:Object.assign({width:"100%"},c),value:null!=o?o:l,title:l,onFocus:()=>{!i.length&&this.fetchHandle(l)},onBlur:e=>{v&&!this._clicking&&o!==l&&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)}})))}))}}uc.contextType=ao;class pc extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:o}=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 Xt("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:l}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Cl(Object.assign({},n.data,o),l,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:o,fieldName:l,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:De(d),tooltip:o,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(uc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(l,t)}}))),p&&t.createElement(F,null,e.renderFormItemButton(l,p)),u&&t.createElement(F,{flex:Pn(u.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}pc.contextType=ao;class hc extends r{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:o,className:l,style:a={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:p=Tn}=s,h=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===o)))&&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}:`:"",o=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==o&&h.push(Object.assign(Object.assign({},e),{text:`${i}${o}`}))}))}return t.createElement(H.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement($n,{id:o,label:i,className:l,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},a),collapse:c[o],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[o]:e})}))),p(e)}}))}}hc.contextType=ao;const mc=(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:mc(e.children,t,n,r)}):e)),fc=e=>{const{$$form:n}=t.useContext(ao),{value:r,items:i,multiple:o,loading:l,onChange:a,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=Bt("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:f,readOnly:g,disabled:v}=e.option,{itemList:y,filterable:b=!0,listHeight:x=ol,checkStrictly:E,checkStrategy:S="SHOW_CHILD",collapseTags:w,defaultExpandAll:C=!f,defaultExpandedKeys:T,dropdownStyle:N,openPyt:I=!0}=d,[R,O]=t.useState(kn(y)?i:y),k=t.useRef(R);fi((()=>{const e=kn(y)?i:y;f?ge(e,k.current)||(O(e),k.current=e):O(e)}),[y,i]);const A=e=>{var t;return(null===(t=xl(R,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},L=e=>o?(null==e?void 0:e.map((e=>A(e))).join(","))||"":A(e);return n.isOnlyShow?t.createElement($l,{value:L(r),bordered:h}):t.createElement(B,hn({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:o,treeCheckable:o,treeCheckStrictly:E,showCheckedStrategy:B[S],popupClassName:`form-popper__${c}`,dropdownStyle:N,placeholder:p,listHeight:x,style:u,loading:l,bordered:h,allowClear:m,disabled:v,treeDefaultExpandAll:C,treeDefaultExpandedKeys:T,showSearch:b,maxTagCount:w?"responsive":void 0,loadData:f?e=>{let{key:t,children:n}=e;return En(void 0,void 0,void 0,(function*(){var e;if(!f||n)return;const{fetchApi:r,params:i,dataKey:o,textKey:l="text",valueKey:a="value",callback:s,formatter:c=(e=>e)}=f;if(r)try{const n=yield r(c(Object.assign(Object.assign({},i),{[a]:t})));if(200===n.code){const r=Array.isArray(n.data)?n.data:null!==(e=me(n.data,o))&&void 0!==e?e:[],i=mc(R,t,a,bl(r,a,l));O(i),null==s||s(r)}}catch(e){}}))}:void 0,treeData:R},o?{title:L(r)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=Dl.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(I?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==a||a(e),s(e,L(e),R)})(e)}}))};class gc extends r{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:o="value",textKey:l="text",callback:a}=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=me(t.data,i))&&void 0!==e?e:[],r=bl(n,o,l);this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:o,tooltip:l,fieldName:a,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(o),className:De(u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Pn(d)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(o)}},t.createElement(fc,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(a,n)}}))),p&&t.createElement(F,{flex:Pn(p.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:a},p)))))}}gc.contextType=ao;const vc=e=>{const{$$form:n}=t.useContext(ao),{value:r,multiple:i,items:o}=e,{fieldName:l,options:a={},style:s={},placeholder:c=Bt("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,asyncLoad:p,readOnly:h,disabled:m}=e.option,{itemList:f,changeOnSelect:g,checkStrictly:v,checkStrategy:y="SHOW_PARENT",filterable:b=!0,dropdownStyle:x,openPyt:E=!0}=a,[S,w]=t.useState(kn(f)?o:f),C=t.useRef(S);fi((()=>{const e=kn(f)?o:f;p?ge(e,C.current)||(w(e),C.current=e):w(e)}),[f,o]);const T=e=>El(S,null!=e?e:"").map((e=>e.text)).join("/"),N=e=>i?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement($l,{value:N(r),bordered:d}):t.createElement(U,hn({value:(e=>kn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:S,multiple:i,maxTagCount:"responsive",changeOnSelect:g||v,showCheckedStrategy:U[y],popupClassName:`form-popper__${l}`,dropdownStyle:x,placeholder:c,style:s,bordered:d,allowClear:u,disabled:m,showSearch:b&&!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())||"",i=Dl.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(E?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?e=>En(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!p||n.children)return;const{fetchApi:r,params:i,dataKey:o,textKey:l="text",valueKey:a="value",callback:s,formatter:c=(e=>e)}=p;if(r)try{const e=yield r(c(Object.assign(Object.assign({},i),{[a]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=me(e.data,o))&&void 0!==t?t:[],i=mc(S,n.value,a,bl(r,a,l));w(i),null==s||s(r)}}catch(e){}})):void 0},i?{title:N(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,N(t),S)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return i?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class yc extends r{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:o="value",textKey:l="text",callback:a}=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=me(t.data,i))&&void 0!==e?e:[],r=bl(n,o,l);this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:i,label:o,tooltip:l,fieldName:a,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(o),className:De(u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Pn(d)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(o)}},t.createElement(vc,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(a,n)}}))),p&&t.createElement(F,{flex:Pn(p.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:a},p)))))}}yc.contextType=ao;const bc=["110000","120000","310000","500000"],xc=["810000","820000"],Ec=[{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"}],Sc=[{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"}],wc=e=>Dl.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Cc=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...bc,...xc].includes(e))):Object.keys(e[t])).map((r=>({l:wc(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:Cc(e,r,n+1)})))},Tc=(e,t)=>t.map((t=>({l:wc(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Nc extends r{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}),Rt(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:Tc(jt,bc)},{l:"Z2",n:"港澳",c:"",p:"",children:Tc(jt,xc)}]}createProvince(){var e;return(null!==(e=Cc(jt,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Sc.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...bc,...xc].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"},Bt("qm.form.citySelectType.0")),t.createElement(K.Button,{value:"1"},Bt("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?Ec:Sc).map((n=>t.createElement("li",{key:n.value,className:De({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement($,{size:"small",placeholder:Bt("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($.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:De({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:o={},style:l={},placeholder:a=Bt("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=Fn("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},l)},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(Vt.Consumer,null,(r=>{const o={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement($l,{value:m,bordered:s}):t.createElement(Hs,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:De(o,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:al,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(_,{ref:this.searchRef,placeholder:a,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},l),value:m,title:m,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Nc.contextType=ao;class Ic extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Nc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Ic.contextType=ao;const Rc=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Rc(e,n)})))};class Oc extends r{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=Rc(jt,"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=xl(e,t[r]);if(i&&kn(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 En(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:i=(e=>e),dataKey:o,valueKey:l="value",textKey:a="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=me(n.data,o))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[a],value:e[l]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var i;const o=(null===(i=n.find((t=>t.value===e[r])))||void 0===i?void 0:i.text)||`${Bt("qm.form.selectPlaceholder").replace("...","")}(${Bt("qm.form.regionSelectLabel")[r]})`;return t.createElement(no.TabPane,{key:r.toString(),tab:o},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:De({"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(no,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(Pi,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:o={},style:l={},placeholder:a=Bt("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=Fn("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=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(Vt.Consumer,null,(r=>{const o={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement($l,{value:f,bordered:s}):t.createElement(Hs,{action:u?[]:["click"],popupVisible:!u&&n,popup:m,popupClassName:De(o,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:al,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(_,{ref:this.searchRef,placeholder:a,allowClear:c,bordered:s,style:Object.assign({width:"100%"},l),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&Rn((()=>this.initial()))}})))}))}}Oc.contextType=ao;class kc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Oc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(o,n)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}kc.contextType=ao;const Ac=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{options:l={},upload:a={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fileTypes:h,fileSize:m,fileDirection:f,onPreview:g,onRemove:v}=l,{action:y,headers:b,params:x,withCredentials:E=!1,dataKey:S="",downloadWithHeaders:w,fieldAliasMap:C,beforeUpload:T,button:N}=a,I="function"==typeof C?C():C||{};return t.createElement(Xi,{name:"file",action:y,multiple:u,headers:b,data:x,withCredentials:E,downloadWithHeaders:w,beforeUpload:T,maxCount:p,fileTypes:h,fileSize:m,fileDirection:f,disabled:c,readOnly:n.isOnlyShow||d,button:N,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(qe,null)},fileList:r,onChange:e=>{let{file:t,fileList:n}=e;(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in I)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[I[i]])||"";return e.response&&200!==n.code&&k.error(n.message||Bt("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(S?me(n.data,S):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&o(t)})(n)},onPreview:g,onRemove:v})};class Lc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ac,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(o,"")}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Lc.contextType=ao;const Pc=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{options:l={},upload:a={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fixedSize:h,quality:m,openCropper:f,fileTypes:g,fileSize:v,onRemove:y}=l,{action:b,headers:x,params:E,withCredentials:S=!1,dataKey:w="",popupClassName:C,fieldAliasMap:T,beforeUpload:N}=a,I="function"==typeof T?T():T||{};return t.createElement(rd,{name:"file",action:b,multiple:u,headers:x,data:E,withCredentials:S,popupClassName:C,beforeUpload:N,maxCount:p,fixedSize:h,quality:m,openCropper:f,fileTypes:g,fileSize:v,disabled:c,readOnly:n.isOnlyShow||d,fileList:r,onChange:e=>{let{file:t,fileList:n}=e;(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in I)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[I[i]])||"";return e.response&&200!==n.code&&k.error(n.message||Bt("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(w?me(n.data,w):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&o(t)})(n)},onRemove:y})};class _c extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Pc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(o,"")}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}_c.contextType=ao;const Hc=e=>{const{$$form:n}=t.useContext(ao),{value:r,onChange:i,onValuesChange:o}=e,{options:l={},upload:a,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=l;return t.createElement(ed,{value:r,tinymce:u,upload:a,thresholdSize:p,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{null==i||i(e),o(e)})(e)}})};class Dc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:o,invisible:l,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:De(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(F,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Hc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(o,t)}}))),d&&t.createElement(F,{flex:Pn(d.labelWidth||nl)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}Dc.contextType=ao;class Fc extends r{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=we(this.resizeObserveHandler,10),this.getFormItems=kt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=kt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{se(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=e=>{let{values:t,errorFields:n}=e;var r,i;null===(i=(r=this.props).onFinishFailed)||void 0===i||i.call(r,n)},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(","),"]")})));G.error({message:Bt("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Rt(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(){Fi(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){$i(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&&Xt("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).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=>se(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=>se(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,ll.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:il),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=Ln(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";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){var t,n;e!==this.state.collapse&&(this.setState({collapse:e}),null===(n=(t=this.props).onCollapse)||void 0===n||n.call(t,e),Rn((()=>{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,o;if(Sl(e))return wl(e);if(se(e)){const{fieldName:l,label:a,options:s={}}=e;if(Sl(a))return wl(a);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([l])[l])&&void 0!==n?n:this._initialValues[l])&&void 0!==r?r:null===(i=c[0])||void 0===i?void 0:i.value;return(null===(o=c.find((e=>e.value===d)))||void 0===o?void 0:o.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(e){let{type:t,fieldName:n}=e;var r,i;if("DIVIDER"===t)return!0;const o=this.getBlockDerivedItems();for(let e=0,t=o.length;e<t;e++){const t=o[e],l=this.dividers.find((e=>e.fieldName===t[0].fieldName)),a=null!==(i=null===(r=null==l?void 0:l.collapse)||void 0===r?void 0:r.showLimit)&&void 0!==i?i:t.length-1;for(let e=1;e<t.length;e++){if(t[e].fieldName===n&&e>a)return this.state.expand[t[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(fl(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{fl(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[o,l]=r.split("|");e[o]=null!==(t=i[0])&&void 0!==t?t:"",e[l]=null!==(n=i[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)kn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return En(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=An(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:o}=r.fetch;try{const r=yield t(n);200===r.code&&(i=null!==(e=o?me(r.data,o):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:o,secretName:l}=n;i||(e.noAuth=!0,r.noAuth=!0),o&&(e.disabled=!0,r.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},r.options=Object.assign({},r.options,{secretType:l})),this.setFieldAuth(t,{visible:i,disabled:o,secretName:l})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(Bl,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(Gl,{option:e})}INPUT_NUMBER(e){return t.createElement(Xl,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(Ql,{option:e})}SEARCH_HELPER(e){return t.createElement(na,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(Fs,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(qs,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(Vs,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(Ws,{option:e})}CHECKBOX(e){return t.createElement(Kl,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Us,{option:e})}RATE(e){return t.createElement(Ys,{option:e})}RADIO(e){return t.createElement(Zs,{option:e})}SWITCH(e){return t.createElement(Js,{option:e})}TEXT_AREA(e){return t.createElement(tc,{option:e})}DATE(e){return t.createElement(rc,{option:e})}RANGE_DATE(e){return t.createElement(lc,{option:e})}TIME(e){return t.createElement(sc,{option:e})}RANGE_TIME(e){return t.createElement(dc,{option:e})}SELECT(e){return t.createElement(jl,{option:e})}MULTIPLE_SELECT(e){return t.createElement(jl,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(pc,{option:e})}DIVIDER(e){return t.createElement(hc,{option:e})}TREE_SELECT(e){return t.createElement(gc,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(gc,{option:e,multiple:!0})}CASCADER(e){return t.createElement(yc,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(yc,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(Ic,{option:e})}REGION_SELECT(e){return t.createElement(kc,{option:e})}UPLOAD_FILE(e){return t.createElement(Lc,{option:e})}UPLOAD_IMG(e){return t.createElement(_c,{option:e})}TINYMCE(e){return t.createElement(Dc,{option:e})}renderFormLabel(e){if(Sl(e)||!se(e))return e;const{type:n,fieldName:r,label:i,options:o={},onChange:l=Tn}=e,{itemList:a=[]}=o;return"SELECT"===n?t.createElement(H.Item,{name:r,noStyle:!0},t.createElement(ql,{option:e,items:a,loading:!1,onValuesChange:(e,t)=>l(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{style:{paddingRight:5}},i),t.createElement(H.Item,{name:r,noStyle:!0},t.createElement(Vl,{option:e,onValuesChange:e=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:o}=e,{extra:l}=this.state;if(r)return t.createElement(Y,{className:"extra-tooltip",title:l[n]},t.createElement(Ge,{style:{marginLeft:4}}));const a=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:o?"":l[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},o?o(a,this):l[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:o,className:l,labelWidth:a=this.props.labelWidth,rules:s=[],style:c={},render:d}=e;return kn(this.state.formData)?null:t.createElement(H.Item,{label:this.renderFormLabel(n),name:r,rules:s,tooltip:o,hidden:i,className:De(l),style:Object.assign({width:"100%"},c),labelCol:{flex:this.verticalLayout?"initial":Pn(a)}},null==d?void 0:d(e,this))}createFormItem(e){return de(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(Xt("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:i}=this.props,o=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)o.push({});o.push(e);for(let e=0;e<n;e++)o.push({})}));const l=24/e,a=[],s=o.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return a.push(r),r}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=o.map(((n,r)=>{let{selfCol:i=1}=n;const{type:o,fieldName:s}=n;i=i>=24||"DIVIDER"===o||"TINYMCE"===o?e:i;const u=!(!this.state.collapse&&this.showFilterCollapse)||a[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(a[r]),t.createElement(F,{key:null!=s?s:r,className:s,span:i*l,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},o?this.createFormItem(Ln(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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:n,collapse:r}=this.state,{searchButtonCols:i,isSearchBtn:o,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const a=24/n,s=i||1,c=n-e%n-s;return o?t.createElement(F,{key:"-",span:s*a,offset:c*a,style:{textAlign:"right"}},t.createElement(N,{style:{marginBottom:12}},t.createElement(_n,{type:"primary",size:this.$size,icon:t.createElement(We,null),onClick:()=>this.SUBMIT_FORM()},Bt("qm.form.search")),t.createElement(_n,{size:this.$size,icon:t.createElement(Ye,null),onClick:()=>this.RESET_FORM()},Bt("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Fe,null):t.createElement($e,null)," ",Bt(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(D,{gutter:0},t.createElement(F,{key:"-",span:i},t.createElement(H.Item,null,t.createElement(N,{style:{marginBottom:12}},t.createElement(_n,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},Bt("qm.form.save")),t.createElement(_n,{size:this.$size,onClick:()=>this.RESET_FORM()},Bt("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(zl,{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)=>En(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:[Bt("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 En(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 En(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 En(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){Xt("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:i}=this.props,o=r.find((t=>t.fieldName===e));if(!o)return Xt("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!se(t))return Xt("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(o.noAuth)return Xt("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||ve(o,n,t[n]));n&&(i?i([...r]):Xt("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:o,labelAlign:l,labelWrap:a,customClass:s}=this.props,c=Fn("form"),d={required:"${label}"+Bt("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:De(u,e),style:n},t.createElement(H,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:l,labelWrap:a,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Pn(o)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(ao.Provider,{value:this.provide},t.createElement(D,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Fc.contextType=Vt,Fc.propTypes=ul,Fc.defaultProps=pl;const $c={onActivate:m.func,onAddUndo:m.func,onBeforeAddUndo:m.func,onBeforeExecCommand:m.func,onBeforeGetContent:m.func,onBeforeRenderUI:m.func,onBeforeSetContent:m.func,onBeforePaste:m.func,onBlur:m.func,onChange:m.func,onClearUndos:m.func,onClick:m.func,onContextMenu:m.func,onCommentChange:m.func,onCopy:m.func,onCut:m.func,onDblclick:m.func,onDeactivate:m.func,onDirty:m.func,onDrag:m.func,onDragDrop:m.func,onDragEnd:m.func,onDragGesture:m.func,onDragOver:m.func,onDrop:m.func,onExecCommand:m.func,onFocus:m.func,onFocusIn:m.func,onFocusOut:m.func,onGetContent:m.func,onHide:m.func,onInit:m.func,onKeyDown:m.func,onKeyPress:m.func,onKeyUp:m.func,onLoadContent:m.func,onMouseDown:m.func,onMouseEnter:m.func,onMouseLeave:m.func,onMouseMove:m.func,onMouseOut:m.func,onMouseOver:m.func,onMouseUp:m.func,onNodeChange:m.func,onObjectResizeStart:m.func,onObjectResized:m.func,onObjectSelected:m.func,onPaste:m.func,onPostProcess:m.func,onPostRender:m.func,onPreProcess:m.func,onProgressState:m.func,onRedo:m.func,onRemove:m.func,onReset:m.func,onSaveContent:m.func,onSelectionChange:m.func,onSetAttrib:m.func,onSetContent:m.func,onShow:m.func,onSubmit:m.func,onUndo:m.func,onVisualAid:m.func,onSkinLoadError:m.func,onThemeLoadError:m.func,onModelLoadError:m.func,onPluginLoadError:m.func,onIconsLoadError:m.func,onLanguageLoadError:m.func},Mc=Object.assign({apiKey:m.string,id:m.string,inline:m.bool,init:m.object,initialValue:m.string,onEditorChange:m.func,value:m.string,tagName:m.string,cloudChannel:m.string,plugins:m.oneOfType([m.string,m.array]),toolbar:m.oneOfType([m.string,m.array]),disabled:m.bool,textareaName:m.string,tinymceScriptSrc:m.string,rollback:m.oneOfType([m.number,m.oneOf([!1])]),scriptLoading:m.shape({async:m.bool,defer:m.bool,delay:m.number})},$c),qc=e=>"function"==typeof e,jc=e=>e in $c,Vc=e=>e.substr(2),Kc=(e,t,n,r,i)=>((e,t,n,r,i,o,l)=>{const a=Object.keys(i).filter(jc),s=Object.keys(o).filter(jc),c=a.filter((e=>void 0===o[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=Vc(e),r=l[t];n(t,r),delete l[t]})),d.forEach((n=>{const i=r(e,n),o=Vc(n);l[o]=i,t(o,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 zc=0;const Wc=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return zc++,e+"_"+n+zc+String(t)},Bc=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Uc=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Gc=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Yc=()=>({listeners:[],scriptId:Wc("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Xc=(()=>{let e=Yc();return{load:(t,n,r,i,o,l)=>{const a=()=>((e,t,n,r,i,o)=>{const l=t.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=e,l.src=n,l.async=r,l.defer=i;const a=()=>{l.removeEventListener("load",a),o()};l.addEventListener("load",a),t.head&&t.head.appendChild(l)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,o>0?setTimeout(a,o):a()))},reinitialize:()=>{e=Yc()}}})(),Zc=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Qc extends e.Component{constructor(t){var n,r,i,o;super(t),n=this,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=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t,r,i;const o=n.elementRef.current;if(!o)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})(o)){if(0===e)setTimeout((()=>n.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>n.initialise(e+1)),100)}return}const l=Zc(n.view);if(!l)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},n.props.init),{selector:void 0,target:o,readonly:n.props.disabled,inline:n.inline,plugins:(s=null===(t=n.props.init)||void 0===t?void 0:t.plugins,c=n.props.plugins,Uc(s).concat(Uc(c))),toolbar:null!==(r=n.props.toolbar)&&void 0!==r?r:null===(i=n.props.init)||void 0===i?void 0:i.toolbar,setup:e=>{n.editor=e,n.bindHandlers({}),n.inline&&!Bc(o)&&e.once("PostRender",(t=>{e.setContent(n.getInitialValue(),{no_events:!0})})),n.props.init&&qc(n.props.init.setup)&&n.props.init.setup(e)},init_instance_callback:e=>{var t,r;const i=n.getInitialValue();n.currentContent=null!==(t=n.currentContent)&&void 0!==t?t:e.getContent(),n.currentContent!==i&&(n.currentContent=i,e.setContent(i),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const o=null!==(r=n.props.disabled)&&void 0!==r&&r;Gc(n.editor,o?"readonly":"design"),n.props.init&&qc(n.props.init.init_instance_callback)&&n.props.init.init_instance_callback(e)}});var s,c;n.inline||(o.style.visibility=""),Bc(o)&&(o.value=n.getInitialValue()),l.init(a)},this.id=this.props.id||Wc("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(o=null!==(r=this.props.inline)&&void 0!==r?r:null===(i=this.props.init)||void 0===i?void 0:i.inline)&&void 0!==o&&o,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;Gc(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,o;null!==Zc(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Xc.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!==(o=null===(i=this.props.scriptLoading)||void 0===i?void 0:i.delay)&&void 0!==o?o: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=Zc(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){Kc(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 Jc;Qc.propTypes=Mc,Qc.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Jc||(Jc={}));class ed extends r{constructor(){super(...arguments),this.defaultOption={height:400,plugins:"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",menubar:"file edit view insert format tools table help",toolbar:"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"}}render(){var e;const{size:n,className:r,style:i,tinymce:o={},upload:l={},thresholdSize:a=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:p}=this.props,h=this.context.global,m=this.context.locale,f=n||this.context.size||"",g=Fn("tinymce"),v={[g]:!0,[`${g}--lg`]:"large"===f,[`${g}--sm`]:"small"===f},y={init:Object.assign(Object.assign({height:o.height||this.defaultOption.height,plugins:o.plugins||this.defaultOption.plugins,toolbar:o.toolbar||this.defaultOption.toolbar,menubar:o.menubar||this.defaultOption.menubar,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:Jc[m],skin:"tinymce-5"},An(o,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>new Promise(((t,n)=>En(this,void 0,void 0,(function*(){const{action:n,headers:r,dataKey:i}=l,o=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(n&&c/1024/1024>a)try{const e=yield fetch(n,{method:"POST",body:s,headers:r});if(!e.ok)throw new Error(Bt("qm.upload.uploadError"));const o=yield e.json();if(200===o.code){const e=i?me(o.data,i):o.data;t(e)}}catch(e){k.error(Bt("qm.uploadCropper.uploadError"))}else t(o)})))),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),value:d,disabled:c,tinymceScriptSrc:s||(null===(e=null==h?void 0:h.tinymce)||void 0===e?void 0:e.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==p||p(t.getContent(),t)}};return t.createElement("div",{className:De(v,r),style:i},t.createElement(Qc,y))}}ed.contextType=Vt,ed.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Tinymce","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")}};class td extends r{constructor(){super(...arguments),this.imgRef=t.createRef()}componentDidMount(){const e=bn(this.props,["className","style","src","alt","imgStyle"]),t={};for(const n in e)void 0!==this.props[n]&&(t[n]=this.props[n]);this.cropper=new At(this.imgRef.current,t)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:n,src:r,alt:i,imgStyle:o}=this.props,l={[Fn("cropper")]:!0};return t.createElement("div",{className:De(l,e),style:n},t.createElement("img",{ref:this.imgRef,src:r,alt:i,style:Object.assign({maxWidth:"100%"},o)}))}}td.defaultProps={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};class nd extends r{constructor(){super(...arguments),this.cropperRef=t.createRef(),this.state={src:""},this.confirmHandle=()=>En(this,void 0,void 0,(function*(){const{quality:e}=this.props,{type:t,name:n,uid:r}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((e=>En(this,void 0,void 0,(function*(){let i=new File([e],n,{type:t});Object.assign(i,{uid:r});const{fileTypes:o=[],fileSize:l}=this.props;if(!(!o.length||o.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase())))return k.warning(Bt("qm.upload.tooltip",{type:o.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(i);const a=this.beforeUploadRef(i,[i]);if("boolean"==typeof a||a){if(!0===a)return this.resolveRef(i);if(!1===a)return this.rejectRef("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),this.resolveRef(i)}catch(e){this.rejectRef(e)}}else Xt("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),t,e),yield In(100),this.onClose()})),this.onOk=()=>{this.confirmHandle()},this.onClose=()=>{this.setSrc("")}}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:n}=this.props,r=Array.isArray(e)?e[0]:e;if(!r)return null;const i=r.props,{beforeUpload:o}=i,l=bn(i,["beforeUpload"]);return this.beforeUploadRef=o,t.createElement(r.type,Object.assign(Object.assign({},l),{beforeUpload:(e,t)=>new Promise(((r,i)=>En(this,void 0,void 0,(function*(){const i=()=>r(O.LIST_IGNORE);if(n&&!(yield n(e,t)))return void i();this.fileRef=e,this.resolveRef=r,this.rejectRef=i;const o=new FileReader;o.onload=()=>{this.setSrc(o.result),o.onload=null},o.readAsDataURL(e)}))))}))}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(td,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(N,{size:"small"},t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Xe,null),onClick:()=>this.scaleHandle(.2)},Bt("qm.uploadCropper.zoomIn")),t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Ze,null),onClick:()=>this.scaleHandle(-.2)},Bt("qm.uploadCropper.zoomOut")),t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Qe,null),onClick:()=>this.rotateHandle(90)},Bt("qm.uploadCropper.rotatePlus")),t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Je,null),onClick:()=>this.rotateHandle(-90)},Bt("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:this.previewSize})))}render(){const{className:e}=this.props,{src:n}=this.state,r=Fn("cropper-preview");return t.createElement(t.Fragment,null,this.renderUpload(),n&&t.createElement(P,{open:!0,wrapClassName:De(r,e),title:Bt("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}nd.contextType=Vt;class rd extends r{constructor(){super(...arguments),this.state={previewVisible:!1,currentIndex:0},this.isFocused=!1,this.beforeUpload=(e,t)=>new Promise(((n,r)=>En(this,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:o,beforeUpload:l}=this.props,a=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!o||e.size/1024/1024<o,c=a&&s;if(a||k.warning(Bt("qm.upload.tooltip",{type:i.join(",")})),s||k.warning(Bt("qm.upload.sizeLimit",{size:o})),!c)return O.LIST_IGNORE;if(l){const i=l(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)})))),this.handlePreview=e=>{var t;this.setState({currentIndex:(null===(t=this.props.fileList)||void 0===t?void 0:t.findIndex((t=>t.url===e.url)))||0,previewVisible:!0})},this.handlePaste=e=>En(this,void 0,void 0,(function*(){const{fileList:t=[],action:n,data:r,headers:i,onChange:o}=this.props;if(this.isFocused&&this.showUploadButton&&n)for(const l of e.clipboardData.items)if("file"===l.kind&&l.type.startsWith("image/")){const e=l.getAsFile(),a=Date.now(),s=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(s,{uid:`rc-upload-${a}`});try{yield this.beforeUpload(s,[...t,s]);const e=new FormData;if(e.append("file",s),r)for(const t in r)e.append(t,r[t]);const l="string"==typeof n?n:yield n(s),a=yield fetch(l,{method:"POST",body:e,headers:i});if(!a.ok)throw new Error(Bt("qm.upload.uploadError"));const c=yield a.json();null==o||o({file:s,fileList:[...t,{uid:s.uid,lastModified:s.lastModified,lastModifiedDate:s.lastModifiedDate,name:s.name,type:s.type,size:s.size,response:c,status:"done",percent:100,originFileObj:s}]})}catch(e){}}}))}get $size(){var e;return null!==(e=this.context.size)&&void 0!==e?e:""}get showUploadButton(){var e,t;const n=null!==(t=null===(e=this.props.fileList)||void 0===e?void 0:e.length)&&void 0!==t?t:0;return!this.props.maxCount||n<this.props.maxCount}componentDidMount(){document.addEventListener("paste",this.handlePaste)}componentDidUpdate(e){const{fileList:t}=e,{fileList:n}=this.props;t===n||this.showUploadButton||(this.isFocused=!1)}componentWillUnmount(){document.removeEventListener("paste",this.handlePaste)}render(){const{previewVisible:e,currentIndex:n}=this.state,{fileList:r=[],fixedSize:i,quality:o,fileTypes:l,fileSize:a,disabled:s,readOnly:c,className:d,popupClassName:u,openCropper:p,beforeCrop:h}=this.props,m=Fn("upload-img"),f={[m]:!0,[`${m}--lg`]:"large"===this.$size,[`${m}--sm`]:"small"===this.$size},g=s||c,v=t.createElement(O,hn({className:De(f,d)},An(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:g,onPreview:this.handlePreview,showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,n,r,i)=>t.createElement("div",{className:"upload-item"},e,!g&&t.createElement(Ue,{title:Bt("qm.upload.remove"),className:"icon",onClick:()=>i.remove()}))}),!this.showUploadButton||c&&r.length?null:t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(et,null)),t.createElement("p",{className:"ant-upload-text"},Bt("qm.uploadCropper.dragableText")),t.createElement("button",{className:De("ant-upload-button",{disabled:g}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{this.isFocused=!0},onBlur:()=>{this.isFocused=!1}},Bt("qm.uploadCropper.pasteText"))));return t.createElement(t.Fragment,null,p?t.createElement(nd,{className:u,fixedSize:i,quality:o,fileTypes:l,fileSize:a,beforeCrop:h},v):v,t.createElement("div",{style:{display:"none"}},t.createElement(X.PreviewGroup,{preview:{visible:e,current:n,rootClassName:u,onVisibleChange:e=>{this.setState({previewVisible:e})}}},r.map((e=>t.createElement(X,{key:e.uid,src:e.url,alt:""}))))))}}rd.contextType=Vt,rd.defaultProps={name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0};const id=(e,t,n)=>{let r;for(let i=0;i<e.length;i++){const o=e[i];if(o.children)if(o.children.some((e=>e[n]===t)))r=o[n];else{const e=id(o.children,t,n);e&&(r=e)}}return r},od=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&od(e.children,t),t(e)||e.children&&e.children.length))),ld=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ld(e.children,t)),t(e)&&n.push(e)})),n},ad=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=ad(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},sd=(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:sd(e.children,t,n,r)}):e)),cd=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...cd(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},dd=(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=dd(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},ud=(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(...ud(e,t)))),r},pd=t.forwardRef(((e,n)=>{const{className:r,style:i,filterable:o=!0,multiple:l,draggable:a,dataSource:s,fetch:c,asyncLoad:d,checkStrictly:u,checkStrategy:p="SHOW_CHILD",placeholder:h=Bt("qm.form.inputPlaceholder"),fieldsDefine:m,value:f,height:g,defaultSelectedKeys:v=[],defaultExpandAll:y=!0,showSearchBar:b=!0,showCollapse:x=!0,onSelectChange:E,onCheckChange:S,onDragStart:w,onDragChange:C,onExpand:T}=e,{size:N}=t.useContext(Vt),I=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:N)&&void 0!==n?n:""}),[e.size,N]),R=(null==m?void 0:m.valueKey)||"value",O=(null==m?void 0:m.textKey)||"text";null==m||m.children;const k=t.useRef(null),A=Mi(k),[L,P]=t.useState(g),[H,D]=t.useState(!1),F=Vi((()=>{P(k.current.offsetHeight-X.current.offsetHeight-10)}),5);ji((()=>{g||F()}),[A.height]);const[$,M]=t.useState([]),[q,j]=t.useState({}),[V,K]=t.useState([]),[z,W]=t.useState([]),[B,U]=t.useState(""),[G,Y]=t.useState(y),X=t.useRef(null),Q=t.useRef([]),J=t.useRef([]);t.useEffect((()=>{Array.isArray(s)&&(ee(s),K(te(s)),j({}))}),[s]),t.useEffect((()=>{ie()}),[]),fi((()=>{ie()}),[null==c?void 0:c.params]),fi((()=>{W(re())}),[q]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=ad($,(t=>e===t[R]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],ee([...$]))},REMOVE_RECORD:e=>{var t;const n=id($,e,R);if(void 0===n&&$.find((t=>t[R]===e)))ee($.filter((t=>t[R]!==e)));else{const r=ad($,(e=>n===e[R]));if(!r)return;const i=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[R]));i>=0&&(r.children.splice(i,1),ee([...$]))}},UPDATE_RECORD:(e,t)=>{const n=ad($,(t=>e===t[R]));n&&(xe(n,t),ee([...$]))}})));const ee=e=>{M(e),Q.current=e,J.current=cd(e,R)},te=e=>{if(l)return v;const t=ld(e,(e=>v.includes(e[O])));return 1===t.length?[t[0][R]]:[]},ne=e=>{var t;return(null===(t=dd($,e,R))||void 0===t?void 0:t.slice(0,-1))||[]},re=()=>{if(y)return J.current;const e=[];return V.forEach((t=>{if(l){if("SHOW_ALL"===p&&!J.current.includes(t)&&e.push(...ne(t)),"SHOW_CHILD"===p&&e.push(...ne(t)),"SHOW_PARENT"===p){const n=xl($,t);if(n){const r=ne(t),i=ud(n,R);e.push(...r,...[t,...i].filter((e=>J.current.includes(e))))}}}else e.push(...ne(t))})),[...new Set(e)]},ie=()=>En(void 0,void 0,void 0,(function*(){var e;if(!c)return;const{api:t,params:n,dataKey:r,afterFetch:i,callback:o}=c;try{D(!0);const l=yield t(n);if(200===l.code){let t=Array.isArray(l.data)?l.data:null!==(e=me(l.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,ee(t),K(te(t)),j({}),null==o||o(t)}}catch(e){}D(!1)})),oe=e=>`${e}|${Dl.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,le=Fn("search-tree"),ae={[le]:!0,[`${le}--lg`]:"large"===I,[`${le}--sm`]:"small"===I};return t.createElement("div",{ref:k,className:De(ae,r),style:i},t.createElement("div",{ref:X,className:"topper"},b&&t.createElement(_.Search,{value:B,size:I,placeholder:h,allowClear:!0,onChange:e=>(e=>{if(!o)return;const t=od(Q.current,(t=>{if(!e)return!0;const n=t[O]||"";return-1!==oe(n).indexOf(e)}));U(e),M(t),y||e?W(cd(t,R)):j({})})(e.target.value)}),x&&t.createElement("a",{className:"trigger",onClick:()=>{Y(!G),W(G?[]:J.current)}},G?t.createElement(Fe,null):t.createElement($e,null)," ",Bt(G?"qm.form.collect":"qm.form.spread"))),t.createElement(_i,{spinning:H},t.createElement(Z,{fieldNames:{title:O,key:R,children:"children"},multiple:l,draggable:a,blockNode:a,checkable:l,selectable:!l,height:L,disabled:e.disabled,checkStrictly:u,selectedKeys:null!=f?f:V,checkedKeys:null!=f?f:V,expandedKeys:z,treeData:$,loadData:d?e=>{let{key:t,children:n}=e;return En(void 0,void 0,void 0,(function*(){var e;if(!c||n)return;const{api:r,params:i,dataKey:o,formatter:l=(e=>e),afterFetch:a}=c;try{const n=yield r(l(Object.assign(Object.assign({},i),{[R]:t})));if(200===n.code){let r=Array.isArray(n.data)?n.data:null!==(e=me(n.data,o))&&void 0!==e?e:[];r="function"==typeof a?yield a(r):r;const i=sd(Q.current,t,R,r);ee(i)}}catch(e){}}))}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!B)return!1;const t=e[O]||"";return-1!==oe(t).indexOf(B)},onDragStart:w,onDragEnter:e=>{W(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]),o=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][R]===t)return n(e[r],r,e);e[r].children&&o(e[r].children,t,n)}},l=[...$];let a;if(o(l,n,((e,t,n)=>{n.splice(t,1),a=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)o(l,t,(e=>{e.children=e.children||[],e.children.unshift(a)}));else{let e,n=[];o(l,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,a):n.splice(e+1,0,a)}else o(l,t,(e=>{e.children=e.children||[],e.children.unshift(a)}));ee(l)},onDragEnd:e=>{null==C||C(e,$)},onExpand:(e,t)=>{kn(e)&&Y(!1),J.current.every((t=>e.includes(t)))&&Y(!0),W(e),null==T||T(e,t)},onSelect:e=>{K(e);const t=ld(Q.current,(t=>e.includes(me(t,R))));null==E||E(l?t:t[0])},onCheck:e=>{u&&(e=e.checked),K(e),"SHOW_CHILD"===p&&(e=e.filter((e=>!J.current.includes(e)))),"SHOW_PARENT"===p&&(e=e.filter(((e,t,n)=>!n.includes(id($,e,R)))));const t=ld(Q.current,(t=>e.includes(me(t,R))));null==S||S(l?t:t[0])}})))}));pd.displayName="QmSearchTree";const hd=n(void 0),md={dataIndex:f.string.isRequired,title:f.string.isRequired,description:f.string,colSpan:f.number,width:f.number,minWidth:f.number,fixed:f.oneOf(["left","right"]),align:f.oneOf(["left","center","right"]),theadAlign:f.oneOf(["left","center","right"]),printFixed:f.bool,hidden:f.bool,noAuth:f.bool,noFixed:f.bool,ellipsis:f.bool,className:f.string,theadClassName:f.string,children:f.array,sorter:f.oneOfType([f.bool,f.func]),filter:f.shape({type:f.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:f.arrayOf(f.shape({text:f.string,value:f.oneOfType([f.string,f.number])})),style:f.object}),precision:f.number,displayPrecision:f.number,formatType:f.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:f.bool,canCopy:f.bool,editRender:f.func,dictItems:f.arrayOf(f.shape({text:f.string,value:f.oneOfType([f.string,f.number])})),summation:f.shape({sumBySelection:f.bool,displayWhenNotSelect:f.bool,dataKey:f.string,unit:f.string,render:f.func}),groupSummary:f.shape({dataKey:f.string,unit:f.string,render:f.func}),shouldCellUpdate:f.func,headRender:f.func,render:f.func};f.arrayOf(f.shape(md)).isRequired,f.func,f.array,f.oneOfType([f.string,f.func]).isRequired,f.number,f.bool,f.bool,f.shape({api:f.func.isRequired,params:f.object.isRequired,formatter:f.func,beforeFetch:f.func,afterFetch:f.func,stopToFirst:f.bool,dataKey:f.string,callback:f.func}),f.bool,f.bool,f.string,f.string,f.bool,f.bool,f.bool,f.bool,f.oneOfType([f.object,f.func]),f.oneOfType([f.object,f.func]),f.array,f.func,f.bool,f.object,f.object,f.shape({type:f.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:f.array,selectedRowKeys:f.array,hideSelectAll:f.bool,checkStrictly:f.bool,filterable:f.bool,selectByClickRow:f.bool,selectFirstRowOnChange:f.bool,clearableAfterFetched:f.bool,selectAllOnCurrentPage:f.bool,fetchSelectedRows:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),fetchAllRowKeys:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),disabled:f.func,onChange:f.func,onSelect:f.func,onSelectAll:f.func}),f.shape({currentRowKey:f.oneOfType([f.number,f.string]),disabled:f.func,onChange:f.func}),f.shape({virtual:f.bool,doubleXScrollbar:f.bool}),f.shape({virtual:f.bool,expandIconColumn:f.string}),f.shape({defaultExpandAllRows:f.bool,defaultExpandedRowKeys:f.array,expandedRowKeys:f.array,hideExpandAll:f.bool,rowExpandable:f.func,expandedRowClassName:f.string,expandedRowRender:f.func,onExpand:f.func,onChange:f.func}),f.shape({cellMerge:f.bool,onCellMerge:f.func,onSelectChange:f.func}),f.shape({groupItems:f.arrayOf(f.shape({dataIndex:f.string.isRequired,titleIndex:f.string,color:f.string,backgroundColor:f.string})),fetch:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),onChange:f.func}),f.func,f.bool,f.bool,f.bool,f.bool,f.shape({current:f.number,pageSize:f.number,pageSizeOptions:f.array,showSizeChanger:f.bool,showQuickJumper:f.bool}),f.shape({fileName:f.string,fetch:f.shape({api:f.func.isRequired,params:f.object}),beforeExport:f.func,cellStyle:f.bool,hideIcon:f.bool}),f.shape({showLogo:f.bool}),f.shape({fetch:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),fieldList:f.arrayOf(f.object)}),f.shape({position:f.oneOf(["top","bottom"]),hideAlert:f.bool,hideClearButton:f.bool}),f.oneOf(["left","right"]),f.func,f.func,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.func,f.func,f.func,f.func,f.func,f.func,f.func,f.func,f.func;const fd={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},gd=10,vd="1",yd="0",bd="YYYY-MM-DD",xd="YYYY-MM-DD HH:mm:ss",Ed="YYYYMMDDHHmmss",Sd={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 wd;function Cd(t){const n=e.useRef();n.current=t;const r=e.useCallback((function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null===(e=n.current)||void 0===e?void 0:e.call(n,...r)}),[]);return r}!function(e){e.left="flex-start",e.right="flex-end"}(wd||(wd={}));let Td=0;const Nd=Object.assign({},e).useId;var Id=Nd?function(e){const t=Nd();return e||t}:function(t){const[n,r]=e.useState("ssr-id");return e.useEffect((()=>{const e=Td;Td+=1,r(`qm_unique_${e}`)}),[]),t||n};class Rd{constructor(){this.instances=[],this.getFocusInstance=()=>{var e;return null!==(e=this.instances[0])&&void 0!==e?e:null},this.getInstance=e=>{var t;return null!==(t=this.instances.find((t=>t.id===e)))&&void 0!==t?t:null},this.focus=e=>{const t=this.getInstance(e);t&&0!==this.instances.findIndex((e=>e===t))&&(this.deregister(e),this.instances=[t,...this.instances])},this.register=(e,t)=>{e&&t&&(null!==this.getInstance(e)&&this.deregister(e),this.instances=[{id:e,vm:t},...this.instances])},this.deregister=e=>{e&&(this.instances=this.instances.filter((t=>t.id!==e)))}}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}class Od{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 kd={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:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};function Ad(e){return void 0!==e}function Ld(t,n){const{defaultValue:r,value:i,onChange:o,postState:l}=n||{},[a,s]=e.useState((()=>Ad(i)?i:Ad(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=Ad(i)?i:a,d=l?l(c):c,u=Cd(o),[p,h]=e.useState([c]);ji((()=>{const e=p[0];a!==e&&u(a,e)}),[p]),ji((()=>{Ad(i)||s(i)}),[i]);return[d,Cd((e=>{s(e),h([c])}))]}let Pd;const _d=()=>{var e;if(Sn)return 0;if(void 0!==Pd)return Pd;const t=document.createElement("div");t.className="qm-scrollbar__wrap",t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const n=t.offsetWidth;t.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",t.appendChild(r);const i=r.offsetWidth;return null===(e=t.parentNode)||void 0===e||e.removeChild(t),Pd=n-i,Pd},Hd=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=Hd(t.children)),t})),Dd=(e,n)=>{const{fetch:r,columns:i,height:o,minHeight:l,maxHeight:a,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:h,scrollPagination:m,showSuperSearch:f,showFastSearch:g,showGroupSummary:v,showTableImport:y,showClipboard:b,showSelectCollection:x,footRender:E}=e,{tableRef:S,getRowKey:w,tableFullData:C,tableData:T,selectionKeys:N,sorter:I,filters:R,superFilters:O,pagination:k,mergedTdCells:A}=n,{selectionRows:L,summaries:P}=S.current,{expandIconColumn:_=""}=p||{},H=e=>{const t=(e=>{const t=[],n=[],r=[];for(let i=0;i<e.length;i++){const o=e[i];"left"===o.fixed?t.push(o):"right"===o.fixed?n.push(o):r.push(o)}return[...t,...r,...n]})(Hd(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:kd.selectionColumn,title:"radio"===t?Bt("qm.table.config.selectionText"):"",width:kd.selectionColumnWidth,fixed:"left",type:t}})(c),r=(null==(i=u)?void 0:i.expandedRowRender)?{dataIndex:kd.expandableColumn,title:"",width:kd.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),Co(t)},D=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),F=t.useMemo((()=>!D&&!!h),[D,h]),$=t.useMemo((()=>D&&!!m),[D,m]),M=t.useMemo((()=>(D||F)&&!$),[D,F,$]),q=t.useMemo((()=>!!(o||l||a)),[o,l,a]),j=t.useMemo((()=>H(i)),[i]),V=t.useMemo((()=>wo(j)),[j]),K=t.useMemo((()=>V.filter((e=>"function"==typeof e.editRender))),[V]),z=t.useMemo((()=>V.filter((e=>!!e.summation))),[V]),W=t.useMemo((()=>V.filter((e=>"left"===e.fixed))),[V]),B=t.useMemo((()=>V.filter((e=>"right"===e.fixed))),[V]),U=t.useMemo((()=>(e=>{const t=[];return e.forEach((e=>{const n=C.find((t=>w(t,t.index)===e.rowKey)),r=V.findIndex((t=>t.dataIndex===e.dataIndex));if(!n||r<0)return;const i={row:n.index,col:r,rowSpan:e.rowSpan,colSpan:e.colSpan};t.push(i);for(let n=1;n<e.colSpan;n++)for(let r=0;r<e.rowSpan;r++)t.push({row:i.row+r,col:i.col+n,rowSpan:0,colSpan:0});for(let n=1;n<e.rowSpan;n++)for(let r=0;r<e.colSpan;r++)t.push({row:i.row+n,col:i.col+r,rowSpan:0,colSpan:0})})),t})(A)),[A,V,C]),G=t.useMemo((()=>{var e,t;const n=V.filter((e=>![kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(e.dataIndex)));return _&&n.some((e=>e.dataIndex===_))?_:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[V,_]),Y=t.useMemo((()=>z.length>0),[z]),X=t.useMemo((()=>!!E||Y),[E,Y]),Z=t.useMemo((()=>Po(j).length>1),[j]),Q=t.useMemo((()=>s||Z),[s,Z]),J=t.useMemo((()=>V.some((e=>e.sorter))),[V]),ee=t.useMemo((()=>V.some((e=>e.filter))),[V]),te=t.useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),ne=t.useMemo((()=>!D&&!!y),[D,y]),re=t.useMemo((()=>!!b&&K.length>0),[b,K]),ie=t.useMemo((()=>!!x&&"checkbox"===(null==c?void 0:c.type)),[x,c]),oe=t.useMemo((()=>!!f&&ee),[f,ee]),le=t.useMemo((()=>!D&&!!g&&ee),[D,g,ee]),ae=t.useMemo((()=>!!v&&V.some((e=>!!e.groupSummary))),[V]),se=t.useMemo((()=>{var e;return!!(null===(e=null==d?void 0:d.groupItems)||void 0===e?void 0:e.length)}),[d]),ce=t.useMemo((()=>C.some((e=>Array.isArray(e.children)))),[C]),de=t.useMemo((()=>!T.length),[T]),ue=t.useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:o}=t,{sumBySelection:l,displayWhenNotSelect:a,unit:s}=o,c=se?Go(S.current.tableFullData):S.current.tableFullData,d=!L.length&&!!a;let u=(!l||d?c:L).reduce(((e,t)=>{if(null==t?void 0:t[kd.summaryIgnore])return e;const r=Fo(t,n);return qo(r)?e.plus(r):e}),new Lt(0));!Object.keys(P).includes(n)||l&&!d||(u=new Lt(Fo(P,n))),$o(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=Vo(p,i)),p=jo(p),$o(e,`${n}_text`,s?`${p} ${s}`:p)})),[e]})()),[T,N,P]),pe=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(",")})(I),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,i]=t.split("|"),o=e[t];Object.keys(o).forEach((e=>{n.push({type:i,bracketLeft:"",fieldName:r,expression:e,value:o[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type:e.fieldType,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(R,O),i=t?{[kd.sorterFieldName]:t}:null,o=n.length?{[kd.filterFieldName]:n}:null,l=pe?{[kd.groupSummary.summaryFieldName]:pe,usedJH:1}:null,a=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[kd.currentPageName]:k.current,[kd.pageSizeName]:k.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),o),l),a),s)}),[null==r?void 0:r.params,k.current,k.pageSize,I,R,O,pe]);return{isFetch:D,isWebPagination:F,isScrollPagination:$,showPagination:M,shouldUpdateHeight:q,tableColumns:j,flattenColumns:V,editableColumns:K,summationColumns:z,leftFixedColumns:W,rightFixedColumns:B,derivedMergeCells:U,treeExpandIndex:G,showSummary:Y,showFooter:X,isHeadGroup:Z,bordered:Q,isHeadSorter:J,isHeadFilter:ee,isServiceSummation:te,isSelectCollection:ie,isTableImport:ne,isTableClipboard:re,isSuperSearch:oe,isFastSearch:le,isGroupSummary:ae,isGroupSubtotal:se,isTreeTable:ce,isTableEmpty:de,summationRows:ue,fetchParams:he}},Fd=(e,n)=>{const{rowKey:r,height:i,dataSource:o,summation:l,fetch:a,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,treeConfig:h,authConfig:m,ignorePageIndex:f,columnsChange:g,onChange:v,onDataChange:y,onDataLoad:b,onScrollEnd:x,onFetchError:E}=e,{getRowKey:S,tableRef:w,tableElementRef:C,tableBodyRef:T,$size:N,tableColumns:I,flattenColumns:R,tableFullData:O,pagination:k,layout:A,filters:L,sorter:P,superFilters:_,fetchParams:H,selectionKeys:D,rowExpandedKeys:F,highlightKey:$,summationColumns:M,shouldUpdateHeight:q,isFetch:j,isTreeTable:V,isWebPagination:K,isScrollPagination:z,isServiceSummation:W,isGroupSubtotal:B,doLayout:U,setTableData:G,setTableFlatColumns:Y,setTableFullData:X,setTableOriginData:Z,setTableFlatData:Q,setAllTableData:J,setDeriveRowKeys:ee,setPagination:te,setSpinning:ne,setSorter:re,setFilters:ie,setSuperFilters:oe,setSelectionKeys:le,setRowExpandedKeys:ae,setHighlightKey:se,setSelectionRows:ce,setScrollXLoad:de,setScrollYLoad:ue,setScrollXStore:pe,setScrollYStore:he,computeVirtualX:fe,computeVirtualY:ge,setFieldAuth:ve,setResizeState:ye,setSummaries:be,setPermission:xe,setRecordsMap:Ee,resetTableScroll:we,clearElementStore:Ce,clearRecordsMap:Te}=n,{store:Ne,scrollBarRef:Ie}=w.current,Re=Number.parseInt(t.version)>=18?Pt.flushSync:null,Oe=t.useRef(Object.assign({},H)),ke=t.useRef(new Map),Ae=t.useRef(!1),Le=Mi(C);ji((()=>{$e(),w.current.scrollXLoad?qe(Ie.current.scrollLeft):je(),U()}),[I]),ji((()=>{Pe()}),[Le,N,i,A.tableAutoHeight]),fi((()=>{Tt(),Nt(),It(),j||(K&&mt(),st(o)),s&&re(s),c&&ie(c)}),[o,null==a?void 0:a.params]),fi((()=>{const e=rt(H,Oe.current);e||j&&(null==d?void 0:d.clearableAfterFetched)&&Rt(),!e&&H[kd.currentPageName]>1&&!(null==a?void 0:a.stopToFirst)?mt():j&<(),Oe.current=H}),[H]),fi((()=>{K&&Et(),z||we(),et()}),[k.current,k.pageSize]),fi((()=>{w.current.scrollYLoad&&ze(Ie.current.scrollTop),j||He(O.length),U()}),[O]),fi((()=>{V&&w.current.scrollYLoad&&(ft(),Et())}),[F]);const Pe=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:n}=w.current,{width:r,height:i}=n,{width:o,height:l}=Le,a=o!==r,s=l!==i;U(),a&&e&&je(),s&&q&&t&&We(),ye(Object.assign({},n,{width:o,height:l}))},_e=()=>{$&&T.current.setClickedValues([$,""]),"radio"===(null==d?void 0:d.type)&&D.length&&T.current.setClickedValues([D[0],""])},He=e=>{e!==k.total&&te((t=>Object.assign({},t,{total:e})))},De=e=>{Ae.current=e},Fe=Vi((e=>{ut(),null==x||x(e)})),$e=()=>{de(R.length>kd.virtualScrollX)},Me=function(){let e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).length>kd.virtualScrollY;(null==p?void 0:p.virtual)&&(e=!0),(null==h?void 0:h.virtual)&&(e=!0),ue(e)},qe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollXStore:t}=w.current,{startIndex:n,endIndex:r,offsetSize:i}=t,{toVisibleIndex:o,visibleSize:l}=fe(e,A.tableWidth),a=Math.max(0,o-1-i),s=o+l+i;(o<=n||o>=r-l-1)&&(n===a&&r===s||(pe(Object.assign({},t,{startIndex:a,endIndex:s})),je()))},je=()=>{Ve(),Ke()},Ve=()=>{const{scrollXLoad:e,scrollXStore:t}=w.current;if(!e)return;const n=[],r=[],i=[];for(let e=0;e<R.length;e++){const o=R[e];o.fixed?"left"===o.fixed?n.push(o):i.push(o):e>=t.startIndex&&e<t.endIndex&&r.push(o)}Re?queueMicrotask((()=>Re((()=>Y([...n,...r,...i]))))):Y([...n,...r,...i])},Ke=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:n}=w.current,{tableBodyWidth:r,gutterWidth:i}=A;let o="",l="";if(n){o=`${R.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,l=`${scrollY?r-i:r}px`}e.$tableBody.style.marginLeft=o,e.$tableXspace.style.width=l},ze=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=w.current,{startIndex:n,endIndex:r,offsetSize:i,visibleSize:o,rowHeight:l}=t,{toVisibleIndex:a}=ge(e,l),s=Math.max(0,a-1-i),c=a+o+i;(a<=n||a>=r-o-1)&&(n===s&&r===c||(he(Object.assign({},t,{startIndex:s,endIndex:c})),We()))},We=()=>{const{tableFlatData:e}=w.current;bt(e),(e=>{const{elementStore:t,scrollYStore:n,scrollYLoad:r}=w.current,{startIndex:i,rowHeight:o}=n;let l="",a="";r&&(l=`${Math.max(0,i*o)}px`,a=e.length*o+"px"),t.$tableBody.style.marginTop=l,t.$tableYspace.style.height=a})(e)},Be=e=>B?Ue(Ge(e,0)):e,Ue=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ue(e.children)),delete e.children,t.push(e)})),t},Ge=(e,t)=>{var n;const i=null===(n=l.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 Xo(e,[i.dataIndex]).map((e=>{const n={children:Ge(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&$o(n,r.toString(),Wo()),i.titleIndex&&$o(n,i.titleIndex,Fo(e[0],i.titleIndex)),$o(n,i.dataIndex,Fo(e[0],i.dataIndex)),M.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[kd.summaryIgnore])return e;const n=Number(Fo(t,r));return Number.isNaN(n)?e:e+n}),0);$o(n,r,i)})),n}))},Ye=e=>{le(e),ce((e=>{const{selectionRows:t,allTableData:n,recordsMap:r}=w.current;if(j)return[...t.filter((t=>e.includes(S(t,t.index)))),...n.filter((n=>{const r=S(n,n.index);return e.includes(r)&&-1===t.findIndex((e=>S(e,e.index)===r))}))];const i=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];r.has(n)&&i.push(r.get(n))}return i})(e))},Xe=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let i=[];return w.current.treeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:o}=w.current,l=Ao(i,e);let a=[];if(!l)return a;let s=Qe((null==l?void 0:l.children)||[]);return r&&(s=s.filter((e=>!o.has(e)||!r(o.get(e))))),a=[...new Set([...t,...s])],((null===(n=Qo(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ao(i,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>a.includes(e.rowKey)));a=r?[...a,e]:a.filter((t=>t!==e))})),a})(e,r))})),i="radio"===t?r.slice(0,1):[...new Set([...r,...i])],i},Ze=e=>{const{allRowKeys:t,flattenRowKeys:n,deriveRowKeys:r}=w.current,{defaultExpandAllRows:i,expandedRowRender:o}=u||{},l=Array.isArray(e)?e:F;if(w.current.treeTable){o&&Xt("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];$&&e.unshift($);let a=[];return e.forEach((e=>{const t=Qo(r,e)||[];a.push(...t.length>1?t.slice(0,-1).reverse():t)})),a=i?t:[...new Set([...l,...a])],a.filter((e=>!n.includes(e)))}return u?i?t.slice(0):[...l]:[]},Qe=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...Qe(e[n].children)),t.push(e[n].rowKey);return t},Je=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Je(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...Je(e,n[n.length-1])),n},et=Vi((()=>{null==v||v(k,nt(L),tt(P),_,{currentDataSource:yt()})})),tt=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},nt=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},rt=(e,t)=>{const n=Object.keys(Do(e,t));return 1===n.length&&(n.includes(kd.currentPageName)||n.includes(kd.pageSizeName))},it=()=>En(void 0,void 0,void 0,(function*(){var t;if(!m)return;let n=An(m,["fetch"]);if(m.fetch){const{api:e,params:r,dataKey:i}=m.fetch;try{const o=yield e(r);200===o.code&&(n=null!==(t=i?me(o.data,i):o.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;xe((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const{originColumns:t}=w.current,r=No(e.columns,(e=>{const{dataIndex:r}=e,i=n.fieldList.find((e=>e.dataIndex===r));if(i){const{visible:n=1,disabled:o,secretName:l}=i,a=Io(t,r);ve(r,{visible:n,disabled:o,secretName:l}),n||(e.noAuth=!0,a.noAuth=!0),l&&(e.formatType=`secret-${l}`,a.formatType=`secret-${l}`)}}));null==g||g(r)}})),ot=()=>En(void 0,void 0,void 0,(function*(){var e,t,n;if(!a)return;const{formatter:r=(e=>e),beforeFetch:i=Nn,afterFetch:o,callback:s}=a;if(!i(H))return;const c=!!(null===(e=null==l?void 0:l.fetch)||void 0===e?void 0:e.api);ne(!0);try{const[e,i]=c?yield Promise.all([a.api(r(H)),l.fetch.api(r(H))]):[yield a.api(r(H))];if(w.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=a.dataKey)&&void 0!==t?t:kd.dataKey;let l=null!==(n=me(e.data,r))&&void 0!==n?n:[];l="function"==typeof o?yield o(l):l;const c=me(e.data,r.replace(/[^.]+$/,kd.totalKey))||l.length||0,d=Math.max(Math.ceil(c/k.pageSize),1);if(H[kd.currentPageName]>d)return pt(Object.assign(Object.assign({},k),{current:d}));st(Ae.current?w.current.tableFullData.concat(l):l),He(c),ct((null==i?void 0:i.data)||e.data),null==s||s(e.data,e)}}catch(e){null==E||E(e)}var d,u;d=a,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(a.stopToFirst=!1),ne(!1),De(!1)})),lt=Vi(ot),at=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=at(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:n}=k;return!j||z?e:(t-1)*n+e})(t)),e))),st=e=>{const t=Be(at(e));St(t),wt(t),Ye(Xe()),ae(Ze()),dt(),null==b||b(t)},ct=e=>{var t,n,r;if(!W)return;const i=null!==(n=null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:kd.summationKey,o=null!==(r=i?me(e,i):e)&&void 0!==r?r:{},a={};M.filter((e=>!!e.summation.dataKey)).forEach((e=>{$o(a,e.dataIndex,Number(Fo(o,e.summation.dataKey)))})),be(a)},dt=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=yt();if(e.length){const t=S(e[0],e[0].index);Ye([t])}else Ye([])}},ut=()=>{if(!z)return;const e=ht();Ae.current||k.current>=e||(De(!0),pt(Object.assign(Object.assign({},k),{current:k.current+1})))},pt=e=>{let{current:t,pageSize:n}=e;te((e=>Object.assign({},e,{current:t,pageSize:n})))},ht=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},mt=()=>{pt(Object.assign({},k,{current:1}))},ft=()=>{const{scrollYLoad:e,deriveRowKeys:t}=w.current;if(!w.current.treeTable||!e)return;const n=gt(t,(()=>{const{allTableData:e,allRowKeys:t}=w.current,{rowExpandable:n}=u||{},r=[];return"function"==typeof n&&e.forEach(((e,i)=>!n(e)&&r.push(t[i]))),r.length?F.filter((e=>!r.includes(e))):F})());ke.current.clear(),n.forEach(((e,t)=>ke.current.set(e,t)))},gt=(e,t)=>{const n=[];return e.forEach((e=>{if(e.children&&n.push(...gt(e.children,t)),void 0===e.parentRowKey)n.push(e.rowKey);else if(t.includes(e.parentRowKey)){e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1))&&n.push(e.rowKey)}})),n},vt=()=>{const{current:e,pageSize:t}=k;return w.current.tableFullData.slice((e-1)*t,e*t)},yt=()=>K?vt():w.current.tableFullData,bt=e=>{const{scrollYLoad:t,scrollYStore:n}=w.current;if(!t)return G(e);const{startIndex:r,endIndex:i}=n;Re?queueMicrotask((()=>Re((()=>G(e.slice(r,i)))))):G(e.slice(r,i))},xt=()=>{let e=yt();w.current.treeTable&&(null==h?void 0:h.virtual)&&(e=(e=>{const{recordsMap:t,allRowKeys:n}=w.current,r=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];ke.current.has(i)&&r.push(t.get(i))}return r})()),Me(e),Q(e)},Et=()=>{xt(),We()},St=e=>{X(e),J(e),ee(e),Ct(),ft(),Et()},wt=e=>{Z(e)},Ct=()=>{Te(),w.current.allTableData.forEach((e=>Ee(S(e,e.index),e)))},Tt=()=>{re({})},Nt=()=>{ie({})},It=()=>{oe([])},Rt=()=>{Ye([])};return{initialTable:()=>{it(),_e(),$e(),Me(),j?ot():st(o)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Xt("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:St,getTableData:ot,handleTableData:bt,createWebPageData:vt,createTableData:st,createGroupData:Be,createSelectionKeys:Xe,createRowExpandedKeys:Ze,setSelectionKeysEffect:Ye,findParentRowKeys:Je,getAllChildRowKeys:Qe,doFieldValidate:(e,t,n,r)=>{if(!Array.isArray(e))return Xt("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ne.removeFromRequired({x:n,y:r}),Ne.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&kn(t)&&Ne.addToRequired({x:n,y:r,text:e.message}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||Ne.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=Ne.state,o=Se(n,i),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!o.includes(e))),updated:r.filter((e=>![...Se(r,n),...Se(r,i)].includes(e))),removed:i.filter((e=>!o.includes(e)))}},dataChange:()=>{null==y||y(w.current.tableFullData)},tableChange:et,toLastPage:()=>{const e=ht();k.current!==e&&pt(Object.assign({},k,{current:e}))},toFirstPage:mt,getPageCount:ht,pagerChangeHandle:pt,triggerScrollXEvent:e=>{qe(e)},triggerScrollYEvent:e=>{ze(e)},scrollBottomDebouncer:Fe,clearTableSorter:Tt,clearTableFilter:Nt,clearSuperFilters:It,clearRowSelection:Rt,clearRowHighlight:()=>{se("")},clearTableLog:()=>{Ne.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;Ce(),Ne.destroy(),e.deregister(t),e.destroy()}}},$d=(e,n)=>{const{height:r,minHeight:i,maxHeight:o,ellipsis:l,showHeader:a,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,$size:h,tableColumns:m,flattenColumns:f,leftFixedColumns:g,derivedMergeCells:v,layout:y,scrollX:b,scrollY:x,showFooter:E,showPagination:S,isFullScreen:w,setLayout:C,setScrollX:T,setScrollY:N,setElementStore:I,setScrollXStore:R,setScrollYStore:O,setShouldToTop:k}=n,A=t.useRef(x),L=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=y,n={};return i&&Object.assign(n,{minHeight:`${Ho(i)}px`}),o&&Object.assign(n,{maxHeight:`${Ho(o)}px`}),w?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${Ho(r)}px`:`${t}px`}):n}),[r,o,i,w,y]),P=()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,i=a?e.$header.offsetHeight:y.headerHeight,o=E?e.$footer.offsetHeight:y.footerHeight,l=r-i-o,s=e.$tableBody.offsetHeight,c=t||s>l;let u=0;if(w){const t=e.$toper?e.$toper.offsetHeight+gd:0,r=e.$pager?e.$pager.offsetHeight+gd:0;u=n.winHeight-t-r-20}(t||l!==y.viewportHeight)&&D(l),A.current=c,N(c),C((e=>Object.assign({},e,{headerHeight:i,footerHeight:o,viewportHeight:l,tableBodyHeight:s,tableFullHeight:u})))},_=e=>{const{scrollXStore:t,isIE:n,scrollBarRef:r}=d.current,i=r.current.scrollLeft,{toVisibleIndex:o,visibleSize:l}=H(i,e),a=n?5:0,s=Math.max(0,o-1-a),c=Math.max(o+l+a,t.endIndex);R(Object.assign({},t,{visibleSize:l,offsetSize:a,startIndex:s,endIndex:c}))},H=(e,t)=>{const n=e+t;let r=-1,i=0,o=0;for(let t=0,l=f.length;t<l;t++){const l=f[t];if(i+=l.width||l.renderWidth,-1===r&&e<i&&(r=t),r>=0&&(o++,i>n))break}return{toVisibleIndex:Math.max(0,r),visibleSize:Math.max(8,o)}},D=e=>{const{scrollBarRef:t,scrollYStore:n,isIE:r}=d.current,i=t.current.scrollTop,{rowHeight:o}=n,{toVisibleIndex:l}=F(i,o),a=Math.max(8,Math.ceil(e/o)+2),s=r?5:0,c=Math.max(0,l-1-s),u=Math.max(l+a+s,n.endIndex);O(Object.assign({},n,{visibleSize:a,offsetSize:s,startIndex:c,endIndex:u}))},F=(e,t)=>{const n=Math.floor(e/t);return{toVisibleIndex:Math.max(0,n)}},$=(e,t)=>{const{scrollBarRef:n,elementStore:r,scrollYStore:i,scrollYLoad:o,tableFlatData:l}=d.current;if(void 0!==t&&t>=0)n.current.SET_SCROLL_TOP(t*i.rowHeight);else if(o){const t=l.findIndex((t=>e===c(t,t.index)));t>=0&&n.current.SET_SCROLL_TOP(t*i.rowHeight)}else{const t=r.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}};return{createElementStore:()=>{I("$toper",u.current),I("$table",p.current)},tableStyles:L,getSpan:(e,t,n,r,i)=>{let o=1,l=1;if("function"==typeof s){const a=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(a)?(o=a[0],l=a[1]):se(a)&&(o=a.rowSpan,l=a.colSpan)}if(v.length>0){const e=v.find((e=>e.row===n&&e.col===r));e&&(o=e.rowSpan,l=e.colSpan)}return{rowSpan:o,colSpan:l}},getStickyLeft:e=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Ro(Io(m,e)).dataIndex);let t=0;for(let n=0;n<f.length;n++){const r=f[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Oo(Io(m,e)).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()})(f):f;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{scrollBarRef:n}=d.current,r=void 0===t?f.findIndex((t=>t.dataIndex===e)):t;if(r<0)return;const i=g.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),o=f.slice(0,r).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);n.current.SET_SCROLL_LEFT(o-i)},scrollYToRecord:$,rowInViewport:e=>{const{scrollBarRef:t,scrollYStore:n}=d.current,{viewportHeight:r,gutterWidth:i}=y,o=e*n.rowHeight;return!(o<t.current.scrollTop||o+n.rowHeight>t.current.scrollTop+(b?r-i:r))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(S?Jl["small"!==h?"middle":h]+gd:0)-gd;C((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&$("",0),k(!0)},computeVirtualX:H,computeVirtualY:F,doLayout:()=>{l?P():Rn((()=>P())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,r=A.current?y.gutterWidth:0,{defaultColumnWidth:i}=kd,o=[];let l=0;if(f.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,l+=e.width):(e.renderWidth=void 0,o.push(e))})),o.length>0){const e=f.reduce(((e,t)=>e+(t.width||t.minWidth||i)),0);if(e<=n-r){T(!1);const t=n-r-e;if(1===o.length)o[0].renderWidth=(o[0].minWidth||i)+t;else{const e=t/o.reduce(((e,t)=>e+(t.minWidth||i)),0);let n=0;o.forEach(((t,r)=>{if(0===r)return;const o=Math.floor((t.minWidth||i)*e);n+=o,t.renderWidth=(t.minWidth||i)+o})),o[0].renderWidth=(o[0].minWidth||i)+t-n}}else T(!0),o.forEach((e=>{e.renderWidth=e.minWidth||i}));C((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else l=f.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||i)),0),T(l>n),C((e=>Object.assign(Object.assign({},e),{tableBodyWidth:l})));C((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&_(n)})()}}},Md=(e,n)=>{const{columns:r,summation:i,rowSelection:o,expandable:l,rowHighlight:a}=e,{tableRef:s,tableBodyRef:c,$size:d,scrollX:u,pagination:p,selectionKeys:h,rowExpandedKeys:m,highlightKey:f,summationRows:g,showSummary:v,isWebPagination:y,isScrollPagination:b,isTreeTable:x,checkDataIndex:E,toLastPage:S,toFirstPage:w,getPageCount:C,setHandleState:T,scrollYToRecord:N,setSelectionKeysEffect:I,setOriginColumns:R,setRowExpandedKeys:O,setHighlightKey:k,setResizeState:A,setPingRight:L,setUnMounted:P,calcTableHeight:_,createSelectionKeys:H,createRowExpandedKeys:D,initialTable:F,destroy:$}=n,M=t.useRef(g);fi((()=>{if(!o)return;const{onChange:e}=o;"radio"===o.type&&c.current.setClickedValues(h.length?[h[0],""]:[]),h.__prevent__||null==e||e(h,s.current.selectionRows),delete h.__prevent__}),[h]),fi((()=>{if(!l)return;const{onChange:e}=l;m.__prevent__||null==e||e(m,m.map((e=>s.current.recordsMap.get(e)))),delete m.__prevent__}),[m]),fi((()=>{var e,t;x&&O(D()),a&&(c.current.setClickedValues(f?[f,""]:[]),null===(e=a.onChange)||void 0===e||e.call(a,f,null!==(t=s.current.recordsMap.get(f))&&void 0!==t?t:null))}),[f]),fi((()=>{var e;ge(g,M.current)||(M.current=g,v&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,g)))}),[g]),fi((()=>{const e=H(o.selectedRowKeys);ge(e,h)||(e.__prevent__=!0,I(e),x&&O(D()))}),[null==o?void 0:o.selectedRowKeys]),fi((()=>{const e=D(l.expandedRowKeys);ge(e,m)||(e.__prevent__=!0,O(e))}),[null==l?void 0:l.expandedRowKeys]),fi((()=>{const{currentRowKey:e}=a;e!==f&&k(null!=e?e:"")}),[null==a?void 0:a.currentRowKey]),fi((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?S():w()),N("","after"===e?1e5:0)),t&&p.current>C()&&S(),(e||t)&&T({insert:null,remove:!1})}),[p.total]),fi((()=>{L(u)}),[u]),fi((()=>{_()}),[d]),fi((()=>{s.current.scrollYLoad&&(e.height||e.maxHeight||Xt("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||Xt("Table","必须设置组件参数 `ellipsis`")),b&&(e.height||e.maxHeight||Xt("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,b]);const q=Cd((()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(A(Object.assign({},e,{winHeight:n})),_())}));t.useEffect((()=>(R(Ln(r)),F(),window.addEventListener("resize",q,!1),E(),Rn((()=>_())),()=>{$(),window.removeEventListener("resize",q),P(!0)})),[])},qd=e=>{const{total:n}=e,{tableRef:r,selectionKeys:i,isHeadSorter:o,isHeadFilter:l,isTreeTable:a,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=t.useContext(hd),{infoBarConfig:h,rowSelection:m,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:v}=r.current,{hideAlert:y,hideClearButton:b}=h||{},x=t.useMemo((()=>!y),[y]),E=t.useMemo((()=>!b&&!!(o||l||m||f)),[b,o,l,m,f]),S={[`${Fn("table")}__alert`]:!0};return x?t.createElement("div",{className:De(S)},t.createElement("i",{className:"svgicon icon"},t.createElement(tt,null)),t.createElement("span",null,Bt("qm.table.alert.total",{total:a?g.length:n}),m?`,${Bt("qm.table.alert.selected",{total:Math.max(i.length-v.length,0)})}`:""),E&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),Rn((()=>s()))}},Bt("qm.table.alert.clear"))):null},jd=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{setFullScreen:o}=t.useContext(hd),l=()=>{o(!r)};t.useImperativeHandle(n,(()=>({clickHandle:l})));const a=Fn("table");return i?t.createElement("span",{className:`${a}-full-screen`,title:Bt(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>l()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(je,null):t.createElement(Ve,null))):null}));jd.displayName="FullScreen";const Vd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{getTableData:i}=t.useContext(hd),o=()=>{i()};t.useImperativeHandle(n,(()=>({clickHandle:o})));const l=Fn("table");return r?t.createElement("span",{className:`${l}-reload`,title:Bt("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ye,null))):null}));Vd.displayName="Reload";const Kd=()=>{const e={dateFormat:e=>{const t=e?g(e).format(bd):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?g(e).format(xd):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?g(e).format(xd.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>qo(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>jo(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,o,l,a;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:p}=n,h=s||(null===(i=null==p?void 0:p(r,n))||void 0===i?void 0:i.items)||[];let m=null!==(a=null!==(l=null===(o=h.find((e=>e.value==t)))||void 0===o?void 0:o.text)&&void 0!==l?l:t)&&void 0!==a?a:"";if(Array.isArray(t)&&(m=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&&""!==m&&(m=qo(m)?new Lt(m).toFixed(c):m),d>=0&&""!==m&&(m=Vo(m,d)),u){const t=e[`${On(u)}Format`];t?m=t(m):Xt("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>wn(e)?Bo(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,o)=>{const l=Fo(e,r.dataIndex),a=r.render?r.render(l,e,r,i,o):t(l,r,e);return n(a)}}},zd=t.forwardRef(((e,n)=>{var r,i,o,l;const{tableColumns:a,open:s=!0}=e,{global:c}=t.useContext(Vt),{tableRef:d,flattenColumns:u,summationRows:p,showSummary:h,getSpan:m}=t.useContext(hd),{tablePrint:f,showHeader:g}=d.current.props,{getTitleFromCellValue:v}=Kd(),y=null!==(i=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==i?i:"",b=null!==(l=null===(o=null==c?void 0:c.print)||void 0===o?void 0:o.rightLogo)&&void 0!==l?l:"",x=!(!y&&!b),E=t.useMemo((()=>Ln(ko(a,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn]))),[a]),S=t.useMemo((()=>Ln(ko(u,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn]))),[u]),w=t.useMemo((()=>Ln(a.filter((e=>e.printFixed)))),[a]),C=e=>{const t=Object.assign({},Zo(E,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?C(t):t},T=(e,t)=>Ce(Te(Ne(e),t),Ie((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Re(...n,((e,n)=>{if(Array.isArray(e))return T(e.concat(n),t)}))}))),N=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(C(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]:T(n,"dataIndex")[0]})))(n),t.push(Po(n))})),t},I=()=>{const{allTableData:e}=d.current,t=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const o=e[i];r+=o.width||o.renderWidth||o.minWidth||kd.defaultColumnWidth,r<=kd.printWidth?(n.push(o),i===e.length-1&&t.push(n),i++):i>0?(e.splice(0,i),w.length&&e.unshift(...w),t.push(n),n=[],r=0,i=0):(o.width=kd.printWidth,n.push(o),t.push(n),i++)}return t})([...S]),n=N(t);let r=["<!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 i=0;i<t.length;i++)r+=R(n[i],t[i],e),r+='<div class="page-break"></div>';return r+"</body></html>"},R=(e,t,n)=>{const{showLogo:r=!0}=f;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((e=>{let{width:t,minWidth:n,renderWidth:r}=e;return`<col style="width:${t||r||n||kd.defaultColumnWidth}px">`})).join("")}</colgroup>`,g&&(i+=["<thead>",r&&x?`<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">',y?`<img src="${y}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" 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}">${Uo(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${n.map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:o}=m(e,t,e.index,r,n);return i&&o?`<td rowspan="${i}" colspan="${o}">${v(e,t,e.index,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),h&&p.length&&(i+=["<tfoot>",p.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:i,summation:o}=t,l=(null==o?void 0:o.render)?o.render(n):Fo(e,`${i}_text`);return`<td>${0===r&&""===l?Bt("qm.table.config.summaryText"):wn(l)?Bo(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},O=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:i}=e,o=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!i)return Promise.resolve({type:r,content:t,blob:e});Gi(e,o)}})({filename:"print",type:"html",isDownload:!1},I()))||void 0===e||e.then((e=>{let{content:t,blob:n}=e,r=document.createElement("iframe");r.setAttribute("frameborder","0"),r.setAttribute("width","100%"),r.setAttribute("height","0"),r.style.display="none",document.body.appendChild(r),d.current.isIE?(r.contentDocument.write(t),r.contentDocument.execCommand("print"),r.parentNode.removeChild(r),r=null):(r.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{r.parentNode.removeChild(r),r=null}))},r.src=URL.createObjectURL(n))}))};t.useImperativeHandle(n,(()=>({clickHandle:O})));const k=Fn("table");return s?t.createElement("span",{className:`${k}-print`,title:Bt("qm.table.print.text"),onClick:()=>O()},t.createElement("i",{className:"svgicon icon"},t.createElement(nt,null))):null}));zd.displayName="TablePrint";const Wd="606060",Bd="thin",Ud="d4d4d4",Gd=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Yd=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Xd=()=>({top:{style:Bd,color:{argb:Ud}},left:{style:Bd,color:{argb:Ud}},bottom:{style:Bd,color:{argb:Ud}},right:{style:Bd,color:{argb:Ud}}}),Zd=e=>{const{children:t}=e;return t&&t.length?Zd(t[0]):e},Qd=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},Jd=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(hd),{spanMethod:o,showHeader:l}=e.current.props,a=(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,a,s,c)=>En(void 0,void 0,void 0,(function*(){const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:p}}=e.current,h=wo(d),m=Po(d),f=[],g=[],v=[],y=[];let b=0;const x={};h.forEach((e=>{const{dataIndex:t,width:n,minWidth:r,renderWidth:i}=e;x[t]=Uo(e.title),v.push({key:t,width:(n||i||r||kd.defaultColumnWidth)/8})})),l&&(i?m.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,o=Zd(e),l=h.findIndex((e=>{let{dataIndex:t}=e;return t===o.dataIndex}));n[o.dataIndex]=Uo(e.title),0!==r&&(r>1||i>1)&&y.push({s:{r:t,c:l},e:{r:t+i-1,c:l+r-1}})})),f.push(n)})):(h.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&y.push({s:{r:b,c:t},e:{r:b+r-1,c:t+n-1}})})),f.push(x)),b+=f.length);const E=a.map(((e,t)=>{const r={};return h.forEach(((i,l)=>{if("function"==typeof o){const{rowSpan:r,colSpan:o}=n(e,i,t,l,a);(o>1||r>1)&&y.push({s:{r:t+b,c:l},e:{r:t+b+r-1,c:l+o-1}})}const s=["percent","finance"].includes(i.formatType);r[i.dataIndex]=s?Fo(e,i.dataIndex):c(e,t,i,l)})),r}));b+=E.length,r&&u&&s(h,a).forEach(((e,t)=>{const n={};h.forEach(((t,r)=>{const{dataIndex:i,summation:o}=t,l=(null==o?void 0:o.render)?o.render(a):Fo(e,i);n[i]=0===r&&""===l?Bt("qm.table.config.summaryText"):wn(l)?Bo(l).join(""):l})),g.push(n)}));const{sheetName:S,useStyle:w}=t,C=new qt.Workbook,T=C.addWorksheet(S);T.columns=v,l&&T.addRows(f).forEach((e=>{w&&Gd(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Io(d,t.key),{align:r,theadAlign:i}=n;Yd(e,i||r),w&&Object.assign(e,{font:{bold:!0,color:{argb:Wd}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Xd()})}))})),T.addRows(E).forEach((e=>{w&&Gd(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Io(d,t.key),{align:r}=n;Yd(e,r),Object.assign(e,Qd(n)),w&&Object.assign(e,{font:{color:{argb:Wd}},border:Xd()})}))})),r&&u&&T.addRows(g).forEach((e=>{w&&Gd(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Io(d,t.key),{align:r}=n;Yd(e,r),Object.assign(e,Qd(n)),w&&Object.assign(e,{font:{color:{argb:Wd}},border:Xd()})}))})),y.forEach((e=>{let{s:t,e:n}=e;T.mergeCells(t.r+1,t.c+1,n.r+1,n.c+1)}));const N=yield C.xlsx.writeBuffer();return new Blob([N],{type:"application/octet-stream"})})),exportCSV:(e,t)=>{const n=e=>{let t=e;const n=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),r=-1!==e.indexOf('"');return r&&(t=t.replace(/"/g,'""')),(n||r)&&(t='"'+t+'"'),t},r="\ufeff"+(e=>{let t,r,i,o,l="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],r=0;r<i.cells.length;r+=1)o=i.cells[r],l=l+(r?",":"")+n(o.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var i;return((e,t,n)=>{t=t||"",n=n||512;const r=window.atob(e),i=[];let o;for(o=0;o<r.length;o+=n){const e=r.slice(o,o+n),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const a=new window.Uint8Array(t);i.push(a)}return new window.Blob(i,{type:t})})((i=r,window.btoa(unescape(encodeURIComponent(i)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:r}=e,i=wo(n),o=new FileReader;o.onerror=()=>{k.error(Bt("qm.table.import.error"))},o.onload=e=>{const n=i.map((e=>Uo(e.title))),r=new qt.Workbook,o=e.target;o?r.xlsx.load(o.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),l=e[o],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(s){const r=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("")),se(i)&&"text"in i&&(i=i.text),Oe(i)&&(i=zo(i,xd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[l[n]]=i}));const r={};return n.forEach(((e,n)=>{var o;const{dataIndex:l,dictItems:s}=i[n];Array.isArray(s)&&((null===(o=t[e])||void 0===o?void 0:o.toString().includes(","))?t[e]=t[e].split(",").map((e=>a(s,e))).filter((e=>""!==e)):t[e]=a(s,t[e])),$o(r,l,t[e])})),r}));null==t||t(r)}else k.error(Bt("qm.table.import.error"))}else k.error(Bt("qm.table.import.error"))})):k.error(Bt("qm.table.import.error"))},o.readAsArrayBuffer(r)}}},eu=e=>{const{fileType:n,onChange:r}=e;let i,o;const l=Fn("table"),a=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}},s=()=>En(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),o=document.createElement("input"),i.className=`${l}--file-form`,o.name="file",o.type="file",i.appendChild(o),document.body.appendChild(i)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:s}=l.target,c=s[0];let d="";if(!r)for(let e=0;e<s.length;e++){const{type:n}=a(s[e]);if(t.type!==n){d=n;break}}d?(k.warning(Bt("qm.upload.notType",{type:d})),n()):e(c),document.body.removeChild(i),i=null,o=null},i.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(_n,{onClick:()=>s()},Bt("qm.upload.text"))},tu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,createTableData:o,dataChange:l}=t.useContext(hd),{beforeTableImport:a}=i.current.props,{importXLSX:s}=Jd(),c=t.useRef(null),[d,u]=t.useState(!1),[p,h]=t.useState(!0),m=e=>e.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))),[f,g]=t.useState([{type:"INPUT",label:Bt("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(eu,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&h(!1)}}))}},{type:"SELECT",label:Bt("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:Bt("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:Bt("qm.table.import.fillText"),value:"fill"},{text:Bt("qm.table.import.addText"),value:"add"},{text:Bt("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{f.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,g([...f])}},{type:"INPUT_NUMBER",label:Bt("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:i.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),v=Fn("table");return t.createElement("div",{className:`${v}-import__setting`},t.createElement(Fc,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:f,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(_n,{onClick:()=>r(),style:{marginRight:8}},Bt("qm.table.export.closeButton")),t.createElement(_n,{type:"primary",loading:d,disabled:p,onClick:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield c.current.GET_FORM_DATA();e||(u(!0),s({columns:m(n),file:t.file},(e=>En(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:s}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof a)try{e=yield a(e)}catch(e){}if("fill"===t.importType&&o(e),"add"===t.importType&&o([...n,...e]),"insert"===t.importType){const{tableFullData:n}=i.current,r=t.posIndex,l=n.slice(0,r).concat(e).concat(n.slice(r));o(l)}e.forEach((e=>{s.addToInserted(e)})),l(),k.success(Bt("qm.table.import.success",{total:e.length})),u(!1),r()})))))}))},Bt("qm.table.import.text"))))},nu=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,[o,l]=t.useState(!1),a=()=>{l(!0)};t.useImperativeHandle(n,(()=>({clickHandle:a})));const s={[`${Fn("table")}-import`]:!0},c={visible:o,title:Bt("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:De(s),title:Bt("qm.table.import.textNoSpace"),onClick:()=>a()},t.createElement("i",{className:"svgicon icon"},t.createElement(rt,null))),t.createElement(lo,c,t.createElement(tu,{columns:r,onClose:()=>l(!1)})))}));nu.displayName="TableImport";const ru=e=>{const{columns:n,onChange:r}=e,{$size:i}=t.useContext(hd),o=t.useRef([]),[l,a]=t.useState(!1),[s,c]=t.useState(n);fi((()=>{u()}),[s]),t.useEffect((()=>{d()}),[n]);const d=()=>{const e=[];n.forEach(((t,r)=>{const i=t.colSpan;i>1&&n.slice(r+1,r+i).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(n.slice(r,r+i))})),o.current=e},u=()=>{const e=[];s.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(((e,n)=>{let{dataIndex:r}=e;const i=s.find((e=>e.dataIndex===r));return n>0&&void 0!==t.hidden&&(i.hidden=t.hidden),i})))})),null==r||r(e)},p=Fn("table"),h={[`${p}__popper`]:!0,"column-filter__popper":!0,[`${p}--lg`]:"large"===i,[`${p}--sm`]:"small"===i},m=[`${p}-column-filter`,{selected:l}];return t.createElement(Hs,{action:["click"],popupVisible:l,popup:t.createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"main"},t.createElement($t,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),n=s.map((e=>e.dataIndex));ge(t,n)||c(tl(e))}},s.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,c([...s])}}),t.createElement("i",{className:De(i),title:Bt("qm.table.columnFilter.draggable")},t.createElement(Ke,null)),t.createElement("span",{className:"text"},Uo(e.title)))})(e,"main")))))),popupClassName:De(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{a(e)},builtinPlacements:Sd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:De(m),title:Bt("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(it,null)),t.createElement("span",null,Bt("qm.table.columnFilter.text"))))},iu=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:o,selectionKeys:l,pagination:a,showSummary:s}=t.useContext(hd),{rowSelection:c}=o.current.props,d=t.useRef(null),[u,p]=t.useState(!1),h=t.useMemo((()=>Object.assign({},{fileName:`${g().format(Ed)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:l.length?"selected":"all","startIndex|endIndex":[1,a.total],footSummation:s?1:0,useStyle:0},n,{columns:Ln(n.columns||[])})),[]),[m,f]=t.useState([{type:"INPUT",label:Bt("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:Bt("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:Bt("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:Bt("qm.table.export.all"),value:"all"},{text:Bt("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==c?void 0:c.type)},{text:Bt("qm.table.export.custom"),value:"custom"}]},onChange:e=>{m.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,f([...m])}},options:{min:1},disabled:!0},{type:"INPUT",label:Bt("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t.createElement(ru,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:Bt("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:Bt("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),v=Fn("table");return t.createElement("div",{className:`${v}-export__setting`},t.createElement(Fc,{ref:d,initialValues:h,items:m,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(_n,{onClick:()=>r(),style:{marginRight:8}},Bt("qm.table.export.closeButton")),t.createElement(_n,{type:"primary",loading:u,onClick:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield d.current.GET_FORM_DATA();if(!e){p(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);i(t),yield In(1e3),p(!1),r()}}))},Bt("qm.table.export.text"))))},ou=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:o=!0}=e,{global:l}=t.useContext(Vt),{tableRef:a,flattenColumns:s,pagination:c,fetchParams:d,isFetch:u,isGroupSubtotal:p,showSummary:h,getSpan:m}=t.useContext(hd),{exportExcel:f,fetch:v,showHeader:y}=a.current.props,{getTitleFromCellValue:b}=Kd(),[x,E]=t.useState(!1),[S,w]=t.useState(!1),C=t.useMemo((()=>{var e;return!!(null===(e=null==f?void 0:f.fetch)||void 0===e?void 0:e.api)}),[f]),T=t.useMemo((()=>!c.total||S),[c.total,S]),N=t.useMemo((()=>ko(i,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn])),[i]),I=t.useMemo((()=>ko(s,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn])),[s]),R=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map(((e,r)=>{const i=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),o=t?`${t}.${i.index+1}`:`${i.index+1}`;return i.indexPath=o,i._level=n,Array.isArray(e.children)&&(i.children=R(e.children,o,n+1)),I.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&$o(i,t,Fo(i,t))})),i}))},O=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(p?Go(t):t).reduce(((e,t)=>{if(null==t?void 0:t[kd.summaryIgnore])return e;const n=Number(Fo(t,r));return Number.isNaN(n)?e:e+n}),0);$o(n,r,i)})),[n]},A=(e,t,n,r)=>{const{precision:i,formatType:o}=n;let l=b(e,n,t,r);return i>=0&&!o&&""!==l&&(l=Number(l)),l},{exportXLSX:L,exportCSV:P}=Jd(),_=e=>En(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:i,dataKey:o}=v;let l=[];try{w(!0);const a=yield n(Object.assign(Object.assign({},r(d)),{[kd.currentPageName]:1,[kd.pageSizeName]:null!=e?e:c.total}));if(200===a.code){let e=Array.isArray(a.data)?a.data:null!==(t=me(a.data,o))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,l=Lo(R(e))}}catch(e){}return w(!1),l})),H=e=>{var t;const n=null===(t=null==l?void 0:l.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},D=(e,t)=>{const{columns:n,footSummation:r}=e,i=Po(n),o=wo(n);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${o.map((e=>{let{width:t,minWidth:n,renderWidth:r}=e;return`<col style="width:${t||r||n||kd.defaultColumnWidth}px">`})).join("")}</colgroup>`,y&&(l+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Uo(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${t.map((e=>`<tr>${o.map(((n,r)=>{const{rowSpan:i,colSpan:o}=m(e,n,e.index,r,t);return i&&o?`<td rowspan="${i}" colspan="${o}">${A(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),h&&r&&(l+=["<tfoot>",O(o,t).map((e=>`<tr>${o.map(((n,r)=>{const{dataIndex:i,summation:o}=n,l=(null==o?void 0:o.render)?o.render(t):Fo(e,i);return`<td>${0===r&&""===l?Bt("qm.table.config.summaryText"):wn(l)?Bo(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},F=null!==(r=null==f?void 0:f.fileName)&&void 0!==r?r:`${g().format(Ed)}.xlsx`,$=F.slice(F.lastIndexOf(".")+1).toLowerCase(),M=()=>{if(T)return k.warning(Bt("qm.table.export.warnText"));var e;C?(e=F,En(void 0,void 0,void 0,(function*(){w(!0);try{const{api:t,params:n}=f.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:I.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:i}=e.filter||{};return{title:t,dataIndex:n,type:i,hidden:r}}))},d),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[kd.currentPageName]:void 0,[kd.pageSizeName]:void 0}));r.data&&(Gi(r.data,e),H(e))}catch(e){}w(!1)}))):E(!0)};t.useImperativeHandle(n,(()=>({clickHandle:M})));const q={[`${Fn("table")}-export`]:!0},j={visible:x,title:Bt("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>E(!1)},V={fileName:F.slice(0,F.lastIndexOf(".")),fileType:$,columns:N,useStyle:(null==f?void 0:f.cellStyle)?1:0};return t.createElement(t.Fragment,null,o&&t.createElement("span",{className:De(q),title:Bt("qm.table.export.textNoSpace"),onClick:()=>M()},t.createElement("i",{className:"svgicon icon"},t.createElement(qe,null))),t.createElement(lo,j,t.createElement(iu,{defaultValue:V,onClose:()=>E(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:Co(e.columns)}),En(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:o}=t,{allTableData:l,selectionRows:s}=a.current;let c=[];if(u?("all"===r&&(c=yield _()),"custom"===r&&(c=yield _(o),c=c.slice(i-1))):("all"===r&&(c=l.slice(0)),"custom"===r&&(c=l.slice(i-1,o||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==f?void 0:f.beforeExport))try{c=null==f?void 0:f.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield L(t,c,O,A);Gi(n,`${e}.xlsx`),H(`${e}.xlsx`)}if("csv"===n){const n=P(t,D(t,c));Gi(n,`${e}.csv`),H(`${e}.csv`)}}))}})))}));ou.displayName="TableExport";const lu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:o,dataChange:l}=t.useContext(hd),{beforeClipboard:a}=i.current.props,s=t.useRef(null),[c,d]=t.useState([{type:"INPUT_NUMBER",label:Bt("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:Bt("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:n.map(((e,t)=>({value:t,text:Uo(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:Bt("qm.table.clipboard.content"),fieldName:"content",placeholder:Bt("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[u,p]=t.useState(!1),h=Fn("table");return t.createElement("div",{className:`${h}-clipboard__setting`},t.createElement("h3",{className:"info"},Bt("qm.table.clipboard.supportText")),t.createElement(Fc,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:c,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(_n,{onClick:()=>r(),style:{marginRight:8}},Bt("qm.table.export.closeButton")),t.createElement(_n,{type:"primary",loading:u,onClick:()=>En(void 0,void 0,void 0,(function*(){var e;const[t,c]=yield s.current.GET_FORM_DATA();if(t)return;const{tableFullData:d,store:u}=i.current;p(!0);const h=c.content.trim().replace(/(\r|\n)$/,"");let m=h.replace(/"[^"]+"/g,"^");((null===(e=h.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{m=m.replace(/\^/,e)}));let f=m.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof a)try{f=yield a(f,f[0].map(((e,t)=>n[c.colIndex+t].dataIndex)))}catch(t){}f.forEach(((e,t)=>{e.forEach(((e,r)=>{var o,l;const a=d[c.rowIndex-1+t],s=n[c.colIndex+r];if(a&&s){let t=!1;if(s.editRender){const e=s.editRender(a,s);t=!(e.disabled||(null===(o=e.extra)||void 0===o?void 0:o.disabled)||(null===(l=i.current.fieldAuth[s.dataIndex])||void 0===l?void 0:l.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&($o(a,s.dataIndex,e),u.addToUpdated(a))}}))})),o.current.forceUpdate(),l(),k.success(Bt("qm.table.clipboard.success",{total:f.length})),p(!1),r()}))},Bt("qm.table.clipboard.text"))))},au=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{flattenColumns:i}=t.useContext(hd),[o,l]=t.useState(!1),a=t.useMemo((()=>(e=>e.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))))(i)),[i]),s=()=>{l(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={[`${Fn("table")}-clipboard`]:!0},d={visible:o,title:Bt("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:De(c),title:Bt("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(ot,null))),t.createElement(lo,d,t.createElement(lu,{columns:a,onClose:()=>l(!1)})))}));au.displayName="TableClipboard";const su=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:o,selectionKeys:l,setSelectionKeysEffect:a}=t.useContext(hd),{rowKey:s,rowSelection:c}=i.current.props,d=t.useRef(null),u=Mi(d),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,m]=t.useState([{title:Bt("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(n.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))))]),[f]=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})()),[g,v]=t.useState(300),y=Vi((()=>{const e=d.current;v(e.offsetHeight-2*Jl[o]-30)}),5);return ji((()=>{y()}),[u.width]),t.createElement("div",{ref:d,style:{height:"100%"}},t.createElement(Zu,{size:o,columns:h,dataSource:f,rowKey:s,height:g,rowSelection:{type:"checkbox",selectedRowKeys:l,onChange:e=>a(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>m(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(_n,{onClick:()=>r()},Bt("qm.table.selectCollection.closeButton"))))},cu=t.forwardRef(((e,n)=>{const{columns:r,open:i=!0}=e,{tableRef:o,getRowKey:l,selectionKeys:a,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=t.useContext(hd),{rowSelection:p}=o.current.props,[h,m]=t.useState(!1),f=t.useRef(!1);fi((()=>{!f.current&&g()}),[c]);const g=()=>En(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=p;if(s&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:a},t.params));if(200===r.code){let i=Array.isArray(r.data)?r.data:null!==(e=me(r.data,t.dataKey))&&void 0!==e?e:[];i=i.filter((e=>!n(e))),d(i.map(((e,t)=>l(e,t)))),u(i),f.current=!0}}catch(e){}})),v=()=>{m(!0)};t.useImperativeHandle(n,(()=>({clickHandle:v})));const y=Fn("table"),b={visible:h,title:Bt("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:`${y}-select-collection`,title:Bt("qm.table.selectCollection.text"),onClick:()=>v()},t.createElement("i",{className:"svgicon icon"},t.createElement(lt,null))),t.createElement(lo,b,t.createElement(su,{columns:r,onClose:()=>m(!1)})))}));cu.displayName="SelectCollection";const du=e=>{const{onClose:n}=e,{global:r}=t.useContext(Vt),{tableRef:i,getRowKey:o,$size:l,flattenColumns:a,pagination:s,createWebPageData:c,setPagination:d,scrollYToRecord:u,setHighlightKey:p,setShouldToTop:h,isTreeTable:m,isWebPagination:f}=t.useContext(hd),{uniqueKey:g}=i.current.props,v=t.useRef(null),y=t.useRef(null),b=t.useRef([]),x=t.useRef(""),E=t.useRef(-1),S=t.useRef("stop");fi((()=>{const e=Lo(c()).findIndex((e=>o(e,e.index)===x.current));u("",e)}),[s.current]);const w=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},C=e=>e.filter((e=>null==e?void 0:e.dataIndex)).map((e=>{var t;return{type:w(e.filter.type),fieldName:e.dataIndex,label:Uo(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:null!==(t=e.dictItems)&&void 0!==t?t:[]},onChange:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA(),[n,r]=yield y.current.GET_FORM_DATA(),i=ke(Object.assign({},t,r),kn);R(i)}))}})),T={case:0,fullchar:0},N=t.useMemo((()=>a.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[a]),[I,R]=t.useState({}),[O,k]=t.useState(T),[A]=t.useState(C([N[0]])),[L]=t.useState(C(N.slice(1))),[H,D]=t.useState(0),F=t.useMemo((()=>!Object.keys(I).length),[I]);fi((()=>{S.current="ready"}),[I,O]);const $=e=>{k(Object.assign({},O,e))},q=(e,t,n)=>new Promise(((r,i)=>{P.confirm({title:Bt("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),j=e=>En(void 0,void 0,void 0,(function*(){if(!Object.keys(I).length)return P.warning({title:Bt("qm.button.confirmPrompt"),content:Bt("qm.table.fastSearch.queryCondition")});if("ready"===S.current&&(S.current="stop",b.current=(e=>{const{allTableData:t}=i.current,n=[];for(let i=0,o=t.length;i<o;i++){const o=t[i];let l=!0;for(const t in e){const{type:n}=N.find((e=>e.dataIndex===t)).filter;let i=Fo(o,t),a=!0;if("text"===n||"textarea"===n?a=new RegExp(O.fullchar?`^${e[t]}$`:e[t],O.case?"":"i").test(i):(i="string"==typeof(r=i)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(r)?i.slice(0,10):i,a=i==e[t]),!a){l=!1;break}}l&&n.push(o)}var r;return n})(I),D(b.current.length)),!b.current.length)return p(""),P.warning({title:Bt("qm.button.confirmPrompt"),content:Bt("qm.table.fastSearch.notMatch")});"next"===e&&(E.current=E.current<0?0:E.current+1,E.current>b.current.length-1&&(yield q(Bt("qm.table.fastSearch.toTheEnd"),(()=>E.current=0),(()=>E.current=b.current.length-1)))),"prev"===e&&(E.current=E.current<0?b.current.length-1:E.current-1,E.current<0&&(yield q(Bt("qm.table.fastSearch.toStart"),(()=>E.current=b.current.length-1),(()=>E.current=0))));const t=b.current[E.current],n=o(t,t.index);let r=t.index;if(m&&f){const e=Qo(i.current.deriveRowKeys,n)[0];r=i.current.tableFullData.findIndex((t=>o(t,t.index)===e))}((e,t)=>{if(x.current=e,f){const{pageSize:e}=s,n=Math.ceil((t+1)/e);h(!1),d(Object.assign({},s,{current:n}))}else u(e)})(n,r),p(n)})),V=()=>{v.current.RESET_FORM(),y.current.RESET_FORM()},K=t.useMemo((()=>g?`fastSearch_${g}`:""),[g]),[z,W]=t.useState([]),[B,U]=t.useState(""),[G,Y]=t.useState("");fi((()=>{if(G){const{filters:e,config:t}=z.find((e=>e.value===G)).list;v.current.SET_FIELDS_VALUE(An(e,L.map((e=>e.fieldName)))),y.current.SET_FIELDS_VALUE(An(e,A.map((e=>e.fieldName)))),R(e),k(t)}else V(),R({}),k(T)}),[G]),t.useEffect((()=>{X()}),[]);const X=()=>En(void 0,void 0,void 0,(function*(){if(!K)return;let e=yield Mt.getItem(K);e||(e=yield Z(K),Array.isArray(e)&&(yield Mt.setItem(K,e))),Array.isArray(e)&&e.length&&(W(e),Y(e[0].value))})),Z=e=>En(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)=>En(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),J=Fn("table");return t.createElement("div",{className:`${J}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"top"},t.createElement("div",{className:"container"},t.createElement(no,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,Bt("qm.table.alert.total",{total:H}))},t.createElement(no.TabPane,{tab:Bt("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t.createElement(Fc,{ref:v,items:A,cols:1,labelWidth:110})),t.createElement(no.TabPane,{tab:Bt("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t.createElement(Fc,{ref:y,items:L,cols:1,labelWidth:110})))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(_,{size:l,value:B,placeholder:Bt("qm.table.highSearch.configText"),disabled:F,onChange:e=>{const{value:t}=e.target;U(t)}}),t.createElement(_n,{type:"primary",disabled:!B||F,style:{marginLeft:"10px"},onClick:()=>En(void 0,void 0,void 0,(function*(){if(!K)return Xt("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Wo(),t=[...z,{text:B,value:e,list:{filters:I,config:O}}];W(t),Y(e),U(""),yield Mt.setItem(K,t),yield Q(K,t)}))},Bt("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${kd.rowHeightMaps[l]}px`}},t.createElement("span",null,Bt("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,z.map((e=>t.createElement("li",{key:e.value,className:De({selected:e.value===G}),title:e.text,onClick:()=>{return t=e.value,void Y(t!==G?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:Bt("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,En(void 0,void 0,void 0,(function*(){if(!n)return;const e=z.filter((e=>e.value!==n));W(e),n===G&&Y(""),yield Mt.setItem(K,e),yield Q(K,e)}))}},t.createElement(at,null))))),!z.length&&t.createElement("div",{style:{padding:gd}},t.createElement(Pi,null)))))),t.createElement("div",{className:"bottom"},t.createElement("div",null,t.createElement(M,{checked:!!O.case,onChange:e=>$({case:e.target.checked})},Bt("qm.table.fastSearch.matchCase")),t.createElement(M,{checked:!!O.fullchar,onChange:e=>$({fullchar:e.target.checked})},Bt("qm.table.fastSearch.matchFullchar"))),t.createElement("div",null,t.createElement(_n,{onClick:()=>V()},Bt("qm.table.fastSearch.clear"))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Jl[l]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>n(),style:{marginRight:8}},Bt("qm.table.fastSearch.closeButton")),t.createElement(_n,{type:"primary",style:{marginRight:8},onClick:()=>j("prev")},Bt("qm.table.fastSearch.queryPrev")),t.createElement(_n,{type:"primary",onClick:()=>j("next")},Bt("qm.table.fastSearch.queryNext"))))},uu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{$size:i}=t.useContext(hd),[o,l]=t.useState(!1),a=()=>{l(!0)};t.useImperativeHandle(n,(()=>({clickHandle:a})));const s=Fn("table"),c={visible:o,title:Bt("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Jl[i]+20}px`},onClose:()=>l(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${s}-super-search`,title:Bt("qm.table.fastSearch.text"),onClick:()=>a()},t.createElement("i",{className:"svgicon icon"},t.createElement(st,null))),t.createElement(lo,c,t.createElement(du,{onClose:()=>l(!1)})))}));uu.displayName="FastSearch";const pu=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:o,$size:l,pagination:a,fetchParams:s,isFetch:c}=t.useContext(hd),{fetch:d}=o.current.props,u=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},u(e.group)))),h=i.map((e=>e.summary===kd.groupSummary.total.value?{dataIndex:e.summary,title:kd.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},u(e.summary)),{formula:e.formula}))),m=t.useMemo((()=>Object.assign({},s,{[kd.sorterFieldName]:void 0,[kd.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[kd.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[kd.currentPageName]:1})),[s,r,i]),[f,v]=t.useState(((e,t)=>[{title:Bt("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===kd.groupSummary.total.value&&(i={dataIndex:kd.groupSummary.recordTotalIndex,summation:{render:()=>a.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?i:null)}))])(p,h)),[y]=t.useState(c?[]:(e=>{const t=Xo(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};f.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&$o(t,r,Fo(e[0],r))})),i.forEach((n=>{const r=n.summary!==kd.groupSummary.total.value?n.summary:kd.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&$o(t,r,e.length),"sum"===i&&$o(t,r,Ae(e,r)),"max"===i&&$o(t,r,Le(e,r)[r]),"min"===i&&$o(t,r,Pe(e,r)[r]),"avg"===i&&$o(t,r,(Ae(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(o.current.tableFullData)),b=Object.assign(Object.assign({size:l,height:400},c?{fetch:{api:d.api,params:m,dataKey:null==d?void 0:d.dataKey}}:{dataSource:y}),{columns:f,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${g().format(Ed)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)});return t.createElement(Zu,b)},hu=e=>{const{onClose:n}=e,{global:r}=t.useContext(Vt),{tableRef:i,$size:o,flattenColumns:l}=t.useContext(hd),{uniqueKey:a}=i.current.props,s=t.useRef(null),c=t.useRef(null),[d,u]=t.useState(!1),[p,h]=t.useState([]),[m,f]=t.useState(""),[g,v]=t.useState("");fi((()=>{if(g){const{group:e,summary:t}=p.find((e=>e.value===g)).list;C(e),R(t)}else{const e=P();C((null==e?void 0:e.group)||[]),R((null==e?void 0:e.summary)||[])}}),[g]),t.useEffect((()=>{H()}),[]);const y=t.useMemo((()=>a?`summary_${a}`:""),[a]),b=t.useMemo((()=>l.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex)))),[l]),x=b.filter((e=>!e.groupSummary)).map((e=>({text:Uo(e.title),value:e.dataIndex}))),E=[kd.groupSummary.total,...b.filter((e=>!!e.groupSummary)).map((e=>({text:Uo(e.title),value:e.dataIndex})))],S=[{text:Bt("qm.table.groupSummary.sumText"),value:"sum"},{text:Bt("qm.table.groupSummary.maxText"),value:"max"},{text:Bt("qm.table.groupSummary.minText"),value:"min"},{text:Bt("qm.table.groupSummary.avgText"),value:"avg"},{text:Bt("qm.table.groupSummary.countText"),value:"count"}],[w,C]=t.useState([]),[T,N]=t.useState([{title:Bt("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(_n,{type:"text",onClick:()=>{s.current.REMOVE_RECORDS(n)}},Bt("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:Bt("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:x.map((e=>Object.assign(Object.assign({},e),{disabled:w.findIndex((t=>t.group===e.value))>-1})))})}]),[I,R]=t.useState([]),[O,k]=t.useState([{title:Bt("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(_n,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(n)}},Bt("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:Bt("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:E.map((e=>Object.assign(Object.assign({},e),{disabled:I.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:Bt("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===kd.groupSummary.total.value?S.slice(S.length-1):S})}]),A=t.useMemo((()=>{const e=w.length&&w.every((e=>Object.values(e).every((e=>""!==e)))),t=I.length&&I.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[w,I]),L=()=>{y&&sessionStorage.setItem(y,JSON.stringify({group:w.filter((e=>!!e.group)),summary:I.filter((e=>!!e.summary))}))},P=()=>{if(!y)return;const e=sessionStorage.getItem(y);return e?JSON.parse(e):null},H=()=>En(void 0,void 0,void 0,(function*(){if(!y)return;const e=P();if(e){const{group:t,summary:n}=e;C(t),R(n)}let t=yield Mt.getItem(y);t||(t=yield D(y),Array.isArray(t)&&(yield Mt.setItem(y,t))),Array.isArray(t)&&t.length&&(h(t),!e&&v(t[0].value))})),D=e=>En(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){}})),F=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),$=Fn("table"),M={visible:d,title:Bt("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>u(!1)};return t.createElement("div",{className:`${$}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Zu,{ref:s,size:o,columns:T,dataSource:w,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>N(e),onDataChange:e=>{C(e)}},t.createElement(_n,{type:"primary",icon:t.createElement(ct,null),onClick:()=>{s.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(Zu,{ref:c,size:o,columns:O,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{R(e)}},t.createElement(_n,{type:"primary",icon:t.createElement(ct,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(_,{size:o,value:m,placeholder:Bt("qm.table.groupSummary.configText"),disabled:A,onChange:e=>{const{value:t}=e.target;f(t)}}),t.createElement(_n,{type:"primary",disabled:!m||A,style:{marginLeft:"10px"},onClick:()=>En(void 0,void 0,void 0,(function*(){if(!y)return Xt("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Wo(),t=[...p,{text:m,value:e,list:{group:w.filter((e=>!!e.group)),summary:I.filter((e=>!!e.summary))}}];h(t),v(e),f(""),yield Mt.setItem(y,t),yield F(y,t)}))},Bt("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${kd.rowHeightMaps[o]}px`}},t.createElement("span",null,Bt("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,p.map((e=>t.createElement("li",{key:e.value,className:De({selected:e.value===g}),title:e.text,onClick:()=>{return t=e.value,void v(t!==g?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:Bt("qm.table.groupSummary.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,En(void 0,void 0,void 0,(function*(){if(!n)return;const e=p.filter((e=>e.value!==n));h(e),n===g&&v(""),yield Mt.setItem(y,e),yield F(y,e)}))}},t.createElement(at,null))))),!p.length&&t.createElement("div",{style:{padding:gd}},t.createElement(Pi,null)))))),t.createElement(lo,M,t.createElement(pu,{columns:b,group:w,summary:I})),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(_n,{onClick:()=>n(),style:{marginRight:8}},Bt("qm.table.groupSummary.closeButton")),t.createElement(_n,{type:"primary",disabled:A,onClick:()=>(L(),void u(!0))},Bt("qm.table.groupSummary.confirmButton"))))},mu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,[i,o]=t.useState(!1),l=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:l})));const a=Fn("table"),s={visible:i,title:Bt("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:`${a}-group-summary`,title:Bt("qm.table.groupSummary.text"),onClick:()=>l()},t.createElement("i",{className:"svgicon icon"},t.createElement(dt,null))),t.createElement(lo,s,t.createElement(hu,{onClose:()=>o(!1)})))}));mu.displayName="GroupSummary";const fu=e=>{const{onClose:n}=e,{global:r}=t.useContext(Vt),{tableRef:i,$size:o,flattenColumns:l,setSuperFilters:a,clearTableFilter:s}=t.useContext(hd),{uniqueKey:c}=i.current.props,d=t.useRef(null),[u,p]=t.useState([]),[h,m]=t.useState([]),[f,g]=t.useState(""),[v,y]=t.useState("");fi((()=>{p(v?h.find((e=>e.value===v)).list:P()||[])}),[v]),t.useEffect((()=>{H()}),[]);const b=t.useMemo((()=>c?`superSearch_${c}`:""),[c]),x=t.useMemo((()=>l.filter((e=>!!e.filter))),[l]),E=Yo(u),S=t.useMemo((()=>!(E&&Eo(E))),[E]),w=t.useMemo((()=>!!u.length&&S),[u,S]),C=[{value:"and",text:Bt("qm.table.highSearch.andText")},{value:"or",text:Bt("qm.table.highSearch.orText")}],T=l.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Uo(e.title)}))),N=e=>["in","nin"].includes(e),I=(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},R=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:Bt("qm.table.highSearch.gtText")},{value:"<",text:Bt("qm.table.highSearch.ltText")},{value:">=",text:Bt("qm.table.highSearch.gteText")},{value:"<=",text:Bt("qm.table.highSearch.lteText")},{value:"==",text:Bt("qm.table.highSearch.eqText")},{value:"!=",text:Bt("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:Bt("qm.table.highSearch.inText")},{value:"nin",text:Bt("qm.table.highSearch.ninText")},{value:"==",text:Bt("qm.table.highSearch.eqText")},{value:"!=",text:Bt("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:Bt("qm.table.highSearch.likeText")},{value:"==",text:Bt("qm.table.highSearch.eqText")},{value:"!=",text:Bt("qm.table.highSearch.neqText")}]}return t},[O,k]=t.useState([{title:Bt("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(_n,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},Bt("qm.table.highSearch.removeText")))},{title:Bt("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:Bt("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:T,rules:[{required:!0,message:Bt("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const i=Object.values(t)[0],o=null===(n=x.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,l=R(o);e.fieldType=o,e.expression=i?null===(r=l[0])||void 0===r?void 0:r.value:"",e.condition=N(e.expression)?[]:"",i||(e.bracketLeft=e.bracketRight="")}})},{title:Bt("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:Bt("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{var t;const n=null===(t=x.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:R(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=N(e.expression)?[]:""}}}},{title:Bt("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const i=x.find((t=>t.dataIndex===e.fieldName)),o=null==i?void 0:i.filter.type,l=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:I(o,N(e.expression)),editable:!0,items:l,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:Bt("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:Bt("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:C,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),A=()=>{s(),a(u.map((e=>An(e,["index","pageIndex"])))),L(),n()},L=()=>{b&&sessionStorage.setItem(b,JSON.stringify(u.filter((e=>!!e.fieldName))))},P=()=>{if(!b)return;const e=sessionStorage.getItem(b);return e?JSON.parse(e):null},H=()=>En(void 0,void 0,void 0,(function*(){if(!b)return;const e=P();e&&p(e);let t=yield Mt.getItem(b);t||(t=yield D(b),Array.isArray(t)&&(yield Mt.setItem(b,t))),Array.isArray(t)&&t.length&&(m(t),!e&&y(t[0].value))})),D=e=>En(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){}})),F=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),$=Fn("table");return t.createElement("div",{className:`${$}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Zu,{ref:d,size:o,columns:O,dataSource:u,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(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]?"":")"),p([...u]))},onDataChange:e=>{p(e)}},t.createElement(_n,{type:"primary",icon:t.createElement(ct,null),onClick:()=>{d.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),kd.highSearch.showSQL&&E&&t.createElement("code",{className:"lang-js"},E)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(_,{size:o,value:f,placeholder:Bt("qm.table.highSearch.configText"),disabled:S,onChange:e=>{const{value:t}=e.target;g(t)}}),t.createElement(_n,{type:"primary",disabled:!f||S,style:{marginLeft:"10px"},onClick:()=>En(void 0,void 0,void 0,(function*(){if(!b)return Xt("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Wo(),t=[...h,{text:f,value:e,list:u.filter((e=>!!e.fieldName))}];m(t),y(e),g(""),yield Mt.setItem(b,t),yield F(b,t)}))},Bt("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${kd.rowHeightMaps[o]}px`}},t.createElement("span",null,Bt("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.value,className:De({selected:e.value===v}),title:e.text,onClick:()=>{return t=e.value,void y(t!==v?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:Bt("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,En(void 0,void 0,void 0,(function*(){if(!n)return;const e=h.filter((e=>e.value!==n));m(e),n===v&&y(""),yield Mt.setItem(b,e),yield F(b,e)}))}},t.createElement(at,null))))),!h.length&&t.createElement("div",{style:{padding:gd}},t.createElement(Pi,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(_n,{onClick:()=>n(),style:{marginRight:8}},Bt("qm.table.highSearch.closeButton")),t.createElement(_n,{type:"primary",disabled:w,onClick:()=>A()},Bt("qm.table.highSearch.searchButton"))))},gu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,[i,o]=t.useState(!1),l=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:l})));const a=Fn("table"),s={visible:i,title:Bt("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:`${a}-super-search`,title:Bt("qm.table.highSearch.text"),onClick:()=>l()},t.createElement("i",{className:"svgicon icon"},t.createElement(ut,null))),t.createElement(lo,s,t.createElement(fu,{onClose:()=>o(!1)})))}));gu.displayName="SuperSearch";const vu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:o,showPrint:l,showImport:a,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:p,showGroupSummary:h,showToolBox:m}=e,{global:f}=t.useContext(Vt),{tableRef:g,isFullScreen:v,$size:y}=t.useContext(hd),{uniqueKey:b,exportExcel:x}=g.current.props,E=t.useRef(null),S=t.useRef(null),w=t.useRef(null),C=t.useRef(null),T=t.useRef(null),N=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),A=t.useRef(!1),L=t.useMemo((()=>b?`toolBox_${b}`:""),[b]),[P,_]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),H={fullScreen:i,reload:o,print:l,import:a,export:s&&!(null==x?void 0:x.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:p,groupSummary:h},[D,F]=t.useState(!1);fi((()=>{A.current&&(j(),A.current=!1)}),[P]),t.useEffect((()=>{$()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!T.current)return Xt("Table","执行导出需要配置 `exportExcel` 参数");T.current.clickHandle()}})));const $=()=>{if(!L||!m)return;const e=JSON.parse(localStorage.getItem(L));e||V(L).then((e=>{e&&(_(Object.assign({},P,e)),localStorage.setItem(L,JSON.stringify(e)))})).catch((()=>{})),e&&_(Object.assign({},P,e))},j=()=>{if(!L||!m)return;const e={};for(const t in P)P[t]&&(e[t]=P[t]);localStorage.setItem(L,JSON.stringify(e)),K(L,e)},V=e=>En(void 0,void 0,void 0,(function*(){const t=null==f?void 0:f.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),K=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==f?void 0:f.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),z=e=>En(void 0,void 0,void 0,(function*(){F(!1),yield In(100),e.current.clickHandle()})),W=(e,t)=>{A.current=!0,_(Object.assign({},P,{[t]:e}))},B=Fn("table"),U={"top-toolbox__popper":!0,[`${B}--lg`]:"large"===y,[`${B}--sm`]:"small"===y};return t.createElement(t.Fragment,null,i&&t.createElement(jd,{ref:E,isFullScreen:v,open:!m||P.fullScreen}),o&&t.createElement(Vd,{ref:S,open:!m||P.reload}),l&&t.createElement(zd,{ref:w,tableColumns:r,open:!m||P.print}),a&&t.createElement(nu,{ref:C,tableColumns:r,open:!m||P.import}),s&&t.createElement(ou,{ref:T,tableColumns:r,open:(!m||P.export)&&!(null==x?void 0:x.hideIcon)}),c&&t.createElement(au,{ref:N,open:!m||P.clipboard}),d&&t.createElement(cu,{ref:I,columns:r,open:!m||P.collection}),u&&t.createElement(uu,{ref:R,open:!m||P.fastSearch}),h&&t.createElement(mu,{ref:O,open:!m||P.groupSummary}),p&&t.createElement(gu,{ref:k,open:!m||P.superSearch}),m&&t.createElement(q,{open:D,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.screen.full"))),onClick:()=>z(E)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.refresh.text"))),onClick:()=>z(S)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.print.text"))),onClick:()=>z(w)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.import.textNoSpace"))),onClick:()=>z(C)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.export.textNoSpace"))),onClick:()=>z(T)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.clipboard.textNoSpace"))),onClick:()=>z(N)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.selectCollection.text"))),onClick:()=>z(I)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.fastSearch.text"))),onClick:()=>z(R)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.groupSummary.text"))),onClick:()=>z(O)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.highSearch.text"))),onClick:()=>z(k)}];return t.createElement(Q,{items:e.filter((e=>H[e.key]))})})(),overlayClassName:De(U),overlayStyle:{minWidth:120},onOpenChange:e=>{F(e)}},t.createElement("span",{className:`${B}-toolbox`,title:Bt("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(pt,null)))))}));vu.displayName="ToolBox";const yu=(e,t)=>e.map((e=>(e.children&&(e.children=yu(e.children,t)),t(e)))),bu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(Vt),{tableRef:o,$size:l}=t.useContext(hd),{showColumnDefine:a,uniqueKey:s,onlyShowIcon:c,columnsChange:d}=o.current.props,u=t.useRef([]),[p,h]=t.useState(!1),m=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),f=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),g=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),v=t.useMemo((()=>s?`table_${s}`:""),[s]);fi((()=>{x(r)}),[r]),t.useLayoutEffect((()=>{E()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:E})));const y=()=>{if(!v)return;const e=JSON.parse(localStorage.getItem(v));var t;if(e||(t=v,En(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(v,JSON.stringify(e)),E()):(null==i?void 0:i.getComponentConfigApi)&&x(r)})).catch((()=>{})),!e)return;return ye(To(e).map((e=>e.dataIndex)),To(r).map((e=>e.dataIndex))).length>0?yu(r,(t=>{const n=Io(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})):yu(e,(e=>{const t=Io(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},b=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=b(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)})),x=e=>{if(!v)return;const t=b(e),n=JSON.parse(localStorage.getItem(v));var r,l;o.current.columnsDefined&&!ge(t,n)&&(localStorage.setItem(v,JSON.stringify(t)),r=v,l=t,En(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:l})}catch(e){}})))},E=()=>{const e=y();var t;e&&(t=S(e),u.current=t,null==d||d(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((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(r,r+i))})),t},w=()=>{const e=t=>t.map((t=>{const n=Io(r,t.dataIndex)||Ln(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));null==d||d(e(o.current.originColumns))},C=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:i}=n;if(0===r)return;if(1===r)return t.push(n);const o=u.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===o)return t.push(n);t.push(...u.current[o].map(((t,r)=>{let{dataIndex:i}=t;const o=e.find((e=>e.dataIndex===i));return r>0&&(void 0!==n.hidden&&(o.hidden=n.hidden),void 0!==n.fixed?o.fixed=n.fixed:o.fixed&&delete o.fixed),o})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==d||d(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},N=(e,n)=>{var i;const{colSpan:o,noFixed:l}=e;if(0===o)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=Uo(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,C(r)}}),t.createElement("i",{className:De(s),title:Bt("qm.table.columnFilter.draggable")},t.createElement(Ke,null)),t.createElement("span",{className:"text",title:a},a),"main"===n?t.createElement("span",{className:De("fixed",l?"disabled":"")},t.createElement("i",{className:"svgicon",title:Bt("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},t.createElement(ht,null)),t.createElement("i",{className:"svgicon",title:Bt("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},t.createElement(mt,null))):"sub"!==n?t.createElement("span",{className:De("fixed",l?"disabled":"")},t.createElement("i",{className:"svgicon",title:Bt("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},t.createElement(at,null))):null);return!e.hidden&&(null===(i=e.children)||void 0===i?void 0:i.length)?t.createElement(J,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:I(e.children,e.dataIndex)},c):c},I=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement($t,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const i=t.map((e=>e.dataIndex)),o=e.map((e=>e.dataIndex));ge(i,o)||((e,t)=>{Io(r,t).children=e,null==d||d([...r])})(tl(t),n)}},e.map((e=>N(e,"sub"))))),R=Fn("table"),O={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===l,[`${R}--sm`]:"small"===l},k=[`${R}-column-filter`,{selected:p}];return a?t.createElement(Hs,{action:["click"],popupVisible:p,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(_n,{type:"text",size:"small",onClick:w},Bt("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement($t,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:m,setList:e=>{const t=e.map((e=>e.dataIndex)),n=m.map((e=>e.dataIndex));ge(t,n)||C([...tl(e),...g,...f])}},m.map((e=>N(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement($t,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),n=g.map((e=>e.dataIndex));ge(t,n)||C([...m,...tl(e),...f])}},g.map((e=>N(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement($t,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:f,setList:e=>{const t=e.map((e=>e.dataIndex)),n=f.map((e=>e.dataIndex));ge(t,n)||C([...m,...g,...tl(e)])}},f.map((e=>N(e,"right")))))),popupClassName:De(O),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{h(e)},builtinPlacements:Sd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:De(k),title:c?Bt("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(it,null)),!c&&t.createElement("span",null,Bt("qm.table.columnFilter.text")))):null}));bu.displayName="ColumnFilter";const xu=()=>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"})),Eu=e=>{const{column:n,filters:r}=e,{$size:i,setFilters:o,clearSuperFilters:l}=t.useContext(hd),a=t.useRef(null),s=t.useRef(null),c=t.useRef(null),[d,u]=t.useState(!1),[p,h]=t.useState(!1),[m,f]=t.useState({}),g=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),v=t.useMemo((()=>{let e=!1;for(const t in r[g])if(!kn(r[g][t])||p){e=!0;break}return e}),[g,r,p]);t.useLayoutEffect((()=>{d&&setTimeout((()=>y()),20)}),[d]),t.useEffect((()=>{var e;ge(m[g],r[g])||f({[g]:r[g]||{}}),h(""===(null===(e=r[g])||void 0===e?void 0:e["=="]))}),[r]);const y=()=>{switch(n.filter.type){case"text":a.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},b=e=>{e&&f(e),l(),o((e=>{for(const t in e){for(const n in e[t])if(kn(e[t][n])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][n])continue;delete e[t][n]}Object.keys(e[t]).length||delete e[t]}return e})(Object.assign(Object.assign(Object.assign({},r),m),e))),u(!1)},x={text:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(_,{ref:a,size:i,placeholder:Bt("qm.table.filter.searchText",{text:Uo(e.title)}),style:{width:"180px"},value:null!==(r=null===(n=m[g])||void 0===n?void 0:n.like)&&void 0!==r?r:"",disabled:p,onChange:e=>{const{value:t}=e.target;f((e=>Object.assign({},e,{[g]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&b()}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:p,onChange:e=>{const{checked:t}=e.target,n=t?"":null;f((e=>Object.assign({},e,{[g]:{"==":n,like:null}}))),h(t)}},Bt("qm.table.filter.nullValue"))))},textarea:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(_.TextArea,{ref:c,size:i,placeholder:Bt("qm.table.filter.searchAreaText",{text:Uo(e.title)}),style:{width:"220px"},value:null!==(r=null===(n=m[g])||void 0===n?void 0:n.likes)&&void 0!==r?r:"",disabled:p,onChange:e=>{const{value:t}=e.target;f((e=>Object.assign({},e,{[g]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),b())}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:p,onChange:e=>{const{checked:t}=e.target,n=t?"":null;f((e=>Object.assign({},e,{[g]:{"==":n,like:null}}))),h(t)}},Bt("qm.table.filter.nullValue"))))},number:e=>{const n=e=>{var t,n;return{value:null!==(n=null===(t=m[g])||void 0===t?void 0:t[e])&&void 0!==n?n:"",size:i,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||f((n=>Object.assign({},n,{[g]:Object.assign({},n[g],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&b()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(j,hn({ref:s},n(">"),{placeholder:Bt("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(j,hn({},n("<"),{placeholder:Bt("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(j,hn({},n("=="),{placeholder:Bt("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(j,hn({},n("!="),{placeholder:Bt("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:Ko(null===(t=m[g])||void 0===t?void 0:t[e],bd),format:bd,size:i,onChange:t=>{f((n=>Object.assign({},n,{[g]:Object.assign({},n[g],{[e]:zo(t,bd)})})))},onKeyDown:e=>{13===e.keyCode&&b()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(pn,hn({},n(">"),{placeholder:Bt("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(pn,hn({},n("<"),{placeholder:Bt("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(pn,hn({},n("=="),{placeholder:Bt("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(pn,hn({},n("!="),{placeholder:Bt("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{var n;const{filter:r,dictItems:i=[]}=e,o=r.items||i;return t.createElement("ul",null,t.createElement(K.Group,{style:{width:"100%"},value:null===(n=m[g])||void 0===n?void 0:n["=="],onChange:e=>{const{value:t}=e.target;f((e=>Object.assign({},e,{[g]:{"==":t}})))}},o.map((e=>t.createElement("li",{key:e.value},t.createElement(K,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{var n;const{filter:r,dictItems:i=[]}=e,o=r.items||i;return t.createElement("ul",null,t.createElement(M.Group,{style:{width:"100%"},value:null===(n=m[g])||void 0===n?void 0:n.in,onChange:e=>{f((t=>Object.assign({},t,{[g]:{in:e}})))}},o.map((e=>t.createElement("li",{key:e.value},t.createElement(M,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{var n;const{filter:r,dictItems:i=[]}=e,o=r.items||i;return t.createElement("div",{style:Object.assign({height:200},r.style)},t.createElement(pd,{multiple:!0,value:(null===(n=m[g])||void 0===n?void 0:n.in)||[],dataSource:o,onCheckChange:e=>{const t=e.map((e=>e.value));f((e=>Object.assign({},e,{[g]:{in:t}})))}}))}},E=()=>t.createElement(N,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t.createElement(_n,{size:i,onClick:()=>(b({[g]:{}}),void h(!1))},Bt("qm.table.filter.reset")),t.createElement(_n,{type:"primary",size:i,onClick:()=>b()},Bt("qm.table.filter.search"))),S=Fn("table"),w={"head-filter__popper":!0,[`${S}--lg`]:"large"===i,[`${S}--sm`]:"small"===i},C=["cell--filter",{selected:d,actived:v}];return t.createElement(Hs,{action:["click"],popupVisible:d,popup:(()=>{const e=n.filter.type,r=x[e];return r?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement("div",null,r(n)),E()):(Xt("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:De(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:Sd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:De(C),title:Bt("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(xu,null))))},Su=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(hd),{columns:o,resizable:l,columnsChange:a=Tn}=r.current.props,s=t.useMemo((()=>Oo(n)),[n]),c={resizable:!0,"is--line":l&&!i};return t.createElement("div",{className:De(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,i=n.$resizableBar,l=t.offsetWidth/2,c=e.clientX,d=_o(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+l;n.$table.classList.add("c--resize"),i.style.left=`${d}px`,i.style.display="block";const u=s.width||s.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,n=u+t;n<(s.minWidth||kd.defaultColumnWidth)||(p=Math.floor(n),i.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Io(o,s.dataIndex).width=p,a([...o]))},!1}})},wu=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:o,createWebPageData:l,setSelectionKeysEffect:a,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=t.useContext(hd),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:f,onSelectAll:g}=p,v=t.useRef([]),y=t.useMemo((()=>d&&!!h),[d,h]),b=t.useMemo((()=>!y&&!!m),[y,m]),x=t.useMemo((()=>(null==f||f)&&!b),[f,b]),E=()=>u?l():r.current.tableFullData,S=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>i(e,e.index)))},w=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:n}=p;if(y)return v.current.length?v.current:_e(t,S());if(!b)return n?t.filter((t=>!n(e.get(t)))):t;const o=n?E().filter((e=>!n(e))).map((e=>i(e,e.index))):E().map((e=>i(e,e.index)));return _e(o,S())})(),C=n.filter((e=>!w.includes(e))),T=n.length-C.length,N=T>0&&T<w.length,I=!!T&&T===w.length;s(C);const R=()=>En(void 0,void 0,void 0,(function*(){var e;const t=h;let n=[];c(!0);try{const r=yield t.api(o);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=me(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:o}=p;o&&(n=ye(n,E().filter((e=>o(e))).map((e=>i(e,e.index))))),v.current=n}}catch(e){}return c(!1),n})),O=e=>En(void 0,void 0,void 0,(function*(){let t=[];t=y?e?yield R():[]:e?w.slice(0):[],t=[...new Set([...t,...C])],a(t),null==g||g(e,t)})),k=()=>{const e=[{key:1,label:Bt("qm.table.selection.all"),onClick:()=>{O(!0)}},{key:2,label:Bt("qm.table.selection.invert"),onClick:()=>En(void 0,void 0,void 0,(function*(){let e=[];e=ye(n,y?yield R():w),e=[...new Set([...e,...C])],a(e)}))},{key:3,label:Bt("qm.table.selection.clear"),onClick:()=>{O(!1)}}];return t.createElement(Q,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(M,{checked:I,indeterminate:N,disabled:!w.length,onChange:e=>O(e.target.checked)}),x&&t.createElement(q,{overlayClassName:"all-selection__popper",dropdownRender:()=>k()},t.createElement($e,{className:"svgicon icon"})),b&&t.createElement(Y,{placement:"top",title:Bt("qm.table.selection.currentPage")},t.createElement(ft,{className:"info"})))},Cu=e=>{const{style:n}=e,{tableRef:r,isTreeTable:i,setRowExpandedKeys:o}=t.useContext(hd),{expandable:l}=r.current.props,[a,s]=t.useState((null==l?void 0:l.defaultExpandAllRows)||!1);fi((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;o(a?e.filter((e=>!(i&&t.includes(e)))):[])}),[a]);const c={[`${Fn("expand")}--icon`]:!0,expanded:a,collapsed:!a};return t.createElement("span",{className:De(c),title:"",onClick:e=>{e.stopPropagation(),s(!a)},style:n})},Tu=()=>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"})),Nu=()=>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"})),Iu=e=>{const{tableColumns:n,sorter:r,filters:i}=e,{tableRef:o,layout:l,scrollY:a,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:h,isTreeTable:m,isGroupSubtotal:f,tableChange:g,setSorter:v,setElementStore:y,resetTableScroll:b,getStickyLeft:x,getStickyRight:E,createGroupData:S,createTableFullData:w}=t.useContext(hd),{ellipsis:C,resizable:T,multipleSort:N,rowSelection:I,expandable:R}=o.current.props,[O,k]=kd.sortDirections,{tableOriginData:A}=o.current,L=t.useRef(null),P=t.useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),_=t.useMemo((()=>!h),[h]),H=t.useMemo((()=>!h),[h]),D=t.useMemo((()=>!(null==R?void 0:R.hideExpandAll)),[R]),F=t.useMemo((()=>!!I&&(h?!(!I.selectAllOnCurrentPage&&!I.fetchAllRowKeys):!I.hideSelectAll)),[h,I]);fi((()=>{z(),g(),b()}),[r]),fi((()=>{U(),g(),b()}),[i]),fi((()=>{U(),g(),b()}),[c]),t.useEffect((()=>{!kn(r)&&Rn((()=>z())),!kn(i)&&Rn((()=>U()))}),[]),t.useLayoutEffect((()=>{$()}),[]);const $=()=>{y("$header",L.current)},M=(e,n,i)=>{var s,c,d;const{isIE:u}=o.current,{gutterWidth:p}=l,{dataIndex:h,colSpan:m,rowSpan:f,fixed:g,align:v,theadAlign:y,theadClassName:b="",sorter:S,filter:w,required:N,headRender:I}=e;if(0===m)return null;const R=y||v,O=["header--column",{"col--ellipsis":null!==(s=e.ellipsis)&&void 0!==s?s:C,"col--center":"center"===R,"col--right":"right"===R,"column--required":!!N,"column-has-sorter":S,"column-has-filter":w,"column--sort":!!r[h],"cell-fix-left":!u&&"left"===g,"cell-fix-right":!u&&"right"===g,"cell-fix-left-last":!u&&"left"===g&&!(null===(c=i[n+(null!=m?m:1)])||void 0===c?void 0:c.fixed),"cell-fix-right-first":!u&&"right"===g&&!(null===(d=i[n-1])||void 0===d?void 0:d.fixed),[b]:!!b}],k=u?null:{left:"left"===g?`${x(h)}px`:"",right:"right"===g?`${E(h,"thead")+(a?p:0)}px`:""},A=T&&![kd.expandableColumn,kd.selectionColumn].includes(h);return t.createElement("th",{key:h,className:De(O),colSpan:m,rowSpan:f,style:Object.assign({},k),onClick:t=>K(t,e)},t.createElement("div",{className:"cell--wrapper"},I?t.createElement("div",{className:"cell--text cell"},I(e,o.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},q(e)),w?V(e):null)),A&&t.createElement(Su,{column:e}))},q=e=>{const{dataIndex:n,type:i,sorter:o,title:l,description:a}=e;if(n===kd.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},F?t.createElement(wu,{selectionKeys:d}):Bt("qm.table.config.selectionText"));if("radio"===i)return t.createElement("div",{className:"cell"},l)}const s=[];return s.push(t.createElement("div",{key:0,className:"cell",title:Uo(l)},m&&n===p&&D?t.createElement(Cu,null):null,n===kd.expandableColumn&&D?t.createElement(Cu,null):l)),a&&s.push(t.createElement(Y,{key:1,placement:"top",title:a},t.createElement(ft,{className:"tip"}))),o&&s.push(j(r[n])),s},j=e=>{const n=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return t.createElement("div",{key:2,className:"cell--sorter",title:Bt("qm.table.sorter.text")},t.createElement("span",{className:De(n)},t.createElement(Tu,null)),t.createElement("span",{className:De(r)},t.createElement(Nu,null)))},V=e=>t.createElement(Eu,{column:e,filters:i}),K=(e,t)=>{const{sorter:n,dataIndex:i}=t;if(n){const e=r[i],t=e?e===k?null:k:O;N?(delete r[i],v(Object.assign({},r,{[i]:t}))):v(Object.assign({},{[i]:t}))}},z=()=>{_&&W()},W=e=>{const t=He(r,(e=>null!==e));for(const e in t){const n=s.find((t=>t.dataIndex===e));n?B(n,t[e]):delete t[e]}e||Object.keys(t).length||B({dataIndex:"index"},O)},B=(e,t)=>{const{tableFullData:n}=o.current,{dataIndex:r,sorter:i}=e,l=(e,n)=>{const i=Fo(e,r),o=Fo(n,r);return Number.isNaN(i-o)?t===O?i.toString().localeCompare(o.toString()):o.toString().localeCompare(i.toString()):t===O?i-o:o-i},a=f?S(Go(n).sort("function"==typeof i?i:l)):n.sort("function"==typeof i?i:l).slice(0);w(a)},U=()=>{H&&G()},G=()=>{const e=c.length?Yo(c):Yo(i),t=""!==e?f?S(So(Go(A),e,P)):So(A,e,P):A;w(t),W(!0)},X=Po(n),Z=Fn("table"),{tableBodyWidth:Q}=l;return t.createElement("div",{ref:L,className:`${Z}--header-wrapper`},t.createElement("table",{className:`${Z}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Q?`${Q}px`:""}},(()=>{const{gutterWidth:e}=l;return t.createElement("colgroup",null,s.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`}})})),a&&t.createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t.createElement("thead",null,(e=>{const{isIE:n}=o.current,r=["gutter",{"cell-fix-right":!!u.length}],i=n?null:{right:u.length?0:""};return e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>M(t,n,e))),a&&t.createElement("th",{className:De(r),style:Object.assign({},i)}))))})(X))))},Ru=t.createContext([]),Ou=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,ku=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Au=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!Ou(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Lu(t){let{ref:n,handler:r,enabled:i=!0,omitClassNames:o=[]}=t;const l=Cd(r),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!i)return;const e=e=>{Au(e,n)&&(a.current.isPointerDown=!0)},t=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:r&&a.current.isPointerDown&&Au(e,n)&&ku(e,o)&&(a.current.isPointerDown=!1,l(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,r&&a.current.isPointerDown&&Au(e,n)&&ku(e,o)&&(a.current.isPointerDown=!1,l(e))},c=Ou(n.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",t,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",t,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[r,n,l,a,i])}function Pu(){const[,t]=e.useReducer((e=>e+1),0);return t}function _u(){const{locale:t}=e.useContext(Vt);return{t:Bt,$locale:t}}const Hu=e=>{const{selectionKeys:n,column:r,record:i,rowKey:o}=e,{tableRef:l,isTreeTable:a,getAllChildRowKeys:s}=t.useContext(hd),{rowSelection:c}=l.current.props,d=t.useMemo((()=>r.type||""),[r.type]),u=e=>{var t,r;const i=null===(t=c.checkStrictly)||void 0===t||t;if(!a||i)return!1;const o=Ao(l.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})(s(null!==(r=null==o?void 0:o.children)&&void 0!==r?r:[]),n)};return"radio"===d?(()=>{const e=c.disabled,r=null==e?void 0:e(i),l=!r&&n[0]===o;return t.createElement(K,{checked:l,disabled:r})})():(()=>{const e=c.disabled,r=null==e?void 0:e(i),l=!!n.includes(o);return t.createElement(M,{checked:l,indeterminate:u(o),disabled:r})})()},Du=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:o,rowExpandedKeys:l,setRowExpandedKeys:a}=t.useContext(hd),{expandable:s={}}=o.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>l.includes(r)),[l,r]);fi((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${Fn("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:De(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?l.filter((e=>e!==r)):[...l,r];a(t)},style:i})},Fu=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:o,min:l,max:a,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,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)>a&&(t=a.toString()),t&&Number(t)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new Lt(t).toFixed(p)),t},E=void 0!==o,[S,w]=t.useState(null!=i?i:""),C=v(E?o:S),T=y(C);fi((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,T)}),[S]);return t.createElement(_,{ref:n,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const n=y(t.target.value);let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===p&&n.includes(".")&&(r=!1),l>=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):w(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(T);null===(t=e.onBlur)||void 0===t||t.call(e,n,T)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(T),T))}})}));Fu.displayName="InputNumber";const{Search:$u}=_,Mu=t.forwardRef(((e,n)=>{var r,i,o,l,a,s;const{column:c,record:d,rowKey:u,columnKey:p}=e,{tableRef:h,tableBodyRef:m,$size:f,flattenColumns:g,updateTableData:v,doFieldValidate:y,dataChange:b}=t.useContext(hd),x=t.useContext(Ru),E=Pu(),{store:S,fieldAuth:w}=h.current,T=(null===(r=c.editRender)||void 0===r?void 0:r.call(c,d,c))||{},N=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),A=t.useRef(!1),L=t.useRef({}),P=t.useRef({}),H=t.useRef([]),[D,F]=t.useState(!1),[q,j]=t.useState(!1),[V,K]=t.useState(!1),[W,B]=t.useState(T.items||[]),[U,G]=t.useState(),Y=(T.editable||ge(x,[u,p]))&&!T.disabled&&!(null===(i=w[p])||void 0===i?void 0:i.disabled),X=`${u}|${p}`,Z=2===x.length?`${x[0]}|${x[1]}`:"",Q=![...S.state.required,...S.state.validate].some((e=>{let{x:t,y:n}=e;return t===u&&n===p})),J=(null===(o=S.state.required.find((e=>{let{x:t,y:n}=e;return t===u&&n===p})))||void 0===o?void 0:o.text)||"",ee=(null===(l=S.state.validate.find((e=>{let{x:t,y:n}=e;return t===u&&n===p})))||void 0===l?void 0:l.text)||"",te=S.state.edited.some((e=>{let{x:t,y:n}=e;return t===u&&n===p})),ne=Y||!Q||D||V||q,re=!!(null===(a=T.helper)||void 0===a?void 0:a.combinedDataIndex)&&("search-helper"===T.type||"tree-helper"===T.type),ie=null===(s=T.type)||void 0===s?void 0:s.endsWith("multiple");t.useLayoutEffect((()=>{ne&&Z===X&&ce()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;ie&&e&&ae(e.map((e=>({[P.current.valueKey]:e.value,[P.current.textKey]:e.text}))))}),[]);const oe=()=>{v(),b()},le=(e,t)=>{F(e),null==t||t()},ae=e=>{H.current=e},ce=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=I.current)||void 0===e||e.focus();break;case"number":null===(t=R.current)||void 0===t||t.select();break;case"search-helper":null===(n=O.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=k.current)||void 0===r||r.focus()}};t.useImperativeHandle(n,(()=>({focus:ce})));const de=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},ue=(e,t,n)=>{const{cornerSign:r=!0}=T.extra||{};S.addToUpdated(e),r&&S.addToEdited({x:t,y:n})},pe=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",he={text:(e,n,r)=>{const{dataIndex:i}=n,{type:o,extra:l={},rules:a=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=Fo(e,i),g=Object.assign({},{minRows:1,maxRows:4},l.autoSize),v=r?{rows:g.minRows,autoSize:g}:null,b=l.password?_.Password:r?_.TextArea:_;return t.createElement(b,hn({ref:I,size:f,value:m,maxLength:l.maxLength,showCount:l.showCount},v,{autoComplete:l.password?"new-password":"off",placeholder:l.placeholder||Bt("qm.table.editable.inputPlaceholder"),allowClear:l.allowClear,readOnly:l.readOnly,disabled:l.disabled,suffix:l.suffix,onChange:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";$o(e,i,r),y(a,r,u,p),E(),null==s||s({[X]:r}),A.current=!0},onFocus:()=>j(!0),onBlur:t=>{var n;j(!1);const r=null!==(n=t.target.value)&&void 0!==n?n:"";A.current&&(A.current=!1,ue(e,u,p),null==c||c({[X]:r},e),null==h||h({[X]:r},e),oe())},onKeyUp:t=>{var n;if(13===t.keyCode&&!t.shiftKey){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==d||d({[X]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&d&&e.preventDefault()}}))},textarea:(e,t)=>he.text(e,t,!0),number:(e,n)=>{var r;const{dataIndex:i,precision:o,formatType:l}=n,{type:a,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:m,onBlur:g}=T,v=Fo(e,i);let b,x;return"finance"===l&&(b=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},x=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===l&&(b=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Lt(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Lt(e).times(.01).toString()),t.createElement(Fu,{ref:R,size:f,value:v,min:s.min,max:s.max,precision:o,stringMode:s.stringMode,prefix:s.prefix,suffix:null!==(r=s.suffix)&&void 0!==r?r:"percent"===l?"%":void 0,placeholder:s.placeholder||Bt("qm.table.editable.inputPlaceholder"),maxLength:s.maxLength,allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,formatter:b,parser:x,onChange:t=>{$o(e,i,t),y(c,t,u,p),E(),null==d||d({[X]:t}),A.current=!0},onFocus:()=>j(!0),onBlur:(t,n)=>{if(j(!1),!A.current)return;A.current=!1;let r=s.stringMode?t:pe(t);"percent"===l&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),$o(e,i,r),ue(e,u,p),null==h||h({[X]:r},e),null==g||g({[X]:r},e),oe()},onEnter:(t,n)=>{let r=s.stringMode?t:pe(t);"percent"===l&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==m||m({[X]:r},e)}})},select:(e,n,r)=>{var i;const{dataIndex:o,dictItems:l=[]}=n,{type:a,extra:s={},rules:c=[],items:d,onChange:h,onEnter:m}=T,g=d||l,v=Fo(e,o);let b=v;return t.createElement($,{mode:r?"multiple":void 0,size:f,popupClassName:"table-editable__popper",value:v||void 0,placeholder:s.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,listHeight:s.listHeight,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},showSearch:null===(i=s.filterable)||void 0===i||i,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${Dl.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{$o(e,o,t),y(c,t,u,p),ue(e,u,p),null==h||h({[X]:t},e),oe()},onSelect:e=>{b=e},onInputKeyDown:t=>{13===t.keyCode&&Rn((()=>null==m?void 0:m({[X]:b},e)))}},g.map((e=>t.createElement($.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>he.select(e,t,!0),date:(e,n,r)=>{var i;const{dataIndex:o}=n,{type:l,extra:a={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=Fo(e,o);return t.createElement(pn,{size:f,popupClassName:"table-editable__popper",value:null!==(i=Ko(h,cl[d]))&&void 0!==i?i:void 0,picker:sl[d],format:a.format,showTime:"datetime"===d,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=a;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:a.placeholder,allowClear:a.allowClear,disabled:a.disabled,style:{width:"100%"},onChange:t=>{const n=zo(t,cl[d]);$o(e,o,n),y(s,n,u,p),ue(e,u,p),null==c||c({[X]:n},e),oe()}})},datetime:(e,t)=>he.date(e,t,"datetime"),month:(e,t)=>he.date(e,t,"month"),year:(e,t)=>he.date(e,t,"year"),time:(e,n)=>{var r;const{dataIndex:i}=n,{type:o,extra:l={},rules:a=[],onChange:s}=T,c="HH:mm:ss",d=Fo(e,i);return t.createElement(mn,{size:f,popupClassName:"table-editable__popper",value:null!==(r=Ko(d,c))&&void 0!==r?r:void 0,format:l.format||c,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=zo(t,c);$o(e,i,n),y(a,n,u,p),ue(e,u,p),null==s||s({[X]:n},e),oe()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:o={},rules:l=[],onChange:a}=T,{trueValue:s=vd,falseValue:c=yd,disabled:d}=o,h=Fo(e,r);return t.createElement(M,{checked:h===s,disabled:d,onChange:t=>{const n=t.target.checked?s:c;$o(e,r,n),y(l,n,u,p),ue(e,u,p),null==a||a({[X]:n},e),oe()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:o={},rules:l=[],onChange:a}=T,{trueValue:s=vd,falseValue:c=yd,disabled:d}=o,h=Fo(e,r);return t.createElement(z,{checked:h===s,disabled:d,onChange:t=>{const n=t?s:c;$o(e,r,n),y(l,n,u,p),ue(e,u,p),null==a||a({[X]:n},e),oe()}})},"search-helper":(e,n)=>{var r;const{dataIndex:i,precision:o}=n,{type:l,extra:a={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,v=Mo(e,re?c.combinedDataIndex:i),b=c.fieldAliasMap;b||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(i)||Xt("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),re&&(c.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Xt("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[i].includes("|")&&Xt("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=e=>{const{filterAliasMap:t}=c,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],o={[i]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(se(e))for(const t in e)o[t]="function"==typeof e[t]?e[t](n):n;else o[e]=n})),o},S=e=>{const{autoQueryAssign:t=!0}=c;t&&(L.current=E(e)),F(!0)},w=(t,r)=>{const{beforeOpen:i}=c,o=(null!=i?i:Nn)({[X]:v},e,n);(null==o?void 0:o.then)?o.then((()=>{S(t),null==r||r()})).catch((()=>{})):!1!==o&&(S(t),null==r||r())},C=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=Mo(e,r))}const n=x[i]?Mo(e,x[i]):"";R(n,t);const{closed:r}=c;le(!1,(()=>de(N.current))),ce(),null==r||r(e)},I=()=>{const{onlySelect:e=!0}=c;A.current&&R(e?"":v),le(!1,(()=>de(N.current)))},R=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;var r;if(se(n)&&Object.keys(n).length)for(const t in n){const i=n[t],o=g.find((e=>e.dataIndex===t));if(o){$o(e,t,i,o.precision);const n=null===(r=o.editRender)||void 0===r?void 0:r.call(o,e,o);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else $o(e,t,i)}re&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return $o(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&$o(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),$o(e,i,t,o),y(s,t,u,p),ue(e,u,p),null==h||h({[X]:t},e),oe(),L.current={},A.current=!1,G(void 0)},k={visible:D,title:Bt("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Jl[f]+20}px`},onClose:()=>{I()}},P=Object.assign(Object.assign({},c),{size:f,initialValue:Object.assign({},L.current,c.initialValue),onClose:e=>{e?C(e):I()}});return t.createElement(t.Fragment,null,t.createElement($u,{ref:O,value:null!=U?U:v,placeholder:a.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:a.allowClear,readOnly:a.readOnly,disabled:a.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:o}=c;if(A.current&&!D)return n&&r&&(null===(t=null==o?void 0:o.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=c,{beforeFetch:r=Nn}=t.fetch;return new Promise(((i,o)=>En(void 0,void 0,void 0,(function*(){var l;const a=xe({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(a))return o();K(!0);try{const e=yield t.fetch.api(a);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(l=me(e.data,t.fetch.dataKey))&&void 0!==l?l:[];i(n)}else o()}catch(e){o(e)}finally{Rn((()=>K(!1)))}}))))})(n).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>Mo(t,x[i]).toString().includes(e)));if(1===t.length)return C(t[0]);w(e)}(e,n))).catch((()=>R(""))):void R(n)},onChange:e=>{const{value:t}=e.target;null==d||d({[X]:t}),A.current=!0,G(t)},onKeyUp:t=>{var n;if(13===t.keyCode){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==m||m({[X]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;w(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&w(e)}}),t.createElement(lo,k,t.createElement(Qu,P)))},"search-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:o,items:l=[],extra:a={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=Fo(e,i),v=c.fieldAliasMap;v||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Xt("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),P.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Nn)({[X]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{F(!0),null==t||t()})).catch((()=>{})):!1!==i&&(F(!0),null==t||t())},E=()=>{le(!1,(()=>de(N.current)))},S=t=>{$o(e,i,t),y(s,t,u,p),ue(e,u,p),null==h||h({[X]:t},e,H.current),oe()},w={visible:D,title:Bt("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Jl[f]+20}px`},onClose:()=>{E()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:xe({},c.initialValue),defaultSelectedKeys:g,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=b;ae(Ee([...H.current.filter((e=>t.includes(e[r]))),...e],r));const i=H.current.map((e=>({text:e[n],value:e[r]}))),o=Ee([...i,...l],"value").filter((e=>t.includes(e.value)));B(o),S(o.map((e=>e.value)));const{closed:a}=c;le(!1,(()=>de(N.current))),null==a||a(H.current)})(e,t):E()}});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($,{mode:"multiple",open:!1,value:g,placeholder:a.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:a.allowClear,maxTagCount:a.collapseTags?"responsive":void 0,maxTagTextLength:a.maxTagTextLength,disabled:a.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[X]:g},e))},onDoubleClick:()=>{a.disabled||x()},onChange:e=>{const{valueKey:t}=b;ae(H.current.filter((n=>e.includes(n[t])))),S(e)}},W.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:a.disabled,icon:t.createElement(We,null),onClick:()=>{x()}})))),t.createElement(lo,w,t.createElement(Qu,I)))},"tree-helper":(e,n)=>{var r,i;const{dataIndex:o,precision:l}=n,{type:a,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:m}=T,v=Mo(e,re?d.combinedDataIndex:o),b=d.fieldAliasMap;b||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(o)||Xt("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),re&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Xt("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[o].includes("|")&&Xt("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:r}=d,i=(null!=r?r:Nn)({[X]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{F(!0),null==t||t()})).catch((()=>{})):!1!==i&&(F(!0),null==t||t())},S=()=>{le(!1,(()=>de(N.current)))},w=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;var r;if(se(n)&&Object.keys(n).length)for(const t in n){const i=n[t],o=g.find((e=>e.dataIndex===t));if(o){$o(e,t,i,o.precision);const n=null===(r=o.editRender)||void 0===r?void 0:r.call(o,e,o);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else $o(e,t,i)}$o(e,o,t,l),y(c,t,u,p),ue(e,u,p),null==h||h({[X]:t},e),oe()},C={visible:D,title:Bt("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Jl[f]+20}px`},onClose:()=>{S()}},I=Object.assign(Object.assign({},d),{defaultSelectedKeys:[v],size:f,onClose:e=>{e?(e=>{const t={};for(const n in x){const r=x[n];n!==o&&(t[n]=Mo(e,r))}const n=x[o]?Mo(e,x[o]):"";w(n,t);const{closed:r}=d;le(!1,(()=>de(N.current))),ce(),null==r||r(e)})(e):S()}});return t.createElement(t.Fragment,null,t.createElement($u,{ref:k,value:v,allowClear:null===(i=s.allowClear)||void 0===i||i,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||Bt("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{var n;if(13===t.keyCode){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==m||m({[X]:r},e)}},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?E():w(""))}}),t.createElement(lo,C,t.createElement(rp,I)))},"tree-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:o,extra:l={},items:a=[],rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=Fo(e,i),v=c.fieldAliasMap;v||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Xt("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),P.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Nn)({[X]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{F(!0),null==t||t()})).catch((()=>{})):!1!==i&&(F(!0),null==t||t())},E=()=>{le(!1,(()=>de(N.current)))},S=t=>{$o(e,i,t),y(s,t,u,p),ue(e,u,p),null==h||h({[X]:t},e,H.current),oe()},w={visible:D,title:Bt("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Jl[f]+20}px`},onClose:()=>{E()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:xe({},c.initialValue),defaultSelectedKeys:g,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=b;ae(e);const r=H.current.map((e=>({text:e[t],value:e[n]})));B(r),S(r.map((e=>e.value)));const{closed:i}=c;le(!1,(()=>de(N.current))),null==i||i(H.current)})(e):E()}});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($,{mode:"multiple",open:!1,value:g,placeholder:l.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:l.allowClear,maxTagCount:l.collapseTags?"responsive":void 0,maxTagTextLength:l.maxTagTextLength,disabled:l.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[X]:g},e))},onDoubleClick:()=>{l.disabled||x()},onChange:e=>{const{valueKey:t}=b;ae(H.current.filter((n=>e.includes(n[t])))),S(e)}},W.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:l.disabled,icon:t.createElement(We,null),onClick:()=>{x()}})))),t.createElement(lo,w,t.createElement(rp,I)))}};return t.createElement(t.Fragment,null,ne?(()=>{const{type:e}=T,n=he[e];if(!n)return Xt("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!Q}];return t.createElement("div",{ref:N,className:De(r)},n(d,c),!Q&&t.createElement("div",{className:"cell-error"},J||ee))})():(()=>{const{extra:n={}}=T;return t.createElement("span",{style:{color:n.disabledColor}},e.children)})(),te&&t.createElement("i",{className:"cell--sign"}))}));Mu.displayName="CellEdit";const qu=function(e){if(!t.isValidElement(e))return null;for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return t.cloneElement(e,...r)},ju=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:o}=e;return qu(e.children,{onClick:l=>{const a=t.Children.only(e.children),s=_t(n,r);null==o||o(n,s),s&&i&&k.success(Bt("qm.clipboard.success")),a&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(l)}})};ju.displayName="QmCopyToClipboard";const Vu=t.forwardRef(((n,r)=>{const{column:i,row:o,rowIndex:l,columnIndex:a,rowKey:s,depth:c,showTitle:d}=n,{flattenColumns:u,selectionKeys:p,treeExpandIndex:h,updateMark:m,isTreeTable:f}=t.useContext(hd),{dataIndex:g,canCopy:v,render:y,editRender:b,shouldCellUpdate:x}=i,{t:E}=_u(),{renderText:S,getTitleFromCellNode:w}=Kd(),C=t.useRef(null),T=Fo(o,g),[N,I]=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=y?y(T,o,i,l,a):S(T,i,o);return[e,b?t.createElement(Mu,{ref:r,column:i,record:o,rowKey:s,columnKey:g},e):null]}),[m,T,y,b],((e,t)=>{if(x){const[,n]=e,[,r]=t;return x(r,n,o)}return!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=new Set;return function e(t,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(r.has(t))return!1;if(t===i)return!0;if(n&&o>1)return!1;r.add(t);const l=o+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],l))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],l)))}return!1}(e,t)}(e,t,!0)}));t.useEffect((()=>{if([kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(g))return;const e=C.current.parentNode;d?e.title=w(N):e.removeAttribute("title")}),[d,N]);const R=e=>Array.isArray(e.children);return t.createElement("div",{ref:C,className:"cell"},(()=>{if(g===kd.expandableColumn)return t.createElement(Du,{record:o,rowKey:s});if(g===kd.selectionColumn)return t.createElement(Hu,{selectionKeys:p,column:i,record:o,rowKey:s});if(I)return I;if(f&&g===h)return t.createElement(t.Fragment,null,(e=o._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*kd.treeTable.textIndent+"px"}}):null,t.createElement(Du,{key:"expand",record:o,rowKey:s,style:R(o)?{}:{visibility:"hidden"}}),N);var e;if(v){const e=w(N);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},N),e&&t.createElement(ju,{text:e},t.createElement(ot,{className:"icon",title:E("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return N})())}));Vu.displayName="Cell";const Ku={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},zu=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,flattenColumns:o,mergedTdCells:l,setMergedCells:a}=t.useContext(hd),{areaSelection:s={}}=r.current.props,{elementStore:c,tableFlatData:d}=r.current,{t:u}=_u(),p=t.useRef(null),h=t.useRef(document.onselectstart),[m,f]=t.useState(null),[g,v]=t.useState(null),[y,b]=t.useState(null);Lu({ref:p,handler:()=>D()});const x=t.useRef(Ku),E=e=>{x.current=Object.assign({},x.current,e)};t.useEffect((()=>{const e=It(c.$tableBody,"mousedown",A),t=It(c.$tableBody,"contextmenu",R),n=It(document,"mousedown",O),r=It(document,"keydown",k);return()=>{e.remove(),t.remove(),n.remove(),r.remove()}}),[]);const S=()=>{f(null),v(null),b(null)};t.useImperativeHandle(n,(()=>({blur:S})));const w=()=>c.$tableBody.parentNode,C=e=>{const{offsetLeft:t,offsetTop:n,offsetWidth:r,offsetHeight:i}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:n,w:r,h:i}},T=Vi(((e,t)=>{let n=null;const r=c.$tableBody.querySelectorAll("tbody > tr");for(let i=0;i<r.length;i++){if(r[i].offsetTop>t||r[i].offsetTop+r[i].offsetHeight<t)continue;const o=r[i].querySelectorAll("td");for(let t=0;t<o.length;t++)if(!(o[t].offsetLeft>e||o[t].offsetLeft+o[t].offsetWidth<e)){n=o[t];break}break}n&&v(C(n))}),5),N=Cd((()=>{const e=[];if(!m||!g)return e;const[t,n]=[m.colIndex,g.colIndex],[r,l]=[m.rowKey,g.rowKey];let[a,s]=[0,0];for(let e=0;e<d.length;e++){const t=i(d[e],d[e].index);if(t==r&&(a=e),t==l){s=e;break}}const c=o.slice(Math.min(t,n),Math.max(t,n)+1);return d.slice(a,s+1).forEach((t=>{for(let n=0;n<c.length;n++){const{dataIndex:r}=c[n];e.push({rowKey:i(t,t.index),dataIndex:r,cellValue:Fo(t,r)})}})),e})),I=e=>{var t;a(e),null===(t=s.onCellMerge)||void 0===t||t.call(s,e),Rn((()=>S()))},R=Cd((e=>{s.cellMerge&&m&&F(e.clientX,e.clientY)?(e.preventDefault(),H(e.clientX,e.clientY)):(null==y?void 0:y.open)&&D()})),O=e=>{var t;1!==e.buttons||(null===(t=p.current)||void 0===t?void 0:t.contains(e.target))||c.$tableBody.contains(e.target)||S()},k=e=>{27===e.keyCode&&S()},A=Cd((e=>{e.stopPropagation();const t=(e=>{let t=e;for(;t;){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null})(e.target);if(1!==e.buttons||!t)return;f(C(t)),v(C(t));const[n,r]=[c.$tableBody.getBoundingClientRect().top,w().getBoundingClientRect().left],{offsetWidth:i,offsetHeight:o}=w();E({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-r,startOffsetY:e.clientY-n,containerSizeX:i,containerSizeY:o}),document.addEventListener("mousemove",L),document.addEventListener("mouseup",P),h.current=document.onselectstart,document.onselectstart=()=>!1})),L=e=>{const t=e.clientX-x.current.startX,n=e.clientY-x.current.startY,r=x.current.startOffsetX+t,i=x.current.startOffsetY+n;T(Math.min(r,x.current.containerSizeX),Math.min(i,x.current.containerSizeY))},P=()=>{var e;E(Ku),null===(e=s.onSelectChange)||void 0===e||e.call(s,N()),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",P),_()},_=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)},H=(e,t)=>{const{top:n,left:r}=w().getBoundingClientRect();b({open:!0,startX:e-r+5,startY:t-n+5})},D=()=>{b(null)},F=(e,t)=>{const{top:n,left:r}=w().getBoundingClientRect(),[i,o]=[e-r,t-n],{el:l,et:a,ew:s,eh:c}=q();return!(i<l||i>l+s||o<a||o>a+c)},$=()=>{if(!m||!g||(t=g,(e=m).rowKey===t.rowKey&&e.colIndex===t.colIndex))return S();var e,t;const[n,r]=m.t<=g.t?[m.rowKey,g.rowKey]:[g.rowKey,m.rowKey],[a,s]=[m.colIndex,g.colIndex];let[c,u]=[0,0],p=n;for(let e=0;e<d.length;e++){const t=d[e],o=i(t,t.index);if(o==n&&(p=o,c=e),o==r){u=e;break}}const h={rowKey:p,dataIndex:o[Math.min(a,s)].dataIndex,rowSpan:u-c+1,colSpan:Math.abs(s-a+1)};I([...l.filter((e=>!(e.rowKey===h.rowKey&&e.dataIndex===h.dataIndex))),h])},M=()=>{let e=m.rowKey;const t=m.colIndex;for(let t=0;t<d.length;t++){const n=d[t],r=i(n,n.index);if(r==e){e=r;break}}const n=e,r=o[t].dataIndex;I(l.filter((e=>!(e.rowKey===n&&e.dataIndex===r))))},q=()=>{const{w:e,h:t,l:n,t:r}=m;let{w:i,h:o,l:l,t:a}=g;return i=l-n>0?l-n+i:Math.abs(l-n)+e,o=a-r>0?a-r+o:Math.abs(a-r)+t,l=l>n?n:l,a=a>r?r:a,{sl:n,st:r,sw:e,sh:t,el:l,et:a,ew:i,eh:o}},j=Fn("table");return t.createElement("div",{className:`${j}--area-select`},(()=>{if(!m||!g)return null;const{sl:e,st:n,sw:r,sh:i,el:o,et:l,ew:a,eh:s}=q();return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:i}}),t.createElement("div",{className:"checked-area",style:{left:o,top:l,width:a,height:s}}),(null==y?void 0:y.open)&&t.createElement("div",{ref:p,className:"context-menu ant-dropdown",style:{left:y.startX,top:y.startY}},t.createElement("ul",{className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:$},u("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:M},u("qm.table.areaSelect.cancelMerge")))))})())}));zu.displayName="AreaSelect";const Wu=t.forwardRef(((e,n)=>{const{tableFlatColumns:r,tableData:i}=e,{getRowKey:o,tableRef:l,flattenColumns:a,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:h,showFooter:m,scrollX:f,scrollY:g,selectionKeys:v,rowExpandedKeys:y,highlightKey:b,isPingLeft:x,isPingRight:E,isTableEmpty:S,isTreeTable:w,isGroupSubtotal:C,isWebPagination:T,setElementStore:N,createTableFullData:I,setSelectionKeysEffect:R,setHighlightKey:O,getStickyLeft:k,getStickyRight:A,scrollXToColumn:L,scrollYToRecord:P,rowInViewport:_,dataChange:H,setPingLeft:D,setPingRight:F,setFullScreen:$,findParentRowKeys:M,getAllChildRowKeys:q,triggerScrollXEvent:j,triggerScrollYEvent:V,scrollBottomDebouncer:K}=t.useContext(hd),{height:z,minHeight:W,maxHeight:B,rowHeight:U,rowSelection:G,rowHighlight:Y,expandable:X,stripe:Z,summation:Q,rowStyle:J,cellStyle:ee,spanMethod:te,tableConfig:ne,areaSelection:re,nativeScrollBar:ie,ellipsis:oe,showHeader:le,rowDraggable:ae,onRowClick:ce,onRowDblclick:de,onRowContextmenu:ue,onRowEnter:pe}=l.current.props,he=t.useRef(null),me=t.useRef({}),fe=t.useRef(null),ve=t.useRef(null),ye=t.useRef({prevST:0,prevSL:0}),be=l.current.scrollXLoad?r:a,xe=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,o={};return S&&Object.assign(o,{minHeight:"100px"}),W&&Object.assign(o,{minHeight:Ho(W)-e-n+"px"}),B&&Object.assign(o,{maxHeight:Ho(B)-e-n+"px"}),z||r||i?Object.assign(Object.assign({},o),{maxHeight:"",minHeight:"",height:`${t}px`}):o}),[z,B,W,S,h]),Ee=t.useMemo((()=>{const{scrollYStore:e}=l.current,{viewportHeight:t,gutterWidth:n}=h;return Math.floor((f?t-n:t)/e.rowHeight)}),[h,f]),[Se,we]=t.useState([]),Ce=Pu();Lu({ref:he,omitClassNames:[".table-editable__popper"],handler:()=>Oe([])}),t.useImperativeHandle(n,(()=>({setClickedValues:Oe,createFocus:Ie,forceUpdate:Ce}))),fi((()=>{Se.length&&l.current.tableManager.focus(l.current.uid)}),[Se]),t.useLayoutEffect((()=>{Ne();const e=It(document,"keydown",Te);return()=>e.remove()}),[]);const Te=Cd((e=>{var t,n,r,a,c,d,u;const{keyCode:p}=e;if(l.current.uid===(null===(t=l.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id)&&(27===p&&(Oe([]),O(""),$(!1)),Se.length&&(Ni(document.activeElement,he.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===p&&("radio"===(null==G?void 0:G.type)||Y)){const t=null!==(a=null!==(r=v[0])&&void 0!==r?r:b)&&void 0!==a?a:null,n=null!==(c=i.find((e=>o(e,e.index)===t)))&&void 0!==c?c:null;n&&(null==pe||pe(n,e))}if(38===p||40===p){bi(e);const{allTableData:t}=l.current,n=T?Lo(i):t,r=n.length;let a=n.findIndex((e=>o(e,e.index)===Se[0]));const s=38===p?(--a+r)%r:++a%r,c=n[s],h=o(c,c.index);"radio"!==(null==G?void 0:G.type)||(null===(d=G.disabled)||void 0===d?void 0:d.call(G,c))||R([h]),Y&&!(null===(u=Y.disabled)||void 0===u?void 0:u.call(Y,c))&&O(h),_(s)||(38===p&&P(h,s),40===p&&P(h,Ee>s+1?0:s+1-Ee)),Oe([h,Se[1]])}if(9===p){if(bi(e),!s.length)return Oe([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Se[1]));const r=++n%t,i=s[r].dataIndex;Oe([Se[0],i]),L(i)}}})),Ne=()=>{N("$tableBody",he.current),N("$tableXspace",fe.current),N("$tableYspace",ve.current)},Ie=(e,t)=>{var n;null===(n=me.current[`${e}-${t}`])||void 0===n||n.focus()},Re=(e,t,n)=>{var r,i;const{dataIndex:l}=n;if([kd.expandableColumn,kd.operationColumn].includes(l))return;const a=o(t,t.index);Oe([a,l]);const s=null===(r=n.editRender)||void 0===r?void 0:r.call(n,t,n),c=s&&!s.disabled,{type:d,selectByClickRow:u=!0,disabled:p=Tn}=G||{};!d||p(t)||c||(u||l===kd.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:r=!0,onSelect:i}=G||{};if("radio"===n&&R([e]),"checkbox"===n){const n=!v.includes(e),o=w&&!r?Ae(e,v,n):ke(e,v,n);R(o),null==i||i(n,t,o)}})(a,t),[kd.selectionColumn].includes(l)||(!Y||(null===(i=Y.disabled)||void 0===i?void 0:i.call(Y,t))||c||O(a),null==ce||ce(t,n,e))},Oe=e=>{ge(e,Se)||we(e)},ke=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Ae=(e,t,n)=>{var r;const{disabled:i}=G||{},{deriveRowKeys:o,recordsMap:a}=l.current,s=Ao(o,e);let c=[],d=q((null==s?void 0:s.children)||[]);i&&(d=d.filter((e=>!a.has(e)||!i(a.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(r=Qo(o,e))||void 0===r?void 0:r.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ao(o,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},Le=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=[];return e.forEach((e=>{const i=e.index,a=o(e,e.index);if(r.push(Pe(e,i,a,n)),null==X?void 0:X.expandedRowRender){const{expandedRowClassName:n,rowExpandable:o=Nn}=X;y.includes(a)&&o(e)&&r.push(t.createElement("tr",{key:`expand_${a}`,className:"body--row-expanded"},t.createElement("td",{colSpan:be.length,className:"body--column",style:{paddingLeft:G?2*kd.selectionColumnWidth:kd.selectionColumnWidth}},t.createElement("div",{className:De("cell",n)},X.expandedRowRender(e,i)))))}if(!l.current.scrollYLoad&&(e=>Array.isArray(e.children))(e)){const t="function"!=typeof(null==X?void 0:X.rowExpandable)||X.rowExpandable(e);y.includes(a)&&t&&r.push(...Le(e.children,n+1))}})),r},Pe=function(e,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const{disabled:o}=G||{},l=["body--row",Object.assign({"body--row-striped":Z&&n%2!=0,"body--row-selected":v.includes(r)&&!(null==o?void 0:o(e)),"body--row-current":b===r},C?$e(e._group):null)];return t.createElement("tr",{key:r,"data-row-key":r,className:De(l)},be.map(((t,o)=>_e(t,o,e,n,r,i))))},_e=(e,n,r,i,o,s)=>{var u,h,m;const{isIE:f}=l.current,{dataIndex:g,fixed:v,align:y,className:b="",editRender:x}=e;l.current.scrollXLoad&&(n=a.findIndex((e=>e.dataIndex===g)));const{rowSpan:E,colSpan:S}=He(r,e,i,n);if(!E||!S)return null;const w=null!==(u=e.ellipsis)&&void 0!==u?u:oe,T=!f&&"left"===v,N=!f&&"right"===v,I=["body--column",{"col--ellipsis":w,"col--center":"center"===y,"col--right":"right"===y,"column--sort":!!p[g],"cell-fix-left":T,"cell-fix-right":N,"cell-fix-left-last":T&&(null===(h=c[c.length-S])||void 0===h?void 0:h.dataIndex)===g,"cell-fix-right-first":N&&(null===(m=d[0])||void 0===m?void 0:m.dataIndex)===g,[b]:!!b}],R=N&&S>1?a.slice(n+1,n+S).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,O=f?null:{left:T?`${k(g)}px`:"",right:N?A(g)-R+"px":""},L=J?"function"==typeof J?J(r,i):J:null,P=ee?"function"==typeof ee?ee(r,e,i,n):ee:null,_=C?Fe(r._group):null,H=Object.assign({},O,U?{height:U}:null,_,L,P);if(x){const{extra:t}=x(r,e)||{};(null==t?void 0:t.disabledBackgroundColor)&&Object.assign(H,{backgroundColor:null==t?void 0:t.disabledBackgroundColor})}return t.createElement("td",{key:g,"data-col-index":n,rowSpan:E>1?E:void 0,colSpan:S>1?S:void 0,className:De(I),style:H,onClick:t=>Re(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(r)||null==de||de(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(r)||null==ue||ue(t,n,e)})(t,r,e)},t.createElement(Vu,{ref:e=>me.current[`${o}-${g}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:o,depth:s,showTitle:w}))},He=(e,t,n,r)=>{let o=1,l=1;if("function"==typeof te){const a=te({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});if(Array.isArray(a)?(o=a[0],l=a[1]):se(a)&&(o=a.rowSpan,l=a.colSpan),e===i[0]&&0===o){o=1;for(let e=1;e<i.length;e++){const{rowSpan:n}=He(i[e],t,i[e].index,r);if(n>0)break;o++}}}if(u.length>0){const e=u.find((e=>e.row===n&&e.col===r));e&&(o=e.rowSpan,l=e.colSpan)}return{rowSpan:o,colSpan:l}},Fe=e=>{var t;const{backgroundColor:n,color:r}=null!==(t=Q.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}},$e=e=>{const t=Q.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Me=Fn("table");return t.createElement(t.Fragment,null,t.createElement(Ui,{ref:l.current.scrollBarRef,wrapClassName:`${Me}--body-wrapper`,wrapStyle:xe,native:ie,showTopScrollbar:null==ne?void 0:ne.doubleXScrollbar,onScroll:e=>{const{elementStore:t,scrollXLoad:n,scrollYLoad:r}=l.current,{prevST:i,prevSL:o}=ye.current,a=g?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==o){le&&(t.$header.scrollLeft=c),m&&(t.$footer.scrollLeft=c);const e=c>0,n=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+a;x!==e&&D(e),E!==n&&F(n)}if(r&&s!==i&&V(s),n&&c!==o&&j(c),g&&s!==i){const n=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-a>=n&&K({type:"scroll",target:e,preventDefault:Tn,stopPropagation:Tn})}ye.current.prevST=s,ye.current.prevSL=c}},t.createElement("div",{ref:ve,className:"body--y-space"}),t.createElement("div",{ref:fe,className:"body--x-space",style:{width:g?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),t.createElement(Ru.Provider,{value:Se},t.createElement("table",{ref:he,className:`${Me}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0",style:{width:0}},t.createElement("colgroup",null,be.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`}})}))),ae?t.createElement($t,{itemKey:e=>o(e,e.index),tag:"tbody",animation:200,list:i,setList:e=>{const t=e.map((e=>o(e,e.index))),n=i.map((e=>o(e,e.index)));if(ge(t,n))return;const r=tl(e),a=[];l.current.tableFullData.forEach((e=>{i.includes(e)?a.push(r.shift()):a.push(e)})),I(a),H()}},i.map((e=>Pe(e,e.index,o(e,e.index))))):t.createElement("tbody",null,Le(i)))),!!re&&t.createElement(zu,null)))}));Wu.displayName="TableBody";const Bu=e=>{const{summationRows:n}=e,{tableRef:r,sorter:i,layout:o,scrollY:l,flattenColumns:a,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=t.useContext(hd),{footRender:h}=r.current.props,m=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{d("$footer",m.current)},g=(e,n,a)=>{var d,h;const{isIE:m}=r.current,{gutterWidth:f}=o,{dataIndex:g,fixed:v,align:y,summation:b}=e,x=["footer--column","col--ellipsis",{"col--center":"center"===y,"col--right":"right"===y,"column--sort":!!i[g],"cell-fix-left":!m&&"left"===v,"cell-fix-right":!m&&"right"===v,"cell-fix-left-last":!m&&"left"===v&&(null===(d=s[s.length-1])||void 0===d?void 0:d.dataIndex)===g,"cell-fix-right-first":!m&&"right"===v&&(null===(h=c[0])||void 0===h?void 0:h.dataIndex)===g}],E=m?null:{left:"left"===v?`${u(g)}px`:"",right:"right"===v?`${p(g)+(l?f:0)}px`:""},S=(null==b?void 0:b.render)?b.render(r.current.tableFullData):Fo(n,`${g}_text`),w=0===a&&""===S?Bt("qm.table.config.summaryText"):S;return t.createElement("td",{key:g,title:w,className:De(x),style:Object.assign({},E)},t.createElement("div",{className:"cell"},w))},v=Fn("table"),{tableBodyWidth:y}=o;return t.createElement("div",{ref:m,className:`${v}--footer-wrapper`},h?h(a,r.current.tableFullData):t.createElement("table",{className:`${v}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=o;return 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`}})})),l&&t.createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t.createElement("tfoot",null,(()=>{const{isIE:e}=r.current,i=["gutter",{"cell-fix-right":!!c.length}],o=e?null:{right:c.length?0:""};return n.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},a.map(((t,n)=>g(t,e,n))),l&&t.createElement("td",{className:De(i),style:Object.assign({},o)}))))})())))};var Uu;!function(e){e.small="small",e.middle="default",e.large="default"}(Uu||(Uu={}));const Gu=e=>{var n,r,i,o;const{current:l,pageSize:a,total:s,onChange:c}=e,{global:d}=t.useContext(Vt),{tableRef:u,$size:p,setElementStore:h}=t.useContext(hd),{uniqueKey:m,paginationConfig:f,infoBarConfig:g}=u.current.props,v=t.useRef(null),y=t.useMemo((()=>m?`tablePager_${m}`:""),[m]);t.useLayoutEffect((()=>{b(),w()}),[]);const b=()=>{h("$pager",v.current)},x=null!==(n=null==f?void 0:f.showSizeChanger)&&void 0!==n?n:kd.pagination.showSizeChanger,E=null!==(r=null==f?void 0:f.showQuickJumper)&&void 0!==r?r:kd.pagination.showQuickJumper,S=(null==f?void 0:f.pageSizeOptions)||(null===(o=null===(i=null==d?void 0:d.table)||void 0===i?void 0:i.pagination)||void 0===o?void 0:o.pageSizeOptions)||kd.pagination.pageSizeOptions,w=()=>En(void 0,void 0,void 0,(function*(){if(!y)return;const e=yield C(y);e&&e!==a&&(c(l,e),localStorage.setItem(y,e.toString()))})),C=e=>En(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t&&!localStorage.getItem(y))try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),T=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),N={[`${Fn("table")}-pager`]:!0};return t.createElement("div",{ref:v,className:De(N)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==g?void 0:g.position)&&t.createElement(qd,{total:s})),t.createElement(ee,{size:Uu[p],showSizeChanger:x,showQuickJumper:E,pageSizeOptions:S,current:l,pageSize:a,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{y&&(T(y,t),localStorage.setItem(y,`${t}`))}}))},Yu=()=>{const{layout:e}=t.useContext(hd),n=t.useMemo((()=>{const{headerHeight:t,viewportHeight:n}=e;return{top:`${t}px`,height:`${n}px`}}),[e]),r=Fn("table");return t.createElement("div",{className:`${r}--empty`,style:n},t.createElement(Pi,null))},Xu=()=>{const{setElementStore:e}=t.useContext(hd),n=t.useRef(null);t.useLayoutEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",n.current)},i=Fn("table");return t.createElement("div",{ref:n,className:`${i}--resizable-bar`})},Zu=t.forwardRef(((e,n)=>{const r=((e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})))(fd,e),{rowKey:i,columns:o,loading:l,resizable:a,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:p,topSpaceAlign:h,showTableInfo:m,showFullScreen:f,showRefresh:g,showToolBox:v,showHeader:y}=r,{size:b}=t.useContext(Vt),x=t.useMemo((()=>{var e,t;return null!==(t=null!==(e=r.size)&&void 0!==e?e:b)&&void 0!==t?t:""}),[r.size,b]),E=t.useRef(null),S=t.useRef(null),w=t.useRef(null),C=t.useRef(null),T=t.useRef(null),N=Cd(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(Xt("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:I,tableFullData:R,setElementStore:O,setOriginColumns:k,setTableFullData:A,setTableOriginData:L,setTableFlatData:P,setAllTableData:_,setDeriveRowKeys:H,setInvalidRowKeys:D,setFieldAuth:F,setColumnsDefined:$,setScrollXStore:M,setScrollYStore:q,setScrollXLoad:j,setScrollYLoad:V,setResizeState:K,setHandleState:z,setSummaries:W,setSelectionRows:B,setShouldToTop:U,setRecordsMap:G,setUnMounted:Y,clearElementStore:X,clearRecordsMap:Z}=((e,n)=>{let{getRowKey:r,$size:i}=n;const{rowHeight:o,dynamicThead:l}=e,a=t.useRef({props:e,uid:Id(),tableManager:new Rd,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],tableFlatData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!l,scrollBarRef:t.createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:o||kd.rowHeightMaps[i]},store:new Od,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollXLoad:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!Sn&&/MSIE|Trident/.test(navigator.userAgent)});var s;s=e,a.current.props=s;const c=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const l=r(e,e.index),a=n?`${n}#${l}`:`${l}`,s=i?`${i}.${e.index+1}`:`${e.index+1}`,d={level:o,rowKey:l,rowKeyPath:a,indexPath:s};return e.indexPath=s,e._level=o,Array.isArray(e.children)&&(d.children=c(e.children,l,a,s,o+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},d=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...d(e.children)):t.push(e.rowKey)})),t};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},setTableFlatData:e=>{a.current.tableFlatData=e},setTableOriginData:e=>{a.current.tableOriginData=e},setAllTableData:e=>{const t=Lo(e);a.current.allTableData=t,a.current.allRowKeys=t.map((e=>r(e,e.index)))},setDeriveRowKeys:e=>{const t=a.current.tableFullData.some((e=>Array.isArray(e.children)));a.current.treeTable=t,a.current.deriveRowKeys=t?c(e,""):[],a.current.flattenRowKeys=t?d(a.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{a.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{a.current.fieldAuth[e]=t},setColumnsDefined:e=>{a.current.columnsDefined=e},setScrollXStore:e=>{a.current.scrollXStore=e},setScrollYStore:e=>{a.current.scrollYStore=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},setShouldToTop:e=>{a.current.shouldToTop=e},setSelectionRows:e=>{a.current.selectionRows=e},setRecordsMap:(e,t)=>{a.current.recordsMap.set(e,t)},setUnMounted:e=>{a.current.unMounted=e},clearElementStore:()=>{for(const e in a.current.elementStore)a.current.elementStore[e]=null},clearRecordsMap:()=>{a.current.recordsMap.clear()}})})(r,{getRowKey:N,$size:x}),{tableData:Q,setTableData:J,tableFlatColumns:ee,setTableFlatColumns:te,filters:ne,setFilters:re,sorter:ie,setSorter:oe,superFilters:le,setSuperFilters:ae,pagination:ce,setPagination:de,selectionKeys:ue,setSelectionKeys:pe,rowExpandedKeys:he,setRowExpandedKeys:me,highlightKey:fe,setHighlightKey:ye,updateMark:be,forceUpdate:xe,mergedTdCells:Ee,setMergedCells:Se,layout:we,setLayout:Ce,permission:Te,setPermission:Ne,spinning:Ie,setSpinning:Re,scrollX:Oe,setScrollX:ke,scrollY:Ae,setScrollY:Le,isPingLeft:Pe,setPingLeft:_e,isPingRight:He,setPingRight:Fe,isFullScreen:$e,setFullScreen:Me,updateTableData:qe}=(e=>{var n,r,i,o,l,a,s,c,d,u,p;const{uniqueKey:h,nativeScrollBar:m,initialSorter:f={},initialFilter:g={},paginationConfig:v,rowSelection:y,expandable:b,rowHighlight:x,mergedCells:E}=e,{global:S}=t.useContext(Vt),w={current:null!==(n=null==v?void 0:v.current)&&void 0!==n?n:kd.pagination.current,pageSize:null!==(a=null!==(i=null!==(r=(()=>{if(h)return Number(localStorage.getItem(`tablePager_${h}`))||void 0})())&&void 0!==r?r:null==v?void 0:v.pageSize)&&void 0!==i?i:null===(l=null===(o=null==S?void 0:S.table)||void 0===o?void 0:o.pagination)||void 0===l?void 0:l.pageSize)&&void 0!==a?a:kd.pagination.pageSize,total:0},C=null!==(c=null!==(s=null==y?void 0:y.selectedRowKeys)&&void 0!==s?s:null==y?void 0:y.defaultSelectedRowKeys)&&void 0!==c?c:[],T=null!==(u=null!==(d=null==b?void 0:b.expandedRowKeys)&&void 0!==d?d:null==b?void 0:b.defaultExpandedRowKeys)&&void 0!==u?u:[],[N,I]=t.useState([]),[R,O]=t.useState([]),[k,A]=t.useReducer(((e,t)=>ge(e,t)?e:t),g),[L,P]=t.useReducer(((e,t)=>ge(e,t)?e:t),f),[_,H]=t.useReducer(((e,t)=>ge(e,t)?e:t),[]),[D,F]=t.useState(w),[$,M]=t.useReducer(((e,t)=>ge(e,t)?e:t),C),[q,j]=t.useReducer(((e,t)=>ge(e,t)?e:t),T),[V,K]=t.useState(null!==(p=null==x?void 0:x.currentRowKey)&&void 0!==p?p:""),[z,W]=t.useReducer((e=>e+1),0),[B,U]=Ld([],{value:E}),[G,Y]=t.useState({gutterWidth:m?_d():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[X,Z]=t.useState({export:!0,import:!0,print:!0}),[Q,J]=t.useState(!1),[ee,te]=t.useState(!1),[ne,re]=t.useState(!1),[ie,oe]=t.useState(!1),[le,ae]=t.useState(!1),[se,ce]=t.useState(!1);return{tableData:N,setTableData:I,tableFlatColumns:R,setTableFlatColumns:O,filters:k,setFilters:A,sorter:L,setSorter:P,superFilters:_,setSuperFilters:H,pagination:D,setPagination:F,selectionKeys:$,setSelectionKeys:M,rowExpandedKeys:q,setRowExpandedKeys:j,highlightKey:V,setHighlightKey:K,updateMark:z,forceUpdate:W,mergedTdCells:B,setMergedCells:U,layout:G,permission:X,setPermission:Z,setLayout:Y,spinning:Q,setSpinning:J,scrollX:ee,setScrollX:te,scrollY:ne,setScrollY:re,isPingLeft:ie,setPingLeft:oe,isPingRight:le,setPingRight:ae,isFullScreen:se,setFullScreen:ce,updateTableData:()=>I([...N])}})(r),{isFetch:je,isWebPagination:Ve,isScrollPagination:Ke,showPagination:ze,shouldUpdateHeight:We,tableColumns:Be,flattenColumns:Ue,editableColumns:Ge,summationColumns:Ye,leftFixedColumns:Xe,rightFixedColumns:Ze,derivedMergeCells:Qe,treeExpandIndex:Je,showSummary:et,showFooter:tt,isHeadGroup:nt,bordered:rt,isHeadSorter:it,isHeadFilter:ot,isServiceSummation:lt,isSelectCollection:at,isTableImport:st,isTableClipboard:ct,isSuperSearch:dt,isFastSearch:ut,isGroupSummary:pt,isGroupSubtotal:ht,isTreeTable:mt,isTableEmpty:ft,summationRows:gt,fetchParams:vt}=Dd(r,{getRowKey:N,tableRef:I,tableFullData:R,tableData:Q,sorter:ie,filters:ne,superFilters:le,selectionKeys:ue,pagination:ce,mergedTdCells:Ee}),{createElementStore:yt,tableStyles:bt,getSpan:xt,getStickyLeft:Et,getStickyRight:St,scrollXToColumn:wt,scrollYToRecord:Ct,rowInViewport:Tt,calcTableHeight:Nt,resetTableScroll:It,computeVirtualX:Rt,computeVirtualY:Ot,doLayout:kt}=$d(r,{getRowKey:N,tableRef:I,topElementRef:E,tableElementRef:S,$size:x,tableColumns:Be,flattenColumns:Ue,leftFixedColumns:Xe,derivedMergeCells:Qe,layout:we,scrollX:Oe,scrollY:Ae,showFooter:tt,showPagination:ze,isFullScreen:$e,setLayout:Ce,setScrollX:ke,setScrollY:Le,setElementStore:O,setScrollXStore:M,setScrollYStore:q,setShouldToTop:U}),{initialTable:At,checkDataIndex:Lt,createTableFullData:Pt,getTableData:_t,handleTableData:Ht,createWebPageData:Dt,createTableData:Ft,createGroupData:$t,createSelectionKeys:Mt,createRowExpandedKeys:qt,setSelectionKeysEffect:jt,findParentRowKeys:Kt,getAllChildRowKeys:zt,doFieldValidate:Wt,getTableLog:Bt,dataChange:Ut,tableChange:Gt,toLastPage:Yt,toFirstPage:Zt,getPageCount:Qt,pagerChangeHandle:Jt,triggerScrollXEvent:en,triggerScrollYEvent:tn,scrollBottomDebouncer:nn,clearTableSorter:rn,clearTableFilter:on,clearSuperFilters:ln,clearRowSelection:an,clearRowHighlight:sn,clearTableLog:cn,destroy:dn}=Fd(r,{getRowKey:N,tableRef:I,tableElementRef:S,tableBodyRef:w,$size:x,tableColumns:Be,flattenColumns:Ue,tableFullData:R,pagination:ce,layout:we,filters:ne,sorter:ie,superFilters:le,fetchParams:vt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,summationColumns:Ye,shouldUpdateHeight:We,isFetch:je,isTreeTable:mt,isWebPagination:Ve,isScrollPagination:Ke,isServiceSummation:lt,isGroupSubtotal:ht,doLayout:kt,setTableData:J,setTableFlatColumns:te,setTableFullData:A,setTableOriginData:L,setTableFlatData:P,setAllTableData:_,setDeriveRowKeys:H,setPagination:de,setSpinning:Re,setSorter:oe,setFilters:re,setSuperFilters:ae,setSelectionKeys:pe,setRowExpandedKeys:me,setHighlightKey:ye,setSelectionRows:B,setScrollXLoad:j,setScrollYLoad:V,setScrollXStore:M,setScrollYStore:q,computeVirtualX:Rt,computeVirtualY:Ot,setFieldAuth:F,setResizeState:K,setSummaries:W,setPermission:Ne,setRecordsMap:G,resetTableScroll:It,clearElementStore:X,clearRecordsMap:Z});Md(r,{tableRef:I,tableBodyRef:w,$size:x,scrollX:Oe,pagination:ce,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,showSummary:et,summationRows:gt,isWebPagination:Ve,isScrollPagination:Ke,isTreeTable:mt,checkDataIndex:Lt,toLastPage:Yt,toFirstPage:Zt,getPageCount:Qt,setHandleState:z,scrollYToRecord:Ct,setOriginColumns:k,setSelectionKeysEffect:jt,setRowExpandedKeys:me,setHighlightKey:ye,setResizeState:K,setPingRight:Fe,setUnMounted:Y,calcTableHeight:Nt,createSelectionKeys:Mt,createRowExpandedKeys:qt,initialTable:At,destroy:dn});const un=t.useMemo((()=>({getRowKey:N,tableRef:I,tableBodyRef:w,$size:x,flattenColumns:Ue,editableColumns:Ge,leftFixedColumns:Xe,rightFixedColumns:Ze,treeExpandIndex:Je,sorter:ie,filters:ne,superFilters:le,layout:we,bordered:rt,showFooter:tt,showSummary:et,summationRows:gt,scrollX:Oe,scrollY:Ae,pagination:ce,fetchParams:vt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,mergedTdCells:Ee,derivedMergeCells:Qe,updateMark:be,isFetch:je,isPingLeft:Pe,isPingRight:He,isHeadSorter:it,isHeadFilter:ot,isFullScreen:$e,isTableEmpty:ft,isHeadGroup:nt,isTreeTable:mt,isGroupSubtotal:ht,isWebPagination:Ve,dataChange:Ut,tableChange:Gt,getTableData:_t,setElementStore:O,createWebPageData:Dt,createTableFullData:Pt,updateTableData:qe,setSorter:oe,setFilters:re,setSuperFilters:ae,setHighlightKey:ye,setRowExpandedKeys:me,setSelectionRows:B,setSelectionKeysEffect:jt,setInvalidRowKeys:D,setMergedCells:Se,getSpan:xt,getStickyLeft:Et,getStickyRight:St,scrollXToColumn:wt,scrollYToRecord:Ct,rowInViewport:Tt,setPagination:de,setPingLeft:_e,setPingRight:Fe,setSpinning:Re,setFullScreen:Me,setShouldToTop:U,doFieldValidate:Wt,createTableData:Ft,createGroupData:$t,findParentRowKeys:Kt,getAllChildRowKeys:zt,triggerScrollXEvent:en,triggerScrollYEvent:tn,scrollBottomDebouncer:nn,resetTableScroll:It,clearTableSorter:rn,clearTableFilter:on,clearSuperFilters:ln,clearRowSelection:an,clearRowHighlight:sn})),[x,Ue,Ge,Xe,Ze,Je,ie,ne,le,we,rt,tt,et,gt,Oe,Ae,ce,vt,ue,he,fe,Qe,be,je,Pe,He,it,ot,$e,ft,nt,mt,ht,Ve]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:o,tableBodyRef:l,columnFilterRef:a,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:v,handleTableData:y,createTableData:b,createTableFullData:x,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:T,setHandleState:N,setColumnsDefined:I,setSelectionKeysEffect:R,setRowExpandedKeys:O,setHighlightKey:k,setSelectionRows:A,setOriginColumns:L,forceUpdate:P,getTableLog:_,clearRowSelection:H,clearRowHighlight:D,clearTableSorter:F,clearTableFilter:$,clearSuperFilters:M,clearTableLog:q}=n,{columns:j,columnsChange:V}=i.current.props,K=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=K(e.children,t,n));const o=t.includes(i);return o&&(null==n||n(e,i)),!o}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:e=>En(void 0,void 0,void 0,(function*(){f&&(yield v(),null==e||e())})),GET_LOG:()=>_(),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||(H(),D(),F(),$(),M(),q(),b([]))},CLEAR_LOG:()=>{q()},CREATE_FOCUS:(e,t)=>{l.current.createFocus(e,t)},FORCE_UPDATE:()=>{P()},DO_EXPORT:()=>{o.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:(e,t)=>{const n=[...e];t&&(n.__prevent__=!0),R(n)},SET_EXPANDABLE:(e,t)=>{const n=[...e];t&&(n.__prevent__=!0),O(n)},SET_HIGHLIGHT:e=>{k(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),I(!0),a.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=Io(j,e);if(!r)return Xt("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!se(t))return Xt("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return Xt("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&ve(r,e,t[e]);n&&(V?V([...j]):Xt("Table","需要设置 `columnsChange` 参数"),P())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:o}=i.current,l=(Array.isArray(e)?e:[e]).filter((e=>se(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(n)||$o(e,n,Fo(e,n))})),n.addToInserted(e)}));const a="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=o;if(c)a?d.unshift(...l):d.push(...l);else{const e=Jo(o,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?a?e.children.unshift(...l):e.children.push(...l):e.children=l)}b(d),c&&N(Object.assign({},i.current.handleState,{insert:a?"before":"after"})),P(),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,o=(Array.isArray(e)?e:[e]).map((e=>se(e)?r(e,e.index):e));if(!o.length)return;let l=!1;const a=K(n,o,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:o}=r,l=null==o?void 0:o(e,r);if(!l)return;const{rules:a=[],disabled:s}=l;!s&&a.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),l=!0}));l&&(x(a),R(p.filter((e=>!o.includes(e)))),o.includes(m)&&D(),O(h.filter((e=>!o.includes(e)))),N(Object.assign({},i.current.handleState,{remove:!0})),g(),Rn((()=>{T(K(i.current.tableOriginData,o))})))},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:o,editRender:l}=i,a=null==l?void 0:l(n,i);if(!a)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(o))return;const{rules:c=[],disabled:d}=a;!d&&c.length&&C(c,Fo(n,o),s,o)}))}));const{required:n,validate:o}=_(),l=[...n,...o];return l.length&&w(l[0].rowKey),P(),{required:n,validate:o}}})))})(n,{getRowKey:N,tableRef:I,toolBoxRef:C,tableBodyRef:w,columnFilterRef:T,flattenColumns:Ue,editableColumns:Ge,pagination:ce,fetchParams:vt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,isFetch:je,dataChange:Ut,getTableData:_t,handleTableData:Ht,createTableData:Ft,createTableFullData:Pt,calcTableHeight:Nt,scrollXToColumn:wt,scrollYToRecord:Ct,doFieldValidate:Wt,setTableOriginData:L,setHandleState:z,setColumnsDefined:$,setSelectionKeysEffect:jt,setRowExpandedKeys:me,setHighlightKey:ye,setSelectionRows:B,setOriginColumns:k,forceUpdate:xe,getTableLog:Bt,clearRowSelection:an,clearRowHighlight:sn,clearTableSorter:rn,clearTableFilter:on,clearSuperFilters:ln,clearTableLog:cn}),t.useLayoutEffect((()=>{yt(),I.current.tableManager.register(I.current.uid,null!=n?n:{current:null})}),[]);const pn=Fn("table"),mn={[`${pn}--wrapper`]:!0,[`${pn}--lg`]:"large"===x,[`${pn}--sm`]:"small"===x,[`${pn}--maximize`]:$e,[s]:!!s},fn={[pn]:!0,"is--border":rt,"is--fixed":Xe.length||Ze.length,"is--sortable":it,"is--filterable":ot,"is--head-group":nt,"is--area-select":!!c,"is--ping-left":Pe,"is--ping-right":He};return t.createElement(hd.Provider,{value:un},t.createElement("div",{className:De(mn)},m&&t.createElement("div",{ref:E,className:`${pn}-top`},t.createElement("div",{className:`${pn}-top__space`},"bottom"!==(null==p?void 0:p.position)&&t.createElement(qd,{total:ce.total}),t.createElement("div",{className:`${pn}-top__space-slot`,style:{justifyContent:wd[h]}},r.children)),t.createElement("div",{className:`${pn}-top__actions`},t.createElement(vu,{ref:C,showFullScreen:f,showReload:g&&je,showPrint:Te.print&&!!d,showImport:Te.import&&st,showExport:Te.export&&!!u,showClipboard:ct,showCollection:at,showFastSearch:ut,showSuperSearch:dt,showGroupSummary:pt,showToolBox:v,tableColumns:Be}),t.createElement(bu,{ref:T,columns:o}))),t.createElement(_i,{spinning:null!=l?l:Ie},t.createElement("div",{ref:S,className:De(fn),style:bt},t.createElement("div",{className:`${pn}--main-wrapper`},y&&t.createElement(Iu,{tableColumns:Be,sorter:ie,filters:ne}),t.createElement(Wu,{ref:w,tableFlatColumns:ee,tableData:Q}),tt&&t.createElement(Bu,{summationRows:gt})),rt&&t.createElement("div",{className:`${pn}--border-line`}),ft&&t.createElement(Yu,null),a&&t.createElement(Xu,null))),ze&&t.createElement(Gu,hn({},ce,{onChange:(e,t)=>Jt({current:e,pageSize:t})}))))}));Zu.displayName="QmTable";const Qu=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:o,selectionRows:l,defaultSelectedKeys:a=[],filters:s=[],table:c={},className:d,style:u,onClose:p}=e,{size:h}=t.useContext(Vt),m=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:h)&&void 0!==n?n:""}),[e.size,h]),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=Mi(f),[b,x]=t.useState(c),[E,S]=t.useState(),[w,C]=t.useState(a),[T,N]=t.useState(!1),[I,R]=t.useState(300),[O,k]=t.useState(s),[A,L]=t.useState((e=>[{title:Bt("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[P,_]=t.useState(xe({},null===(n=c.fetch)||void 0===n?void 0:n.params,o)),[H,D]=t.useState([]),F=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Jl[m]-30)},$=Vi(F,5);ji((()=>{$()}),[y.width]),fi((()=>{ge(s,O)||k(s)}),[s]),t.useEffect((()=>{M()}),[P]),t.useEffect((()=>{l&&v.current.SET_SELECTION_ROWS(l)}),[l]),t.useEffect((()=>{var e;o&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(o))}),[]);const M=()=>En(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:o,beforeFetch:l=Nn}=n;if(l(P)){N(!0);try{const t=yield r(P);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,o))&&void 0!==e?e:[];i||(C([]),yield In(0)),D(n)}}catch(e){}N(!1)}})),q=e=>{i||(S(e),p(e))},j=e=>{_(Object.assign({},P,e))},V={[`${Fn("search-helper")}--wrapper`]:!0},K=b.webPagination?{dataSource:H,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:P})};return t.createElement("div",{ref:f,className:De(V,d),style:u},t.createElement("div",{className:"form-wrap"},O.length?t.createElement(Fc,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>F(),onFinish:e=>j(e),onReset:()=>En(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(Zu,hn({ref:v,uniqueKey:r,height:I,columns:A,rowKey:b.rowKey||"pageIndex"},K,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{C(e),S(i?t:t[0])}},paginationConfig:b.paginationConfig,columnsChange:e=>L(e),onRowDblclick:q,onRowEnter:q}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Jl[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>p(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!E,onClick:()=>p(E,i?w:void 0)},Bt("qm.dialog.confirm"))))};Qu.displayName="SearchHelper";const Ju=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ju(e.children)),e.children&&t.push(e.value)})),t},ep=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=ep(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},tp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&tp(e.children,t),t(e)||e.children&&e.children.length))),np=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:o,selectionRows:l,defaultSelectedKeys:a=[],filters:s=[],table:c={},tree:d={},className:u,style:p,onClose:h}=e,{size:m}=t.useContext(Vt),f=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:m)&&void 0!==n?n:""}),[e.size,m]),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=Mi(g),[x,E]=t.useState(c),[S,w]=t.useState(),[C,T]=t.useState(a),[N,I]=t.useState(!1),[R,O]=t.useState(300),[k,A]=t.useState(300),[L,P]=t.useState(s),[H,D]=t.useState((e=>[{title:Bt("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[F,$]=t.useState(xe({},null===(n=c.fetch)||void 0===n?void 0:n.params,o)),[M,q]=t.useState([]),j=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");O(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Jl[f]-30)},V=Vi(j,5);ji((()=>{V()}),[b.width]),fi((()=>{ge(s,L)||P(s)}),[s]),t.useEffect((()=>{K()}),[F]),t.useEffect((()=>{l&&y.current.SET_SELECTION_ROWS(l)}),[l]),t.useEffect((()=>{var e;o&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(o)),te()}),[]);const K=()=>En(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:o,beforeFetch:l=Nn}=n;if(l(F)){I(!0);try{const t=yield r(F);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,o))&&void 0!==e?e:[];i||(T([]),yield In(0)),q(n)}}catch(e){}I(!1)}})),z=e=>{i||(w(e),h(e))},W=e=>{$(Object.assign({},F,e))},[B,U]=t.useState([]),[G,Y]=t.useState([]),[X,Q]=t.useState(""),J=t.useRef(B),ee=t.useRef([]);fi((()=>{Y(Ju(B))}),[B]);const te=()=>En(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:i="value",textKey:o="text"}=d.fetch;try{const l=yield t(n);if(200===l.code){const t=Array.isArray(l.data)?l.data:null!==(e=me(l.data,r))&&void 0!==e?e:[],n=bl(t,i,o);U(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${Dl.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${Fn("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:M,loading:N,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:F})};return t.createElement("div",{ref:g,className:De(re,u),style:p},t.createElement(Ai,{defaultValue:200,style:{height:"100%"}},t.createElement(Ai.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(_.Search,{className:"input-wrap",value:X,style:{marginBottom:8},placeholder:Bt("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=tp(J.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==ne(n).indexOf(e)}));Q(e),U(t)})(e.target.value)}),t.createElement(Z,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:G,treeData:B,filterTreeNode:e=>{if(!X)return!1;const t=e.text||"";return-1!==ne(t).indexOf(X)},onExpand:e=>{Y(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return Xt("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=me(e,t[r]);W(n)})(ep(ee.current,(n=>me(n,t)===e[0]))||{})}})),t.createElement(Ai.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},L.length?t.createElement(Fc,{ref:v,items:L,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>P(e),onCollapse:()=>j(),onFinish:e=>W(e),onReset:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||W(t)}))}):null),t.createElement("div",null,t.createElement(Zu,hn({ref:y,uniqueKey:r,height:k,columns:H,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{T(e),w(i?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>D(e),onRowDblclick:z,onRowEnter:z}))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Jl[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>h(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!S,onClick:()=>h(S,i?C:void 0)},Bt("qm.dialog.confirm"))))};np.displayName="TreeTableHelper";const rp=e=>{var n,r,i;const{multiple:o,tree:l={},defaultSelectedKeys:a,className:s,style:c,onClose:d}=e,{size:u}=t.useContext(Vt),p=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:u)&&void 0!==n?n:""}),[e.size,u]),[h,m]=t.useState(),[f]=t.useState(null===(n=l.fetch)||void 0===n?void 0:n.params),g={[`${Fn("tree-helper")}--wrapper`]:!0},v=l.fetch?Object.assign(Object.assign({},An(l.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:De(g,s),style:c},t.createElement(pd,{multiple:o,fetch:v,fieldsDefine:{valueKey:null===(r=l.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=l.fetch)||void 0===i?void 0:i.textKey},asyncLoad:l.asyncLoad,checkStrictly:l.checkStrictly,checkStrategy:l.checkStrategy,defaultSelectedKeys:a,defaultExpandAll:l.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Jl[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>d(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!h,onClick:()=>d(h)},Bt("qm.dialog.confirm"))))};rp.displayName="TreeHelper";const ip="_startSign",op="_endSign",lp=e=>{var n;const{uniqueKey:r,initialValue:i,filters:o=[],table:l={},onClose:a}=e,{size:s}=t.useContext(Vt),c=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:s)&&void 0!==n?n:""}),[e.size,s]),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=Mi(d),[m,f]=t.useState(l),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[S,w]=t.useState(o),[C,T]=t.useState((e=>[{title:Bt("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},{title:Bt("qm.form.rangeSearchHelper")[0],dataIndex:ip,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(l.columns||[]),{title:Bt("qm.form.rangeSearchHelper")[1],dataIndex:op,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[N,I]=t.useState(xe({},null===(n=l.fetch)||void 0===n?void 0:n.params,i)),[R,O]=t.useState([]),A=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),L=t.useMemo((()=>2===A.length&&A.every((e=>void 0!==e))),[A]),P=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Jl[c]-30)},_=Vi(P,5);ji((()=>{_()}),[h.width]),fi((()=>{ge(o,S)||w(o)}),[o]),t.useEffect((()=>{H()}),[N]);const H=()=>En(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=m;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:o=Nn}=n;if(o(N)){v(!0);try{const t=yield r(N);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,i))&&void 0!==e?e:[];O(n)}}catch(e){}v(!1)}})),D=(e,t)=>{delete e[t]},F=()=>{y.forEach((e=>{e&&(D(e,ip),D(e,op))})),b([])},$=e=>{F(),I(Object.assign({},N,e))},M=Fn("range-helper"),q=m.webPagination?{dataSource:R,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},m.fetch),{params:N})};return t.createElement("div",{ref:d,className:`${M}--wrapper`},t.createElement("div",{className:"form-wrap"},S.length?t.createElement(Fc,{ref:u,items:S,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>P(),onFinish:e=>$(e),onReset:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||$(t)}))}):null),t.createElement("div",null,t.createElement(Zu,hn({ref:p,height:x,columns:C,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=A[0]&&e.pageIndex<=A[1]?{backgroundColor:"#f5f5f5"}:{}},q,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[ip,op].includes(n)&&(n===ip&&(e[n]?(D(e,n),b([void 0,y[1]])):e.pageIndex>A[1]?k.warning(Bt("qm.searchHelper.rangeStartTip")):(y[0]&&D(y[0],n),e[n]="[",b([e,y[1]]))),n===op&&(e[n]?(D(e,n),b([y[0],void 0])):e.pageIndex<A[0]?k.warning(Bt("qm.searchHelper.rangeEndTip")):(y[1]&&D(y[1],n),e[n]="]",b([y[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===A[0]&&(e[ip]="["),e.pageIndex===A[1]&&(e[op]="]")}))}}),t.createElement(_n,{type:"primary",icon:t.createElement(gt,null),title:Bt("qm.table.alert.clear"),onClick:()=>F()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Jl[c]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>a(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!L,onClick:()=>a(y.map((e=>(e=>{const t={};for(const n in e)[ip,op].includes(n)||(t[n]=e[n]);return t})(e))))},Bt("qm.dialog.confirm"))))};lp.displayName="RangeTableHelper";const ap=e=>null!=e;function sp(e,n,r,i){const[o,l]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[a,s]=t.useState(null),c=Cd((()=>{if(o){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:o,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&i<=t&&o<=n})(o)&&n&&o.scrollIntoView(i);const{left:e,top:t,width:r,height:l}=o.getBoundingClientRect(),a={left:e,top:t,width:r,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(a)?a:e))}else s(null)}));t.useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[o,n,c]);return[t.useMemo((()=>{if(!a)return a;const e=(null==r?void 0:r.offset)||6,t=(null==r?void 0:r.radius)||2;return{left:a.left-e,top:a.top-e,width:a.width+2*e,height:a.height+2*e,radius:t}}),[a,r]),o]}const cp=8;const dp={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"]}},up={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"]}},pp=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function hp(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:o,visibleFirst:l}=e,a=t/2,s={};return Object.keys(dp).forEach((e=>{const c=r&&up[e]||dp[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,pp.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-a-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=a+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-a-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=a+i}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?cp:r}}({contentRadius:o,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-a;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+a;break;case"leftTop":case"rightTop":d.offset[1]=-u.arrowOffsetHorizontal-a;break;case"leftBottom":case"rightBottom":d.offset[1]=u.arrowOffsetHorizontal+a}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const i=r&&"object"==typeof r?r:{},o={};switch(e){case"top":case"bottom":o.shiftX=2*t.arrowOffsetHorizontal+n,o.shiftY=!0,o.adjustY=!0;break;case"left":case"right":o.shiftY=2*t.arrowOffsetVertical+n,o.shiftX=!0,o.adjustX=!0}const l=Object.assign(Object.assign({},o),i);return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,u,t,n),l&&(d.htmlRegion="visibleFirst")})),s}const mp={fill:"transparent",pointerEvents:"auto"},fp=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:o,style:l={},fill:a="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${Id()}`,p="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Ht,{open:s,autoLock:!0},t.createElement("div",{className:De(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},l)},o?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:p?`${n}-placeholder-animated`:""}))),t.createElement("rect",hn({},i?null:mp,{x:"0",y:"0",width:"100%",height:"100%",fill:a,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",hn({},mp,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",hn({},mp,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",hn({},mp,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",hn({},mp,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},gp=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:o,onPlay:l}=e,[a,s]=Ld(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=Cd((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=It(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!a),a?null==o||o():null==l||l())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,i=window.innerWidth,o=window.innerHeight,l=e.clientX-Ci(t).x,a=e.clientY-Ci(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-a;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>o-r-1&&(c=o-r-1),Ei(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},a?t.createElement(vt,null):t.createElement(yt,null))},vp=e=>{const{prefixCls:n,current:r,total:i=0,cover:o,title:l,description:a,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:v}=_u(),y="primary"!==c?"primary":"default",b=Cd((e=>{w(e),40===e.keyCode&&(r<i-1?null==h||h():null==m||m()),38===e.keyCode&&r>0&&(null==p||p())}));t.useEffect((()=>{const e=It(document,"keyup",b);return()=>e.remove()}),[]);const x=ap(o)?t.createElement("div",{className:`${n}-cover`},o):null,E=ap(a)?t.createElement("div",{className:`${n}-description`},a):null;let S;S=g?g(r,i):[...Array.from({length:i}).keys()].map(((e,i)=>t.createElement("span",{key:e,className:De(i===r&&`${n}-indicator-active`,`${n}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:De(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(Ue,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(J,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(bt,{className:De(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},l)),E,t.createElement("div",{className:`${n}-footer`},i>1&&t.createElement("div",{className:`${n}-indicators`},S),t.createElement(Dn,{className:`${n}-buttons`},0!==r?t.createElement(_n,{className:`${n}-prev-btn`,size:"small",onMouseDown:w,onClick:p},v("qm.tour.prevStep")):null,r===i-1?t.createElement(_n,{className:`${n}-finish-btn`,type:y,size:"small",onClick:m},v("qm.tour.finish")):t.createElement(_n,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},v("qm.tour.nextStep"))))))},yp=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(vp,e))},bp={left:"50%",top:"50%",width:1,height:1},xp=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:o,onChange:l,onClose:a,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0}=e,C=bn(e,["steps","defaultCurrent","current","onChange","onClose","onFinish","open","type","mask","arrow","control","overlayClassName","overlayStyle","placement","helper","zIndex","renderPanel","indicatorsRender","gap","animated","scrollIntoViewOptions"]),T=t.useRef(),[N,I]=Ld(0,{value:o,defaultValue:i}),[R,O]=Ld(void 0,{value:c,postState:e=>!(N<0||N>=r.length)&&(null!=e&&e)}),[k,A]=Ld(1051,{value:y,defaultValue:y}),[L,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=>A(e)})));const{target:H,type:D,placement:F,trigger:$,delay:M,style:q,arrow:j,className:V,mask:K,scrollIntoViewOptions:z,zIndex:W,action:B}=r[N]||{},U=W||k,G=D||d,Y=R&&(null!=K?K:u),X=null!=z?z:w,[Z,Q]=sp(H,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Q,g,F),ee=!!Q&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=T.current)||void 0===e||e.forceAlign()}),[te,N]),fi((()=>{R&&(ie(),null==B||B(Q,N))}),[R,Q]);const ne=e=>{I(e),null==l||l(e)},re=()=>{O(!1),null==a||a(N)},ie=()=>{if(!Q)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===xi(r=n,"display")||"hidden"===xi(r,"visibility")||"0"===xi(r,"opacity"))||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Q),e.length&&e[0].focus()};if(void 0===Q)return null;const oe=()=>En(void 0,void 0,void 0,(function*(){if(!$||!Q)return;const{left:e,top:t}=Q.getBoundingClientRect(),n=Q.offsetWidth,r=Q.offsetHeight,[i,o]=[e+n/2,t+r/2],l=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:o}),a=document.elementFromPoint(i,o);a&&(a.dispatchEvent(l),yield In(null!=M?M:320))})),le="boolean"==typeof Y?Y:!!Y,ae="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=Fn("tour"),de=[{[`${ce}-primary`]:"primary"===G},m,V],ue=hp({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(fp,{zIndex:U,prefixCls:ce,pos:Z,showMask:le,style:null==ae?void 0:ae.style,fill:null==ae?void 0:ae.color,open:L,animated:S,rootClassName:m}),t.createElement(Ht,{open:L,autoLock:!0},t.createElement(Dt,hn({ref:T},C,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:L,popupClassName:De(de),prefixCls:ce,popup:()=>t.createElement(yp,hn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>En(void 0,void 0,void 0,(function*(){yield oe(),ne(N-1)})),onNext:()=>En(void 0,void 0,void 0,(function*(){yield oe(),ne(N+1)})),onClose:re,current:N,onFinish:()=>{re(),null==s||s()}},Object.assign({},r[N],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Q||document.body,forceRender:!1,destroyPopupOnHide:!0}),t.createElement("div",{className:De(m,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Z||bp),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(Ht,{open:R},t.createElement(gp,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));xp.displayName="QmTour";const Ep=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Sp=e=>({_s:e,status:Ep[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),wp=e=>e?6:5,Cp=(e,t,n,r,i)=>{clearTimeout(r.current);const o=Sp(e);t(o),n.current=o,null==i||i({current:o})},Tp=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:o,initialEntered:a,mountOnEnter:c,unmountOnExit:d,onStateChange:u}=e||{},[m,f]=p((()=>Sp(a?2:wp(c)))),g=l(m),v=l(),[y,b]=(e=>se(e)?[e.enter,e.exit]:[e,e])(o),x=h((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return wp(t)}})(g.current._s,d);e&&Cp(e,f,g,v,u)}),[u,d]),E=h((e=>{const o=e=>{switch(Cp(e,f,g,v,u),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((()=>o(e+1)),0)}},l=g.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&o(t?r?0:1:2):l&&o(n?i?3:4:wp(d))}),[x,u,t,n,r,i,y,b,d]);return s((()=>()=>clearTimeout(v.current)),[]),[m,E,x]},Np=e=>{const{name:n,in:r,timeout:i,preEnter:o=!0,preExit:l}=e,[a,s]=Tp({timeout:i,preEnter:o,preExit:l,initialEntered:r});return ji((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?qu(e,{className:De(e.props.className,n,a.status)}):e)))};var Ip={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Rp=n(void 0);var Op=null;function kp(){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),o=e.match(/x64/i);if(!t&&!n&&o)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||o)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Ap(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(kp()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void k.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:Op?n=Op:((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),Op=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&kp(),n}catch(e){k.error("getLodop 出错:"+e)}}kp();const Lp=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)},Pp=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:o}=t.useContext(Vt),{$$preview:l}=t.useContext(Rp),{state:a,isWindowsPrinter:s,pageSize:c}=l,d=t.useRef(null),u=t.useRef({}),p=t.useRef([]),h=t.useRef([]),m=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:A,createPrintHtml:k,SHOW_PREVIEW:L,DIRECT_PRINT:P}))),fi((()=>{R()}),[a.form.printerType,a.form.setting.direction,a.form.setting.distance,a.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}}}=a,t=s?10*Ip.defaultDistance+10*Ip.defaultDistance:0;return("vertical"===e?c[0]:c[1])-t}),[a,s,c]),y=t.useMemo((()=>{const{form:{setting:{direction:e}}}=a,t=s?10*Ip.defaultDistance+10*Ip.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[a,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=a;return Lp(v-10*(e.left-Ip.defaultDistance)-10*(e.right-Ip.defaultDistance))}),[a,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=a;return Lp(y-10*(e.top-Ip.defaultDistance)-10*(e.bottom-Ip.defaultDistance))}),[a,y]),E=a.form.scale,S=t.useMemo((()=>{const{form:{setting:{distance:e}}}=a;return{left:Lp(10*e.left),right:Lp(10*e.right),top:Lp(10*e.top),bottom:Lp(10*e.bottom)}}),[a]),w=t.useMemo((()=>{const{form:{printerType:e}}=a,{left:t,right:n,top:r,bottom:i}=S,o=b+t+n,l=Ip.previewWidth-o<=0?0:(Ip.previewWidth-o)/2,s=Math.abs((1-E)*o/2);let c=0;return E>1&&(c=s>l?-1*l:-1*s),E<1&&(c=o-2*s>Ip.previewWidth?0:l>0?s:(Ip.previewWidth-(o-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}}),[a,f,S,E,x,b]);p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const C=()=>{var e,t,n,r;const i=null!==(t=null===(e=null==o?void 0:o.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",l=null!==(r=null===(n=null==o?void 0:o.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Ip.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;">',l?`<img src="${l}" border="0" height="46" />`:"","</td>","</tr>"].join("")},T=()=>{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},N=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=T().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,p.current=t},R=()=>{var e;if(!p.current.length)return;const{form:{setting:t,printerType:n}}=a;if(i)return m.current.push([T(),C(),...p.current]);const r=t.fixedLogo?x-Ip.logoHeight:x;let o=[];if(m.current=[],"stylus"===n)m.current.push([T(),...t.fixedLogo?[C()]:[],...p.current]);else{let e=0;for(let n=0,i=h.current.length;n<i;n++){const l=p.current[n],a=h.current[n];t.fixedLogo||0!==n||(e+=Ip.logoHeight),e+=a,e<=r?o.push(l):(m.current.push([T(),...t.fixedLogo?[C()]:[],...o]),o=[],e=0,n-=1),n===i-1&&o.length&&m.current.push([T(),...t.fixedLogo?[C()]:[],...o])}}t.fixedLogo||null===(e=m.current[0])||void 0===e||e.splice(1,0,C());for(let e=0,t=m.current.length;e<t&&e!==t-1;e++)m.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');l.setState({currentPage:1,totalPage:m.current.length}),O()},O=()=>{var e,t;const{currentPage:n}=a;let r=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;r+=null!==(t=null===(e=m.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+=[...m.current[e-1]].join("")}else for(let e=0;e<m.current.length;e++)t+=m.current[e].join("");return t+="</table>",t},A=()=>{const e=[];for(let t=0;t<p.current.length;t++)e[t]=p.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+C()+T()+e.join("")+"</table>"},L=()=>En(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||(N(),yield In(0),I(),R(),g(!1))})),P=()=>En(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();N(),yield In(0),I(),R(),g(!1),l.doPrint(k()),yield In(0),l.doClose()})),_=()=>{Xt("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},H={[Fn("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:De(H)},t.createElement(_i,{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:w}))))}));Pp.displayName="Container";class _p extends r{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:Bt("qm.print.setPanel.printParameter")},{type:"SELECT",label:Bt("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:Bt("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:Bt("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:Bt("qm.print.setPanel.vertical"),value:"vertical"},{text:Bt("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:Bt("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:Bt("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:Bt("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:Bt("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Ip.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Ip.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Ip.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Ip.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("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:Bt("qm.print.setPanel.sizeUnit"),disright:Bt("qm.print.setPanel.sizeUnit"),distop:Bt("qm.print.setPanel.sizeUnit"),disbottom:Bt("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>En(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(Fc,{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(_n,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},Bt("qm.dialog.close")),t.createElement(_n,{type:"primary",onClick:()=>this.confirmHandle()},Bt("qm.dialog.confirm"))))}}_p.contextType=Vt;class Hp extends r{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:Ip.defaultDistance,right:Ip.defaultDistance,top:Ip.defaultDistance,bottom:Ip.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=()=>En(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 Mt.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=>En(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)=>En(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=Ap();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i,printerName:o,printerType:l,copies:a}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Ip,{left:d,right:u,top:p,bottom:h}=i.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(o),t.SET_PRINT_COPIES(a),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"===l&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():k.error(Bt("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=Ap();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():k.error(Bt("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(`${g().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:Bt("qm.print.laserPrinter"),value:"laser"},{text:Bt("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Ap(),t=[{text:Bt("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){Xt("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 En(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Mt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),se(n)&&(yield Mt.setItem(this.printerKey,n))),se(n)&&Object.keys(n).length&&xe(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:o,totalPage:l,printPage:a}=this.state,s=Fn("print-preview"),c={visible:r,title:Bt("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:De(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,Bt("qm.print.printer"),":",t.createElement($,{value:i.printerName,onChange:e=>{this.setState((t=>xe({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,Bt("qm.print.type"),":",t.createElement($,{value:i.printerType,onChange:e=>{this.setState((t=>xe({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,Bt("qm.print.copies"),":",t.createElement(j,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>xe({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,Bt("qm.print.printPage.0"),t.createElement(j,{value:a,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),Bt("qm.print.printPage.1")),t.createElement("span",null,t.createElement(ee,{size:"small",current:o,pageSize:1,total:l,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(_n,{type:"text",icon:t.createElement(it,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},Bt("qm.print.setting"))),t.createElement("span",null,t.createElement(_n,{type:"text",icon:t.createElement(qe,null),className:"text-btn",onClick:()=>this.exportClickHandle()},Bt("qm.print.export"))),t.createElement("span",null,t.createElement(_n,{icon:t.createElement(nt,null),type:"primary",onClick:this.printClickHandle},Bt("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Rp.Provider,{value:this.provide},t.createElement(Pp,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,Bt("qm.print.scale"),":",t.createElement(te,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>xe({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,Bt("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,Bt("qm.print.pageNumber"),":",Bt("qm.print.pagination",{currentPage:o,totalPage:l}))))),t.createElement(lo,c,t.createElement(_p,{setting:i.setting,onChange:e=>{this.setState((t=>xe({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Rp.Provider,{value:this.provide},t.createElement(Pp,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Hp.contextType=Vt;class Dp extends r{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>En(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:o,closeAfterPrint:l}=this.props,a={visible:e,title:Bt("qm.print.preview"),width:`${Ip.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:i,preview:o,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return o?t.createElement(lo,a,t.createElement(Hp,s)):e?t.createElement(Hp,s):null},this.DO_PRINT=()=>En(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield In(0),this.setState({visible:!0}),yield In(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:o,shape:l}=this.props,a={size:n||this.context.size||"",type:i,shape:l,icon:r,loading:e,disabled:o,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(_n,a,this.props.children),this.createRender())}}function Fp(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function $p(e){const t=Fp(e);return t?t.frameElement:null}function Mp(e){const t=Vp(e);return qp([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function qp(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 jp(e,t){const n=$p(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,o=!1;for(;i;){const e=Mp(i);if(r.push(e),i=$p(i),o)break;i&&Fp(i)===t&&(o=!0)}return qp(r)}return e.getBoundingClientRect()}function Vp(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)}}Dp.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:f.elementType},Dp.defaultProps={preview:!0,type:"primary",icon:t.createElement(nt,null)},Dp.contextType=Vt;const Kp=Object.assign;class zp{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=Gp.border,this.padding.style.borderColor=Gp.padding,this.content.style.backgroundColor=Gp.background,Kp(this.node.style,{borderColor:Gp.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){Up(t,"margin",this.node),Up(t,"border",this.border),Up(t,"padding",this.padding),Kp(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"}),Kp(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Wp{constructor(e,t){this.tip=e.createElement("div"),Kp(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),Kp(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),Kp(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),o=5;let l;l=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+o:e.top+e.height+o:e.top-r<=t.top+t.height?e.top-r-o<t.top+o?t.top+o:e.top-r-o:t.top+t.height-r-o;let a=e.left+o;e.left<t.left&&(a=t.left+o);e.left+i>t.left+t.width&&(a=t.left+t.width-i-o);return l+="px",a+="px",{style:{top:l,left:a}}}(e,t,{width:n.width,height:n.height});Kp(this.tip.style,r.style)}}class Bp{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 Wp(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 zp(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=jp(e,this.window),i=Vp(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=jp(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 Up(e,t,n){Kp(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 Gp={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 Yp=null,Xp=null;function Zp(){null!=window.document&&(Yp=null,null!==Xp&&(Xp.remove(),Xp=null))}class Qp{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=>Ni(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Zp();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!==Yp&&clearTimeout(Yp),null!=n&&(null===Xp&&(Xp=new Bp),Xp.inspect(n,r),i&&(Yp=setTimeout((()=>Zp()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=pe((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(){Zp(),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 Jp(e){return document.querySelector(e)}const eh=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:o}=e,{t:l}=_u();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t.createElement(Dn,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(_n,{size:"small",onClick:()=>null==i?void 0:i()},l("qm.guideTracker.closeButton")),t.createElement(_n,{size:"small",onClick:()=>null==r?void 0:r()},l("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(_n,{size:"small",onClick:()=>null==o?void 0:o()},l("qm.guideTracker.finishButton"))))},th={left:"50%",top:"50%",width:1,height:1},nh=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:o,steps:l=[],placement:a="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=_u(),E=t.useRef(),S=t.useRef(l.length),[w,C]=Ld(0,{value:i,defaultValue:o}),[N,I]=Ld(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=Ld(1051,{value:h,defaultValue:h}),[k,A]=t.useState({}),[L,P]=t.useState(!1),[_,H]=t.useState(N),[D,F]=t.useState(!1),[$,M]=sp(k.node,!!r),[j,V]=t.useState(22),K=t.useRef(!1),z=t.useMemo((()=>w>=l.length?"add":"edit"),[w,l]),W=t.useMemo((()=>`${w+1} / ${l.length}`),[w,l]);t.useLayoutEffect((()=>{E.current=new Qp({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),A({id:Wo(),node:e,path:t}),C(S.current),P(!0),U(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(N?B():U(),N?setTimeout((()=>H(!0)),16):H(!1),()=>{U()})),[N]),t.useEffect((()=>{S.current=l.length}),[l]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},G=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:w,selector:k.path})})));const Y=Fn("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Z=hp({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Ht,{open:N&&L,autoLock:!0},t.createElement(Dt,{zIndex:R,builtinPlacements:Z,popupPlacement:a,popupVisible:N&&L,popupClassName:De(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{P(!1),B()};return t.createElement("div",{className:`${Y}-content`},t.createElement("div",{className:`${Y}-inner`},t.createElement(Ue,{className:`${Y}-close`,onClick:()=>{null==y||y(w),e()}}),t.createElement(q,{open:D,trigger:["click"],dropdownRender:()=>l.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement($t,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),n=l.map((e=>e.id));if(ge(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:w;C(i),null==v||v(tl(e),i)}},l.map(((e,n)=>t.createElement("li",{key:n,className:De("item",{actived:e.id===k.id})},t.createElement(Ke,{className:"handle",title:x("qm.form.draggable")}),t.createElement("span",{className:"box"},t.createElement("span",{className:"title",title:e.title,onClick:()=>{n!==w&&(A({id:e.id,node:Jp(e.selector),path:e.selector}),C(n),V(22===j?j+1:j-1),null==v||v(l,n))}},e.title),t.createElement(T,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=l.filter((t=>t.id!==e.id)),r=n===w;let i=n<=w?w-1:w;if(i=i<0?0:i,i=i>t.length?t.length:i,r&&t[i]){const{id:e,selector:n}=t[i];A({id:e,node:Jp(n),path:n})}C(i),null==v||v(t,i)}},t.createElement(Ue,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>F(e)},t.createElement(xt,{className:De(`${Y}-close`,"menu-icon"),style:{width:j}})),m.content&&t.createElement(J,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:m.content,title:m.title},t.createElement(bt,{className:De(`${Y}-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"),W)),p?p({id:k.id,selector:k.path,actionStatus:z,DO_CLOSE:e},w):t.createElement(eh,{action:z,onConfirm:()=>{null==v||v("add"===z?[...l,{id:k.id,selector:k.path,title:"Guide Title"}]:[...l],w),e()},onCancel:()=>{null==y||y(w),e()},onFinish:()=>{e(),null==y||y(w),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:De(`${Y}-target-placeholder`),style:Object.assign(Object.assign({},$||th),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:G,onClick:G}))),s&&t.createElement(Ht,{open:_},t.createElement(gp,{zIndex:R,prefixCls:Y,onPause:()=>{K.current=L,P(!1),U()},onPlay:()=>{K.current?P(!0):B()}})))}));nh.displayName="QmGuideTracker";const rh=n=>{var r,i,o,l,a,s,c,d;const{content:u,image:p,width:h,height:m,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:S,className:w,style:C}=n,T=t.useRef(null),N=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!==(o=f.fontStyle)&&void 0!==o?o:"normal",k=null!==(l=f.fontFamily)&&void 0!==l?l:"sans-serif",A=null!==(a=f.color)&&void 0!==a?a:"rgba(0, 0, 0, 0.15)",L=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],H=g[1],D=_/2,F=H/2,$=null!==(c=v[0])&&void 0!==c?c:D,M=null!==(d=v[1])&&void 0!==d?d:F,q=t.useMemo((()=>{const e=$-D,t=M-F;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,F,$,M,b]),j=(e,t)=>{var n;if(T.current){const r=N.current.get(T.current);r&&(T.current.contains(r)&&T.current.removeChild(r),N.current.delete(T.current));const i=document.createElement("div");i.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,n]=e;return`${r=t,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${n}`;var r})).join(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=T.current)||void 0===n||n.append(i),N.current.set(T.current,i)}},V=()=>{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(!p&&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!=m?m:n]})(t),o=r*n,l=i*n,a=(_+r)*n,s=(H+i)*n,c=_/2*n,d=H/2*n,u=a/2,f=s/2,g=2*(_+r);e.width=2*a,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,a,s,a,s,a,s),S&&(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=A,t.textAlign=L,t.textBaseline="top",t.translate(o/2,0),P.forEach(((r,i)=>{t.fillText(null!=r?r:"",c,d+i*(e+3*n))})),v()};if(p){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,o,l),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=p}else b()},K=e=>Array.from(N.current.values()).includes(e);t.useEffect((()=>{V()}),[u,p,h,m,f,g,v,y,b,x,E,S]),function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=window&&"MutationObserver"in window,o=e.useRef(),l=()=>{o.current&&(o.current.disconnect(),o.current=void 0)};e.useLayoutEffect((()=>(l(),i&&t.current&&(o.current=new MutationObserver(n),o.current.observe(t.current,r)),()=>l())),[t])}(T,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>K(e))),n="attributes"===t.type&&K(t.target);if(e||n){V();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=Fn("watermark");return t.createElement("div",{ref:T,className:De(z,w),style:Object.assign({position:"relative"},C)},n.children)},ih=new Map,oh=new WeakMap;let lh,ah=0;function sh(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(oh.has(n)||(ah+=1,oh.set(n,ah.toString())),oh.get(n)):"0"):e[t]}`;var n})).toString()}function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:lh;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:o,elements:l}=function(e){const t=sh(e);let n=ih.get(t);if(!n){const r=new Map;let i=[];const o=new IntersectionObserver((t=>{t.forEach((t=>{var n;const o=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=o),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(o,t)}))}))}),e);i=o.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:o,elements:r},ih.set(t,n)}return n}(n),a=l.get(e)||[];return l.has(e)||l.set(e,a),a.push(t),o.observe(e),function(){a.splice(a.indexOf(t),1),0===a.length&&(l.delete(e),o.unobserve(e)),0===l.size&&(o.disconnect(),ih.delete(i))}}const dh=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:o,className:l,style:a}=e,{ref:s,inView:c,entry:d}=function(){let{root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:o,trackVisibility:l,skip:a,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var d;const[u,p]=t.useState(null),[h,m]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(a||!u)return;let t;return t=ch(u,((e,n)=>{var r;m({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:l,delay:s},o),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,a,l,o,s]);const g=null===(d=h.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||i||a||v.current===g||(v.current=g,m({inView:!1,entry:void 0}));const y=[p,h.inView,h.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y}(Object.assign({},e,{triggerOnce:!o}));t.useEffect((()=>{r||Xt("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[Fn("lazy-load")]:!0};return t.createElement("div",{ref:s,className:De(u,l),style:a},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},i))};class uh{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 ph{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 ph(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,o=t.x-n.x,l=t.y-n.y,a=(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),p=Math.sqrt(o*o+l*l),h=p/(u+p),m=c+(a-c)*h,f=d+(s-d)*h,g=t.x-m,v=t.y-f;return{c1:new uh(a+g,s+v),c2:new uh(c+g,d+v)}}constructor(e,t,n,r,i,o){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=o}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,o=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=o-e,i=l-t;n+=Math.sqrt(r*r+i*i)}e=o,t=l}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 hh{constructor(e,t){var n=this;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=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!n._drawingStroke)return;if(0===n._data.length)return void n._strokeBegin(e);const r=n._createPoint(e.x,e.y,e.pressure),i=n._data[n._data.length-1],o=i.points,l=o.length>0&&o[o.length-1],a=!!l&&r.distanceTo(l)<=n.minDistance,s=n._getPointGroupOptions(i);if(!l||!l||!a){const e=n._addPoint(r,s);t&&(l?e&&n._drawCurve(e,s):n._drawDot(r,s)),o.push({time:r.time,x:r.x,y:r.y,pressure:r.pressure})}},this._strokeEnd=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n._drawingStroke&&(t&&n._strokeUpdate(e),n._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 o=n/i,l=o*o,a=l*o,s=1-o,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*o*e.control1.x,u+=3*s*l*e.control2.x,u+=a*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*o*e.control1.y,p+=3*s*l*e.control2.y,p+=a*e.endPoint.y;const h=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,p,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 uh(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=ph.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),o={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,o},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)),o=Math.min(r,t),l=Math.min(i,n),a=.5*(Math.max(r,t)-o),s=.5*(Math.max(i,n)-l),c=o+a,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,a,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)),o=180*Math.atan2(n-i,t-r)/Math.PI,l=(o+25)*Math.PI/180,a=(o-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(a),u=15*Math.sin(a);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 p=r+s,h=i+c;this.ctx.lineTo(p,h);const m=r+d,f=i+u;this.ctx.lineTo(m,f),this.ctx.lineTo(r,i),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,i=e.data,o=[];return o[0]=i[4*(n*r+t)],o[1]=i[4*(n*r+t)+1],o[2]=i[4*(n*r+t)+2],o[3]=i[4*(n*r+t)+3],o},this.setAxisColor=(e,t,n,r)=>{const i=e.width,o=e.data;o[4*(n*i+t)]=r[0],o[4*(n*i+t)+1]=r[1],o[4*(n*i+t)+2]=r[2],o[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,o=r.height,l=i/this.degreeOfBlur,a=o/this.degreeOfBlur;for(let e=0;e<a;e++)for(let t=0;t<l;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 o=0;o<this.degreeOfBlur;o++)this.setAxisColor(r,t*this.degreeOfBlur+o,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,o=e.target.innerText,l=[];let a="";for(let e=0;e<o.length;e++){const t=a+o[e];this.ctx.measureText(t).width>i&&a.length>0?(l.push(a),a=o[e]):a=t}l.push(a),l.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,this.backgroundColor?(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)):1!==this.ratio&&t.scale(this.ratio,this.ratio),e.toDataURL()===this.canvas.toDataURL()},this.toDataURL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n.canvas.width===n.width)return n.canvas.toDataURL(e,t);const r=document.createElement("canvas");r.width=n.width,r.height=n.height;return r.getContext("2d").drawImage(n.canvas,0,0,r.width,r.height),r.toDataURL(e,t)},this.getPNG=()=>this.toDataURL(),this.getJPG=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;return n.toDataURL("image/jpeg",e)},this.initial(e,t)}initial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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.backgroundColor=t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this._strokeMoveUpdate=this.throttle?function(e){let t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,o=0,l=null;const a=()=>{o=Date.now(),l=null,t=e.apply(n,r),l||(n=null,r=[])};return function(){const s=Date.now(),c=i-(s-o);n=this;for(var d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];return r=u,c<=0||c>i?(l&&(clearTimeout(l),l=null),o=s,t=e.apply(n,r),l||(n=null,r=[])):l||(l=window.setTimeout(a,c)),t}}(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)}}hh.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),i=r.length,o=new Uint8Array(i);for(let e=0;e<i;++e)o[e]=r.charCodeAt(e);return new Blob([o],{type:n})},hh.canvasToDataURL=e=>e.toDataURL("image/png",1),hh.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const mh=()=>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"})),fh=()=>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"})),gh=()=>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"})),vh=()=>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"})),yh=()=>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"})),bh=t.forwardRef(((e,n)=>{const{open:r,width:i,height:o,imageName:l,penColor:a,minWidth:s,maxWidth:c,backgroundColor:d,className:u,style:p,onOk:h,onCancel:m}=e,{t:f}=_u(),v=t.useRef(),y=t.useRef(null),b=t.useRef(null),x=t.useRef(null),E=[2,4,6],S=[14,16,18,20,24,28],w=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[C,T]=Ld(void 0,{value:r,postState:e=>null!=e&&e}),N=t.useMemo((()=>!!e.children),[e.children]),[I,R]=t.useState(N?"square":"line"),[O,k]=t.useState(E[0]),[A,L]=t.useState(N?w[0]:w[4]),[P,_]=t.useState(S[1]),[H,D]=t.useState("bottomLeft"),[F,M]=t.useState(!1),[j,V]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=i?i:null===(e=b.current)||void 0===e?void 0:e.offsetWidth,height:null!=o?o:null===(t=b.current)||void 0===t?void 0:t.offsetHeight,maxWidth:O,mode:I,penColor:A,fontSize:P,backgroundColor:d,openSmooth:!N};return n.openSmooth&&Object.assign(n,{penColor:a,minWidth:s,maxWidth:c}),v.current=new hh(y.current,n),()=>v.current.destroy()}),[]);const K=e=>{var t,n;const[r,l]=[null!=i?i:null===(t=b.current)||void 0===t?void 0:t.offsetWidth,null!=o?o:null===(n=b.current)||void 0===n?void 0:n.offsetHeight],{width:a,height:s}=v.current;let c=!1;r&&r!==a&&(v.current.width=r,c=!0),l&&l!==s&&(v.current.height=l,c=!0),(c||e)&&v.current.update()};fi((()=>{N&&C&&K()}),[C,N]),fi((()=>{v.current.setDrawMode(I)}),[I]),fi((()=>{v.current.setLineWidth(O)}),[O]),fi((()=>{v.current.setPenColor(A)}),[A]),fi((()=>{v.current.setFontSize(P)}),[P]);const z=()=>En(void 0,void 0,void 0,(function*(){const e=N?b.current.parentNode:y.current;if(e)try{const t=yield Ft(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===x.current||e.classList.contains("spinning")});return hh.canvasToDataURL(t)}catch(e){Xt("Signature","生成合成图片失败!")}})),W=()=>{v.current.clear(),null==m||m()};t.useImperativeHandle(n,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>v.current.clear(),IS_EMPTY:()=>v.current.isEmpty(),UPDATE:K,GET_DATE_URL:z})));const B=e=>{e&&D((()=>{const e=x.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},U=e=>t.createElement("div",{className:De("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},E.map((e=>t.createElement("span",{key:e,className:De("dot",`s${e}`,{active:e===O}),onClick:()=>k(e)})))):t.createElement("div",{className:"fontSize"},t.createElement($,{size:"small",value:P,options:S.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},w.map((e=>t.createElement("span",{key:e,className:De("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>L(e)},t.createElement(Be,{className:"icon"})))))),G=Fn("signature"),Y={[G]:!0,"is-annotation":N},X=i?Object.assign(Object.assign({},p),{width:i}):p;return t.createElement("div",{className:De(Y,u),style:X},N&&t.createElement(t.Fragment,null,t.createElement("div",{ref:b,className:"content"},e.children),j&&t.createElement(_i,{spinning:!0,className:"spinning"})),t.createElement("div",{className:De("signature",{show:C})},t.createElement("canvas",{ref:y,className:I}),N&&t.createElement("div",{ref:x,className:"signature__tool-bar"},t.createElement("div",{className:"wrapper"},t.createElement("div",{className:De("actions",{hidden:F})},t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("square")},t.createElement(Et,null))),t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("round")},t.createElement(mh,null))),t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("arrow")},t.createElement(gh,null))),t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("line")},t.createElement(St,null))),t.createElement(q,{dropdownRender:()=>U("text"),overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("text")},t.createElement(fh,null))),t.createElement("button",{className:"btn",onClick:()=>En(void 0,void 0,void 0,(function*(){yield En(void 0,void 0,void 0,(function*(){V(!0);const e=yield z();if(e){const t=l?l.slice(0,l.lastIndexOf(".")>0?l.lastIndexOf("."):void 0):g().format(Ed);Gi(hh.dataURLToBlob(e),`${t}.png`)}V(!1)})),W()}))},t.createElement(qe,null)),t.createElement("button",{className:"btn",onClick:()=>R("eraser")},t.createElement(vh,null)),t.createElement("button",{className:"btn",onClick:()=>v.current.undo()},t.createElement(yh,null)),t.createElement("button",{className:"btn",onClick:()=>v.current.clear()},t.createElement(gt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==m?void 0:m()},t.createElement(Ue,null)),t.createElement("button",{className:"btn",onClick:()=>En(void 0,void 0,void 0,(function*(){V(!0),yield In(10);const e=yield z();V(!1),W(),null==h||h(e)}))},t.createElement(Be,null))),t.createElement("button",{className:"btn btn-fold",title:f(F?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!F)},F?t.createElement(Ct,null):t.createElement(wt,null))))))}));bh.displayName="QmSignature";const xh="1.9.26";export{un as Calendar,pn as DatePicker,eo as DcpAnchor,_n as DcpButton,hi as DcpCollapse,yn as DcpConfigProvider,ju as DcpCopyToClipboard,Li as DcpCountup,td as DcpCropper,$n as DcpDivider,Zi as DcpDownload,ro as DcpDrawer,Pi as DcpEmpty,Fc as DcpForm,nh as DcpGuideTracker,dh as DcpLazyLoad,lo as DcpModal,Dp as DcpPrint,lp as DcpRangeTableHelper,Ui as DcpScrollbar,Qu as DcpSearchHelper,pd as DcpSearchTree,bh as DcpSignature,Dn as DcpSpace,_i as DcpSpin,Ai as DcpSplit,Zu as DcpTable,no as DcpTabs,ed as DcpTinymce,xp as DcpTour,Np as DcpTransition,rp as DcpTreeHelper,np as DcpTreeTableHelper,Xi as DcpUploadFile,rd as DcpUploadImg,rh as DcpWatermark,eo as QmAnchor,_n as QmButton,hi as QmCollapse,yn as QmConfigProvider,ju as QmCopyToClipboard,Li as QmCountup,td as QmCropper,$n as QmDivider,Zi as QmDownload,ro as QmDrawer,Pi as QmEmpty,Fc as QmForm,nh as QmGuideTracker,dh as QmLazyLoad,lo as QmModal,Dp as QmPrint,lp as QmRangeTableHelper,Ui as QmScrollbar,Qu as QmSearchHelper,pd as QmSearchTree,bh as QmSignature,Dn as QmSpace,_i as QmSpin,Ai as QmSplit,Zu as QmTable,no as QmTabs,ed as QmTinymce,xp as QmTour,Np as QmTransition,rp as QmTreeHelper,np as QmTreeTableHelper,Xi as QmUploadFile,rd as QmUploadImg,rh as QmWatermark,mn as TimePicker,Dl as pinyin,xh as version};
|
|
1
|
+
import*as e from"react";import t,{createContext as n,Component as r,version as i,isValidElement as l,useRef as o,useLayoutEffect as a,useEffect as s,createRef as c,forwardRef as d,useImperativeHandle as u,useState as p,useCallback as h}from"react";import*as m from"prop-types";import f from"prop-types";import g from"dayjs";import"dayjs/locale/zh-cn";import v from"dayjs/plugin/localeData";import y from"dayjs/plugin/advancedFormat";import b from"dayjs/plugin/customParseFormat";import x from"dayjs/plugin/quarterOfYear";import E from"dayjs/plugin/weekOfYear";import S from"dayjs/plugin/weekday";import{ConfigProvider as w,Button as C,Popconfirm as T,Space as N,Empty as I,Spin as R,Upload as O,message as k,Tabs as A,Drawer as L,Modal as P,Input as _,Form as H,Row as F,Col as D,Select as $,Checkbox as M,Dropdown as q,InputNumber as j,Rate as V,Radio as K,Switch as z,Tag as W,TreeSelect as B,Cascader as U,notification as G,Tooltip as Y,Image as X,Tree as Z,Menu as Q,Popover as J,Pagination as ee,Slider as te}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 ne from"dayjs/plugin/weekYear";import re from"antd/es/calendar/generateCalendar";import"antd/es/calendar/style";import ie from"antd/es/date-picker/generatePicker";import"antd/es/date-picker/style/index";import le from"antd/es/locale/zh_CN";import oe from"antd/es/locale/en_GB";import{isArray as ae,isPlainObject as se,isNumber as ce,isFunction as de,isString as ue,throttle as pe,isUndefined as he,get as me,transform as fe,isEqual as ge,set as ve,xor as ye,isRegExp as be,merge as xe,uniqBy as Ee,intersection as Se,debounce as we,map as Ce,groupBy as Te,flatten as Ne,spread as Ie,mergeWith as Re,isDate as Oe,omitBy as ke,sumBy as Ae,maxBy as Le,minBy as Pe,union as _e,pickBy as He}from"lodash-es";import Fe from"classnames";import{UpOutlined as De,DownOutlined as $e,UploadOutlined as Me,DownloadOutlined as qe,FullscreenExitOutlined as je,FullscreenOutlined as Ve,HolderOutlined as Ke,UnorderedListOutlined as ze,SearchOutlined as We,CheckOutlined as Be,CloseOutlined as Ue,ExclamationCircleOutlined as Ge,ReloadOutlined as Ye,ZoomInOutlined as Xe,ZoomOutOutlined as Ze,RotateRightOutlined as Qe,RotateLeftOutlined as Je,InboxOutlined as et,InfoCircleFilled as tt,PrinterOutlined as nt,ImportOutlined as rt,SettingOutlined as it,CopyOutlined as lt,CheckSquareOutlined as ot,CloseCircleOutlined as at,MonitorOutlined as st,PlusOutlined as ct,PieChartOutlined as dt,FunnelPlotOutlined as ut,AppstoreAddOutlined as pt,StepBackwardOutlined as ht,StepForwardOutlined as mt,InfoCircleOutlined as ft,ClearOutlined as gt,PauseOutlined as vt,CaretRightOutlined as yt,QuestionCircleOutlined as bt,MenuOutlined as xt,BorderOutlined as Et,EditOutlined as St,RightOutlined as wt,LeftOutlined as Ct}from"@ant-design/icons";import Tt from"react-countup";import Nt from"resize-observer-polyfill";import It from"add-dom-event-listener";import Rt from"scroll-into-view-if-needed";import Ot from"react-draggable";import kt from"memoize-one";import At from"cropperjs";import Lt from"big.js";import Pt from"react-dom";import _t from"copy-to-clipboard";import Ht from"@rc-component/portal";import Ft from"@rc-component/trigger";import Dt from"html2canvas";import{ReactSortable as $t}from"react-sortablejs";import Mt from"localforage";import qt from"exceljs";import jt from"china-area-data";const Vt=n({locale:"zh-cn",size:"middle"});var Kt={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},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:"删除文件"},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},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},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:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};let zt=Kt;function Wt(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const Bt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const[r,i]=t;let l;const o=r.split(".");let a=zt;for(let e=0,t=o.length;e<t;e++){if(l=a[o[e]],e===t-1)return Wt(l,i);if(!l)return"";a=l}return""},Ut=e=>{zt=e||zt,zt.name&&g.locale(zt.name)};class Gt extends Error{constructor(e){super(e),this.name="QmDesignError"}}function Yt(e,t){throw new Gt(`[${e}] ${t}`)}function Xt(e,t){console.warn(new Gt(`[${e}] ${t}`))}const Zt=e=>"number"==typeof e||void 0===e||(["px","rem","em","vw","vh","%"].some((t=>e.endsWith(t)))||e.startsWith("calc")),Qt=e=>["","small","middle","large"].includes(e);g.extend(v),g.extend(y),g.extend(b),g.extend(x),g.extend(E),g.extend(S);var Jt={},en=[];function tn(e,t){if(!e&&void 0!==console){var n=en.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function nn(e,t){if(!e&&void 0!==console){var n=en.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function rn(e,t,n){t||Jt[n]||(e(!1,n),Jt[n]=!0)}function ln(e,t){rn(tn,e,t)}function on(e,t){rn(nn,e,t)}ln.preMessage=function(e){en.push(e)},ln.resetWarned=function(){Jt={}},ln.noteOnce=on,g.extend(b),g.extend(y),g.extend(S),g.extend(v),g.extend(E),g.extend(ne),g.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 an={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"},sn=function(e){return an[e]||e.split("_")[0]},cn=function(){on(!1,"Not match any format. Please help to fire a issue about this.")},dn={getNow:function(){return g()},getFixedDate:function(e){return g(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 g().locale(sn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(sn(e)).weekday(0)},getWeek:function(e,t){return t.locale(sn(e)).week()},getShortWeekDays:function(e){return g().locale(sn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return g().locale(sn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(sn(e)).format(n)},parse:function(e,t,n){for(var r=sn(e),i=0;i<n.length;i+=1){var l=n[i],o=t;if(l.includes("wo")||l.includes("Wo")){for(var a=o.split("-")[0],s=o.split("-")[1],c=g(a,"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 cn(),null}var p=g(o,l).locale(r);if(p.isValid())return p}return t&&cn(),null}}};const un=re(dn),pn=ie(dn);function hn(){return hn=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},hn.apply(this,arguments)}const mn=e.forwardRef(((t,n)=>e.createElement(pn,hn({},t,{picker:"time",mode:void 0,ref:n}))));mn.displayName="TimePicker";const fn=e.forwardRef(((t,n)=>e.createElement(pn.RangePicker,hn({},t,{picker:"time",mode:void 0,ref:n}))));fn.displayName="RangePicker",mn.RangePicker=fn;var gn={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},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"},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:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},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",likeText:"fuzzy matching",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?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}};const vn={[gn.name]:{qm:gn,antd:oe},[Kt.name]:{qm:Kt,antd:le}};class yn extends r{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},Ut(Object.assign({},vn,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:n,size:r}=t.value,{locale:i,size:l,global:o}=e;return i!==n&&Ut(Object.assign({},vn,o.langPackage)[i].qm),i!==n||l!==r?{value:Object.assign({},t.value,{locale:i,size:l})}:null}render(){const{global:e}=this.props,{value:n}=this.state,r=Object.assign({},vn,e.langPackage);return t.createElement(Vt.Provider,{value:n},t.createElement(w,{locale:r[n.locale].antd,componentSize:n.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}function bn(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 xn(e,t,n,r){var i,l=arguments.length,o=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(l<3?i(o):l>3?i(t,n,o):i(t,n))||o);return l>3&&o&&Object.defineProperty(t,n,o),o}function En(e,t,n,r){return new(n||(n=Promise))((function(i,l){function o(e){try{s(r.next(e))}catch(e){l(e)}}function a(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(o,a)}s((r=r.apply(e,t||[])).next())}))}yn.propTypes={locale:f.string,size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Divider","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},theme:f.string,global:f.object},yn.defaultProps={locale:"zh-cn",size:"middle",global:{}};var Sn="undefined"==typeof window;const wn=e=>t.isValidElement(e),Cn=e=>wn(e)&&e.type===t.Fragment,Tn=()=>{},Nn=()=>!0,In=e=>En(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Rn=e=>{Promise.resolve().then(e)},On=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),kn=e=>!!(!e&&0!==e||ae(e)&&!e.length||se(e)&&!Object.keys(e).length),An=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Ln=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(se(e)||ae(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]=Ln(e[l],t)})),r}return e},Pn=e=>ce(e)?`${e}px`:e.toString();class _n extends r{constructor(){super(...arguments),this.state={isLoading:!1},this.clickHandle=e=>En(this,void 0,void 0,(function*(){var t,n;this.setState({isLoading:!0});try{yield null===(n=(t=this.props).click)||void 0===n?void 0:n.call(t,e)}catch(e){Xt("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:n,authConfig:r,click:i,confirm:l}=this.props,{isLoading:o}=this.state,a=e||this.context.size||"",s=de(i)?{onClick:this.clickHandle}:null,c=Object.assign(Object.assign(Object.assign({},An(this.props,["authConfig","click","confirm"])),{size:a,loading:o||n||!1}),s);if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(c.disabled=!0)}return l?t.createElement(T,{title:l.title||Bt("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{var t,n;null===(t=l.onConfirm)||void 0===t||t.call(l),null===(n=c.onClick)||void 0===n||n.call(c,e)},onCancel:e=>{var t;null===(t=l.onCancel)||void 0===t||t.call(l,e)}},t.createElement(C,hn({},c,{onClick:Tn}),this.props.children)):t.createElement(C,c,this.props.children)}}var Hn;_n.propTypes={click:f.func,confirm:f.shape({title:f.node,onConfirm:f.func,onCancel:f.func})},_n.contextType=Vt,function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(Hn||(Hn={}));class Fn extends r{render(){const{size:e}=this.props,n=e||this.context.size||"",r=ce(e)?e:Hn[e||n||"default"],i=Object.assign(Object.assign({},this.props),{size:r});return t.createElement(N,i,this.props.children)}}Fn.contextType=Vt;const Dn=e=>`qm-${e}`;class $n extends r{constructor(){super(...arguments),this.clickHandle=()=>{const{collapse:e,onCollapseChange:t=Tn}=this.props;t(!e)}}render(){const{size:e,label:n,extra:r,collapse:i,bordered:l,disabled:o,id:a,className:s,style:c}=this.props,d=e||this.context.size||"",u=Dn("divider"),p={[u]:!0,[`${u}-borderless`]:!l,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return t.createElement("div",{id:a,className:Fe(p,s),style:c},t.createElement("span",{className:Fe(`${u}__title`)},n),t.createElement("div",{className:Fe(`${u}__extra`)},r),void 0!==i&&t.createElement(C,{type:"link",className:Fe(`${u}__collapse`),disabled:o,onClick:this.clickHandle},Bt(i?"qm.divider.collect":"qm.divider.spread"),i?t.createElement(De,null):t.createElement($e,null)))}}$n.contextType=Vt,$n.propTypes={label:f.string,size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Divider","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},extra:f.oneOfType([f.element,f.string]),collapse:f.bool,bordered:f.bool},$n.defaultProps={bordered:!0};const Mn=()=>({height:0,opacity:0}),qn=(e,t)=>"height"===t.propertyName,jn={motionName:"rc-collapse-motion",onEnterStart:Mn,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Mn,onEnterEnd:qn,onLeaveEnd:qn,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"};function Vn(e){return Vn="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},Vn(e)}function Kn(e){var t=function(e,t){if("object"!==Vn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Vn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Vn(t)?t:String(t)}function zn(e,t,n){return(t=Kn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wn(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 Bn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wn(Object(n),!0).forEach((function(t){zn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Un(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 Gn(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,o,a=[],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)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Un(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)?Un(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 Yn(e){return e instanceof HTMLElement||e instanceof SVGElement}function Xn(e){var n,r=function(e){return e&&"object"===Vn(e)&&Yn(e.nativeElement)?e.nativeElement:Yn(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Pt.findDOMNode)||void 0===n?void 0:n.call(Pt,e):null)}var Zn,Qn={exports:{}},Jn={};Qn.exports=(Zn||(Zn=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"),o=Symbol.for("react.provider"),a=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"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){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 a:case c:case h:case p:case o:return g;default:return m}}case n:return m}}}e=Symbol.for("react.module.reference");var g=a,v=o,y=t,b=c,x=r,E=h,S=p,w=n,C=l,T=i,N=d,I=u,R=!1,O=!1;Jn.ContextConsumer=g,Jn.ContextProvider=v,Jn.Element=y,Jn.ForwardRef=b,Jn.Fragment=x,Jn.Lazy=E,Jn.Memo=S,Jn.Portal=w,Jn.Profiler=C,Jn.StrictMode=T,Jn.Suspense=N,Jn.SuspenseList=I,Jn.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},Jn.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},Jn.isContextConsumer=function(e){return f(e)===a},Jn.isContextProvider=function(e){return f(e)===o},Jn.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Jn.isForwardRef=function(e){return f(e)===c},Jn.isFragment=function(e){return f(e)===r},Jn.isLazy=function(e){return f(e)===h},Jn.isMemo=function(e){return f(e)===p},Jn.isPortal=function(e){return f(e)===n},Jn.isProfiler=function(e){return f(e)===l},Jn.isStrictMode=function(e){return f(e)===i},Jn.isSuspense=function(e){return f(e)===d},Jn.isSuspenseList=function(e){return f(e)===u},Jn.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===l||t===i||t===d||t===u||t===m||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===p||t.$$typeof===o||t.$$typeof===a||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Jn.typeOf=f}()),Jn);var er=function(e,t){"function"==typeof e?e(t):"object"===Vn(e)&&e&&"current"in e&&(e.current=t)},tr=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){er(t,e)}))}},nr=function(e){var t,n,r=Qn.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===Qn.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===Qn.exports.ForwardRef)};function rr(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(i.split(".")[0]);var ir=e.createContext({});function lr(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,Kn(r.key),r)}}function ar(e,t,n){return t&&or(e.prototype,t),n&&or(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sr(e,t)}function cr(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&&sr(e,t)}function dr(e){return dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dr(e)}function ur(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pr(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=dr(e);if(t){var i=dr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Vn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ur(e)}(this,n)}}var hr=function(t){cr(r,e.Component);var n=pr(r);function r(){return lr(this,r),n.apply(this,arguments)}return ar(r,[{key:"render",value:function(){return this.props.children}}]),r}();function mr(t){var n=e.useRef(!1),r=Gn(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 fr="none",gr="appear",vr="enter",yr="leave",br="none",xr="prepare",Er="start",Sr="active",wr="end",Cr="prepared";function Tr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Nr(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 Ir,Rr,Or,kr=(Ir=Tr(),Rr="undefined"!=typeof window?window:{},Or={animationend:Nr("Animation","AnimationEnd"),transitionend:Nr("Transition","TransitionEnd")},Ir&&("AnimationEvent"in Rr||delete Or.animationend.animation,"TransitionEvent"in Rr||delete Or.transitionend.transition),Or),Ar={};if(Tr()){var Lr=document.createElement("div");Ar=Lr.style}var Pr={};function _r(e){if(Pr[e])return Pr[e];var t=kr[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 Ar)return Pr[e]=t[l],Pr[e]}return""}var Hr=_r("animationend"),Fr=_r("transitionend"),Dr=!(!Hr||!Fr),$r=Hr||"animationend",Mr=Fr||"transitionend";function qr(e,t){return e?"object"===Vn(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var jr=function(t){var n=o(),r=o(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function l(e){e&&(e.removeEventListener(Mr,i),e.removeEventListener($r,i))}return e.useEffect((function(){return function(){l(n.current)}}),[]),[function(e){n.current&&n.current!==e&&l(n.current),e&&e!==n.current&&(e.addEventListener(Mr,i),e.addEventListener($r,i),n.current=e)},l]},Vr=Tr()?a:s,Kr=function(e){return+setTimeout(e,16)},zr=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(Kr=function(e){return window.requestAnimationFrame(e)},zr=function(e){return window.cancelAnimationFrame(e)});var Wr=0,Br=new Map;function Ur(e){Br.delete(e)}var Gr=function(e){var t=Wr+=1;return function n(r){if(0===r)Ur(t),e();else{var i=Kr((function(){n(r-1)}));Br.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};Gr.cancel=function(e){var t=Br.get(e);return Ur(e),zr(t)},Gr.ids=function(){return Br};var Yr=[xr,Er,Sr,wr],Xr=[xr,Cr],Zr=!1,Qr=!0;function Jr(e){return e===Sr||e===wr}var ei=function(t,n,r){var i=Gn(mr(br),2),l=i[0],o=i[1],a=function(){var t=e.useRef(null);function n(){Gr.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=Gr((function(){i<=1?r({isCanceled:function(){return l!==t.current}}):e(r,i-1)}));t.current=l},n]}(),s=Gn(a,2),c=s[0],d=s[1];var u=n?Xr:Yr;return Vr((function(){if(l!==br&&l!==wr){var e=u.indexOf(l),t=u[e+1],n=r(l);n===Zr?o(t,!0):t&&c((function(e){function r(){e.isCanceled()||o(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,l]),e.useEffect((function(){return function(){d()}}),[]),[function(){o(xr,!0)},l]};var ti=function(t){var n=t;"object"===Vn(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,l=void 0===i||i,a=t.removeOnLeave,c=void 0===a||a,d=t.forceRender,u=t.children,p=t.motionName,h=t.leavedClassName,m=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(ir).motion),g=o(),v=o();var y=function(t,n,r,i){var l=i.motionEnter,a=void 0===l||l,c=i.motionAppear,d=void 0===c||c,u=i.motionLeave,p=void 0===u||u,h=i.motionDeadline,m=i.motionLeaveImmediately,f=i.onAppearPrepare,g=i.onEnterPrepare,v=i.onLeavePrepare,y=i.onAppearStart,b=i.onEnterStart,x=i.onLeaveStart,E=i.onAppearActive,S=i.onEnterActive,w=i.onLeaveActive,C=i.onAppearEnd,T=i.onEnterEnd,N=i.onLeaveEnd,I=i.onVisibleChanged,R=Gn(mr(),2),O=R[0],k=R[1],A=Gn(mr(fr),2),L=A[0],P=A[1],_=Gn(mr(null),2),H=_[0],F=_[1],D=o(!1),$=o(null);function M(){return r()}var q=o(!1);function j(){P(fr,!0),F(null,!0)}function V(e){var t=M();if(!e||e.deadline||e.target===t){var n,r=q.current;L===gr&&r?n=null==C?void 0:C(t,e):L===vr&&r?n=null==T?void 0:T(t,e):L===yr&&r&&(n=null==N?void 0:N(t,e)),L!==fr&&r&&!1!==n&&j()}}var K=Gn(jr(V),1)[0],z=function(e){var t,n,r;switch(e){case gr:return zn(t={},xr,f),zn(t,Er,y),zn(t,Sr,E),t;case vr:return zn(n={},xr,g),zn(n,Er,b),zn(n,Sr,S),n;case yr:return zn(r={},xr,v),zn(r,Er,x),zn(r,Sr,w),r;default:return{}}},W=e.useMemo((function(){return z(L)}),[L]),B=Gn(ei(L,!t,(function(e){if(e===xr){var t=W[xr];return t?t(M()):Zr}var n;return G in W&&F((null===(n=W[G])||void 0===n?void 0:n.call(W,M(),null))||null),G===Sr&&(K(M()),h>0&&(clearTimeout($.current),$.current=setTimeout((function(){V({deadline:!0})}),h))),G===Cr&&j(),Qr})),2),U=B[0],G=B[1],Y=Jr(G);q.current=Y,Vr((function(){k(n);var e,r=D.current;D.current=!0,!r&&n&&d&&(e=gr),r&&n&&a&&(e=vr),(r&&!n&&p||!r&&m&&!n&&p)&&(e=yr);var i=z(e);e&&(t||i[xr])?(P(e),U()):P(fr)}),[n]),s((function(){(L===gr&&!d||L===vr&&!a||L===yr&&!p)&&P(fr)}),[d,a,p]),s((function(){return function(){D.current=!1,clearTimeout($.current)}}),[]);var X=e.useRef(!1);s((function(){O&&(X.current=!0),void 0!==O&&L===fr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,L]);var Z=H;return W[xr]&&G===Er&&(Z=Bn({transition:"none"},Z)),[L,G,Z,null!=O?O:n]}(f,l,(function(){try{return g.current instanceof HTMLElement?g.current:Xn(v.current)}catch(e){return null}}),t),b=Gn(y,4),x=b[0],E=b[1],S=b[2],w=b[3],C=e.useRef(w);w&&(C.current=!0);var T,N=e.useCallback((function(e){g.current=e,er(r,e)}),[r]),I=Bn(Bn({},m),{},{visible:l});if(u)if(x===fr)T=w?u(Bn({},I),N):!c&&C.current&&h?u(Bn(Bn({},I),{},{className:h}),N):d||!c&&!h?u(Bn(Bn({},I),{},{style:{display:"none"}}),N):null;else{var R,O;E===xr?O="prepare":Jr(E)?O="active":E===Er&&(O="start");var k=qr(p,"".concat(x,"-").concat(O));T=u(Bn(Bn({},I),{},{className:Fe(qr(p,x),(R={},zn(R,k,k&&O),zn(R,p,"string"==typeof p),R)),style:S}),N)}else T=null;e.isValidElement(T)&&nr(T)&&(T.ref||(T=e.cloneElement(T,{ref:N})));return e.createElement(hr,{ref:v},T)}));return r.displayName="CSSMotion",r}(Dr);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 ri="add",ii="keep",li="remove",oi="removed";function ai(e){var t;return Bn(Bn({},t=e&&"object"===Vn(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function si(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(ai)}var ci=["component","children","onVisibleChanged","onAllRemoved"],di=["status"],ui=["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]:ti,r=function(t){cr(i,e.Component);var r=pr(i);function i(){var e;lr(this,i);for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return zn(ur(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),zn(ur(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:Bn(Bn({},e),{},{status:oi})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==oi})).length})),e}return ar(i,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,i=this.props,l=i.component,o=i.children,a=i.onVisibleChanged,s=i.onAllRemoved,c=rr(i,ci),d=l||e.Fragment,u={};return ui.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=rr(r,di),c=i===ri||i===ii;return e.createElement(n,ni({},u,{key:l.key,visible:c,eventProps:l,onVisibleChanged:function(e){(null==a||a(e,{key:l.key}),e)||0===t.removeKey(l.key)&&s&&s()}}),o)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=si(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=si(e),o=si(t);l.forEach((function(e){for(var t=!1,l=r;l<i;l+=1){var a=o[l];if(a.key===e.key){r<l&&(n=n.concat(o.slice(r,l).map((function(e){return Bn(Bn({},e),{},{status:ri})}))),r=l),n.push(Bn(Bn({},a),{},{status:ii})),r+=1,t=!0;break}}t||n.push(Bn(Bn({},e),{},{status:li}))})),r<i&&(n=n.concat(o.slice(r).map((function(e){return Bn(Bn({},e),{},{status:ri})}))));var a={};return n.forEach((function(e){var t=e.key;a[t]=(a[t]||0)+1})),Object.keys(a).filter((function(e){return a[e]>1})).forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==li}))).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!==li}))}}}]),i}();zn(r,"defaultProps",{component:"div"})}(Dr);const pi=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:l,boxStyle:o,isActive:a}=e,[s,c]=t.useState(a||r);if(t.useEffect((()=>{(r||a)&&c(!0)}),[r,a]),!s)return null;const d=Dn("collapse");return t.createElement("div",{ref:n,className:Fe(`${d}-content`,{[`${d}-content-active`]:a,[`${d}-content-inactive`]:!a},i),style:l},t.createElement("div",{className:`${d}-content-box`,style:o},e.children))}));pi.displayName="PanelContent";const hi=e=>{const{defaultActive:n,label:r,extra:i,className:l,style:o,containerStyle:a,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=t.useState(!!n),f=Dn("collapse"),g=Fe({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},l);return t.createElement("div",{className:g,style:o},t.createElement($n,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),null==p||p(e)}}),t.createElement(ti,hn({visible:h},jn,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((n,r)=>{let{className:i,style:l}=n;return t.createElement(pi,{ref:r,prefixCls:f,className:i,style:l,boxStyle:a,isActive:h,forceRender:d},e.children)})))};hi.displayName="QmCollapse";const mi=t.createContext(void 0);function fi(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 gi=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},vi=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},yi=e=>e.preventDefault(),bi=(e,t)=>{if(Sn||!e||!t)return null;"float"===(t=On(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]}},xi=(e,t,n)=>{!Sn&&e&&t&&(se(t)?Object.keys(t).forEach((n=>{xi(e,n,t[n])})):(t=On(t),e.style[t]=n))},Ei=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Si=(e,t)=>Math.abs(Ei(e)-Ei(t)),wi=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}},Ci=(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},Ti=(e,t)=>{if(Sn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ni=e=>Math.pow(e,3),Ii=e=>e<.5?Ni(2*e)/2:1-Ni(2*(1-e))/2,Ri=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:l,direction:o}=t.useContext(mi),a=t.useRef(Sn?null:document.onselectstart),s=t.useMemo((()=>"horizontal"===o),[o]),c=t.useMemo((()=>s?"X":"Y"),[s]),d=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),u=e=>{d.current=Object.assign({},d.current,e)},p=e=>{if(1!==e.buttons)return h();const t=e[`page${c}`]-d.current[`start${c}`],r=[n[0],d.current[`containerSize${c}`]-n[1]];let l=d.current[`firstElementSize${c}`]+t;l=Math.max(r[0],l),l=Math.min(r[1],l),i(l)},h=()=>{u({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),vi(document,"mousemove",p),vi(document,"mouseup",h),m()},m=()=>{document.onselectstart!==a.current&&(document.onselectstart=a.current)},f={[`${Dn("split")}__resize-bar`]:!0,vertical:"vertical"===o,horizontal:"horizontal"===o};return t.createElement("div",{className:Fe(f),title:Bt("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=l.current,n=t.children[0];u({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),gi(document,"mousemove",p),gi(document,"mouseup",h),r(!0),a.current=document.onselectstart,document.onselectstart=()=>!1}})};Ri.displayName="ResizeBar";const Oi=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:l}=e,{direction:o,dragging:a}=t.useContext(mi),s="vertical"===o?"height":"width",c={[Dn("split-pane")]:!0,isLocked:a,horizontal:"horizontal"===o,vertical:"vertical"===o,[i]:!!i},d=void 0!==r?{[s]:Pn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:Fe(c),style:Object.assign(Object.assign({},d),l)},e.children)}));Oi.displayName="QmSplitPane";const ki=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:l,style:o,onDragStart:a,onDrag:s=Tn,onDragEnd:c}=e,{global:d}=t.useContext(Vt),u=t.useRef(null),p=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`,m=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));fi((()=>{v?null==a||a(m(b)):(null==c||c(m(b)),localStorage.setItem(g,b),w(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):S(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},S=e=>En(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){}})),w=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),C=t.useMemo((()=>({splitRef:u,direction:n,dragging:v})),[n,v]),T=[];t.Children.map(e.children,(e=>{var t;wn(e)&&!Cn(e)&&"QmSplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&T.push(e)}));const[N,I]=T,R=t.useMemo((()=>[f(N),f(I)]),[N,I]),O={[Dn("split")]:!0,vertical:"vertical"===n};return t.createElement(mi.Provider,{value:C},t.createElement("div",{ref:u,className:Fe(O,l),style:o},t.createElement(Oi,hn({},N.props,{ref:p,offset:b})),t.createElement(Ri,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Oi,I.props)))};ki.Pane=Oi,ki.displayName="QmSplit";class Ai extends r{render(){const{size:e,className:n,style:r}=this.props,i=e||this.context.size||"",l=Dn("countup"),o={[l]:!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i};return t.createElement(Tt,hn({},this.props,{className:Fe(o,n),style:r}),this.props.children)}}Ai.defaultProps={duration:2},Ai.contextType=Vt;class Li extends r{render(){const{size:e,className:n}=this.props,r=e||this.context.size||"",i=Dn("empty"),l=Object.assign(Object.assign({},this.props),{image:I.PRESENTED_IMAGE_SIMPLE}),o={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(I,hn({},l,{className:Fe(o,n)}))}}Li.contextType=Vt,Li.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")}};class Pi extends r{render(){const{fullHeight:e,className:n,style:r={}}=this.props,i={[`${Dn("spin")}-full-height`]:e},l=Object.assign(Object.assign({wrapperClassName:Fe(i,n)},An(this.props,["fullHeight"])),{style:Object.assign(Object.assign({},r),{maxHeight:"none"})});return t.createElement(R,l,this.props.children)}}Pi.defaultProps={tip:"Loading...",fullHeight:!1};const _i=t.createContext(void 0),Hi=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},Fi=function(e,t){!Sn&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new Nt(Hi),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},Di=function(e,t){var n;e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||null===(n=e.__ro__)||void 0===n||n.disconnect())};function $i(t){const[n,r]=e.useState({width:0,height:0});return e.useLayoutEffect((()=>{const e=t.current,n=e=>{const{width:t,height:n}=e.contentRect;r({width:t,height:n})};return e&&Fi(e,n),()=>{e&&Di(e,n)}}),[t]),n}const Mi=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function qi(e,t){Mi((t=>{if(!t)return e()}),t)}function ji(t,n){var r=this;const i=e.useRef(null);e.useEffect((()=>()=>{clearTimeout(i.current),i.current=null}),[]);const l=e.useCallback((function(){for(var e=arguments.length,l=new Array(e),o=0;o<e;o++)l[o]=arguments[o];i.current&&clearTimeout(i.current),i.current=setTimeout((()=>t.apply(r,l)),n)}),[t,n]);return l}const Vi=6,Ki={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"}},zi=e=>{const{thumb:n,always:r,className:i,barSize:l=Vi,direction:o="vertical",onDrag:a=Tn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(_i),u=Ki[o],p=t.useRef(n),h=t.useRef(null),m=t.useRef(null),f=t.useRef({}),g=t.useRef(!1),v=t.useRef(!1),y=t.useRef(Sn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{p.current=n}),[n]),t.useEffect((()=>{const e=c.current;return gi(e,"mousemove",C),gi(e,"mouseleave",T),()=>{w(),vi(document,"mouseup",S),vi(e,"mousemove",C),vi(e,"mouseleave",T)}}),[]);const E=e=>{if(!h.current||!m.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])-(m.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,a(!0)},S=()=>{g.current=!1,f.current={[u.axis]:0},vi(document,"mousemove",E),vi(document,"mouseup",S),w(),v.current&&x(!1),a(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},C=()=>{v.current=!1,x(!!p.current.size)},T=()=>{v.current=!0,x(g.current)},N=Dn("scrollbar"),I={[`${N}__bar`]:!0,"is-vertical":"vertical"===o,"is-horizontal":"horizontal"===o},R={[u.reverse]:l},O={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(Ip,{name:"fade",in:r||s||b,timeout:300},t.createElement("div",{ref:h,className:Fe(I,i),style:R},t.createElement("div",{ref:m,className:`${N}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),gi(document,"mousemove",E),gi(document,"mouseup",S),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])})}})))},Wi=20,Bi=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,barWidth:l,always:o,native:a,showTopScrollbar:s,minSize:c=Wi,onScroll:d}=e,u=t.useRef(null),p=t.useRef(null),h=t.useRef(null),[m,f]=t.useState({size:0,offset:0,ratio:1}),[g,v]=t.useState({size:0,offset:0,ratio:1}),[y,b]=t.useState(!1),x=$i(u),E=$i(h);qi((()=>{!a&&S()}),[E.width,E.height,x.width,x.height]);const S=ji((()=>{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,i=Math.max(n,c),l=Math.max(r,c),o=n/(e-n)/(i/(e-i)),a=r/(t-r)/(l/(t-l)),s=i+4<e?i:0,d=l+4<t?l:0,u=100*p.current.scrollTop/e*o,h=100*p.current.scrollLeft/t*a;f(Object.assign({},m,{size:d,ratio:a,offset:h})),v(Object.assign({},g,{size:s,ratio:o,offset:u}))}),5),w=e=>{b(e)},C=(e,t)=>{ce(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,i=window.requestAnimationFrame,l=()=>{const o=(Date.now()-n)/500;o<1?(e.scrollTop=r+(t-r)*Ii(o),i(l)):e.scrollTop=t};i(l)})(p.current,e):p.current.scrollTop=e:Xt("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{ce(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,i=window.requestAnimationFrame,l=()=>{const o=(Date.now()-n)/500;o<1?(e.scrollLeft=r+(t-r)*Ii(o),i(l)):e.scrollLeft=t};i(l)})(p.current,e):p.current.scrollLeft=e:Xt("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:u.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:C,SET_SCROLL_LEFT:T}}));const N=t.useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:p})),[y]),I=Dn("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!a};return t.createElement("div",{ref:u,className:Fe(I,e.className),style:e.style},t.createElement("div",{ref:p,className:Fe(R,r),style:i,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!a&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=100*p.current.scrollTop/e*g.ratio,r=100*p.current.scrollLeft/t*m.ratio;f(Object.assign({},m,{offset:r})),v(Object.assign({},g,{offset:n}))})(),null==d||d({scrollTop:t,scrollLeft:n})}},t.createElement("div",{ref:h,className:`${I}__view`},e.children)),!a&&t.createElement(_i.Provider,{value:N},s&&t.createElement(zi,{className:"top",direction:"horizontal",thumb:m,barSize:l,always:o,onDrag:w}),t.createElement(zi,{direction:"horizontal",thumb:m,barSize:l,always:o,onDrag:w}),t.createElement(zi,{direction:"vertical",thumb:g,barSize:l,always:o,onDrag:w})))}));Bi.displayName="QmScrollbar";const Ui=(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}},Gi=(e,t)=>{let{fileName:n,headers:r,params:i}=t;return En(void 0,void 0,void 0,(function*(){const t=i?new URLSearchParams(i).toString():"",l=t?e.includes("?")?"&":"?":"",o=yield fetch(e+`${l+t}`,{method:"GET",headers:r});if(!o.ok)throw new Error(Bt("qm.download.error"));const a=yield o.blob(),s=o.headers.get("content-disposition"),c=n||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ui(a,c)}))};class Yi extends r{constructor(){super(...arguments),this.beforeUpload=(e,t)=>new Promise(((n,r)=>En(this,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:l,maxCount:o,fileList:a=[],beforeUpload:s}=this.props,c=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!l||e.size/1024/1024<l,u=!(o>1)||a.length<o,p=c&&d&&u;if(c||k.warning(Bt("qm.upload.tooltip",{type:i.join(",")})),d||k.warning(Bt("qm.upload.sizeLimit",{size:l})),u||k.warning(Bt("qm.upload.countLimit",{count:o})),!p)return O.LIST_IGNORE;if(s){const i=s(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)})))),this.doDownload=e=>En(this,void 0,void 0,(function*(){const{downloadWithHeaders:t,headers:n}=this.props;try{e.url&&(yield Gi(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){k.error(Bt("qm.download.error"))}}))}get $size(){var e;return null!==(e=this.context.size)&&void 0!==e?e:""}render(){var e,n;const{fileList:r=[],button:i={},fileDirection:l,disabled:o,readOnly:a,className:s,onPreview:c,onChange:d}=this.props,u=Dn("upload-file"),p={[u]:!0,[`${u}--lg`]:"large"===this.$size,[`${u}--sm`]:"small"===this.$size,[`${u}--horizontal`]:"horizontal"===l};return t.createElement(O,hn({className:Fe(p,s)},An(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:o||a,onChange:d,onPreview:e=>En(this,void 0,void 0,(function*(){if("function"==typeof c)return c(e,(t=>this.doDownload(t||e)));o||(yield this.doDownload(e))})),onDownload:e=>En(this,void 0,void 0,(function*(){yield this.doDownload(e)}))}),this.props.children||a&&r.length?this.props.children:t.createElement(C,{type:null!==(e=i.type)&&void 0!==e?e:"default",icon:null!==(n=i.icon)&&void 0!==n?n:t.createElement(Me,null),disabled:o||a},i.text||Bt("qm.upload.text")))}}Yi.contextType=Vt,Yi.defaultProps={name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}};class Xi extends r{constructor(){super(...arguments),this.state={loading:!1},this.downloadHandle=()=>En(this,void 0,void 0,(function*(){var e,t,n,r;this.setState({loading:!0});try{const{action:n,fileName:r,headers:i,params:l,beforeDownload:o=Nn}=this.props,a=ue(n)?n:yield this.getActionUrl();if(!a)return Xt("Download","参数 `action` 有误!");if(!o(a))return;yield Gi(a,{fileName:r,headers:i,params:l}),yield In(100),null===(t=(e=this.props).onSuccess)||void 0===t||t.call(e),k.success(Bt("qm.download.success"))}catch(e){null===(r=(n=this.props).onError)||void 0===r||r.call(n,e),k.error(Bt("qm.download.error"))}this.setState({loading:!1})}))}getActionUrl(){return En(this,void 0,void 0,(function*(){const e=this.props.action;if(e.api)try{const t=yield e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}))}render(){const{size:e}=this.props,{loading:n}=this.state,r=e||this.context.size||"",i=An(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(C,hn({},i,{size:r,loading:n,onClick:this.downloadHandle}),this.props.children)}}Xi.propTypes={action:f.oneOfType([f.string,f.shape({api:f.func.isRequired,params:f.object})]),size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},fileName:f.string,headers:f.object,withCredentials:f.bool,params:f.object,beforeDownload:f.func,onSuccess:f.func,onError:f.func},Xi.defaultProps={icon:t.createElement(qe,null),children:Bt("qm.download.text"),withCredentials:!1},Xi.contextType=Vt;class Zi extends r{renderLabel(){const{activeKey:e,labels:n,onTabClick:r}=this.props;return n.map(((n,i)=>{const l={item:!0,actived:i===e};return t.createElement("div",{key:i,className:Fe(l),onClick:e=>r(i,e)},t.createElement("span",null,n))}))}render(){return t.createElement(t.Fragment,null,this.renderLabel())}}class Qi extends r{render(){const{label:e,showDivider:n,className:r,style:i}=this.props,l={[Dn("anchor-item")]:!0};return t.createElement("div",{className:Fe(l,r),style:i},n&&t.createElement($n,{label:e,style:{marginBottom:10}}),this.props.children)}}Qi.displayName="QmAnchorItem";class Ji extends r{get __is_conf(){var e;return!!(null===(e=this.props.labelList)||void 0===e?void 0:e.length)}constructor(e){super(e),this.currentState="ready",this.scrollRef=c(),this.onScrollHandle=e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})},this.onTabClickHandle=e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Rt(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))},this.SCROLL_TO_ITEM=e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)},this.state={activeKey:e.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=It(this.scrollRef.current,"scroll",pe(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Si(this.getTargetElement(e),this.scrollRef.current))}createDistances(){var e;const{labelList:t=[]}=this.props;return(this.__is_conf?t.map((e=>document.getElementById(e.id))):Array.from((null===(e=this.scrollRef.current)||void 0===e?void 0:e.children)||[])).map((e=>Si(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),n=this.createDistances();let r=-1;for(let e=0;e<n.length;e++){const i=n[e],l=n[e+1]||1e4;t>=i-1&&t<l&&(r=e)}return r}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:n,labelWidth:r,tabPosition:i,labelList:l=[],onTabClick:o,className:a,style:s}=this.props,c=n||this.context.size||"",d=Dn("anchor"),u={[d]:!0,[`${d}-left`]:"left"===i,[`${d}-top`]:"top"===i,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];t.Children.map(this.props.children,(e=>{var t;wn(e)&&!Cn(e)&&"QmAnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&p.push(e)}));const h=this.__is_conf?l.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?l.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,t.createElement("div",{className:Fe(u,a),style:s},t.createElement("div",{className:Fe("anchor-nav"),style:{width:r?Pn(r):""}},t.createElement(Zi,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),null==o||o({label:h[e],id:m[e]},t)}})),t.createElement("div",{ref:this.scrollRef,className:Fe("anchor-container")},this.__is_conf?this.props.children:p))}}Ji.Item=Qi,Ji.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},labelWidth:(e,t,n)=>{if(!Zt(e[t]))return Yt("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},labelList:f.arrayOf(f.shape({id:f.string,label:f.string}))},Ji.defaultProps={tabPosition:"left"},Ji.contextType=Vt;class el extends r{render(){return t.createElement(A.TabPane,this.props,this.props.children)}}el.displayName="QmTabPane";class tl extends r{render(){const{items:e,size:n,tabPosition:r,tabBarGutter:i,className:l,authConfig:o}=this.props,a=n||this.context.size||"",s=Dn("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===a,[`${s}--sm`]:"small"===a},d=Object.assign(Object.assign({},An(this.props,["items","authConfig"])),{size:a,tabBarGutter:null!=i?i:["top","bottom"].includes(r)?30:0}),u=[];t.Children.map(this.props.children,(e=>{var t;wn(e)&&!Cn(e)&&"QmTabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:n}=e;return{key:t,label:n.tab,disabled:n.disabled,closable:n.closable,forceRender:n.forceRender,children:n.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:i=1,disabled:l}=r||{};i?l&&(n.disabled=!0):(p.splice(t,1),t--)}}return t.createElement(A,hn({},d,{items:p,className:Fe(c,l)}))}}tl.TabPane=el,tl.contextType=Vt,tl.defaultProps={tabPosition:"top"};class nl extends r{constructor(){super(...arguments),this.titleRef=t.createRef(),this.$drawer=null,this.opened=!1,this.state={fullscreen:!1,spinning:!1,sloading:!1},this.afterVisibleChange=e=>{var t,n;const{loading:r}=this.props;e?(this.opened=!0,he(r)&&setTimeout((()=>this.setState({spinning:!1})),100)):(null===(n=(t=this.props).onClosed)||void 0===n||n.call(t),this.setState({fullscreen:!1}))},this.toggleHandle=()=>{this.$drawer=Ci(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(t=(e=this.props).onFullChange)||void 0===t||t.call(e,this.state.fullscreen)}))},this.START_LOADING=()=>{this.setState({sloading:!0})},this.STOP_LOADING=()=>{this.setState({sloading:!1})}}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){var n;const{visible:r,open:i,loading:l,destroyOnClose:o}=this.props,a=null!=i?i:r,s=null!==(n=e.open)&&void 0!==n?n:e.visible,{fullscreen:c}=this.state;a&&a!==s&&(!o&&this.opened||he(l)&&this.setState({spinning:!0})),this.$drawer&&c!==t.fullscreen&&xi(this.$drawer,c?{width:"100%"}:{width:Pn(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:n,showHeader:r,showFullScreen:i}=this.props;return t.createElement(t.Fragment,null,t.createElement("span",{ref:this.titleRef,className:Fe("text")},r&&n),i&&t.createElement("button",{type:"button",className:Fe("full-screen"),onClick:this.toggleHandle},t.createElement(e?je:Ve)))}render(){var e;const{spinning:n,sloading:r}=this.state,{visible:i,open:l,size:o,className:a,loading:s,showHeader:c,maskClosable:d,onClose:u}=this.props,p=this.context.global,h=o||this.context.size||"",m=Dn("drawer"),f={[m]:!0,"no-header":!c,[`${m}--lg`]:"large"===h,[`${m}--sm`]:"small"===h};return t.createElement(L,hn({},An(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=l?l:i,maskClosable:null!==(e=null!=d?d:null==p?void 0:p.maskClosable)&&void 0!==e&&e,className:Fe(f,a),title:this.renderTitle(),footer:null,onClose:u,afterOpenChange:this.afterVisibleChange}),this.props.children,(s||r||n)&&t.createElement(Pi,{spinning:!0,className:Fe("spinning")}))}}nl.contextType=Vt,nl.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Drawer","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},spinning:f.bool},nl.defaultProps={width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null};const rl="10vh";var il;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(il||(il={}));class ll extends r{constructor(){super(...arguments),this.draggleRef=t.createRef(),this.opened=!1,this.state={fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0},this.onStart=(e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=this.draggleRef.current.getBoundingClientRect();i&&this.setState({bounds:{left:-i.left+t.x,right:n-(i.right-t.x)-1,top:-i.top+t.y,bottom:r-(i.bottom-t.y)-1}})},this.toggleHandle=e=>{const t=Ci(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body"),{width:r,height:i,showHeader:l}=this.props,{fullscreen:o}=this.state;o?(xi(t,{width:Pn(r||"60%"),height:"auto",top:rl}),xi(n,{height:i?Pn(i):this.defaultHeight,maxHeight:"auto"===i?this.defaultHeight:""})):(xi(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),xi(n,{height:`calc(100vh - ${il[l?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(t=(e=this.props).onFullChange)||void 0===t||t.call(e,this.state.fullscreen)}))},this.afterVisibleChange=()=>{const{onClosed:e}=this.props;null==e||e(),this.setState({fullscreen:!1})},this.START_LOADING=()=>{this.setState({sloading:!0})},this.STOP_LOADING=()=>{this.setState({sloading:!1})}}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${rl} - ${rl} - ${il[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){var n;const{visible:r,open:i,loading:l,destroyOnClose:o}=this.props,a=null!=i?i:r,s=null!==(n=e.open)&&void 0!==n?n:e.visible,{fullscreen:c}=this.state;if(a&&a!==s){if(!o&&this.opened||he(l)&&this.setState({spinning:!0}),!o&&this.opened)return;setTimeout((()=>{this.opened=!0,he(l)&&this.setState({spinning:!1})}),400)}c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:n}=this.state,{title:r,showHeader:i,showFullScreen:l}=this.props;return t.createElement("div",{onMouseOver:()=>{n&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t.createElement("span",{className:Fe("text")},i&&r),l&&t.createElement("button",{type:"button",className:Fe("full-screen"),onClick:this.toggleHandle},t.createElement(e?je:Ve)))}render(){var e;const{spinning:n,sloading:r,fullscreen:i,disabled:l,bounds:o,position:a}=this.state,{visible:s,open:c,height:d,className:u,loading:p,draggable:h,showHeader:m,maskClosable:f,bodyStyle:g,onClose:v}=this.props,y=this.context.global,b=Dn("modal"),x={height:d?Pn(d):this.defaultHeight,maxHeight:"auto"===d?this.defaultHeight:"",overflow:"auto"},E={[b]:!0,"no-header":!m,[`${b}--lg`]:"large"===this.$size,[`${b}--sm`]:"small"===this.$size};return t.createElement(P,hn({},An(this.props,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=c?c:s,maskClosable:null!==(e=null!=f?f:null==y?void 0:y.maskClosable)&&void 0!==e&&e,className:Fe(E,u),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},x,g),onCancel:v,afterClose:this.afterVisibleChange,modalRender:e=>t.createElement(Ot,{nodeRef:this.draggleRef,bounds:o,position:a,disabled:!h||l||i,onStart:(e,t)=>this.onStart(e,t)},t.createElement("div",{ref:this.draggleRef},e))}),this.props.children,(p||r||n)&&t.createElement(Pi,{spinning:!0,className:Fe("spinning")}))}}ll.contextType=Vt,ll.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Modal","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},spinning:f.bool},ll.defaultProps={width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:rl}};const ol=n(void 0),al=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var sl={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)al.includes(t[e])?(n[r]=n[r].join(" "),r++,n[r]=[]):n[r].push(t[e]);return n[r]=n[r].join(" "),n},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";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," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),e=this.find_replace(e," NIN "," nin ")}};const cl=["==","<",">","<=",">=","!=","like","likes","in","nin"];var dl=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},ul=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++)cl.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),cl.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const pl=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,hl=["string","number","boolean","symbol"],ml=e=>hl.includes(typeof e),fl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),gl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(pl,"\\$1"),"i");window.__query__=function(){return((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(gl(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(gl(t))));break;case"in":ml(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":ml(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(fl(e)?e.slice(0,10):e)!=n;break;case"<":r=(fl(e)?e.slice(0,10):e)<n;break;case"<=":r=(fl(e)?e.slice(0,10):e)<=n;break;case">":r=(fl(e)?e.slice(0,10):e)>n;break;case">=":r=(fl(e)?e.slice(0,10):e)>=n;break;default:r=(fl(e)?e.slice(0,10):e)==n}return r})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const vl=sl.stringify,yl=sl.array_format,bl=dl,xl=(e,t,n)=>{let r=[];t=sl.replace_symbols(t);try{if(n){const n=new Function("record",`return ${ul(t,"record")};`);r=Ql(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${ul(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){Xt("Table","组件 `initialFilter` 参数有误!"),r=e}return r},El=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...El(e.children)):t.push(e)})),t},Sl=e=>e.filter((e=>(e.children&&(e.children=Sl(e.children)),!e.hidden&&!e.noAuth))),wl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...wl(e.children))})),t},Cl=(e,t)=>e.map((e=>(e.children&&(e.children=Cl(e.children,t)),null==t||t(e),e))),Tl=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Tl(n.children,t);if(e)return e}}return null},Nl=e=>{const t=e.children;return t?t[0].children?Nl(t[0]):t[0]:e},Il=e=>{const t=e.children;return t?t[t.length-1].children?Il(t[t.length-1]):t[t.length-1]:e},Rl=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Ol=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Ol(n.children,t);if(e)return e}}return null},kl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...kl(e.children))})),t},Al=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 wl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Ll=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{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 Ll(e.offsetParent,t,n)}return n},Pl=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,_l=(e,t)=>fe(e,((e,n,r)=>{ge(n,t[r])||(e[r]=se(n)&&se(t[r])?_l(n,t[r]):n)})),Hl=(e,t)=>{var n;return null!==(n=me(e,t))&&void 0!==n?n:""},Fl=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),ve(e,t,null!=n?n:"")},Dl=(e,t)=>{if(!t.includes("|"))return Hl(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Hl(e,t))})),n.every((e=>!e))?"":n.join(" | ")},$l=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Ml=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]}`:""}`},ql=(e,t)=>{const n=e.toString();if(!$l(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)},jl=(e,t)=>e?g(e,t):null,Vl=(e,t)=>e?g(e).format(t):"",Kl=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",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)}))},zl=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...zl(e))}))}else n.push(e);return n},Wl=e=>zl(e).join(""),Bl=e=>e.filter((e=>!e._group)),Ul=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],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 o=Array.isArray(l.condition)?yl(l.condition):vl(l.condition,"^");n+=`${l.bracketLeft} ${t?`${l.fieldName}|${l.fieldType}`:l.fieldName} ${l.expression} ${o} ${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,""],o=e[r];for(const e in o){n+=`${t?`${i}|${l}`:i} ${e} ${Array.isArray(o[e])?yl(o[e]):vl(o[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},Gl=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((n=>{const r=JSON.stringify((t=>{const n=[];return e.forEach((e=>n.push(Hl(t,e)))),n})(n));t[r]=t[r]||[],t[r].push(n)})),Object.keys(t).map((e=>t[e]))},Yl=(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=Yl(e[n].children,t);if(r)return[e[n],r].flat()}}},Xl=(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=Xl(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},Zl=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=Zl(n.children,t);if(e)return e}if(t(n))return n}return null},Ql=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Ql(e.children,t),t(e)||e.children&&e.children.length))),Jl=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),eo=80,to="1",no="0",ro=400,io=["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"],lo={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 oo,ao,so;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(oo||(oo={})),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"}(ao||(ao={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(so||(so={}));const co={items:f.arrayOf(f.shape({type:f.string.isRequired,fieldName:f.string.isRequired})),initialValues:f.object,initialExtras:f.object,layout:f.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:f.number,customClass:f.string,compactMode:f.bool,labelWidth:f.oneOfType([f.number,f.string]),labelAlign:f.oneOf(["left","right"]),labelWrap:f.bool,formType:f.oneOf(["default","search","onlyShow"]),disabled:f.bool,uniqueKey:f.string,defaultRows:f.number,defaultExpand:f.bool,searchButtonCols:f.number,scrollToFirstError:f.bool,authConfig:f.object,isAutoFocus:f.bool,isCollapse:f.bool,isFieldsDefine:f.bool,isSearchBtn:f.bool,isSubmitBtn:f.bool,fieldsChange:f.func,onValuesChange:f.func,onFieldsChange:f.func,onFinish:f.func,onFinishFailed:f.func,onReset:f.func,onCollapse:f.func},uo={layout:"horizontal",labelWidth:eo,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Tn,onFieldsChange:Tn,onFinish:Tn,onFinishFailed:Tn,onReset:Tn,onCollapse:Tn},po=(e,t)=>{if(!e)return null;if(t===ao.week){const t=e.match(/^(\d{4})-(\d+)/);return t?g().year(Number(t[1])).week(Number(t[2])):null}if(t===ao.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?g().year(Number(t[1])).quarter(Number(t[2])):null}return g(e,t)},ho=(e,t)=>e?g(e).format(t):"",mo=e=>""===e||null==e,fo=(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},go=(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]]},vo=(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]]},yo=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),he(e.isLeaf)||(r.isLeaf=!!e.isLeaf),he(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=yo(e.children,t,n)),r})),bo=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=bo(n.children,t);if(e)return e}}return null},xo=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...xo(e.children,t,n+1))})),r},Eo=e=>wn(e)||"string"==typeof e,So=e=>wn(e)?zl(e).join(""):null!=e?e:"",wo=(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 Co={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 To="阿",No="鿿",Io=1,Ro=2,Oo=3;let ko,Ao=null;function Lo(e){return e||null===Ao?("object"==typeof Intl&&Intl.Collator?(ko=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Ao=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Ao=!1,Ao):Ao}function Po(e){const t=Co.UNIHANS,n=Co.PINYINS,r=Co.EXCEPTIONS,i={source:e};if(e in r)return i.type=Ro,i.target=r[e],i;let l,o=-1;if(e.charCodeAt(0)<256)return i.type=Io,i.target=e,i;if(l=ko.compare(e,To),l<0)return i.type=Oo,i.target=e,i;if(0===l)i.type=Ro,o=0;else{if(l=ko.compare(e,No),l>0)return i.type=Oo,i.target=e,i;0===l&&(i.type=Ro,o=t.length-1)}if(i.type=Ro,o<0){let n=0,r=t.length-1;for(;n<=r;){o=~~((n+r)/2);const i=t[o];if(l=ko.compare(e,i),0===l)break;l>0?n=o+1:r=o-1}}return l<0&&o--,i.target=n[o],i.target||(i.type=Oo,i.target=i.source),i}function _o(e){return"string"==typeof e&&Lo()?e.split("").map((e=>Po(e))):e}var Ho={isSupported:Lo,parse:_o,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Co)})))},genToken:Po,convertToPinyin:(e,t,n)=>_o(e).map((e=>t&&e.type===Ro?e.target.toLowerCase():e.target)).join(n||"")};var Fo={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)}};Ho.isSupported()&&Fo.shouldPatch(Ho.genToken)&&Ho.patchDict(Fo);const Do=e=>{const{value:n,bordered:r}=e;return t.createElement(_,{value:n,title:n,bordered:r,readOnly:!0})};Do.displayName="FormItemView";const{Option:$o}=$,Mo=e=>{const{$$form:n}=t.useContext(ol),{value:r,items:i,multiple:l,loading:o,onChange:a,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=Bt("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:f,disabled:g}=e.option,{itemList:v=[],filterable:y=!0,listHeight:b=ro,collapseTags:x,maxTagTextLength:E,dropdownStyle:S,openPyt:w=!0}=d,C=kn(v)?i:v,T=e=>{var t;return(null===(t=C.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},N=e=>l?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement(Do,{value:N(r),bordered:h}):t.createElement($,hn({value:r,mode:l?"multiple":void 0,popupClassName:`form-popper__${c}`,dropdownStyle:S,placeholder:p,style:u,loading:o,bordered:h,allowClear:m,disabled:g,showSearch:y,listHeight:b,maxTagCount:x?"responsive":void 0,maxTagTextLength:E},l?{title:N(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=Ho.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},onChange:e=>{(e=>{null==a||a(e),s(e,N(e),C)})(e)}}),C.map((e=>t.createElement($o,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class qo extends r{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:o="text",callback:a}=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=me(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[o]})));this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:o,fieldName:a,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(l),className:Fe(u),tooltip:o,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Pn(d)},required:e.getFormItemRequired(f)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:a,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Mo,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(a,n)}}))),h&&t.createElement(D,null,e.renderFormItemButton(a,h)),p&&t.createElement(D,{flex:Pn(p.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:a},p)))))}}qo.contextType=ol;const jo=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{label:o,options:a={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=no,trueValue:h=to}=a,m=e=>Bt(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,m(e))})(t?h:p)}},u?o:null)};class Vo extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option,{labelToCheckbox:m}=a;return t.createElement(H.Item,{label:m?" ":e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(jo,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Vo.contextType=ol;class Ko extends r{constructor(){super(...arguments),this.linkRef=t.createRef(),this.state={visible:!1},this.getFormFieldsConfig=e=>En(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.saveFormFieldsConfig=(e,t)=>En(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.resetFieldsHandle=e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||Ln(e);return Object.assign(t,{hidden:e.hidden})}));this.changeHandle(t),this.setLocalFields(t)}}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));if(e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{var t;e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):(null===(t=this.context.global)||void 0===t?void 0:t.getComponentConfigApi)&&this.setLocalFields(this.props.items)})).catch((()=>{})),!e)return;return ye(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?(he(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName));return Object.assign(Object.assign({},t),e)}))}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return he(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(this.formUniqueKey));ge(t,n)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;null==t||t([...e])}popupRender(){const{items:e}=this.props;return t.createElement(ol.Consumer,null,(n=>{const r=n.$$form;return t.createElement("div",{className:Fe("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(_n,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(r.getOriginItems())},Bt("qm.table.columnFilter.reset"))),t.createElement($t,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),i=e.map((e=>e.fieldName));if(ge(n,i))return;r.setExpandHandle(!0);const l=Jl(t);this.changeHandle(l),this.setLocalFields(l)}},e.map((n=>{var i;return t.createElement("li",{key:n.fieldName,className:"item",style:n.noAuth?{display:"none"}:void 0},t.createElement(M,{disabled:(null===(i=n.rules)||void 0===i?void 0:i.findIndex((e=>e.required)))>-1,checked:!n.hidden,onChange:t=>{const{checked:r}=t.target;n.hidden=!r,this.changeHandle(e),this.setLocalFields(e)}}),t.createElement(Ke,{className:"handle",title:Bt("qm.form.draggable")}),t.createElement("span",{className:"title"},r.getFormItemLabel(n.label)))}))))}))}render(){const{visible:e}=this.state,n=Dn("form-fields-filter");return t.createElement(ol.Consumer,null,(r=>{const{$size:i}=r.$$form,l={[n]:!0,[`${n}--lg`]:"large"===i,[`${n}--sm`]:"small"===i};return t.createElement(q,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Fe(l),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},t.createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t.createElement(ze,null)))}))}}Ko.contextType=Vt;const zo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(ol),{value:i,onChange:l,onValuesChange:o}=e,{options:a={},style:s={},placeholder:c=Bt("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h,onBlur:m=Tn,onEnter:f=Tn}=e.option,{prefix:g,suffix:v,password:y,maxLength:b,pattern:x,toUpper:E,toTrim:S,autoFocus:w,autoComplete:C,secretType:T}=a,N=T&&(p||h),I=t.useRef(),R=e=>{null==l||l(e),o(e)},O=y?_.Password:_,k=N?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return 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,T):i;return r.isOnlyShow?t.createElement(Do,{value:(e=>e&&y?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):t.createElement(O,{ref:e=>{I.current=e,"function"==typeof n&&n(e)},value:k,autoComplete:y?"new-password":C,autoFocus:w,placeholder:c,style:s,title:y?"":k,prefix:g,suffix:v,maxLength:b,bordered:d,allowClear:u,readOnly:p,disabled:h,onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(S){const e=r.trim();r!==e&&(r=e,R(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),m(r)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;f(n),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=I.current)||void 0===t||t.blur())}},onChange:e=>{let t=e.target.value;be(x)&&(t=x.test(t)?t:null!=i?i:""),E&&(t=t.toUpperCase()),R(t)}})}));zo.displayName="VInput";class Wo extends r{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:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(zo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(l,t)}}))),u&&t.createElement(D,null,e.renderFormItemButton(l,u)),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Wo.contextType=ol;const Bo=e=>{const{$$form:n}=t.useContext(ol),{value:r=[],onChange:i,onValuesChange:l}=e,{options:o={},placeholder:a=Bt("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:p,suffix:h,maxLength:m}=o,f=e=>{const t=e.every((e=>!e))?[]:e;null==i||i(t),l(t,g(t))},g=e=>e.join(" - ");return n.isOnlyShow?t.createElement(Do,{value:g(r),bordered:s}):t.createElement(_.Group,null,t.createElement(_,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:a[0],prefix:p,suffix:h,maxLength:m,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;f([t,r[1]])}}),t.createElement(_,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t.createElement(_,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:a[1],prefix:p,suffix:h,maxLength:m,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;f([r[0],t])}}))};class Uo extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,labelWidth:a=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(s),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(a)},required:e.getFormItemRequired(u)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Bo,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(l,t)}}))),c&&t.createElement(D,{flex:Pn(c.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}Uo.contextType=ol;const Go=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(ol),{value:i,onChange:l,onValuesChange:o}=e,{options:a={},style:s={},placeholder:c=Bt("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:p,onBlur:h=Tn,onEnter:m=Tn}=e.option,{step:f=1,min:g,max:v,precision:y,autoFocus:b,stringMode:x,textAlign:E="left",controls:S=!0,formatter:w,parser:C}=a,T=t.useRef(),N=t.useRef(i),I=e=>{const t=mo(e)?"":ce(e)?e.toFixed(y):new Lt(e).toFixed(y);return"function"==typeof w?w(t):t},R={[E]:!0,controls:S};return r.isOnlyShow?t.createElement(Do,{value:I(i),bordered:d}):t.createElement(j,{ref:e=>{T.current=e,"function"==typeof n&&n(e)},value:i,className:Fe(R),placeholder:c,style:Object.assign({width:"100%"},s),step:f,min:g,max:v,controls:S,precision:y,autoFocus:b,stringMode:x,formatter:w,parser:C,bordered:d,readOnly:u,disabled:p,onBlur:()=>{Rn((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(N.current),h(N.current)}))},onKeyUp:e=>{var t;13===e.keyCode&&(m(i),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=T.current)||void 0===t||t.blur()))},onChange:e=>{const t=null!=e?e:"";!x&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{N.current=e,null==l||l(e),o(e,I(e))})(t)}})}));Go.displayName="VInputNumber";class Yo extends r{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:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Go,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(D,null,e.renderFormItemButton(l,u)),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Yo.contextType=ol;const Xo=e=>{const{$$form:n}=t.useContext(ol),{value:r=[],onChange:i,onValuesChange:l}=e,{options:o={},placeholder:a=Bt("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:p=1,min:h=0,max:m,textAlign:f="left",controls:g=!0,precision:v,formatter:y,parser:b}=o,x=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),E(e)},E=e=>{const t=e.every((e=>null===e))?[]:[...e];null==i||i(t),l(t,S(t))},S=e=>mo(e)?"":e.map((e=>mo(e)?"":Number(e).toFixed(v))),w={[f]:!0,controls:g};return n.isOnlyShow?t.createElement(Do,{value:S(r),bordered:s}):t.createElement(_.Group,null,t.createElement(j,{value:r[0],className:Fe("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:a[0],step:p,min:h,max:m,controls:g,precision:v,formatter:y,parser:b,bordered:s,readOnly:d,disabled:u,onChange:e=>{E([e,r[1]])},onBlur:()=>{x(r)}}),t.createElement(_,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t.createElement(j,{value:r[1],className:Fe("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:a[1],step:p,min:h,max:m,controls:g,precision:v,formatter:y,parser:b,bordered:s,readOnly:d,disabled:u,onChange:e=>{E([r[0],e])},onBlur:()=>{x(r)}}))};class Zo extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,labelWidth:a=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(s),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(a)},required:e.getFormItemRequired(u)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Xo,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(l,t)}}))),c&&t.createElement(D,{flex:Pn(c.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}var Qo;Zo.contextType=ol,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Qo||(Qo={}));const{Search:Jo}=_;class ea extends r{constructor(e){var t;super(e),t=this,this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>En(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||Xt("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)||Xt("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Xt("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>En(this,void 0,void 0,(function*(){var e;yield this.props.waiting();const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:o,fieldAliasMap:a,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof a?a():a||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(!t||kn(u))return this._prevValue=void 0;this.setState({loading:!0});try{const a=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=me(a.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&go(e,this.alias,c),d&&vo(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,o){const t=fo(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(se(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=Nn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,o)=>En(this,void 0,void 0,(function*(){var a;const s=xe({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return o();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!==(a=me(e.data,t.fetch.dataKey))&&void 0!==a?a:[];l(n)}else o()}catch(e){o(e)}finally{Rn((()=>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=fo(e,this.alias[r]);void 0!==i&&(t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i))}for(const n in this.extras){const r=fo(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return En(t,void 0,void 0,(function*(){const{fieldName:t}=this.props.option,r=e.filter((e=>{var r;return null===(r=fo(e,this.alias[t]))||void 0===r?void 0:r.toString().toLowerCase().includes(n.toLowerCase())}));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(n)}))},this.openSearchHelper=(e,t)=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:Nn)(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)r!==n&&t.SET_FIELDS_VALUE({[r]:fo(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:fo(e,this.extras[n])});const r=fo(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});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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){var e;if(null===this._prevValue)return;const t=this.getItemValue();this._prevValue!==t&&t!==(null===(e=this._record)||void 0===e?void 0:e[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=t}render(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l}=this.props,{type:o,fieldName:a,options:s={},searchHelper:c={},style:d={},placeholder:u=Bt("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:Bt("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Qo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:Object.assign({},this.deriveParams,c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(Do,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(Jo,{ref:e=>this[`${o}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,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):Rn((()=>this.clearSearchHelperValue())))}}),t.createElement(ll,b,t.createElement(Ju,x)))}}ea.contextType=ol;class ta extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:o}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=wo(Object.assign({},n.data,l),o,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(ea,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(o,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(o,p)),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}ta.contextType=ol;const na=e=>{class n extends r{constructor(){var e;super(...arguments),e=this,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,o=!i||!l,a=(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=!(o||a||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}}componentDidMount(){this.event1=It(document,"mousedown",this.mousedownHandler),this.event2=It(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,hn({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,hn({},e,{forwardedRef:r}))))};function ra(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 ia(e,t,n,r){var i=Pt.unstable_batchedUpdates?function(e){Pt.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)}}}var la=d((function(e,t){var n=e.didUpdate,r=e.getContainer,i=e.children,l=o(),a=o();u(t,(function(){return{}}));var c=o(!1);return!c.current&&Tr()&&(a.current=r(),l.current=a.current.parentNode,c.current=!0),s((function(){null==n||n(e)})),s((function(){return null===a.current.parentNode&&null!==l.current&&l.current.appendChild(a.current),function(){var e;null===(e=a.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(a.current)}}),[]),a.current?Pt.createPortal(i,a.current):null}));function oa(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var aa;function sa(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 ca(t){var n=t.prefixCls,r=t.visible,i=t.zIndex,l=t.mask,o=t.maskMotion,a=t.maskAnimation,s=t.maskTransitionName;if(!l)return null;var c={};return(o||s||a)&&(c=Bn({motionAppear:!0},sa({motion:o,prefixCls:n,transitionName:s,animation:a}))),e.createElement(ti,ni({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:i},className:Fe("".concat(n,"-mask"),r)})}))}function da(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 ua(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?da(Object(n),!0).forEach((function(t){ha(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):da(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pa(e){return pa="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},pa(e)}function ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ma={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function fa(){if(void 0!==aa)return aa;aa="";var e=document.createElement("p").style;for(var t in ma)t+"Transform"in e&&(aa=t);return aa}function ga(){return fa()?"".concat(fa(),"TransitionProperty"):"transitionProperty"}function va(){return fa()?"".concat(fa(),"Transform"):"transform"}function ya(e,t){var n=ga();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function ba(e,t){var n=va();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var xa,Ea=/matrix\((.*)\)/,Sa=/matrix3d\((.*)\)/;function wa(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Ca(e,t,n){var r=n;if("object"!==pa(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):xa(e,t);for(var i in t)t.hasOwnProperty(i)&&Ca(e,i,t[i])}function Ta(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 Na(e){return Ta(e)}function Ia(e){return Ta(e,!0)}function Ra(e){var t=function(e){var t,n,r,i=e.ownerDocument,l=i.body,o=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=o.clientLeft||l.clientLeft||0,top:r-=o.clientTop||l.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=Na(r),t.top+=Ia(r),t}function Oa(e){return null!=e&&e==e.window}function ka(e){return Oa(e)?e.document:9===e.nodeType?e:e.ownerDocument}var Aa=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),La=/^(top|right|bottom|left)$/,Pa="currentStyle",_a="runtimeStyle",Ha="left";function Fa(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function Da(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function $a(e,t,n){"static"===Ca(e,"position")&&(e.style.position="relative");var r=-999,i=-999,l=Fa("left",n),o=Fa("top",n),a=Da(l),s=Da(o);"left"!==l&&(r=999),"top"!==o&&(i=999);var c,d="",u=Ra(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[ga()]||"",ya(e,"none")),"left"in t&&(e.style[a]="",e.style[l]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[o]="".concat(i,"px")),wa(e);var p=Ra(e),h={};for(var m in t)if(t.hasOwnProperty(m)){var f=Fa(m,n),g="left"===m?r:i,v=u[m]-p[m];h[f]=f===m?g+v:g-v}Ca(e,h),wa(e),("left"in t||"top"in t)&&ya(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=Fa(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}Ca(e,y)}function Ma(e,t){var n=Ra(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(va());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(va());if(r&&"none"!==r){var i,l=r.match(Ea);l?((i=(l=l[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,ba(e,"matrix(".concat(i.join(","),")"))):((i=r.match(Sa)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,ba(e,"matrix3d(".concat(i.join(","),")")))}else ba(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function qa(e,t){for(var n=0;n<e.length;n++)t(e[n])}function ja(e){return"border-box"===xa(e,"boxSizing")}"undefined"!=typeof window&&(xa=window.getComputedStyle?function(e,t,n){var r=n,i="",l=ka(e);return(r=r||l.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[Pa]&&e[Pa][t];if(Aa.test(n)&&!La.test(t)){var r=e.style,i=r[Ha],l=e[_a][Ha];e[_a][Ha]=e[Pa][Ha],r[Ha]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[Ha]=i,e[_a][Ha]=l}return""===n?"auto":n});var Va=["margin","border","padding"],Ka=-1,za=2,Wa=1;function Ba(e,t,n){var r,i,l,o=0;for(i=0;i<t.length;i++)if(r=t[i])for(l=0;l<n.length;l++){var a=void 0;a="border"===r?"".concat(r).concat(n[l],"Width"):r+n[l],o+=parseFloat(xa(e,a))||0}return o}var Ua={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 Ga(e,t,n){var r=n;if(Oa(e))return"width"===t?Ua.viewportWidth(e):Ua.viewportHeight(e);if(9===e.nodeType)return"width"===t?Ua.docWidth(e):Ua.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],l="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),o=ja(e),a=0;(null==l||l<=0)&&(l=void 0,(null==(a=xa(e,t))||Number(a)<0)&&(a=e.style[t]||0),a=Math.floor(parseFloat(a))||0),void 0===r&&(r=o?Wa:Ka);var s=void 0!==l||o,c=l||a;return r===Ka?s?c-Ba(e,["border","padding"],i):a:s?r===Wa?c:c+(r===za?-Ba(e,["border"],i):Ba(e,["margin"],i)):a+Ba(e,Va.slice(r),i)}qa(["Width","Height"],(function(e){Ua["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],Ua["viewport".concat(e)](n))},Ua["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 Ya={position:"absolute",visibility:"hidden",display:"block"};function Xa(){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=Ga.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,Ya,(function(){r=Ga.apply(void 0,t)})),r}function Za(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}qa(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);Ua["outer".concat(t)]=function(t,n){return t&&Xa(t,e,n?0:Wa)};var n="width"===e?["Left","Right"]:["Top","Bottom"];Ua[e]=function(t,r){var i=r;return void 0!==i?t?(ja(t)&&(i+=Ba(t,["padding","border"],n)),Ca(t,e,i)):void 0:t&&Xa(t,e,Ka)}}));var Qa={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:ka,offset:function(e,t,n){if(void 0===t)return Ra(e);!function(e,t,n){if(n.ignoreShake){var r=Ra(e),i=r.left.toFixed(0),l=r.top.toFixed(0),o=t.left.toFixed(0),a=t.top.toFixed(0);if(i===o&&l===a)return}n.useCssRight||n.useCssBottom?$a(e,t,n):n.useCssTransform&&va()in document.body.style?Ma(e,t):$a(e,t,n)}(e,t,n||{})},isWindow:Oa,each:qa,css:Ca,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:Za,getWindowScrollLeft:function(e){return Na(e)},getWindowScrollTop:function(e){return Ia(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Qa.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Za(Qa,Ua);var Ja=Qa.getParent;function es(e){if(Qa.isWindow(e)||9===e.nodeType)return null;var t,n=Qa.getDocument(e).body,r=Qa.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:Ja(e);for(t=Ja(e);t&&t!==n&&9!==t.nodeType;t=Ja(t))if("static"!==(r=Qa.css(t,"position")))return t;return null}var ts=Qa.getParent;function ns(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=es(e),i=Qa.getDocument(e),l=i.defaultView||i.parentWindow,o=i.body,a=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===o||r===a||"visible"===Qa.css(r,"overflow")){if(r===o||r===a)break}else{var s=Qa.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=es(r)}var c=null;Qa.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Qa.css(e,"position")&&(e.style.position="fixed"));var d=Qa.getWindowScrollLeft(l),u=Qa.getWindowScrollTop(l),p=Qa.viewportWidth(l),h=Qa.viewportHeight(l),m=a.scrollWidth,f=a.scrollHeight,g=window.getComputedStyle(o);if("hidden"===g.overflowX&&(m=l.innerWidth),"hidden"===g.overflowY&&(f=l.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Qa.isWindow(e)||9===e.nodeType)return!1;var t=Qa.getDocument(e),n=t.body,r=null;for(r=ts(e);r&&r!==n&&r!==t;r=ts(r))if("fixed"===Qa.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+p),n.bottom=Math.min(n.bottom,u+h);else{var v=Math.max(m,d+p);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 rs(e){var t,n,r;if(Qa.isWindow(e)||9===e.nodeType){var i=Qa.getWindow(e);t={left:Qa.getWindowScrollLeft(i),top:Qa.getWindowScrollTop(i)},n=Qa.viewportWidth(i),r=Qa.viewportHeight(i)}else t=Qa.offset(e),n=Qa.outerWidth(e),r=Qa.outerHeight(e);return t.width=n,t.height=r,t}function is(e,t){var n=t.charAt(0),r=t.charAt(1),i=e.width,l=e.height,o=e.left,a=e.top;return"c"===n?a+=l/2:"b"===n&&(a+=l),"c"===r?o+=i/2:"r"===r&&(o+=i),{left:o,top:a}}function ls(e,t,n,r,i){var l=is(t,n[1]),o=is(e,n[0]),a=[o.left-l.left,o.top-l.top];return{left:Math.round(e.left-a[0]+r[0]-i[0]),top:Math.round(e.top-a[1]+r[1]-i[1])}}function os(e,t,n){return e.left<n.left||e.left+t.width>n.right}function as(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function ss(e,t,n){var r=[];return Qa.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function cs(e,t){return e[t]=-e[t],e}function ds(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function us(e,t){e[0]=ds(e[0],t.width),e[1]=ds(e[1],t.height)}function ps(e,t,n,r){var i=n.points,l=n.offset||[0,0],o=n.targetOffset||[0,0],a=n.overflow,s=n.source||e;l=[].concat(l),o=[].concat(o);var c={},d=0,u=ns(s,!(!(a=a||{})||!a.alwaysByViewport)),p=rs(s);us(l,p),us(o,t);var h=ls(p,t,i,l,o),m=Qa.merge(p,h);if(u&&(a.adjustX||a.adjustY)&&r){if(a.adjustX&&os(h,p,u)){var f=ss(i,/[lr]/gi,{l:"r",r:"l"}),g=cs(l,0),v=cs(o,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(ls(p,t,f,g,v),p,u)||(d=1,i=f,l=g,o=v)}if(a.adjustY&&as(h,p,u)){var y=ss(i,/[tb]/gi,{t:"b",b:"t"}),b=cs(l,1),x=cs(o,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(ls(p,t,y,b,x),p,u)||(d=1,i=y,l=b,o=x)}d&&(h=ls(p,t,i,l,o),Qa.mix(m,h));var E=os(h,p,u),S=as(h,p,u);if(E||S){var w=i;E&&(w=ss(i,/[lr]/gi,{l:"r",r:"l"})),S&&(w=ss(i,/[tb]/gi,{t:"b",b:"t"})),i=w,l=n.offset||[0,0],o=n.targetOffset||[0,0]}c.adjustX=a.adjustX&&E,c.adjustY=a.adjustY&&S,(c.adjustX||c.adjustY)&&(m=function(e,t,n,r){var i=Qa.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)),Qa.mix(i,l)}(h,p,u,c))}return m.width!==p.width&&Qa.css(s,"width",Qa.width(s)+m.width-p.width),m.height!==p.height&&Qa.css(s,"height",Qa.height(s)+m.height-p.height),Qa.offset(s,{left:m.left,top:m.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:i,offset:l,targetOffset:o,overflow:c}}function hs(e,t,n){var r=n.target||t,i=rs(r),l=!function(e,t){var n=ns(e,t),r=rs(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 ps(e,i,n,l)}hs.__getOffsetParent=es,hs.__getVisibleRectForElement=ns;var ms=Tr()?e.useLayoutEffect:e.useEffect,fs=function(t,n){var r=e.useRef(!0);ms((function(){return t(r.current)}),n),ms((function(){return r.current=!1,function(){r.current=!0}}),[])};function gs(e,t){var n=null,r=null;var i=new Nt((function(e){var i=Gn(e,1)[0].target;if(document.documentElement.contains(i)){var l=i.getBoundingClientRect(),o=l.width,a=l.height,s=Math.floor(o),c=Math.floor(a);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 vs(e){return"function"!=typeof e?null:e()}function ys(e){return"object"===Vn(e)&&e?e:null}var bs=function(e,n){var r=e.children,i=e.disabled,l=e.target,o=e.align,a=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),p=t.useRef(),h=t.Children.only(r),m=t.useRef({});m.current.disabled=i,m.current.target=l,m.current.align=o,m.current.onAlign=a;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function l(){window.clearTimeout(i.current)}return[function t(o){if(l(),r.current&&!0!==o)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(o))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,l()}]}((function(){var e=m.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,l=p.current;if(!t&&n&&l){var o,a=vs(n),s=ys(n);u.current.element=a,u.current.point=s,u.current.align=r;var c=document.activeElement;return a&&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,o=i.height;if(l||o)return!0}}return!1}(a)?o=hs(l,a,r):s&&(o=function(e,t,n){var r,i,l=Qa.getDocument(e),o=l.defaultView||l.parentWindow,a=Qa.getWindowScrollLeft(o),s=Qa.getWindowScrollTop(o),c=Qa.viewportWidth(o),d=Qa.viewportHeight(o),u={left:r="pageX"in t?t.pageX:a+t.clientX,top:i="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},p=r>=0&&r<=a+c&&i>=0&&i<=s+d,h=[n.points[0],"cc"];return ps(e,u,ua(ua({},n),{},{points:h}),p)}(l,s,r)),function(e,t){e!==document.activeElement&&ra(t,e)&&"function"==typeof e.focus&&e.focus()}(c,l),i&&o&&i(l,o),!0}return!1}),d),g=Gn(f,2),v=g[0],y=g[1],b=Gn(t.useState(),2),x=b[0],E=b[1],S=Gn(t.useState(),2),w=S[0],C=S[1];return fs((function(){E(vs(l)),C(ys(l))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=w)||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,o=r.has(t);if(ln(!o,"Warning: There may be circular references"),o)return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);var a=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],a))return!1;return!0}if(t&&i&&"object"===Vn(t)&&"object"===Vn(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every((function(n){return e(t[n],i[n],a)}))}return!1}(e,t)}(u.current.align,o)||v()})),t.useEffect((function(){return gs(p.current,v)}),[p.current]),t.useEffect((function(){return gs(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return ia(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:tr(h.ref,p)})),h},xs=t.forwardRef(bs);function Es(){Es=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",o=i.asyncIterator||"@@asyncIterator",a=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 p?t:p,o=Object.create(l.prototype),a=new T(i||[]);return r(o,"_invoke",{value:E(e,n,a)}),o}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 p(){}function h(){}function m(){}var f={};s(f,l,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(N([])));v&&v!==t&&n.call(v,l)&&(f=v);var y=m.prototype=p.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,o,a){var s=d(e[r],e,l);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==Vn(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,o,a)}),(function(e){i("throw",e,o,a)})):t.resolve(u).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,a)}))}a(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 o=n.delegate;if(o){var a=S(o,n);if(a){if(a===u)continue;return a}}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 S(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,S(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 w(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function N(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=m,r(y,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:h,configurable:!0}),h.displayName=s(m,a,"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,m):(e.__proto__=m,s(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,o,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,l){void 0===l&&(l=Promise);var o=new x(c(t,n,r,i),l);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(y),s(y,a,"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=N,T.prototype={constructor:T,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(C),!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 o.type="throw",o.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],o=l.completion;if("root"===l.tryLoc)return r("end");if(l.tryLoc<=this.prev){var a=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(a&&s){if(this.prev<l.catchLoc)return r(l.catchLoc,!0);if(this.prev<l.finallyLoc)return r(l.finallyLoc)}else if(a){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 o=l?l.completion:{};return o.type=e,o.arg=t,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(o)},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),C(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;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function Ss(e,t,n,r,i,l,o){try{var a=e[l](o),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(r,i)}function ws(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var l=e.apply(t,n);function o(e){Ss(l,r,i,o,a,"next",e)}function a(e){Ss(l,r,i,o,a,"throw",e)}o(void 0)}))}}xs.displayName="Align";var Cs=["measure","alignPre","align",null,"motion"],Ts=e.forwardRef((function(t,n){var r=t.visible,i=t.prefixCls,l=t.className,a=t.style,c=t.children,d=t.zIndex,u=t.stretch,h=t.destroyPopupOnHide,m=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,S=t.onMouseDown,w=t.onTouchStart,C=t.onClick,T=o(),N=o(),I=Gn(p(),2),R=I[0],O=I[1],k=function(t){var n=Gn(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,o=r.height;Math.abs(t-l)<1&&Math.abs(n-o)<1&&(t=l,n=o),i({width:t,height:n})}]}(u),A=Gn(k,2),L=A[0],P=A[1];var _=function(e,t){var n=Gn(mr(null),2),r=n[0],i=n[1],l=o();function a(e){i(e,!0)}function c(){Gr.cancel(l.current)}return s((function(){a("measure")}),[e]),s((function(){"measure"===r&&t(),r&&(l.current=Gr(ws(Es().mark((function e(){var t,n;return Es().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Cs.indexOf(r),(n=Cs[t+1])&&-1!==t&&a(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),s((function(){return function(){c()}}),[]),[r,function(e){c(),l.current=Gr((function(){a((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){u&&P(v())})),H=Gn(_,2),F=H[0],D=H[1],$=Gn(p(0),2),M=$[0],q=$[1],j=o();function V(){var e;null===(e=T.current)||void 0===e||e.forceAlign()}function K(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===F&&(null==b||b(e,t))}fs((function(){"alignPre"===F&&q(0)}),[F]),fs((function(){"align"===F&&(M<3?V():D((function(){var e;null===(e=j.current)||void 0===e||e.call(j)})))}),[M]);var z=Bn({},sa(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 D(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==F||D()}),[z.motionName,F]),e.useImperativeHandle(n,(function(){return{forceAlign:V,getElement:function(){return N.current}}}));var B=Bn(Bn({},L),{},{zIndex:d,opacity:"motion"!==F&&"stable"!==F&&r?0:void 0,pointerEvents:r||"stable"===F?void 0:"none"},a),U=!0;null==f||!f.points||"align"!==F&&"stable"!==F||(U=!1);var G=c;return e.Children.count(c)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},c)),e.createElement(ti,ni({visible:r,ref:N,leavedClassName:"".concat(i,"-hidden")},z,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:h,forceRender:m}),(function(t,n){var r=t.className,o=t.style,a=Fe(i,l,R,r);return e.createElement(xs,{target:g||v,key:"popup",ref:T,monitorWindowResize:!0,disabled:U,align:f,onAlign:K},e.createElement("div",{ref:n,className:a,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:S,onTouchStartCapture:w,onClick:C,style:Bn(Bn({},o),B)},G))}))}));Ts.displayName="PopupInner";var Ns=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,l=t.zIndex,o=t.children,a=t.mobile,s=(a=void 0===a?{}:a).popupClassName,c=a.popupStyle,d=a.popupMotion,u=void 0===d?{}:d,p=a.popupRender,h=t.onClick,m=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return m.current}}}));var f=Bn({zIndex:l},c),g=o;return e.Children.count(o)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},o)),p&&(g=p(g)),e.createElement(ti,ni({visible:i,ref:m,removeOnLeave:!0},u),(function(t,n){var i=t.className,l=t.style,o=Fe(r,s,i);return e.createElement("div",{ref:n,className:o,onClick:h,style:Bn(Bn({},l),f)},g)}))}));Ns.displayName="MobilePopupInner";var Is=["visible","mobile"],Rs=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,l=rr(t,Is),o=Gn(p(r),2),a=o[0],c=o[1],d=Gn(p(!1),2),u=d[0],h=d[1],m=Bn(Bn({},l),{},{visible:a});s((function(){c(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=u?e.createElement(Ns,ni({},m,{mobile:i,ref:n})):e.createElement(Ts,ni({},m,{ref:n}));return e.createElement("div",null,e.createElement(ca,m),f)}));Rs.displayName="Popup";var Os=e.createContext(null);function ks(){}function As(){return""}function Ls(e){return e?e.ownerDocument:window.document}var Ps=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var _s=function(t){var n=function(n){cr(i,e.Component);var r=pr(i);function i(t){var n,l;return lr(this,i),zn(ur(n=r.call(this,t)),"popupRef",e.createRef()),zn(ur(n),"triggerRef",e.createRef()),zn(ur(n),"portalContainer",void 0),zn(ur(n),"attachId",void 0),zn(ur(n),"clickOutsideHandler",void 0),zn(ur(n),"touchOutsideHandler",void 0),zn(ur(n),"contextMenuOutsideHandler1",void 0),zn(ur(n),"contextMenuOutsideHandler2",void 0),zn(ur(n),"mouseDownTimeout",void 0),zn(ur(n),"focusTime",void 0),zn(ur(n),"preClickTime",void 0),zn(ur(n),"preTouchTime",void 0),zn(ur(n),"delayTimer",void 0),zn(ur(n),"hasPopupMouseDown",void 0),zn(ur(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),zn(ur(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),zn(ur(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),zn(ur(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),zn(ur(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&ra(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),zn(ur(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),zn(ur(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),zn(ur(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),zn(ur(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),zn(ur(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),zn(ur(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),zn(ur(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)})),zn(ur(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)})),zn(ur(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();ra(r,t)&&!n.isContextMenuOnly()||ra(i,t)||n.hasPopupMouseDown||n.close()}})),zn(ur(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=Xn(n.triggerRef.current);if(t)return t}catch(e){}return Pt.findDOMNode(ur(n))})),zn(ur(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,l=r.builtinPlacements,o=r.prefixCls,a=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&l&&t.push(function(e,t,n,r){for(var i=n.points,l=Object.keys(e),o=0;o<l.length;o+=1){var a=l[o];if(oa(e[a].points,i,r))return"".concat(t,"-placement-").concat(a)}return""}(l,o,e,a)),s&&t.push(s(e)),t.join(" ")})),zn(ur(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,l=t.popupClassName,o=t.onPopupAlign,a=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,p=t.maskAnimation,h=t.maskTransitionName,m=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,S=n.state,w=S.popupVisible,C=S.point,T=n.getPopupAlign(),N={};return n.isMouseEnterToShow()&&(N.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(N.onMouseLeave=n.onPopupMouseLeave),N.onMouseDown=n.onPopupMouseDown,N.onTouchStart=n.onPopupMouseDown,e.createElement(Rs,ni({prefixCls:r,destroyPopupOnHide:i,visible:w,point:y&&C,className:l,align:T,onAlign:o,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},N,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:p,maskTransitionName:h,maskMotion:m,ref:n.popupRef,motion:a,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),zn(ur(n),"attachParent",(function(e){Gr.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,l=r.getDocument,o=n.getRootDomNode();i?(o||0===i.length)&&(t=i(o)):t=l(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=Gr((function(){n.attachParent(e)}))})),zn(ur(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})),zn(ur(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),zn(ur(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),zn(ur(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),l="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:l,popupVisible:l},Ps.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return ar(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=ia(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=ia(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=ia(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=ia(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),Gr.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 Bn(Bn({},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,o=r.alignPoint,a=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,o&&(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=Fe(c&&c.props&&c.props.className,a);u&&(d.className=u);var p=Bn({},d);nr(c)&&(p.ref=tr(this.triggerRef,c.ref));var h,m=e.cloneElement(c,p);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(Os.Provider,{value:this.triggerContextValue},m,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 zn(n,"contextType",Os),zn(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:As,getDocument:Ls,onPopupVisibleChange:ks,afterPopupVisibleChange:ks,onPopupAlign:ks,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}(la);let Hs=class extends r{constructor(e){var n;super(e),n=this,this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>En(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Xt("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Xt("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=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:r}=n.alias;n.setRecords(Ee([...n._records.filter((e=>t.includes(e[r]))),...e],r));const i=n.recordsToDict();n.setItemList(i),n.triggerChange(i.map((e=>e.value)));const{closed:l}=n.searchHelper;n.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(n._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;ge(Se(n,r),r)||ge(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return En(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:o=(e=>e),dataKey:a,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&&!kn(u)){this.setState({loading:!0});try{const e=yield i(o(Object.assign(Object.assign({},l),{keys:u})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=me(e.data,a))&&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:o,loading:a,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=Bt("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:l,title:Bt("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Qo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},S=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:xe({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),w=s.filter((e=>null==c?void 0:c.includes(e.value))),T=t.createElement("ul",{className:"ant-dropdown-menu"},w.length?w.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},Bt("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=Dn("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(Do,{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(_s,{popupVisible:!y&&o,popup:T,popupClassName:Fe(O),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:lo,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement($,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:a,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($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:y,icon:t.createElement(We,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(ll,E,t.createElement(Ju,S)))}};Hs.contextType=ol,Hs=xn([na],Hs);class Fs extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:o}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=wo(Object.assign({},n.data,l),o,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Hs,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(o,n)}}))),p&&t.createElement(D,null,e.renderFormItemButton(o,p)),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}Fs.contextType=ol;const{Search:Ds}=_;class $s extends r{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>En(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||Xt("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)||Xt("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Xt("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>En(this,void 0,void 0,(function*(){var e;yield this.props.waiting();const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:o,fieldAliasMap:a,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof a?a():a||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(!t||kn(u))return this._prevValue=void 0;this.setState({loading:!0});try{const a=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=me(a.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&go(e,this.alias,c),d&&vo(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,o){const t=fo(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=fo(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:fo(e,this.extras[n])})},this.openSearchHelper=e=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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)r!==n&&t.SET_FIELDS_VALUE({[r]:fo(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:fo(e,this.extras[n])});const r=fo(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});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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){var e;if(null===this._prevValue)return;const t=this.getItemValue();this._prevValue!==t&&t!==(null===(e=this._record)||void 0===e?void 0:e[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=t}render(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l=""}=this.props,{type:o,fieldName:a,options:s={},searchHelper:c={},style:d={},placeholder:u=Bt("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:Bt("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Qo[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:xe({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(Do,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(Ds,{ref:e=>this[`${o}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,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(ll,b,t.createElement(rp,x)))}}$s.contextType=ol;class Ms extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:o}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=wo(Object.assign({},n.data,l),o,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement($s,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(o,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(o,p)),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}Ms.contextType=ol;let qs=class extends r{constructor(e){var n;super(e),n=this,this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>En(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Xt("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Xt("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=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:r}=n.alias;n.setRecords(Ee([...n._records.filter((e=>t.includes(e[r]))),...e],r));const i=n.recordsToDict();n.setItemList(i),n.triggerChange(i.map((e=>e.value)));const{closed:l}=n.searchHelper;n.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(n._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;ge(Se(n,r),r)||ge(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return En(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:o=(e=>e),dataKey:a,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&&!kn(d)){this.setState({loading:!0});try{const e=yield i(o(Object.assign(Object.assign({},l),{keys:d})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=me(e.data,a))&&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:o,loading:a,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=Bt("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:l,title:Bt("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Qo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},S=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:xe({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),w=s.filter((e=>null==c?void 0:c.includes(e.value))),T=t.createElement("ul",{className:"ant-dropdown-menu"},w.length?w.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},Bt("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=Dn("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(Do,{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(_s,{popupVisible:!y&&o,popup:T,popupClassName:Fe(O),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:lo,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement($,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:a,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($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:y,icon:t.createElement(We,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(ll,E,t.createElement(rp,S)))}};qs.contextType=ol,qs=xn([na],qs);class js extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:o}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=wo(Object.assign({},n.data,l),o,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(qs,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(o,n)}}))),p&&t.createElement(D,null,e.renderFormItemButton(o,p)),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}js.contextType=ol;const Vs=new Array(2).fill("");class Ks extends r{constructor(e){var t;super(e),t=this,this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:Vs},this.getSearchHelper=kt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>En(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Xt("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Xt("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(Vs),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=>En(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Nn)(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]:kn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Nn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,o)=>En(this,void 0,void 0,(function*(){var a;const s=xe({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return o();this.setState({loading:!0});const e=yield t.fetch.api(s);if(Rn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=me(e.data,t.fetch.dataKey))&&void 0!==a?a:[];return l(n)}}catch(e){this.setState({loading:!1})}o()}))))},this.resetSearchHelperValue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return En(t,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;ge(Se(t,n),n)||ge(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!ge(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=Vs.map(((e,t)=>{var l,o;return null!==(o=null===(l=r[i].find((e=>e.value===n[t])))||void 0===l?void 0:l.text)&&void 0!==o?o:""}));this.setTextValue(e)}}getItemList(){var e;return En(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:o,fieldAliasMap:a}=this.searchHelper.echoRequest||{},s="function"==typeof a?a():a||{},{value:c}=this.props;if(r&&!kn(c)){this.setState({loading:!0});try{const a=yield r(l(Object.assign(Object.assign({},i),{keys:c})));if(200===a.code){let r=Array.isArray(a.data)?a.data:null!==(e=me(a.data,o))&&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:o,options:a={},searchHelper:s={},placeholder:c=Bt("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=l.every((e=>mo(e)))?"":l.join(" - "),f={visible:r,title:Bt("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Qo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:xe({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(Do,{value:m,bordered:d}):t.createElement(t.Fragment,null,t.createElement(_.Group,null,t.createElement(_,{value:l[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,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(_,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),t.createElement(_.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:p,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(ll,f,t.createElement(ap,g)))}}Ks.contextType=ol;class zs extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("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 Xt("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:o}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=wo(Object.assign({},n.data,l),o,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ks,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{m(t,r),e.setViewValue(o,n)}}))),u&&t.createElement(D,null,e.renderFormItemButton(o,u)),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},d)))))}}zs.contextType=ol;const Ws=e=>{const{$$form:n}=t.useContext(ol),{value:r,items:i,onChange:l,onValuesChange:o}=e,{options:a={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=a,h=kn(p)?i:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(Do,{value:m(r),bordered:c}):t.createElement(M.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==l||l(e),o(e,m(e))})(e)}},h.map((e=>t.createElement(M,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Bs extends r{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;ge(r,i)||this.getItemList()}getItemList(){var e;return En(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:o="text",callback:a}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[o]})));this.setState({itemList:r},(()=>null==a?void 0:a(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ws,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(o,n)}}))),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}Bs.contextType=ol;const Us=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{options:o={},style:a={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=o,m=e=>h?h[Math.ceil(e)-1]:e.toString();return t.createElement(V,{value:r,count:p,style:a,allowHalf:u,allowClear:s,tooltips:h,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==i||i(e),l(e,m(e))})(e)}})};class Gs extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Us,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Gs.contextType=ol;const Ys=e=>{const{$$form:n}=t.useContext(ol),{value:r,items:i,onChange:l,onValuesChange:o}=e,{options:a={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:p=[]}=a,h=kn(p)?i:p,m=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(Do,{value:m(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==l||l(e),o(e,m(e))})(t)}},h.map((e=>t.createElement(K,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Xs extends r{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:o="text",callback:a}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[o]})));this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(h)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Ys,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(o,n)}}))),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}Xs.contextType=ol;const Zs=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{label:o,options:a={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=no,trueValue:h=to}=a;return t.createElement(t.Fragment,null,t.createElement(z,{checked:r===h,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement(Be,null),unCheckedChildren:t.createElement(Ue,null),onChange:e=>{(e=>{null==i||i(e),l(e,Bt(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},o):null)};class Qs extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option,{labelToSwitch:m}=a;return t.createElement(H.Item,{label:m?" ":e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Zs,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Qs.contextType=ol;const Js=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{options:o={},style:a={},placeholder:s=Bt("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p,onBlur:h=Tn,onEnter:m=Tn}=e.option,{showCount:f,maxLength:g,autoSize:v}=o,y=Object.assign({},{minRows:1,maxRows:3},v);return t.createElement(_.TextArea,{value:r,placeholder:s,style:a,maxLength:g,showCount:f,autoSize:y,bordered:c,allowClear:d,readOnly:u||n.isOnlyShow,disabled:p,onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),h(n)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;m(t)}},onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),l(e)})(t)}})};class ec extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Js,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ec.contextType=ol;const tc=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{fieldName:o,options:a={},style:s={},placeholder:c=Bt("qm.form.datePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{dateType:m="date",format:f,disabledDate:v,minDateTime:y,maxDateTime:b,shortCuts:x=!0}=a,E=t.createRef(),S=e=>{e&&"date"===m&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),l(e,w(e))},w=e=>mo(e)?"":["date","exactdate"].includes(m)?e.slice(0,10):e,C=e=>{let t=ho(g().subtract(e,"day"),ao[m]);"date"===m&&(t=t.slice(0,10)),S(t),E.current.blur(),E.current.focus()};return n.isOnlyShow?t.createElement(Do,{value:w(r),bordered:d}):t.createElement(pn,{ref:E,style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${o}`,picker:oo[m],format:f,bordered:d,showToday:!1,showTime:"datetime"===m&&{defaultValue:g("00:00:00","HH:mm:ss")},allowClear:u,disabled:h,inputReadOnly:p,disabledDate:null!=v?v:e=>((e,t)=>{let[n,r]=t;return n&&r?e.isBefore(n,"day")||e.isAfter(r,"day"):n?e.isBefore(n,"day"):!!r&&e.isAfter(r,"day")})(e,[y,b]),renderExtraFooter:x&&m.includes("date")?()=>"function"==typeof x?x():t.createElement(t.Fragment,null,t.createElement(W,{color:"processing",onClick:()=>C(0)},Bt("qm.form.datePickers")[0]),t.createElement(W,{color:"processing",onClick:()=>C(1)},Bt("qm.form.datePickers")[1]),t.createElement(W,{color:"processing",onClick:()=>C(7)},Bt("qm.form.datePickers")[2]),t.createElement(W,{color:"processing",onClick:()=>C(30)},Bt("qm.form.datePickers")[3])):void 0,value:po(r,ao[m]),onChange:(e,t)=>{S(ho(e,ao[m]))}})};class nc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(tc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}nc.contextType=ol;const rc=e=>[g().subtract(e,"day"),g()],ic=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{fieldName:o,options:a={},style:s={},placeholder:c=Bt("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=n.isFormDisabled}=e.option,{dateType:m="date",format:f,disableds:v=[!1,!1],allowEmpty:y,disabledDate:b,minDateTime:x,maxDateTime:E,shortCuts:S=!0}=a,w={[Bt("qm.form.dateRangePickers")[0]]:rc(7),[Bt("qm.form.dateRangePickers")[1]]:rc(30),[Bt("qm.form.dateRangePickers")[2]]:rc(90),[Bt("qm.form.dateRangePickers")[3]]:rc(180)},C=e=>mo(e)?"":e.map((e=>["date","exactdate"].includes(m)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(Do,{value:C(r),bordered:d}):t.createElement(pn.RangePicker,{style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${o}`,picker:oo[m],format:f,bordered:d,showTime:"datetime"===m&&{defaultValue:[g("00:00:00","HH:mm:ss"),g("23:59:59","HH:mm:ss")]},allowClear:u,allowEmpty:y,disabled:h?[!0,!0]:v,inputReadOnly:p,disabledDate:null!=b?b:e=>((e,t)=>{let[n,r]=t;return n&&r?e.isBefore(n,"day")||e.isAfter(r,"day"):n?e.isBefore(n,"day"):!!r&&e.isAfter(r,"day")})(e,[x,E]),ranges:S&&m.includes("date")?w:void 0,value:kn(r)?null:[po(null==r?void 0:r[0],ao[m]),po(null==r?void 0:r[1],ao[m])],onChange:(e,t)=>{(e=>{"date"===m&&(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,C(e))})([ho(null==e?void 0:e[0],ao[m]),ho(null==e?void 0:e[1],ao[m])])}})};class lc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ic,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}lc.contextType=ol;const oc=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{fieldName:o,options:a={},style:s={},placeholder:c=Bt("qm.form.timePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:v=1}=a;return n.isOnlyShow?t.createElement(Do,{value:r,bordered:d}):t.createElement(mn,{style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${o}`,bordered:d,showNow:!0,hourStep:f,minuteStep:g,secondStep:v,allowClear:u,disabled:h,inputReadOnly:p,format:so[m],value:po(r,so[m]),onChange:(e,t)=>{(e=>{const t=ho(e,so[m]);null==i||i(t),l(t)})(e)}})};class ac extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(oc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ac.contextType=ol;const sc=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{fieldName:o,options:a={},style:s={},placeholder:c=Bt("qm.form.timerangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=n.isFormDisabled}=e.option,{timeType:m="hour-minute-second",disableds:f=[!1,!1],allowEmpty:g,hourStep:v=1,minuteStep:y=1,secondStep:b=1}=a,x=e=>mo(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(Do,{value:x(r),bordered:d}):t.createElement(mn.RangePicker,{style:Object.assign({width:"100%"},s),popupClassName:`form-popper__${o}`,bordered:d,showNow:!1,hourStep:v,minuteStep:y,secondStep:b,allowClear:u,allowEmpty:g,disabled:h?[!0,!0]:f,inputReadOnly:p,format:so[m],value:kn(r)?null:[po(null==r?void 0:r[0],so[m]),po(null==r?void 0:r[1],so[m])],onChange:(e,t)=>{(e=>{const t=[ho(null==e?void 0:e[0],so[m]),ho(null==e?void 0:e[1],so[m])];null==i||i(t),l(t,x(t))})(e)}})};class cc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(sc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}cc.contextType=ol;class dc extends r{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=kt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.initialHandle=()=>En(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||Xt("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)||Xt("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),l&&!this.valueKey&&Xt("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&Xt("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getItemText=()=>En(this,void 0,void 0,(function*(){var e;yield this.props.waiting();const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:o,fieldAliasMap:a,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof a?a():a||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(!t||kn(u))return this._prevValue=void 0;try{const a=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=me(a.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&go(e,this.alias,c),d&&vo(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,o){const t=fo(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=fo(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:fo(e,this.extras[n])})},this.fetchHandle=we(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)t!==r&&n.SET_FIELDS_VALUE({[t]:fo(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:fo(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=fo(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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){var t,n,r,i,l,o,a;const s=(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),c=(null===(l=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===l?void 0:l.params)||(null===(o=this.props.option.request)||void 0===o?void 0:o.params);if(ge(s,c)||this.getItemList(),null===this._prevValue)return;const d=this.getItemValue();this._prevValue!==d&&d!==(null===(a=this._record)||void 0===a?void 0:a[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=d}getItemList(e){var t;return En(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:o}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const a=yield r(l(Object.assign(Object.assign({},i),{[n]:e})));if(200===a.code){const e=Array.isArray(a.data)?a.data:null!==(t=me(a.data,o))&&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:o}=this.props,{fieldName:a,options:s={},style:c={},placeholder:d=Bt("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=ro}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=Dn("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t.createElement(R,{spinning:r},i.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:Fe("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},me(e,n.dataIndex))))))))):t.createElement(Li,null));return t.createElement(Vt.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(Do,{value:o,bordered:u}):t.createElement(_s,{action:m?[]:["click"],popupVisible:!m&&n,popup:E,popupClassName:Fe(s,`form-popper__${a}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:lo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(_,{ref:this.searchRef,placeholder:d,allowClear:p,bordered:u,readOnly:h,disabled:m,style:Object.assign({width:"100%"},c),value:null!=l?l:o,title:o,onFocus:()=>{!i.length&&this.fetchHandle(o)},onBlur:e=>{v&&!this._clicking&&l!==o&&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)}})))}))}}dc.contextType=ol;class uc extends r{constructor(e,t){let{$$form:n}=t;super(e),this.state={searchHelper:{}},this.waiting=()=>En(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Yt("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 Xt("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:o}=this.props.option;this.promiseRef=new Promise(((e,t)=>En(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=wo(Object.assign({},n.data,l),o,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:o,invisible:a,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(i),className:Fe(d),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Pn(c)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(dc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(o,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(o,p)),u&&t.createElement(D,{flex:Pn(u.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:o},u)))))}}uc.contextType=ol;class pc extends r{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:l,className:o,style:a={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:p=Tn}=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(H.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement($n,{id:l,label:i,className:o,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},a),collapse:c[l],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[l]:e})}))),p(e)}}))}}pc.contextType=ol;const hc=(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:hc(e.children,t,n,r)}):e)),mc=e=>{const{$$form:n}=t.useContext(ol),{value:r,items:i,multiple:l,loading:o,onChange:a,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=Bt("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:f,readOnly:g,disabled:v}=e.option,{itemList:y,filterable:b=!0,listHeight:x=ro,checkStrictly:E,checkStrategy:S="SHOW_CHILD",collapseTags:w,defaultExpandAll:C=!f,defaultExpandedKeys:T,dropdownStyle:N,openPyt:I=!0}=d,[R,O]=t.useState(kn(y)?i:y),k=t.useRef(R);fi((()=>{const e=kn(y)?i:y;f?ge(e,k.current)||(O(e),k.current=e):O(e)}),[y,i]);const A=e=>{var t;return(null===(t=bo(R,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},L=e=>l?(null==e?void 0:e.map((e=>A(e))).join(","))||"":A(e);return n.isOnlyShow?t.createElement(Do,{value:L(r),bordered:h}):t.createElement(B,hn({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:l,treeCheckable:l,treeCheckStrictly:E,showCheckedStrategy:B[S],popupClassName:`form-popper__${c}`,dropdownStyle:N,placeholder:p,listHeight:x,style:u,loading:o,bordered:h,allowClear:m,disabled:v,treeDefaultExpandAll:C,treeDefaultExpandedKeys:T,showSearch:b,maxTagCount:w?"responsive":void 0,loadData:f?e=>{let{key:t,children:n}=e;return En(void 0,void 0,void 0,(function*(){var e;if(!f||n)return;const{fetchApi:r,params:i,dataKey:l,textKey:o="text",valueKey:a="value",callback:s,formatter:c=(e=>e)}=f;if(r)try{const n=yield r(c(Object.assign(Object.assign({},i),{[a]:t})));if(200===n.code){const r=Array.isArray(n.data)?n.data:null!==(e=me(n.data,l))&&void 0!==e?e:[],i=hc(R,t,a,yo(r,a,o));O(i),null==s||s(r)}}catch(e){}}))}:void 0,treeData:R},l?{title:L(r)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=Ho.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(I?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==a||a(e),s(e,L(e),R)})(e)}}))};class fc extends r{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:o="text",callback:a}=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=me(t.data,i))&&void 0!==e?e:[],r=yo(n,l,o);this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:o,fieldName:a,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(l),className:Fe(u),tooltip:o,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Pn(d)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(mc,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(a,n)}}))),p&&t.createElement(D,{flex:Pn(p.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:a},p)))))}}fc.contextType=ol;const gc=e=>{const{$$form:n}=t.useContext(ol),{value:r,multiple:i,items:l}=e,{fieldName:o,options:a={},style:s={},placeholder:c=Bt("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,asyncLoad:p,readOnly:h,disabled:m}=e.option,{itemList:f,changeOnSelect:g,checkStrictly:v,checkStrategy:y="SHOW_PARENT",filterable:b=!0,dropdownStyle:x,openPyt:E=!0}=a,[S,w]=t.useState(kn(f)?l:f),C=t.useRef(S);fi((()=>{const e=kn(f)?l:f;p?ge(e,C.current)||(w(e),C.current=e):w(e)}),[f,l]);const T=e=>xo(S,null!=e?e:"").map((e=>e.text)).join("/"),N=e=>i?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement(Do,{value:N(r),bordered:d}):t.createElement(U,hn({value:(e=>kn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:S,multiple:i,maxTagCount:"responsive",changeOnSelect:g||v,showCheckedStrategy:U[y],popupClassName:`form-popper__${o}`,dropdownStyle:x,placeholder:c,style:s,bordered:d,allowClear:u,disabled:m,showSearch:b&&!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())||"",i=Ho.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(E?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?e=>En(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!p||n.children)return;const{fetchApi:r,params:i,dataKey:l,textKey:o="text",valueKey:a="value",callback:s,formatter:c=(e=>e)}=p;if(r)try{const e=yield r(c(Object.assign(Object.assign({},i),{[a]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=me(e.data,l))&&void 0!==t?t:[],i=hc(S,n.value,a,yo(r,a,o));w(i),null==s||s(r)}}catch(e){}})):void 0},i?{title:N(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,N(t),S)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return i?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class vc extends r{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>En(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:o="text",callback:a}=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=me(t.data,i))&&void 0!==e?e:[],r=yo(n,l,o);this.setState({itemList:r},(()=>null==a?void 0:a(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;ge(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:i,label:l,tooltip:o,fieldName:a,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(l),className:Fe(u),tooltip:o,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Pn(d)},required:e.getFormItemRequired(m)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(gc,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(a,n)}}))),p&&t.createElement(D,{flex:Pn(p.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:a},p)))))}}vc.contextType=ol;const yc=["110000","120000","310000","500000"],bc=["810000","820000"],xc=[{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"}],Ec=[{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"}],Sc=e=>Ho.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),wc=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...yc,...bc].includes(e))):Object.keys(e[t])).map((r=>({l:Sc(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:wc(e,r,n+1)})))},Cc=(e,t)=>t.map((t=>({l:Sc(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Tc extends r{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}),Rt(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:Cc(jt,yc)},{l:"Z2",n:"港澳",c:"",p:"",children:Cc(jt,bc)}]}createProvince(){var e;return(null!==(e=wc(jt,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Ec.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...yc,...bc].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"},Bt("qm.form.citySelectType.0")),t.createElement(K.Button,{value:"1"},Bt("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?xc:Ec).map((n=>t.createElement("li",{key:n.value,className:Fe({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement($,{size:"small",placeholder:Bt("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($.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:Fe({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:o={},placeholder:a=Bt("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=Dn("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},o)},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(Vt.Consumer,null,(r=>{const l={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(Do,{value:m,bordered:s}):t.createElement(_s,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:Fe(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:lo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(_,{ref:this.searchRef,placeholder:a,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},o),value:m,title:m,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Tc.contextType=ol;class Nc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Tc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Nc.contextType=ol;const Ic=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Ic(e,n)})))};class Rc extends r{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=Ic(jt,"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=bo(e,t[r]);if(i&&kn(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 En(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:i=(e=>e),dataKey:l,valueKey:o="value",textKey:a="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=me(n.data,l))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[a],value:e[o]})))]})))}}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)||`${Bt("qm.form.selectPlaceholder").replace("...","")}(${Bt("qm.form.regionSelectLabel")[r]})`;return t.createElement(tl.TabPane,{key:r.toString(),tab:l},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:Fe({"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(tl,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(Li,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:o={},placeholder:a=Bt("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=Dn("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=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(Vt.Consumer,null,(r=>{const l={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(Do,{value:f,bordered:s}):t.createElement(_s,{action:u?[]:["click"],popupVisible:!u&&n,popup:m,popupClassName:Fe(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:lo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(_,{ref:this.searchRef,placeholder:a,allowClear:c,bordered:s,style:Object.assign({width:"100%"},o),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&Rn((()=>this.initial()))}})))}))}}Rc.contextType=ol;class Oc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Rc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Oc.contextType=ol;const kc=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{options:o={},upload:a={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fileTypes:h,fileSize:m,fileDirection:f,onPreview:g,onRemove:v}=o,{action:y,headers:b,params:x,withCredentials:E=!1,dataKey:S="",downloadWithHeaders:w,fieldAliasMap:C,beforeUpload:T,button:N}=a,I="function"==typeof C?C():C||{};return t.createElement(Yi,{name:"file",action:y,multiple:u,headers:b,data:x,withCredentials:E,downloadWithHeaders:w,beforeUpload:T,maxCount:p,fileTypes:h,fileSize:m,fileDirection:f,disabled:c,readOnly:n.isOnlyShow||d,button:N,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(qe,null)},fileList:r,onChange:e=>{let{file:t,fileList:n}=e;(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in I)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[I[i]])||"";return e.response&&200!==n.code&&k.error(n.message||Bt("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(S?me(n.data,S):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(n)},onPreview:g,onRemove:v})};class Ac extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(kc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Ac.contextType=ol;const Lc=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{options:o={},upload:a={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fixedSize:h,quality:m,openCropper:f,fileTypes:g,fileSize:v,onRemove:y}=o,{action:b,headers:x,params:E,withCredentials:S=!1,dataKey:w="",popupClassName:C,fieldAliasMap:T,beforeUpload:N}=a,I="function"==typeof T?T():T||{};return t.createElement(nd,{name:"file",action:b,multiple:u,headers:x,data:E,withCredentials:S,popupClassName:C,beforeUpload:N,maxCount:p,fixedSize:h,quality:m,openCropper:f,fileTypes:g,fileSize:v,disabled:c,readOnly:n.isOnlyShow||d,fileList:r,onChange:e=>{let{file:t,fileList:n}=e;(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in I)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[I[i]])||"";return e.response&&200!==n.code&&k.error(n.message||Bt("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(w?me(n.data,w):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(n)},onRemove:y})};class Pc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Lc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Pc.contextType=ol;const _c=e=>{const{$$form:n}=t.useContext(ol),{value:r,onChange:i,onValuesChange:l}=e,{options:o={},upload:a,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=o;return t.createElement(Jc,{value:r,tinymce:u,upload:a,thresholdSize:p,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{null==i||i(e),l(e)})(e)}})};class Hc extends r{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:o,options:a={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Tn}=this.props.option;return t.createElement(H.Item,{label:e.renderFormLabel(r),className:Fe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Pn(s)},required:e.getFormItemRequired(p)},t.createElement(F,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(H.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(_c,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Pn(d.labelWidth||eo)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Hc.contextType=ol;class Fc extends r{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=we(this.resizeObserveHandler,10),this.getFormItems=kt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=kt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{se(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=e=>{let{values:t,errorFields:n}=e;var r,i;null===(i=(r=this.props).onFinishFailed)||void 0===i||i.call(r,n)},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(","),"]")})));G.error({message:Bt("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Rt(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(){Fi(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){Di(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&&Xt("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).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=>se(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=>se(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,io.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:no),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=Ln(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";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){var t,n;e!==this.state.collapse&&(this.setState({collapse:e}),null===(n=(t=this.props).onCollapse)||void 0===n||n.call(t,e),Rn((()=>{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(Eo(e))return So(e);if(se(e)){const{fieldName:o,label:a,options:s={}}=e;if(Eo(a))return So(a);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([o])[o])&&void 0!==n?n:this._initialValues[o])&&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(e){let{type:t,fieldName:n}=e;var r,i;if("DIVIDER"===t)return!0;const l=this.getBlockDerivedItems();for(let e=0,t=l.length;e<t;e++){const t=l[e],o=this.dividers.find((e=>e.fieldName===t[0].fieldName)),a=null!==(i=null===(r=null==o?void 0:o.collapse)||void 0===r?void 0:r.showLimit)&&void 0!==i?i:t.length-1;for(let e=1;e<t.length;e++){if(t[e].fieldName===n&&e>a)return this.state.expand[t[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(mo(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{mo(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[l,o]=r.split("|");e[l]=null!==(t=i[0])&&void 0!==t?t:"",e[o]=null!==(n=i[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)kn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return En(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=An(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?me(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:o}=n;i||(e.noAuth=!0,r.noAuth=!0),l&&(e.disabled=!0,r.disabled=!0),o&&(e.options?e.options.secretType=o:e.options={secretType:o},r.options=Object.assign({},r.options,{secretType:o})),this.setFieldAuth(t,{visible:i,disabled:l,secretName:o})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(Wo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(Uo,{option:e})}INPUT_NUMBER(e){return t.createElement(Yo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(Zo,{option:e})}SEARCH_HELPER(e){return t.createElement(ta,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(Fs,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(Ms,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(js,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(zs,{option:e})}CHECKBOX(e){return t.createElement(Vo,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Bs,{option:e})}RATE(e){return t.createElement(Gs,{option:e})}RADIO(e){return t.createElement(Xs,{option:e})}SWITCH(e){return t.createElement(Qs,{option:e})}TEXT_AREA(e){return t.createElement(ec,{option:e})}DATE(e){return t.createElement(nc,{option:e})}RANGE_DATE(e){return t.createElement(lc,{option:e})}TIME(e){return t.createElement(ac,{option:e})}RANGE_TIME(e){return t.createElement(cc,{option:e})}SELECT(e){return t.createElement(qo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(qo,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(uc,{option:e})}DIVIDER(e){return t.createElement(pc,{option:e})}TREE_SELECT(e){return t.createElement(fc,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(fc,{option:e,multiple:!0})}CASCADER(e){return t.createElement(vc,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(vc,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(Nc,{option:e})}REGION_SELECT(e){return t.createElement(Oc,{option:e})}UPLOAD_FILE(e){return t.createElement(Ac,{option:e})}UPLOAD_IMG(e){return t.createElement(Pc,{option:e})}TINYMCE(e){return t.createElement(Hc,{option:e})}renderFormLabel(e){if(Eo(e)||!se(e))return e;const{type:n,fieldName:r,label:i,options:l={},onChange:o=Tn}=e,{itemList:a=[]}=l;return"SELECT"===n?t.createElement(H.Item,{name:r,noStyle:!0},t.createElement(Mo,{option:e,items:a,loading:!1,onValuesChange:(e,t)=>o(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{style:{paddingRight:5}},i),t.createElement(H.Item,{name:r,noStyle:!0},t.createElement(jo,{option:e,onValuesChange:e=>o(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:l}=e,{extra:o}=this.state;if(r)return t.createElement(Y,{className:"extra-tooltip",title:o[n]},t.createElement(Ge,{style:{marginLeft:4}}));const a=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:l?"":o[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},l?l(a,this):o[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:o,labelWidth:a=this.props.labelWidth,rules:s=[],style:c={},render:d}=e;return kn(this.state.formData)?null:t.createElement(H.Item,{label:this.renderFormLabel(n),name:r,rules:s,tooltip:l,hidden:i,className:Fe(o),style:Object.assign({width:"100%"},c),labelCol:{flex:this.verticalLayout?"initial":Pn(a)}},null==d?void 0:d(e,this))}createFormItem(e){return de(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(Xt("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 o=24/e,a=[],s=l.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return a.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)||a[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(a[r]),t.createElement(D,{key:null!=s?s:r,className:s,span:i*o,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},l?this.createFormItem(Ln(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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:n,collapse:r}=this.state,{searchButtonCols:i,isSearchBtn:l,isFieldsDefine:o=!0}=this.props;if(!this.isFilterType)return null;const a=24/n,s=i||1,c=n-e%n-s;return l?t.createElement(D,{key:"-",span:s*a,offset:c*a,style:{textAlign:"right"}},t.createElement(N,{style:{marginBottom:12}},t.createElement(_n,{type:"primary",size:this.$size,icon:t.createElement(We,null),onClick:()=>this.SUBMIT_FORM()},Bt("qm.form.search")),t.createElement(_n,{size:this.$size,icon:t.createElement(Ye,null),onClick:()=>this.RESET_FORM()},Bt("qm.form.reset")),o?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(De,null):t.createElement($e,null)," ",Bt(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(F,{gutter:0},t.createElement(D,{key:"-",span:i},t.createElement(H.Item,null,t.createElement(N,{style:{marginBottom:12}},t.createElement(_n,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},Bt("qm.form.save")),t.createElement(_n,{size:this.$size,onClick:()=>this.RESET_FORM()},Bt("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(Ko,{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)=>En(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:[Bt("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 En(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 En(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 En(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){Xt("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 Xt("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!se(t))return Xt("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(l.noAuth)return Xt("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||ve(l,n,t[n]));n&&(i?i([...r]):Xt("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:l,labelAlign:o,labelWrap:a,customClass:s}=this.props,c=Dn("form"),d={required:"${label}"+Bt("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:Fe(u,e),style:n},t.createElement(H,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:o,labelWrap:a,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Pn(l)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(ol.Provider,{value:this.provide},t.createElement(F,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Fc.contextType=Vt,Fc.propTypes=co,Fc.defaultProps=uo;const Dc={onActivate:m.func,onAddUndo:m.func,onBeforeAddUndo:m.func,onBeforeExecCommand:m.func,onBeforeGetContent:m.func,onBeforeRenderUI:m.func,onBeforeSetContent:m.func,onBeforePaste:m.func,onBlur:m.func,onChange:m.func,onClearUndos:m.func,onClick:m.func,onContextMenu:m.func,onCommentChange:m.func,onCopy:m.func,onCut:m.func,onDblclick:m.func,onDeactivate:m.func,onDirty:m.func,onDrag:m.func,onDragDrop:m.func,onDragEnd:m.func,onDragGesture:m.func,onDragOver:m.func,onDrop:m.func,onExecCommand:m.func,onFocus:m.func,onFocusIn:m.func,onFocusOut:m.func,onGetContent:m.func,onHide:m.func,onInit:m.func,onKeyDown:m.func,onKeyPress:m.func,onKeyUp:m.func,onLoadContent:m.func,onMouseDown:m.func,onMouseEnter:m.func,onMouseLeave:m.func,onMouseMove:m.func,onMouseOut:m.func,onMouseOver:m.func,onMouseUp:m.func,onNodeChange:m.func,onObjectResizeStart:m.func,onObjectResized:m.func,onObjectSelected:m.func,onPaste:m.func,onPostProcess:m.func,onPostRender:m.func,onPreProcess:m.func,onProgressState:m.func,onRedo:m.func,onRemove:m.func,onReset:m.func,onSaveContent:m.func,onSelectionChange:m.func,onSetAttrib:m.func,onSetContent:m.func,onShow:m.func,onSubmit:m.func,onUndo:m.func,onVisualAid:m.func,onSkinLoadError:m.func,onThemeLoadError:m.func,onModelLoadError:m.func,onPluginLoadError:m.func,onIconsLoadError:m.func,onLanguageLoadError:m.func},$c=Object.assign({apiKey:m.string,id:m.string,inline:m.bool,init:m.object,initialValue:m.string,onEditorChange:m.func,value:m.string,tagName:m.string,cloudChannel:m.string,plugins:m.oneOfType([m.string,m.array]),toolbar:m.oneOfType([m.string,m.array]),disabled:m.bool,textareaName:m.string,tinymceScriptSrc:m.string,rollback:m.oneOfType([m.number,m.oneOf([!1])]),scriptLoading:m.shape({async:m.bool,defer:m.bool,delay:m.number})},Dc),Mc=e=>"function"==typeof e,qc=e=>e in Dc,jc=e=>e.substr(2),Vc=(e,t,n,r,i)=>((e,t,n,r,i,l,o)=>{const a=Object.keys(i).filter(qc),s=Object.keys(l).filter(qc),c=a.filter((e=>void 0===l[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=jc(e),r=o[t];n(t,r),delete o[t]})),d.forEach((n=>{const i=r(e,n),l=jc(n);o[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 Kc=0;const zc=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return Kc++,e+"_"+n+Kc+String(t)},Wc=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Bc=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Uc=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Gc=()=>({listeners:[],scriptId:zc("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Yc=(()=>{let e=Gc();return{load:(t,n,r,i,l,o)=>{const a=()=>((e,t,n,r,i,l)=>{const o=t.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=e,o.src=n,o.async=r,o.defer=i;const a=()=>{o.removeEventListener("load",a),l()};o.addEventListener("load",a),t.head&&t.head.appendChild(o)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?o():(e.listeners.push(o),e.scriptLoading||(e.scriptLoading=!0,l>0?setTimeout(a,l):a()))},reinitialize:()=>{e=Gc()}}})(),Xc=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Zc extends e.Component{constructor(t){var n,r,i,l;super(t),n=this,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=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t,r,i;const l=n.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((()=>n.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>n.initialise(e+1)),100)}return}const o=Xc(n.view);if(!o)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},n.props.init),{selector:void 0,target:l,readonly:n.props.disabled,inline:n.inline,plugins:(s=null===(t=n.props.init)||void 0===t?void 0:t.plugins,c=n.props.plugins,Bc(s).concat(Bc(c))),toolbar:null!==(r=n.props.toolbar)&&void 0!==r?r:null===(i=n.props.init)||void 0===i?void 0:i.toolbar,setup:e=>{n.editor=e,n.bindHandlers({}),n.inline&&!Wc(l)&&e.once("PostRender",(t=>{e.setContent(n.getInitialValue(),{no_events:!0})})),n.props.init&&Mc(n.props.init.setup)&&n.props.init.setup(e)},init_instance_callback:e=>{var t,r;const i=n.getInitialValue();n.currentContent=null!==(t=n.currentContent)&&void 0!==t?t:e.getContent(),n.currentContent!==i&&(n.currentContent=i,e.setContent(i),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const l=null!==(r=n.props.disabled)&&void 0!==r&&r;Uc(n.editor,l?"readonly":"design"),n.props.init&&Mc(n.props.init.init_instance_callback)&&n.props.init.init_instance_callback(e)}});var s,c;n.inline||(l.style.visibility=""),Wc(l)&&(l.value=n.getInitialValue()),o.init(a)},this.id=this.props.id||zc("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(l=null!==(r=this.props.inline)&&void 0!==r?r:null===(i=this.props.init)||void 0===i?void 0:i.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;Uc(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,l;null!==Xc(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Yc.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=Xc(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){Vc(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 Qc;Zc.propTypes=$c,Zc.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Qc||(Qc={}));class Jc extends r{constructor(){super(...arguments),this.defaultOption={height:400,plugins:"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",menubar:"file edit view insert format tools table help",toolbar:"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"}}render(){var e;const{size:n,className:r,style:i,tinymce:l={},upload:o={},thresholdSize:a=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:p}=this.props,h=this.context.global,m=this.context.locale,f=n||this.context.size||"",g=Dn("tinymce"),v={[g]:!0,[`${g}--lg`]:"large"===f,[`${g}--sm`]:"small"===f},y={init:Object.assign(Object.assign({height:l.height||this.defaultOption.height,plugins:l.plugins||this.defaultOption.plugins,toolbar:l.toolbar||this.defaultOption.toolbar,menubar:l.menubar||this.defaultOption.menubar,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:Qc[m],skin:"tinymce-5"},An(l,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>new Promise(((t,n)=>En(this,void 0,void 0,(function*(){const{action:n,headers:r,dataKey:i}=o,l=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(n&&c/1024/1024>a)try{const e=yield fetch(n,{method:"POST",body:s,headers:r});if(!e.ok)throw new Error(Bt("qm.upload.uploadError"));const l=yield e.json();if(200===l.code){const e=i?me(l.data,i):l.data;t(e)}}catch(e){k.error(Bt("qm.uploadCropper.uploadError"))}else t(l)})))),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),value:d,disabled:c,tinymceScriptSrc:s||(null===(e=null==h?void 0:h.tinymce)||void 0===e?void 0:e.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==p||p(t.getContent(),t)}};return t.createElement("div",{className:Fe(v,r),style:i},t.createElement(Zc,y))}}Jc.contextType=Vt,Jc.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Tinymce","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")}};class ed extends r{constructor(){super(...arguments),this.imgRef=t.createRef()}componentDidMount(){const e=bn(this.props,["className","style","src","alt","imgStyle"]),t={};for(const n in e)void 0!==this.props[n]&&(t[n]=this.props[n]);this.cropper=new At(this.imgRef.current,t)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:n,src:r,alt:i,imgStyle:l}=this.props,o={[Dn("cropper")]:!0};return t.createElement("div",{className:Fe(o,e),style:n},t.createElement("img",{ref:this.imgRef,src:r,alt:i,style:Object.assign({maxWidth:"100%"},l)}))}}ed.defaultProps={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};class td extends r{constructor(){super(...arguments),this.cropperRef=t.createRef(),this.state={src:""},this.confirmHandle=()=>En(this,void 0,void 0,(function*(){const{quality:e}=this.props,{type:t,name:n,uid:r}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((e=>En(this,void 0,void 0,(function*(){let i=new File([e],n,{type:t});Object.assign(i,{uid:r});const{fileTypes:l=[],fileSize:o}=this.props;if(!(!l.length||l.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase())))return k.warning(Bt("qm.upload.tooltip",{type:l.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(i);const a=this.beforeUploadRef(i,[i]);if("boolean"==typeof a||a){if(!0===a)return this.resolveRef(i);if(!1===a)return this.rejectRef("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),this.resolveRef(i)}catch(e){this.rejectRef(e)}}else Xt("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),t,e),yield In(100),this.onClose()})),this.onOk=()=>{this.confirmHandle()},this.onClose=()=>{this.setSrc("")}}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:n}=this.props,r=Array.isArray(e)?e[0]:e;if(!r)return null;const i=r.props,{beforeUpload:l}=i,o=bn(i,["beforeUpload"]);return this.beforeUploadRef=l,t.createElement(r.type,Object.assign(Object.assign({},o),{beforeUpload:(e,t)=>new Promise(((r,i)=>En(this,void 0,void 0,(function*(){const i=()=>r(O.LIST_IGNORE);if(n&&!(yield n(e,t)))return void i();this.fileRef=e,this.resolveRef=r,this.rejectRef=i;const l=new FileReader;l.onload=()=>{this.setSrc(l.result),l.onload=null},l.readAsDataURL(e)}))))}))}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(ed,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(N,{size:"small"},t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Xe,null),onClick:()=>this.scaleHandle(.2)},Bt("qm.uploadCropper.zoomIn")),t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Ze,null),onClick:()=>this.scaleHandle(-.2)},Bt("qm.uploadCropper.zoomOut")),t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Qe,null),onClick:()=>this.rotateHandle(90)},Bt("qm.uploadCropper.rotatePlus")),t.createElement(C,{type:"primary",size:"middle",icon:t.createElement(Je,null),onClick:()=>this.rotateHandle(-90)},Bt("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:this.previewSize})))}render(){const{className:e}=this.props,{src:n}=this.state,r=Dn("cropper-preview");return t.createElement(t.Fragment,null,this.renderUpload(),n&&t.createElement(P,{open:!0,wrapClassName:Fe(r,e),title:Bt("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}td.contextType=Vt;class nd extends r{constructor(){super(...arguments),this.state={previewVisible:!1,currentIndex:0},this.isFocused=!1,this.beforeUpload=(e,t)=>new Promise(((n,r)=>En(this,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:l,beforeUpload:o}=this.props,a=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!l||e.size/1024/1024<l,c=a&&s;if(a||k.warning(Bt("qm.upload.tooltip",{type:i.join(",")})),s||k.warning(Bt("qm.upload.sizeLimit",{size:l})),!c)return O.LIST_IGNORE;if(o){const i=o(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)})))),this.handlePreview=e=>{var t;this.setState({currentIndex:(null===(t=this.props.fileList)||void 0===t?void 0:t.findIndex((t=>t.url===e.url)))||0,previewVisible:!0})},this.handlePaste=e=>En(this,void 0,void 0,(function*(){const{fileList:t=[],action:n,data:r,headers:i,onChange:l}=this.props;if(this.isFocused&&this.showUploadButton&&n)for(const o of e.clipboardData.items)if("file"===o.kind&&o.type.startsWith("image/")){const e=o.getAsFile(),a=Date.now(),s=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(s,{uid:`rc-upload-${a}`});try{yield this.beforeUpload(s,[...t,s]);const e=new FormData;if(e.append("file",s),r)for(const t in r)e.append(t,r[t]);const o="string"==typeof n?n:yield n(s),a=yield fetch(o,{method:"POST",body:e,headers:i});if(!a.ok)throw new Error(Bt("qm.upload.uploadError"));const c=yield a.json();null==l||l({file:s,fileList:[...t,{uid:s.uid,lastModified:s.lastModified,lastModifiedDate:s.lastModifiedDate,name:s.name,type:s.type,size:s.size,response:c,status:"done",percent:100,originFileObj:s}]})}catch(e){}}}))}get $size(){var e;return null!==(e=this.context.size)&&void 0!==e?e:""}get showUploadButton(){var e,t;const n=null!==(t=null===(e=this.props.fileList)||void 0===e?void 0:e.length)&&void 0!==t?t:0;return!this.props.maxCount||n<this.props.maxCount}componentDidMount(){document.addEventListener("paste",this.handlePaste)}componentDidUpdate(e){const{fileList:t}=e,{fileList:n}=this.props;t===n||this.showUploadButton||(this.isFocused=!1)}componentWillUnmount(){document.removeEventListener("paste",this.handlePaste)}render(){const{previewVisible:e,currentIndex:n}=this.state,{fileList:r=[],fixedSize:i,quality:l,fileTypes:o,fileSize:a,disabled:s,readOnly:c,className:d,popupClassName:u,openCropper:p,beforeCrop:h}=this.props,m=Dn("upload-img"),f={[m]:!0,[`${m}--lg`]:"large"===this.$size,[`${m}--sm`]:"small"===this.$size},g=s||c,v=t.createElement(O,hn({className:Fe(f,d)},An(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:g,onPreview:this.handlePreview,showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,n,r,i)=>t.createElement("div",{className:"upload-item"},e,!g&&t.createElement(Ue,{title:Bt("qm.upload.remove"),className:"icon",onClick:()=>i.remove()}))}),!this.showUploadButton||c&&r.length?null:t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(et,null)),t.createElement("p",{className:"ant-upload-text"},Bt("qm.uploadCropper.dragableText")),t.createElement("button",{className:Fe("ant-upload-button",{disabled:g}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{this.isFocused=!0},onBlur:()=>{this.isFocused=!1}},Bt("qm.uploadCropper.pasteText"))));return t.createElement(t.Fragment,null,p?t.createElement(td,{className:u,fixedSize:i,quality:l,fileTypes:o,fileSize:a,beforeCrop:h},v):v,t.createElement("div",{style:{display:"none"}},t.createElement(X.PreviewGroup,{preview:{visible:e,current:n,rootClassName:u,onVisibleChange:e=>{this.setState({previewVisible:e})}}},r.map((e=>t.createElement(X,{key:e.uid,src:e.url,alt:""}))))))}}nd.contextType=Vt,nd.defaultProps={name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0};const rd=(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=rd(l.children,t,n);e&&(r=e)}}return r},id=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&id(e.children,t),t(e)||e.children&&e.children.length))),ld=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ld(e.children,t)),t(e)&&n.push(e)})),n},od=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=od(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},ad=(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:ad(e.children,t,n,r)}):e)),sd=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...sd(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},cd=(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=cd(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},dd=(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(...dd(e,t)))),r},ud=t.forwardRef(((e,n)=>{const{className:r,style:i,filterable:l=!0,multiple:o,draggable:a,dataSource:s,fetch:c,asyncLoad:d,checkStrictly:u,checkStrategy:p="SHOW_CHILD",placeholder:h=Bt("qm.form.inputPlaceholder"),fieldsDefine:m,value:f,height:g,defaultSelectedKeys:v=[],defaultExpandAll:y=!0,showSearchBar:b=!0,showCollapse:x=!0,onSelectChange:E,onCheckChange:S,onDragStart:w,onDragChange:C,onExpand:T}=e,{size:N}=t.useContext(Vt),I=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:N)&&void 0!==n?n:""}),[e.size,N]),R=(null==m?void 0:m.valueKey)||"value",O=(null==m?void 0:m.textKey)||"text";null==m||m.children;const k=t.useRef(null),A=$i(k),[L,P]=t.useState(g),[H,F]=t.useState(!1),D=ji((()=>{P(k.current.offsetHeight-X.current.offsetHeight-10)}),5);qi((()=>{g||D()}),[A.height]);const[$,M]=t.useState([]),[q,j]=t.useState({}),[V,K]=t.useState([]),[z,W]=t.useState([]),[B,U]=t.useState(""),[G,Y]=t.useState(y),X=t.useRef(null),Q=t.useRef([]),J=t.useRef([]);t.useEffect((()=>{Array.isArray(s)&&(ee(s),K(te(s)),j({}))}),[s]),t.useEffect((()=>{ie()}),[]),fi((()=>{ie()}),[null==c?void 0:c.params]),fi((()=>{W(re())}),[q]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=od($,(t=>e===t[R]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],ee([...$]))},REMOVE_RECORD:e=>{var t;const n=rd($,e,R);if(void 0===n&&$.find((t=>t[R]===e)))ee($.filter((t=>t[R]!==e)));else{const r=od($,(e=>n===e[R]));if(!r)return;const i=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[R]));i>=0&&(r.children.splice(i,1),ee([...$]))}},UPDATE_RECORD:(e,t)=>{const n=od($,(t=>e===t[R]));n&&(xe(n,t),ee([...$]))}})));const ee=e=>{M(e),Q.current=e,J.current=sd(e,R)},te=e=>{if(o)return v;const t=ld(e,(e=>v.includes(e[O])));return 1===t.length?[t[0][R]]:[]},ne=e=>{var t;return(null===(t=cd($,e,R))||void 0===t?void 0:t.slice(0,-1))||[]},re=()=>{if(y)return J.current;const e=[];return V.forEach((t=>{if(o){if("SHOW_ALL"===p&&!J.current.includes(t)&&e.push(...ne(t)),"SHOW_CHILD"===p&&e.push(...ne(t)),"SHOW_PARENT"===p){const n=bo($,t);if(n){const r=ne(t),i=dd(n,R);e.push(...r,...[t,...i].filter((e=>J.current.includes(e))))}}}else e.push(...ne(t))})),[...new Set(e)]},ie=()=>En(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{F(!0);const o=yield t(n);if(200===o.code){let t=Array.isArray(o.data)?o.data:null!==(e=me(o.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,ee(t),K(te(t)),j({}),null==l||l(t)}}catch(e){}F(!1)})),le=e=>`${e}|${Ho.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe=Dn("search-tree"),ae={[oe]:!0,[`${oe}--lg`]:"large"===I,[`${oe}--sm`]:"small"===I};return t.createElement("div",{ref:k,className:Fe(ae,r),style:i},t.createElement("div",{ref:X,className:"topper"},b&&t.createElement(_.Search,{value:B,size:I,placeholder:h,allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=id(Q.current,(t=>{if(!e)return!0;const n=t[O]||"";return-1!==le(n).indexOf(e)}));U(e),M(t),y||e?W(sd(t,R)):j({})})(e.target.value)}),x&&t.createElement("a",{className:"trigger",onClick:()=>{Y(!G),W(G?[]:J.current)}},G?t.createElement(De,null):t.createElement($e,null)," ",Bt(G?"qm.form.collect":"qm.form.spread"))),t.createElement(Pi,{spinning:H},t.createElement(Z,{fieldNames:{title:O,key:R,children:"children"},multiple:o,draggable:a,blockNode:a,checkable:o,selectable:!o,height:L,disabled:e.disabled,checkStrictly:u,selectedKeys:null!=f?f:V,checkedKeys:null!=f?f:V,expandedKeys:z,treeData:$,loadData:d?e=>{let{key:t,children:n}=e;return En(void 0,void 0,void 0,(function*(){var e;if(!c||n)return;const{api:r,params:i,dataKey:l,formatter:o=(e=>e),afterFetch:a}=c;try{const n=yield r(o(Object.assign(Object.assign({},i),{[R]:t})));if(200===n.code){let r=Array.isArray(n.data)?n.data:null!==(e=me(n.data,l))&&void 0!==e?e:[];r="function"==typeof a?yield a(r):r;const i=ad(Q.current,t,R,r);ee(i)}}catch(e){}}))}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!B)return!1;const t=e[O]||"";return-1!==le(t).indexOf(B)},onDragStart:w,onDragEnter:e=>{W(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][R]===t)return n(e[r],r,e);e[r].children&&l(e[r].children,t,n)}},o=[...$];let a;if(l(o,n,((e,t,n)=>{n.splice(t,1),a=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)l(o,t,(e=>{e.children=e.children||[],e.children.unshift(a)}));else{let e,n=[];l(o,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,a):n.splice(e+1,0,a)}else l(o,t,(e=>{e.children=e.children||[],e.children.unshift(a)}));ee(o)},onDragEnd:e=>{null==C||C(e,$)},onExpand:(e,t)=>{kn(e)&&Y(!1),J.current.every((t=>e.includes(t)))&&Y(!0),W(e),null==T||T(e,t)},onSelect:e=>{K(e);const t=ld(Q.current,(t=>e.includes(me(t,R))));null==E||E(o?t:t[0])},onCheck:e=>{u&&(e=e.checked),K(e),"SHOW_CHILD"===p&&(e=e.filter((e=>!J.current.includes(e)))),"SHOW_PARENT"===p&&(e=e.filter(((e,t,n)=>!n.includes(rd($,e,R)))));const t=ld(Q.current,(t=>e.includes(me(t,R))));null==S||S(o?t:t[0])}})))}));ud.displayName="QmSearchTree";const pd=n(void 0),hd={dataIndex:f.string.isRequired,title:f.string.isRequired,description:f.string,colSpan:f.number,width:f.number,minWidth:f.number,fixed:f.oneOf(["left","right"]),align:f.oneOf(["left","center","right"]),theadAlign:f.oneOf(["left","center","right"]),printFixed:f.bool,hidden:f.bool,noAuth:f.bool,noFixed:f.bool,ellipsis:f.bool,className:f.string,theadClassName:f.string,children:f.array,sorter:f.oneOfType([f.bool,f.func]),filter:f.shape({type:f.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:f.arrayOf(f.shape({text:f.string,value:f.oneOfType([f.string,f.number])})),style:f.object}),precision:f.number,displayPrecision:f.number,formatType:f.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:f.bool,canCopy:f.bool,editRender:f.func,dictItems:f.arrayOf(f.shape({text:f.string,value:f.oneOfType([f.string,f.number])})),summation:f.shape({sumBySelection:f.bool,displayWhenNotSelect:f.bool,dataKey:f.string,unit:f.string,render:f.func}),groupSummary:f.shape({dataKey:f.string,unit:f.string,render:f.func}),shouldCellUpdate:f.func,headRender:f.func,render:f.func};f.arrayOf(f.shape(hd)).isRequired,f.func,f.array,f.oneOfType([f.string,f.func]).isRequired,f.number,f.bool,f.bool,f.shape({api:f.func.isRequired,params:f.object.isRequired,formatter:f.func,beforeFetch:f.func,afterFetch:f.func,stopToFirst:f.bool,dataKey:f.string,callback:f.func}),f.bool,f.bool,f.string,f.string,f.bool,f.bool,f.bool,f.bool,f.oneOfType([f.object,f.func]),f.oneOfType([f.object,f.func]),f.array,f.func,f.bool,f.object,f.object,f.shape({type:f.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:f.array,selectedRowKeys:f.array,hideSelectAll:f.bool,checkStrictly:f.bool,filterable:f.bool,selectByClickRow:f.bool,selectFirstRowOnChange:f.bool,clearableAfterFetched:f.bool,selectAllOnCurrentPage:f.bool,fetchSelectedRows:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),fetchAllRowKeys:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),disabled:f.func,onChange:f.func,onSelect:f.func,onSelectAll:f.func}),f.shape({currentRowKey:f.oneOfType([f.number,f.string]),disabled:f.func,onChange:f.func}),f.shape({virtual:f.bool,doubleXScrollbar:f.bool}),f.shape({virtual:f.bool,expandIconColumn:f.string}),f.shape({defaultExpandAllRows:f.bool,defaultExpandedRowKeys:f.array,expandedRowKeys:f.array,hideExpandAll:f.bool,rowExpandable:f.func,expandedRowClassName:f.string,expandedRowRender:f.func,onExpand:f.func,onChange:f.func}),f.shape({cellMerge:f.bool,onCellMerge:f.func,onSelectChange:f.func}),f.shape({groupItems:f.arrayOf(f.shape({dataIndex:f.string.isRequired,titleIndex:f.string,color:f.string,backgroundColor:f.string})),fetch:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),onChange:f.func}),f.func,f.bool,f.bool,f.bool,f.bool,f.shape({current:f.number,pageSize:f.number,pageSizeOptions:f.array,showSizeChanger:f.bool,showQuickJumper:f.bool}),f.shape({fileName:f.string,fetch:f.shape({api:f.func.isRequired,params:f.object}),beforeExport:f.func,cellStyle:f.bool,hideIcon:f.bool}),f.shape({showLogo:f.bool}),f.shape({fetch:f.shape({api:f.func.isRequired,params:f.object,dataKey:f.string}),fieldList:f.arrayOf(f.object)}),f.shape({position:f.oneOf(["top","bottom"]),hideAlert:f.bool,hideClearButton:f.bool}),f.oneOf(["left","right"]),f.func,f.func,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.bool,f.func,f.func,f.func,f.func,f.func,f.func,f.func,f.func,f.func;const md={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},fd=10,gd="1",vd="0",yd="YYYY-MM-DD",bd="YYYY-MM-DD HH:mm:ss",xd="YYYYMMDDHHmmss",Ed={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 Sd;function wd(t){const n=e.useRef();n.current=t;const r=e.useCallback((function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null===(e=n.current)||void 0===e?void 0:e.call(n,...r)}),[]);return r}!function(e){e.left="flex-start",e.right="flex-end"}(Sd||(Sd={}));let Cd=0;const Td=Object.assign({},e).useId;var Nd=Td?function(e){const t=Td();return e||t}:function(t){const[n,r]=e.useState("ssr-id");return e.useEffect((()=>{const e=Cd;Cd+=1,r(`qm_unique_${e}`)}),[]),t||n};let Id=[];const Rd={getFocusInstance:function(){var e;return null!==(e=Id[0])&&void 0!==e?e:null},getInstance:function(e){var t;return null!==(t=Id.find((t=>t.id===e)))&&void 0!==t?t:null},focus:function(e){const t=this.getInstance(e);t&&0!==Id.findIndex((e=>e===t))&&(this.deregister(e),Id=[t,...Id])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Id=[{id:e,vm:t},...Id])},deregister:function(e){e&&(Id=Id.filter((t=>t.id!==e)))}};class Od{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 kd={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:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};function Ad(e){return void 0!==e}function Ld(t,n){const{defaultValue:r,value:i,onChange:l,postState:o}=n||{},[a,s]=e.useState((()=>Ad(i)?i:Ad(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=Ad(i)?i:a,d=o?o(c):c,u=wd(l),[p,h]=e.useState([c]);qi((()=>{const e=p[0];a!==e&&u(a,e)}),[p]),qi((()=>{Ad(i)||s(i)}),[i]);return[d,wd((e=>{s(e),h([c])}))]}let Pd;const _d=()=>{var e;if(Sn)return 0;if(void 0!==Pd)return Pd;const t=document.createElement("div");t.className="qm-scrollbar__wrap",t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const n=t.offsetWidth;t.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",t.appendChild(r);const i=r.offsetWidth;return null===(e=t.parentNode)||void 0===e||e.removeChild(t),Pd=n-i,Pd},Hd=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=Hd(t.children)),t})),Fd=(e,n)=>{const{fetch:r,columns:i,height:l,minHeight:o,maxHeight:a,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:h,scrollPagination:m,showSuperSearch:f,showFastSearch:g,showGroupSummary:v,showTableImport:y,showClipboard:b,showSelectCollection:x,footRender:E}=e,{tableRef:S,getRowKey:w,tableFullData:C,tableData:T,selectionKeys:N,sorter:I,filters:R,superFilters:O,pagination:k,mergedTdCells:A}=n,{selectionRows:L,summaries:P}=S.current,{expandIconColumn:_=""}=p||{},H=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]})(Hd(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:kd.selectionColumn,title:"radio"===t?Bt("qm.table.config.selectionText"):"",width:kd.selectionColumnWidth,fixed:"left",type:t}})(c),r=(null==(i=u)?void 0:i.expandedRowRender)?{dataIndex:kd.expandableColumn,title:"",width:kd.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),Sl(t)},F=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),D=t.useMemo((()=>!F&&!!h),[F,h]),$=t.useMemo((()=>F&&!!m),[F,m]),M=t.useMemo((()=>(F||D)&&!$),[F,D,$]),q=t.useMemo((()=>!!(l||o||a)),[l,o,a]),j=t.useMemo((()=>H(i)),[i]),V=t.useMemo((()=>El(j)),[j]),K=t.useMemo((()=>V.filter((e=>"function"==typeof e.editRender))),[V]),z=t.useMemo((()=>V.filter((e=>!!e.summation))),[V]),W=t.useMemo((()=>V.filter((e=>"left"===e.fixed))),[V]),B=t.useMemo((()=>V.filter((e=>"right"===e.fixed))),[V]),U=t.useMemo((()=>(e=>{const t=[];return e.forEach((e=>{const n=C.find((t=>w(t,t.index)===e.rowKey)),r=V.findIndex((t=>t.dataIndex===e.dataIndex));if(!n||r<0)return;const i={row:n.index,col:r,rowSpan:e.rowSpan,colSpan:e.colSpan};t.push(i);for(let n=1;n<e.colSpan;n++)for(let r=0;r<e.rowSpan;r++)t.push({row:i.row+r,col:i.col+n,rowSpan:0,colSpan:0});for(let n=1;n<e.rowSpan;n++)for(let r=0;r<e.colSpan;r++)t.push({row:i.row+n,col:i.col+r,rowSpan:0,colSpan:0})})),t})(A)),[A,V,C]),G=t.useMemo((()=>{var e,t;const n=V.filter((e=>![kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(e.dataIndex)));return _&&n.some((e=>e.dataIndex===_))?_:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[V,_]),Y=t.useMemo((()=>z.length>0),[z]),X=t.useMemo((()=>!!E||Y),[E,Y]),Z=t.useMemo((()=>Al(j).length>1),[j]),Q=t.useMemo((()=>s||Z),[s,Z]),J=t.useMemo((()=>V.some((e=>e.sorter))),[V]),ee=t.useMemo((()=>V.some((e=>e.filter))),[V]),te=t.useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),ne=t.useMemo((()=>!F&&!!y),[F,y]),re=t.useMemo((()=>!!b&&K.length>0),[b,K]),ie=t.useMemo((()=>!!x&&"checkbox"===(null==c?void 0:c.type)),[x,c]),le=t.useMemo((()=>!!f&&ee),[f,ee]),oe=t.useMemo((()=>!F&&!!g&&ee),[F,g,ee]),ae=t.useMemo((()=>!!v&&V.some((e=>!!e.groupSummary))),[V]),se=t.useMemo((()=>{var e;return!!(null===(e=null==d?void 0:d.groupItems)||void 0===e?void 0:e.length)}),[d]),ce=t.useMemo((()=>C.some((e=>Array.isArray(e.children)))),[C]),de=t.useMemo((()=>!T.length),[T]),ue=t.useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:l}=t,{sumBySelection:o,displayWhenNotSelect:a,unit:s}=l,c=se?Bl(S.current.tableFullData):S.current.tableFullData,d=!L.length&&!!a;let u=(!o||d?c:L).reduce(((e,t)=>{if(null==t?void 0:t[kd.summaryIgnore])return e;const r=Hl(t,n);return $l(r)?e.plus(r):e}),new Lt(0));!Object.keys(P).includes(n)||o&&!d||(u=new Lt(Hl(P,n))),Fl(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=ql(p,i)),p=Ml(p),Fl(e,`${n}_text`,s?`${p} ${s}`:p)})),[e]})()),[T,N,P]),pe=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(",")})(I),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:i,bracketLeft:"",fieldName:r,expression:e,value:l[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type:e.fieldType,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(R,O),i=t?{[kd.sorterFieldName]:t}:null,l=n.length?{[kd.filterFieldName]:n}:null,o=pe?{[kd.groupSummary.summaryFieldName]:pe,usedJH:1}:null,a=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[kd.currentPageName]:k.current,[kd.pageSizeName]:k.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),l),o),a),s)}),[null==r?void 0:r.params,k.current,k.pageSize,I,R,O,pe]);return{isFetch:F,isWebPagination:D,isScrollPagination:$,showPagination:M,shouldUpdateHeight:q,tableColumns:j,flattenColumns:V,editableColumns:K,summationColumns:z,leftFixedColumns:W,rightFixedColumns:B,derivedMergeCells:U,treeExpandIndex:G,showSummary:Y,showFooter:X,isHeadGroup:Z,bordered:Q,isHeadSorter:J,isHeadFilter:ee,isServiceSummation:te,isSelectCollection:ie,isTableImport:ne,isTableClipboard:re,isSuperSearch:le,isFastSearch:oe,isGroupSummary:ae,isGroupSubtotal:se,isTreeTable:ce,isTableEmpty:de,summationRows:ue,fetchParams:he}},Dd=(e,n)=>{const{rowKey:r,height:i,dataSource:l,summation:o,fetch:a,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,treeConfig:h,authConfig:m,ignorePageIndex:f,columnsChange:g,onChange:v,onDataChange:y,onDataLoad:b,onScrollEnd:x,onFetchError:E}=e,{getRowKey:S,tableRef:w,tableElementRef:C,tableBodyRef:T,$size:N,tableColumns:I,flattenColumns:R,tableFullData:O,pagination:k,layout:A,filters:L,sorter:P,superFilters:_,fetchParams:H,selectionKeys:F,rowExpandedKeys:D,highlightKey:$,summationColumns:M,shouldUpdateHeight:q,isFetch:j,isTreeTable:V,isWebPagination:K,isScrollPagination:z,isServiceSummation:W,isGroupSubtotal:B,doLayout:U,setTableData:G,setTableFlatColumns:Y,setTableFullData:X,setTableOriginData:Z,setTableFlatData:Q,setAllTableData:J,setDeriveRowKeys:ee,setPagination:te,setSpinning:ne,setSorter:re,setFilters:ie,setSuperFilters:le,setSelectionKeys:oe,setRowExpandedKeys:ae,setHighlightKey:se,setSelectionRows:ce,setScrollXLoad:de,setScrollYLoad:ue,setScrollXStore:pe,setScrollYStore:he,computeVirtualX:fe,computeVirtualY:ge,setFieldAuth:ve,setResizeState:ye,setSummaries:be,setPermission:xe,setRecordsMap:Ee,resetTableScroll:we,clearElementStore:Ce,clearRecordsMap:Te}=n,{store:Ne,scrollBarRef:Ie}=w.current,Re=Number.parseInt(t.version)>=18?Pt.flushSync:null,Oe=t.useRef(Object.assign({},H)),ke=t.useRef(new Map),Ae=t.useRef(!1),Le=$i(C);qi((()=>{$e(),w.current.scrollXLoad?qe(Ie.current.scrollLeft):je(),U()}),[I]),qi((()=>{Pe()}),[Le,N,i,A.tableAutoHeight]),fi((()=>{Tt(),Nt(),It(),j||(K&&mt(),st(l)),s&&re(s),c&&ie(c)}),[l,null==a?void 0:a.params]),fi((()=>{const e=rt(H,Oe.current);e||j&&(null==d?void 0:d.clearableAfterFetched)&&Rt(),!e&&H[kd.currentPageName]>1&&!(null==a?void 0:a.stopToFirst)?mt():j&&ot(),Oe.current=H}),[H]),fi((()=>{K&&Et(),z||we(),et()}),[k.current,k.pageSize]),fi((()=>{w.current.scrollYLoad&&ze(Ie.current.scrollTop),j||He(O.length),U()}),[O]),fi((()=>{V&&w.current.scrollYLoad&&(ft(),Et())}),[D]);const Pe=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:n}=w.current,{width:r,height:i}=n,{width:l,height:o}=Le,a=l!==r,s=o!==i;U(),a&&e&&je(),s&&q&&t&&We(),ye(Object.assign({},n,{width:l,height:o}))},_e=()=>{$&&T.current.setClickedValues([$,""]),"radio"===(null==d?void 0:d.type)&&F.length&&T.current.setClickedValues([F[0],""])},He=e=>{e!==k.total&&te((t=>Object.assign({},t,{total:e})))},Fe=e=>{Ae.current=e},De=ji((e=>{ut(),null==x||x(e)})),$e=()=>{de(R.length>kd.virtualScrollX)},Me=function(){let e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).length>kd.virtualScrollY;(null==p?void 0:p.virtual)&&(e=!0),(null==h?void 0:h.virtual)&&(e=!0),ue(e)},qe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollXStore:t}=w.current,{startIndex:n,endIndex:r,offsetSize:i}=t,{toVisibleIndex:l,visibleSize:o}=fe(e,A.tableWidth),a=Math.max(0,l-1-i),s=l+o+i;(l<=n||l>=r-o-1)&&(n===a&&r===s||(pe(Object.assign({},t,{startIndex:a,endIndex:s})),je()))},je=()=>{Ve(),Ke()},Ve=()=>{const{scrollXLoad:e,scrollXStore:t}=w.current;if(!e)return;const n=[],r=[],i=[];for(let e=0;e<R.length;e++){const l=R[e];l.fixed?"left"===l.fixed?n.push(l):i.push(l):e>=t.startIndex&&e<t.endIndex&&r.push(l)}Re?queueMicrotask((()=>Re((()=>Y([...n,...r,...i]))))):Y([...n,...r,...i])},Ke=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:n}=w.current,{tableBodyWidth:r,gutterWidth:i}=A;let l="",o="";if(n){l=`${R.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,o=`${scrollY?r-i:r}px`}e.$tableBody.style.marginLeft=l,e.$tableXspace.style.width=o},ze=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=w.current,{startIndex:n,endIndex:r,offsetSize:i,visibleSize:l,rowHeight:o}=t,{toVisibleIndex:a}=ge(e,o),s=Math.max(0,a-1-i),c=a+l+i;(a<=n||a>=r-l-1)&&(n===s&&r===c||(he(Object.assign({},t,{startIndex:s,endIndex:c})),We()))},We=()=>{const{tableFlatData:e}=w.current;bt(e),(e=>{const{elementStore:t,scrollYStore:n,scrollYLoad:r}=w.current,{startIndex:i,rowHeight:l}=n;let o="",a="";r&&(o=`${Math.max(0,i*l)}px`,a=e.length*l+"px"),t.$tableBody.style.marginTop=o,t.$tableYspace.style.height=a})(e)},Be=e=>B?Ue(Ge(e,0)):e,Ue=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ue(e.children)),delete e.children,t.push(e)})),t},Ge=(e,t)=>{var n;const i=null===(n=o.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 Gl(e,[i.dataIndex]).map((e=>{const n={children:Ge(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&Fl(n,r.toString(),Kl()),i.titleIndex&&Fl(n,i.titleIndex,Hl(e[0],i.titleIndex)),Fl(n,i.dataIndex,Hl(e[0],i.dataIndex)),M.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[kd.summaryIgnore])return e;const n=Number(Hl(t,r));return Number.isNaN(n)?e:e+n}),0);Fl(n,r,i)})),n}))},Ye=e=>{oe(e),ce((e=>{const{selectionRows:t,allTableData:n,recordsMap:r}=w.current;if(j)return[...t.filter((t=>e.includes(S(t,t.index)))),...n.filter((n=>{const r=S(n,n.index);return e.includes(r)&&-1===t.findIndex((e=>S(e,e.index)===r))}))];const i=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];r.has(n)&&i.push(r.get(n))}return i})(e))},Xe=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:F;let i=[];return w.current.treeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:l}=w.current,o=Ol(i,e);let a=[];if(!o)return a;let s=Qe((null==o?void 0:o.children)||[]);return r&&(s=s.filter((e=>!l.has(e)||!r(l.get(e))))),a=[...new Set([...t,...s])],((null===(n=Xl(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ol(i,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>a.includes(e.rowKey)));a=r?[...a,e]:a.filter((t=>t!==e))})),a})(e,r))})),i="radio"===t?r.slice(0,1):[...new Set([...r,...i])],i},Ze=e=>{const{allRowKeys:t,flattenRowKeys:n,deriveRowKeys:r}=w.current,{defaultExpandAllRows:i,expandedRowRender:l}=u||{},o=Array.isArray(e)?e:D;if(w.current.treeTable){l&&Xt("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...F];$&&e.unshift($);let a=[];return e.forEach((e=>{const t=Xl(r,e)||[];a.push(...t.length>1?t.slice(0,-1).reverse():t)})),a=i?t:[...new Set([...o,...a])],a.filter((e=>!n.includes(e)))}return u?i?t.slice(0):[...o]:[]},Qe=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...Qe(e[n].children)),t.push(e[n].rowKey);return t},Je=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Je(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...Je(e,n[n.length-1])),n},et=ji((()=>{null==v||v(k,nt(L),tt(P),_,{currentDataSource:yt()})})),tt=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},nt=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},rt=(e,t)=>{const n=Object.keys(_l(e,t));return 1===n.length&&(n.includes(kd.currentPageName)||n.includes(kd.pageSizeName))},it=()=>En(void 0,void 0,void 0,(function*(){var t;if(!m)return;let n=An(m,["fetch"]);if(m.fetch){const{api:e,params:r,dataKey:i}=m.fetch;try{const l=yield e(r);200===l.code&&(n=null!==(t=i?me(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;xe((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const{originColumns:t}=w.current,r=Cl(e.columns,(e=>{const{dataIndex:r}=e,i=n.fieldList.find((e=>e.dataIndex===r));if(i){const{visible:n=1,disabled:l,secretName:o}=i,a=Tl(t,r);ve(r,{visible:n,disabled:l,secretName:o}),n||(e.noAuth=!0,a.noAuth=!0),o&&(e.formatType=`secret-${o}`,a.formatType=`secret-${o}`)}}));null==g||g(r)}})),lt=()=>En(void 0,void 0,void 0,(function*(){var e,t,n;if(!a)return;const{formatter:r=(e=>e),beforeFetch:i=Nn,afterFetch:l,callback:s}=a;if(!i(H))return;const c=!!(null===(e=null==o?void 0:o.fetch)||void 0===e?void 0:e.api);ne(!0);try{const[e,i]=c?yield Promise.all([a.api(r(H)),o.fetch.api(r(H))]):[yield a.api(r(H))];if(w.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=a.dataKey)&&void 0!==t?t:kd.dataKey;let o=null!==(n=me(e.data,r))&&void 0!==n?n:[];o="function"==typeof l?yield l(o):o;const c=me(e.data,r.replace(/[^.]+$/,kd.totalKey))||o.length||0,d=Math.max(Math.ceil(c/k.pageSize),1);if(H[kd.currentPageName]>d)return pt(Object.assign(Object.assign({},k),{current:d}));st(Ae.current?w.current.tableFullData.concat(o):o),He(c),ct((null==i?void 0:i.data)||e.data),null==s||s(e.data,e)}}catch(e){null==E||E(e)}var d,u;d=a,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(a.stopToFirst=!1),ne(!1),Fe(!1)})),ot=ji(lt),at=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=at(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:n}=k;return!j||z?e:(t-1)*n+e})(t)),e))),st=e=>{const t=Be(at(e));St(t),wt(t),Ye(Xe()),ae(Ze()),dt(),null==b||b(t)},ct=e=>{var t,n,r;if(!W)return;const i=null!==(n=null===(t=null==o?void 0:o.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:kd.summationKey,l=null!==(r=i?me(e,i):e)&&void 0!==r?r:{},a={};M.filter((e=>!!e.summation.dataKey)).forEach((e=>{Fl(a,e.dataIndex,Number(Hl(l,e.summation.dataKey)))})),be(a)},dt=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=yt();if(e.length){const t=S(e[0],e[0].index);Ye([t])}else Ye([])}},ut=()=>{if(!z)return;const e=ht();Ae.current||k.current>=e||(Fe(!0),pt(Object.assign(Object.assign({},k),{current:k.current+1})))},pt=e=>{let{current:t,pageSize:n}=e;te((e=>Object.assign({},e,{current:t,pageSize:n})))},ht=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},mt=()=>{pt(Object.assign({},k,{current:1}))},ft=()=>{const{scrollYLoad:e,deriveRowKeys:t}=w.current;if(!w.current.treeTable||!e)return;const n=gt(t,(()=>{const{allTableData:e,allRowKeys:t}=w.current,{rowExpandable:n}=u||{},r=[];return"function"==typeof n&&e.forEach(((e,i)=>!n(e)&&r.push(t[i]))),r.length?D.filter((e=>!r.includes(e))):D})());ke.current.clear(),n.forEach(((e,t)=>ke.current.set(e,t)))},gt=(e,t)=>{const n=[];return e.forEach((e=>{if(e.children&&n.push(...gt(e.children,t)),void 0===e.parentRowKey)n.push(e.rowKey);else if(t.includes(e.parentRowKey)){e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1))&&n.push(e.rowKey)}})),n},vt=()=>{const{current:e,pageSize:t}=k;return w.current.tableFullData.slice((e-1)*t,e*t)},yt=()=>K?vt():w.current.tableFullData,bt=e=>{const{scrollYLoad:t,scrollYStore:n}=w.current;if(!t)return G(e);const{startIndex:r,endIndex:i}=n;Re?queueMicrotask((()=>Re((()=>G(e.slice(r,i)))))):G(e.slice(r,i))},xt=()=>{let e=yt();w.current.treeTable&&(null==h?void 0:h.virtual)&&(e=(e=>{const{recordsMap:t,allRowKeys:n}=w.current,r=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];ke.current.has(i)&&r.push(t.get(i))}return r})()),Me(e),Q(e)},Et=()=>{xt(),We()},St=e=>{X(e),J(e),ee(e),Ct(),ft(),Et()},wt=e=>{Z(e)},Ct=()=>{Te(),w.current.allTableData.forEach((e=>Ee(S(e,e.index),e)))},Tt=()=>{re({})},Nt=()=>{ie({})},It=()=>{le([])},Rt=()=>{Ye([])};return{initialTable:()=>{it(),_e(),$e(),Me(),j?lt():st(l)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Xt("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:St,getTableData:lt,handleTableData:bt,createWebPageData:vt,createTableData:st,createGroupData:Be,createSelectionKeys:Xe,createRowExpandedKeys:Ze,setSelectionKeysEffect:Ye,findParentRowKeys:Je,getAllChildRowKeys:Qe,doFieldValidate:(e,t,n,r)=>{if(!Array.isArray(e))return Xt("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ne.removeFromRequired({x:n,y:r}),Ne.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&kn(t)&&Ne.addToRequired({x:n,y:r,text:e.message}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||Ne.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=Ne.state,l=Se(n,i),o=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:o(e),validate:o(t),inserted:n.filter((e=>!l.includes(e))),updated:r.filter((e=>![...Se(r,n),...Se(r,i)].includes(e))),removed:i.filter((e=>!l.includes(e)))}},dataChange:()=>{null==y||y(w.current.tableFullData)},tableChange:et,toLastPage:()=>{const e=ht();k.current!==e&&pt(Object.assign({},k,{current:e}))},toFirstPage:mt,getPageCount:ht,pagerChangeHandle:pt,triggerScrollXEvent:e=>{qe(e)},triggerScrollYEvent:e=>{ze(e)},scrollBottomDebouncer:De,clearTableSorter:Tt,clearTableFilter:Nt,clearSuperFilters:It,clearRowSelection:Rt,clearRowHighlight:()=>{se("")},clearTableLog:()=>{Ne.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;Ce(),Ne.destroy(),e.deregister(t)}}},$d=(e,n)=>{const{height:r,minHeight:i,maxHeight:l,ellipsis:o,showHeader:a,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,$size:h,tableColumns:m,flattenColumns:f,leftFixedColumns:g,derivedMergeCells:v,layout:y,scrollX:b,scrollY:x,showFooter:E,showPagination:S,isFullScreen:w,setLayout:C,setScrollX:T,setScrollY:N,setElementStore:I,setScrollXStore:R,setScrollYStore:O,setShouldToTop:k}=n,A=t.useRef(x),L=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=y,n={};return i&&Object.assign(n,{minHeight:`${Pl(i)}px`}),l&&Object.assign(n,{maxHeight:`${Pl(l)}px`}),w?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${Pl(r)}px`:`${t}px`}):n}),[r,l,i,w,y]),P=()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,i=a?e.$header.offsetHeight:y.headerHeight,l=E?e.$footer.offsetHeight:y.footerHeight,o=r-i-l,s=e.$tableBody.offsetHeight,c=t||s>o;let u=0;if(w){const t=e.$toper?e.$toper.offsetHeight+fd:0,r=e.$pager?e.$pager.offsetHeight+fd:0;u=n.winHeight-t-r-20}(t||o!==y.viewportHeight)&&F(o),A.current=c,N(c),C((e=>Object.assign({},e,{headerHeight:i,footerHeight:l,viewportHeight:o,tableBodyHeight:s,tableFullHeight:u})))},_=e=>{const{scrollXStore:t,isIE:n,scrollBarRef:r}=d.current,i=r.current.scrollLeft,{toVisibleIndex:l,visibleSize:o}=H(i,e),a=n?5:0,s=Math.max(0,l-1-a),c=Math.max(l+o+a,t.endIndex);R(Object.assign({},t,{visibleSize:o,offsetSize:a,startIndex:s,endIndex:c}))},H=(e,t)=>{const n=e+t;let r=-1,i=0,l=0;for(let t=0,o=f.length;t<o;t++){const o=f[t];if(i+=o.width||o.renderWidth,-1===r&&e<i&&(r=t),r>=0&&(l++,i>n))break}return{toVisibleIndex:Math.max(0,r),visibleSize:Math.max(8,l)}},F=e=>{const{scrollBarRef:t,scrollYStore:n,isIE:r}=d.current,i=t.current.scrollTop,{rowHeight:l}=n,{toVisibleIndex:o}=D(i,l),a=Math.max(8,Math.ceil(e/l)+2),s=r?5:0,c=Math.max(0,o-1-s),u=Math.max(o+a+s,n.endIndex);O(Object.assign({},n,{visibleSize:a,offsetSize:s,startIndex:c,endIndex:u}))},D=(e,t)=>{const n=Math.floor(e/t);return{toVisibleIndex:Math.max(0,n)}},$=(e,t)=>{const{scrollBarRef:n,elementStore:r,scrollYStore:i,scrollYLoad:l,tableFlatData:o}=d.current;if(void 0!==t&&t>=0)n.current.SET_SCROLL_TOP(t*i.rowHeight);else if(l){const t=o.findIndex((t=>e===c(t,t.index)));t>=0&&n.current.SET_SCROLL_TOP(t*i.rowHeight)}else{const t=r.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}};return{createElementStore:()=>{I("$toper",u.current),I("$table",p.current)},tableStyles:L,getSpan:(e,t,n,r,i)=>{let l=1,o=1;if("function"==typeof s){const a=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(a)?(l=a[0],o=a[1]):se(a)&&(l=a.rowSpan,o=a.colSpan)}if(v.length>0){const e=v.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,o=e.colSpan)}return{rowSpan:l,colSpan:o}},getStickyLeft:e=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Nl(Tl(m,e)).dataIndex);let t=0;for(let n=0;n<f.length;n++){const r=f[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Il(Tl(m,e)).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()})(f):f;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{scrollBarRef:n}=d.current,r=void 0===t?f.findIndex((t=>t.dataIndex===e)):t;if(r<0)return;const i=g.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=f.slice(0,r).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);n.current.SET_SCROLL_LEFT(l-i)},scrollYToRecord:$,rowInViewport:e=>{const{scrollBarRef:t,scrollYStore:n}=d.current,{viewportHeight:r,gutterWidth:i}=y,l=e*n.rowHeight;return!(l<t.current.scrollTop||l+n.rowHeight>t.current.scrollTop+(b?r-i:r))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(S?Qo["small"!==h?"middle":h]+fd:0)-fd;C((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&$("",0),k(!0)},computeVirtualX:H,computeVirtualY:D,doLayout:()=>{o?P():Rn((()=>P())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,r=A.current?y.gutterWidth:0,{defaultColumnWidth:i}=kd,l=[];let o=0;if(f.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,o+=e.width):(e.renderWidth=void 0,l.push(e))})),l.length>0){const e=f.reduce(((e,t)=>e+(t.width||t.minWidth||i)),0);if(e<=n-r){T(!1);const t=n-r-e;if(1===l.length)l[0].renderWidth=(l[0].minWidth||i)+t;else{const e=t/l.reduce(((e,t)=>e+(t.minWidth||i)),0);let n=0;l.forEach(((t,r)=>{if(0===r)return;const l=Math.floor((t.minWidth||i)*e);n+=l,t.renderWidth=(t.minWidth||i)+l})),l[0].renderWidth=(l[0].minWidth||i)+t-n}}else T(!0),l.forEach((e=>{e.renderWidth=e.minWidth||i}));C((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else o=f.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||i)),0),T(o>n),C((e=>Object.assign(Object.assign({},e),{tableBodyWidth:o})));C((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&_(n)})()}}},Md=(e,n)=>{const{columns:r,summation:i,rowSelection:l,expandable:o,rowHighlight:a}=e,{tableRef:s,tableBodyRef:c,$size:d,scrollX:u,pagination:p,selectionKeys:h,rowExpandedKeys:m,highlightKey:f,summationRows:g,showSummary:v,isWebPagination:y,isScrollPagination:b,isTreeTable:x,checkDataIndex:E,toLastPage:S,toFirstPage:w,getPageCount:C,setHandleState:T,scrollYToRecord:N,setSelectionKeysEffect:I,setOriginColumns:R,setRowExpandedKeys:O,setHighlightKey:k,setResizeState:A,setPingRight:L,setUnMounted:P,calcTableHeight:_,createSelectionKeys:H,createRowExpandedKeys:F,initialTable:D,destroy:$}=n,M=t.useRef(g);fi((()=>{if(!l)return;const{onChange:e}=l;"radio"===l.type&&c.current.setClickedValues(h.length?[h[0],""]:[]),h.__prevent__||null==e||e(h,s.current.selectionRows),delete h.__prevent__}),[h]),fi((()=>{if(!o)return;const{onChange:e}=o;m.__prevent__||null==e||e(m,m.map((e=>s.current.recordsMap.get(e)))),delete m.__prevent__}),[m]),fi((()=>{var e,t;x&&O(F()),a&&(c.current.setClickedValues(f?[f,""]:[]),null===(e=a.onChange)||void 0===e||e.call(a,f,null!==(t=s.current.recordsMap.get(f))&&void 0!==t?t:null))}),[f]),fi((()=>{var e;ge(g,M.current)||(M.current=g,v&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,g)))}),[g]),fi((()=>{const e=H(l.selectedRowKeys);ge(e,h)||(e.__prevent__=!0,I(e),x&&O(F()))}),[null==l?void 0:l.selectedRowKeys]),fi((()=>{const e=F(o.expandedRowKeys);ge(e,m)||(e.__prevent__=!0,O(e))}),[null==o?void 0:o.expandedRowKeys]),fi((()=>{const{currentRowKey:e}=a;e!==f&&k(null!=e?e:"")}),[null==a?void 0:a.currentRowKey]),fi((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?S():w()),N("","after"===e?1e5:0)),t&&p.current>C()&&S(),(e||t)&&T({insert:null,remove:!1})}),[p.total]),fi((()=>{L(u)}),[u]),fi((()=>{_()}),[d]),fi((()=>{s.current.scrollYLoad&&(e.height||e.maxHeight||Xt("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||Xt("Table","必须设置组件参数 `ellipsis`")),b&&(e.height||e.maxHeight||Xt("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,b]);const q=wd((()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(A(Object.assign({},e,{winHeight:n})),_())}));t.useEffect((()=>(R(Ln(r)),D(),window.addEventListener("resize",q,!1),E(),Rn((()=>_())),()=>{$(),window.removeEventListener("resize",q),P(!0)})),[])},qd=e=>{const{total:n}=e,{tableRef:r,selectionKeys:i,isHeadSorter:l,isHeadFilter:o,isTreeTable:a,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=t.useContext(pd),{infoBarConfig:h,rowSelection:m,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:v}=r.current,{hideAlert:y,hideClearButton:b}=h||{},x=t.useMemo((()=>!y),[y]),E=t.useMemo((()=>!b&&!!(l||o||m||f)),[b,l,o,m,f]),S={[`${Dn("table")}__alert`]:!0};return x?t.createElement("div",{className:Fe(S)},t.createElement("i",{className:"svgicon icon"},t.createElement(tt,null)),t.createElement("span",null,Bt("qm.table.alert.total",{total:a?g.length:n}),m?`,${Bt("qm.table.alert.selected",{total:Math.max(i.length-v.length,0)})}`:""),E&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),Rn((()=>s()))}},Bt("qm.table.alert.clear"))):null},jd=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{setFullScreen:l}=t.useContext(pd),o=()=>{l(!r)};t.useImperativeHandle(n,(()=>({clickHandle:o})));const a=Dn("table");return i?t.createElement("span",{className:`${a}-full-screen`,title:Bt(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(je,null):t.createElement(Ve,null))):null}));jd.displayName="FullScreen";const Vd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{getTableData:i}=t.useContext(pd),l=()=>{i()};t.useImperativeHandle(n,(()=>({clickHandle:l})));const o=Dn("table");return r?t.createElement("span",{className:`${o}-reload`,title:Bt("qm.table.refresh.text"),onClick:()=>l()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ye,null))):null}));Vd.displayName="Reload";const Kd=()=>{const e={dateFormat:e=>{const t=e?g(e).format(yd):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?g(e).format(bd):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?g(e).format(bd.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>$l(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Ml(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,o,a;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:p}=n,h=s||(null===(i=null==p?void 0:p(r,n))||void 0===i?void 0:i.items)||[];let m=null!==(a=null!==(o=null===(l=h.find((e=>e.value==t)))||void 0===l?void 0:l.text)&&void 0!==o?o:t)&&void 0!==a?a:"";if(Array.isArray(t)&&(m=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&&""!==m&&(m=$l(m)?new Lt(m).toFixed(c):m),d>=0&&""!==m&&(m=ql(m,d)),u){const t=e[`${On(u)}Format`];t?m=t(m):Xt("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>wn(e)?zl(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,l)=>{const o=Hl(e,r.dataIndex),a=r.render?r.render(o,e,r,i,l):t(o,r,e);return n(a)}}},zd=t.forwardRef(((e,n)=>{var r,i,l,o;const{tableColumns:a,open:s=!0}=e,{global:c}=t.useContext(Vt),{tableRef:d,flattenColumns:u,summationRows:p,showSummary:h,getSpan:m}=t.useContext(pd),{tablePrint:f,showHeader:g}=d.current.props,{getTitleFromCellValue:v}=Kd(),y=null!==(i=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==i?i:"",b=null!==(o=null===(l=null==c?void 0:c.print)||void 0===l?void 0:l.rightLogo)&&void 0!==o?o:"",x=!(!y&&!b),E=t.useMemo((()=>Ln(Rl(a,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn]))),[a]),S=t.useMemo((()=>Ln(Rl(u,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn]))),[u]),w=t.useMemo((()=>Ln(a.filter((e=>e.printFixed)))),[a]),C=e=>{const t=Object.assign({},Yl(E,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?C(t):t},T=(e,t)=>Ce(Te(Ne(e),t),Ie((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Re(...n,((e,n)=>{if(Array.isArray(e))return T(e.concat(n),t)}))}))),N=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(C(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]:T(n,"dataIndex")[0]})))(n),t.push(Al(n))})),t},I=()=>{const{allTableData:e}=d.current,t=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const l=e[i];r+=l.width||l.renderWidth||l.minWidth||kd.defaultColumnWidth,r<=kd.printWidth?(n.push(l),i===e.length-1&&t.push(n),i++):i>0?(e.splice(0,i),w.length&&e.unshift(...w),t.push(n),n=[],r=0,i=0):(l.width=kd.printWidth,n.push(l),t.push(n),i++)}return t})([...S]),n=N(t);let r=["<!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 i=0;i<t.length;i++)r+=R(n[i],t[i],e),r+='<div class="page-break"></div>';return r+"</body></html>"},R=(e,t,n)=>{const{showLogo:r=!0}=f;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((e=>{let{width:t,minWidth:n,renderWidth:r}=e;return`<col style="width:${t||r||n||kd.defaultColumnWidth}px">`})).join("")}</colgroup>`,g&&(i+=["<thead>",r&&x?`<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">',y?`<img src="${y}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" 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}">${Wl(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${n.map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:l}=m(e,t,e.index,r,n);return i&&l?`<td rowspan="${i}" colspan="${l}">${v(e,t,e.index,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),h&&p.length&&(i+=["<tfoot>",p.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:i,summation:l}=t,o=(null==l?void 0:l.render)?l.render(n):Hl(e,`${i}_text`);return`<td>${0===r&&""===o?Bt("qm.table.config.summaryText"):wn(o)?zl(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},O=()=>{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});Ui(e,l)}})({filename:"print",type:"html",isDownload:!1},I()))||void 0===e||e.then((e=>{let{content:t,blob:n}=e,r=document.createElement("iframe");r.setAttribute("frameborder","0"),r.setAttribute("width","100%"),r.setAttribute("height","0"),r.style.display="none",document.body.appendChild(r),d.current.isIE?(r.contentDocument.write(t),r.contentDocument.execCommand("print"),r.parentNode.removeChild(r),r=null):(r.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{r.parentNode.removeChild(r),r=null}))},r.src=URL.createObjectURL(n))}))};t.useImperativeHandle(n,(()=>({clickHandle:O})));const k=Dn("table");return s?t.createElement("span",{className:`${k}-print`,title:Bt("qm.table.print.text"),onClick:()=>O()},t.createElement("i",{className:"svgicon icon"},t.createElement(nt,null))):null}));zd.displayName="TablePrint";const Wd="606060",Bd="thin",Ud="d4d4d4",Gd=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Yd=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Xd=()=>({top:{style:Bd,color:{argb:Ud}},left:{style:Bd,color:{argb:Ud}},bottom:{style:Bd,color:{argb:Ud}},right:{style:Bd,color:{argb:Ud}}}),Zd=e=>{const{children:t}=e;return t&&t.length?Zd(t[0]):e},Qd=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},Jd=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(pd),{spanMethod:l,showHeader:o}=e.current.props,a=(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,a,s,c)=>En(void 0,void 0,void 0,(function*(){const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:p}}=e.current,h=El(d),m=Al(d),f=[],g=[],v=[],y=[];let b=0;const x={};h.forEach((e=>{const{dataIndex:t,width:n,minWidth:r,renderWidth:i}=e;x[t]=Wl(e.title),v.push({key:t,width:(n||i||r||kd.defaultColumnWidth)/8})})),o&&(i?m.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,l=Zd(e),o=h.findIndex((e=>{let{dataIndex:t}=e;return t===l.dataIndex}));n[l.dataIndex]=Wl(e.title),0!==r&&(r>1||i>1)&&y.push({s:{r:t,c:o},e:{r:t+i-1,c:o+r-1}})})),f.push(n)})):(h.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&y.push({s:{r:b,c:t},e:{r:b+r-1,c:t+n-1}})})),f.push(x)),b+=f.length);const E=a.map(((e,t)=>{const r={};return h.forEach(((i,o)=>{if("function"==typeof l){const{rowSpan:r,colSpan:l}=n(e,i,t,o,a);(l>1||r>1)&&y.push({s:{r:t+b,c:o},e:{r:t+b+r-1,c:o+l-1}})}const s=["percent","finance"].includes(i.formatType);r[i.dataIndex]=s?Hl(e,i.dataIndex):c(e,t,i,o)})),r}));b+=E.length,r&&u&&s(h,a).forEach(((e,t)=>{const n={};h.forEach(((t,r)=>{const{dataIndex:i,summation:l}=t,o=(null==l?void 0:l.render)?l.render(a):Hl(e,i);n[i]=0===r&&""===o?Bt("qm.table.config.summaryText"):wn(o)?zl(o).join(""):o})),g.push(n)}));const{sheetName:S,useStyle:w}=t,C=new qt.Workbook,T=C.addWorksheet(S);T.columns=v,o&&T.addRows(f).forEach((e=>{w&&Gd(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Tl(d,t.key),{align:r,theadAlign:i}=n;Yd(e,i||r),w&&Object.assign(e,{font:{bold:!0,color:{argb:Wd}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Xd()})}))})),T.addRows(E).forEach((e=>{w&&Gd(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Tl(d,t.key),{align:r}=n;Yd(e,r),Object.assign(e,Qd(n)),w&&Object.assign(e,{font:{color:{argb:Wd}},border:Xd()})}))})),r&&u&&T.addRows(g).forEach((e=>{w&&Gd(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Tl(d,t.key),{align:r}=n;Yd(e,r),Object.assign(e,Qd(n)),w&&Object.assign(e,{font:{color:{argb:Wd}},border:Xd()})}))})),y.forEach((e=>{let{s:t,e:n}=e;T.mergeCells(t.r+1,t.c+1,n.r+1,n.c+1)}));const N=yield C.xlsx.writeBuffer();return new Blob([N],{type:"application/octet-stream"})})),exportCSV:(e,t)=>{const n=e=>{let t=e;const n=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),r=-1!==e.indexOf('"');return r&&(t=t.replace(/"/g,'""')),(n||r)&&(t='"'+t+'"'),t},r="\ufeff"+(e=>{let t,r,i,l,o="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],r=0;r<i.cells.length;r+=1)l=i.cells[r],o=o+(r?",":"")+n(l.textContent.trim());o+="\r\n"}return o})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var i;return((e,t,n)=>{t=t||"",n=n||512;const r=window.atob(e),i=[];let l;for(l=0;l<r.length;l+=n){const e=r.slice(l,l+n),t=new Array(e.length);let o;for(o=0;o<e.length;o+=1)t[o]=e.charCodeAt(o);const a=new window.Uint8Array(t);i.push(a)}return new window.Blob(i,{type:t})})((i=r,window.btoa(unescape(encodeURIComponent(i)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:r}=e,i=El(n),l=new FileReader;l.onerror=()=>{k.error(Bt("qm.table.import.error"))},l.onload=e=>{const n=i.map((e=>Wl(e.title))),r=new qt.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)),o=e[l],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,o);if(s){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("")),se(i)&&"text"in i&&(i=i.text),Oe(i)&&(i=Vl(i,bd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[o[n]]=i}));const r={};return n.forEach(((e,n)=>{var l;const{dataIndex:o,dictItems:s}=i[n];Array.isArray(s)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>a(s,e))).filter((e=>""!==e)):t[e]=a(s,t[e])),Fl(r,o,t[e])})),r}));null==t||t(r)}else k.error(Bt("qm.table.import.error"))}else k.error(Bt("qm.table.import.error"))})):k.error(Bt("qm.table.import.error"))},l.readAsArrayBuffer(r)}}},eu=e=>{const{fileType:n,onChange:r}=e;let i,l;const o=Dn("table"),a=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}},s=()=>En(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),l=document.createElement("input"),i.className=`${o}--file-form`,l.name="file",l.type="file",i.appendChild(l),document.body.appendChild(i)),new Promise(((e,n)=>{const r=!t.type;l.multiple=!!t.multiple,l.accept=r?"":`.${t.type}`,l.onchange=o=>{const{files:s}=o.target,c=s[0];let d="";if(!r)for(let e=0;e<s.length;e++){const{type:n}=a(s[e]);if(t.type!==n){d=n;break}}d?(k.warning(Bt("qm.upload.notType",{type:d})),n()):e(c),document.body.removeChild(i),i=null,l=null},i.reset(),l.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(_n,{onClick:()=>s()},Bt("qm.upload.text"))},tu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,createTableData:l,dataChange:o}=t.useContext(pd),{beforeTableImport:a}=i.current.props,{importXLSX:s}=Jd(),c=t.useRef(null),[d,u]=t.useState(!1),[p,h]=t.useState(!0),m=e=>e.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))),[f,g]=t.useState([{type:"INPUT",label:Bt("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(eu,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&h(!1)}}))}},{type:"SELECT",label:Bt("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:Bt("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:Bt("qm.table.import.fillText"),value:"fill"},{text:Bt("qm.table.import.addText"),value:"add"},{text:Bt("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{f.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,g([...f])}},{type:"INPUT_NUMBER",label:Bt("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:i.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),v=Dn("table");return t.createElement("div",{className:`${v}-import__setting`},t.createElement(Fc,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:f,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(_n,{onClick:()=>r(),style:{marginRight:8}},Bt("qm.table.export.closeButton")),t.createElement(_n,{type:"primary",loading:d,disabled:p,onClick:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield c.current.GET_FORM_DATA();e||(u(!0),s({columns:m(n),file:t.file},(e=>En(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:s}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof a)try{e=yield a(e)}catch(e){}if("fill"===t.importType&&l(e),"add"===t.importType&&l([...n,...e]),"insert"===t.importType){const{tableFullData:n}=i.current,r=t.posIndex,o=n.slice(0,r).concat(e).concat(n.slice(r));l(o)}e.forEach((e=>{s.addToInserted(e)})),o(),k.success(Bt("qm.table.import.success",{total:e.length})),u(!1),r()})))))}))},Bt("qm.table.import.text"))))},nu=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,[l,o]=t.useState(!1),a=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:a})));const s={[`${Dn("table")}-import`]:!0},c={visible:l,title:Bt("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:Fe(s),title:Bt("qm.table.import.textNoSpace"),onClick:()=>a()},t.createElement("i",{className:"svgicon icon"},t.createElement(rt,null))),t.createElement(ll,c,t.createElement(tu,{columns:r,onClose:()=>o(!1)})))}));nu.displayName="TableImport";const ru=e=>{const{columns:n,onChange:r}=e,{$size:i}=t.useContext(pd),l=t.useRef([]),[o,a]=t.useState(!1),[s,c]=t.useState(n);fi((()=>{u()}),[s]),t.useEffect((()=>{d()}),[n]);const d=()=>{const e=[];n.forEach(((t,r)=>{const i=t.colSpan;i>1&&n.slice(r+1,r+i).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(n.slice(r,r+i))})),l.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const i=l.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===i)return e.push(t);e.push(...l.current[i].map(((e,n)=>{let{dataIndex:r}=e;const i=s.find((e=>e.dataIndex===r));return n>0&&void 0!==t.hidden&&(i.hidden=t.hidden),i})))})),null==r||r(e)},p=Dn("table"),h={[`${p}__popper`]:!0,"column-filter__popper":!0,[`${p}--lg`]:"large"===i,[`${p}--sm`]:"small"===i},m=[`${p}-column-filter`,{selected:o}];return t.createElement(_s,{action:["click"],popupVisible:o,popup:t.createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"main"},t.createElement($t,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),n=s.map((e=>e.dataIndex));ge(t,n)||c(Jl(e))}},s.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,c([...s])}}),t.createElement("i",{className:Fe(i),title:Bt("qm.table.columnFilter.draggable")},t.createElement(Ke,null)),t.createElement("span",{className:"text"},Wl(e.title)))})(e,"main")))))),popupClassName:Fe(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{a(e)},builtinPlacements:Ed,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Fe(m),title:Bt("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(it,null)),t.createElement("span",null,Bt("qm.table.columnFilter.text"))))},iu=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:l,selectionKeys:o,pagination:a,showSummary:s}=t.useContext(pd),{rowSelection:c}=l.current.props,d=t.useRef(null),[u,p]=t.useState(!1),h=t.useMemo((()=>Object.assign({},{fileName:`${g().format(xd)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,a.total],footSummation:s?1:0,useStyle:0},n,{columns:Ln(n.columns||[])})),[]),[m,f]=t.useState([{type:"INPUT",label:Bt("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:Bt("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:Bt("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:Bt("qm.table.export.all"),value:"all"},{text:Bt("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==c?void 0:c.type)},{text:Bt("qm.table.export.custom"),value:"custom"}]},onChange:e=>{m.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,f([...m])}},options:{min:1},disabled:!0},{type:"INPUT",label:Bt("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t.createElement(ru,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:Bt("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:Bt("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),v=Dn("table");return t.createElement("div",{className:`${v}-export__setting`},t.createElement(Fc,{ref:d,initialValues:h,items:m,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(_n,{onClick:()=>r(),style:{marginRight:8}},Bt("qm.table.export.closeButton")),t.createElement(_n,{type:"primary",loading:u,onClick:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield d.current.GET_FORM_DATA();if(!e){p(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);i(t),yield In(1e3),p(!1),r()}}))},Bt("qm.table.export.text"))))},lu=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:l=!0}=e,{global:o}=t.useContext(Vt),{tableRef:a,flattenColumns:s,pagination:c,fetchParams:d,isFetch:u,isGroupSubtotal:p,showSummary:h,getSpan:m}=t.useContext(pd),{exportExcel:f,fetch:v,showHeader:y}=a.current.props,{getTitleFromCellValue:b}=Kd(),[x,E]=t.useState(!1),[S,w]=t.useState(!1),C=t.useMemo((()=>{var e;return!!(null===(e=null==f?void 0:f.fetch)||void 0===e?void 0:e.api)}),[f]),T=t.useMemo((()=>!c.total||S),[c.total,S]),N=t.useMemo((()=>Rl(i,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn])),[i]),I=t.useMemo((()=>Rl(s,[kd.expandableColumn,kd.selectionColumn,kd.operationColumn])),[s]),R=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return 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=R(e.children,l,n+1)),I.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&Fl(i,t,Hl(i,t))})),i}))},O=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(p?Bl(t):t).reduce(((e,t)=>{if(null==t?void 0:t[kd.summaryIgnore])return e;const n=Number(Hl(t,r));return Number.isNaN(n)?e:e+n}),0);Fl(n,r,i)})),[n]},A=(e,t,n,r)=>{const{precision:i,formatType:l}=n;let o=b(e,n,t,r);return i>=0&&!l&&""!==o&&(o=Number(o)),o},{exportXLSX:L,exportCSV:P}=Jd(),_=e=>En(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:i,dataKey:l}=v;let o=[];try{w(!0);const a=yield n(Object.assign(Object.assign({},r(d)),{[kd.currentPageName]:1,[kd.pageSizeName]:null!=e?e:c.total}));if(200===a.code){let e=Array.isArray(a.data)?a.data:null!==(t=me(a.data,l))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,o=kl(R(e))}}catch(e){}return w(!1),o})),H=e=>{var t;const n=null===(t=null==o?void 0:o.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},F=(e,t)=>{const{columns:n,footSummation:r}=e,i=Al(n),l=El(n);let o='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return o+=`<colgroup>${l.map((e=>{let{width:t,minWidth:n,renderWidth:r}=e;return`<col style="width:${t||r||n||kd.defaultColumnWidth}px">`})).join("")}</colgroup>`,y&&(o+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Wl(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(o+=`<tbody>${t.map((e=>`<tr>${l.map(((n,r)=>{const{rowSpan:i,colSpan:l}=m(e,n,e.index,r,t);return i&&l?`<td rowspan="${i}" colspan="${l}">${A(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),h&&r&&(o+=["<tfoot>",O(l,t).map((e=>`<tr>${l.map(((n,r)=>{const{dataIndex:i,summation:l}=n,o=(null==l?void 0:l.render)?l.render(t):Hl(e,i);return`<td>${0===r&&""===o?Bt("qm.table.config.summaryText"):wn(o)?zl(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),o+="</table>",o},D=null!==(r=null==f?void 0:f.fileName)&&void 0!==r?r:`${g().format(xd)}.xlsx`,$=D.slice(D.lastIndexOf(".")+1).toLowerCase(),M=()=>{if(T)return k.warning(Bt("qm.table.export.warnText"));var e;C?(e=D,En(void 0,void 0,void 0,(function*(){w(!0);try{const{api:t,params:n}=f.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:I.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:i}=e.filter||{};return{title:t,dataIndex:n,type:i,hidden:r}}))},d),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[kd.currentPageName]:void 0,[kd.pageSizeName]:void 0}));r.data&&(Ui(r.data,e),H(e))}catch(e){}w(!1)}))):E(!0)};t.useImperativeHandle(n,(()=>({clickHandle:M})));const q={[`${Dn("table")}-export`]:!0},j={visible:x,title:Bt("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>E(!1)},V={fileName:D.slice(0,D.lastIndexOf(".")),fileType:$,columns:N,useStyle:(null==f?void 0:f.cellStyle)?1:0};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:Fe(q),title:Bt("qm.table.export.textNoSpace"),onClick:()=>M()},t.createElement("i",{className:"svgicon icon"},t.createElement(qe,null))),t.createElement(ll,j,t.createElement(iu,{defaultValue:V,onClose:()=>E(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:Sl(e.columns)}),En(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:l}=t,{allTableData:o,selectionRows:s}=a.current;let c=[];if(u?("all"===r&&(c=yield _()),"custom"===r&&(c=yield _(l),c=c.slice(i-1))):("all"===r&&(c=o.slice(0)),"custom"===r&&(c=o.slice(i-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==f?void 0:f.beforeExport))try{c=null==f?void 0:f.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield L(t,c,O,A);Ui(n,`${e}.xlsx`),H(`${e}.xlsx`)}if("csv"===n){const n=P(t,F(t,c));Ui(n,`${e}.csv`),H(`${e}.csv`)}}))}})))}));lu.displayName="TableExport";const ou=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:l,dataChange:o}=t.useContext(pd),{beforeClipboard:a}=i.current.props,s=t.useRef(null),[c,d]=t.useState([{type:"INPUT_NUMBER",label:Bt("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:Bt("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:n.map(((e,t)=>({value:t,text:Wl(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:Bt("qm.table.clipboard.content"),fieldName:"content",placeholder:Bt("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[u,p]=t.useState(!1),h=Dn("table");return t.createElement("div",{className:`${h}-clipboard__setting`},t.createElement("h3",{className:"info"},Bt("qm.table.clipboard.supportText")),t.createElement(Fc,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:c,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(_n,{onClick:()=>r(),style:{marginRight:8}},Bt("qm.table.export.closeButton")),t.createElement(_n,{type:"primary",loading:u,onClick:()=>En(void 0,void 0,void 0,(function*(){var e;const[t,c]=yield s.current.GET_FORM_DATA();if(t)return;const{tableFullData:d,store:u}=i.current;p(!0);const h=c.content.trim().replace(/(\r|\n)$/,"");let m=h.replace(/"[^"]+"/g,"^");((null===(e=h.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{m=m.replace(/\^/,e)}));let f=m.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof a)try{f=yield a(f,f[0].map(((e,t)=>n[c.colIndex+t].dataIndex)))}catch(t){}f.forEach(((e,t)=>{e.forEach(((e,r)=>{var l,o;const a=d[c.rowIndex-1+t],s=n[c.colIndex+r];if(a&&s){let t=!1;if(s.editRender){const e=s.editRender(a,s);t=!(e.disabled||(null===(l=e.extra)||void 0===l?void 0:l.disabled)||(null===(o=i.current.fieldAuth[s.dataIndex])||void 0===o?void 0:o.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(Fl(a,s.dataIndex,e),u.addToUpdated(a))}}))})),l.current.forceUpdate(),o(),k.success(Bt("qm.table.clipboard.success",{total:f.length})),p(!1),r()}))},Bt("qm.table.clipboard.text"))))},au=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{flattenColumns:i}=t.useContext(pd),[l,o]=t.useState(!1),a=t.useMemo((()=>(e=>e.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))))(i)),[i]),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={[`${Dn("table")}-clipboard`]:!0},d={visible:l,title:Bt("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:Fe(c),title:Bt("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(lt,null))),t.createElement(ll,d,t.createElement(ou,{columns:a,onClose:()=>o(!1)})))}));au.displayName="TableClipboard";const su=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:l,selectionKeys:o,setSelectionKeysEffect:a}=t.useContext(pd),{rowKey:s,rowSelection:c}=i.current.props,d=t.useRef(null),u=$i(d),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,m]=t.useState([{title:Bt("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(n.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))))]),[f]=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})()),[g,v]=t.useState(300),y=ji((()=>{const e=d.current;v(e.offsetHeight-2*Qo[l]-30)}),5);return qi((()=>{y()}),[u.width]),t.createElement("div",{ref:d,style:{height:"100%"}},t.createElement(Qu,{size:l,columns:h,dataSource:f,rowKey:s,height:g,rowSelection:{type:"checkbox",selectedRowKeys:o,onChange:e=>a(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>m(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(_n,{onClick:()=>r()},Bt("qm.table.selectCollection.closeButton"))))},cu=t.forwardRef(((e,n)=>{const{columns:r,open:i=!0}=e,{tableRef:l,getRowKey:o,selectionKeys:a,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=t.useContext(pd),{rowSelection:p}=l.current.props,[h,m]=t.useState(!1),f=t.useRef(!1);fi((()=>{!f.current&&g()}),[c]);const g=()=>En(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=p;if(s&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:a},t.params));if(200===r.code){let i=Array.isArray(r.data)?r.data:null!==(e=me(r.data,t.dataKey))&&void 0!==e?e:[];i=i.filter((e=>!n(e))),d(i.map(((e,t)=>o(e,t)))),u(i),f.current=!0}}catch(e){}})),v=()=>{m(!0)};t.useImperativeHandle(n,(()=>({clickHandle:v})));const y=Dn("table"),b={visible:h,title:Bt("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:`${y}-select-collection`,title:Bt("qm.table.selectCollection.text"),onClick:()=>v()},t.createElement("i",{className:"svgicon icon"},t.createElement(ot,null))),t.createElement(ll,b,t.createElement(su,{columns:r,onClose:()=>m(!1)})))}));cu.displayName="SelectCollection";const du=e=>{const{onClose:n}=e,{global:r}=t.useContext(Vt),{tableRef:i,getRowKey:l,$size:o,flattenColumns:a,pagination:s,createWebPageData:c,setPagination:d,scrollYToRecord:u,setHighlightKey:p,setShouldToTop:h,isTreeTable:m,isWebPagination:f}=t.useContext(pd),{uniqueKey:g}=i.current.props,v=t.useRef(null),y=t.useRef(null),b=t.useRef([]),x=t.useRef(""),E=t.useRef(-1),S=t.useRef("stop");fi((()=>{const e=kl(c()).findIndex((e=>l(e,e.index)===x.current));u("",e)}),[s.current]);const w=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},C=e=>e.filter((e=>null==e?void 0:e.dataIndex)).map((e=>{var t;return{type:w(e.filter.type),fieldName:e.dataIndex,label:Wl(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:null!==(t=e.dictItems)&&void 0!==t?t:[]},onChange:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA(),[n,r]=yield y.current.GET_FORM_DATA(),i=ke(Object.assign({},t,r),kn);R(i)}))}})),T={case:0,fullchar:0},N=t.useMemo((()=>a.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[a]),[I,R]=t.useState({}),[O,k]=t.useState(T),[A]=t.useState(C([N[0]])),[L]=t.useState(C(N.slice(1))),[H,F]=t.useState(0),D=t.useMemo((()=>!Object.keys(I).length),[I]);fi((()=>{S.current="ready"}),[I,O]);const $=e=>{k(Object.assign({},O,e))},q=(e,t,n)=>new Promise(((r,i)=>{P.confirm({title:Bt("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),j=e=>En(void 0,void 0,void 0,(function*(){if(!Object.keys(I).length)return P.warning({title:Bt("qm.button.confirmPrompt"),content:Bt("qm.table.fastSearch.queryCondition")});if("ready"===S.current&&(S.current="stop",b.current=(e=>{const{allTableData:t}=i.current,n=[];for(let i=0,l=t.length;i<l;i++){const l=t[i];let o=!0;for(const t in e){const{type:n}=N.find((e=>e.dataIndex===t)).filter;let i=Hl(l,t),a=!0;if("text"===n||"textarea"===n?a=new RegExp(O.fullchar?`^${e[t]}$`:e[t],O.case?"":"i").test(i):(i="string"==typeof(r=i)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(r)?i.slice(0,10):i,a=i==e[t]),!a){o=!1;break}}o&&n.push(l)}var r;return n})(I),F(b.current.length)),!b.current.length)return p(""),P.warning({title:Bt("qm.button.confirmPrompt"),content:Bt("qm.table.fastSearch.notMatch")});"next"===e&&(E.current=E.current<0?0:E.current+1,E.current>b.current.length-1&&(yield q(Bt("qm.table.fastSearch.toTheEnd"),(()=>E.current=0),(()=>E.current=b.current.length-1)))),"prev"===e&&(E.current=E.current<0?b.current.length-1:E.current-1,E.current<0&&(yield q(Bt("qm.table.fastSearch.toStart"),(()=>E.current=b.current.length-1),(()=>E.current=0))));const t=b.current[E.current],n=l(t,t.index);let r=t.index;if(m&&f){const e=Xl(i.current.deriveRowKeys,n)[0];r=i.current.tableFullData.findIndex((t=>l(t,t.index)===e))}((e,t)=>{if(x.current=e,f){const{pageSize:e}=s,n=Math.ceil((t+1)/e);h(!1),d(Object.assign({},s,{current:n}))}else u(e)})(n,r),p(n)})),V=()=>{v.current.RESET_FORM(),y.current.RESET_FORM()},K=t.useMemo((()=>g?`fastSearch_${g}`:""),[g]),[z,W]=t.useState([]),[B,U]=t.useState(""),[G,Y]=t.useState("");fi((()=>{if(G){const{filters:e,config:t}=z.find((e=>e.value===G)).list;v.current.SET_FIELDS_VALUE(An(e,L.map((e=>e.fieldName)))),y.current.SET_FIELDS_VALUE(An(e,A.map((e=>e.fieldName)))),R(e),k(t)}else V(),R({}),k(T)}),[G]),t.useEffect((()=>{X()}),[]);const X=()=>En(void 0,void 0,void 0,(function*(){if(!K)return;let e=yield Mt.getItem(K);e||(e=yield Z(K),Array.isArray(e)&&(yield Mt.setItem(K,e))),Array.isArray(e)&&e.length&&(W(e),Y(e[0].value))})),Z=e=>En(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)=>En(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),J=Dn("table");return t.createElement("div",{className:`${J}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"top"},t.createElement("div",{className:"container"},t.createElement(tl,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,Bt("qm.table.alert.total",{total:H}))},t.createElement(tl.TabPane,{tab:Bt("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t.createElement(Fc,{ref:v,items:A,cols:1,labelWidth:110})),t.createElement(tl.TabPane,{tab:Bt("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t.createElement(Fc,{ref:y,items:L,cols:1,labelWidth:110})))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(_,{size:o,value:B,placeholder:Bt("qm.table.highSearch.configText"),disabled:D,onChange:e=>{const{value:t}=e.target;U(t)}}),t.createElement(_n,{type:"primary",disabled:!B||D,style:{marginLeft:"10px"},onClick:()=>En(void 0,void 0,void 0,(function*(){if(!K)return Xt("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Kl(),t=[...z,{text:B,value:e,list:{filters:I,config:O}}];W(t),Y(e),U(""),yield Mt.setItem(K,t),yield Q(K,t)}))},Bt("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${kd.rowHeightMaps[o]}px`}},t.createElement("span",null,Bt("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,z.map((e=>t.createElement("li",{key:e.value,className:Fe({selected:e.value===G}),title:e.text,onClick:()=>{return t=e.value,void Y(t!==G?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:Bt("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,En(void 0,void 0,void 0,(function*(){if(!n)return;const e=z.filter((e=>e.value!==n));W(e),n===G&&Y(""),yield Mt.setItem(K,e),yield Q(K,e)}))}},t.createElement(at,null))))),!z.length&&t.createElement("div",{style:{padding:fd}},t.createElement(Li,null)))))),t.createElement("div",{className:"bottom"},t.createElement("div",null,t.createElement(M,{checked:!!O.case,onChange:e=>$({case:e.target.checked})},Bt("qm.table.fastSearch.matchCase")),t.createElement(M,{checked:!!O.fullchar,onChange:e=>$({fullchar:e.target.checked})},Bt("qm.table.fastSearch.matchFullchar"))),t.createElement("div",null,t.createElement(_n,{onClick:()=>V()},Bt("qm.table.fastSearch.clear"))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Qo[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>n(),style:{marginRight:8}},Bt("qm.table.fastSearch.closeButton")),t.createElement(_n,{type:"primary",style:{marginRight:8},onClick:()=>j("prev")},Bt("qm.table.fastSearch.queryPrev")),t.createElement(_n,{type:"primary",onClick:()=>j("next")},Bt("qm.table.fastSearch.queryNext"))))},uu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{$size:i}=t.useContext(pd),[l,o]=t.useState(!1),a=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:a})));const s=Dn("table"),c={visible:l,title:Bt("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Qo[i]+20}px`},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${s}-super-search`,title:Bt("qm.table.fastSearch.text"),onClick:()=>a()},t.createElement("i",{className:"svgicon icon"},t.createElement(st,null))),t.createElement(ll,c,t.createElement(du,{onClose:()=>o(!1)})))}));uu.displayName="FastSearch";const pu=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:l,$size:o,pagination:a,fetchParams:s,isFetch:c}=t.useContext(pd),{fetch:d}=l.current.props,u=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},u(e.group)))),h=i.map((e=>e.summary===kd.groupSummary.total.value?{dataIndex:e.summary,title:kd.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},u(e.summary)),{formula:e.formula}))),m=t.useMemo((()=>Object.assign({},s,{[kd.sorterFieldName]:void 0,[kd.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[kd.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[kd.currentPageName]:1})),[s,r,i]),[f,v]=t.useState(((e,t)=>[{title:Bt("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===kd.groupSummary.total.value&&(i={dataIndex:kd.groupSummary.recordTotalIndex,summation:{render:()=>a.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?i:null)}))])(p,h)),[y]=t.useState(c?[]:(e=>{const t=Gl(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};f.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&Fl(t,r,Hl(e[0],r))})),i.forEach((n=>{const r=n.summary!==kd.groupSummary.total.value?n.summary:kd.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&Fl(t,r,e.length),"sum"===i&&Fl(t,r,Ae(e,r)),"max"===i&&Fl(t,r,Le(e,r)[r]),"min"===i&&Fl(t,r,Pe(e,r)[r]),"avg"===i&&Fl(t,r,(Ae(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(l.current.tableFullData)),b=Object.assign(Object.assign({size:o,height:400},c?{fetch:{api:d.api,params:m,dataKey:null==d?void 0:d.dataKey}}:{dataSource:y}),{columns:f,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${g().format(xd)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)});return t.createElement(Qu,b)},hu=e=>{const{onClose:n}=e,{global:r}=t.useContext(Vt),{tableRef:i,$size:l,flattenColumns:o}=t.useContext(pd),{uniqueKey:a}=i.current.props,s=t.useRef(null),c=t.useRef(null),[d,u]=t.useState(!1),[p,h]=t.useState([]),[m,f]=t.useState(""),[g,v]=t.useState("");fi((()=>{if(g){const{group:e,summary:t}=p.find((e=>e.value===g)).list;C(e),R(t)}else{const e=P();C((null==e?void 0:e.group)||[]),R((null==e?void 0:e.summary)||[])}}),[g]),t.useEffect((()=>{H()}),[]);const y=t.useMemo((()=>a?`summary_${a}`:""),[a]),b=t.useMemo((()=>o.filter((e=>![kd.expandableColumn,kd.selectionColumn,"index","pageIndex",kd.operationColumn].includes(e.dataIndex)))),[o]),x=b.filter((e=>!e.groupSummary)).map((e=>({text:Wl(e.title),value:e.dataIndex}))),E=[kd.groupSummary.total,...b.filter((e=>!!e.groupSummary)).map((e=>({text:Wl(e.title),value:e.dataIndex})))],S=[{text:Bt("qm.table.groupSummary.sumText"),value:"sum"},{text:Bt("qm.table.groupSummary.maxText"),value:"max"},{text:Bt("qm.table.groupSummary.minText"),value:"min"},{text:Bt("qm.table.groupSummary.avgText"),value:"avg"},{text:Bt("qm.table.groupSummary.countText"),value:"count"}],[w,C]=t.useState([]),[T,N]=t.useState([{title:Bt("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(_n,{type:"text",onClick:()=>{s.current.REMOVE_RECORDS(n)}},Bt("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:Bt("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:x.map((e=>Object.assign(Object.assign({},e),{disabled:w.findIndex((t=>t.group===e.value))>-1})))})}]),[I,R]=t.useState([]),[O,k]=t.useState([{title:Bt("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(_n,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(n)}},Bt("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:Bt("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:E.map((e=>Object.assign(Object.assign({},e),{disabled:I.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:Bt("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===kd.groupSummary.total.value?S.slice(S.length-1):S})}]),A=t.useMemo((()=>{const e=w.length&&w.every((e=>Object.values(e).every((e=>""!==e)))),t=I.length&&I.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[w,I]),L=()=>{y&&sessionStorage.setItem(y,JSON.stringify({group:w.filter((e=>!!e.group)),summary:I.filter((e=>!!e.summary))}))},P=()=>{if(!y)return;const e=sessionStorage.getItem(y);return e?JSON.parse(e):null},H=()=>En(void 0,void 0,void 0,(function*(){if(!y)return;const e=P();if(e){const{group:t,summary:n}=e;C(t),R(n)}let t=yield Mt.getItem(y);t||(t=yield F(y),Array.isArray(t)&&(yield Mt.setItem(y,t))),Array.isArray(t)&&t.length&&(h(t),!e&&v(t[0].value))})),F=e=>En(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){}})),D=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),$=Dn("table"),M={visible:d,title:Bt("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>u(!1)};return t.createElement("div",{className:`${$}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Qu,{ref:s,size:l,columns:T,dataSource:w,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>N(e),onDataChange:e=>{C(e)}},t.createElement(_n,{type:"primary",icon:t.createElement(ct,null),onClick:()=>{s.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(Qu,{ref:c,size:l,columns:O,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{R(e)}},t.createElement(_n,{type:"primary",icon:t.createElement(ct,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(_,{size:l,value:m,placeholder:Bt("qm.table.groupSummary.configText"),disabled:A,onChange:e=>{const{value:t}=e.target;f(t)}}),t.createElement(_n,{type:"primary",disabled:!m||A,style:{marginLeft:"10px"},onClick:()=>En(void 0,void 0,void 0,(function*(){if(!y)return Xt("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Kl(),t=[...p,{text:m,value:e,list:{group:w.filter((e=>!!e.group)),summary:I.filter((e=>!!e.summary))}}];h(t),v(e),f(""),yield Mt.setItem(y,t),yield D(y,t)}))},Bt("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${kd.rowHeightMaps[l]}px`}},t.createElement("span",null,Bt("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,p.map((e=>t.createElement("li",{key:e.value,className:Fe({selected:e.value===g}),title:e.text,onClick:()=>{return t=e.value,void v(t!==g?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:Bt("qm.table.groupSummary.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,En(void 0,void 0,void 0,(function*(){if(!n)return;const e=p.filter((e=>e.value!==n));h(e),n===g&&v(""),yield Mt.setItem(y,e),yield D(y,e)}))}},t.createElement(at,null))))),!p.length&&t.createElement("div",{style:{padding:fd}},t.createElement(Li,null)))))),t.createElement(ll,M,t.createElement(pu,{columns:b,group:w,summary:I})),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(_n,{onClick:()=>n(),style:{marginRight:8}},Bt("qm.table.groupSummary.closeButton")),t.createElement(_n,{type:"primary",disabled:A,onClick:()=>(L(),void u(!0))},Bt("qm.table.groupSummary.confirmButton"))))},mu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,[i,l]=t.useState(!1),o=()=>{l(!0)};t.useImperativeHandle(n,(()=>({clickHandle:o})));const a=Dn("table"),s={visible:i,title:Bt("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${a}-group-summary`,title:Bt("qm.table.groupSummary.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(dt,null))),t.createElement(ll,s,t.createElement(hu,{onClose:()=>l(!1)})))}));mu.displayName="GroupSummary";const fu=e=>{const{onClose:n}=e,{global:r}=t.useContext(Vt),{tableRef:i,$size:l,flattenColumns:o,setSuperFilters:a,clearTableFilter:s}=t.useContext(pd),{uniqueKey:c}=i.current.props,d=t.useRef(null),[u,p]=t.useState([]),[h,m]=t.useState([]),[f,g]=t.useState(""),[v,y]=t.useState("");fi((()=>{p(v?h.find((e=>e.value===v)).list:P()||[])}),[v]),t.useEffect((()=>{H()}),[]);const b=t.useMemo((()=>c?`superSearch_${c}`:""),[c]),x=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),E=Ul(u),S=t.useMemo((()=>!(E&&bl(E))),[E]),w=t.useMemo((()=>!!u.length&&S),[u,S]),C=[{value:"and",text:Bt("qm.table.highSearch.andText")},{value:"or",text:Bt("qm.table.highSearch.orText")}],T=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Wl(e.title)}))),N=e=>["in","nin"].includes(e),I=(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},R=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:Bt("qm.table.highSearch.gtText")},{value:"<",text:Bt("qm.table.highSearch.ltText")},{value:">=",text:Bt("qm.table.highSearch.gteText")},{value:"<=",text:Bt("qm.table.highSearch.lteText")},{value:"==",text:Bt("qm.table.highSearch.eqText")},{value:"!=",text:Bt("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:Bt("qm.table.highSearch.inText")},{value:"nin",text:Bt("qm.table.highSearch.ninText")},{value:"==",text:Bt("qm.table.highSearch.eqText")},{value:"!=",text:Bt("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:Bt("qm.table.highSearch.likeText")},{value:"==",text:Bt("qm.table.highSearch.eqText")},{value:"!=",text:Bt("qm.table.highSearch.neqText")}]}return t},[O,k]=t.useState([{title:Bt("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(_n,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},Bt("qm.table.highSearch.removeText")))},{title:Bt("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:Bt("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:T,rules:[{required:!0,message:Bt("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const i=Object.values(t)[0],l=null===(n=x.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,o=R(l);e.fieldType=l,e.expression=i?null===(r=o[0])||void 0===r?void 0:r.value:"",e.condition=N(e.expression)?[]:"",i||(e.bracketLeft=e.bracketRight="")}})},{title:Bt("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:Bt("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{var t;const n=null===(t=x.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:R(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=N(e.expression)?[]:""}}}},{title:Bt("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const i=x.find((t=>t.dataIndex===e.fieldName)),l=null==i?void 0:i.filter.type,o=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:I(l,N(e.expression)),editable:!0,items:o,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:Bt("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:Bt("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:C,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),A=()=>{s(),a(u.map((e=>An(e,["index","pageIndex"])))),L(),n()},L=()=>{b&&sessionStorage.setItem(b,JSON.stringify(u.filter((e=>!!e.fieldName))))},P=()=>{if(!b)return;const e=sessionStorage.getItem(b);return e?JSON.parse(e):null},H=()=>En(void 0,void 0,void 0,(function*(){if(!b)return;const e=P();e&&p(e);let t=yield Mt.getItem(b);t||(t=yield F(b),Array.isArray(t)&&(yield Mt.setItem(b,t))),Array.isArray(t)&&t.length&&(m(t),!e&&y(t[0].value))})),F=e=>En(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){}})),D=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),$=Dn("table");return t.createElement("div",{className:`${$}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Qu,{ref:d,size:l,columns:O,dataSource:u,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(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]?"":")"),p([...u]))},onDataChange:e=>{p(e)}},t.createElement(_n,{type:"primary",icon:t.createElement(ct,null),onClick:()=>{d.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),kd.highSearch.showSQL&&E&&t.createElement("code",{className:"lang-js"},E)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(_,{size:l,value:f,placeholder:Bt("qm.table.highSearch.configText"),disabled:S,onChange:e=>{const{value:t}=e.target;g(t)}}),t.createElement(_n,{type:"primary",disabled:!f||S,style:{marginLeft:"10px"},onClick:()=>En(void 0,void 0,void 0,(function*(){if(!b)return Xt("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Kl(),t=[...h,{text:f,value:e,list:u.filter((e=>!!e.fieldName))}];m(t),y(e),g(""),yield Mt.setItem(b,t),yield D(b,t)}))},Bt("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${kd.rowHeightMaps[l]}px`}},t.createElement("span",null,Bt("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.value,className:Fe({selected:e.value===v}),title:e.text,onClick:()=>{return t=e.value,void y(t!==v?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:Bt("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,En(void 0,void 0,void 0,(function*(){if(!n)return;const e=h.filter((e=>e.value!==n));m(e),n===v&&y(""),yield Mt.setItem(b,e),yield D(b,e)}))}},t.createElement(at,null))))),!h.length&&t.createElement("div",{style:{padding:fd}},t.createElement(Li,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(_n,{onClick:()=>n(),style:{marginRight:8}},Bt("qm.table.highSearch.closeButton")),t.createElement(_n,{type:"primary",disabled:w,onClick:()=>A()},Bt("qm.table.highSearch.searchButton"))))},gu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,[i,l]=t.useState(!1),o=()=>{l(!0)};t.useImperativeHandle(n,(()=>({clickHandle:o})));const a=Dn("table"),s={visible:i,title:Bt("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${a}-super-search`,title:Bt("qm.table.highSearch.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(ut,null))),t.createElement(ll,s,t.createElement(fu,{onClose:()=>l(!1)})))}));gu.displayName="SuperSearch";const vu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:l,showPrint:o,showImport:a,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:p,showGroupSummary:h,showToolBox:m}=e,{global:f}=t.useContext(Vt),{tableRef:g,isFullScreen:v,$size:y}=t.useContext(pd),{uniqueKey:b,exportExcel:x}=g.current.props,E=t.useRef(null),S=t.useRef(null),w=t.useRef(null),C=t.useRef(null),T=t.useRef(null),N=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),A=t.useRef(!1),L=t.useMemo((()=>b?`toolBox_${b}`:""),[b]),[P,_]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),H={fullScreen:i,reload:l,print:o,import:a,export:s&&!(null==x?void 0:x.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:p,groupSummary:h},[F,D]=t.useState(!1);fi((()=>{A.current&&(j(),A.current=!1)}),[P]),t.useEffect((()=>{$()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!T.current)return Xt("Table","执行导出需要配置 `exportExcel` 参数");T.current.clickHandle()}})));const $=()=>{if(!L||!m)return;const e=JSON.parse(localStorage.getItem(L));e||V(L).then((e=>{e&&(_(Object.assign({},P,e)),localStorage.setItem(L,JSON.stringify(e)))})).catch((()=>{})),e&&_(Object.assign({},P,e))},j=()=>{if(!L||!m)return;const e={};for(const t in P)P[t]&&(e[t]=P[t]);localStorage.setItem(L,JSON.stringify(e)),K(L,e)},V=e=>En(void 0,void 0,void 0,(function*(){const t=null==f?void 0:f.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),K=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==f?void 0:f.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),z=e=>En(void 0,void 0,void 0,(function*(){D(!1),yield In(100),e.current.clickHandle()})),W=(e,t)=>{A.current=!0,_(Object.assign({},P,{[t]:e}))},B=Dn("table"),U={"top-toolbox__popper":!0,[`${B}--lg`]:"large"===y,[`${B}--sm`]:"small"===y};return t.createElement(t.Fragment,null,i&&t.createElement(jd,{ref:E,isFullScreen:v,open:!m||P.fullScreen}),l&&t.createElement(Vd,{ref:S,open:!m||P.reload}),o&&t.createElement(zd,{ref:w,tableColumns:r,open:!m||P.print}),a&&t.createElement(nu,{ref:C,tableColumns:r,open:!m||P.import}),s&&t.createElement(lu,{ref:T,tableColumns:r,open:(!m||P.export)&&!(null==x?void 0:x.hideIcon)}),c&&t.createElement(au,{ref:N,open:!m||P.clipboard}),d&&t.createElement(cu,{ref:I,columns:r,open:!m||P.collection}),u&&t.createElement(uu,{ref:R,open:!m||P.fastSearch}),h&&t.createElement(mu,{ref:O,open:!m||P.groupSummary}),p&&t.createElement(gu,{ref:k,open:!m||P.superSearch}),m&&t.createElement(q,{open:F,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.screen.full"))),onClick:()=>z(E)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.refresh.text"))),onClick:()=>z(S)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.print.text"))),onClick:()=>z(w)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.import.textNoSpace"))),onClick:()=>z(C)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.export.textNoSpace"))),onClick:()=>z(T)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.clipboard.textNoSpace"))),onClick:()=>z(N)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.selectCollection.text"))),onClick:()=>z(I)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.fastSearch.text"))),onClick:()=>z(R)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.groupSummary.text"))),onClick:()=>z(O)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:P.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,Bt("qm.table.highSearch.text"))),onClick:()=>z(k)}];return t.createElement(Q,{items:e.filter((e=>H[e.key]))})})(),overlayClassName:Fe(U),overlayStyle:{minWidth:120},onOpenChange:e=>{D(e)}},t.createElement("span",{className:`${B}-toolbox`,title:Bt("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(pt,null)))))}));vu.displayName="ToolBox";const yu=(e,t)=>e.map((e=>(e.children&&(e.children=yu(e.children,t)),t(e)))),bu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(Vt),{tableRef:l,$size:o}=t.useContext(pd),{showColumnDefine:a,uniqueKey:s,onlyShowIcon:c,columnsChange:d}=l.current.props,u=t.useRef([]),[p,h]=t.useState(!1),m=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),f=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),g=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),v=t.useMemo((()=>s?`table_${s}`:""),[s]);fi((()=>{x(r)}),[r]),t.useLayoutEffect((()=>{E()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:E})));const y=()=>{if(!v)return;const e=JSON.parse(localStorage.getItem(v));var t;if(e||(t=v,En(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(v,JSON.stringify(e)),E()):(null==i?void 0:i.getComponentConfigApi)&&x(r)})).catch((()=>{})),!e)return;return ye(wl(e).map((e=>e.dataIndex)),wl(r).map((e=>e.dataIndex))).length>0?yu(r,(t=>{const n=Tl(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})):yu(e,(e=>{const t=Tl(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},b=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=b(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)})),x=e=>{if(!v)return;const t=b(e),n=JSON.parse(localStorage.getItem(v));var r,o;l.current.columnsDefined&&!ge(t,n)&&(localStorage.setItem(v,JSON.stringify(t)),r=v,o=t,En(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:o})}catch(e){}})))},E=()=>{const e=y();var t;e&&(t=S(e),u.current=t,null==d||d(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((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(r,r+i))})),t},w=()=>{const e=t=>t.map((t=>{const n=Tl(r,t.dataIndex)||Ln(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));null==d||d(e(l.current.originColumns))},C=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=u.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===l)return t.push(n);t.push(...u.current[l].map(((t,r)=>{let{dataIndex:i}=t;const l=e.find((e=>e.dataIndex===i));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==d||d(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},N=(e,n)=>{var i;const{colSpan:l,noFixed:o}=e;if(0===l)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=Wl(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,C(r)}}),t.createElement("i",{className:Fe(s),title:Bt("qm.table.columnFilter.draggable")},t.createElement(Ke,null)),t.createElement("span",{className:"text",title:a},a),"main"===n?t.createElement("span",{className:Fe("fixed",o?"disabled":"")},t.createElement("i",{className:"svgicon",title:Bt("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},t.createElement(ht,null)),t.createElement("i",{className:"svgicon",title:Bt("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},t.createElement(mt,null))):"sub"!==n?t.createElement("span",{className:Fe("fixed",o?"disabled":"")},t.createElement("i",{className:"svgicon",title:Bt("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},t.createElement(at,null))):null);return!e.hidden&&(null===(i=e.children)||void 0===i?void 0:i.length)?t.createElement(J,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:I(e.children,e.dataIndex)},c):c},I=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement($t,{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));ge(i,l)||((e,t)=>{Tl(r,t).children=e,null==d||d([...r])})(Jl(t),n)}},e.map((e=>N(e,"sub"))))),R=Dn("table"),O={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===o,[`${R}--sm`]:"small"===o},k=[`${R}-column-filter`,{selected:p}];return a?t.createElement(_s,{action:["click"],popupVisible:p,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(_n,{type:"text",size:"small",onClick:w},Bt("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement($t,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:m,setList:e=>{const t=e.map((e=>e.dataIndex)),n=m.map((e=>e.dataIndex));ge(t,n)||C([...Jl(e),...g,...f])}},m.map((e=>N(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement($t,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),n=g.map((e=>e.dataIndex));ge(t,n)||C([...m,...Jl(e),...f])}},g.map((e=>N(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement($t,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:f,setList:e=>{const t=e.map((e=>e.dataIndex)),n=f.map((e=>e.dataIndex));ge(t,n)||C([...m,...g,...Jl(e)])}},f.map((e=>N(e,"right")))))),popupClassName:Fe(O),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{h(e)},builtinPlacements:Ed,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Fe(k),title:c?Bt("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(it,null)),!c&&t.createElement("span",null,Bt("qm.table.columnFilter.text")))):null}));bu.displayName="ColumnFilter";const xu=()=>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"})),Eu=e=>{const{column:n,filters:r}=e,{$size:i,setFilters:l,clearSuperFilters:o}=t.useContext(pd),a=t.useRef(null),s=t.useRef(null),c=t.useRef(null),[d,u]=t.useState(!1),[p,h]=t.useState(!1),[m,f]=t.useState({}),g=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),v=t.useMemo((()=>{let e=!1;for(const t in r[g])if(!kn(r[g][t])||p){e=!0;break}return e}),[g,r,p]);t.useLayoutEffect((()=>{d&&setTimeout((()=>y()),20)}),[d]),t.useEffect((()=>{var e;ge(m[g],r[g])||f({[g]:r[g]||{}}),h(""===(null===(e=r[g])||void 0===e?void 0:e["=="]))}),[r]);const y=()=>{switch(n.filter.type){case"text":a.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},b=e=>{e&&f(e),o(),l((e=>{for(const t in e){for(const n in e[t])if(kn(e[t][n])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][n])continue;delete e[t][n]}Object.keys(e[t]).length||delete e[t]}return e})(Object.assign(Object.assign(Object.assign({},r),m),e))),u(!1)},x={text:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(_,{ref:a,size:i,placeholder:Bt("qm.table.filter.searchText",{text:Wl(e.title)}),style:{width:"180px"},value:null!==(r=null===(n=m[g])||void 0===n?void 0:n.like)&&void 0!==r?r:"",disabled:p,onChange:e=>{const{value:t}=e.target;f((e=>Object.assign({},e,{[g]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&b()}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:p,onChange:e=>{const{checked:t}=e.target,n=t?"":null;f((e=>Object.assign({},e,{[g]:{"==":n,like:null}}))),h(t)}},Bt("qm.table.filter.nullValue"))))},textarea:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(_.TextArea,{ref:c,size:i,placeholder:Bt("qm.table.filter.searchAreaText",{text:Wl(e.title)}),style:{width:"220px"},value:null!==(r=null===(n=m[g])||void 0===n?void 0:n.likes)&&void 0!==r?r:"",disabled:p,onChange:e=>{const{value:t}=e.target;f((e=>Object.assign({},e,{[g]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),b())}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:p,onChange:e=>{const{checked:t}=e.target,n=t?"":null;f((e=>Object.assign({},e,{[g]:{"==":n,like:null}}))),h(t)}},Bt("qm.table.filter.nullValue"))))},number:e=>{const n=e=>{var t,n;return{value:null!==(n=null===(t=m[g])||void 0===t?void 0:t[e])&&void 0!==n?n:"",size:i,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||f((n=>Object.assign({},n,{[g]:Object.assign({},n[g],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&b()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(j,hn({ref:s},n(">"),{placeholder:Bt("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(j,hn({},n("<"),{placeholder:Bt("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(j,hn({},n("=="),{placeholder:Bt("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(j,hn({},n("!="),{placeholder:Bt("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:jl(null===(t=m[g])||void 0===t?void 0:t[e],yd),format:yd,size:i,onChange:t=>{f((n=>Object.assign({},n,{[g]:Object.assign({},n[g],{[e]:Vl(t,yd)})})))},onKeyDown:e=>{13===e.keyCode&&b()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(pn,hn({},n(">"),{placeholder:Bt("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(pn,hn({},n("<"),{placeholder:Bt("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(pn,hn({},n("=="),{placeholder:Bt("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(pn,hn({},n("!="),{placeholder:Bt("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("ul",null,t.createElement(K.Group,{style:{width:"100%"},value:null===(n=m[g])||void 0===n?void 0:n["=="],onChange:e=>{const{value:t}=e.target;f((e=>Object.assign({},e,{[g]:{"==":t}})))}},l.map((e=>t.createElement("li",{key:e.value},t.createElement(K,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("ul",null,t.createElement(M.Group,{style:{width:"100%"},value:null===(n=m[g])||void 0===n?void 0:n.in,onChange:e=>{f((t=>Object.assign({},t,{[g]:{in:e}})))}},l.map((e=>t.createElement("li",{key:e.value},t.createElement(M,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("div",{style:Object.assign({height:200},r.style)},t.createElement(ud,{multiple:!0,value:(null===(n=m[g])||void 0===n?void 0:n.in)||[],dataSource:l,onCheckChange:e=>{const t=e.map((e=>e.value));f((e=>Object.assign({},e,{[g]:{in:t}})))}}))}},E=()=>t.createElement(N,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t.createElement(_n,{size:i,onClick:()=>(b({[g]:{}}),void h(!1))},Bt("qm.table.filter.reset")),t.createElement(_n,{type:"primary",size:i,onClick:()=>b()},Bt("qm.table.filter.search"))),S=Dn("table"),w={"head-filter__popper":!0,[`${S}--lg`]:"large"===i,[`${S}--sm`]:"small"===i},C=["cell--filter",{selected:d,actived:v}];return t.createElement(_s,{action:["click"],popupVisible:d,popup:(()=>{const e=n.filter.type,r=x[e];return r?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement("div",null,r(n)),E()):(Xt("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Fe(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:Ed,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:Fe(C),title:Bt("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(xu,null))))},Su=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(pd),{columns:l,resizable:o,columnsChange:a=Tn}=r.current.props,s=t.useMemo((()=>Il(n)),[n]),c={resizable:!0,"is--line":o&&!i};return t.createElement("div",{className:Fe(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,i=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Ll(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),i.style.left=`${d}px`,i.style.display="block";const u=s.width||s.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,n=u+t;n<(s.minWidth||kd.defaultColumnWidth)||(p=Math.floor(n),i.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Tl(l,s.dataIndex).width=p,a([...l]))},!1}})},wu=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:l,createWebPageData:o,setSelectionKeysEffect:a,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=t.useContext(pd),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:f,onSelectAll:g}=p,v=t.useRef([]),y=t.useMemo((()=>d&&!!h),[d,h]),b=t.useMemo((()=>!y&&!!m),[y,m]),x=t.useMemo((()=>(null==f||f)&&!b),[f,b]),E=()=>u?o():r.current.tableFullData,S=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>i(e,e.index)))},w=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:n}=p;if(y)return v.current.length?v.current:_e(t,S());if(!b)return n?t.filter((t=>!n(e.get(t)))):t;const l=n?E().filter((e=>!n(e))).map((e=>i(e,e.index))):E().map((e=>i(e,e.index)));return _e(l,S())})(),C=n.filter((e=>!w.includes(e))),T=n.length-C.length,N=T>0&&T<w.length,I=!!T&&T===w.length;s(C);const R=()=>En(void 0,void 0,void 0,(function*(){var e;const t=h;let n=[];c(!0);try{const r=yield t.api(l);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=me(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:l}=p;l&&(n=ye(n,E().filter((e=>l(e))).map((e=>i(e,e.index))))),v.current=n}}catch(e){}return c(!1),n})),O=e=>En(void 0,void 0,void 0,(function*(){let t=[];t=y?e?yield R():[]:e?w.slice(0):[],t=[...new Set([...t,...C])],a(t),null==g||g(e,t)})),k=()=>{const e=[{key:1,label:Bt("qm.table.selection.all"),onClick:()=>{O(!0)}},{key:2,label:Bt("qm.table.selection.invert"),onClick:()=>En(void 0,void 0,void 0,(function*(){let e=[];e=ye(n,y?yield R():w),e=[...new Set([...e,...C])],a(e)}))},{key:3,label:Bt("qm.table.selection.clear"),onClick:()=>{O(!1)}}];return t.createElement(Q,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(M,{checked:I,indeterminate:N,disabled:!w.length,onChange:e=>O(e.target.checked)}),x&&t.createElement(q,{overlayClassName:"all-selection__popper",dropdownRender:()=>k()},t.createElement($e,{className:"svgicon icon"})),b&&t.createElement(Y,{placement:"top",title:Bt("qm.table.selection.currentPage")},t.createElement(ft,{className:"info"})))},Cu=e=>{const{style:n}=e,{tableRef:r,isTreeTable:i,setRowExpandedKeys:l}=t.useContext(pd),{expandable:o}=r.current.props,[a,s]=t.useState((null==o?void 0:o.defaultExpandAllRows)||!1);fi((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;l(a?e.filter((e=>!(i&&t.includes(e)))):[])}),[a]);const c={[`${Dn("expand")}--icon`]:!0,expanded:a,collapsed:!a};return t.createElement("span",{className:Fe(c),title:"",onClick:e=>{e.stopPropagation(),s(!a)},style:n})},Tu=()=>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"})),Nu=()=>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"})),Iu=e=>{const{tableColumns:n,sorter:r,filters:i}=e,{tableRef:l,layout:o,scrollY:a,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:h,isTreeTable:m,isGroupSubtotal:f,tableChange:g,setSorter:v,setElementStore:y,resetTableScroll:b,getStickyLeft:x,getStickyRight:E,createGroupData:S,createTableFullData:w}=t.useContext(pd),{ellipsis:C,resizable:T,multipleSort:N,rowSelection:I,expandable:R}=l.current.props,[O,k]=kd.sortDirections,{tableOriginData:A}=l.current,L=t.useRef(null),P=t.useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),_=t.useMemo((()=>!h),[h]),H=t.useMemo((()=>!h),[h]),F=t.useMemo((()=>!(null==R?void 0:R.hideExpandAll)),[R]),D=t.useMemo((()=>!!I&&(h?!(!I.selectAllOnCurrentPage&&!I.fetchAllRowKeys):!I.hideSelectAll)),[h,I]);fi((()=>{z(),g(),b()}),[r]),fi((()=>{U(),g(),b()}),[i]),fi((()=>{U(),g(),b()}),[c]),t.useEffect((()=>{!kn(r)&&Rn((()=>z())),!kn(i)&&Rn((()=>U()))}),[]),t.useLayoutEffect((()=>{$()}),[]);const $=()=>{y("$header",L.current)},M=(e,n,i)=>{var s,c,d;const{isIE:u}=l.current,{gutterWidth:p}=o,{dataIndex:h,colSpan:m,rowSpan:f,fixed:g,align:v,theadAlign:y,theadClassName:b="",sorter:S,filter:w,required:N,headRender:I}=e;if(0===m)return null;const R=y||v,O=["header--column",{"col--ellipsis":null!==(s=e.ellipsis)&&void 0!==s?s:C,"col--center":"center"===R,"col--right":"right"===R,"column--required":!!N,"column-has-sorter":S,"column-has-filter":w,"column--sort":!!r[h],"cell-fix-left":!u&&"left"===g,"cell-fix-right":!u&&"right"===g,"cell-fix-left-last":!u&&"left"===g&&!(null===(c=i[n+(null!=m?m:1)])||void 0===c?void 0:c.fixed),"cell-fix-right-first":!u&&"right"===g&&!(null===(d=i[n-1])||void 0===d?void 0:d.fixed),[b]:!!b}],k=u?null:{left:"left"===g?`${x(h)}px`:"",right:"right"===g?`${E(h,"thead")+(a?p:0)}px`:""},A=T&&![kd.expandableColumn,kd.selectionColumn].includes(h);return t.createElement("th",{key:h,className:Fe(O),colSpan:m,rowSpan:f,style:Object.assign({},k),onClick:t=>K(t,e)},t.createElement("div",{className:"cell--wrapper"},I?t.createElement("div",{className:"cell--text cell"},I(e,l.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},q(e)),w?V(e):null)),A&&t.createElement(Su,{column:e}))},q=e=>{const{dataIndex:n,type:i,sorter:l,title:o,description:a}=e;if(n===kd.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},D?t.createElement(wu,{selectionKeys:d}):Bt("qm.table.config.selectionText"));if("radio"===i)return t.createElement("div",{className:"cell"},o)}const s=[];return s.push(t.createElement("div",{key:0,className:"cell",title:Wl(o)},m&&n===p&&F?t.createElement(Cu,null):null,n===kd.expandableColumn&&F?t.createElement(Cu,null):o)),a&&s.push(t.createElement(Y,{key:1,placement:"top",title:a},t.createElement(ft,{className:"tip"}))),l&&s.push(j(r[n])),s},j=e=>{const n=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return t.createElement("div",{key:2,className:"cell--sorter",title:Bt("qm.table.sorter.text")},t.createElement("span",{className:Fe(n)},t.createElement(Tu,null)),t.createElement("span",{className:Fe(r)},t.createElement(Nu,null)))},V=e=>t.createElement(Eu,{column:e,filters:i}),K=(e,t)=>{const{sorter:n,dataIndex:i}=t;if(n){const e=r[i],t=e?e===k?null:k:O;N?(delete r[i],v(Object.assign({},r,{[i]:t}))):v(Object.assign({},{[i]:t}))}},z=()=>{_&&W()},W=e=>{const t=He(r,(e=>null!==e));for(const e in t){const n=s.find((t=>t.dataIndex===e));n?B(n,t[e]):delete t[e]}e||Object.keys(t).length||B({dataIndex:"index"},O)},B=(e,t)=>{const{tableFullData:n}=l.current,{dataIndex:r,sorter:i}=e,o=(e,n)=>{const i=Hl(e,r),l=Hl(n,r);return Number.isNaN(i-l)?t===O?i.toString().localeCompare(l.toString()):l.toString().localeCompare(i.toString()):t===O?i-l:l-i},a=f?S(Bl(n).sort("function"==typeof i?i:o)):n.sort("function"==typeof i?i:o).slice(0);w(a)},U=()=>{H&&G()},G=()=>{const e=c.length?Ul(c):Ul(i),t=""!==e?f?S(xl(Bl(A),e,P)):xl(A,e,P):A;w(t),W(!0)},X=Al(n),Z=Dn("table"),{tableBodyWidth:Q}=o;return t.createElement("div",{ref:L,className:`${Z}--header-wrapper`},t.createElement("table",{className:`${Z}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Q?`${Q}px`:""}},(()=>{const{gutterWidth:e}=o;return t.createElement("colgroup",null,s.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`}})})),a&&t.createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t.createElement("thead",null,(e=>{const{isIE:n}=l.current,r=["gutter",{"cell-fix-right":!!u.length}],i=n?null:{right:u.length?0:""};return e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>M(t,n,e))),a&&t.createElement("th",{className:Fe(r),style:Object.assign({},i)}))))})(X))))},Ru=t.createContext([]),Ou=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,ku=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Au=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!Ou(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Lu(t){let{ref:n,handler:r,enabled:i=!0,omitClassNames:l=[]}=t;const o=wd(r),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!i)return;const e=e=>{Au(e,n)&&(a.current.isPointerDown=!0)},t=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:r&&a.current.isPointerDown&&Au(e,n)&&ku(e,l)&&(a.current.isPointerDown=!1,o(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,r&&a.current.isPointerDown&&Au(e,n)&&ku(e,l)&&(a.current.isPointerDown=!1,o(e))},c=Ou(n.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",t,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",t,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[r,n,o,a,i])}function Pu(){const[,t]=e.useReducer((e=>e+1),0);return t}function _u(){const{locale:t}=e.useContext(Vt);return{t:Bt,$locale:t}}const Hu=e=>{const{selectionKeys:n,column:r,record:i,rowKey:l}=e,{tableRef:o,isTreeTable:a,getAllChildRowKeys:s}=t.useContext(pd),{rowSelection:c}=o.current.props,d=t.useMemo((()=>r.type||""),[r.type]),u=e=>{var t,r;const i=null===(t=c.checkStrictly)||void 0===t||t;if(!a||i)return!1;const l=Ol(o.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})(s(null!==(r=null==l?void 0:l.children)&&void 0!==r?r:[]),n)};return"radio"===d?(()=>{const e=c.disabled,r=null==e?void 0:e(i),o=!r&&n[0]===l;return t.createElement(K,{checked:o,disabled:r})})():(()=>{const e=c.disabled,r=null==e?void 0:e(i),o=!!n.includes(l);return t.createElement(M,{checked:o,indeterminate:u(l),disabled:r})})()},Fu=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:l,rowExpandedKeys:o,setRowExpandedKeys:a}=t.useContext(pd),{expandable:s={}}=l.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>o.includes(r)),[o,r]);fi((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${Dn("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:Fe(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?o.filter((e=>e!==r)):[...o,r];a(t)},style:i})},Du=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:l,min:o,max:a,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,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)>a&&(t=a.toString()),t&&Number(t)<o&&(t=o.toString()),p>=0&&""!==t&&(t=new Lt(t).toFixed(p)),t},E=void 0!==l,[S,w]=t.useState(null!=i?i:""),C=v(E?l:S),T=y(C);fi((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,T)}),[S]);return t.createElement(_,{ref:n,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const n=y(t.target.value);let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===p&&n.includes(".")&&(r=!1),o>=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):w(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(T);null===(t=e.onBlur)||void 0===t||t.call(e,n,T)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(T),T))}})}));Du.displayName="InputNumber";const{Search:$u}=_,Mu=t.forwardRef(((e,n)=>{var r,i,l,o,a,s;const{column:c,record:d,rowKey:u,columnKey:p}=e,{tableRef:h,tableBodyRef:m,$size:f,flattenColumns:g,updateTableData:v,doFieldValidate:y,dataChange:b}=t.useContext(pd),x=t.useContext(Ru),E=Pu(),{store:S,fieldAuth:w}=h.current,T=(null===(r=c.editRender)||void 0===r?void 0:r.call(c,d,c))||{},N=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),A=t.useRef(!1),L=t.useRef({}),P=t.useRef({}),H=t.useRef([]),[F,D]=t.useState(!1),[q,j]=t.useState(!1),[V,K]=t.useState(!1),[W,B]=t.useState(T.items||[]),[U,G]=t.useState(),Y=(T.editable||ge(x,[u,p]))&&!T.disabled&&!(null===(i=w[p])||void 0===i?void 0:i.disabled),X=`${u}|${p}`,Z=2===x.length?`${x[0]}|${x[1]}`:"",Q=![...S.state.required,...S.state.validate].some((e=>{let{x:t,y:n}=e;return t===u&&n===p})),J=(null===(l=S.state.required.find((e=>{let{x:t,y:n}=e;return t===u&&n===p})))||void 0===l?void 0:l.text)||"",ee=(null===(o=S.state.validate.find((e=>{let{x:t,y:n}=e;return t===u&&n===p})))||void 0===o?void 0:o.text)||"",te=S.state.edited.some((e=>{let{x:t,y:n}=e;return t===u&&n===p})),ne=Y||!Q||F||V||q,re=!!(null===(a=T.helper)||void 0===a?void 0:a.combinedDataIndex)&&("search-helper"===T.type||"tree-helper"===T.type),ie=null===(s=T.type)||void 0===s?void 0:s.endsWith("multiple");t.useLayoutEffect((()=>{ne&&Z===X&&ce()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;ie&&e&&ae(e.map((e=>({[P.current.valueKey]:e.value,[P.current.textKey]:e.text}))))}),[]);const le=()=>{v(),b()},oe=(e,t)=>{D(e),null==t||t()},ae=e=>{H.current=e},ce=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=I.current)||void 0===e||e.focus();break;case"number":null===(t=R.current)||void 0===t||t.select();break;case"search-helper":null===(n=O.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=k.current)||void 0===r||r.focus()}};t.useImperativeHandle(n,(()=>({focus:ce})));const de=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},ue=(e,t,n)=>{const{cornerSign:r=!0}=T.extra||{};S.addToUpdated(e),r&&S.addToEdited({x:t,y:n})},pe=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",he={text:(e,n,r)=>{const{dataIndex:i}=n,{type:l,extra:o={},rules:a=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=Hl(e,i),g=Object.assign({},{minRows:1,maxRows:4},o.autoSize),v=r?{rows:g.minRows,autoSize:g}:null,b=o.password?_.Password:r?_.TextArea:_;return t.createElement(b,hn({ref:I,size:f,value:m,maxLength:o.maxLength,showCount:o.showCount},v,{autoComplete:o.password?"new-password":"off",placeholder:o.placeholder||Bt("qm.table.editable.inputPlaceholder"),allowClear:o.allowClear,readOnly:o.readOnly,disabled:o.disabled,suffix:o.suffix,onChange:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";Fl(e,i,r),y(a,r,u,p),E(),null==s||s({[X]:r}),A.current=!0},onFocus:()=>j(!0),onBlur:t=>{var n;j(!1);const r=null!==(n=t.target.value)&&void 0!==n?n:"";A.current&&(A.current=!1,ue(e,u,p),null==c||c({[X]:r},e),null==h||h({[X]:r},e),le())},onKeyUp:t=>{var n;if(13===t.keyCode&&!t.shiftKey){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==d||d({[X]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&d&&e.preventDefault()}}))},textarea:(e,t)=>he.text(e,t,!0),number:(e,n)=>{var r;const{dataIndex:i,precision:l,formatType:o}=n,{type:a,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:m,onBlur:g}=T,v=Hl(e,i);let b,x;return"finance"===o&&(b=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},x=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(b=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Lt(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Lt(e).times(.01).toString()),t.createElement(Du,{ref:R,size:f,value:v,min:s.min,max:s.max,precision:l,stringMode:s.stringMode,prefix:s.prefix,suffix:null!==(r=s.suffix)&&void 0!==r?r:"percent"===o?"%":void 0,placeholder:s.placeholder||Bt("qm.table.editable.inputPlaceholder"),maxLength:s.maxLength,allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,formatter:b,parser:x,onChange:t=>{Fl(e,i,t),y(c,t,u,p),E(),null==d||d({[X]:t}),A.current=!0},onFocus:()=>j(!0),onBlur:(t,n)=>{if(j(!1),!A.current)return;A.current=!1;let r=s.stringMode?t:pe(t);"percent"===o&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),Fl(e,i,r),ue(e,u,p),null==h||h({[X]:r},e),null==g||g({[X]:r},e),le()},onEnter:(t,n)=>{let r=s.stringMode?t:pe(t);"percent"===o&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==m||m({[X]:r},e)}})},select:(e,n,r)=>{var i;const{dataIndex:l,dictItems:o=[]}=n,{type:a,extra:s={},rules:c=[],items:d,onChange:h,onEnter:m}=T,g=d||o,v=Hl(e,l);let b=v;return t.createElement($,{mode:r?"multiple":void 0,size:f,popupClassName:"table-editable__popper",value:v||void 0,placeholder:s.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,listHeight:s.listHeight,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},showSearch:null===(i=s.filterable)||void 0===i||i,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${Ho.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{Fl(e,l,t),y(c,t,u,p),ue(e,u,p),null==h||h({[X]:t},e),le()},onSelect:e=>{b=e},onInputKeyDown:t=>{13===t.keyCode&&Rn((()=>null==m?void 0:m({[X]:b},e)))}},g.map((e=>t.createElement($.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>he.select(e,t,!0),date:(e,n,r)=>{var i;const{dataIndex:l}=n,{type:o,extra:a={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=Hl(e,l);return t.createElement(pn,{size:f,popupClassName:"table-editable__popper",value:null!==(i=jl(h,ao[d]))&&void 0!==i?i:void 0,picker:oo[d],format:a.format,showTime:"datetime"===d,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=a;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:a.placeholder,allowClear:a.allowClear,disabled:a.disabled,style:{width:"100%"},onChange:t=>{const n=Vl(t,ao[d]);Fl(e,l,n),y(s,n,u,p),ue(e,u,p),null==c||c({[X]:n},e),le()}})},datetime:(e,t)=>he.date(e,t,"datetime"),month:(e,t)=>he.date(e,t,"month"),year:(e,t)=>he.date(e,t,"year"),time:(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:o={},rules:a=[],onChange:s}=T,c="HH:mm:ss",d=Hl(e,i);return t.createElement(mn,{size:f,popupClassName:"table-editable__popper",value:null!==(r=jl(d,c))&&void 0!==r?r:void 0,format:o.format||c,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const n=Vl(t,c);Fl(e,i,n),y(a,n,u,p),ue(e,u,p),null==s||s({[X]:n},e),le()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:o=[],onChange:a}=T,{trueValue:s=gd,falseValue:c=vd,disabled:d}=l,h=Hl(e,r);return t.createElement(M,{checked:h===s,disabled:d,onChange:t=>{const n=t.target.checked?s:c;Fl(e,r,n),y(o,n,u,p),ue(e,u,p),null==a||a({[X]:n},e),le()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:o=[],onChange:a}=T,{trueValue:s=gd,falseValue:c=vd,disabled:d}=l,h=Hl(e,r);return t.createElement(z,{checked:h===s,disabled:d,onChange:t=>{const n=t?s:c;Fl(e,r,n),y(o,n,u,p),ue(e,u,p),null==a||a({[X]:n},e),le()}})},"search-helper":(e,n)=>{var r;const{dataIndex:i,precision:l}=n,{type:o,extra:a={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,v=Dl(e,re?c.combinedDataIndex:i),b=c.fieldAliasMap;b||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(i)||Xt("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),re&&(c.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Xt("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[i].includes("|")&&Xt("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=e=>{const{filterAliasMap:t}=c,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],l={[i]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(se(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},S=e=>{const{autoQueryAssign:t=!0}=c;t&&(L.current=E(e)),D(!0)},w=(t,r)=>{const{beforeOpen:i}=c,l=(null!=i?i:Nn)({[X]:v},e,n);(null==l?void 0:l.then)?l.then((()=>{S(t),null==r||r()})).catch((()=>{})):!1!==l&&(S(t),null==r||r())},C=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=Dl(e,r))}const n=x[i]?Dl(e,x[i]):"";R(n,t);const{closed:r}=c;oe(!1,(()=>de(N.current))),ce(),null==r||r(e)},I=()=>{const{onlySelect:e=!0}=c;A.current&&R(e?"":v),oe(!1,(()=>de(N.current)))},R=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;var r;if(se(n)&&Object.keys(n).length)for(const t in n){const i=n[t],l=g.find((e=>e.dataIndex===t));if(l){Fl(e,t,i,l.precision);const n=null===(r=l.editRender)||void 0===r?void 0:r.call(l,e,l);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else Fl(e,t,i)}re&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return Fl(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&Fl(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),Fl(e,i,t,l),y(s,t,u,p),ue(e,u,p),null==h||h({[X]:t},e),le(),L.current={},A.current=!1,G(void 0)},k={visible:F,title:Bt("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${Qo[f]+20}px`},onClose:()=>{I()}},P=Object.assign(Object.assign({},c),{size:f,initialValue:Object.assign({},L.current,c.initialValue),onClose:e=>{e?C(e):I()}});return t.createElement(t.Fragment,null,t.createElement($u,{ref:O,value:null!=U?U:v,placeholder:a.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:a.allowClear,readOnly:a.readOnly,disabled:a.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:l}=c;if(A.current&&!F)return n&&r&&(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=c,{beforeFetch:r=Nn}=t.fetch;return new Promise(((i,l)=>En(void 0,void 0,void 0,(function*(){var o;const a=xe({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(a))return l();K(!0);try{const e=yield t.fetch.api(a);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=me(e.data,t.fetch.dataKey))&&void 0!==o?o:[];i(n)}else l()}catch(e){l(e)}finally{Rn((()=>K(!1)))}}))))})(n).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>Dl(t,x[i]).toString().includes(e)));if(1===t.length)return C(t[0]);w(e)}(e,n))).catch((()=>R(""))):void R(n)},onChange:e=>{const{value:t}=e.target;null==d||d({[X]:t}),A.current=!0,G(t)},onKeyUp:t=>{var n;if(13===t.keyCode){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==m||m({[X]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;w(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&w(e)}}),t.createElement(ll,k,t.createElement(Ju,P)))},"search-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:l,items:o=[],extra:a={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=Hl(e,i),v=c.fieldAliasMap;v||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Xt("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),P.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Nn)({[X]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{D(!0),null==t||t()})).catch((()=>{})):!1!==i&&(D(!0),null==t||t())},E=()=>{oe(!1,(()=>de(N.current)))},S=t=>{Fl(e,i,t),y(s,t,u,p),ue(e,u,p),null==h||h({[X]:t},e,H.current),le()},w={visible:F,title:Bt("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${Qo[f]+20}px`},onClose:()=>{E()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:xe({},c.initialValue),defaultSelectedKeys:g,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=b;ae(Ee([...H.current.filter((e=>t.includes(e[r]))),...e],r));const i=H.current.map((e=>({text:e[n],value:e[r]}))),l=Ee([...i,...o],"value").filter((e=>t.includes(e.value)));B(l),S(l.map((e=>e.value)));const{closed:a}=c;oe(!1,(()=>de(N.current))),null==a||a(H.current)})(e,t):E()}});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($,{mode:"multiple",open:!1,value:g,placeholder:a.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:a.allowClear,maxTagCount:a.collapseTags?"responsive":void 0,maxTagTextLength:a.maxTagTextLength,disabled:a.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[X]:g},e))},onDoubleClick:()=>{a.disabled||x()},onChange:e=>{const{valueKey:t}=b;ae(H.current.filter((n=>e.includes(n[t])))),S(e)}},W.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:a.disabled,icon:t.createElement(We,null),onClick:()=>{x()}})))),t.createElement(ll,w,t.createElement(Ju,I)))},"tree-helper":(e,n)=>{var r,i;const{dataIndex:l,precision:o}=n,{type:a,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:m}=T,v=Dl(e,re?d.combinedDataIndex:l),b=d.fieldAliasMap;b||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(l)||Xt("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),re&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Xt("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[l].includes("|")&&Xt("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:r}=d,i=(null!=r?r:Nn)({[X]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{D(!0),null==t||t()})).catch((()=>{})):!1!==i&&(D(!0),null==t||t())},S=()=>{oe(!1,(()=>de(N.current)))},w=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;var r;if(se(n)&&Object.keys(n).length)for(const t in n){const i=n[t],l=g.find((e=>e.dataIndex===t));if(l){Fl(e,t,i,l.precision);const n=null===(r=l.editRender)||void 0===r?void 0:r.call(l,e,l);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else Fl(e,t,i)}Fl(e,l,t,o),y(c,t,u,p),ue(e,u,p),null==h||h({[X]:t},e),le()},C={visible:F,title:Bt("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"30%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${Qo[f]+20}px`},onClose:()=>{S()}},I=Object.assign(Object.assign({},d),{defaultSelectedKeys:[v],size:f,onClose:e=>{e?(e=>{const t={};for(const n in x){const r=x[n];n!==l&&(t[n]=Dl(e,r))}const n=x[l]?Dl(e,x[l]):"";w(n,t);const{closed:r}=d;oe(!1,(()=>de(N.current))),ce(),null==r||r(e)})(e):S()}});return t.createElement(t.Fragment,null,t.createElement($u,{ref:k,value:v,allowClear:null===(i=s.allowClear)||void 0===i||i,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||Bt("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{var n;if(13===t.keyCode){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==m||m({[X]:r},e)}},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?E():w(""))}}),t.createElement(ll,C,t.createElement(ip,I)))},"tree-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:o={},items:a=[],rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=Hl(e,i),v=c.fieldAliasMap;v||Xt("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Xt("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),P.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Nn)({[X]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{D(!0),null==t||t()})).catch((()=>{})):!1!==i&&(D(!0),null==t||t())},E=()=>{oe(!1,(()=>de(N.current)))},S=t=>{Fl(e,i,t),y(s,t,u,p),ue(e,u,p),null==h||h({[X]:t},e,H.current),le()},w={visible:F,title:Bt("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${Qo[f]+20}px`},onClose:()=>{E()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:xe({},c.initialValue),defaultSelectedKeys:g,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=b;ae(e);const r=H.current.map((e=>({text:e[t],value:e[n]})));B(r),S(r.map((e=>e.value)));const{closed:i}=c;oe(!1,(()=>de(N.current))),null==i||i(H.current)})(e):E()}});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($,{mode:"multiple",open:!1,value:g,placeholder:o.placeholder||Bt("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[X]:g},e))},onDoubleClick:()=>{o.disabled||x()},onChange:e=>{const{valueKey:t}=b;ae(H.current.filter((n=>e.includes(n[t])))),S(e)}},W.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(C,{className:"ant-input-search-button",disabled:o.disabled,icon:t.createElement(We,null),onClick:()=>{x()}})))),t.createElement(ll,w,t.createElement(ip,I)))}};return t.createElement(t.Fragment,null,ne?(()=>{const{type:e}=T,n=he[e];if(!n)return Xt("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!Q}];return t.createElement("div",{ref:N,className:Fe(r)},n(d,c),!Q&&t.createElement("div",{className:"cell-error"},J||ee))})():(()=>{const{extra:n={}}=T;return t.createElement("span",{style:{color:n.disabledColor}},e.children)})(),te&&t.createElement("i",{className:"cell--sign"}))}));Mu.displayName="CellEdit";const qu=function(e){if(!t.isValidElement(e))return null;for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return t.cloneElement(e,...r)},ju=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:l}=e;return qu(e.children,{onClick:o=>{const a=t.Children.only(e.children),s=_t(n,r);null==l||l(n,s),s&&i&&k.success(Bt("qm.clipboard.success")),a&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(o)}})};ju.displayName="QmCopyToClipboard";const Vu=t.forwardRef(((n,r)=>{const{column:i,row:l,rowIndex:o,columnIndex:a,rowKey:s,depth:c,showTitle:d}=n,{flattenColumns:u,selectionKeys:p,treeExpandIndex:h,updateMark:m,isTreeTable:f}=t.useContext(pd),{dataIndex:g,canCopy:v,render:y,editRender:b,shouldCellUpdate:x}=i,{t:E}=_u(),{renderText:S,getTitleFromCellNode:w}=Kd(),C=t.useRef(null),T=Hl(l,g),[N,I]=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=y?y(T,l,i,o,a):S(T,i,l);return[e,b?t.createElement(Mu,{ref:r,column:i,record:l,rowKey:s,columnKey:g},e):null]}),[m,T,y,b],((e,t)=>{if(x){const[,n]=e,[,r]=t;return x(r,n,l)}return!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=new Set;return function e(t,i){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(r.has(t))return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);const o=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],o))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],o)))}return!1}(e,t)}(e,t,!0)}));t.useEffect((()=>{if([kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(g))return;const e=C.current.parentNode;d?e.title=w(N):e.removeAttribute("title")}),[d,N]);const R=e=>Array.isArray(e.children);return t.createElement("div",{ref:C,className:"cell"},(()=>{if(g===kd.expandableColumn)return t.createElement(Fu,{record:l,rowKey:s});if(g===kd.selectionColumn)return t.createElement(Hu,{selectionKeys:p,column:i,record:l,rowKey:s});if(I)return I;if(f&&g===h)return t.createElement(t.Fragment,null,(e=l._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*kd.treeTable.textIndent+"px"}}):null,t.createElement(Fu,{key:"expand",record:l,rowKey:s,style:R(l)?{}:{visibility:"hidden"}}),N);var e;if(v){const e=w(N);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},N),e&&t.createElement(ju,{text:e},t.createElement(lt,{className:"icon",title:E("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return N})())}));Vu.displayName="Cell";const Ku={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},zu={open:!1,offsetX:0,offsetY:0},Wu=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,flattenColumns:l,mergedTdCells:o,setMergedCells:a}=t.useContext(pd),{areaSelection:s={}}=r.current.props,{elementStore:c,tableFlatData:d}=r.current,{t:u}=_u(),p=t.useRef(document.onselectstart),h=t.useRef(null),m=t.useRef(null),[f,g]=t.useState(null),[v,y]=t.useState(null),[b,x]=t.useState(null);Lu({ref:h,handler:()=>D()});const E=t.useRef(Ku),S=e=>{E.current=Object.assign({},E.current,e)};t.useEffect((()=>{const e=It(c.$tableBody,"mousedown",A),t=It(c.$tableBody,"contextmenu",O),n=It(document,"keydown",k);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const w=()=>{g(null),y(null),x(null)};t.useImperativeHandle(n,(()=>({blur:w})));const C=()=>c.$tableBody.parentNode,T=e=>{const{offsetLeft:t,offsetTop:n,offsetWidth:r,offsetHeight:i}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:n,w:r,h:i}},N=ji(((e,t)=>{let n=null;const r=c.$tableBody.querySelectorAll("tbody > tr");for(let i=0;i<r.length;i++){if(r[i].offsetTop>t||r[i].offsetTop+r[i].offsetHeight<t)continue;const l=r[i].querySelectorAll("td");for(let t=0;t<l.length;t++)if(!(l[t].offsetLeft>e||l[t].offsetLeft+l[t].offsetWidth<e)){n=l[t];break}break}n&&y(T(n))}),5),I=wd((()=>{const e=[];if(!f||!v)return e;const[t,n]=[f.colIndex,v.colIndex],[r,o]=[f.rowKey,v.rowKey];let[a,s]=[0,0];for(let e=0;e<d.length;e++){const t=i(d[e],d[e].index);if(t==r&&(a=e),t==o){s=e;break}}const c=l.slice(Math.min(t,n),Math.max(t,n)+1);return d.slice(a,s+1).forEach((t=>{for(let n=0;n<c.length;n++){const{dataIndex:r}=c[n];e.push({rowKey:i(t,t.index),dataIndex:r,cellValue:Hl(t,r)})}})),e})),R=e=>{var t;a(e),null===(t=s.onCellMerge)||void 0===t||t.call(s,e),Rn((()=>w()))},O=wd((e=>{s.cellMerge&&f&&H(e.clientX,e.clientY)?(e.preventDefault(),F(e)):(null==b?void 0:b.open)&&D()})),k=e=>{27===e.keyCode&&w()},A=wd((e=>{e.stopPropagation();const t=(e=>{let t=e;for(;t;){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null})(e.target);if(1!==e.buttons||!t)return;D(),setTimeout((()=>{g(T(t)),y(T(t))}));const[n,r]=[c.$tableBody.getBoundingClientRect().top,C().getBoundingClientRect().left],{offsetWidth:i,offsetHeight:l}=C();S({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-r,startOffsetY:e.clientY-n,containerSizeX:i,containerSizeY:l}),document.addEventListener("mousemove",L),document.addEventListener("mouseup",P),p.current=document.onselectstart,document.onselectstart=()=>!1})),L=e=>{const t=e.clientX-E.current.startX,n=e.clientY-E.current.startY,r=E.current.startOffsetX+t,i=E.current.startOffsetY+n;N(Math.min(r,E.current.containerSizeX),Math.min(i,E.current.containerSizeY))},P=()=>{var e;S(Ku),null===(e=s.onSelectChange)||void 0===e||e.call(s,I()),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",P),_()},_=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},H=(e,t)=>{const{top:n,left:r}=C().getBoundingClientRect(),[i,l]=[e-r,t-n],{el:o,et:a,ew:s,eh:c}=q();return!(i<o||i>o+s||l<a||l>a+c)},F=e=>{const{top:t,left:n,height:r}=m.current.getBoundingClientRect();x({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},D=()=>{x((e=>Object.assign(Object.assign({},e),{open:!1})))},$=()=>{if(!f||!v||(t=v,(e=f).rowKey===t.rowKey&&e.colIndex===t.colIndex))return w();var e,t;const[n,r]=f.t<=v.t?[f.rowKey,v.rowKey]:[v.rowKey,f.rowKey],[a,s]=[f.colIndex,v.colIndex];let[c,u]=[0,0],p=n;for(let e=0;e<d.length;e++){const t=d[e],l=i(t,t.index);if(l==n&&(p=l,c=e),l==r){u=e;break}}const h={rowKey:p,dataIndex:l[Math.min(a,s)].dataIndex,rowSpan:u-c+1,colSpan:Math.abs(s-a+1)};R([...o.filter((e=>!(e.rowKey===h.rowKey&&e.dataIndex===h.dataIndex))),h])},M=()=>{let e=f.rowKey;const t=f.colIndex;for(let t=0;t<d.length;t++){const n=d[t],r=i(n,n.index);if(r==e){e=r;break}}const n=e,r=l[t].dataIndex;R(o.filter((e=>!(e.rowKey===n&&e.dataIndex===r))))},q=()=>{const{w:e,h:t,l:n,t:r}=f;let{w:i,h:l,l:o,t:a}=v;return i=o-n>0?o-n+i:Math.abs(o-n)+e,l=a-r>0?a-r+l:Math.abs(a-r)+t,o=o>n?n:o,a=a>r?r:a,{sl:n,st:r,sw:e,sh:t,el:o,et:a,ew:i,eh:l}},j=Dn("table");return t.createElement("div",{className:`${j}--area-select`},(()=>{if(!f||!v)return null;const{sl:e,st:n,sw:r,sh:i,el:l,et:o,ew:a,eh:s}=q(),{open:c,offsetX:d,offsetY:p}=b||zu,g=t.createElement("ul",{ref:h,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:$},u("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:M},u("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(_s,{popupVisible:c,popup:g,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:"table-editable__popper",builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,p+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:m,className:"checked-area",style:{left:l,top:o,width:a,height:s}})))})())}));Wu.displayName="AreaSelect";const Bu=t.forwardRef(((e,n)=>{const{tableFlatColumns:r,tableData:i}=e,{getRowKey:l,tableRef:o,flattenColumns:a,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:h,showFooter:m,scrollX:f,scrollY:g,selectionKeys:v,rowExpandedKeys:y,highlightKey:b,isPingLeft:x,isPingRight:E,isTableEmpty:S,isTreeTable:w,isGroupSubtotal:C,isWebPagination:T,setElementStore:N,createTableFullData:I,setSelectionKeysEffect:R,setHighlightKey:O,getStickyLeft:k,getStickyRight:A,scrollXToColumn:L,scrollYToRecord:P,rowInViewport:_,dataChange:H,setPingLeft:F,setPingRight:D,setFullScreen:$,findParentRowKeys:M,getAllChildRowKeys:q,triggerScrollXEvent:j,triggerScrollYEvent:V,scrollBottomDebouncer:K}=t.useContext(pd),{height:z,minHeight:W,maxHeight:B,rowHeight:U,rowSelection:G,rowHighlight:Y,expandable:X,stripe:Z,summation:Q,rowStyle:J,cellStyle:ee,spanMethod:te,tableConfig:ne,areaSelection:re,nativeScrollBar:ie,ellipsis:le,showHeader:oe,rowDraggable:ae,onRowClick:ce,onRowDblclick:de,onRowContextmenu:ue,onRowEnter:pe}=o.current.props,he=t.useRef(null),me=t.useRef({}),fe=t.useRef(null),ve=t.useRef(null),ye=t.useRef(null),be=t.useRef({prevST:0,prevSL:0}),xe=o.current.scrollXLoad?r:a,Ee=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,l={};return S&&Object.assign(l,{minHeight:"100px"}),W&&Object.assign(l,{minHeight:Pl(W)-e-n+"px"}),B&&Object.assign(l,{maxHeight:Pl(B)-e-n+"px"}),z||r||i?Object.assign(Object.assign({},l),{maxHeight:"",minHeight:"",height:`${t}px`}):l}),[z,B,W,S,h]),Se=t.useMemo((()=>{const{scrollYStore:e}=o.current,{viewportHeight:t,gutterWidth:n}=h;return Math.floor((f?t-n:t)/e.rowHeight)}),[h,f]),[we,Ce]=t.useState([]),Te=Pu();Lu({ref:he,omitClassNames:[".table-editable__popper"],handler:()=>{var e;ke([]),null===(e=ye.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:ke,createFocus:Re,forceUpdate:Te}))),fi((()=>{we.length&&o.current.tableManager.focus(o.current.uid)}),[we]),t.useLayoutEffect((()=>{Ie();const e=It(document,"keydown",Ne);return()=>e.remove()}),[]);const Ne=wd((e=>{var t,n,r,a,c,d,u;const{keyCode:p}=e;if(o.current.uid===(null===(t=o.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id)&&(27===p&&(ke([]),O(""),$(!1)),we.length&&(Ti(document.activeElement,he.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===p&&("radio"===(null==G?void 0:G.type)||Y)){const t=null!==(a=null!==(r=v[0])&&void 0!==r?r:b)&&void 0!==a?a:null,n=null!==(c=i.find((e=>l(e,e.index)===t)))&&void 0!==c?c:null;n&&(null==pe||pe(n,e))}if(38===p||40===p){yi(e);const{allTableData:t}=o.current,n=T?kl(i):t,r=n.length;let a=n.findIndex((e=>l(e,e.index)===we[0]));const s=38===p?(--a+r)%r:++a%r,c=n[s],h=l(c,c.index);"radio"!==(null==G?void 0:G.type)||(null===(d=G.disabled)||void 0===d?void 0:d.call(G,c))||R([h]),Y&&!(null===(u=Y.disabled)||void 0===u?void 0:u.call(Y,c))&&O(h),_(s)||(38===p&&P(h,s),40===p&&P(h,Se>s+1?0:s+1-Se)),ke([h,we[1]])}if(9===p){if(yi(e),!s.length)return ke([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===we[1]));const r=++n%t,i=s[r].dataIndex;ke([we[0],i]),L(i)}}})),Ie=()=>{N("$tableBody",he.current),N("$tableXspace",fe.current),N("$tableYspace",ve.current)},Re=(e,t)=>{var n;null===(n=me.current[`${e}-${t}`])||void 0===n||n.focus()},Oe=(e,t,n)=>{var r,i;const{dataIndex:o}=n;if([kd.expandableColumn,kd.operationColumn].includes(o))return;const a=l(t,t.index);ke([a,o]);const s=null===(r=n.editRender)||void 0===r?void 0:r.call(n,t,n),c=s&&!s.disabled,{type:d,selectByClickRow:u=!0,disabled:p=Tn}=G||{};!d||p(t)||c||(u||o===kd.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:r=!0,onSelect:i}=G||{};if("radio"===n&&R([e]),"checkbox"===n){const n=!v.includes(e),l=w&&!r?Le(e,v,n):Ae(e,v,n);R(l),null==i||i(n,t,l)}})(a,t),[kd.selectionColumn].includes(o)||(!Y||(null===(i=Y.disabled)||void 0===i?void 0:i.call(Y,t))||c||O(a),null==ce||ce(t,n,e))},ke=e=>{ge(e,we)||Ce(e)},Ae=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Le=(e,t,n)=>{var r;const{disabled:i}=G||{},{deriveRowKeys:l,recordsMap:a}=o.current,s=Ol(l,e);let c=[],d=q((null==s?void 0:s.children)||[]);i&&(d=d.filter((e=>!a.has(e)||!i(a.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(r=Xl(l,e))||void 0===r?void 0:r.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ol(l,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},Pe=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=[];return e.forEach((e=>{const i=e.index,a=l(e,e.index);if(r.push(_e(e,i,a,n)),null==X?void 0:X.expandedRowRender){const{expandedRowClassName:n,rowExpandable:l=Nn}=X;y.includes(a)&&l(e)&&r.push(t.createElement("tr",{key:`expand_${a}`,className:"body--row-expanded"},t.createElement("td",{colSpan:xe.length,className:"body--column",style:{paddingLeft:G?2*kd.selectionColumnWidth:kd.selectionColumnWidth}},t.createElement("div",{className:Fe("cell",n)},X.expandedRowRender(e,i)))))}if(!o.current.scrollYLoad&&(e=>Array.isArray(e.children))(e)){const t="function"!=typeof(null==X?void 0:X.rowExpandable)||X.rowExpandable(e);y.includes(a)&&t&&r.push(...Pe(e.children,n+1))}})),r},_e=function(e,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const{disabled:l}=G||{},o=["body--row",Object.assign({"body--row-striped":Z&&n%2!=0,"body--row-selected":v.includes(r)&&!(null==l?void 0:l(e)),"body--row-current":b===r},C?Me(e._group):null)];return t.createElement("tr",{key:r,"data-row-key":r,className:Fe(o)},xe.map(((t,l)=>He(t,l,e,n,r,i))))},He=(e,n,r,i,l,s)=>{var u,h,m;const{isIE:f}=o.current,{dataIndex:g,fixed:v,align:y,className:b="",editRender:x}=e;o.current.scrollXLoad&&(n=a.findIndex((e=>e.dataIndex===g)));const{rowSpan:E,colSpan:S}=De(r,e,i,n);if(!E||!S)return null;const w=null!==(u=e.ellipsis)&&void 0!==u?u:le,T=!f&&"left"===v,N=!f&&"right"===v,I=["body--column",{"col--ellipsis":w,"col--center":"center"===y,"col--right":"right"===y,"column--sort":!!p[g],"cell-fix-left":T,"cell-fix-right":N,"cell-fix-left-last":T&&(null===(h=c[c.length-S])||void 0===h?void 0:h.dataIndex)===g,"cell-fix-right-first":N&&(null===(m=d[0])||void 0===m?void 0:m.dataIndex)===g,[b]:!!b}],R=N&&S>1?a.slice(n+1,n+S).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,O=f?null:{left:T?`${k(g)}px`:"",right:N?A(g)-R+"px":""},L=J?"function"==typeof J?J(r,i):J:null,P=ee?"function"==typeof ee?ee(r,e,i,n):ee:null,_=C?$e(r._group):null,H=Object.assign({},O,U?{height:U}:null,_,L,P);if(x){const{extra:t}=x(r,e)||{};(null==t?void 0:t.disabledBackgroundColor)&&Object.assign(H,{backgroundColor:null==t?void 0:t.disabledBackgroundColor})}return t.createElement("td",{key:g,"data-col-index":n,rowSpan:E>1?E:void 0,colSpan:S>1?S:void 0,className:Fe(I),style:H,onClick:t=>Oe(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(r)||null==de||de(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(r)||null==ue||ue(t,n,e)})(t,r,e)},t.createElement(Vu,{ref:e=>me.current[`${l}-${g}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:l,depth:s,showTitle:w}))},De=(e,t,n,r)=>{let l=1,o=1;if("function"==typeof te){const a=te({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});if(Array.isArray(a)?(l=a[0],o=a[1]):se(a)&&(l=a.rowSpan,o=a.colSpan),e===i[0]&&0===l){l=1;for(let e=1;e<i.length;e++){const{rowSpan:n}=De(i[e],t,i[e].index,r);if(n>0)break;l++}}}if(u.length>0){const e=u.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,o=e.colSpan)}return{rowSpan:l,colSpan:o}},$e=e=>{var t;const{backgroundColor:n,color:r}=null!==(t=Q.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}},Me=e=>{const t=Q.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},qe=Dn("table");return t.createElement(t.Fragment,null,t.createElement(Bi,{ref:o.current.scrollBarRef,wrapClassName:`${qe}--body-wrapper`,wrapStyle:Ee,native:ie,showTopScrollbar:null==ne?void 0:ne.doubleXScrollbar,onScroll:e=>{const{elementStore:t,scrollXLoad:n,scrollYLoad:r}=o.current,{prevST:i,prevSL:l}=be.current,a=g?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==l){oe&&(t.$header.scrollLeft=c),m&&(t.$footer.scrollLeft=c);const e=c>0,n=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+a;x!==e&&F(e),E!==n&&D(n)}if(r&&s!==i&&V(s),n&&c!==l&&j(c),g&&s!==i){const n=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-a>=n&&K({type:"scroll",target:e,preventDefault:Tn,stopPropagation:Tn})}be.current.prevST=s,be.current.prevSL=c}},t.createElement("div",{ref:ve,className:"body--y-space"}),t.createElement("div",{ref:fe,className:"body--x-space",style:{width:g?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),t.createElement(Ru.Provider,{value:we},t.createElement("table",{ref:he,className:`${qe}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0",style:{width:0}},t.createElement("colgroup",null,xe.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`}})}))),ae?t.createElement($t,{itemKey:e=>l(e,e.index),tag:"tbody",animation:200,list:i,setList:e=>{const t=e.map((e=>l(e,e.index))),n=i.map((e=>l(e,e.index)));if(ge(t,n))return;const r=Jl(e),a=[];o.current.tableFullData.forEach((e=>{i.includes(e)?a.push(r.shift()):a.push(e)})),I(a),H()}},i.map((e=>_e(e,e.index,l(e,e.index))))):t.createElement("tbody",null,Pe(i)))),!!re&&t.createElement(Wu,{ref:ye})))}));Bu.displayName="TableBody";const Uu=e=>{const{summationRows:n}=e,{tableRef:r,sorter:i,layout:l,scrollY:o,flattenColumns:a,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=t.useContext(pd),{footRender:h}=r.current.props,m=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{d("$footer",m.current)},g=(e,n,a)=>{var d,h;const{isIE:m}=r.current,{gutterWidth:f}=l,{dataIndex:g,fixed:v,align:y,summation:b}=e,x=["footer--column","col--ellipsis",{"col--center":"center"===y,"col--right":"right"===y,"column--sort":!!i[g],"cell-fix-left":!m&&"left"===v,"cell-fix-right":!m&&"right"===v,"cell-fix-left-last":!m&&"left"===v&&(null===(d=s[s.length-1])||void 0===d?void 0:d.dataIndex)===g,"cell-fix-right-first":!m&&"right"===v&&(null===(h=c[0])||void 0===h?void 0:h.dataIndex)===g}],E=m?null:{left:"left"===v?`${u(g)}px`:"",right:"right"===v?`${p(g)+(o?f:0)}px`:""},S=(null==b?void 0:b.render)?b.render(r.current.tableFullData):Hl(n,`${g}_text`),w=0===a&&""===S?Bt("qm.table.config.summaryText"):S;return t.createElement("td",{key:g,title:w,className:Fe(x),style:Object.assign({},E)},t.createElement("div",{className:"cell"},w))},v=Dn("table"),{tableBodyWidth:y}=l;return t.createElement("div",{ref:m,className:`${v}--footer-wrapper`},h?h(a,r.current.tableFullData):t.createElement("table",{className:`${v}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=l;return 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`}})})),o&&t.createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t.createElement("tfoot",null,(()=>{const{isIE:e}=r.current,i=["gutter",{"cell-fix-right":!!c.length}],l=e?null:{right:c.length?0:""};return n.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},a.map(((t,n)=>g(t,e,n))),o&&t.createElement("td",{className:Fe(i),style:Object.assign({},l)}))))})())))};var Gu;!function(e){e.small="small",e.middle="default",e.large="default"}(Gu||(Gu={}));const Yu=e=>{var n,r,i,l;const{current:o,pageSize:a,total:s,onChange:c}=e,{global:d}=t.useContext(Vt),{tableRef:u,$size:p,setElementStore:h}=t.useContext(pd),{uniqueKey:m,paginationConfig:f,infoBarConfig:g}=u.current.props,v=t.useRef(null),y=t.useMemo((()=>m?`tablePager_${m}`:""),[m]);t.useLayoutEffect((()=>{b(),w()}),[]);const b=()=>{h("$pager",v.current)},x=null!==(n=null==f?void 0:f.showSizeChanger)&&void 0!==n?n:kd.pagination.showSizeChanger,E=null!==(r=null==f?void 0:f.showQuickJumper)&&void 0!==r?r:kd.pagination.showQuickJumper,S=(null==f?void 0:f.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)||kd.pagination.pageSizeOptions,w=()=>En(void 0,void 0,void 0,(function*(){if(!y)return;const e=yield C(y);e&&e!==a&&(c(o,e),localStorage.setItem(y,e.toString()))})),C=e=>En(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t&&!localStorage.getItem(y))try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),T=(e,t)=>En(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),N={[`${Dn("table")}-pager`]:!0};return t.createElement("div",{ref:v,className:Fe(N)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==g?void 0:g.position)&&t.createElement(qd,{total:s})),t.createElement(ee,{size:Gu[p],showSizeChanger:x,showQuickJumper:E,pageSizeOptions:S,current:o,pageSize:a,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{y&&(T(y,t),localStorage.setItem(y,`${t}`))}}))},Xu=()=>{const{layout:e}=t.useContext(pd),n=t.useMemo((()=>{const{headerHeight:t,viewportHeight:n}=e;return{top:`${t}px`,height:`${n}px`}}),[e]),r=Dn("table");return t.createElement("div",{className:`${r}--empty`,style:n},t.createElement(Li,null))},Zu=()=>{const{setElementStore:e}=t.useContext(pd),n=t.useRef(null);t.useLayoutEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",n.current)},i=Dn("table");return t.createElement("div",{ref:n,className:`${i}--resizable-bar`})},Qu=t.forwardRef(((e,n)=>{const r=((e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})))(md,e),{rowKey:i,columns:l,loading:o,resizable:a,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:p,topSpaceAlign:h,showTableInfo:m,showFullScreen:f,showRefresh:g,showToolBox:v,showHeader:y}=r,{size:b}=t.useContext(Vt),x=t.useMemo((()=>{var e,t;return null!==(t=null!==(e=r.size)&&void 0!==e?e:b)&&void 0!==t?t:""}),[r.size,b]),E=t.useRef(null),S=t.useRef(null),w=t.useRef(null),C=t.useRef(null),T=t.useRef(null),N=wd(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(Xt("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:I,tableFullData:R,setElementStore:O,setOriginColumns:k,setTableFullData:A,setTableOriginData:L,setTableFlatData:P,setAllTableData:_,setDeriveRowKeys:H,setInvalidRowKeys:F,setFieldAuth:D,setColumnsDefined:$,setScrollXStore:M,setScrollYStore:q,setScrollXLoad:j,setScrollYLoad:V,setResizeState:K,setHandleState:z,setSummaries:W,setSelectionRows:B,setShouldToTop:U,setRecordsMap:G,setUnMounted:Y,clearElementStore:X,clearRecordsMap:Z}=((e,n)=>{let{getRowKey:r,$size:i}=n;const{rowHeight:l,dynamicThead:o}=e,a=t.useRef({props:e,uid:Nd(),tableManager:Rd,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],tableFlatData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!o,scrollBarRef:t.createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:l||kd.rowHeightMaps[i]},store:new Od,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollXLoad:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!Sn&&/MSIE|Trident/.test(navigator.userAgent)});var s;s=e,a.current.props=s;const c=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const o=r(e,e.index),a=n?`${n}#${o}`:`${o}`,s=i?`${i}.${e.index+1}`:`${e.index+1}`,d={level:l,rowKey:o,rowKeyPath:a,indexPath:s};return e.indexPath=s,e._level=l,Array.isArray(e.children)&&(d.children=c(e.children,o,a,s,l+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},d=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...d(e.children)):t.push(e.rowKey)})),t};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},setTableFlatData:e=>{a.current.tableFlatData=e},setTableOriginData:e=>{a.current.tableOriginData=e},setAllTableData:e=>{const t=kl(e);a.current.allTableData=t,a.current.allRowKeys=t.map((e=>r(e,e.index)))},setDeriveRowKeys:e=>{const t=a.current.tableFullData.some((e=>Array.isArray(e.children)));a.current.treeTable=t,a.current.deriveRowKeys=t?c(e,""):[],a.current.flattenRowKeys=t?d(a.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{a.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{a.current.fieldAuth[e]=t},setColumnsDefined:e=>{a.current.columnsDefined=e},setScrollXStore:e=>{a.current.scrollXStore=e},setScrollYStore:e=>{a.current.scrollYStore=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},setShouldToTop:e=>{a.current.shouldToTop=e},setSelectionRows:e=>{a.current.selectionRows=e},setRecordsMap:(e,t)=>{a.current.recordsMap.set(e,t)},setUnMounted:e=>{a.current.unMounted=e},clearElementStore:()=>{for(const e in a.current.elementStore)a.current.elementStore[e]=null},clearRecordsMap:()=>{a.current.recordsMap.clear()}})})(r,{getRowKey:N,$size:x}),{tableData:Q,setTableData:J,tableFlatColumns:ee,setTableFlatColumns:te,filters:ne,setFilters:re,sorter:ie,setSorter:le,superFilters:oe,setSuperFilters:ae,pagination:ce,setPagination:de,selectionKeys:ue,setSelectionKeys:pe,rowExpandedKeys:he,setRowExpandedKeys:me,highlightKey:fe,setHighlightKey:ye,updateMark:be,forceUpdate:xe,mergedTdCells:Ee,setMergedCells:Se,layout:we,setLayout:Ce,permission:Te,setPermission:Ne,spinning:Ie,setSpinning:Re,scrollX:Oe,setScrollX:ke,scrollY:Ae,setScrollY:Le,isPingLeft:Pe,setPingLeft:_e,isPingRight:He,setPingRight:De,isFullScreen:$e,setFullScreen:Me,updateTableData:qe}=(e=>{var n,r,i,l,o,a,s,c,d,u,p;const{uniqueKey:h,nativeScrollBar:m,initialSorter:f={},initialFilter:g={},paginationConfig:v,rowSelection:y,expandable:b,rowHighlight:x,mergedCells:E}=e,{global:S}=t.useContext(Vt),w={current:null!==(n=null==v?void 0:v.current)&&void 0!==n?n:kd.pagination.current,pageSize:null!==(a=null!==(i=null!==(r=(()=>{if(h)return Number(localStorage.getItem(`tablePager_${h}`))||void 0})())&&void 0!==r?r:null==v?void 0:v.pageSize)&&void 0!==i?i:null===(o=null===(l=null==S?void 0:S.table)||void 0===l?void 0:l.pagination)||void 0===o?void 0:o.pageSize)&&void 0!==a?a:kd.pagination.pageSize,total:0},C=null!==(c=null!==(s=null==y?void 0:y.selectedRowKeys)&&void 0!==s?s:null==y?void 0:y.defaultSelectedRowKeys)&&void 0!==c?c:[],T=null!==(u=null!==(d=null==b?void 0:b.expandedRowKeys)&&void 0!==d?d:null==b?void 0:b.defaultExpandedRowKeys)&&void 0!==u?u:[],[N,I]=t.useState([]),[R,O]=t.useState([]),[k,A]=t.useReducer(((e,t)=>ge(e,t)?e:t),g),[L,P]=t.useReducer(((e,t)=>ge(e,t)?e:t),f),[_,H]=t.useReducer(((e,t)=>ge(e,t)?e:t),[]),[F,D]=t.useState(w),[$,M]=t.useReducer(((e,t)=>ge(e,t)?e:t),C),[q,j]=t.useReducer(((e,t)=>ge(e,t)?e:t),T),[V,K]=t.useState(null!==(p=null==x?void 0:x.currentRowKey)&&void 0!==p?p:""),[z,W]=t.useReducer((e=>e+1),0),[B,U]=Ld([],{value:E}),[G,Y]=t.useState({gutterWidth:m?_d():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[X,Z]=t.useState({export:!0,import:!0,print:!0}),[Q,J]=t.useState(!1),[ee,te]=t.useState(!1),[ne,re]=t.useState(!1),[ie,le]=t.useState(!1),[oe,ae]=t.useState(!1),[se,ce]=t.useState(!1);return{tableData:N,setTableData:I,tableFlatColumns:R,setTableFlatColumns:O,filters:k,setFilters:A,sorter:L,setSorter:P,superFilters:_,setSuperFilters:H,pagination:F,setPagination:D,selectionKeys:$,setSelectionKeys:M,rowExpandedKeys:q,setRowExpandedKeys:j,highlightKey:V,setHighlightKey:K,updateMark:z,forceUpdate:W,mergedTdCells:B,setMergedCells:U,layout:G,permission:X,setPermission:Z,setLayout:Y,spinning:Q,setSpinning:J,scrollX:ee,setScrollX:te,scrollY:ne,setScrollY:re,isPingLeft:ie,setPingLeft:le,isPingRight:oe,setPingRight:ae,isFullScreen:se,setFullScreen:ce,updateTableData:()=>I([...N])}})(r),{isFetch:je,isWebPagination:Ve,isScrollPagination:Ke,showPagination:ze,shouldUpdateHeight:We,tableColumns:Be,flattenColumns:Ue,editableColumns:Ge,summationColumns:Ye,leftFixedColumns:Xe,rightFixedColumns:Ze,derivedMergeCells:Qe,treeExpandIndex:Je,showSummary:et,showFooter:tt,isHeadGroup:nt,bordered:rt,isHeadSorter:it,isHeadFilter:lt,isServiceSummation:ot,isSelectCollection:at,isTableImport:st,isTableClipboard:ct,isSuperSearch:dt,isFastSearch:ut,isGroupSummary:pt,isGroupSubtotal:ht,isTreeTable:mt,isTableEmpty:ft,summationRows:gt,fetchParams:vt}=Fd(r,{getRowKey:N,tableRef:I,tableFullData:R,tableData:Q,sorter:ie,filters:ne,superFilters:oe,selectionKeys:ue,pagination:ce,mergedTdCells:Ee}),{createElementStore:yt,tableStyles:bt,getSpan:xt,getStickyLeft:Et,getStickyRight:St,scrollXToColumn:wt,scrollYToRecord:Ct,rowInViewport:Tt,calcTableHeight:Nt,resetTableScroll:It,computeVirtualX:Rt,computeVirtualY:Ot,doLayout:kt}=$d(r,{getRowKey:N,tableRef:I,topElementRef:E,tableElementRef:S,$size:x,tableColumns:Be,flattenColumns:Ue,leftFixedColumns:Xe,derivedMergeCells:Qe,layout:we,scrollX:Oe,scrollY:Ae,showFooter:tt,showPagination:ze,isFullScreen:$e,setLayout:Ce,setScrollX:ke,setScrollY:Le,setElementStore:O,setScrollXStore:M,setScrollYStore:q,setShouldToTop:U}),{initialTable:At,checkDataIndex:Lt,createTableFullData:Pt,getTableData:_t,handleTableData:Ht,createWebPageData:Ft,createTableData:Dt,createGroupData:$t,createSelectionKeys:Mt,createRowExpandedKeys:qt,setSelectionKeysEffect:jt,findParentRowKeys:Kt,getAllChildRowKeys:zt,doFieldValidate:Wt,getTableLog:Bt,dataChange:Ut,tableChange:Gt,toLastPage:Yt,toFirstPage:Zt,getPageCount:Qt,pagerChangeHandle:Jt,triggerScrollXEvent:en,triggerScrollYEvent:tn,scrollBottomDebouncer:nn,clearTableSorter:rn,clearTableFilter:ln,clearSuperFilters:on,clearRowSelection:an,clearRowHighlight:sn,clearTableLog:cn,destroy:dn}=Dd(r,{getRowKey:N,tableRef:I,tableElementRef:S,tableBodyRef:w,$size:x,tableColumns:Be,flattenColumns:Ue,tableFullData:R,pagination:ce,layout:we,filters:ne,sorter:ie,superFilters:oe,fetchParams:vt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,summationColumns:Ye,shouldUpdateHeight:We,isFetch:je,isTreeTable:mt,isWebPagination:Ve,isScrollPagination:Ke,isServiceSummation:ot,isGroupSubtotal:ht,doLayout:kt,setTableData:J,setTableFlatColumns:te,setTableFullData:A,setTableOriginData:L,setTableFlatData:P,setAllTableData:_,setDeriveRowKeys:H,setPagination:de,setSpinning:Re,setSorter:le,setFilters:re,setSuperFilters:ae,setSelectionKeys:pe,setRowExpandedKeys:me,setHighlightKey:ye,setSelectionRows:B,setScrollXLoad:j,setScrollYLoad:V,setScrollXStore:M,setScrollYStore:q,computeVirtualX:Rt,computeVirtualY:Ot,setFieldAuth:D,setResizeState:K,setSummaries:W,setPermission:Ne,setRecordsMap:G,resetTableScroll:It,clearElementStore:X,clearRecordsMap:Z});Md(r,{tableRef:I,tableBodyRef:w,$size:x,scrollX:Oe,pagination:ce,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,showSummary:et,summationRows:gt,isWebPagination:Ve,isScrollPagination:Ke,isTreeTable:mt,checkDataIndex:Lt,toLastPage:Yt,toFirstPage:Zt,getPageCount:Qt,setHandleState:z,scrollYToRecord:Ct,setOriginColumns:k,setSelectionKeysEffect:jt,setRowExpandedKeys:me,setHighlightKey:ye,setResizeState:K,setPingRight:De,setUnMounted:Y,calcTableHeight:Nt,createSelectionKeys:Mt,createRowExpandedKeys:qt,initialTable:At,destroy:dn});const un=t.useMemo((()=>({getRowKey:N,tableRef:I,tableBodyRef:w,$size:x,flattenColumns:Ue,editableColumns:Ge,leftFixedColumns:Xe,rightFixedColumns:Ze,treeExpandIndex:Je,sorter:ie,filters:ne,superFilters:oe,layout:we,bordered:rt,showFooter:tt,showSummary:et,summationRows:gt,scrollX:Oe,scrollY:Ae,pagination:ce,fetchParams:vt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,mergedTdCells:Ee,derivedMergeCells:Qe,updateMark:be,isFetch:je,isPingLeft:Pe,isPingRight:He,isHeadSorter:it,isHeadFilter:lt,isFullScreen:$e,isTableEmpty:ft,isHeadGroup:nt,isTreeTable:mt,isGroupSubtotal:ht,isWebPagination:Ve,dataChange:Ut,tableChange:Gt,getTableData:_t,setElementStore:O,createWebPageData:Ft,createTableFullData:Pt,updateTableData:qe,setSorter:le,setFilters:re,setSuperFilters:ae,setHighlightKey:ye,setRowExpandedKeys:me,setSelectionRows:B,setSelectionKeysEffect:jt,setInvalidRowKeys:F,setMergedCells:Se,getSpan:xt,getStickyLeft:Et,getStickyRight:St,scrollXToColumn:wt,scrollYToRecord:Ct,rowInViewport:Tt,setPagination:de,setPingLeft:_e,setPingRight:De,setSpinning:Re,setFullScreen:Me,setShouldToTop:U,doFieldValidate:Wt,createTableData:Dt,createGroupData:$t,findParentRowKeys:Kt,getAllChildRowKeys:zt,triggerScrollXEvent:en,triggerScrollYEvent:tn,scrollBottomDebouncer:nn,resetTableScroll:It,clearTableSorter:rn,clearTableFilter:ln,clearSuperFilters:on,clearRowSelection:an,clearRowHighlight:sn})),[x,Ue,Ge,Xe,Ze,Je,ie,ne,oe,we,rt,tt,et,gt,Oe,Ae,ce,vt,ue,he,fe,Qe,be,je,Pe,He,it,lt,$e,ft,nt,mt,ht,Ve]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:l,tableBodyRef:o,columnFilterRef:a,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:v,handleTableData:y,createTableData:b,createTableFullData:x,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:T,setHandleState:N,setColumnsDefined:I,setSelectionKeysEffect:R,setRowExpandedKeys:O,setHighlightKey:k,setSelectionRows:A,setOriginColumns:L,forceUpdate:P,getTableLog:_,clearRowSelection:H,clearRowHighlight:F,clearTableSorter:D,clearTableFilter:$,clearSuperFilters:M,clearTableLog:q}=n,{columns:j,columnsChange:V}=i.current.props,K=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=K(e.children,t,n));const l=t.includes(i);return l&&(null==n||n(e,i)),!l}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:e=>En(void 0,void 0,void 0,(function*(){f&&(yield v(),null==e||e())})),GET_LOG:()=>_(),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||(H(),F(),D(),$(),M(),q(),b([]))},CLEAR_LOG:()=>{q()},CREATE_FOCUS:(e,t)=>{o.current.createFocus(e,t)},FORCE_UPDATE:()=>{P()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:(e,t)=>{const n=[...e];t&&(n.__prevent__=!0),R(n)},SET_EXPANDABLE:(e,t)=>{const n=[...e];t&&(n.__prevent__=!0),O(n)},SET_HIGHLIGHT:e=>{k(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),I(!0),a.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=Tl(j,e);if(!r)return Xt("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!se(t))return Xt("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return Xt("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&ve(r,e,t[e]);n&&(V?V([...j]):Xt("Table","需要设置 `columnsChange` 参数"),P())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:l}=i.current,o=(Array.isArray(e)?e:[e]).filter((e=>se(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[kd.expandableColumn,kd.selectionColumn,kd.operationColumn].includes(n)||Fl(e,n,Hl(e,n))})),n.addToInserted(e)}));const a="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=l;if(c)a?d.unshift(...o):d.push(...o);else{const e=Zl(l,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?a?e.children.unshift(...o):e.children.push(...o):e.children=o)}c&&N(Object.assign({},i.current.handleState,{insert:a?"before":"after"})),b(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,l=(Array.isArray(e)?e:[e]).map((e=>se(e)?r(e,e.index):e));if(!l.length)return;let o=!1;const a=K(n,l,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:l}=r,o=null==l?void 0:l(e,r);if(!o)return;const{rules:a=[],disabled:s}=o;!s&&a.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),o=!0}));o&&(N(Object.assign({},i.current.handleState,{remove:!0})),x(a),R(p.filter((e=>!l.includes(e)))),l.includes(m)&&F(),O(h.filter((e=>!l.includes(e)))),g(),Rn((()=>{T(K(i.current.tableOriginData,l))})))},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:l,editRender:o}=i,a=null==o?void 0:o(n,i);if(!a)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(l))return;const{rules:c=[],disabled:d}=a;!d&&c.length&&C(c,Hl(n,l),s,l)}))}));const{required:n,validate:l}=_(),o=[...n,...l];return o.length&&w(o[0].rowKey),P(),{required:n,validate:l}}})))})(n,{getRowKey:N,tableRef:I,toolBoxRef:C,tableBodyRef:w,columnFilterRef:T,flattenColumns:Ue,editableColumns:Ge,pagination:ce,fetchParams:vt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,isFetch:je,dataChange:Ut,getTableData:_t,handleTableData:Ht,createTableData:Dt,createTableFullData:Pt,calcTableHeight:Nt,scrollXToColumn:wt,scrollYToRecord:Ct,doFieldValidate:Wt,setTableOriginData:L,setHandleState:z,setColumnsDefined:$,setSelectionKeysEffect:jt,setRowExpandedKeys:me,setHighlightKey:ye,setSelectionRows:B,setOriginColumns:k,forceUpdate:xe,getTableLog:Bt,clearRowSelection:an,clearRowHighlight:sn,clearTableSorter:rn,clearTableFilter:ln,clearSuperFilters:on,clearTableLog:cn}),t.useLayoutEffect((()=>{yt(),I.current.tableManager.register(I.current.uid,null!=n?n:{current:null})}),[]);const pn=Dn("table"),mn={[`${pn}--wrapper`]:!0,[`${pn}--lg`]:"large"===x,[`${pn}--sm`]:"small"===x,[`${pn}--maximize`]:$e,[s]:!!s},fn={[pn]:!0,"is--border":rt,"is--fixed":Xe.length||Ze.length,"is--sortable":it,"is--filterable":lt,"is--head-group":nt,"is--area-select":!!c,"is--ping-left":Pe,"is--ping-right":He};return t.createElement(pd.Provider,{value:un},t.createElement("div",{className:Fe(mn)},m&&t.createElement("div",{ref:E,className:`${pn}-top`},t.createElement("div",{className:`${pn}-top__space`},"bottom"!==(null==p?void 0:p.position)&&t.createElement(qd,{total:ce.total}),t.createElement("div",{className:`${pn}-top__space-slot`,style:{justifyContent:Sd[h]}},r.children)),t.createElement("div",{className:`${pn}-top__actions`},t.createElement(vu,{ref:C,showFullScreen:f,showReload:g&&je,showPrint:Te.print&&!!d,showImport:Te.import&&st,showExport:Te.export&&!!u,showClipboard:ct,showCollection:at,showFastSearch:ut,showSuperSearch:dt,showGroupSummary:pt,showToolBox:v,tableColumns:Be}),t.createElement(bu,{ref:T,columns:l}))),t.createElement(Pi,{spinning:null!=o?o:Ie},t.createElement("div",{ref:S,className:Fe(fn),style:bt},t.createElement("div",{className:`${pn}--main-wrapper`},y&&t.createElement(Iu,{tableColumns:Be,sorter:ie,filters:ne}),t.createElement(Bu,{ref:w,tableFlatColumns:ee,tableData:Q}),tt&&t.createElement(Uu,{summationRows:gt})),rt&&t.createElement("div",{className:`${pn}--border-line`}),ft&&t.createElement(Xu,null),a&&t.createElement(Zu,null))),ze&&t.createElement(Yu,hn({},ce,{onChange:(e,t)=>Jt({current:e,pageSize:t})}))))}));Qu.displayName="QmTable";const Ju=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:o,defaultSelectedKeys:a=[],filters:s=[],table:c={},className:d,style:u,onClose:p}=e,{size:h}=t.useContext(Vt),m=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:h)&&void 0!==n?n:""}),[e.size,h]),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=$i(f),[b,x]=t.useState(c),[E,S]=t.useState(),[w,C]=t.useState(a),[T,N]=t.useState(!1),[I,R]=t.useState(300),[O,k]=t.useState(s),[A,L]=t.useState((e=>[{title:Bt("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[P,_]=t.useState(xe({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[H,F]=t.useState([]),D=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Qo[m]-30)},$=ji(D,5);qi((()=>{$()}),[y.width]),fi((()=>{ge(s,O)||k(s)}),[s]),t.useEffect((()=>{M()}),[P]),t.useEffect((()=>{o&&v.current.SET_SELECTION_ROWS(o)}),[o]),t.useEffect((()=>{var e;l&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(l))}),[]);const M=()=>En(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:o=Nn}=n;if(o(P)){N(!0);try{const t=yield r(P);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,l))&&void 0!==e?e:[];i||(C([]),yield In(0)),F(n)}}catch(e){}N(!1)}})),q=e=>{i||(S(e),p(e))},j=e=>{_(Object.assign({},P,e))},V={[`${Dn("search-helper")}--wrapper`]:!0},K=b.webPagination?{dataSource:H,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:P})};return t.createElement("div",{ref:f,className:Fe(V,d),style:u},t.createElement("div",{className:"form-wrap"},O.length?t.createElement(Fc,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>D(),onFinish:e=>j(e),onReset:()=>En(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(Qu,hn({ref:v,uniqueKey:r,height:I,columns:A,rowKey:b.rowKey||"pageIndex"},K,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{C(e),S(i?t:t[0])}},paginationConfig:b.paginationConfig,columnsChange:e=>L(e),onRowDblclick:q,onRowEnter:q}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Qo[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>p(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!E,onClick:()=>p(E,i?w:void 0)},Bt("qm.dialog.confirm"))))};Ju.displayName="SearchHelper";const ep=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...ep(e.children)),e.children&&t.push(e.value)})),t},tp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=tp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},np=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&np(e.children,t),t(e)||e.children&&e.children.length))),rp=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:o,defaultSelectedKeys:a=[],filters:s=[],table:c={},tree:d={},className:u,style:p,onClose:h}=e,{size:m}=t.useContext(Vt),f=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:m)&&void 0!==n?n:""}),[e.size,m]),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=$i(g),[x,E]=t.useState(c),[S,w]=t.useState(),[C,T]=t.useState(a),[N,I]=t.useState(!1),[R,O]=t.useState(300),[k,A]=t.useState(300),[L,P]=t.useState(s),[H,F]=t.useState((e=>[{title:Bt("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[D,$]=t.useState(xe({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[M,q]=t.useState([]),j=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");O(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Qo[f]-30)},V=ji(j,5);qi((()=>{V()}),[b.width]),fi((()=>{ge(s,L)||P(s)}),[s]),t.useEffect((()=>{K()}),[D]),t.useEffect((()=>{o&&y.current.SET_SELECTION_ROWS(o)}),[o]),t.useEffect((()=>{var e;l&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(l)),te()}),[]);const K=()=>En(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:o=Nn}=n;if(o(D)){I(!0);try{const t=yield r(D);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,l))&&void 0!==e?e:[];i||(T([]),yield In(0)),q(n)}}catch(e){}I(!1)}})),z=e=>{i||(w(e),h(e))},W=e=>{$(Object.assign({},D,e))},[B,U]=t.useState([]),[G,Y]=t.useState([]),[X,Q]=t.useState(""),J=t.useRef(B),ee=t.useRef([]);fi((()=>{Y(ep(B))}),[B]);const te=()=>En(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 o=yield t(n);if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=me(o.data,r))&&void 0!==e?e:[],n=yo(t,i,l);U(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${Ho.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${Dn("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:M,loading:N,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:D})};return t.createElement("div",{ref:g,className:Fe(re,u),style:p},t.createElement(ki,{defaultValue:200,style:{height:"100%"}},t.createElement(ki.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(_.Search,{className:"input-wrap",value:X,style:{marginBottom:8},placeholder:Bt("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=np(J.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==ne(n).indexOf(e)}));Q(e),U(t)})(e.target.value)}),t.createElement(Z,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:G,treeData:B,filterTreeNode:e=>{if(!X)return!1;const t=e.text||"";return-1!==ne(t).indexOf(X)},onExpand:e=>{Y(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return Xt("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=me(e,t[r]);W(n)})(tp(ee.current,(n=>me(n,t)===e[0]))||{})}})),t.createElement(ki.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},L.length?t.createElement(Fc,{ref:v,items:L,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>P(e),onCollapse:()=>j(),onFinish:e=>W(e),onReset:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||W(t)}))}):null),t.createElement("div",null,t.createElement(Qu,hn({ref:y,uniqueKey:r,height:k,columns:H,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{T(e),w(i?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>F(e),onRowDblclick:z,onRowEnter:z}))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Qo[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>h(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!S,onClick:()=>h(S,i?C:void 0)},Bt("qm.dialog.confirm"))))};rp.displayName="TreeTableHelper";const ip=e=>{var n,r,i;const{multiple:l,tree:o={},defaultSelectedKeys:a,className:s,style:c,onClose:d}=e,{size:u}=t.useContext(Vt),p=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:u)&&void 0!==n?n:""}),[e.size,u]),[h,m]=t.useState(),[f]=t.useState(null===(n=o.fetch)||void 0===n?void 0:n.params),g={[`${Dn("tree-helper")}--wrapper`]:!0},v=o.fetch?Object.assign(Object.assign({},An(o.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:Fe(g,s),style:c},t.createElement(ud,{multiple:l,fetch:v,fieldsDefine:{valueKey:null===(r=o.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=o.fetch)||void 0===i?void 0:i.textKey},asyncLoad:o.asyncLoad,checkStrictly:o.checkStrictly,checkStrategy:o.checkStrategy,defaultSelectedKeys:a,defaultExpandAll:o.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Qo[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>d(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!h,onClick:()=>d(h)},Bt("qm.dialog.confirm"))))};ip.displayName="TreeHelper";const lp="_startSign",op="_endSign",ap=e=>{var n;const{uniqueKey:r,initialValue:i,filters:l=[],table:o={},onClose:a}=e,{size:s}=t.useContext(Vt),c=t.useMemo((()=>{var t,n;return null!==(n=null!==(t=e.size)&&void 0!==t?t:s)&&void 0!==n?n:""}),[e.size,s]),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=$i(d),[m,f]=t.useState(o),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[S,w]=t.useState(l),[C,T]=t.useState((e=>[{title:Bt("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},{title:Bt("qm.form.rangeSearchHelper")[0],dataIndex:lp,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(o.columns||[]),{title:Bt("qm.form.rangeSearchHelper")[1],dataIndex:op,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[N,I]=t.useState(xe({},null===(n=o.fetch)||void 0===n?void 0:n.params,i)),[R,O]=t.useState([]),A=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),L=t.useMemo((()=>2===A.length&&A.every((e=>void 0!==e))),[A]),P=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Qo[c]-30)},_=ji(P,5);qi((()=>{_()}),[h.width]),fi((()=>{ge(l,S)||w(l)}),[l]),t.useEffect((()=>{H()}),[N]);const H=()=>En(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=m;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:l=Nn}=n;if(l(N)){v(!0);try{const t=yield r(N);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=me(t.data,i))&&void 0!==e?e:[];O(n)}}catch(e){}v(!1)}})),F=(e,t)=>{delete e[t]},D=()=>{y.forEach((e=>{e&&(F(e,lp),F(e,op))})),b([])},$=e=>{D(),I(Object.assign({},N,e))},M=Dn("range-helper"),q=m.webPagination?{dataSource:R,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},m.fetch),{params:N})};return t.createElement("div",{ref:d,className:`${M}--wrapper`},t.createElement("div",{className:"form-wrap"},S.length?t.createElement(Fc,{ref:u,items:S,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>P(),onFinish:e=>$(e),onReset:()=>En(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||$(t)}))}):null),t.createElement("div",null,t.createElement(Qu,hn({ref:p,height:x,columns:C,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=A[0]&&e.pageIndex<=A[1]?{backgroundColor:"#f5f5f5"}:{}},q,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[lp,op].includes(n)&&(n===lp&&(e[n]?(F(e,n),b([void 0,y[1]])):e.pageIndex>A[1]?k.warning(Bt("qm.searchHelper.rangeStartTip")):(y[0]&&F(y[0],n),e[n]="[",b([e,y[1]]))),n===op&&(e[n]?(F(e,n),b([y[0],void 0])):e.pageIndex<A[0]?k.warning(Bt("qm.searchHelper.rangeEndTip")):(y[1]&&F(y[1],n),e[n]="]",b([y[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===A[0]&&(e[lp]="["),e.pageIndex===A[1]&&(e[op]="]")}))}}),t.createElement(_n,{type:"primary",icon:t.createElement(gt,null),title:Bt("qm.table.alert.clear"),onClick:()=>D()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Qo[c]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(_n,{onClick:()=>a(null),style:{marginRight:8}},Bt("qm.dialog.cancel")),t.createElement(_n,{type:"primary",disabled:!L,onClick:()=>a(y.map((e=>(e=>{const t={};for(const n in e)[lp,op].includes(n)||(t[n]=e[n]);return t})(e))))},Bt("qm.dialog.confirm"))))};ap.displayName="RangeTableHelper";const sp=e=>null!=e;function cp(e,n,r,i){const[l,o]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;o(t||null)}));const[a,s]=t.useState(null),c=wd((()=>{if(l){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:l,left:o}=e.getBoundingClientRect();return r>=0&&o>=0&&i<=t&&l<=n})(l)&&n&&l.scrollIntoView(i);const{left:e,top:t,width:r,height:o}=l.getBoundingClientRect(),a={left:e,top:t,width:r,height:o,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(a)?a:e))}else s(null)}));t.useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[l,n,c]);return[t.useMemo((()=>{if(!a)return a;const e=(null==r?void 0:r.offset)||6,t=(null==r?void 0:r.radius)||2;return{left:a.left-e,top:a.top-e,width:a.width+2*e,height:a.height+2*e,radius:t}}),[a,r]),l]}const dp=8;const up={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"]}},pp={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"]}},hp=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function mp(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:l,visibleFirst:o}=e,a=t/2,s={};return Object.keys(up).forEach((e=>{const c=r&&pp[e]||up[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,hp.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-a-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=a+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-a-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=a+i}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?dp:r}}({contentRadius:l,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-a;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+a;break;case"leftTop":case"rightTop":d.offset[1]=-u.arrowOffsetHorizontal-a;break;case"leftBottom":case"rightBottom":d.offset[1]=u.arrowOffsetHorizontal+a}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 o=Object.assign(Object.assign({},l),i);return o.shiftX||(o.adjustX=!0),o.shiftY||(o.adjustY=!0),o}(e,u,t,n),o&&(d.htmlRegion="visibleFirst")})),s}const fp={fill:"transparent",pointerEvents:"auto"},gp=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:l,style:o={},fill:a="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${Nd()}`,p="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Ht,{open:s,autoLock:!0},t.createElement("div",{className:Fe(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},o)},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:p?`${n}-placeholder-animated`:""}))),t.createElement("rect",hn({},i?null:fp,{x:"0",y:"0",width:"100%",height:"100%",fill:a,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",hn({},fp,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",hn({},fp,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",hn({},fp,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",hn({},fp,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},vp=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:l,onPlay:o}=e,[a,s]=Ld(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=wd((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=It(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!a),a?null==l||l():null==o||o())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,i=window.innerWidth,l=window.innerHeight,o=e.clientX-wi(t).x,a=e.clientY-wi(t).y;return document.onmousemove=e=>{let s=e.clientX-o,c=e.clientY-a;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>l-r-1&&(c=l-r-1),xi(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},a?t.createElement(vt,null):t.createElement(yt,null))},yp=e=>{const{prefixCls:n,current:r,total:i=0,cover:l,title:o,description:a,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:v}=_u(),y="primary"!==c?"primary":"default",b=wd((e=>{w(e),40===e.keyCode&&(r<i-1?null==h||h():null==m||m()),38===e.keyCode&&r>0&&(null==p||p())}));t.useEffect((()=>{const e=It(document,"keyup",b);return()=>e.remove()}),[]);const x=sp(l)?t.createElement("div",{className:`${n}-cover`},l):null,E=sp(a)?t.createElement("div",{className:`${n}-description`},a):null;let S;S=g?g(r,i):[...Array.from({length:i}).keys()].map(((e,i)=>t.createElement("span",{key:e,className:Fe(i===r&&`${n}-indicator-active`,`${n}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:Fe(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(Ue,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(J,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(bt,{className:Fe(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},o)),E,t.createElement("div",{className:`${n}-footer`},i>1&&t.createElement("div",{className:`${n}-indicators`},S),t.createElement(Fn,{className:`${n}-buttons`},0!==r?t.createElement(_n,{className:`${n}-prev-btn`,size:"small",onMouseDown:w,onClick:p},v("qm.tour.prevStep")):null,r===i-1?t.createElement(_n,{className:`${n}-finish-btn`,type:y,size:"small",onClick:m},v("qm.tour.finish")):t.createElement(_n,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},v("qm.tour.nextStep"))))))},bp=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(yp,e))},xp={left:"50%",top:"50%",width:1,height:1},Ep=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:l,onChange:o,onClose:a,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0}=e,C=bn(e,["steps","defaultCurrent","current","onChange","onClose","onFinish","open","type","mask","arrow","control","overlayClassName","overlayStyle","placement","helper","zIndex","renderPanel","indicatorsRender","gap","animated","scrollIntoViewOptions"]),T=t.useRef(),[N,I]=Ld(0,{value:l,defaultValue:i}),[R,O]=Ld(void 0,{value:c,postState:e=>!(N<0||N>=r.length)&&(null!=e&&e)}),[k,A]=Ld(1051,{value:y,defaultValue:y}),[L,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=>A(e)})));const{target:H,type:F,placement:D,trigger:$,delay:M,style:q,arrow:j,className:V,mask:K,scrollIntoViewOptions:z,zIndex:W,action:B}=r[N]||{},U=W||k,G=F||d,Y=R&&(null!=K?K:u),X=null!=z?z:w,[Z,Q]=cp(H,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Q,g,D),ee=!!Q&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=T.current)||void 0===e||e.forceAlign()}),[te,N]),fi((()=>{R&&(ie(),null==B||B(Q,N))}),[R,Q]);const ne=e=>{I(e),null==o||o(e)},re=()=>{O(!1),null==a||a(N)},ie=()=>{if(!Q)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===bi(r=n,"display")||"hidden"===bi(r,"visibility")||"0"===bi(r,"opacity"))||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Q),e.length&&e[0].focus()};if(void 0===Q)return null;const le=()=>En(void 0,void 0,void 0,(function*(){if(!$||!Q)return;const{left:e,top:t}=Q.getBoundingClientRect(),n=Q.offsetWidth,r=Q.offsetHeight,[i,l]=[e+n/2,t+r/2],o=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:l}),a=document.elementFromPoint(i,l);a&&(a.dispatchEvent(o),yield In(null!=M?M:320))})),oe="boolean"==typeof Y?Y:!!Y,ae="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=Dn("tour"),de=[{[`${ce}-primary`]:"primary"===G},m,V],ue=mp({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(gp,{zIndex:U,prefixCls:ce,pos:Z,showMask:oe,style:null==ae?void 0:ae.style,fill:null==ae?void 0:ae.color,open:L,animated:S,rootClassName:m}),t.createElement(Ht,{open:L,autoLock:!0},t.createElement(Ft,hn({ref:T},C,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:L,popupClassName:Fe(de),prefixCls:ce,popup:()=>t.createElement(bp,hn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>En(void 0,void 0,void 0,(function*(){yield le(),ne(N-1)})),onNext:()=>En(void 0,void 0,void 0,(function*(){yield le(),ne(N+1)})),onClose:re,current:N,onFinish:()=>{re(),null==s||s()}},Object.assign({},r[N],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Q||document.body,forceRender:!1,destroyPopupOnHide:!0}),t.createElement("div",{className:Fe(m,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Z||xp),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(Ht,{open:R},t.createElement(vp,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));Ep.displayName="QmTour";const Sp=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],wp=e=>({_s:e,status:Sp[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Cp=e=>e?6:5,Tp=(e,t,n,r,i)=>{clearTimeout(r.current);const l=wp(e);t(l),n.current=l,null==i||i({current:l})},Np=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:l,initialEntered:a,mountOnEnter:c,unmountOnExit:d,onStateChange:u}=e||{},[m,f]=p((()=>wp(a?2:Cp(c)))),g=o(m),v=o(),[y,b]=(e=>se(e)?[e.enter,e.exit]:[e,e])(l),x=h((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Cp(t)}})(g.current._s,d);e&&Tp(e,f,g,v,u)}),[u,d]),E=h((e=>{const l=e=>{switch(Tp(e,f,g,v,u),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)}},o=g.current.isEnter;"boolean"!=typeof e&&(e=!o),e?!o&&l(t?r?0:1:2):o&&l(n?i?3:4:Cp(d))}),[x,u,t,n,r,i,y,b,d]);return s((()=>()=>clearTimeout(v.current)),[]),[m,E,x]},Ip=e=>{const{name:n,in:r,timeout:i,preEnter:l=!0,preExit:o}=e,[a,s]=Np({timeout:i,preEnter:l,preExit:o,initialEntered:r});return qi((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?qu(e,{className:Fe(e.props.className,n,a.status)}):e)))};var Rp={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Op=n(void 0);var kp=null;function Ap(){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 o=e.match(/Chrome\D?\d+/i);if(o&&(o=o[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Lp(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(Ap()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void k.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:kp?n=kp:((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),kp=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&Ap(),n}catch(e){k.error("getLodop 出错:"+e)}}Ap();const Pp=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)},_p=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:l}=t.useContext(Vt),{$$preview:o}=t.useContext(Op),{state:a,isWindowsPrinter:s,pageSize:c}=o,d=t.useRef(null),u=t.useRef({}),p=t.useRef([]),h=t.useRef([]),m=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:A,createPrintHtml:k,SHOW_PREVIEW:L,DIRECT_PRINT:P}))),fi((()=>{R()}),[a.form.printerType,a.form.setting.direction,a.form.setting.distance,a.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}}}=a,t=s?10*Rp.defaultDistance+10*Rp.defaultDistance:0;return("vertical"===e?c[0]:c[1])-t}),[a,s,c]),y=t.useMemo((()=>{const{form:{setting:{direction:e}}}=a,t=s?10*Rp.defaultDistance+10*Rp.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[a,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=a;return Pp(v-10*(e.left-Rp.defaultDistance)-10*(e.right-Rp.defaultDistance))}),[a,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=a;return Pp(y-10*(e.top-Rp.defaultDistance)-10*(e.bottom-Rp.defaultDistance))}),[a,y]),E=a.form.scale,S=t.useMemo((()=>{const{form:{setting:{distance:e}}}=a;return{left:Pp(10*e.left),right:Pp(10*e.right),top:Pp(10*e.top),bottom:Pp(10*e.bottom)}}),[a]),w=t.useMemo((()=>{const{form:{printerType:e}}=a,{left:t,right:n,top:r,bottom:i}=S,l=b+t+n,o=Rp.previewWidth-l<=0?0:(Rp.previewWidth-l)/2,s=Math.abs((1-E)*l/2);let c=0;return E>1&&(c=s>o?-1*o:-1*s),E<1&&(c=l-2*s>Rp.previewWidth?0:o>0?s:(Rp.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}}),[a,f,S,E,x,b]);p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const C=()=>{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:"",o=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: ${Rp.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;">',o?`<img src="${o}" border="0" height="46" />`:"","</td>","</tr>"].join("")},T=()=>{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},N=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=T().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,p.current=t},R=()=>{var e;if(!p.current.length)return;const{form:{setting:t,printerType:n}}=a;if(i)return m.current.push([T(),C(),...p.current]);const r=t.fixedLogo?x-Rp.logoHeight:x;let l=[];if(m.current=[],"stylus"===n)m.current.push([T(),...t.fixedLogo?[C()]:[],...p.current]);else{let e=0;for(let n=0,i=h.current.length;n<i;n++){const o=p.current[n],a=h.current[n];t.fixedLogo||0!==n||(e+=Rp.logoHeight),e+=a,e<=r?l.push(o):(m.current.push([T(),...t.fixedLogo?[C()]:[],...l]),l=[],e=0,n-=1),n===i-1&&l.length&&m.current.push([T(),...t.fixedLogo?[C()]:[],...l])}}t.fixedLogo||null===(e=m.current[0])||void 0===e||e.splice(1,0,C());for(let e=0,t=m.current.length;e<t&&e!==t-1;e++)m.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:m.current.length}),O()},O=()=>{var e,t;const{currentPage:n}=a;let r=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;r+=null!==(t=null===(e=m.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+=[...m.current[e-1]].join("")}else for(let e=0;e<m.current.length;e++)t+=m.current[e].join("");return t+="</table>",t},A=()=>{const e=[];for(let t=0;t<p.current.length;t++)e[t]=p.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+C()+T()+e.join("")+"</table>"},L=()=>En(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||(N(),yield In(0),I(),R(),g(!1))})),P=()=>En(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();N(),yield In(0),I(),R(),g(!1),o.doPrint(k()),yield In(0),o.doClose()})),_=()=>{Xt("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},H={[Dn("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:Fe(H)},t.createElement(Pi,{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:w}))))}));_p.displayName="Container";class Hp extends r{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:Bt("qm.print.setPanel.printParameter")},{type:"SELECT",label:Bt("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:Bt("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:Bt("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:Bt("qm.print.setPanel.vertical"),value:"vertical"},{text:Bt("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:Bt("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:Bt("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:Bt("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:Bt("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Rp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Rp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Rp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:Bt("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Rp.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:Bt("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:Bt("qm.print.setPanel.sizeUnit"),disright:Bt("qm.print.setPanel.sizeUnit"),distop:Bt("qm.print.setPanel.sizeUnit"),disbottom:Bt("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>En(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(Fc,{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(_n,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},Bt("qm.dialog.close")),t.createElement(_n,{type:"primary",onClick:()=>this.confirmHandle()},Bt("qm.dialog.confirm"))))}}Hp.contextType=Vt;class Fp extends r{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:Rp.defaultDistance,right:Rp.defaultDistance,top:Rp.defaultDistance,bottom:Rp.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=()=>En(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 Mt.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=>En(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)=>En(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=Lp();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i,printerName:l,printerType:o,copies:a}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Rp,{left:d,right:u,top:p,bottom:h}=i.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(l),t.SET_PRINT_COPIES(a),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"===o&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===o&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==o?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():k.error(Bt("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=Lp();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():k.error(Bt("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(`${g().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:Bt("qm.print.laserPrinter"),value:"laser"},{text:Bt("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Lp(),t=[{text:Bt("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){Xt("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 En(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Mt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),se(n)&&(yield Mt.setItem(this.printerKey,n))),se(n)&&Object.keys(n).length&&xe(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:o,printPage:a}=this.state,s=Dn("print-preview"),c={visible:r,title:Bt("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:Fe(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,Bt("qm.print.printer"),":",t.createElement($,{value:i.printerName,onChange:e=>{this.setState((t=>xe({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,Bt("qm.print.type"),":",t.createElement($,{value:i.printerType,onChange:e=>{this.setState((t=>xe({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement($.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,Bt("qm.print.copies"),":",t.createElement(j,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>xe({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,Bt("qm.print.printPage.0"),t.createElement(j,{value:a,min:1,max:o,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),Bt("qm.print.printPage.1")),t.createElement("span",null,t.createElement(ee,{size:"small",current:l,pageSize:1,total:o,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(_n,{type:"text",icon:t.createElement(it,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},Bt("qm.print.setting"))),t.createElement("span",null,t.createElement(_n,{type:"text",icon:t.createElement(qe,null),className:"text-btn",onClick:()=>this.exportClickHandle()},Bt("qm.print.export"))),t.createElement("span",null,t.createElement(_n,{icon:t.createElement(nt,null),type:"primary",onClick:this.printClickHandle},Bt("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Op.Provider,{value:this.provide},t.createElement(_p,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,Bt("qm.print.scale"),":",t.createElement(te,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>xe({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,Bt("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,Bt("qm.print.pageNumber"),":",Bt("qm.print.pagination",{currentPage:l,totalPage:o}))))),t.createElement(ll,c,t.createElement(Hp,{setting:i.setting,onChange:e=>{this.setState((t=>xe({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Op.Provider,{value:this.provide},t.createElement(_p,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Fp.contextType=Vt;class Dp extends r{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>En(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:o}=this.props,a={visible:e,title:Bt("qm.print.preview"),width:`${Rp.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:o,onClose:()=>{this.setState({visible:!1})}};return l?t.createElement(ll,a,t.createElement(Fp,s)):e?t.createElement(Fp,s):null},this.DO_PRINT=()=>En(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield In(0),this.setState({visible:!0}),yield In(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:o}=this.props,a={size:n||this.context.size||"",type:i,shape:o,icon:r,loading:e,disabled:l,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(_n,a,this.props.children),this.createRender())}}function $p(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Mp(e){const t=$p(e);return t?t.frameElement:null}function qp(e){const t=Kp(e);return jp([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function jp(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 Vp(e,t){const n=Mp(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,l=!1;for(;i;){const e=qp(i);if(r.push(e),i=Mp(i),l)break;i&&$p(i)===t&&(l=!0)}return jp(r)}return e.getBoundingClientRect()}function Kp(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)}}Dp.propTypes={size:(e,t,n)=>{if(!Qt(e[t]||""))return Yt("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:f.elementType},Dp.defaultProps={preview:!0,type:"primary",icon:t.createElement(nt,null)},Dp.contextType=Vt;const zp=Object.assign;class Wp{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=Yp.border,this.padding.style.borderColor=Yp.padding,this.content.style.backgroundColor=Yp.background,zp(this.node.style,{borderColor:Yp.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){Gp(t,"margin",this.node),Gp(t,"border",this.border),Gp(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 Bp{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 o;o=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 a=e.left+l;e.left<t.left&&(a=t.left+l);e.left+i>t.left+t.width&&(a=t.left+t.width-i-l);return o+="px",a+="px",{style:{top:o,left:a}}}(e,t,{width:n.width,height:n.height});zp(this.tip.style,r.style)}}class Up{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 Bp(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 Wp(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=Vp(e,this.window),i=Kp(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=Vp(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 Gp(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 Yp={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 Xp=null,Zp=null;function Qp(){null!=window.document&&(Xp=null,null!==Zp&&(Zp.remove(),Zp=null))}class Jp{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=>Ti(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Qp();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!==Xp&&clearTimeout(Xp),null!=n&&(null===Zp&&(Zp=new Up),Zp.inspect(n,r),i&&(Xp=setTimeout((()=>Qp()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=pe((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(){Qp(),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 eh(e){return document.querySelector(e)}const th=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:l}=e,{t:o}=_u();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},o("qm.table.config.emptyText")),t.createElement(Fn,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(_n,{size:"small",onClick:()=>null==i?void 0:i()},o("qm.guideTracker.closeButton")),t.createElement(_n,{size:"small",onClick:()=>null==r?void 0:r()},o("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(_n,{size:"small",onClick:()=>null==l?void 0:l()},o("qm.guideTracker.finishButton"))))},nh={left:"50%",top:"50%",width:1,height:1},rh=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:l,steps:o=[],placement:a="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=_u(),E=t.useRef(),S=t.useRef(o.length),[w,C]=Ld(0,{value:i,defaultValue:l}),[N,I]=Ld(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=Ld(1051,{value:h,defaultValue:h}),[k,A]=t.useState({}),[L,P]=t.useState(!1),[_,H]=t.useState(N),[F,D]=t.useState(!1),[$,M]=cp(k.node,!!r),[j,V]=t.useState(22),K=t.useRef(!1),z=t.useMemo((()=>w>=o.length?"add":"edit"),[w,o]),W=t.useMemo((()=>`${w+1} / ${o.length}`),[w,o]);t.useLayoutEffect((()=>{E.current=new Jp({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),A({id:Kl(),node:e,path:t}),C(S.current),P(!0),U(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(N?B():U(),N?setTimeout((()=>H(!0)),16):H(!1),()=>{U()})),[N]),t.useEffect((()=>{S.current=o.length}),[o]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},G=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:w,selector:k.path})})));const Y=Dn("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Z=mp({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Ht,{open:N&&L,autoLock:!0},t.createElement(Ft,{zIndex:R,builtinPlacements:Z,popupPlacement:a,popupVisible:N&&L,popupClassName:Fe(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{P(!1),B()};return t.createElement("div",{className:`${Y}-content`},t.createElement("div",{className:`${Y}-inner`},t.createElement(Ue,{className:`${Y}-close`,onClick:()=>{null==y||y(w),e()}}),t.createElement(q,{open:F,trigger:["click"],dropdownRender:()=>o.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement($t,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:o,setList:e=>{const t=e.map((e=>e.id)),n=o.map((e=>e.id));if(ge(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:w;C(i),null==v||v(Jl(e),i)}},o.map(((e,n)=>t.createElement("li",{key:n,className:Fe("item",{actived:e.id===k.id})},t.createElement(Ke,{className:"handle",title:x("qm.form.draggable")}),t.createElement("span",{className:"box"},t.createElement("span",{className:"title",title:e.title,onClick:()=>{n!==w&&(A({id:e.id,node:eh(e.selector),path:e.selector}),C(n),V(22===j?j+1:j-1),null==v||v(o,n))}},e.title),t.createElement(T,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=o.filter((t=>t.id!==e.id)),r=n===w;let i=n<=w?w-1:w;if(i=i<0?0:i,i=i>t.length?t.length:i,r&&t[i]){const{id:e,selector:n}=t[i];A({id:e,node:eh(n),path:n})}C(i),null==v||v(t,i)}},t.createElement(Ue,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>D(e)},t.createElement(xt,{className:Fe(`${Y}-close`,"menu-icon"),style:{width:j}})),m.content&&t.createElement(J,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:m.content,title:m.title},t.createElement(bt,{className:Fe(`${Y}-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"),W)),p?p({id:k.id,selector:k.path,actionStatus:z,DO_CLOSE:e},w):t.createElement(th,{action:z,onConfirm:()=>{null==v||v("add"===z?[...o,{id:k.id,selector:k.path,title:"Guide Title"}]:[...o],w),e()},onCancel:()=>{null==y||y(w),e()},onFinish:()=>{e(),null==y||y(w),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:Fe(`${Y}-target-placeholder`),style:Object.assign(Object.assign({},$||nh),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:G,onClick:G}))),s&&t.createElement(Ht,{open:_},t.createElement(vp,{zIndex:R,prefixCls:Y,onPause:()=>{K.current=L,P(!1),U()},onPlay:()=>{K.current?P(!0):B()}})))}));rh.displayName="QmGuideTracker";const ih=n=>{var r,i,l,o,a,s,c,d;const{content:u,image:p,width:h,height:m,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:S,className:w,style:C}=n,T=t.useRef(null),N=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!==(o=f.fontFamily)&&void 0!==o?o:"sans-serif",A=null!==(a=f.color)&&void 0!==a?a:"rgba(0, 0, 0, 0.15)",L=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],H=g[1],F=_/2,D=H/2,$=null!==(c=v[0])&&void 0!==c?c:F,M=null!==(d=v[1])&&void 0!==d?d:D,q=t.useMemo((()=>{const e=$-F,t=M-D;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}}),[F,D,$,M,b]),j=(e,t)=>{var n;if(T.current){const r=N.current.get(T.current);r&&(T.current.contains(r)&&T.current.removeChild(r),N.current.delete(T.current));const i=document.createElement("div");i.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,n]=e;return`${r=t,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${n}`;var r})).join(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=T.current)||void 0===n||n.append(i),N.current.set(T.current,i)}},V=()=>{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(!p&&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!=m?m:n]})(t),l=r*n,o=i*n,a=(_+r)*n,s=(H+i)*n,c=_/2*n,d=H/2*n,u=a/2,f=s/2,g=2*(_+r);e.width=2*a,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,a,s,a,s,a,s),S&&(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=A,t.textAlign=L,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(p){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,l,o),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=p}else b()},K=e=>Array.from(N.current.values()).includes(e);t.useEffect((()=>{V()}),[u,p,h,m,f,g,v,y,b,x,E,S]),function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=window&&"MutationObserver"in window,l=e.useRef(),o=()=>{l.current&&(l.current.disconnect(),l.current=void 0)};e.useLayoutEffect((()=>(o(),i&&t.current&&(l.current=new MutationObserver(n),l.current.observe(t.current,r)),()=>o())),[t])}(T,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>K(e))),n="attributes"===t.type&&K(t.target);if(e||n){V();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=Dn("watermark");return t.createElement("div",{ref:T,className:Fe(z,w),style:Object.assign({position:"relative"},C)},n.children)},lh=new Map,oh=new WeakMap;let ah,sh=0;function ch(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(oh.has(n)||(sh+=1,oh.set(n,sh.toString())),oh.get(n)):"0"):e[t]}`;var n})).toString()}function dh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ah;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:o}=function(e){const t=ch(e);let n=lh.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},lh.set(t,n)}return n}(n),a=o.get(e)||[];return o.has(e)||o.set(e,a),a.push(t),l.observe(e),function(){a.splice(a.indexOf(t),1),0===a.length&&(o.delete(e),l.unobserve(e)),0===o.size&&(l.disconnect(),lh.delete(i))}}const uh=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:l,className:o,style:a}=e,{ref:s,inView:c,entry:d}=function(){let{root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:l,trackVisibility:o,skip:a,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var d;const[u,p]=t.useState(null),[h,m]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(a||!u)return;let t;return t=dh(u,((e,n)=>{var r;m({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:o,delay:s},l),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,a,o,l,s]);const g=null===(d=h.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||i||a||v.current===g||(v.current=g,m({inView:!1,entry:void 0}));const y=[p,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||Xt("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[Dn("lazy-load")]:!0};return t.createElement("div",{ref:s,className:Fe(u,o),style:a},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},i))};class ph{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 hh{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 hh(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,o=t.y-n.y,a=(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),p=Math.sqrt(l*l+o*o),h=p/(u+p),m=c+(a-c)*h,f=d+(s-d)*h,g=t.x-m,v=t.y-f;return{c1:new ph(a+g,s+v),c2:new ph(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),o=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=l-e,i=o-t;n+=Math.sqrt(r*r+i*i)}e=l,t=o}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 mh{constructor(e,t){var n=this;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=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!n._drawingStroke)return;if(0===n._data.length)return void n._strokeBegin(e);const r=n._createPoint(e.x,e.y,e.pressure),i=n._data[n._data.length-1],l=i.points,o=l.length>0&&l[l.length-1],a=!!o&&r.distanceTo(o)<=n.minDistance,s=n._getPointGroupOptions(i);if(!o||!o||!a){const e=n._addPoint(r,s);t&&(o?e&&n._drawCurve(e,s):n._drawDot(r,s)),l.push({time:r.time,x:r.x,y:r.y,pressure:r.pressure})}},this._strokeEnd=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n._drawingStroke&&(t&&n._strokeUpdate(e),n._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,o=l*l,a=o*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*o*e.control2.x,u+=a*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*l*e.control1.y,p+=3*s*o*e.control2.y,p+=a*e.endPoint.y;const h=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,p,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 ph(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=hh.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),o=Math.min(i,n),a=.5*(Math.max(r,t)-l),s=.5*(Math.max(i,n)-o),c=l+a,d=o+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,a,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,o=(l+25)*Math.PI/180,a=(l-25)*Math.PI/180,s=15*Math.cos(o),c=15*Math.sin(o),d=15*Math.cos(a),u=15*Math.sin(a);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 p=r+s,h=i+c;this.ctx.lineTo(p,h);const m=r+d,f=i+u;this.ctx.lineTo(m,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,o=i/this.degreeOfBlur,a=l/this.degreeOfBlur;for(let e=0;e<a;e++)for(let t=0;t<o;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,o=[];let a="";for(let e=0;e<l.length;e++){const t=a+l[e];this.ctx.measureText(t).width>i&&a.length>0?(o.push(a),a=l[e]):a=t}o.push(a),o.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,this.backgroundColor?(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)):1!==this.ratio&&t.scale(this.ratio,this.ratio),e.toDataURL()===this.canvas.toDataURL()},this.toDataURL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n.canvas.width===n.width)return n.canvas.toDataURL(e,t);const r=document.createElement("canvas");r.width=n.width,r.height=n.height;return r.getContext("2d").drawImage(n.canvas,0,0,r.width,r.height),r.toDataURL(e,t)},this.getPNG=()=>this.toDataURL(),this.getJPG=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;return n.toDataURL("image/jpeg",e)},this.initial(e,t)}initial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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.backgroundColor=t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this._strokeMoveUpdate=this.throttle?function(e){let t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,l=0,o=null;const a=()=>{l=Date.now(),o=null,t=e.apply(n,r),o||(n=null,r=[])};return function(){const s=Date.now(),c=i-(s-l);n=this;for(var d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];return r=u,c<=0||c>i?(o&&(clearTimeout(o),o=null),l=s,t=e.apply(n,r),o||(n=null,r=[])):o||(o=window.setTimeout(a,c)),t}}(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)}}mh.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})},mh.canvasToDataURL=e=>e.toDataURL("image/png",1),mh.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const fh=()=>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"})),gh=()=>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"})),vh=()=>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"})),yh=()=>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"})),bh=()=>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"})),xh=t.forwardRef(((e,n)=>{const{open:r,width:i,height:l,imageName:o,penColor:a,minWidth:s,maxWidth:c,backgroundColor:d,className:u,style:p,onOk:h,onCancel:m}=e,{t:f}=_u(),v=t.useRef(),y=t.useRef(null),b=t.useRef(null),x=t.useRef(null),E=[2,4,6],S=[14,16,18,20,24,28],w=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[C,T]=Ld(void 0,{value:r,postState:e=>null!=e&&e}),N=t.useMemo((()=>!!e.children),[e.children]),[I,R]=t.useState(N?"square":"line"),[O,k]=t.useState(E[0]),[A,L]=t.useState(N?w[0]:w[4]),[P,_]=t.useState(S[1]),[H,F]=t.useState("bottomLeft"),[D,M]=t.useState(!1),[j,V]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=i?i:null===(e=b.current)||void 0===e?void 0:e.offsetWidth,height:null!=l?l:null===(t=b.current)||void 0===t?void 0:t.offsetHeight,maxWidth:O,mode:I,penColor:A,fontSize:P,backgroundColor:d,openSmooth:!N};return n.openSmooth&&Object.assign(n,{penColor:a,minWidth:s,maxWidth:c}),v.current=new mh(y.current,n),()=>v.current.destroy()}),[]);const K=e=>{var t,n;const[r,o]=[null!=i?i:null===(t=b.current)||void 0===t?void 0:t.offsetWidth,null!=l?l:null===(n=b.current)||void 0===n?void 0:n.offsetHeight],{width:a,height:s}=v.current;let c=!1;r&&r!==a&&(v.current.width=r,c=!0),o&&o!==s&&(v.current.height=o,c=!0),(c||e)&&v.current.update()};fi((()=>{N&&C&&K()}),[C,N]),fi((()=>{v.current.setDrawMode(I)}),[I]),fi((()=>{v.current.setLineWidth(O)}),[O]),fi((()=>{v.current.setPenColor(A)}),[A]),fi((()=>{v.current.setFontSize(P)}),[P]);const z=()=>En(void 0,void 0,void 0,(function*(){const e=N?b.current.parentNode:y.current;if(e)try{const t=yield Dt(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===x.current||e.classList.contains("spinning")});return mh.canvasToDataURL(t)}catch(e){Xt("Signature","生成合成图片失败!")}})),W=()=>{v.current.clear(),null==m||m()};t.useImperativeHandle(n,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>v.current.clear(),IS_EMPTY:()=>v.current.isEmpty(),UPDATE:K,GET_DATE_URL:z})));const B=e=>{e&&F((()=>{const e=x.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},U=e=>t.createElement("div",{className:Fe("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},E.map((e=>t.createElement("span",{key:e,className:Fe("dot",`s${e}`,{active:e===O}),onClick:()=>k(e)})))):t.createElement("div",{className:"fontSize"},t.createElement($,{size:"small",value:P,options:S.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},w.map((e=>t.createElement("span",{key:e,className:Fe("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>L(e)},t.createElement(Be,{className:"icon"})))))),G=Dn("signature"),Y={[G]:!0,"is-annotation":N},X=i?Object.assign(Object.assign({},p),{width:i}):p;return t.createElement("div",{className:Fe(Y,u),style:X},N&&t.createElement(t.Fragment,null,t.createElement("div",{ref:b,className:"content"},e.children),j&&t.createElement(Pi,{spinning:!0,className:"spinning"})),t.createElement("div",{className:Fe("signature",{show:C})},t.createElement("canvas",{ref:y,className:I}),N&&t.createElement("div",{ref:x,className:"signature__tool-bar"},t.createElement("div",{className:"wrapper"},t.createElement("div",{className:Fe("actions",{hidden:D})},t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("square")},t.createElement(Et,null))),t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("round")},t.createElement(fh,null))),t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("arrow")},t.createElement(vh,null))),t.createElement(q,{dropdownRender:U,overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("line")},t.createElement(St,null))),t.createElement(q,{dropdownRender:()=>U("text"),overlayClassName:`${G}__popper`,placement:H,trigger:["click"],onOpenChange:B},t.createElement("button",{className:"btn",onClick:()=>R("text")},t.createElement(gh,null))),t.createElement("button",{className:"btn",onClick:()=>En(void 0,void 0,void 0,(function*(){yield En(void 0,void 0,void 0,(function*(){V(!0);const e=yield z();if(e){const t=o?o.slice(0,o.lastIndexOf(".")>0?o.lastIndexOf("."):void 0):g().format(xd);Ui(mh.dataURLToBlob(e),`${t}.png`)}V(!1)})),W()}))},t.createElement(qe,null)),t.createElement("button",{className:"btn",onClick:()=>R("eraser")},t.createElement(yh,null)),t.createElement("button",{className:"btn",onClick:()=>v.current.undo()},t.createElement(bh,null)),t.createElement("button",{className:"btn",onClick:()=>v.current.clear()},t.createElement(gt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==m?void 0:m()},t.createElement(Ue,null)),t.createElement("button",{className:"btn",onClick:()=>En(void 0,void 0,void 0,(function*(){V(!0),yield In(10);const e=yield z();V(!1),W(),null==h||h(e)}))},t.createElement(Be,null))),t.createElement("button",{className:"btn btn-fold",title:f(D?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!D)},D?t.createElement(Ct,null):t.createElement(wt,null))))))}));xh.displayName="QmSignature";const Eh="1.9.28";export{un as Calendar,pn as DatePicker,Ji as DcpAnchor,_n as DcpButton,hi as DcpCollapse,yn as DcpConfigProvider,ju as DcpCopyToClipboard,Ai as DcpCountup,ed as DcpCropper,$n as DcpDivider,Xi as DcpDownload,nl as DcpDrawer,Li as DcpEmpty,Fc as DcpForm,rh as DcpGuideTracker,uh as DcpLazyLoad,ll as DcpModal,Dp as DcpPrint,ap as DcpRangeTableHelper,Bi as DcpScrollbar,Ju as DcpSearchHelper,ud as DcpSearchTree,xh as DcpSignature,Fn as DcpSpace,Pi as DcpSpin,ki as DcpSplit,Qu as DcpTable,tl as DcpTabs,Jc as DcpTinymce,Ep as DcpTour,Ip as DcpTransition,ip as DcpTreeHelper,rp as DcpTreeTableHelper,Yi as DcpUploadFile,nd as DcpUploadImg,ih as DcpWatermark,Ji as QmAnchor,_n as QmButton,hi as QmCollapse,yn as QmConfigProvider,ju as QmCopyToClipboard,Ai as QmCountup,ed as QmCropper,$n as QmDivider,Xi as QmDownload,nl as QmDrawer,Li as QmEmpty,Fc as QmForm,rh as QmGuideTracker,uh as QmLazyLoad,ll as QmModal,Dp as QmPrint,ap as QmRangeTableHelper,Bi as QmScrollbar,Ju as QmSearchHelper,ud as QmSearchTree,xh as QmSignature,Fn as QmSpace,Pi as QmSpin,ki as QmSplit,Qu as QmTable,tl as QmTabs,Jc as QmTinymce,Ep as QmTour,Ip as QmTransition,ip as QmTreeHelper,rp as QmTreeTableHelper,Yi as QmUploadFile,nd as QmUploadImg,ih as QmWatermark,mn as TimePicker,Ho as pinyin,Eh as version};
|