@jiaozhiye/qm-design-react 1.10.1 → 1.10.2
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/form/src/form.d.ts +5 -5
- package/lib/form/src/types.d.ts +1 -1
- package/lib/form/src/utils.d.ts +2 -2
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/style/index.css +17 -0
- package/lib/style/index.min.css +1 -1
- package/lib/table/src/table/props.d.ts +1 -1
- package/lib/table/src/table/types.d.ts +1 -1
- package/lib/table/style/table.less +373 -360
- package/lib/upload-file/src/upload-file.d.ts +2 -0
- package/lib/upload-img/src/upload-img.d.ts +1 -8
- package/package.json +1 -1
package/lib/index.full.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={442:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};n.r(a),n.d(a,{Affix:()=>L.Affix,Alert:()=>L.Alert,Anchor:()=>L.Anchor,AutoComplete:()=>L.AutoComplete,Avatar:()=>L.Avatar,BackTop:()=>L.BackTop,Badge:()=>L.Badge,Breadcrumb:()=>L.Breadcrumb,Button:()=>L.Button,Calendar:()=>$,Card:()=>L.Card,Carousel:()=>L.Carousel,Cascader:()=>L.Cascader,Checkbox:()=>L.Checkbox,Col:()=>L.Col,Collapse:()=>L.Collapse,Comment:()=>L.Comment,ConfigProvider:()=>L.ConfigProvider,DatePicker:()=>j,DcpAnchor:()=>or,DcpButton:()=>be,DcpCollapse:()=>$e,DcpConfigProvider:()=>ee,DcpCopyToClipboard:()=>Kc,DcpCountup:()=>ut,DcpCropper:()=>Sl,DcpDivider:()=>Re,DcpDownload:()=>Yt,DcpDrawer:()=>gr,DcpEmpty:()=>ft,DcpForm:()=>Qo,DcpGuideTracker:()=>Au,DcpLazyLoad:()=>$u,DcpModal:()=>Cr,DcpPrint:()=>cu,DcpRangeTableHelper:()=>Ed,DcpScrollbar:()=>Ht,DcpSearchHelper:()=>sd,DcpSearchTree:()=>Ml,DcpSignature:()=>Ju,DcpSpace:()=>Ee,DcpSpin:()=>xt,DcpSplit:()=>it,DcpTable:()=>id,DcpTabs:()=>pr,DcpTinymce:()=>bl,DcpTour:()=>jd,DcpTransition:()=>Ud,DcpTreeHelper:()=>gd,DcpTreeTableHelper:()=>md,DcpUploadFile:()=>wl,DcpUploadImg:()=>Ol,DcpWatermark:()=>Lu,Descriptions:()=>L.Descriptions,Divider:()=>L.Divider,Drawer:()=>L.Drawer,Dropdown:()=>L.Dropdown,Empty:()=>L.Empty,Form:()=>L.Form,Grid:()=>L.Grid,Image:()=>L.Image,Input:()=>L.Input,InputNumber:()=>L.InputNumber,Layout:()=>L.Layout,List:()=>L.List,Mentions:()=>L.Mentions,Menu:()=>L.Menu,Modal:()=>L.Modal,PageHeader:()=>L.PageHeader,Pagination:()=>L.Pagination,Popconfirm:()=>L.Popconfirm,Popover:()=>L.Popover,Progress:()=>L.Progress,QmAnchor:()=>or,QmButton:()=>be,QmCollapse:()=>$e,QmConfigProvider:()=>ee,QmCopyToClipboard:()=>Kc,QmCountup:()=>ut,QmCropper:()=>Sl,QmDivider:()=>Re,QmDownload:()=>Yt,QmDrawer:()=>gr,QmEmpty:()=>ft,QmForm:()=>Qo,QmGuideTracker:()=>Au,QmLazyLoad:()=>$u,QmModal:()=>Cr,QmPrint:()=>cu,QmRangeTableHelper:()=>Ed,QmScrollbar:()=>Ht,QmSearchHelper:()=>sd,QmSearchTree:()=>Ml,QmSignature:()=>Ju,QmSpace:()=>Ee,QmSpin:()=>xt,QmSplit:()=>it,QmTable:()=>id,QmTabs:()=>pr,QmTinymce:()=>bl,QmTour:()=>jd,QmTransition:()=>Ud,QmTreeHelper:()=>gd,QmTreeTableHelper:()=>md,QmUploadFile:()=>wl,QmUploadImg:()=>Ol,QmWatermark:()=>Lu,Radio:()=>L.Radio,Rate:()=>L.Rate,Result:()=>L.Result,Row:()=>L.Row,Segmented:()=>L.Segmented,Select:()=>L.Select,Skeleton:()=>L.Skeleton,Slider:()=>L.Slider,Space:()=>L.Space,Spin:()=>L.Spin,Statistic:()=>L.Statistic,Steps:()=>L.Steps,Switch:()=>L.Switch,Table:()=>L.Table,Tabs:()=>L.Tabs,Tag:()=>L.Tag,TimePicker:()=>B,Timeline:()=>L.Timeline,Tooltip:()=>L.Tooltip,Transfer:()=>L.Transfer,Tree:()=>L.Tree,TreeSelect:()=>L.TreeSelect,Typography:()=>L.Typography,Upload:()=>L.Upload,message:()=>L.message,notification:()=>L.notification,pinyin:()=>na,version:()=>ep});var i=n(442),o=n.n(i);const l=require("prop-types");var s=n.n(l);const c=(0,i.createContext)({locale:"zh-cn",size:"middle"}),d=require("dayjs");var u=n.n(d);const p={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:"查找下一个"}}}};require("dayjs/locale/zh-cn");let h=p;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const f=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,a]=t;let i;const o=n.split(".");let l=h;for(let e=0,t=o.length;e<t;e++){if(i=l[o[e]],e===t-1)return m(i,a);if(!i)return"";l=i}return""},g=e=>{h=e||h,h.name&&u().locale(h.name)};class b extends Error{constructor(e){super(e),this.name="QmDesignError"}}function y(e,t){throw new b(`[${e}] ${t}`)}function v(e,t){console.warn(new b(`[${e}] ${t}`))}const x=e=>["","small","middle","large"].includes(e),E=require("dayjs/plugin/localeData");var S=n.n(E);const w=require("dayjs/plugin/advancedFormat");var C=n.n(w);const T=require("dayjs/plugin/customParseFormat");var I=n.n(T);const N=require("dayjs/plugin/quarterOfYear");var R=n.n(N);const P=require("dayjs/plugin/weekOfYear");var O=n.n(P);const k=require("dayjs/plugin/weekday");var A=n.n(k);u().extend(S()),u().extend(C()),u().extend(I()),u().extend(R()),u().extend(O()),u().extend(A());const L=require("antd"),_=require("rc-picker/es/generate/dayjs");var F=n.n(_);const H=require("antd/es/calendar/generateCalendar");var D=n.n(H);require("antd/es/calendar/style");const $=D()(F()),q=require("antd/es/date-picker/generatePicker");var M=n.n(q);require("antd/es/date-picker/style/index");const j=M()(F());function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},K.apply(this,arguments)}const V=i.forwardRef(((e,t)=>i.createElement(j,K({},e,{picker:"time",mode:void 0,ref:t}))));V.displayName="TimePicker";const z=i.forwardRef(((e,t)=>i.createElement(j.RangePicker,K({},e,{picker:"time",mode:void 0,ref:t}))));z.displayName="RangePicker",V.RangePicker=z;const B=V,U={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"}}}},W=require("antd/es/locale/zh_CN");var G=n.n(W);const Y=require("antd/es/locale/en_GB");var X=n.n(Y);function Q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Z={[U.name]:{qm:U,antd:X()},[p.name]:{qm:p,antd:G()}};class J extends i.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},g(Object.assign({},Z,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:a,size:i,global:o}=e;return a!==r&&g(Object.assign({},Z,o.langPackage)[a].qm),a!==r||i!==n?{value:Object.assign({},t.value,{locale:a,size:i})}:null}render(){const{global:e}=this.props,{value:t}=this.state,r=Object.assign({},Z,e.langPackage);return o().createElement(c.Provider,{value:t},o().createElement(L.ConfigProvider,{locale:r[t.locale].antd,componentSize:t.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}Q(J,"propTypes",{locale:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:s().string,global:s().object}),Q(J,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const ee=J,te=require("lodash-es"),re="undefined"==typeof window,ne=e=>o().isValidElement(e),ae=e=>ne(e)&&e.type===o().Fragment,ie=()=>{},oe=()=>!0,le=async e=>new Promise((t=>setTimeout(t,e))),se=e=>{Promise.resolve().then(e)},ce=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),de=e=>!!(!e&&0!==e||(0,te.isArray)(e)&&!e.length||(0,te.isPlainObject)(e)&&!Object.keys(e).length),ue=(e,t)=>{const r={...e};for(const e of t)delete r[e];return r},pe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,te.isPlainObject)(e)||(0,te.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(a||e,((r,i)=>{a&&(i=r),n[i]=pe(e[i],t)})),n}return e},he=e=>(0,te.isNumber)(e)?`${e}px`:e.toString();function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},me.apply(this,arguments)}function fe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ge extends i.Component{constructor(){super(...arguments),fe(this,"context",void 0),fe(this,"state",{isLoading:!1}),fe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){v("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:t,authConfig:r,click:n,confirm:a}=this.props,{isLoading:i}=this.state,l=e||this.context.size||"",s=(0,te.isFunction)(n)?{onClick:this.clickHandle}:null,c={...ue(this.props,["authConfig","click","confirm"]),size:l,loading:i||t||!1,...s};if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(c.disabled=!0)}return a?o().createElement(L.Popconfirm,{title:a.title||f("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{a.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{a.onCancel?.(e)}},o().createElement(L.Button,me({},c,{onClick:ie}),this.props.children)):o().createElement(L.Button,c,this.props.children)}}fe(ge,"propTypes",{click:s().func,confirm:s().shape({title:s().node,onConfirm:s().func,onCancel:s().func})}),fe(ge,"contextType",c);const be=ge;function ye(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ve=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ve||{});class xe extends i.Component{constructor(){super(...arguments),ye(this,"context",void 0)}render(){const{size:e}=this.props,t=e||this.context.size||"",r=(0,te.isNumber)(e)?e:ve[e||t||"default"],n={...this.props,size:r};return o().createElement(L.Space,n,this.props.children)}}ye(xe,"contextType",c);const Ee=xe,Se=require("classnames");var we=n.n(Se);const Ce=e=>`qm-${e}`,Te=require("@ant-design/icons");function Ie(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ne extends i.Component{constructor(){super(...arguments),Ie(this,"context",void 0),Ie(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=ie}=this.props;t(!e)}))}render(){const{size:e,label:t,extra:r,collapse:n,bordered:a,disabled:i,id:l,className:s,style:c}=this.props,d=e||this.context.size||"",u=Ce("divider"),p={[u]:!0,[`${u}-borderless`]:!a,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return o().createElement("div",{id:l,className:we()(p,s),style:c},o().createElement("span",{className:we()(`${u}__title`)},t),o().createElement("div",{className:we()(`${u}__extra`)},r),void 0!==n&&o().createElement(L.Button,{type:"link",className:we()(`${u}__collapse`),disabled:i,onClick:this.clickHandle},f(n?"qm.divider.collect":"qm.divider.spread"),n?o().createElement(Te.UpOutlined,null):o().createElement(Te.DownOutlined,null)))}}Ie(Ne,"contextType",c),Ie(Ne,"propTypes",{label:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:s().oneOfType([s().element,s().string]),collapse:s().bool,bordered:s().bool}),Ie(Ne,"defaultProps",{bordered:!0});const Re=Ne,Pe=()=>({height:0,opacity:0}),Oe=(e,t)=>"height"===t.propertyName,ke={motionName:"rc-collapse-motion",onEnterStart:Pe,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Pe,onEnterEnd:Oe,onLeaveEnd:Oe,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Ae=require("rc-motion");var Le=n.n(Ae);const _e=o().forwardRef(((e,t)=>{const{forceRender:r,className:n,style:a,boxStyle:i,isActive:l}=e,[s,c]=o().useState(l||r);if(o().useEffect((()=>{(r||l)&&c(!0)}),[r,l]),!s)return null;const d=Ce("collapse");return o().createElement("div",{ref:t,className:we()(`${d}-content`,{[`${d}-content-active`]:l,[`${d}-content-inactive`]:!l},n),style:a},o().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));_e.displayName="PanelContent";const Fe=_e;function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},He.apply(this,arguments)}const De=e=>{const{defaultActive:t,label:r,extra:n,className:a,style:i,containerStyle:l,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=o().useState(!!t),f=Ce("collapse"),g=we()({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},a);return o().createElement("div",{className:g,style:i},o().createElement(Re,{label:r,extra:n,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),p?.(e)}}),o().createElement(Le(),He({visible:h},ke,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((t,r)=>{let{className:n,style:a}=t;return o().createElement(Fe,{ref:r,prefixCls:f,className:n,style:a,boxStyle:l,isActive:h,forceRender:d},e.children)})))};De.displayName="QmCollapse";const $e=De,qe=o().createContext(void 0);function Me(e,t){((t,r)=>{const n=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(n.current)),r),i.useEffect((()=>(n.current=!1,()=>{n.current=!0})),[])})(0,t)}const je=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Ke=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},Ve=e=>e.preventDefault(),ze=(e,t)=>{if(re||!e||!t)return null;"float"===(t=ce(t))&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const n=window.getComputedStyle(e);return n?n[t]:""}catch(r){return e.style[t]}},Be=(e,t,r)=>{!re&&e&&t&&((0,te.isPlainObject)(t)?Object.keys(t).forEach((r=>{Be(e,r,t[r])})):(t=ce(t),e.style[t]=r))},Ue=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},We=(e,t)=>Math.abs(Ue(e)-Ue(t)),Ge=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Ye=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},Xe=(e,t)=>{if(re||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Qe=e=>Math.pow(e,3),Ze=e=>e<.5?Qe(2*e)/2:1-Qe(2*(1-e))/2,Je=e=>{const{minValues:t,onDragChange:r,onDragging:n}=e,{splitRef:a,direction:i}=o().useContext(qe),l=o().useRef(re?null:document.onselectstart),s=o().useMemo((()=>"horizontal"===i),[i]),c=o().useMemo((()=>s?"X":"Y"),[s]),d=o().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 r=e[`page${c}`]-d.current[`start${c}`],a=[t[0],d.current[`containerSize${c}`]-t[1]];let i=d.current[`firstElementSize${c}`]+r;i=Math.max(a[0],i),i=Math.min(a[1],i),n(i)},h=()=>{u({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),Ke(document,"mousemove",p),Ke(document,"mouseup",h),m()},m=()=>{document.onselectstart!==l.current&&(document.onselectstart=l.current)},g=Ce("split"),b={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return o().createElement("div",{className:we()(b),title:f("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,n=t.children[0];u({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),je(document,"mousemove",p),je(document,"mouseup",h),r(!0),l.current=document.onselectstart,document.onselectstart=()=>!1}})};Je.displayName="ResizeBar";const et=Je,tt=o().forwardRef(((e,t)=>{const{offset:r,className:n,style:a}=e,{direction:i,dragging:l}=o().useContext(qe),s="vertical"===i?"height":"width",c=Ce("split-pane"),d={[c]:!0,isLocked:l,horizontal:"horizontal"===i,vertical:"vertical"===i,[n]:!!n},u=void 0!==r?{[s]:he(r)}:{flex:1,[s]:0};return o().createElement("div",{ref:t,className:we()(d),style:{...u,...a}},e.children)}));tt.displayName="QmSplitPane";const rt=tt;function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nt.apply(this,arguments)}const at=e=>{const{direction:t="horizontal",defaultValue:r="50%",uniqueKey:n,className:a,style:i,onDragStart:l,onDrag:s=ie,onDragEnd:d}=e,{global:u}=o().useContext(c),p=o().useRef(null),h=o().useRef(null),m=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=o().useMemo((()=>n?`split_${n}`:""),[n]),[y,v]=o().useState(!1),[x,E]=o().useState(m(r));Me((()=>{y?l?.(f(x)):(d?.(f(x)),localStorage.setItem(b,x),C(b,x))}),[y]),o().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(m(e)):w(b).then((e=>{localStorage.setItem(b,m(e||r)),S()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},C=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},T=o().useMemo((()=>({splitRef:p,direction:t,dragging:y})),[t,y]),I=[];o().Children.map(e.children,(e=>{ne(e)&&!ae(e)&&"QmSplitPane"===e.type?.displayName&&I.push(e)}));const[N,R]=I,P=o().useMemo((()=>[g(N),g(R)]),[N,R]),O=Ce("split"),k={[O]:!0,vertical:"vertical"===t};return o().createElement(qe.Provider,{value:T},o().createElement("div",{ref:p,className:we()(k,a),style:i},o().createElement(rt,nt({},N.props,{ref:h,offset:x})),o().createElement(et,{minValues:P,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),s(e)}}),o().createElement(rt,R.props)))};at.Pane=rt,at.displayName="QmSplit";const it=at,ot=require("react-countup");var lt=n.n(ot);function st(){return st=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},st.apply(this,arguments)}function ct(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class dt extends i.Component{constructor(){super(...arguments),ct(this,"context",void 0)}render(){const{size:e,className:t,style:r}=this.props,n=e||this.context.size||"",a=Ce("countup"),i={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return o().createElement(lt(),st({},this.props,{className:we()(i,t),style:r}),this.props.children)}}ct(dt,"defaultProps",{duration:2}),ct(dt,"contextType",c);const ut=dt;function pt(){return pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pt.apply(this,arguments)}function ht(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mt extends i.Component{constructor(){super(...arguments),ht(this,"context",void 0)}render(){const{size:e,className:t}=this.props,r=e||this.context.size||"",n=Ce("empty"),a={...this.props,image:L.Empty.PRESENTED_IMAGE_SIMPLE},i={[n]:!0,[`${n}--lg`]:"large"===r,[`${n}--sm`]:"small"===r};return o().createElement(L.Empty,pt({},a,{className:we()(i,t)}))}}ht(mt,"contextType",c),ht(mt,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ft=mt;class gt extends i.Component{render(){const{fullHeight:e,className:t,style:r={}}=this.props,n=Ce("spin"),a={[`${n}-full-height`]:e},i={wrapperClassName:we()(a,t),...ue(this.props,["fullHeight"]),style:{...r,maxHeight:"none"}};return o().createElement(L.Spin,i,this.props.children)}}var bt,yt,vt;bt=gt,vt={tip:"Loading...",fullHeight:!1},(yt=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(yt="defaultProps"))in bt?Object.defineProperty(bt,yt,{value:vt,enumerable:!0,configurable:!0,writable:!0}):bt[yt]=vt;const xt=gt,Et=o().createContext(void 0),St=require("resize-observer-polyfill");var wt=n.n(St);const Ct=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},Tt=function(e,t){!re&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(wt())(Ct),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},It=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Nt(e){const[t,r]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,n=e=>{const{width:t,height:n}=e.contentRect;r({width:t,height:n})};return t&&Tt(t,n),()=>{t&&It(t,n)}}),[e]),t}const Rt=(e,t)=>{const r=i.useRef(!0);i.useLayoutEffect((()=>e(r.current)),t),i.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function Pt(e,t){Rt((t=>{if(!t)return e()}),t)}function Ot(e,t){var r=this;const n=i.useRef(null);i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]);const a=i.useCallback((function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(r,i)),t)}),[e,t]);return a}const kt=6,At={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"}},Lt=e=>{const{thumb:t,always:r,className:n,barSize:a=kt,direction:i="vertical",onDrag:l=ie}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=o().useContext(Et),u=At[i],p=o().useRef(t),h=o().useRef(null),m=o().useRef(null),f=o().useRef({}),g=o().useRef(!1),b=o().useRef(!1),y=o().useRef(re?null:document.onselectstart),[v,x]=o().useState(!1);o().useLayoutEffect((()=>{p.current=t}),[t]),o().useEffect((()=>{const e=c.current;return je(e,"mousemove",C),je(e,"mouseleave",T),()=>{w(),Ke(document,"mouseup",S),Ke(e,"mousemove",C),Ke(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 r=100*(-1*(h.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=r*d.current[u.scrollSize]/100,l(!0)},S=()=>{g.current=!1,f.current={[u.axis]:0},Ke(document,"mousemove",E),Ke(document,"mouseup",S),w(),b.current&&x(!1),l(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},C=()=>{b.current=!1,x(!!p.current.size)},T=()=>{b.current=!0,x(g.current)},I=Ce("scrollbar"),N={[`${I}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},R={[u.reverse]:a},P={[u.size]:t.size,transform:`translate${u.axis}(${t.offset}%)`};return o().createElement(Ud,{name:"fade",in:r||s||v,timeout:300},o().createElement("div",{ref:h,className:we()(N,n),style:R},o().createElement("div",{ref:m,className:`${I}__thumb`,style:P,onMouseDown:e=>{e.stopPropagation(),je(document,"mousemove",E),je(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])})}})))},_t=20,Ft=o().forwardRef(((e,t)=>{const{wrapClassName:r,wrapStyle:n,barWidth:a,always:i,native:l,showTopScrollbar:s,minSize:c=_t,onScroll:d}=e,u=o().useRef(null),p=o().useRef(null),h=o().useRef(null),[m,f]=o().useState({size:0,offset:0,ratio:1}),[g,b]=o().useState({size:0,offset:0,ratio:1}),[y,x]=o().useState(!1),E=Nt(u),S=Nt(h);Pt((()=>{!l&&w()}),[S.width,S.height,E.width,E.height]);const w=Ot((()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,r=e**2/p.current.scrollHeight,n=t**2/p.current.scrollWidth,a=Math.max(r,c),i=Math.max(n,c),o=r/(e-r)/(a/(e-a)),l=n/(t-n)/(i/(t-i)),s=a+4<e?a:0,d=i+4<t?i:0,u=100*p.current.scrollTop/e*o,h=100*p.current.scrollLeft/t*l;f(Object.assign({},m,{size:d,ratio:l,offset:h})),b(Object.assign({},g,{size:s,ratio:o,offset:u}))}),5),C=e=>{x(e)},T=(e,t)=>{(0,te.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const o=(Date.now()-r)/500;o<1?(e.scrollTop=n+(t-n)*Ze(o),a(i)):e.scrollTop=t};a(i)})(p.current,e):p.current.scrollTop=e:v("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},I=(e,t)=>{(0,te.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const o=(Date.now()-r)/500;o<1?(e.scrollLeft=n+(t-n)*Ze(o),a(i)):e.scrollLeft=t};a(i)})(p.current,e):p.current.scrollLeft=e:v("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};o().useImperativeHandle(t,(()=>({container:u.current,scrollTop:p.current?.scrollTop||0,scrollLeft:p.current?.scrollLeft||0,SET_SCROLL_TOP:T,SET_SCROLL_LEFT:I})));const N=o().useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:p})),[y]),R=Ce("scrollbar"),P={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!l};return o().createElement("div",{ref:u,className:we()(R,e.className),style:e.style},o().createElement("div",{ref:p,className:we()(P,r),style:n,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!l&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,r=100*p.current.scrollTop/e*g.ratio,n=100*p.current.scrollLeft/t*m.ratio;f(Object.assign({},m,{offset:n})),b(Object.assign({},g,{offset:r}))})(),d?.({scrollTop:t,scrollLeft:r})}},o().createElement("div",{ref:h,className:`${R}__view`},e.children)),!l&&o().createElement(Et.Provider,{value:N},s&&o().createElement(Lt,{className:"top",direction:"horizontal",thumb:m,barSize:a,always:i,onDrag:C}),o().createElement(Lt,{direction:"horizontal",thumb:m,barSize:a,always:i,onDrag:C}),o().createElement(Lt,{direction:"vertical",thumb:g,barSize:a,always:i,onDrag:C})))}));Ft.displayName="QmScrollbar";const Ht=Ft,Dt=require("sortablejs");var $t=n.n(Dt);const qt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Mt(){return Mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mt.apply(this,arguments)}function jt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Kt=async(e,t)=>{let{fileName:r,headers:n,params:a}=t;const i=a?new URLSearchParams(a).toString():"",o=i?e.includes("?")?"&":"?":"",l=await fetch(e+`${o+i}`,{method:"GET",headers:n});if(!l.ok)throw new Error(f("qm.download.error"));const s=await l.blob(),c=l.headers.get("content-disposition"),d=r||(c?c.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));qt(s,d)},Vt=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e};class zt extends i.Component{constructor(){super(...arguments),jt(this,"context",void 0),jt(this,"state",{actived:{}}),jt(this,"uploadRef",o().createRef()),jt(this,"sortableInstance",void 0),jt(this,"setActiveState",((e,t)=>{this.setState((r=>({actived:Object.assign({},r.actived,{[e]:t??!r.actived[e]})})))})),jt(this,"createSortable",(()=>{this.props.draggable&&(this.sortableInstance=$t().create(this.getFileListNode(),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:e=>{const{oldIndex:t,newIndex:r}=e,{fileList:n=[],onSortChange:a,onChange:i}=this.props;if(t!==r){const e=[...n],[o]=e.splice(t,1);e.splice(r,0,o),a?.(e),i?.({fileList:e})}}}))})),jt(this,"getFileListNode",(()=>Ye(this.uploadRef.current,Ce("upload-file")).querySelector(".ant-upload-list"))),jt(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,maxCount:o,fileList:l=[],beforeUpload:s}=this.props,c=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!i||e.size/1024/1024<i,u=!(o>1)||l.length<o,p=c&&d&&u;if(c||L.message.warning(f("qm.upload.tooltip",{type:a.join(",")})),d||L.message.warning(f("qm.upload.sizeLimit",{size:i})),u||L.message.warning(f("qm.upload.countLimit",{count:o})),!p)return L.Upload.LIST_IGNORE;if(s){const a=s(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),jt(this,"doDownload",(async e=>{const{downloadWithHeaders:t,headers:r}=this.props;try{e.url&&await Kt(e.url,{fileName:e.name,...t?{headers:r}:null})}catch(e){L.message.error(f("qm.download.error"))}})),jt(this,"itemRender",((e,t)=>{const{fileList:r,draggable:n,editable:a,iconRender:i,onChange:l,onEditChange:s}=this.props,{actived:c}=this.state,{uid:d,name:u,url:p,status:h="done"}=e,m="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return o().createElement("div",{className:we()("ant-upload-list-item",`ant-upload-list-item-${h}`,"ant-upload-list-item-list-type-text",{handle:n})},o().createElement("div",{className:"ant-upload-list-item-info"},o().createElement("span",{className:"ant-upload-span"},o().createElement("div",{className:"ant-upload-text-icon"},i?i(e):o().createElement(Te.PaperClipOutlined,null)),o().createElement("div",{className:"ant-upload-list-item-name"},c[d]?o().createElement(L.Input,{size:"small",autoFocus:!0,defaultValue:Vt(u),onBlur:t=>{const{value:n}=t.target;if(n!==Vt(u)){const t=Object.assign({},e,{name:n}),a=r.map((e=>e.uid!==d?e:t));s?.(t,a),l?.({file:t,fileList:a})}this.setActiveState(d,!1)}}):o().createElement("a",{target:"_blank",rel:"noreferrer",title:u,href:p,onClick:e=>{e.preventDefault(),a?this.setActiveState(d,!0):t.preview()}},u)),o().createElement("span",{className:"ant-upload-list-item-card-actions"},a&&o().createElement("button",{type:"button",className:m,onClick:()=>this.setActiveState(d)},c[d]?o().createElement(Te.CheckOutlined,null):o().createElement(Te.EditOutlined,null)),a&&o().createElement("button",{type:"button",className:m,onClick:()=>t.preview()},o().createElement(Te.EyeOutlined,null)),o().createElement("button",{type:"button",className:m,onClick:()=>t.download()},o().createElement(Te.DownloadOutlined,null)),o().createElement("button",{type:"button",className:m,onClick:()=>t.remove()},o().createElement(Te.DeleteOutlined,null))))))}))}get $size(){return this.context.size??""}componentDidMount(){this.createSortable()}componentWillUnmount(){this.sortableInstance?.destroy()}render(){const{fileList:e=[],button:t={},fileDirection:r,disabled:n,readOnly:a,className:i,onPreview:l,onChange:s}=this.props,c=Ce("upload-file"),d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===r};return o().createElement(L.Upload,Mt({className:we()(d,i)},ue(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:n||a,onChange:s,onPreview:async e=>{if("function"==typeof l)return l(e,(t=>this.doDownload(t||e)));n||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)},itemRender:(e,t,r,n)=>this.itemRender(t,n)}),o().createElement("span",{ref:this.uploadRef},this.props.children||a&&e.length?this.props.children:o().createElement(L.Button,{type:t.type??"default",icon:t.icon??o().createElement(Te.UploadOutlined,null),disabled:n||a},t.text||f("qm.upload.text"))))}}jt(zt,"contextType",c),jt(zt,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Bt=zt;function Ut(){return Ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ut.apply(this,arguments)}function Wt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gt extends i.Component{constructor(){super(...arguments),Wt(this,"context",void 0),Wt(this,"state",{loading:!1}),Wt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,fileName:t,headers:r,params:n,beforeDownload:a=oe}=this.props,i=(0,te.isString)(e)?e:await this.getActionUrl();if(!i)return v("Download","参数 `action` 有误!");if(!a(i))return;await Kt(i,{fileName:t,headers:r,params:n}),await le(100),this.props.onSuccess?.(),L.message.success(f("qm.download.success"))}catch(e){this.props.onError?.(e),L.message.error(f("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}render(){const{size:e}=this.props,{loading:t}=this.state,r=e||this.context.size||"",n=ue(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return o().createElement(L.Button,Ut({},n,{size:r,loading:t,onClick:this.downloadHandle}),this.props.children)}}Wt(Gt,"propTypes",{action:s().oneOfType([s().string,s().shape({api:s().func.isRequired,params:s().object})]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:s().string,headers:s().object,withCredentials:s().bool,params:s().object,beforeDownload:s().func,onSuccess:s().func,onError:s().func}),Wt(Gt,"defaultProps",{icon:o().createElement(Te.DownloadOutlined,null),children:f("qm.download.text"),withCredentials:!1}),Wt(Gt,"contextType",c);const Yt=Gt,Xt=require("add-dom-event-listener");var Qt=n.n(Xt);const Zt=require("scroll-into-view-if-needed");var Jt=n.n(Zt);class er extends i.Component{renderLabel(){const{activeKey:e,labels:t,onTabClick:r}=this.props;return t.map(((t,n)=>{const a={item:!0,actived:n===e};return o().createElement("div",{key:n,className:we()(a),onClick:e=>r(n,e)},o().createElement("span",null,t))}))}render(){return o().createElement(o().Fragment,null,this.renderLabel())}}const tr=er;class rr extends i.Component{render(){const{label:e,showDivider:t,className:r,style:n}=this.props,a=Ce("anchor-item"),i={[a]:!0};return o().createElement("div",{className:we()(i,r),style:n},t&&o().createElement(Re,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(rr,"displayName","QmAnchorItem");const nr=rr;function ar(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ir extends i.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(e){super(e),ar(this,"context",void 0),ar(this,"currentState","ready"),ar(this,"itemsTotal",void 0),ar(this,"timer",void 0),ar(this,"scrollEvent",void 0),ar(this,"scrollRef",(0,i.createRef)()),ar(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),ar(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Jt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),ar(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=Qt()(this.scrollRef.current,"scroll",(0,te.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=We(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>We(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const a=r[e],i=r[e+1]||1e4;t>=a-1&&t<i&&(n=e)}return n}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:t,labelWidth:r,tabPosition:n,labelList:a=[],onTabClick:i,className:l,style:s}=this.props,c=t||this.context.size||"",d=Ce("anchor"),u={[d]:!0,[`${d}-left`]:"left"===n,[`${d}-top`]:"top"===n,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];o().Children.map(this.props.children,(e=>{ne(e)&&!ae(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const h=this.__is_conf?a.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?a.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,o().createElement("div",{className:we()(u,l),style:s},o().createElement("div",{className:we()("anchor-nav"),style:{width:r?he(r):""}},o().createElement(tr,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),i?.({label:h[e],id:m[e]},t)}})),o().createElement("div",{ref:this.scrollRef,className:we()("anchor-container")},this.__is_conf?this.props.children:p))}}ar(ir,"Item",nr),ar(ir,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:s().arrayOf(s().shape({id:s().string,label:s().string}))}),ar(ir,"defaultProps",{tabPosition:"left"}),ar(ir,"contextType",c);const or=ir;class lr extends i.Component{render(){return o().createElement(L.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(lr,"displayName","QmTabPane");const sr=lr;function cr(){return cr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cr.apply(this,arguments)}function dr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ur extends i.Component{constructor(){super(...arguments),dr(this,"context",void 0)}render(){const{items:e,size:t,tabPosition:r,tabBarGutter:n,className:a,authConfig:i}=this.props,l=t||this.context.size||"",s=Ce("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===l,[`${s}--sm`]:"small"===l},d={...ue(this.props,["items","authConfig"]),size:l,tabBarGutter:n??(["top","bottom"].includes(r)?30:0)},u=[];o().Children.map(this.props.children,(e=>{ne(e)&&!ae(e)&&"QmTabPane"===e.type?.displayName&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(i){const{fieldList:e=[]}=i||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return o().createElement(L.Tabs,cr({},d,{items:p,className:we()(c,a)}))}}dr(ur,"TabPane",sr),dr(ur,"contextType",c),dr(ur,"defaultProps",{tabPosition:"top"});const pr=ur;function hr(){return hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},hr.apply(this,arguments)}function mr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fr extends i.Component{constructor(){super(...arguments),mr(this,"context",void 0),mr(this,"titleRef",o().createRef()),mr(this,"$drawer",null),mr(this,"opened",!1),mr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),mr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,te.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),mr(this,"toggleHandle",(()=>{this.$drawer=Ye(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),mr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),mr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,o=n??r,l=e.open??e.visible,{fullscreen:s}=this.state;o&&o!==l&&(!i&&this.opened||(0,te.isUndefined)(a)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Be(this.$drawer,s?{width:"100%"}:{width:he(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:t,showHeader:r,showFullScreen:n}=this.props;return o().createElement(o().Fragment,null,o().createElement("span",{ref:this.titleRef,className:we()("text")},r&&t),n&&o().createElement("button",{type:"button",className:we()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Te.FullscreenExitOutlined:Te.FullscreenOutlined)))}render(){const{spinning:e,sloading:t}=this.state,{visible:r,open:n,size:a,className:i,loading:l,showHeader:s,maskClosable:c,onClose:d}=this.props,u=this.context.global,p=a||this.context.size||"",h=Ce("drawer"),m={[h]:!0,"no-header":!s,[`${h}--lg`]:"large"===p,[`${h}--sm`]:"small"===p};return o().createElement(L.Drawer,hr({},ue(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:n??r,maskClosable:c??u?.maskClosable??!1,className:we()(m,i),title:this.renderTitle(),footer:null,onClose:d,afterOpenChange:this.afterVisibleChange}),this.props.children,(l||t||e)&&o().createElement(xt,{spinning:!0,className:we()("spinning")}))}}mr(fr,"contextType",c),mr(fr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),mr(fr,"defaultProps",{width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null});const gr=fr,br=require("react-draggable");var yr=n.n(br);function vr(){return vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vr.apply(this,arguments)}function xr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Er="10vh";var Sr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(Sr||{});class wr extends i.Component{constructor(){super(...arguments),xr(this,"context",void 0),xr(this,"draggleRef",o().createRef()),xr(this,"opened",!1),xr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),xr(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),xr(this,"toggleHandle",(e=>{const t=Ye(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{width:n,height:a,showHeader:i}=this.props,{fullscreen:o}=this.state;o?(Be(t,{width:he(n||"60%"),height:"auto",top:Er}),Be(r,{height:a?he(a):this.defaultHeight,maxHeight:"auto"===a?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${Sr[i?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),xr(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),xr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),xr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${Er} - ${Er} - ${Sr[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,o=n??r,l=e.open??e.visible,{fullscreen:s}=this.state;if(o&&o!==l){if(!i&&this.opened||(0,te.isUndefined)(a)&&this.setState({spinning:!0}),!i&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,te.isUndefined)(a)&&this.setState({spinning:!1})}),400)}s!==t.fullscreen&&(s?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:t}=this.state,{title:r,showHeader:n,showFullScreen:a}=this.props;return o().createElement("div",{onMouseOver:()=>{t&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},o().createElement("span",{className:we()("text")},n&&r),a&&o().createElement("button",{type:"button",className:we()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Te.FullscreenExitOutlined:Te.FullscreenOutlined)))}render(){const{spinning:e,sloading:t,fullscreen:r,disabled:n,bounds:a,position:i}=this.state,{visible:l,open:s,height:c,className:d,loading:u,draggable:p,showHeader:h,maskClosable:m,bodyStyle:f,onClose:g}=this.props,b=this.context.global,y=Ce("modal"),v={height:c?he(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},x={[y]:!0,"no-header":!h,[`${y}--lg`]:"large"===this.$size,[`${y}--sm`]:"small"===this.$size};return o().createElement(L.Modal,vr({},ue(this.props,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:s??l,maskClosable:m??b?.maskClosable??!1,className:we()(x,d),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},v,f),onCancel:g,afterClose:this.afterVisibleChange,modalRender:e=>o().createElement(yr(),{nodeRef:this.draggleRef,bounds:a,position:i,disabled:!p||n||r,onStart:(e,t)=>this.onStart(e,t)},o().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(u||t||e)&&o().createElement(xt,{spinning:!0,className:we()("spinning")}))}}xr(wr,"contextType",c),xr(wr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),xr(wr,"defaultProps",{width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Er}});const Cr=wr,Tr=require("memoize-one");var Ir=n.n(Tr);const Nr=(0,i.createContext)(void 0),Rr=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Pr={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)Rr.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},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 r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-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,r){return e.split(t).join(r)},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 "),this.find_replace(e," NIN "," nin ")}},Or=["==","<",">","<=",">=","!=","like","likes","in","nin"],kr=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)Or.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Or.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},Ar=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Lr=["string","number","boolean","symbol"],_r=e=>Lr.includes(typeof e),Fr=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Hr=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Ar,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Hr(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Hr(t))));break;case"in":_r(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":_r(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(Fr(e)?e.slice(0,10):e)!=r;break;case"<":n=(Fr(e)?e.slice(0,10):e)<r;break;case"<=":n=(Fr(e)?e.slice(0,10):e)<=r;break;case">":n=(Fr(e)?e.slice(0,10):e)>r;break;case">=":n=(Fr(e)?e.slice(0,10):e)>=r;break;default:n=(Fr(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const Dr=Pr.stringify,$r=Pr.array_format,qr=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},Mr=(e,t,r)=>{let n=[];t=Pr.replace_symbols(t);try{if(r){const r=new Function("record",`return ${kr(t,"record")};`);n=vn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${kr(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){v("Table","组件 `initialFilter` 参数有误!"),n=e}return n},jr=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...jr(e.children)):t.push(e)})),t},Kr=e=>e.filter((e=>(e.children&&(e.children=Kr(e.children)),!e.hidden&&!e.noAuth))),Vr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Vr(e.children))})),t},zr=(e,t)=>e.map((e=>(e.children&&(e.children=zr(e.children,t)),t?.(e),e))),Br=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Br(r.children,t);if(e)return e}}return null},Ur=e=>{const t=e.children;return t?t[0].children?Ur(t[0]):t[0]:e},Wr=e=>{const t=e.children;return t?t[t.length-1].children?Wr(t[t.length-1]):t[t.length-1]:e},Gr=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Yr=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Yr(r.children,t);if(e)return e}}return null},Xr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Xr(e.children))})),t},Qr=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Vr(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Zr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Zr(e.offsetParent,t,r)}return r},Jr=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,en=(e,t)=>(0,te.transform)(e,((e,r,n)=>{(0,te.isEqual)(r,t[n])||(e[n]=(0,te.isPlainObject)(r)&&(0,te.isPlainObject)(t[n])?en(r,t[n]):r)})),tn=(e,t)=>(0,te.get)(e,t)??"",rn=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,te.set)(e,t,r??"")},nn=(e,t)=>{if(!t.includes("|"))return tn(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(tn(e,t))})),r.every((e=>!e))?"":r.join(" | ")},an=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),on=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},ln=(e,t)=>{const r=e.toString();if(!an(r)||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},sn=(e,t)=>e?u()(e,t):null,cn=(e,t)=>e?u()(e).format(t):"",dn=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 r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},un=e=>{const t=[];if(o().isValidElement(e)){const{children:r}=e.props;o().Children.forEach(r,(e=>{t.push(...un(e))}))}else t.push(e);return t},pn=e=>un(e).join(""),hn=e=>e.filter((e=>!e._group)),mn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const o=Array.isArray(i.condition)?$r(i.condition):Dr(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${o} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],o=e[n];for(const e in o)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(o[e])?$r(o[e]):Dr(o[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},fn=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((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(tn(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},gn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=gn(e[r].children,t);if(n)return[e[r],n].flat()}}},bn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=bn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},yn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=yn(r.children,t);if(e)return e}if(t(r))return r}return null},vn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vn(e.children,t),t(e)||e.children&&e.children.length))),xn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),En=80,Sn="1",wn="0",Cn=400,Tn=["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"],In={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Nn=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),Rn=function(e){return 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",e}({}),Pn=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const On={items:s().arrayOf(s().shape({type:s().string.isRequired,fieldName:s().string.isRequired})),initialValues:s().object,initialExtras:s().object,layout:s().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:s().number,customClass:s().string,compactMode:s().bool,labelWidth:s().oneOfType([s().number,s().string]),labelAlign:s().oneOf(["left","right"]),labelWrap:s().bool,formType:s().oneOf(["default","search","onlyShow"]),disabled:s().bool,uniqueKey:s().string,defaultRows:s().number,defaultExpand:s().bool,searchButtonCols:s().number,scrollToFirstError:s().bool,authConfig:s().object,isAutoFocus:s().bool,isCollapse:s().bool,isFieldsDefine:s().bool,isSearchBtn:s().bool,isSubmitBtn:s().bool,fieldsChange:s().func,onValuesChange:s().func,onFieldsChange:s().func,onFinish:s().func,onFinishFailed:s().func,onReset:s().func,onCollapse:s().func},kn={layout:"horizontal",labelWidth:En,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ie,onFieldsChange:ie,onFinish:ie,onFinishFailed:ie,onReset:ie,onCollapse:ie},An=(e,t)=>{if(!e)return null;if(t===Rn.week){const t=e.match(/^(\d{4})-(\d+)/);return t?u()().year(Number(t[1])).week(Number(t[2])):null}if(t===Rn.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?u()().year(Number(t[1])).quarter(Number(t[2])):null}return u()(e,t)},Ln=(e,t)=>e?u()(e).format(t):"",_n=e=>""===e||null==e,Fn=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Hn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Dn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},$n=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),(0,te.isUndefined)(e.isLeaf)||(n.isLeaf=!!e.isLeaf),(0,te.isUndefined)(e.selectable)||(n.selectable=!!e.selectable),Array.isArray(e.children)&&(n.children=$n(e.children,t,r)),n})),qn=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=qn(r.children,t);if(e)return e}}return null},Mn=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...Mn(e.children,t,r+1))})),n},jn=e=>ne(e)||"string"==typeof e,Kn=e=>ne(e)?un(e).join(""):e??"",Vn=(e,t,r,n)=>{const a={};return a.filters=e.filters?.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}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},zn={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"}},Bn="阿",Un="鿿",Wn=1,Gn=2,Yn=3;let Xn,Qn=null;function Zn(e){return e||null===Qn?("object"==typeof Intl&&Intl.Collator?(Xn=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Qn=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Qn=!1,Qn):Qn}function Jn(e){const t=zn.UNIHANS,r=zn.PINYINS,n=zn.EXCEPTIONS,a={source:e};if(e in n)return a.type=Gn,a.target=n[e],a;let i,o=-1;if(e.charCodeAt(0)<256)return a.type=Wn,a.target=e,a;if(i=Xn.compare(e,Bn),i<0)return a.type=Yn,a.target=e,a;if(0===i)a.type=Gn,o=0;else{if(i=Xn.compare(e,Un),i>0)return a.type=Yn,a.target=e,a;0===i&&(a.type=Gn,o=t.length-1)}if(a.type=Gn,o<0){let r=0,n=t.length-1;for(;r<=n;){o=~~((r+n)/2);const a=t[o];if(i=Xn.compare(e,a),0===i)break;i>0?r=o+1:n=o-1}}return i<0&&o--,a.target=r[o],a.target||(a.type=Yn,a.target=a.source),a}function ea(e){return"string"==typeof e&&Zn()?e.split("").map((e=>Jn(e))):e}const ta={isSupported:Zn,parse:ea,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(zn)})))},genToken:Jn,convertToPinyin:(e,t,r)=>ea(e).map((e=>t&&e.type===Gn?e.target.toLowerCase():e.target)).join(r||"")},ra={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}};ta.isSupported()&&ra.shouldPatch(ta.genToken)&&ta.patchDict(ra);const na=ta,aa=e=>{const{value:t,bordered:r}=e;return o().createElement(L.Input,{value:t,title:t,bordered:r,readOnly:!0})};aa.displayName="FormItemView";const ia=aa;function oa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function la(){return la=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},la.apply(this,arguments)}const{Option:sa}=L.Select,ca=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,multiple:a,loading:i,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:g,disabled:b}=e.option,{itemList:y=[],filterable:v=!0,listHeight:x=Cn,collapseTags:E,maxTagTextLength:S,dropdownStyle:w,openPyt:C=!0}=d,T=de(y)?n:y,I=e=>T.find((t=>t.value===e))?.text||e?.toString()||"",N=e=>a?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?o().createElement(ia,{value:N(r),bordered:h}):o().createElement(L.Select,la({value:r,mode:a?"multiple":void 0,popupClassName:`form-popper__${c}`,dropdownStyle:w,placeholder:p,style:u,loading:i,bordered:h,allowClear:m,disabled:b,showSearch:v,listHeight:x,maxTagCount:E?"responsive":void 0,maxTagTextLength:S},a?{title:N(r)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,N(e),T)})(e)}}),T.map((e=>o().createElement(sa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class da extends i.Component{constructor(){super(...arguments),oa(this,"context",void 0),oa(this,"state",{itemList:[],loading:!1}),oa(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(a),className:we()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":he(d)},required:e.getFormItemRequired(f)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},o().createElement(ca,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(l,r)}}))),h&&o().createElement(L.Col,null,e.renderFormItemButton(l,h)),p&&o().createElement(L.Col,{flex:he(p.labelWidth||En)},e.renderFormItemExtra({fieldName:l,...p}))))}}oa(da,"contextType",Nr);const ua=da;function pa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ha=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=wn,trueValue:h=Sn}=l;return o().createElement(L.Checkbox,{checked:r===h,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{n?.(e),a(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:p)}},u?i:null)};class ma extends i.Component{constructor(){super(...arguments),pa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option,{labelToCheckbox:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(ha,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}pa(ma,"contextType",Nr);const fa=ma,ga=require("react-sortablejs");function ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ya extends i.Component{constructor(){super(...arguments),ba(this,"context",void 0),ba(this,"linkRef",o().createRef()),ba(this,"state",{visible:!1}),ba(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),ba(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),ba(this,"resetFieldsHandle",(e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||pe(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));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,te.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,te.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,te.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,te.isEqual)(t,r)||(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;t?.([...e])}popupRender(){const{items:e}=this.props;return o().createElement(Nr.Consumer,null,(t=>{const r=t.$$form;return o().createElement("div",{className:we()("ant-dropdown-menu","fields-list")},o().createElement("div",{className:"reset"},o().createElement(be,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(r.getOriginItems())},f("qm.table.columnFilter.reset"))),o().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));if((0,te.isEqual)(n,a))return;r.setExpandHandle(!0);const i=xn(t);this.changeHandle(i),this.setLocalFields(i)}},e.map((t=>o().createElement("li",{key:t.fieldName,className:"item",style:t.noAuth?{display:"none"}:void 0},o().createElement(L.Checkbox,{disabled:t.rules?.findIndex((e=>e.required))>-1,checked:!t.hidden,onChange:r=>{const{checked:n}=r.target;t.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),o().createElement(Te.HolderOutlined,{className:"handle",title:f("qm.form.draggable")}),o().createElement("span",{className:"title"},r.getFormItemLabel(t.label)))))))}))}render(){const{visible:e}=this.state,t=Ce("form-fields-filter");return o().createElement(Nr.Consumer,null,(r=>{const{$size:n}=r.$$form,a={[t]:!0,[`${t}--lg`]:"large"===n,[`${t}--sm`]:"small"===n};return o().createElement(L.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:we()(a),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},o().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},o().createElement(Te.UnorderedListOutlined,null)))}))}}ba(ya,"contextType",c);const va=ya;function xa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ea=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Nr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h,onBlur:m=ie,onEnter:g=ie}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:w,autoFocus:C,autoComplete:T,secretType:I}=l,N=I&&(p||h),R=o().useRef(),P=e=>{a?.(e),i(e)},O=v?L.Input.Password:L.Input,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}(n,I):n;return r.isOnlyShow?o().createElement(ia,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):o().createElement(O,{ref:e=>{R.current=e,"function"==typeof t&&t(e)},value:k,autoComplete:v?"new-password":T,autoFocus:C,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:p,disabled:h,onBlur:t=>{let r=t.target.value??"";if(w){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),m(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),r.isFilterType&&(r.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,te.isRegExp)(E)&&(t=E.test(t)?t:n??""),S&&(t=t.toUpperCase()),P(t)}})}));Ea.displayName="VInput";class Sa extends i.Component{constructor(){super(...arguments),xa(this,"context",void 0),xa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ea,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(a,u)),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}xa(Sa,"contextType",Nr);const wa=Sa;function Ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ta=e=>{const{$$form:t}=o().useContext(Nr),{value:r=[],onChange:n,onValuesChange:a}=e,{options:i={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:p,suffix:h,maxLength:m}=i,g=e=>{const t=e.every((e=>!e))?[]:e;n?.(t),a(t,b(t))},b=e=>e.join(" - ");return t.isOnlyShow?o().createElement(ia,{value:b(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:l[0],prefix:p,suffix:h,maxLength:m,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),o().createElement(L.Input,{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}),o().createElement(L.Input,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:l[1],prefix:p,suffix:h,maxLength:m,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Ia extends i.Component{constructor(){super(...arguments),Ca(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ta,{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(a,t)}}))),c&&o().createElement(L.Col,{flex:he(c.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ca(Ia,"contextType",Nr);const Na=Ia,Ra=require("big.js");var Pa=n.n(Ra);function Oa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ka=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Nr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:p,onBlur:h=ie,onEnter:m=ie}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:w=!0,formatter:C,parser:T}=l,I=o().useRef(),N=o().useRef(n),R=e=>{const t=_n(e)?"":(0,te.isNumber)(e)?e.toFixed(v):new(Pa())(e).toFixed(v);return"function"==typeof C?C(t):t},P={[S]:!0,controls:w};return r.isOnlyShow?o().createElement(ia,{value:R(n),bordered:d}):o().createElement(L.InputNumber,{ref:e=>{I.current=e,"function"==typeof t&&t(e)},value:n,className:we()(P),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:w,precision:v,autoFocus:x,stringMode:E,formatter:C,parser:T,bordered:d,readOnly:u,disabled:p,onBlur:()=>{se((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(N.current),h(N.current)}))},onKeyUp:e=>{13===e.keyCode&&(m(n),r.isFilterType&&(r.SUBMIT_FORM(),I.current?.blur()))},onChange:e=>{const t=e??"";!E&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{N.current=e,a?.(e),i(e,R(e))})(t)}})}));ka.displayName="VInputNumber";class Aa extends i.Component{constructor(){super(...arguments),Oa(this,"context",void 0),Oa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(ka,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(a,u)),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Oa(Aa,"contextType",Nr);const La=Aa;function _a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fa=e=>{const{$$form:t}=o().useContext(Nr),{value:r=[],onChange:n,onValuesChange:a}=e,{options:i={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:p=1,min:h=0,max:m,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=i,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];n?.(t),a(t,w(t))},w=e=>_n(e)?"":e.map((e=>_n(e)?"":Number(e).toFixed(y))),C={[g]:!0,controls:b};return t.isOnlyShow?o().createElement(ia,{value:w(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.InputNumber,{value:r[0],className:we()("site-input-left",C),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:l[0],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([e,r[1]])},onBlur:()=>{E(r)}}),o().createElement(L.Input,{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}),o().createElement(L.InputNumber,{value:r[1],className:we()("site-input-right",C),style:{width:"calc(50% - 5px)"},placeholder:l[1],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([r[0],e])},onBlur:()=>{E(r)}}))};class Ha extends i.Component{constructor(){super(...arguments),_a(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Fa,{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(a,t)}}))),c&&o().createElement(L.Col,{flex:he(c.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...c}))))}}_a(Ha,"contextType",Nr);const Da=Ha;let $a=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Ma}=L.Input;class ja extends i.Component{constructor(e){var t;super(e),t=this,qa(this,"context",void 0),qa(this,"deriveParams",void 0),qa(this,"valueKey",void 0),qa(this,"_is_change",!1),qa(this,"_record",void 0),qa(this,"_prevValue",null),qa(this,"state",{visible:!1,loading:!1}),qa(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),qa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),qa(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),qa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),qa(this,"getDerivedSearchHelper",(()=>this.searchHelper)),qa(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||de(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&Dn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),qa(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),qa(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,te.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),qa(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=oe,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,o)=>{const l=(0,te.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(l))return o();this.setState({loading:!0});try{const e=await t.fetch.api(l);200===e.code?i(Array.isArray(e.data)?e.data:(0,te.get)(e.data,t.fetch.dataKey)??[]):o()}catch(e){o(e)}finally{se((()=>this.setState({loading:!1})))}}))})),qa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Fn(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Fn(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),qa(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>Fn(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(r)})),qa(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??oe)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),qa(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Fn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])});const n=Fn(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),qa(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)})),qa(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),qa(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),qa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),qa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),qa(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(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n}=this.props,{type:a,fieldName:i,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ia,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(Ma,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,onBlur:e=>{const{value:r}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(r),this._is_change&&!t&&(r?n?a?.fetch?.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e,r))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(r):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:r}=e.target;!t&&this.openSearchHelper(r)}},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"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):se((()=>this.clearSearchHelperValue())))}}),o().createElement(Cr,v,o().createElement(sd,x)))}}qa(ja,"contextType",Nr);class Ka extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),qa(this,"context",void 0),qa(this,"promiseRef",void 0),qa(this,"searchRef",void 0),qa(this,"state",{searchHelper:{}}),qa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),qa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ja,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(i,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}qa(Ka,"contextType",Nr);const Va=Ka;function za(){return za=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},za.apply(this,arguments)}function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ua=e=>{class t extends i.Component{constructor(){var e;super(...arguments),e=this,Ba(this,"startClick",void 0),Ba(this,"event1",null),Ba(this,"event2",null),Ba(this,"$el",null),Ba(this,"omitClassNames",[]),Ba(this,"state",{clickOutside:!1}),Ba(this,"mousedownHandler",(e=>{this.startClick=e})),Ba(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Ba(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),o=this.$el===r,l=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=l.some((e=>e?.contains(r)))||l.includes(n);let c;c=!(a||i||o||s),this.setState({clickOutside:c})})),Ba(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Ba(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=Qt()(document,"mousedown",this.mousedownHandler),this.event2=Qt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:r}=this.state;return o().createElement(e,za({ref:t},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ba(t,"displayName",`OutsideClick(${e.displayName||e.name})`),o().forwardRef(((e,r)=>o().createElement(t,za({},e,{forwardedRef:r}))))},Wa=require("rc-trigger");var Ga,Ya,Xa=n.n(Wa);function Qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Za=Ua((Ya=class extends i.Component{constructor(e){var t;super(e),t=this,Qa(this,"context",void 0),Qa(this,"searchRef",o().createRef()),Qa(this,"_records",[]),Qa(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Qa(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),Qa(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Qa(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Qa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Qa(this,"setItemList",(e=>{this.setState({itemList:e})})),Qa(this,"setRecords",(e=>{this._records=e})),Qa(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Qa(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Qa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Qa(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,te.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const a=t.recordsToDict();t.setItemList(a),t.triggerChange(a.map((e=>e.value)));const{closed:i}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>i?.(t._records)),200)}))})),Qa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,te.isEqual)((0,te.intersection)(r,n),n)||(0,te.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:o,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof l?l():l||{},{value:c}=this.props;if(r&&!de(c)){this.setState({loading:!0});try{const l=await r(a({...n,keys:c}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,te.get)(l.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),o?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,te.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ce("form-multiple-search-helper"),{size:T}=e.context,I={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const N=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ia,{value:N,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Xa(),{popupVisible:!g&&r,popup:S,popupClassName:we()(I),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:In,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:i,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:N,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(Cr,v,o().createElement(sd,x)))}},Qa(Ya,"contextType",Nr),Ga=Ya))||Ga;class Ja extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),Qa(this,"context",void 0),Qa(this,"promiseRef",void 0),Qa(this,"state",{searchHelper:{}}),Qa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Qa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Za,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}Qa(Ja,"contextType",Nr);const ei=Ja;function ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:ri}=L.Input;class ni extends i.Component{constructor(e){super(e),ti(this,"context",void 0),ti(this,"valueKey",void 0),ti(this,"_record",void 0),ti(this,"_prevValue",null),ti(this,"state",{visible:!1,loading:!1}),ti(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),ti(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ti(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),ti(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),ti(this,"getDerivedSearchHelper",(()=>this.searchHelper)),ti(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||de(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&Dn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),ti(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Fn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])})})),ti(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ti(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Fn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])});const n=Fn(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),ti(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),ti(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),ti(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;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(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n=""}=this.props,{type:a,fieldName:i,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,te.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?o().createElement(ia,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(ri,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,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"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),o().createElement(Cr,v,o().createElement(md,x)))}}ti(ni,"contextType",Nr);class ai extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),ti(this,"context",void 0),ti(this,"promiseRef",void 0),ti(this,"state",{searchHelper:{}}),ti(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),ti(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ni,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(i,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}ti(ai,"contextType",Nr);const ii=ai;var oi,li;function si(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ci=Ua((li=class extends i.Component{constructor(e){var t;super(e),t=this,si(this,"context",void 0),si(this,"searchRef",o().createRef()),si(this,"_records",[]),si(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),si(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),si(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),si(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),si(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),si(this,"setItemList",(e=>{this.setState({itemList:e})})),si(this,"setRecords",(e=>{this._records=e})),si(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),si(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),si(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),si(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,te.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const a=t.recordsToDict();t.setItemList(a),t.triggerChange(a.map((e=>e.value)));const{closed:i}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>i?.(t._records)),200)}))})),si(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,te.isEqual)((0,te.intersection)(r,n),n)||(0,te.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!de(s)){this.setState({loading:!0});try{const o=await r(a({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,te.get)(o.data,i)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,te.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ce("form-multiple-tree-table-helper"),{size:T}=e.context,I={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const N=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ia,{value:N,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Xa(),{popupVisible:!g&&r,popup:S,popupClassName:we()(I),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:In,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:i,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:N,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(Cr,v,o().createElement(md,x)))}},si(li,"contextType",Nr),oi=li))||oi;class di extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),si(this,"context",void 0),si(this,"promiseRef",void 0),si(this,"state",{searchHelper:{}}),si(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),si(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ci,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}si(di,"contextType",Nr);const ui=di;function pi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const hi=new Array(2).fill("");class mi extends i.Component{constructor(e){var t;super(e),t=this,pi(this,"context",void 0),pi(this,"_is_change",!1),pi(this,"_ceho_data",void 0),pi(this,"_records",[]),pi(this,"_is_clear",!1),pi(this,"state",{visible:!1,loading:!1,itemList:[],textValue:hi}),pi(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),pi(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),pi(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),pi(this,"setItemList",(e=>{this.setState({itemList:e})})),pi(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),pi(this,"setTextValue",(e=>{this.setState({textValue:e})})),pi(this,"setRecords",(e=>{this._records=e})),pi(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),pi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),pi(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(hi),this.triggerChange([])})),pi(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),pi(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),pi(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,r=de(e)?void 0:e;return{[t]:r}})),pi(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=oe,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,o)=>{const l=(0,te.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(l))return o();this.setState({loading:!0});const e=await t.fetch.api(l);if(se((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,te.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}o()}))})),pi(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),pi(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:r=[]}=this.props;(0,te.isEqual)((0,te.intersection)(t,r),r)||(0,te.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,te.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=hi.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:o}=this.searchHelper.echoRequest||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!de(s)){this.setState({loading:!0});try{const o=await r(a({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,te.get)(o.data,i)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:t=[]}=this.props,{visible:r,loading:n,textValue:a}=this.state,{fieldName:i,options:l={},searchHelper:s={},placeholder:c=f("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=a.every((e=>_n(e)))?"":a.join(" - "),g={visible:r,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},b={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,te.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ia,{value:m,bordered:d}):o().createElement(o().Fragment,null,o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:a[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),o().createElement(L.Input,{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}),o().createElement(L.Input.Search,{value:a[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:n,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.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([a[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),o().createElement(Cr,g,o().createElement(Ed,b)))}}pi(mi,"contextType",Nr);class fi extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),pi(this,"context",void 0),pi(this,"promiseRef",void 0),pi(this,"state",{searchHelper:{}}),pi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),pi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(mi,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{m(t,n),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(i,u)),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...d}))))}}pi(fi,"contextType",Nr);const gi=fi;function bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=l,h=de(p)?n:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?o().createElement(ia,{value:m(r),bordered:c}):o().createElement(L.Checkbox.Group,{value:r,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{a?.(e),i(e,m(e))})(e)}},h.map((e=>o().createElement(L.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class vi extends i.Component{constructor(){super(...arguments),bi(this,"context",void 0),bi(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(yi,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}bi(vi,"contextType",Nr);const xi=vi;function Ei(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Si=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},style:l={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=i;return o().createElement(L.Rate,{value:r,count:p,style:l,allowHalf:u,allowClear:s,tooltips:h,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;n?.(e),a(e,(t=e,h?h[Math.ceil(t)-1]:t.toString()))})(e)}})};class wi extends i.Component{constructor(){super(...arguments),Ei(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Si,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ei(wi,"contextType",Nr);const Ci=wi;function Ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ii=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:p=[]}=l,h=de(p)?n:p,m=e=>h.find((t=>t.value===e))?.text??"";return t.isOnlyShow?o().createElement(ia,{value:m(r),bordered:c}):o().createElement(L.Radio.Group,{value:r,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e,m(e))})(t)}},h.map((e=>o().createElement(L.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ni extends i.Component{constructor(){super(...arguments),Ti(this,"context",void 0),Ti(this,"state",{itemList:[]}),Ti(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Ii,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ti(Ni,"contextType",Nr);const Ri=Ni;function Pi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=wn,trueValue:h=Sn}=l;return o().createElement(o().Fragment,null,o().createElement(L.Switch,{checked:r===h,style:s,disabled:d||t.isOnlyShow,checkedChildren:o().createElement(Te.CheckOutlined,null),unCheckedChildren:o().createElement(Te.CloseOutlined,null),onChange:e=>{(e=>{n?.(e),a(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?o().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},i):null)};class ki extends i.Component{constructor(){super(...arguments),Pi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option,{labelToSwitch:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Oi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Pi(ki,"contextType",Nr);const Ai=ki;function Li(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _i=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},style:l={},placeholder:s=f("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p,onBlur:h=ie,onEnter:m=ie}=e.option,{showCount:g,maxLength:b,autoSize:y}=i,v=Object.assign({},{minRows:1,maxRows:3},y);return o().createElement(L.Input.TextArea,{value:r,placeholder:s,style:l,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||t.isOnlyShow,disabled:p,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;m(t)}},onChange:e=>{const{value:t}=e.target;(e=>{n?.(e),a(e)})(t)}})};class Fi extends i.Component{constructor(){super(...arguments),Li(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(_i,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Li(Fi,"contextType",Nr);const Hi=Fi;function Di(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const $i=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.datePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=l,S=o().createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),n?.(e),a(e,C(e))},C=e=>_n(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,T=e=>{let t=Ln(u()().subtract(e,"day"),Rn[g]);"date"===g&&(t=t.slice(0,10)),w(t),S.current.blur(),S.current.focus()};return t.isOnlyShow?o().createElement(ia,{value:C(r),bordered:d}):o().createElement(j,{ref:S,style:{width:"100%",...s},popupClassName:`form-popper__${i}`,picker:Nn[g],format:b,bordered:d,showToday:!1,showTime:"datetime"===g&&{defaultValue:u()("00:00:00","HH:mm:ss")},allowClear:p,disabled:m,inputReadOnly:h,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():o().createElement(o().Fragment,null,o().createElement(L.Tag,{color:"processing",onClick:()=>T(0)},f("qm.form.datePickers")[0]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(1)},f("qm.form.datePickers")[1]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(7)},f("qm.form.datePickers")[2]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(30)},f("qm.form.datePickers")[3])):void 0,value:An(r,Rn[g]),onChange:(e,t)=>{w(Ln(e,Rn[g]))}})};class qi extends i.Component{constructor(){super(...arguments),Di(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement($i,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Di(qi,"contextType",Nr);const Mi=qi;function ji(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ki=e=>[u()().subtract(e,"day"),u()()],Vi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m=t.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:S,shortCuts:w=!0}=l,C={[f("qm.form.dateRangePickers")[0]]:Ki(7),[f("qm.form.dateRangePickers")[1]]:Ki(30),[f("qm.form.dateRangePickers")[2]]:Ki(90),[f("qm.form.dateRangePickers")[3]]:Ki(180)},T=e=>_n(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?o().createElement(ia,{value:T(r),bordered:d}):o().createElement(j.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${i}`,picker:Nn[g],format:b,bordered:d,showTime:"datetime"===g&&{defaultValue:[u()("00:00:00","HH:mm:ss"),u()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:m?[!0,!0]:y,inputReadOnly:h,disabledDate:x??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[E,S])),ranges:w&&g.includes("date")?C:void 0,value:de(r)?null:[An(r?.[0],Rn[g]),An(r?.[1],Rn[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),n?.(e),a(e,T(e))})([Ln(e?.[0],Rn[g]),Ln(e?.[1],Rn[g])])}})};class zi extends i.Component{constructor(){super(...arguments),ji(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Vi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}ji(zi,"contextType",Nr);const Bi=zi;function Ui(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.timePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=l;return t.isOnlyShow?o().createElement(ia,{value:r,bordered:d}):o().createElement(B,{style:{width:"100%",...s},popupClassName:`form-popper__${i}`,bordered:d,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:u,disabled:h,inputReadOnly:p,format:Pn[m],value:An(r,Pn[m]),onChange:(e,t)=>{(e=>{const t=Ln(e,Pn[m]);n?.(t),a(t)})(e)}})};class Gi extends i.Component{constructor(){super(...arguments),Ui(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Wi,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ui(Gi,"contextType",Nr);const Yi=Gi;function Xi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Qi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.timerangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:m="hour-minute-second",disableds:g=[!1,!1],allowEmpty:b,hourStep:y=1,minuteStep:v=1,secondStep:x=1}=l,E=e=>_n(e)?"":e.join(" - ");return t.isOnlyShow?o().createElement(ia,{value:E(r),bordered:d}):o().createElement(B.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${i}`,bordered:d,showNow:!1,hourStep:y,minuteStep:v,secondStep:x,allowClear:u,allowEmpty:b,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Pn[m],value:de(r)?null:[An(r?.[0],Pn[m]),An(r?.[1],Pn[m])],onChange:(e,t)=>{(e=>{const t=[Ln(e?.[0],Pn[m]),Ln(e?.[1],Pn[m])];n?.(t),a(t,E(t))})(e)}})};class Zi extends i.Component{constructor(){super(...arguments),Xi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Qi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Xi(Zi,"contextType",Nr);const Ji=Zi;function eo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class to extends i.Component{constructor(e){super(e),eo(this,"context",void 0),eo(this,"searchRef",o().createRef()),eo(this,"valueKey",void 0),eo(this,"_clicking",!1),eo(this,"_record",void 0),eo(this,"_prevValue",null),eo(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),eo(this,"getSearchHelper",Ir()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),eo(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(n||v("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||v("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&v("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&v("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),eo(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),eo(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||de(d))return this._prevValue=void 0;try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&Dn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}})),eo(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Fn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])})})),eo(this,"fetchHandle",(0,te.debounce)(this.getItemList,200)),eo(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),eo(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),eo(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),eo(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Fn(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Fn(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Fn(e,this.alias[n]);this.triggerChange(a),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){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,te.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=await r(a({...n,[t]:e}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:r,itemList:n,inputText:a}=this.state,{value:i}=this.props,{fieldName:l,options:s={},style:d={},placeholder:u=f("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{listHeight:b=Cn}=s,{hideHeader:y,onlySelect:v=!0}=this.searchHelper||s,x=this.searchHelper.columns||[],E=Ce("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=o().createElement(L.Spin,{spinning:r},n.length?o().createElement("table",{cellSpacing:0,cellPadding:0,className:we()("table")},!y&&o().createElement("thead",null,o().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>o().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),o().createElement("tbody",null,n.map(((e,t)=>o().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((t=>o().createElement("td",{key:t.dataIndex},(0,te.get)(e,t.dataIndex))))))))):o().createElement(ft,null));return o().createElement(c.Consumer,null,(r=>{const s={[E]:!0,[`${E}--lg`]:"large"===r?.size,[`${E}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ia,{value:i,bordered:p}):o().createElement(Xa(),{action:g?[]:["click"],popupVisible:!g&&t,popup:w,popupClassName:we()(s,`form-popper__${l}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:In,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("div",null,o().createElement(L.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:p,readOnly:m,disabled:g,style:{width:"100%",...d},value:a??i,title:i,onFocus:()=>{!n.length&&this.fetchHandle(i)},onBlur:e=>{v&&!this._clicking&&a!==i&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(n[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 r=40===e.keyCode?++t%n.length:(--t+n.length)%n.length;this.setState({activeIndex:r})}},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)}})))}))}}eo(to,"contextType",Nr);class ro extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),eo(this,"context",void 0),eo(this,"promiseRef",void 0),eo(this,"state",{searchHelper:{}}),eo(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),eo(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(to,{option:this.props.option,helperConfig:t,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(i,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}eo(ro,"contextType",Nr);const no=ro;function ao(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class io extends i.Component{constructor(){super(...arguments),ao(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,fieldName:n,className:a,style:i={},collapse:l={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=ie}=l,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===n))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return o().createElement(L.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},o().createElement(Re,{id:n,label:r,className:a,extra:p.map((e=>e.text)).join(" | "),style:{...i},collapse:s[n],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[n]:t})}))),u(t)}}))}}ao(io,"contextType",Nr);const oo=io;function lo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function so(){return so=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},so.apply(this,arguments)}const co=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:co(e.children,t,r,n)}:e)),uo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,multiple:a,loading:i,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:v,filterable:x=!0,listHeight:E=Cn,checkStrictly:S,checkStrategy:w="SHOW_CHILD",collapseTags:C,defaultExpandAll:T=!g,defaultExpandedKeys:I,dropdownStyle:N,openPyt:R=!0}=d,[P,O]=o().useState(de(v)?n:v),k=o().useRef(P);Me((()=>{const e=de(v)?n:v;g?(0,te.isEqual)(e,k.current)||(O(e),k.current=e):O(e)}),[v,n]);const A=e=>qn(P,e)?.text||e?.toString()||"",_=e=>a?e?.map((e=>A(e))).join(",")||"":A(e);return t.isOnlyShow?o().createElement(ia,{value:_(r),bordered:h}):o().createElement(L.TreeSelect,so({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:a,treeCheckable:a,treeCheckStrictly:S,showCheckedStrategy:L.TreeSelect[w],popupClassName:`form-popper__${c}`,dropdownStyle:N,placeholder:p,listHeight:E,style:u,loading:i,bordered:h,allowClear:m,disabled:y,treeDefaultExpandAll:T,treeDefaultExpandedKeys:I,showSearch:x,maxTagCount:C?"responsive":void 0,loadData:g?async e=>{let{key:t,children:r}=e;if(!g||r)return;const{fetchApi:n,params:a,dataKey:i,textKey:o="text",valueKey:l="value",callback:s,formatter:c=(e=>e)}=g;if(n)try{const e=await n(c({...a,[l]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,te.get)(e.data,i)??[],n=co(P,t,l,$n(r,l,o));O(n),s?.(r)}}catch(e){}}:void 0,treeData:P},a?{title:_(r)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,_(e),P)})(e)}}))};class po extends i.Component{constructor(){super(...arguments),lo(this,"context",void 0),lo(this,"state",{itemList:[],loading:!1}),lo(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=$n(t,a,i);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(a),className:we()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":he(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},o().createElement(uo,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:he(p.labelWidth||En)},e.renderFormItemExtra({fieldName:l,...p}))))}}lo(po,"contextType",Nr);const ho=po;function mo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fo(){return fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fo.apply(this,arguments)}const go=e=>{const{$$form:t}=o().useContext(Nr),{value:r,multiple:n,items:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,asyncLoad:p,readOnly:h,disabled:m}=e.option,{itemList:g,changeOnSelect:b,checkStrictly:y,checkStrategy:v="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:S=!0}=l,[w,C]=o().useState(de(g)?a:g),T=o().useRef(w);Me((()=>{const e=de(g)?a:g;p?(0,te.isEqual)(e,T.current)||(C(e),T.current=e):C(e)}),[g,a]);const I=e=>Mn(w,e??"").map((e=>e.text)).join("/"),N=e=>n?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?o().createElement(ia,{value:N(r),bordered:d}):o().createElement(L.Cascader,fo({value:(e=>de(e)?[]:n?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:w,multiple:n,maxTagCount:"responsive",changeOnSelect:b||y,showCheckedStrategy:L.Cascader[v],popupClassName:`form-popper__${i}`,dropdownStyle:E,placeholder:c,style:s,bordered:d,allowClear:u,disabled:m,showSearch:x&&!p&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:r,params:n,dataKey:a,textKey:i="text",valueKey:o="value",callback:l,formatter:s=(e=>e)}=p;if(r)try{const e=await r(s({...n,[o]:t.value}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,te.get)(e.data,a)??[],n=co(w,t.value,o,$n(r,o,i));C(n),l?.(r)}}catch(e){}}:void 0},n?{title:N(r)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,N(t),w)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return n?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class bo extends i.Component{constructor(){super(...arguments),mo(this,"context",void 0),mo(this,"state",{itemList:[],loading:!1}),mo(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=$n(t,a,i);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(a),className:we()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":he(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},o().createElement(go,{option:this.props.option,multiple:t,items:r,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:he(p.labelWidth||En)},e.renderFormItemExtra({fieldName:l,...p}))))}}mo(bo,"contextType",Nr);const yo=bo,vo=require("china-area-data");var xo=n.n(vo);function Eo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const So=["110000","120000","310000","500000"],wo=["810000","820000"],Co=[{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"}],To=[{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"}],Io=e=>na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),No=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...So,...wo].includes(e))):Object.keys(e[t])).map((n=>({l:Io(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:No(e,n,r+1)})))},Ro=(e,t)=>t.map((t=>({l:Io(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Po extends i.Component{constructor(e){super(e),Eo(this,"context",void 0),Eo(this,"searchRef",o().createRef()),Eo(this,"scrollRef",o().createRef()),Eo(this,"zxsAndGa",void 0),Eo(this,"provinces",void 0),Eo(this,"allCities",void 0),Eo(this,"letterCities",void 0),Eo(this,"state",{visible:!1,select_type:"0",active_key:""}),Eo(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Eo(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(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(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Jt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Ro(xo(),So)},{l:"Z2",n:"港澳",c:"",p:"",children:Ro(xo(),wo)}]}createProvince(){return(No(xo(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return To.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...So,...wo].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return o().createElement(L.Radio.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}))}},o().createElement(L.Radio.Button,{value:"0"},f("qm.form.citySelectType.0")),o().createElement(L.Radio.Button,{value:"1"},f("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?Co:To).map((t=>o().createElement("li",{key:t.value,className:we()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return o().createElement(L.Select,{size:"small",placeholder:f("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>o().createElement(L.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,r)=>o().createElement("div",{key:r},o().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),o().createElement("dd",null,t.children?.map((t=>o().createElement("li",{key:t.c,className:we()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ce("form-city-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(r),b=o().createElement("div",{className:"container",style:{...i}},o().createElement("div",{className:"city-drop"},o().createElement("div",{className:"city-drop-toper"},o().createElement("div",{className:"city-drop-toper__type"},this.renderType()),o().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),o().createElement("div",{className:"city-drop-letter"},this.renderLetter()),o().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},o().createElement("dl",null,this.renderCity(r)))));return o().createElement(c.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ia,{value:g,bordered:s}):o().createElement(Xa(),{action:p?[]:["click"],popupVisible:!p&&t,popup:b,popupClassName:we()(a,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:In,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("div",null,o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,readOnly:u,disabled:p,style:{width:"100%",...i},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Eo(Po,"contextType",Nr);class Oo extends i.Component{constructor(){super(...arguments),Eo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Po,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Eo(Oo,"contextType",Nr);const ko=Oo;function Ao(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Lo=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:Lo(e,r)})))};class _o extends i.Component{constructor(e){super(e),Ao(this,"context",void 0),Ao(this,"searchRef",o().createRef()),Ao(this,"prevText",void 0),Ao(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ao(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Lo(xo(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.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 r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=qn(e,t[n]);if(a&&de(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:o="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,te.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,t=this.state.tabs.map(((t,r)=>{const n=t.find((t=>t.value===e[r]))?.text||`${f("qm.form.selectPlaceholder").replace("...","")}(${f("qm.form.regionSelectLabel")[r]})`;return o().createElement(pr.TabPane,{key:r.toString(),tab:n},o().createElement("div",{className:"region-box"},t.map((t=>o().createElement("span",{key:t.value,className:we()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[r]=t.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)}))}},t.text)))))}));return t.length?o().createElement(pr,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):o().createElement(ft,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ce("form-region-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=o().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!t){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return o().createElement(c.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ia,{value:b,bordered:s}):o().createElement(Xa(),{action:p?[]:["click"],popupVisible:!p&&t,popup:g,popupClassName:we()(a,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:In,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("div",null,o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,style:{width:"100%",...i},readOnly:u,disabled:p,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&se((()=>this.initial()))}})))}))}}Ao(_o,"contextType",Nr);class Fo extends i.Component{constructor(){super(...arguments),Ao(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(_o,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ao(Fo,"contextType",Nr);const Ho=Fo;function Do(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const $o=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fileTypes:h,fileSize:m,draggable:g,editable:b,fileDirection:y,onPreview:v,onRemove:x,onSortChange:E,onEditChange:S}=i,{action:w,headers:C,params:T,withCredentials:I=!1,dataKey:N="",downloadWithHeaders:R,fieldAliasMap:P,beforeUpload:O,button:k}=l,A="function"==typeof P?P():P||{};return o().createElement(wl,{name:"file",action:w,multiple:u,headers:C,data:T,withCredentials:I,downloadWithHeaders:R,beforeUpload:O,maxCount:p,fileTypes:h,fileSize:m,draggable:g,editable:b,fileDirection:y,disabled:c,readOnly:t.isOnlyShow||d,button:k,showUploadList:{showDownloadIcon:!0,downloadIcon:o().createElement(Te.DownloadOutlined,null)},fileList:r,onChange:e=>{let{fileList:t}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in A)r[n]=e[n]||t.data?.[A[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(N?(0,te.get)(t.data,N):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(t)},onPreview:v,onRemove:x,onSortChange:E,onEditChange:S})};class qo extends i.Component{constructor(){super(...arguments),Do(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement($o,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Do(qo,"contextType",Nr);const Mo=qo;function jo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ko=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,draggable:v,onRemove:x,onSortChange:E}=i,{action:S,headers:w,params:C,withCredentials:T=!1,dataKey:I="",popupClassName:N,fieldAliasMap:R,beforeUpload:P}=l,O="function"==typeof R?R():R||{};return o().createElement(Ol,{name:"file",action:S,multiple:u,headers:w,data:C,withCredentials:T,popupClassName:N,beforeUpload:P,maxCount:p,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,draggable:v,disabled:c,readOnly:t.isOnlyShow||d,fileList:r,onChange:e=>{let{fileList:t}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in O)r[n]=e[n]||t.data?.[O[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(I?(0,te.get)(t.data,I):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(t)},onRemove:x,onSortChange:E})};class Vo extends i.Component{constructor(){super(...arguments),jo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ko,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}jo(Vo,"contextType",Nr);const zo=Vo;function Bo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Uo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:l,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=i;return o().createElement(bl,{value:r,tinymce:u,upload:l,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{n?.(e),a(e)})(e)}})};class Wo extends i.Component{constructor(){super(...arguments),Bo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Uo,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Bo(Wo,"contextType",Nr);const Go=Wo;function Yo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Xo extends i.Component{constructor(e){super(e),Yo(this,"context",void 0),Yo(this,"provide",{$$form:this,echo_data:{}}),Yo(this,"_initialValues",void 0),Yo(this,"_initialOthers",void 0),Yo(this,"_initialExtras",void 0),Yo(this,"_fieldAuth",{}),Yo(this,"wrapperRef",o().createRef()),Yo(this,"formRef",o().createRef()),Yo(this,"originItems",[]),Yo(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Yo(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),Yo(this,"resizeListenerHandle",(0,te.debounce)(this.resizeObserveHandler,10)),Yo(this,"getFormItems",Ir()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Yo(this,"getFlattenItems",Ir()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,te.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),Yo(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Yo(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Yo(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Yo(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),Yo(this,"openValidateInfo",(e=>{const t=o().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return o().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));L.notification.error({message:f("qm.form.validatePrompt"),description:t,duration:10})})),Yo(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Jt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}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(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.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(){Tt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){It(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&&v("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)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,te.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,te.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,Tn.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??wn),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.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=pe(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((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&(this.setState({collapse:e}),this.props.onCollapse?.(e),se((()=>this.props.onCollapse?.(e))))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if(jn(e))return Kn(e);if((0,te.isPlainObject)(e)){const{fieldName:t,label:r,options:n={}}=e;if(jn(r))return Kn(r);const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],a=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=a?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(_n(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{_n(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)de(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=ue(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,te.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:a=1,disabled:i,secretName:o}=n;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),o&&(e.options?e.options.secretType=o:e.options={secretType:o},t.options=Object.assign({},t.options,{secretType:o})),this.setFieldAuth(r,{visible:a,disabled:i,secretName:o})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return o().createElement(wa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return o().createElement(Na,{option:e})}INPUT_NUMBER(e){return o().createElement(La,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return o().createElement(Da,{option:e})}SEARCH_HELPER(e){return o().createElement(Va,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return o().createElement(ei,{option:e})}TREE_TABLE_HELPER(e){return o().createElement(ii,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return o().createElement(ui,{option:e})}RANGE_SEARCH_HELPER(e){return o().createElement(gi,{option:e})}CHECKBOX(e){return o().createElement(fa,{option:e})}MULTIPLE_CHECKBOX(e){return o().createElement(xi,{option:e})}RATE(e){return o().createElement(Ci,{option:e})}RADIO(e){return o().createElement(Ri,{option:e})}SWITCH(e){return o().createElement(Ai,{option:e})}TEXT_AREA(e){return o().createElement(Hi,{option:e})}DATE(e){return o().createElement(Mi,{option:e})}RANGE_DATE(e){return o().createElement(Bi,{option:e})}TIME(e){return o().createElement(Yi,{option:e})}RANGE_TIME(e){return o().createElement(Ji,{option:e})}SELECT(e){return o().createElement(ua,{option:e})}MULTIPLE_SELECT(e){return o().createElement(ua,{option:e,multiple:!0})}IMMEDIATE(e){return o().createElement(no,{option:e})}DIVIDER(e){return o().createElement(oo,{option:e})}TREE_SELECT(e){return o().createElement(ho,{option:e})}MULTIPLE_TREE_SELECT(e){return o().createElement(ho,{option:e,multiple:!0})}CASCADER(e){return o().createElement(yo,{option:e})}MULTIPLE_CASCADER(e){return o().createElement(yo,{option:e,multiple:!0})}CITY_SELECT(e){return o().createElement(ko,{option:e})}REGION_SELECT(e){return o().createElement(Ho,{option:e})}UPLOAD_FILE(e){return o().createElement(Mo,{option:e})}UPLOAD_IMG(e){return o().createElement(zo,{option:e})}TINYMCE(e){return o().createElement(Go,{option:e})}renderFormLabel(e){if(jn(e)||!(0,te.isPlainObject)(e))return e;const{type:t,fieldName:r,label:n,options:a={},onChange:i=ie}=e,{itemList:l=[]}=a;return"SELECT"===t?o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(ca,{option:e,items:l,loading:!1,onValuesChange:(e,t)=>i(e,t)})):"CHECKBOX"===t?o().createElement(o().Fragment,null,o().createElement("span",{style:{paddingRight:5}},n),o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(ha,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:r,style:n={},render:a}=e,{extra:i}=this.state;if(r)return o().createElement(L.Tooltip,{className:"extra-tooltip",title:i[t]},o().createElement(Te.ExclamationCircleOutlined,{style:{marginLeft:4}}));const l=this.formItems.find((e=>e.fieldName===t));return o().createElement("div",{className:"extra-text",title:a?"":i[t],style:n},o().createElement("span",{className:"extra-overflow-cut"},a?a(l,this):i[t]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:t,fieldName:r,invisible:n,tooltip:a,className:i,labelWidth:l=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return de(this.state.formData)?null:o().createElement(L.Form.Item,{label:this.renderFormLabel(t),name:r,rules:c,tooltip:a,hidden:n,className:we()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":he(l)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},u?.(e,this))}createFormItem(e){return(0,te.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(v("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:r,isFieldsDefine:n}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<r;e++)a.push({})}));const i=24/e,l=[],s=a.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return l.push(n),n}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=a.map(((t,r)=>{let{selfCol:n=1}=t;const{type:a,fieldName:s}=t;n=n>=24||"DIVIDER"===a||"TINYMCE"===a?e:n;const u=!(!this.state.collapse&&this.showFilterCollapse)||l[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(l[r]),o().createElement(L.Col,{key:s??r,className:s,span:n*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},a?this.createFormItem(pe(t)):null)}));return n&&"default"===t&&u.push(o().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:t,collapse:r}=this.state,{searchButtonCols:n,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const l=24/t,s=n||1,c=t-e%t-s;return a?o().createElement(L.Col,{key:"-",span:s*l,offset:c*l,style:{textAlign:"right"}},o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(be,{type:"primary",size:this.$size,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},f("qm.form.search")),o().createElement(be,{size:this.$size,icon:o().createElement(Te.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},f("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&o().createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?o().createElement(Te.UpOutlined,null):o().createElement(Te.DownOutlined,null)," ",f(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const n=24/e;return r&&"default"===t?o().createElement(L.Row,{gutter:0},o().createElement(L.Col,{key:"-",span:n},o().createElement(L.Form.Item,null,o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(be,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},f("qm.form.save")),o().createElement(be,{size:this.$size,onClick:()=>this.RESET_FORM()},f("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:r}=this.props;return o().createElement(va,{uniqueKey:e,items:t,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((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[f("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}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))}async GET_FORM_DATA(){try{const e=await 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]}}async VALIDATE_FIELDS(e){try{return[null,await 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)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){v("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return v("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,te.isPlainObject)(t))return v("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return v("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,te.set)(i,r,t[r]));r&&(a?a([...n]):v("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:r,disabled:n,labelWidth:a,labelAlign:i,labelWrap:l,customClass:s}=this.props,c=Ce("form"),d={required:"${label}"+f("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 o().createElement("div",{ref:this.wrapperRef,className:we()(u,e),style:t},o().createElement(L.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:i,labelWrap:l,colon:!1,disabled:n,labelCol:{flex:this.verticalLayout?"initial":he(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},o().createElement(Nr.Provider,{value:this.provide},o().createElement(L.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Yo(Xo,"contextType",c),Yo(Xo,"propTypes",On),Yo(Xo,"defaultProps",kn);const Qo=Xo,Zo={onActivate:l.func,onAddUndo:l.func,onBeforeAddUndo:l.func,onBeforeExecCommand:l.func,onBeforeGetContent:l.func,onBeforeRenderUI:l.func,onBeforeSetContent:l.func,onBeforePaste:l.func,onBlur:l.func,onChange:l.func,onClearUndos:l.func,onClick:l.func,onContextMenu:l.func,onCommentChange:l.func,onCopy:l.func,onCut:l.func,onDblclick:l.func,onDeactivate:l.func,onDirty:l.func,onDrag:l.func,onDragDrop:l.func,onDragEnd:l.func,onDragGesture:l.func,onDragOver:l.func,onDrop:l.func,onExecCommand:l.func,onFocus:l.func,onFocusIn:l.func,onFocusOut:l.func,onGetContent:l.func,onHide:l.func,onInit:l.func,onKeyDown:l.func,onKeyPress:l.func,onKeyUp:l.func,onLoadContent:l.func,onMouseDown:l.func,onMouseEnter:l.func,onMouseLeave:l.func,onMouseMove:l.func,onMouseOut:l.func,onMouseOver:l.func,onMouseUp:l.func,onNodeChange:l.func,onObjectResizeStart:l.func,onObjectResized:l.func,onObjectSelected:l.func,onPaste:l.func,onPostProcess:l.func,onPostRender:l.func,onPreProcess:l.func,onProgressState:l.func,onRedo:l.func,onRemove:l.func,onReset:l.func,onSaveContent:l.func,onSelectionChange:l.func,onSetAttrib:l.func,onSetContent:l.func,onShow:l.func,onSubmit:l.func,onUndo:l.func,onVisualAid:l.func,onSkinLoadError:l.func,onThemeLoadError:l.func,onModelLoadError:l.func,onPluginLoadError:l.func,onIconsLoadError:l.func,onLanguageLoadError:l.func},Jo={apiKey:l.string,id:l.string,inline:l.bool,init:l.object,initialValue:l.string,onEditorChange:l.func,value:l.string,tagName:l.string,cloudChannel:l.string,plugins:l.oneOfType([l.string,l.array]),toolbar:l.oneOfType([l.string,l.array]),disabled:l.bool,textareaName:l.string,tinymceScriptSrc:l.string,rollback:l.oneOfType([l.number,l.oneOf([!1])]),scriptLoading:l.shape({async:l.bool,defer:l.bool,delay:l.number}),...Zo},el=e=>"function"==typeof e,tl=e=>e in Zo,rl=e=>e.substr(2),nl=(e,t,r,n,a)=>((t,r,n,a,i,o,l)=>{const s=Object.keys(i).filter(tl),c=Object.keys(o).filter(tl),d=s.filter((e=>void 0===o[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=rl(e),r=l[t];n(t,r),delete l[t]})),u.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=rl(n);l[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let al=0;const il=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return al++,e+"_"+r+al+String(t)},ol=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),ll=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),sl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},cl=()=>({listeners:[],scriptId:il("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),dl=(()=>{let e=cl();return{load:(t,r,n,a,i,o)=>{const l=()=>((t,r,n,a,i,o)=>{const l=r.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=t,l.src=n,l.async=a,l.defer=i;const s=()=>{l.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};l.addEventListener("load",s),r.head&&r.head.appendChild(l)})(e.scriptId,t,r,n,a);e.scriptLoaded?o():(e.listeners.push(o),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(l,i):l()))},reinitialize:()=>{e=cl()}}})(),ul=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function pl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class hl extends i.Component{constructor(e){var t;super(e),t=this,pl(this,"editor",void 0),pl(this,"id",void 0),pl(this,"elementRef",void 0),pl(this,"inline",void 0),pl(this,"currentContent",void 0),pl(this,"boundHandlers",void 0),pl(this,"rollbackTimer",void 0),pl(this,"valueCursor",void 0),pl(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})),pl(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){}})),pl(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),pl(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))}})),pl(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),pl(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=t.elementRef.current;if(!r)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(r)){if(0===e)setTimeout((()=>t.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>t.initialise(e+1)),100)}return}const n=ul(t.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const a={...t.props.init,selector:void 0,target:r,readonly:t.props.disabled,inline:t.inline,plugins:(i=t.props.init?.plugins,o=t.props.plugins,ll(i).concat(ll(o))),toolbar:t.props.toolbar??t.props.init?.toolbar,setup:e=>{t.editor=e,t.bindHandlers({}),t.inline&&!ol(r)&&e.once("PostRender",(r=>{e.setContent(t.getInitialValue(),{no_events:!0})})),t.props.init&&el(t.props.init.setup)&&t.props.init.setup(e)},init_instance_callback:e=>{const r=t.getInitialValue();t.currentContent=t.currentContent??e.getContent(),t.currentContent!==r&&(t.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=t.props.disabled??!1;sl(t.editor,n?"readonly":"design"),t.props.init&&el(t.props.init.init_instance_callback)&&t.props.init.init_instance_callback(e)}};var i,o;t.inline||(r.style.visibility=""),ol(r)&&(r.value=t.getInitialValue()),n.init(a)})),this.id=this.props.id||il("tiny-react"),this.elementRef=i.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??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 r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;sl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==ul(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&dl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??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(){const e=ul(this.view)?.Env?.browser?.isIE();return e?"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:e="div"}=this.props;return i.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return i.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){nl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(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)):r&&!n&&(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))}}}function ml(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}pl(hl,"propTypes",Jo),pl(hl,"defaultProps",{cloudChannel:"6"});var fl=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(fl||{});class gl extends i.Component{constructor(){super(...arguments),ml(this,"context",void 0),ml(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(){const{size:e,className:t,style:r,tinymce:n={},upload:a={},thresholdSize:i=.5,tinymceScriptSrc:l,disabled:s,value:c,onResizeEditor:d,onChange:u}=this.props,p=this.context.global,h=this.context.locale,m=e||this.context.size||"",g=Ce("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===m,[`${g}--sm`]:"small"===m},y={init:{height:n.height||this.defaultOption.height,plugins:n.plugins||this.defaultOption.plugins,toolbar:n.toolbar||this.defaultOption.toolbar,menubar:n.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:fl[h],skin:"tinymce-5",...ue(n,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:o,dataKey:l}=a,s=`data:image/jpeg;base64,${e.base64()}`,c=new FormData;c.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>i)try{const e=await fetch(n,{method:"POST",body:c,headers:o});if(!e.ok)throw new Error(f("qm.upload.uploadError"));const r=await e.json();200===r.code&&t(l?(0,te.get)(r.data,l):r.data)}catch(e){L.message.error(f("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;d?.({width:r,height:n},t)}))}},value:c,disabled:s,tinymceScriptSrc:l||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{u?.(t.getContent(),t)}};return o().createElement("div",{className:we()(b,t),style:r},o().createElement(hl,y))}}ml(gl,"contextType",c),ml(gl,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const bl=gl,yl=require("cropperjs");var vl=n.n(yl);function xl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class El extends i.Component{constructor(){super(...arguments),xl(this,"imgRef",o().createRef()),xl(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:a,...i}=this.props,o={};for(const e in i)void 0!==this.props[e]&&(o[e]=this.props[e]);this.cropper=new(vl())(this.imgRef.current,o)}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:t,src:r,alt:n,imgStyle:a}=this.props,i=Ce("cropper"),l={[i]:!0};return o().createElement("div",{className:we()(l,e),style:t},o().createElement("img",{ref:this.imgRef,src:r,alt:n,style:{maxWidth:"100%",...a}}))}}xl(El,"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});const Sl=El,wl=Bt;function Cl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Tl extends i.Component{constructor(){super(...arguments),Cl(this,"context",void 0),Cl(this,"cropperRef",o().createRef()),Cl(this,"beforeUploadRef",void 0),Cl(this,"fileRef",void 0),Cl(this,"resolveRef",void 0),Cl(this,"rejectRef",void 0),Cl(this,"state",{src:""}),Cl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],r,{type:t});Object.assign(a,{uid:n});const{fileTypes:i=[],fileSize:o}=this.props;if(i.length&&!i.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return L.message.warning(f("qm.upload.tooltip",{type:i.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const l=this.beforeUploadRef(a,[a]);if("boolean"==typeof l||l){if(!0===l)return this.resolveRef(a);if(!1===l)return this.rejectRef("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else v("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await le(100),this.onClose()})),Cl(this,"onOk",(()=>{this.confirmHandle()})),Cl(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:t}=this.props,r=Array.isArray(e)?e[0]:e;if(!r)return null;const{beforeUpload:n,...a}=r.props;return this.beforeUploadRef=n,o().createElement(r.type,{...a,beforeUpload:(e,r)=>new Promise((async(n,a)=>{const i=()=>n(L.Upload.LIST_IGNORE);if(t&&!await t(e,r))return void i();this.fileRef=e,this.resolveRef=n,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 o().createElement("div",{className:"cropper-preview"},o().createElement("div",{className:"cropper-area"},o().createElement("div",{className:"img-cropper"},o().createElement(Sl,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),o().createElement("div",{className:"actions"},o().createElement(L.Space,{size:"small"},o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},f("qm.uploadCropper.zoomIn")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},f("qm.uploadCropper.zoomOut")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},f("qm.uploadCropper.rotatePlus")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},f("qm.uploadCropper.rotateSubtract"))))),o().createElement("div",{className:"preview-area"},o().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{className:e}=this.props,{src:t}=this.state,r=Ce("cropper-preview");return o().createElement(o().Fragment,null,this.renderUpload(),t&&o().createElement(L.Modal,{open:!0,wrapClassName:we()(r,e),title:f("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Cl(Tl,"contextType",c);const Il=Tl;function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nl.apply(this,arguments)}function Rl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Pl extends i.Component{constructor(){super(...arguments),Rl(this,"context",void 0),Rl(this,"state",{previewVisible:!1,currentIndex:0}),Rl(this,"uploadRef",o().createRef()),Rl(this,"sortableInstance",void 0),Rl(this,"isFocused",!1),Rl(this,"createSortable",(()=>{this.props.draggable&&(this.sortableInstance=$t().create(this.getFileListNode(),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:e=>{const{oldIndex:t,newIndex:r}=e,{fileList:n=[],onSortChange:a,onChange:i}=this.props;if(t!==r){const e=[...n],[o]=e.splice(t,1);e.splice(r,0,o),a?.(e),i?.({fileList:e})}}}))})),Rl(this,"getFileListNode",(()=>Ye(this.uploadRef.current,Ce("upload-img")).querySelector(".ant-upload-list"))),Rl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,beforeUpload:o}=this.props,l=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!i||e.size/1024/1024<i,c=l&&s;if(l||L.message.warning(f("qm.upload.tooltip",{type:a.join(",")})),s||L.message.warning(f("qm.upload.sizeLimit",{size:i})),!c)return L.Upload.LIST_IGNORE;if(o){const a=o(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Rl(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})})),Rl(this,"handlePaste",(async e=>{const{fileList:t=[],action:r,data:n,headers:a,onChange:i}=this.props;if(this.isFocused&&this.showUploadButton&&r)for(const o of e.clipboardData.items)if("file"===o.kind&&o.type.startsWith("image/")){const e=o.getAsFile(),l=Date.now(),s=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(s,{uid:`rc-upload-${l}`});try{await this.beforeUpload(s,[...t,s]);const e=new FormData;if(e.append("file",s),n)for(const t in n)e.append(t,n[t]);const o="string"==typeof r?r:await r(s),l=await fetch(o,{method:"POST",body:e,headers:a});if(!l.ok)throw new Error(f("qm.upload.uploadError"));const c=await l.json();i?.({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(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}componentDidMount(){this.createSortable(),document.addEventListener("paste",this.handlePaste)}componentDidUpdate(e){const{fileList:t}=e,{fileList:r}=this.props;t===r||this.showUploadButton||(this.isFocused=!1)}componentWillUnmount(){this.sortableInstance?.destroy(),document.removeEventListener("paste",this.handlePaste)}render(){const{previewVisible:e,currentIndex:t}=this.state,{fileList:r=[],fixedSize:n,quality:a,fileTypes:i,fileSize:l,draggable:s,disabled:c,readOnly:d,className:u,popupClassName:p,openCropper:h,beforeCrop:m}=this.props,g=Ce("upload-img"),b={[g]:!0,[`${g}--lg`]:"large"===this.$size,[`${g}--sm`]:"small"===this.$size},y=c||d,v=o().createElement(L.Upload,Nl({className:we()(b,u)},ue(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:y,onPreview:this.handlePreview,showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,r,n)=>o().createElement("div",{className:we()("upload-item",{handle:s})},e,!y&&o().createElement(Te.CloseOutlined,{title:f("qm.upload.remove"),className:"icon",onClick:()=>n.remove()}))}),o().createElement("span",{ref:this.uploadRef},!this.showUploadButton||d&&r.length?null:o().createElement(o().Fragment,null,o().createElement("p",{className:"ant-upload-drag-icon"},o().createElement(Te.InboxOutlined,null)),o().createElement("p",{className:"ant-upload-text"},f("qm.uploadCropper.dragableText")),o().createElement("button",{className:we()("ant-upload-button",{disabled:y}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{this.isFocused=!0},onBlur:()=>{this.isFocused=!1}},f("qm.uploadCropper.pasteText")))));return o().createElement(o().Fragment,null,h?o().createElement(Il,{className:p,fixedSize:n,quality:a,fileTypes:i,fileSize:l,beforeCrop:m},v):v,o().createElement("div",{style:{display:"none"}},o().createElement(L.Image.PreviewGroup,{preview:{visible:e,current:t,rootClassName:p,onVisibleChange:e=>{this.setState({previewVisible:e})}}},r.map(((e,t)=>o().createElement(L.Image,{key:e.uid??t,src:e.url,alt:""}))))))}}Rl(Pl,"contextType",c),Rl(Pl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Ol=Pl,kl=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=kl(i.children,t,r);e&&(n=e)}}return n},Al=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Al(e.children,t),t(e)||e.children&&e.children.length))),Ll=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ll(e.children,t)),t(e)&&r.push(e)})),r},_l=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=_l(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Fl=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Fl(e.children,t,r,n)}:e)),Hl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Hl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},Dl=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=Dl(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},$l=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...$l(e,t)))),r},ql=o().forwardRef(((e,t)=>{const{className:r,style:n,filterable:a=!0,multiple:i,draggable:l,dataSource:s,fetch:d,asyncLoad:u,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:m=f("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:w,onCheckChange:C,onDragStart:T,onDragChange:I,onExpand:N}=e,{size:R}=o().useContext(c),P=o().useMemo((()=>e.size??R??""),[e.size,R]),O=g?.valueKey||"value",k=g?.textKey||"text",A=o().useRef(null),_=Nt(A),[F,H]=o().useState(y),[D,$]=o().useState(!1),q=Ot((()=>{H(A.current.offsetHeight-Z.current.offsetHeight-10)}),5);Pt((()=>{y||q()}),[_.height]);const[M,j]=o().useState([]),[K,V]=o().useState({}),[z,B]=o().useState([]),[U,W]=o().useState([]),[G,Y]=o().useState(""),[X,Q]=o().useState(x),Z=o().useRef(null),J=o().useRef([]),ee=o().useRef([]);o().useEffect((()=>{Array.isArray(s)&&(re(s),B(ne(s)),V({}))}),[s]),o().useEffect((()=>{oe()}),[]),Me((()=>{oe()}),[d?.params]),Me((()=>{W(ie())}),[K]),o().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=_l(M,(t=>e===t[O]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],re([...M]))},REMOVE_RECORD:e=>{const t=kl(M,e,O);if(void 0===t&&M.find((t=>t[O]===e)))re(M.filter((t=>t[O]!==e)));else{const r=_l(M,(e=>t===e[O]));if(!r)return;const n=r.children?.findIndex((t=>e===t[O]));n>=0&&(r.children.splice(n,1),re([...M]))}},UPDATE_RECORD:(e,t)=>{const r=_l(M,(t=>e===t[O]));r&&((0,te.merge)(r,t),re([...M]))}})));const re=e=>{j(e),J.current=e,ee.current=Hl(e,O)},ne=e=>{if(i)return v;const t=Ll(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][O]]:[]},ae=e=>Dl(M,e,O)?.slice(0,-1)||[],ie=()=>{if(x)return ee.current;const e=[];return z.forEach((t=>{if(i){if("SHOW_ALL"===h&&!ee.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const r=qn(M,t);if(r){const n=ae(t),a=$l(r,O);e.push(...n,...[t,...a].filter((e=>ee.current.includes(e))))}}}else e.push(...ae(t))})),[...new Set(e)]},oe=async()=>{if(!d)return;const{api:e,params:t,dataKey:r,afterFetch:n,callback:a}=d;try{$(!0);const i=await e(t);if(200===i.code){let e=Array.isArray(i.data)?i.data:(0,te.get)(i.data,r)??[];e="function"==typeof n?await n(e):e,re(e),B(ne(e)),V({}),a?.(e)}}catch(e){}$(!1)},le=e=>`${e}|${na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ce("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===P,[`${se}--sm`]:"small"===P};return o().createElement("div",{ref:A,className:we()(ce,r),style:n},o().createElement("div",{ref:Z,className:"topper"},E&&o().createElement(L.Input.Search,{value:G,size:P,placeholder:m,allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=Al(J.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==le(r).indexOf(e)}));Y(e),j(t),x||e?W(Hl(t,O)):V({})})(e.target.value)}),S&&o().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:ee.current)}},X?o().createElement(Te.UpOutlined,null):o().createElement(Te.DownOutlined,null)," ",f(X?"qm.form.collect":"qm.form.spread"))),o().createElement(xt,{spinning:D},o().createElement(L.Tree,{fieldNames:{title:k,key:O,children:"children"},multiple:i,draggable:l,blockNode:l,checkable:i,selectable:!i,height:F,disabled:e.disabled,checkStrictly:p,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:U,treeData:M,loadData:u?async e=>{let{key:t,children:r}=e;if(!d||r)return;const{api:n,params:a,dataKey:i,formatter:o=(e=>e),afterFetch:l}=d;try{const e=await n(o({...a,[O]:t}));if(200===e.code){let r=Array.isArray(e.data)?e.data:(0,te.get)(e.data,i)??[];r="function"==typeof l?await l(r):r;const n=Fl(J.current,t,O,r);re(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==le(t).indexOf(G)},onDragStart:T,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][O]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},o=[...M];let l;if(i(o,r,((e,t,r)=>{r.splice(t,1),l=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));else{let e,r=[];i(o,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,l):r.splice(e+1,0,l)}else i(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));re(o)},onDragEnd:e=>{I?.(e,M)},onExpand:(e,t)=>{de(e)&&Q(!1),ee.current.every((t=>e.includes(t)))&&Q(!0),W(e),N?.(e,t)},onSelect:e=>{B(e);const t=Ll(J.current,(t=>e.includes((0,te.get)(t,O))));w?.(i?t:t[0])},onCheck:e=>{p&&(e=e.checked),B(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!ee.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(kl(M,e,O)))));const t=Ll(J.current,(t=>e.includes((0,te.get)(t,O))));C?.(i?t:t[0])}})))}));ql.displayName="QmSearchTree";const Ml=ql,jl=(0,i.createContext)(void 0),Kl={dataIndex:s().string.isRequired,title:s().string.isRequired,description:s().string,colSpan:s().number,width:s().number,minWidth:s().number,fixed:s().oneOf(["left","right"]),align:s().oneOf(["left","center","right"]),theadAlign:s().oneOf(["left","center","right"]),printFixed:s().bool,hidden:s().bool,noAuth:s().bool,noFixed:s().bool,ellipsis:s().bool,className:s().string,theadClassName:s().string,children:s().array,sorter:s().oneOfType([s().bool,s().func]),filter:s().shape({type:s().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),style:s().object}),precision:s().number,displayPrecision:s().number,formatType:s().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:s().bool,canCopy:s().bool,editRender:s().func,dictItems:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),summation:s().shape({sumBySelection:s().bool,displayWhenNotSelect:s().bool,dataKey:s().string,unit:s().string,render:s().func}),groupSummary:s().shape({dataKey:s().string,unit:s().string,render:s().func}),shouldCellUpdate:s().func,headRender:s().func,render:s().func},Vl=(s().arrayOf(s().shape(Kl)).isRequired,s().func,s().array,s().oneOfType([s().string,s().func]).isRequired,s().number,s().bool,s().bool,s().shape({api:s().func.isRequired,params:s().object.isRequired,formatter:s().func,beforeFetch:s().func,afterFetch:s().func,stopToFirst:s().bool,dataKey:s().string,callback:s().func}),s().bool,s().bool,s().string,s().string,s().bool,s().bool,s().bool,s().bool,s().oneOfType([s().object,s().func]),s().oneOfType([s().object,s().func]),s().array,s().func,s().bool,s().object,s().object,s().shape({type:s().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:s().array,selectedRowKeys:s().array,hideSelectAll:s().bool,checkStrictly:s().bool,filterable:s().bool,selectByClickRow:s().bool,selectFirstRowOnChange:s().bool,clearableAfterFetched:s().bool,selectAllOnCurrentPage:s().bool,fetchSelectedRows:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fetchAllRowKeys:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),disabled:s().func,onChange:s().func,onSelect:s().func,onSelectAll:s().func}),s().shape({currentRowKey:s().oneOfType([s().number,s().string]),disabled:s().func,onChange:s().func}),s().shape({virtual:s().bool,doubleXScrollbar:s().bool}),s().shape({virtual:s().bool,expandIconColumn:s().string}),s().shape({defaultExpandAllRows:s().bool,defaultExpandedRowKeys:s().array,expandedRowKeys:s().array,hideExpandAll:s().bool,rowExpandable:s().func,expandedRowClassName:s().string,expandedRowRender:s().func,onExpand:s().func,onChange:s().func}),s().shape({cellMerge:s().bool,onCellMerge:s().func,onSelectChange:s().func}),s().shape({groupItems:s().arrayOf(s().shape({dataIndex:s().string.isRequired,titleIndex:s().string,color:s().string,backgroundColor:s().string})),fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),onChange:s().func}),s().func,s().bool,s().bool,s().bool,s().bool,s().shape({current:s().number,pageSize:s().number,pageSizeOptions:s().array,showSizeChanger:s().bool,showQuickJumper:s().bool}),s().shape({fileName:s().string,fetch:s().shape({api:s().func.isRequired,params:s().object}),beforeExport:s().func,cellStyle:s().bool,hideIcon:s().bool}),s().shape({showLogo:s().bool}),s().shape({fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fieldList:s().arrayOf(s().object)}),s().shape({position:s().oneOf(["top","bottom"]),hideAlert:s().bool,hideClearButton:s().bool}),s().oneOf(["left","right"]),s().func,s().func,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,{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}),zl=10,Bl="1",Ul="0",Wl="YYYY-MM-DD",Gl="YYYY-MM-DD HH:mm:ss",Yl="YYYYMMDDHHmmss",Xl={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Ql=function(e){return e.left="flex-start",e.right="flex-end",e}({});function Zl(e){const t=i.useRef();t.current=e;const r=i.useCallback((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current?.(...r)}),[]);return r}const Jl={...i}.useId;let es=0;const ts=Jl?function(e){const t=Jl();return e||t}:function(e){const[t]=i.useState(`qm_unique_${es}`);return i.useEffect((()=>{es+=1}),[]),e||t};let rs=[];const ns={getFocusInstance:function(){return rs[0]??null},getInstance:function(e){return rs.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==rs.findIndex((e=>e===t))&&(this.deregister(e),rs=[t,...rs])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),rs=[{id:e,vm:t},...rs])},deregister:function(e){e&&(rs=rs.filter((t=>t.id!==e)))}};function as(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const is=class{constructor(){as(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),as(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),as(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)})),as(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),as(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)})),as(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),as(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)})),as(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),as(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),as(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),as(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),as(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),as(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),as(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)}},os={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 ls(e){return void 0!==e}function ss(e,t){const{defaultValue:r,value:n,onChange:a,postState:o}=t||{},[l,s]=i.useState((()=>ls(n)?n:ls(r)?"function"==typeof r?r():r:"function"==typeof e?e():e)),c=ls(n)?n:l,d=o?o(c):c,u=Zl(a),[p,h]=i.useState([c]);return Pt((()=>{const e=p[0];l!==e&&u(l,e)}),[p]),Pt((()=>{ls(n)||s(n)}),[n]),[d,Zl((e=>{s(e),h([c])}))]}let cs;const ds=()=>{if(re)return 0;if(void 0!==cs)return cs;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),cs=t-n,cs},us=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=us(t.children)),t})),ps=(e,t)=>{const{fetch:r,columns:n,height:a,minHeight:i,maxHeight:l,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:h,scrollPagination:m,showSuperSearch:g,showFastSearch:b,showGroupSummary:y,showTableImport:v,showClipboard:x,showSelectCollection:E,footRender:S}=e,{tableRef:w,getRowKey:C,tableFullData:T,tableData:I,selectionKeys:N,sorter:R,filters:P,superFilters:O,pagination:k,mergedTdCells:A}=t,{selectionRows:L,summaries:_}=w.current,{expandIconColumn:F=""}=p||{},H=o().useMemo((()=>!!r?.api),[r?.api]),D=o().useMemo((()=>!H&&!!h),[H,h]),$=o().useMemo((()=>H&&!!m),[H,m]),q=o().useMemo((()=>(H||D)&&!$),[H,D,$]),M=o().useMemo((()=>!!(a||i||l)),[a,i,l]),j=o().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(us(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:os.selectionColumn,title:"radio"===t?f("qm.table.config.selectionText"):"",width:os.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:os.expandableColumn,title:"",width:os.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Kr(t)})(n)),[n]),K=o().useMemo((()=>jr(j)),[j]),V=o().useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),z=o().useMemo((()=>K.filter((e=>!!e.summation))),[K]),B=o().useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),U=o().useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),W=o().useMemo((()=>(e=>{const t=[];return e.forEach((e=>{const r=T.find((t=>C(t,t.index)===e.rowKey)),n=K.findIndex((t=>t.dataIndex===e.dataIndex));if(!r||n<0)return;const a={row:r.index,col:n,rowSpan:e.rowSpan,colSpan:e.colSpan};t.push(a);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:a.row+n,col:a.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:a.row+r,col:a.col+n,rowSpan:0,colSpan:0})})),t})(A)),[A,K,T]),G=o().useMemo((()=>{const e=K.filter((e=>![os.expandableColumn,os.selectionColumn,os.operationColumn].includes(e.dataIndex)));return F&&e.some((e=>e.dataIndex===F))?F:e[0]?.dataIndex??""}),[K,F]),Y=o().useMemo((()=>z.length>0),[z]),X=o().useMemo((()=>!!S||Y),[S,Y]),Q=o().useMemo((()=>Qr(j).length>1),[j]),Z=o().useMemo((()=>s||Q),[s,Q]),J=o().useMemo((()=>K.some((e=>e.sorter))),[K]),ee=o().useMemo((()=>K.some((e=>e.filter))),[K]),te=o().useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),re=o().useMemo((()=>!H&&!!v),[H,v]),ne=o().useMemo((()=>!!x&&V.length>0),[x,V]),ae=o().useMemo((()=>!!E&&"checkbox"===c?.type),[E,c]),ie=o().useMemo((()=>!!g&&ee),[g,ee]),oe=o().useMemo((()=>!H&&!!b&&ee),[H,b,ee]),le=o().useMemo((()=>!!y&&K.some((e=>!!e.groupSummary))),[K]),se=o().useMemo((()=>!!d?.groupItems?.length),[d]),ce=o().useMemo((()=>T.some((e=>Array.isArray(e.children)))),[T]),de=o().useMemo((()=>!I.length),[I]),ue=o().useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:o,displayWhenNotSelect:l,unit:s}=i,c=se?hn(w.current.tableFullData):w.current.tableFullData,d=!L.length&&!!l;let u=(!o||d?c:L).reduce(((e,t)=>{if(t?.[os.summaryIgnore])return e;const n=tn(t,r);return an(n)?e.plus(n):e}),new(Pa())(0));!Object.keys(_).includes(r)||o&&!d||(u=new(Pa())(tn(_,r))),rn(e,r,u.toNumber());let p=n>=0?u.toFixed(n):u.toString();a>=0&&""!==p&&(p=ln(p,a)),p=on(p),rn(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[I,N,_]),pe=o().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),he=o().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=os.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:os.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(P,O);return{...e?{[os.sorterFieldName]:e}:null,...t.length?{[os.filterFieldName]:t}:null,...pe?{[os.groupSummary.summaryFieldName]:pe,usedJH:1}:null,...r?.params??null,[os.currentPageName]:k.current,[os.pageSizeName]:k.pageSize}}),[r?.params,k.current,k.pageSize,R,P,O,pe]);return{isFetch:H,isWebPagination:D,isScrollPagination:$,showPagination:q,shouldUpdateHeight:M,tableColumns:j,flattenColumns:K,editableColumns:V,summationColumns:z,leftFixedColumns:B,rightFixedColumns:U,derivedMergeCells:W,treeExpandIndex:G,showSummary:Y,showFooter:X,isHeadGroup:Q,bordered:Z,isHeadSorter:J,isHeadFilter:ee,isServiceSummation:te,isSelectCollection:ae,isTableImport:re,isTableClipboard:ne,isSuperSearch:ie,isFastSearch:oe,isGroupSummary:le,isGroupSubtotal:se,isTreeTable:ce,isTableEmpty:de,summationRows:ue,fetchParams:he}},hs=require("react-dom");var ms=n.n(hs);const fs=(e,t)=>{const{rowKey:r,height:n,dataSource:a,summation:i,fetch:l,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,treeConfig:h,authConfig:m,ignorePageIndex:f,columnsChange:g,onChange:b,onDataChange:y,onDataLoad:x,onScrollEnd:E,onFetchError:S}=e,{getRowKey:w,tableRef:C,tableElementRef:T,tableBodyRef:I,$size:N,tableColumns:R,flattenColumns:P,tableFullData:O,pagination:k,layout:A,filters:L,sorter:_,superFilters:F,fetchParams:H,selectionKeys:D,rowExpandedKeys:$,highlightKey:q,summationColumns:M,shouldUpdateHeight:j,isFetch:K,isTreeTable:V,isWebPagination:z,isScrollPagination:B,isServiceSummation:U,isGroupSubtotal:W,doLayout:G,setTableData:Y,setTableFlatColumns:X,setTableFullData:Q,setTableOriginData:Z,setTableFlatData:J,setAllTableData:ee,setDeriveRowKeys:re,setPagination:ne,setSpinning:ae,setSorter:ie,setFilters:le,setSuperFilters:se,setSelectionKeys:ce,setRowExpandedKeys:pe,setHighlightKey:he,setSelectionRows:me,setScrollXLoad:fe,setScrollYLoad:ge,setScrollXStore:be,setScrollYStore:ye,computeVirtualX:ve,computeVirtualY:xe,setFieldAuth:Ee,setResizeState:Se,setSummaries:we,setPermission:Ce,setRecordsMap:Te,resetTableScroll:Ie,clearElementStore:Ne,clearRecordsMap:Re}=t,{store:Pe,scrollBarRef:Oe}=C.current,ke=Number.parseInt(o().version)>=18?ms().flushSync:null,Ae=o().useRef({...H}),Le=o().useRef(new Map),_e=o().useRef(!1),Fe=Nt(T);Pt((()=>{je(),C.current.scrollXLoad?Ve(Oe.current.scrollLeft):ze(),G()}),[R]),Pt((()=>{He()}),[Fe,N,n,A.tableAutoHeight]),Me((()=>{It(),Rt(),kt(),K||(z&>(),dt(a)),s&&ie(s),c&&le(c)}),[a,l?.params]),Me((()=>{const e=ot(H,Ae.current);e||K&&d?.clearableAfterFetched&&At(),!e&&H[os.currentPageName]>1&&!l?.stopToFirst?gt():K&&st(),Ae.current=H}),[H]),Me((()=>{z&&St(),B||Ie(),nt()}),[k.current,k.pageSize]),Me((()=>{C.current.scrollYLoad&&We(Oe.current.scrollTop),K||De(O.length),G()}),[O]),Me((()=>{V&&C.current.scrollYLoad&&(bt(),St())}),[$]);const He=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:r}=C.current,{width:n,height:a}=r,{width:i,height:o}=Fe,l=i!==n,s=o!==a;G(),l&&e&&ze(),s&&j&&t&&Ge(),Se(Object.assign({},r,{width:i,height:o}))},De=e=>{e!==k.total&&ne((t=>Object.assign({},t,{total:e})))},$e=e=>{_e.current=e},qe=Ot((e=>{ht(),E?.(e)})),je=()=>{fe(P.length>os.virtualScrollX)},Ke=function(){let e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).length>os.virtualScrollY;p?.virtual&&(e=!0),h?.virtual&&(e=!0),ge(e)},Ve=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollXStore:t}=C.current,{startIndex:r,endIndex:n,offsetSize:a}=t,{toVisibleIndex:i,visibleSize:o}=ve(e,A.tableWidth),l=Math.max(0,i-1-a),s=i+o+a;(i<=r||i>=n-o-1)&&(r===l&&n===s||(be(Object.assign({},t,{startIndex:l,endIndex:s})),ze()))},ze=()=>{Be(),Ue()},Be=()=>{const{scrollXLoad:e,scrollXStore:t}=C.current;if(!e)return;const r=[],n=[],a=[];for(let e=0;e<P.length;e++){const i=P[e];i.fixed?"left"===i.fixed?r.push(i):a.push(i):e>=t.startIndex&&e<t.endIndex&&n.push(i)}ke?queueMicrotask((()=>ke((()=>X([...r,...n,...a]))))):X([...r,...n,...a])},Ue=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:r}=C.current,{tableBodyWidth:n,gutterWidth:a}=A;let i="",o="";r&&(i=`${P.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,o=`${scrollY?n-a:n}px`),e.$tableBody.style.marginLeft=i,e.$tableXspace.style.width=o},We=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=C.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:o}=t,{toVisibleIndex:l}=xe(e,o),s=Math.max(0,l-1-a),c=l+i+a;(l<=r||l>=n-i-1)&&(r===s&&n===c||(ye(Object.assign({},t,{startIndex:s,endIndex:c})),Ge()))},Ge=()=>{const{tableFlatData:e}=C.current;Et(e),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=C.current,{startIndex:a,rowHeight:i}=r;let o="",l="";n&&(o=`${Math.max(0,a*i)}px`,l=e.length*i+"px"),t.$tableBody.style.marginTop=o,t.$tableYspace.style.height=l})(e)},Ye=e=>W?Xe(Qe(e,0)):e,Xe=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Xe(e.children)),delete e.children,t.push(e)})),t},Qe=(e,t)=>{const n=i.groupItems?.[t];return n?fn(e,[n.dataIndex]).map((e=>{const a={children:Qe(e,t+1),_group:n.dataIndex};return"function"!=typeof r&&rn(a,r.toString(),dn()),n.titleIndex&&rn(a,n.titleIndex,tn(e[0],n.titleIndex)),rn(a,n.dataIndex,tn(e[0],n.dataIndex)),M.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[os.summaryIgnore])return e;const n=Number(tn(r,t));return Number.isNaN(n)?e:e+n}),0);rn(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Ze=e=>{ce(e),me((e=>{const{selectionRows:t,recordsMap:r}=C.current,n=new Map;t.forEach((e=>n.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=n.get(e[t])||r.get(e[t]);i&&a.push(i)}return a})(e))},Je=e=>{const{type:t,checkStrictly:r=!0}=d||{},n=Array.isArray(e)?e:D;let a=[];return C.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{disabled:r}=d||{},{deriveRowKeys:n,recordsMap:a}=C.current,i=Yr(n,e);let o=[];if(!i)return o;let l=tt(i?.children||[]);return r&&(l=l.filter((e=>!a.has(e)||!r(a.get(e))))),o=[...new Set([...t,...l])],(bn(n,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Yr(n,e),r=t?.children?.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},et=e=>{const{allRowKeys:t,flattenRowKeys:r,deriveRowKeys:n}=C.current,{defaultExpandAllRows:a,expandedRowRender:i}=u||{},o=Array.isArray(e)?e:$;if(C.current.treeTable){i&&v("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];q&&e.unshift(q);let l=[];return e.forEach((e=>{const t=bn(n,e)||[];l.push(...t.length>1?t.slice(0,-1).reverse():t)})),l=a?t:[...new Set([...o,...l])],l.filter((e=>!r.includes(e)))}return u?a?t.slice(0):[...o]:[]},tt=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...tt(e[r].children)),t.push(e[r].rowKey);return t},rt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...rt(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...rt(e,r[r.length-1])),r},nt=Ot((()=>{b?.(k,it(L),at(_),F,{currentDataSource:xt()})})),at=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},it=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[os.showFilterType?`${n}|${a}`:n]=e[r]}return t},ot=(e,t)=>{const r=Object.keys(en(e,t));return 1===r.length&&(r.includes(os.currentPageName)||r.includes(os.pageSizeName))},lt=async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=oe,afterFetch:r,callback:n}=l;if(!t(H))return;const a=!!i?.fetch?.api;ae(!0);try{const[t,o]=a?await Promise.all([l.api(e(H)),i.fetch.api(e(H))]):[await l.api(e(H))];if(C.current.unMounted)return;if(a?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??os.dataKey;let a=(0,te.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,te.get)(t.data,e.replace(/[^.]+$/,os.totalKey))||a.length||0,s=Math.max(Math.ceil(i/k.pageSize),1);if(H[os.currentPageName]>s)return mt({...k,current:s});dt(_e.current?C.current.tableFullData.concat(a):a),De(i),ut(o?.data||t.data),n?.(t.data,t)}}catch(e){S?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),ae(!1),$e(!1)},st=Ot(lt),ct=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=ct(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:r}=k;return!K||B?e:(t-1)*r+e})(t)),e))),dt=e=>{const t=Ye(ct(e));wt(t),Ct(t),Ze(Je()),pe(et()),pt(),x?.(t)},ut=e=>{if(!U)return;const t=i?.fetch?.dataKey??os.summationKey,r=(t?(0,te.get)(e,t):e)??{},n={};M.filter((e=>!!e.summation.dataKey)).forEach((e=>{rn(n,e.dataIndex,Number(tn(r,e.summation.dataKey)))})),we(n)},pt=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=xt();if(e.length){const t=w(e[0],e[0].index);Ze([t])}else Ze([])}},ht=()=>{if(!B)return;const e=ft();_e.current||k.current>=e||($e(!0),mt({...k,current:k.current+1}))},mt=e=>{let{current:t,pageSize:r}=e;ne((e=>Object.assign({},e,{current:t,pageSize:r})))},ft=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},gt=()=>{mt(Object.assign({},k,{current:1}))},bt=()=>{const{scrollYLoad:e,deriveRowKeys:t}=C.current;if(!C.current.treeTable||!e)return;const r=yt(t,(()=>{const{allTableData:e,allRowKeys:t}=C.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?$.filter((e=>!n.includes(e))):$})());Le.current.clear(),r.forEach(((e,t)=>Le.current.set(e,t)))},yt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...yt(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},vt=()=>{const{current:e,pageSize:t}=k;return C.current.tableFullData.slice((e-1)*t,e*t)},xt=()=>z?vt():C.current.tableFullData,Et=e=>{const{scrollYLoad:t,scrollYStore:r}=C.current;if(!t)return Y(e);const{startIndex:n,endIndex:a}=r;ke?queueMicrotask((()=>ke((()=>Y(e.slice(n,a)))))):Y(e.slice(n,a))},St=()=>{(()=>{let e=xt();C.current.treeTable&&h?.virtual&&(e=(e=>{const{recordsMap:t,allRowKeys:r}=C.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];Le.current.has(a)&&n.push(t.get(a))}return n})()),Ke(e),J(e)})(),Ge()},wt=e=>{Q(e),ee(e),re(e),Tt(),bt(),St()},Ct=e=>{Z(e)},Tt=()=>{Re(),C.current.allTableData.forEach((e=>Te(w(e,e.index),e)))},It=()=>{ie({})},Rt=()=>{le({})},kt=()=>{se([])},At=()=>{Ze([])};return{initialTable:()=>{(async()=>{if(!m)return;let t=ue(m,["fetch"]);if(m.fetch){const{api:e,params:r,dataKey:n}=m.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,te.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;Ce((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=C.current,n=zr(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:o}=a,l=Br(r,n);Ee(n,{visible:t,disabled:i,secretName:o}),t||(e.noAuth=!0,l.noAuth=!0),o&&(e.formatType=`secret-${o}`,l.formatType=`secret-${o}`)}}));g?.(n)}})(),q&&I.current.setClickedValues([q,""]),"radio"===d?.type&&D.length&&I.current.setClickedValues([D[0],""]),je(),Ke(),K?lt():dt(a)},checkDataIndex:()=>{const e=P.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&v("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:wt,getTableData:lt,handleTableData:Et,createWebPageData:vt,createTableData:dt,createGroupData:Ye,createSelectionKeys:Je,createRowExpandedKeys:et,setSelectionKeysEffect:Ze,findParentRowKeys:rt,getAllChildRowKeys:tt,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return v("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Pe.removeFromRequired({x:r,y:n}),Pe.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&de(t)&&Pe.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Pe.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Pe.state,i=(0,te.intersection)(r,a),o=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:o(e),validate:o(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,te.intersection)(n,r),...(0,te.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{y?.(C.current.tableFullData)},tableChange:nt,toLastPage:()=>{const e=ft();k.current!==e&&mt(Object.assign({},k,{current:e}))},toFirstPage:gt,getPageCount:ft,pagerChangeHandle:mt,triggerScrollXEvent:e=>{Ve(e)},triggerScrollYEvent:e=>{We(e)},scrollBottomDebouncer:qe,clearTableSorter:It,clearTableFilter:Rt,clearSuperFilters:kt,clearRowSelection:At,clearRowHighlight:()=>{he("")},clearTableLog:()=>{Pe.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;Ne(),Pe.destroy(),e.deregister(t)}}},gs=(e,t)=>{const{height:r,minHeight:n,maxHeight:a,ellipsis:i,showHeader:l,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,$size:h,tableColumns:m,flattenColumns:f,leftFixedColumns:g,derivedMergeCells:b,layout:y,scrollX:v,scrollY:x,showFooter:E,showPagination:S,isFullScreen:w,setLayout:C,setScrollX:T,setScrollY:I,setElementStore:N,setScrollXStore:R,setScrollYStore:P,setShouldToTop:O}=t,k=o().useRef(x),A=o().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=y,i={};return n&&Object.assign(i,{minHeight:`${Jr(n)}px`}),a&&Object.assign(i,{maxHeight:`${Jr(a)}px`}),w?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:r?{...i,height:"auto"!==r?`${Jr(r)}px`:`${t}px`}:i}),[r,a,n,w,y]),L=()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=l?e.$header.offsetHeight:y.headerHeight,i=E?e.$footer.offsetHeight:y.footerHeight,o=n-a-i,s=e.$tableBody.offsetHeight,c=t||s>o;let u=0;if(w){const t=e.$toper?e.$toper.offsetHeight+zl:0,n=e.$pager?e.$pager.offsetHeight+zl:0;u=r.winHeight-t-n-20}(t||o!==y.viewportHeight)&&F(o),k.current=c,I(c),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:o,tableBodyHeight:s,tableFullHeight:u})))},_=(e,t)=>{const r=e+t;let n=-1,a=0,i=0;for(let t=0,o=f.length;t<o;t++){const o=f[t];if(a+=o.width||o.renderWidth,-1===n&&e<a&&(n=t),n>=0&&(i++,a>r))break}return{toVisibleIndex:Math.max(0,n),visibleSize:Math.max(8,i)}},F=e=>{const{scrollBarRef:t,scrollYStore:r,isIE:n}=d.current,a=t.current.scrollTop,{rowHeight:i}=r,{toVisibleIndex:o}=H(a,i),l=Math.max(8,Math.ceil(e/i)+2),s=n?5:0,c=Math.max(0,o-1-s),u=Math.max(o+l+s,r.endIndex);P(Object.assign({},r,{visibleSize:l,offsetSize:s,startIndex:c,endIndex:u}))},H=(e,t)=>{const r=Math.floor(e/t);return{toVisibleIndex:Math.max(0,r)}},D=(e,t)=>{const{scrollBarRef:r,elementStore:n,scrollYStore:a,scrollYLoad:i,tableFlatData:o}=d.current;if(void 0!==t&&t>=0)r.current.SET_SCROLL_TOP(t*a.rowHeight);else if(i){const t=o.findIndex((t=>e===c(t,t.index)));t>=0&&r.current.SET_SCROLL_TOP(t*a.rowHeight)}else{const t=n.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);t&&r.current.SET_SCROLL_TOP(t.offsetTop)}};return{createElementStore:()=>{N("$toper",u.current),N("$table",p.current)},tableStyles:A,getSpan:(e,t,r,n,a)=>{let i=1,o=1;if("function"==typeof s){const l=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(l)?(i=l[0],o=l[1]):(0,te.isPlainObject)(l)&&(i=l.rowSpan,o=l.colSpan)}if(b.length>0){const e=b.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}},getStickyLeft:e=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Ur(Br(m,e)).dataIndex);let t=0;for(let r=0;r<f.length;r++){const n=f[r];if(n.dataIndex===e)break;t+=n.width||n.renderWidth||0}return t},getStickyRight:(e,t)=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Wr(Br(m,e)).dataIndex);const r="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let r=[];return e.forEach((e=>{e.colSpan>0&&r.length>0&&(t.push(r),r=[]),r.push(e)})),r.length>0&&t.push(r),t.map((e=>{const[t,r]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...r,...t.reverse()]})).flat()})(f):f;let n=0;for(let t=r.length-1;t>=0;t--){const a=r[t];if(a.dataIndex===e)break;n+=a.width||a.renderWidth||0}return n},scrollXToColumn:(e,t)=>{const{scrollBarRef:r}=d.current,n=void 0===t?f.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=g.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=f.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:D,rowInViewport:e=>{const{scrollBarRef:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=y,i=e*r.rowHeight;return!(i<t.current.scrollTop||i+r.rowHeight>t.current.scrollTop+(v?n-a:n))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(S?$a["small"!==h?"middle":h]+zl:0)-zl;C((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&D("",0),O(!0)},computeVirtualX:_,computeVirtualY:H,doLayout:()=>{i?L():se((()=>L())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,r=e.$table.clientWidth,n=k.current?y.gutterWidth:0,{defaultColumnWidth:a}=os,i=[];let o=0;if(f.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,o+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=f.reduce(((e,t)=>e+(t.width||t.minWidth||a)),0);if(e<=r-n){T(!1);const t=r-n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||a)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||a)),0);let r=0;i.forEach(((t,n)=>{if(0===n)return;const i=Math.floor((t.minWidth||a)*e);r+=i,t.renderWidth=(t.minWidth||a)+i})),i[0].renderWidth=(i[0].minWidth||a)+t-r}}else T(!0),i.forEach((e=>{e.renderWidth=e.minWidth||a}));C((t=>({...t,tableBodyWidth:Math.max(e,r)})))}else o=f.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||a)),0),T(o>r),C((e=>({...e,tableBodyWidth:o})));C((e=>({...e,tableWidth:r}))),t&&(e=>{const{scrollXStore:t,isIE:r,scrollBarRef:n}=d.current,a=n.current.scrollLeft,{toVisibleIndex:i,visibleSize:o}=_(a,e),l=r?5:0,s=Math.max(0,i-1-l),c=Math.max(i+o+l,t.endIndex);R(Object.assign({},t,{visibleSize:o,offsetSize:l,startIndex:s,endIndex:c}))})(r)})()}}},bs=e=>{const{total:t}=e,{tableRef:r,selectionKeys:n,isHeadSorter:a,isHeadFilter:i,isTreeTable:l,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=o().useContext(jl),{infoBarConfig:h,rowSelection:m,rowHighlight:g}=r.current.props,{allTableData:b,invalidRowKeys:y}=r.current,{hideAlert:v,hideClearButton:x}=h||{},E=o().useMemo((()=>!v),[v]),S=o().useMemo((()=>!x&&!!(a||i||m||g)),[x,a,i,m,g]),w=Ce("table"),C={[`${w}__alert`]:!0};return E?o().createElement("div",{className:we()(C)},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.InfoCircleFilled,null)),o().createElement("span",null,f("qm.table.alert.total",{total:l?b.length:t}),m?`,${f("qm.table.alert.selected",{total:Math.max(n.length-y.length,0)})}`:""),S&&o().createElement("em",{onClick:()=>{c(),d(),u(),p(),se((()=>s()))}},f("qm.table.alert.clear"))):null},ys=o().forwardRef(((e,t)=>{const{isFullScreen:r,open:n=!0}=e,{setFullScreen:a}=o().useContext(jl),i=()=>{a(!r)};o().useImperativeHandle(t,(()=>({clickHandle:i})));const l=Ce("table");return n?o().createElement("span",{className:`${l}-full-screen`,title:f(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},r?o().createElement(Te.FullscreenExitOutlined,null):o().createElement(Te.FullscreenOutlined,null))):null}));ys.displayName="FullScreen";const vs=ys,xs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{getTableData:n}=o().useContext(jl),a=()=>{n()};o().useImperativeHandle(t,(()=>({clickHandle:a})));const i=Ce("table");return r?o().createElement("span",{className:`${i}-reload`,title:f("qm.table.refresh.text"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.ReloadOutlined,null))):null}));xs.displayName="Reload";const Es=xs,Ss=()=>{const e={dateFormat:e=>{const t=e?u()(e).format(Wl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?u()(e).format(Gl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?u()(e).format(Gl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>an(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>on(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,r,n)=>{const{dictItems:a,precision:i,displayPrecision:o,formatType:l,editRender:s}=r,c=a||s?.(n,r)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==d&&(d=an(d)?new(Pa())(d).toFixed(i):d),o>=0&&""!==d&&(d=ln(d,o)),l){const t=e[`${ce(l)}Format`];t?d=t(d):v("Table","字段的格式化类型 `formatType` 配置不正确")}return d},r=e=>ne(e)?un(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,a,i)=>{const o=tn(e,n.dataIndex),l=n.render?n.render(o,e,n,a,i):t(o,n,e);return r(l)}}},ws=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=o().useContext(c),{tableRef:i,flattenColumns:l,summationRows:s,showSummary:d,getSpan:u}=o().useContext(jl),{tablePrint:p,showHeader:h}=i.current.props,{getTitleFromCellValue:m}=Ss(),g=a?.print?.leftLogo??"",b=a?.print?.rightLogo??"",y=!(!g&&!b),v=o().useMemo((()=>pe(Gr(r,[os.expandableColumn,os.selectionColumn,os.operationColumn]))),[r]),x=o().useMemo((()=>pe(Gr(l,[os.expandableColumn,os.selectionColumn,os.operationColumn]))),[l]),E=o().useMemo((()=>pe(r.filter((e=>e.printFixed)))),[r]),S=e=>{const t=Object.assign({},gn(v,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},w=(e,t)=>(0,te.map)((0,te.groupBy)((0,te.flatten)(e),t),(0,te.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,te.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))}))),C=()=>{const{tableFullData:e}=i.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||os.defaultColumnWidth,n<=os.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),E.length&&e.unshift(...E),t.push(r),r=[],n=0,a=0):(i.width=os.printWidth,r.push(i),t.push(r),a++)}return t})([...x]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(r),t.push(Qr(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=T(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},T=(e,t,r)=>{const{showLogo:n=!0}=p;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||os.defaultColumnWidth}px">`})).join("")}</colgroup>`,h&&(a+=["<thead>",n&&y?`<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">',g?`<img src="${g}" 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:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${pn(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${Xr(r).map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=u(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${n<=0?`<span style="padding-left:${e._level*os.treeTable.textIndent}px"></span>`:""}${m(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),d&&s.length&&(a+=["<tfoot>",s.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,o=i?.render?i.render(r):tn(e,`${a}_text`);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ne(o)?un(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},I=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});qt(e,i)}})(0,C())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),i.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(r))}))};o().useImperativeHandle(t,(()=>({clickHandle:I})));const N=Ce("table");return n?o().createElement("span",{className:`${N}-print`,title:f("qm.table.print.text"),onClick:()=>I()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.PrinterOutlined,null))):null}));ws.displayName="TablePrint";const Cs=ws,Ts=require("exceljs");var Is=n.n(Ts);const Ns="606060",Rs="thin",Ps="d4d4d4",Os=(e,t)=>{t&&(e.height=Math.floor(.75*t))},ks=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},As=()=>({top:{style:Rs,color:{argb:Ps}},left:{style:Rs,color:{argb:Ps}},bottom:{style:Rs,color:{argb:Ps}},right:{style:Rs,color:{argb:Ps}}}),Ls=e=>{const{children:t}=e;return t&&t.length?Ls(t[0]):e},_s=e=>{const{precision:t,formatType:r}=e,n=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===r?{numFmt:n?`0${n}%`:"0%"}:"finance"===r?{numFmt:n?`#,##0${n}`:"#,##0"}:n?{numFmt:`0${n}`}:null},Fs=()=>{const{tableRef:e,getSpan:t,showSummary:r,isHeadGroup:n}=o().useContext(jl),{spanMethod:a,showHeader:i}=e.current.props,l=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(o,l,s,c)=>{const{columns:d,footSummation:u}=o,{scrollYStore:{rowHeight:p}}=e.current,h=jr(d),m=Qr(d),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:r,minWidth:n,renderWidth:a}=e;E[t]=pn(e.title),y.push({key:t,width:(r||a||n||os.defaultColumnWidth)/8})})),i&&(n?m.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Ls(e),o=h.findIndex((e=>{let{dataIndex:t}=e;return t===i.dataIndex}));r[i.dataIndex]=pn(e.title),0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:o},e:{r:t+a-1,c:o+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=Xr(l).map(((e,r)=>{const n={};return h.forEach(((i,o)=>{if("function"==typeof a){const{rowSpan:n,colSpan:a}=t(e,i,r,o,l);(a>1||n>1)&&v.push({s:{r:r+x,c:o},e:{r:r+x+n-1,c:o+a-1}})}const s=["percent","finance"].includes(i.formatType);n[i.dataIndex]=s?tn(e,i.dataIndex):c(e,r,i,o)})),n._level=e._level,n}));x+=S.length,r&&u&&s(h,l).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:a,summation:i}=t,o=i?.render?i.render(l):tn(e,a);r[a]=0===n&&""===o?f("qm.table.config.summaryText"):ne(o)?un(o).join(""):o})),b.push(r)}));const{sheetName:w,useStyle:C}=o,T=new(Is().Workbook),I=T.addWorksheet(w);I.columns=y,i&&I.addRows(g).forEach((e=>{C&&Os(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),r=Br(d,t.key),{align:n,theadAlign:a}=r;ks(e,a||n),C&&Object.assign(e,{font:{bold:!0,color:{argb:Ns}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:As()})}))})),I.addRows(S).forEach(((e,t)=>{const{_level:r}=S[t];C&&Os(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),n=Br(d,t.key),{align:a}=n;ks(e,a),Object.assign(e,_s(n)),C&&Object.assign(e,{font:{color:{argb:Ns}},border:As()}),1===Number(e.col)&&r&&(e.alignment={...e.alignment,indent:r})}))})),r&&u&&I.addRows(b).forEach((e=>{C&&Os(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),r=Br(d,t.key),{align:n}=r;ks(e,n),Object.assign(e,_s(r)),C&&Object.assign(e,{font:{color:{argb:Ns}},border:As()})}))})),v.forEach((e=>{let{s:t,e:r}=e;I.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const N=await T.xlsx.writeBuffer();return new Blob([N],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,o="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],o=o+(n?",":"")+r(i.textContent.trim());o+="\r\n"}return o})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let o;for(o=0;o<e.length;o+=1)t[o]=e.charCodeAt(o);const l=new window.Uint8Array(t);a.push(l)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=jr(r),i=new FileReader;i.onerror=()=>{L.message.error(f("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>pn(e.title))),n=new(Is().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),o=e[i],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,o);if(s){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;Array.isArray(n?.richText)&&(n=n.richText.map((e=>e.text)).join("")),(0,te.isPlainObject)(n)&&"text"in n&&(n=n.text),(0,te.isDate)(n)&&(n=cn(n,Gl)),n?.formula&&(n=n.result??n.value),t[o[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:o}=a[r];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>l(o,e))).filter((e=>""!==e)):t[e]=l(o,t[e])),rn(n,i,t[e])})),n}));t?.(n)}else L.message.error(f("qm.table.import.error"))}else L.message.error(f("qm.table.import.error"))})):L.message.error(f("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},Hs=e=>{const{fileType:t,onChange:r}=e;let n,a;const i=Ce("table"),l=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return o().createElement(be,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return n||(n=document.createElement("form"),a=document.createElement("input"),n.className=`${i}--file-form`,a.name="file",a.type="file",n.appendChild(a),document.body.appendChild(n)),new Promise(((e,r)=>{const i=!t.type;a.multiple=!!t.multiple,a.accept=i?"":`.${t.type}`,a.onchange=o=>{const{files:s}=o.target,c=s[0];let d="";if(!i)for(let e=0;e<s.length;e++){const{type:r}=l(s[e]);if(t.type!==r){d=r;break}}d?(L.message.warning(f("qm.upload.notType",{type:d})),r()):e(c),document.body.removeChild(n),n=null,a=null},n.reset(),a.click()}))})({type:t});r?.(e.name,e)}catch(e){}})()},f("qm.upload.text"))},Ds=e=>{const{columns:t,onClose:r}=e,{tableRef:n,createTableData:a,dataChange:i}=o().useContext(jl),{beforeTableImport:l}=n.current.props,{importXLSX:s}=Fs(),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!0),m=e=>e.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:r}=t.GET_FIELDS_VALUE(["fileName"]);return o().createElement(o().Fragment,null,r?o().createElement("span",null,r):o().createElement(Hs,{fileType:t.state.formData.fileType,onChange:(e,r)=>{t.SET_FIELDS_VALUE({fileName:e,file:r}),r&&h(!1)}}))}},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:f("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:f("qm.table.import.fillText"),value:"fill"},{text:f("qm.table.import.addText"),value:"add"},{text:f("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{g.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,b([...g])}},{type:"INPUT_NUMBER",label:f("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:n.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),y=Ce("table");return o().createElement("div",{className:`${y}-import__setting`},o().createElement(Qo,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(be,{type:"primary",loading:d,disabled:p,onClick:()=>(async()=>{const[e,o]=await c.current.GET_FORM_DATA();e||(u(!0),s({columns:m(t),file:o.file},(async e=>{const{tableFullData:t,store:s}=n.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof l)try{e=await l(e)}catch(e){}if("fill"===o.importType&&a(e),"add"===o.importType&&a([...t,...e]),"insert"===o.importType){const{tableFullData:t}=n.current,r=o.posIndex,i=t.slice(0,r).concat(e).concat(t.slice(r));a(i)}e.forEach((e=>{s.addToInserted(e)})),i(),L.message.success(f("qm.table.import.success",{total:e.length})),u(!1),r()})))})()},f("qm.table.import.text"))))},$s=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,[a,i]=o().useState(!1),l=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ce("table"),c={[`${s}-import`]:!0},d={visible:a,title:f("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:we()(c),title:f("qm.table.import.textNoSpace"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.ImportOutlined,null))),o().createElement(Cr,d,o().createElement(Ds,{columns:r,onClose:()=>i(!1)})))}));$s.displayName="TableImport";const qs=$s,Ms=e=>{const{columns:t,onChange:r}=e,{$size:n}=o().useContext(jl),a=o().useRef([]),[i,l]=o().useState(!1),[s,c]=o().useState(t);Me((()=>{u()}),[s]),o().useEffect((()=>{d()}),[t]);const d=()=>{const e=[];t.forEach(((r,n)=>{const a=r.colSpan;a>1&&t.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(t.slice(n,n+a))})),a.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const i=a.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===i)return e.push(t);e.push(...a.current[i].map(((e,r)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),r?.(e)},p=Ce("table"),h={[`${p}__popper`]:!0,"column-filter__popper":!0,[`${p}--lg`]:"large"===n,[`${p}--sm`]:"small"===n},m=[`${p}-column-filter`,{selected:i}];return o().createElement(Xa(),{action:["click"],popupVisible:i,popup:o().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"main"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||c(xn(e))}},s.map((e=>((e,t)=>{const{colSpan:r}=e;if(0===r)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),o().createElement("i",{className:we()(n),title:f("qm.table.columnFilter.draggable")},o().createElement(Te.HolderOutlined,null)),o().createElement("span",{className:"text"},pn(e.title)))})(e)))))),popupClassName:we()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{l(e)},builtinPlacements:Xl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:we()(m),title:f("qm.table.columnFilter.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.SettingOutlined,null)),o().createElement("span",null,f("qm.table.columnFilter.text"))))},js=e=>{const{defaultValue:t,onClose:r,onOk:n}=e,{tableRef:a,selectionKeys:i,pagination:l,showSummary:s}=o().useContext(jl),{rowSelection:c}=a.current.props,d=o().useRef(null),[p,h]=o().useState(!1),m=o().useMemo((()=>Object.assign({},{fileName:`${u()().format(Yl)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:i.length?"selected":"all","startIndex|endIndex":[1,l.total],footSummation:s?1:0,useStyle:0},t,{columns:pe(t.columns||[])})),[]),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:f("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:f("qm.table.export.all"),value:"all"},{text:f("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==c?.type},{text:f("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:f("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>o().createElement(Ms,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:f("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:f("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ce("table");return o().createElement("div",{className:`${y}-export__setting`},o().createElement(Qo,{ref:d,initialValues:m,items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(be,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);n(t),await le(1e3),h(!1),r()}})()},f("qm.table.export.text"))))},Ks=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=o().useContext(c),{tableRef:i,flattenColumns:l,pagination:s,fetchParams:d,isFetch:p,isGroupSubtotal:h,showSummary:m,getSpan:g}=o().useContext(jl),{exportExcel:b,fetch:y,showHeader:v}=i.current.props,{getTitleFromCellValue:x}=Ss(),[E,S]=o().useState(!1),[w,C]=o().useState(!1),T=o().useMemo((()=>!!b?.fetch?.api),[b]),I=o().useMemo((()=>!s.total||w),[s.total,w]),N=o().useMemo((()=>Gr(r,[os.expandableColumn,os.selectionColumn,os.operationColumn])),[r]),R=o().useMemo((()=>Gr(l,[os.expandableColumn,os.selectionColumn,os.operationColumn])),[l]),P=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map(((e,n)=>{const a={...e,index:n,pageIndex:n},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=r,Array.isArray(e.children)&&(a.children=P(e.children,i,r+1)),R.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&rn(a,t,tn(a,t))})),a}))},O=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(h?hn(t):t).reduce(((e,t)=>{if(t?.[os.summaryIgnore])return e;const r=Number(tn(t,n));return Number.isNaN(r)?e:e+r}),0);rn(r,n,a)})),[r]},k=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let o=x(e,r,t,n);return a>=0&&!i&&""!==o&&(o=Number(o)),o},{exportXLSX:A,exportCSV:_}=Fs(),F=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=y;let i=[];try{C(!0);const o=await t({...r(d),[os.currentPageName]:1,[os.pageSizeName]:e??s.total});if(200===o.code){let e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,a)??[];e="function"==typeof n?await n(e):e,i=P(e)}}catch(e){}return C(!1),i},H=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=b?.fileName??`${u()().format(Yl)}.xlsx`,$=D.slice(D.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return L.message.warning(f("qm.table.export.warnText"));T?(async e=>{C(!0);try{const{api:t,params:r}=b.fetch,n=await t({columns:R.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...d,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[os.currentPageName]:void 0,[os.pageSizeName]:void 0});n.data&&(qt(n.data,e),H(e))}catch(e){}C(!1)})(D):S(!0)};o().useImperativeHandle(t,(()=>({clickHandle:q})));const M=Ce("table"),j={[`${M}-export`]:!0},K={visible:E,title:f("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},V={fileName:D.slice(0,D.lastIndexOf(".")),fileType:$,columns:N,useStyle:b?.cellStyle?1:0};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:we()(j),title:f("qm.table.export.textNoSpace"),onClick:()=>q()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.DownloadOutlined,null))),o().createElement(Cr,K,o().createElement(js,{defaultValue:V,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:o}=e,{tableFullData:l,selectionRows:s}=i.current;let c=[];if(p?("all"===n&&(c=await F()),"custom"===n&&(c=await F(o),c=c.slice(a-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(a-1,o||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof b?.beforeExport)try{c=b?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await A(e,c,O,k);qt(r,`${t}.xlsx`),H(`${t}.xlsx`)}if("csv"===r){const r=_(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Qr(r),i=jr(r);let o='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return o+=`<colgroup>${i.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||os.defaultColumnWidth}px">`})).join("")}</colgroup>`,v&&(o+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${pn(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(o+=`<tbody>${Xr(t).map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=g(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),m&&n&&(o+=["<tfoot>",O(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,o=i?.render?i.render(t):tn(e,a);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ne(o)?un(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),o+="</table>",o})(e,c));qt(r,`${t}.csv`),H(`${t}.csv`)}})(Object.assign({},e,{columns:Kr(e.columns)}))}})))}));Ks.displayName="TableExport";const Vs=Ks,zs=e=>{const{columns:t,onClose:r}=e,{tableRef:n,tableBodyRef:a,dataChange:i}=o().useContext(jl),{beforeClipboard:l}=n.current.props,s=o().useRef(null),[c,d]=o().useState([{type:"INPUT_NUMBER",label:f("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:f("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:pn(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:f("qm.table.clipboard.content"),fieldName:"content",placeholder:f("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[u,p]=o().useState(!1),h=Ce("table");return o().createElement("div",{className:`${h}-clipboard__setting`},o().createElement("h3",{className:"info"},f("qm.table.clipboard.supportText")),o().createElement(Qo,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:c,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(be,{type:"primary",loading:u,onClick:()=>(async()=>{const[e,o]=await s.current.GET_FORM_DATA();if(e)return;const{tableFullData:c,store:d}=n.current;p(!0);const u=o.content.trim().replace(/(\r|\n)$/,"");let h=u.replace(/"[^"]+"/g,"^");(u.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let m=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof l)try{m=await l(m,m[0].map(((e,r)=>t[o.colIndex+r].dataIndex)))}catch(e){}m.forEach(((e,r)=>{e.forEach(((e,a)=>{const i=c[o.rowIndex-1+r],l=t[o.colIndex+a];if(i&&l){let t=!1;if(l.editRender){const e=l.editRender(i,l);t=!(e.disabled||e.extra?.disabled||n.current.fieldAuth[l.dataIndex]?.disabled)}t&&l.dictItems&&(t=l.dictItems.some((t=>t.value==e))),t&&(rn(i,l.dataIndex,e),d.addToUpdated(i))}}))})),a.current.forceUpdate(),i(),L.message.success(f("qm.table.clipboard.success",{total:m.length})),p(!1),r()})()},f("qm.table.clipboard.text"))))},Bs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{flattenColumns:n}=o().useContext(jl),[a,i]=o().useState(!1),l=o().useMemo((()=>(e=>e.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:s})));const c=Ce("table"),d={[`${c}-clipboard`]:!0},u={visible:a,title:f("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:we()(d),title:f("qm.table.clipboard.textNoSpace"),onClick:()=>s()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.CopyOutlined,null))),o().createElement(Cr,u,o().createElement(zs,{columns:l,onClose:()=>i(!1)})))}));Bs.displayName="TableClipboard";const Us=Bs,Ws=e=>{const{columns:t,onClose:r}=e,{tableRef:n,$size:a,selectionKeys:i,setSelectionKeysEffect:l}=o().useContext(jl),{rowKey:s,rowSelection:c}=n.current.props,d=o().useRef(null),u=Nt(d),p=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=p(e.children)),t})),[h,m]=o().useState([{title:f("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(t.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))))]),[g]=o().useState((()=>{const{disabled:e}=c||{},t=n.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[b,y]=o().useState(300),v=Ot((()=>{const e=d.current;y(e.offsetHeight-2*$a[a]-30)}),5);return Pt((()=>{v()}),[u.width]),o().createElement("div",{ref:d,style:{height:"100%"}},o().createElement(ad,{size:a,columns:h,dataSource:g,rowKey:s,height:b,rowSelection:{type:"checkbox",selectedRowKeys:i,onChange:e=>l(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>m(e)}),o().createElement("div",{style:{height:10}}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r()},f("qm.table.selectCollection.closeButton"))))},Gs=o().forwardRef(((e,t)=>{const{columns:r,open:n=!0}=e,{tableRef:a,getRowKey:i,selectionKeys:l,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=o().useContext(jl),{rowSelection:p}=a.current.props,[h,m]=o().useState(!1),g=o().useRef(!1);Me((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:l},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,te.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>i(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{m(!0)};o().useImperativeHandle(t,(()=>({clickHandle:y})));const v=Ce("table"),x={visible:h,title:f("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:`${v}-select-collection`,title:f("qm.table.selectCollection.text"),onClick:()=>y()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.CheckSquareOutlined,null))),o().createElement(Cr,x,o().createElement(Ws,{columns:r,onClose:()=>m(!1)})))}));Gs.displayName="SelectCollection";const Ys=Gs,Xs=require("localforage");var Qs=n.n(Xs);const Zs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),Js=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,getRowKey:a,$size:i,flattenColumns:l,pagination:s,createWebPageData:d,setPagination:u,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:m,isTreeTable:g,isWebPagination:b}=o().useContext(jl),{uniqueKey:y}=n.current.props,x=o().useRef(null),E=o().useRef(null),S=o().useRef([]),w=o().useRef(""),C=o().useRef(-1),T=o().useRef("stop");Me((()=>{const e=Xr(d()).findIndex((e=>a(e,e.index)===w.current));p("",e)}),[s.current]);const I=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},N=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:I(e.filter.type),fieldName:e.dataIndex,label:pn(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[r,n]=await E.current.GET_FORM_DATA(),a=(0,te.omitBy)(Object.assign({},t,n),de);k(a)}}))),R={case:0,fullchar:0},P=o().useMemo((()=>l.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[l]),[O,k]=o().useState({}),[A,_]=o().useState(R),[F]=o().useState(N([P[0]])),[H]=o().useState(N(P.slice(1))),[D,$]=o().useState(0),q=o().useMemo((()=>!Object.keys(O).length),[O]);Me((()=>{T.current="ready"}),[O,A]);const M=e=>{_(Object.assign({},A,e))},j=(e,t,r)=>new Promise(((n,a)=>{L.Modal.confirm({title:f("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),K=async e=>{if(!Object.keys(O).length)return L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.queryCondition")});if("ready"===T.current&&(T.current="stop",S.current=(e=>{const{allTableData:t}=n.current,r=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let i=!0;for(const t in e){const{type:r}=P.find((e=>e.dataIndex===t)).filter;let n=tn(a,t),o=!0;if("text"===r||"textarea"===r?o=new RegExp(A.fullchar?`^${e[t]}$`:e[t],A.case?"":"i").test(n):(n=Zs(n)?n.slice(0,10):n,o=n==e[t]),!o){i=!1;break}}i&&r.push(a)}return r})(O),$(S.current.length)),!S.current.length)return h(""),L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>S.current.length-1&&await j(f("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=S.current.length-1))),"prev"===e&&(C.current=C.current<0?S.current.length-1:C.current-1,C.current<0&&await j(f("qm.table.fastSearch.toStart"),(()=>C.current=S.current.length-1),(()=>C.current=0)));const t=S.current[C.current],r=a(t,t.index);let i=t.index;if(g&&b){const e=bn(n.current.deriveRowKeys,r)[0];i=n.current.tableFullData.findIndex((t=>a(t,t.index)===e))}((e,t)=>{if(w.current=e,b){const{pageSize:e}=s,r=Math.ceil((t+1)/e);m(!1),u(Object.assign({},s,{current:r}))}else p(e)})(r,i),h(r)},V=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=o().useMemo((()=>y?`fastSearch_${y}`:""),[y]),[B,U]=o().useState([]),[W,G]=o().useState(""),[Y,X]=o().useState("");Me((()=>{if(Y){const{filters:e,config:t}=B.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(ue(e,H.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(ue(e,F.map((e=>e.fieldName)))),k(e),_(t)}else V(),k({}),_(R)}),[Y]),o().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await Qs().getItem(z);e||(e=await Z(z),Array.isArray(e)&&await Qs().setItem(z,e)),Array.isArray(e)&&e.length&&(U(e),X(e[0].value))},Z=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},J=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},ee=Ce("table");return o().createElement("div",{className:`${ee}-fast-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"top"},o().createElement("div",{className:"container"},o().createElement(pr,{defaultActiveKey:"1",size:"small",tabBarExtraContent:o().createElement("span",null,f("qm.table.alert.total",{total:D}))},o().createElement(pr.TabPane,{tab:f("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},o().createElement(Qo,{ref:x,items:F,cols:1,labelWidth:110})),o().createElement(pr.TabPane,{tab:f("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},o().createElement(Qo,{ref:E,items:H,cols:1,labelWidth:110})))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:i,value:W,placeholder:f("qm.table.highSearch.configText"),disabled:q,onChange:e=>{const{value:t}=e.target;G(t)}}),o().createElement(be,{type:"primary",disabled:!W||q,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=dn(),t=[...B,{text:W,value:e,list:{filters:O,config:A}}];U(t),X(e),G(""),await Qs().setItem(z,t),await J(z,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${os.rowHeightMaps[i]}px`}},o().createElement("span",null,f("qm.table.fastSearch.savedSetting"))),o().createElement("ul",null,B.map((e=>o().createElement("li",{key:e.value,className:we()({selected:e.value===Y}),title:e.text,onClick:()=>(e=>{X(e!==Y?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=B.filter((t=>t.value!==e));U(t),e===Y&&X(""),await Qs().setItem(z,t),await J(z,t)})(e.value)}},o().createElement(Te.CloseCircleOutlined,null))))),!B.length&&o().createElement("div",{style:{padding:zl}},o().createElement(ft,null)))))),o().createElement("div",{className:"bottom"},o().createElement("div",null,o().createElement(L.Checkbox,{checked:!!A.case,onChange:e=>M({case:e.target.checked})},f("qm.table.fastSearch.matchCase")),o().createElement(L.Checkbox,{checked:!!A.fullchar,onChange:e=>M({fullchar:e.target.checked})},f("qm.table.fastSearch.matchFullchar"))),o().createElement("div",null,o().createElement(be,{onClick:()=>V()},f("qm.table.fastSearch.clear"))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${$a[i]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.fastSearch.closeButton")),o().createElement(be,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},f("qm.table.fastSearch.queryPrev")),o().createElement(be,{type:"primary",onClick:()=>K("next")},f("qm.table.fastSearch.queryNext"))))},ec=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{$size:n}=o().useContext(jl),[a,i]=o().useState(!1),l=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ce("table"),c={visible:a,title:f("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${$a[n]+20}px`},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${s}-super-search`,title:f("qm.table.fastSearch.text"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.MonitorOutlined,null))),o().createElement(Cr,c,o().createElement(Js,{onClose:()=>i(!1)})))}));ec.displayName="FastSearch";const tc=ec,rc=e=>{const{columns:t,group:r,summary:n}=e,{tableRef:a,$size:i,pagination:l,fetchParams:s,isFetch:c}=o().useContext(jl),{fetch:d}=a.current.props,p=e=>{const r=t.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:r.dictItems??[]}},h=r.map((e=>({dataIndex:e.group,...p(e.group)}))),m=n.map((e=>e.summary===os.groupSummary.total.value?{dataIndex:e.summary,title:os.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=o().useMemo((()=>Object.assign({},s,{[os.sorterFieldName]:void 0,[os.groupSummary.summaryFieldName]:n.map((e=>`${e.formula}|${e.summary}`)).join(","),[os.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[os.currentPageName]:1})),[s,r,n]),[b,y]=o().useState(((e,r)=>[{title:f("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...r.map((e=>{const r=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=r?{summation:r}:null;return e.dataIndex===os.groupSummary.total.value&&(n={dataIndex:os.groupSummary.recordTotalIndex,summation:{render:()=>l.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,m)),[v]=o().useState(c?[]:(e=>{const t=fn(e,r.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&rn(t,n,tn(e[0],n))})),n.forEach((r=>{const n=r.summary!==os.groupSummary.total.value?r.summary:os.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&rn(t,n,e.length),"sum"===a&&rn(t,n,(0,te.sumBy)(e,n)),"max"===a&&rn(t,n,(0,te.maxBy)(e,n)[n]),"min"===a&&rn(t,n,(0,te.minBy)(e,n)[n]),"avg"===a&&rn(t,n,((0,te.sumBy)(e,n)/e.length).toFixed(2))})),a.push(t)})),a})(a.current.tableFullData)),x={size:i,height:400,...c?{fetch:{api:d.api,params:g,dataKey:d?.dataKey}}:{dataSource:v},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${u()().format(Yl)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return o().createElement(ad,x)},nc=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:a,flattenColumns:i}=o().useContext(jl),{uniqueKey:l}=n.current.props,s=o().useRef(null),d=o().useRef(null),[u,p]=o().useState(!1),[h,m]=o().useState([]),[g,b]=o().useState(""),[y,x]=o().useState("");Me((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;N(e),k(t)}else{const e=H();N(e?.group||[]),k(e?.summary||[])}}),[y]),o().useEffect((()=>{D()}),[]);const E=o().useMemo((()=>l?`summary_${l}`:""),[l]),S=o().useMemo((()=>i.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex)))),[i]),w=S.filter((e=>!e.groupSummary)).map((e=>({text:pn(e.title),value:e.dataIndex}))),C=[os.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:pn(e.title),value:e.dataIndex})))],T=[{text:f("qm.table.groupSummary.sumText"),value:"sum"},{text:f("qm.table.groupSummary.maxText"),value:"max"},{text:f("qm.table.groupSummary.minText"),value:"min"},{text:f("qm.table.groupSummary.avgText"),value:"avg"},{text:f("qm.table.groupSummary.countText"),value:"count"}],[I,N]=o().useState([]),[R,P]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(be,{type:"text",onClick:()=>{s.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:f("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>({...e,disabled:I.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=o().useState([]),[A,_]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(be,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:f("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>({...e,disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:f("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===os.groupSummary.total.value?T.slice(T.length-1):T})}]),F=o().useMemo((()=>{const e=I.length&&I.every((e=>Object.values(e).every((e=>""!==e)))),t=O.length&&O.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[I,O]),H=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=H();if(e){const{group:t,summary:r}=e;N(t),k(r)}let t=await Qs().getItem(E);t||(t=await $(E),Array.isArray(t)&&await Qs().setItem(E,t)),Array.isArray(t)&&t.length&&(m(t),!e&&x(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ce("table"),j={visible:u,title:f("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return o().createElement("div",{className:`${M}-group-summary__setting`},o().createElement("div",{className:"main"},o().createElement("div",{style:{width:"30%"}},o().createElement(ad,{ref:s,size:a,columns:R,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{N(e)}},o().createElement(be,{type:"primary",icon:o().createElement(Te.PlusOutlined,null),onClick:()=>{s.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"container line"},o().createElement(ad,{ref:d,size:a,columns:A,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onDataChange:e=>{k(e)}},o().createElement(be,{type:"primary",icon:o().createElement(Te.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:a,value:g,placeholder:f("qm.table.groupSummary.configText"),disabled:F,onChange:e=>{const{value:t}=e.target;b(t)}}),o().createElement(be,{type:"primary",disabled:!g||F,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=dn(),t=[...h,{text:g,value:e,list:{group:I.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];m(t),x(e),b(""),await Qs().setItem(E,t),await q(E,t)})()},f("qm.table.groupSummary.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${os.rowHeightMaps[a]}px`}},o().createElement("span",null,f("qm.table.groupSummary.savedSetting"))),o().createElement("ul",null,h.map((e=>o().createElement("li",{key:e.value,className:we()({selected:e.value===y}),title:e.text,onClick:()=>(e=>{x(e!==y?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));m(t),e===y&&x(""),await Qs().setItem(E,t),await q(E,t)})(e.value)}},o().createElement(Te.CloseCircleOutlined,null))))),!h.length&&o().createElement("div",{style:{padding:zl}},o().createElement(ft,null)))))),o().createElement(Cr,j,o().createElement(rc,{columns:S,group:I,summary:O})),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.groupSummary.closeButton")),o().createElement(be,{type:"primary",disabled:F,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:I.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))})),void p(!0))},f("qm.table.groupSummary.confirmButton"))))},ac=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,a]=o().useState(!1),i=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:i})));const l=Ce("table"),s={visible:n,title:f("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-group-summary`,title:f("qm.table.groupSummary.text"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.PieChartOutlined,null))),o().createElement(Cr,s,o().createElement(nc,{onClose:()=>a(!1)})))}));ac.displayName="GroupSummary";const ic=ac,oc=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:a,flattenColumns:i,setSuperFilters:l,clearTableFilter:s}=o().useContext(jl),{uniqueKey:d}=n.current.props,u=o().useRef(null),[p,h]=o().useState([]),[m,g]=o().useState([]),[b,y]=o().useState(""),[x,E]=o().useState("");Me((()=>{h(x?m.find((e=>e.value===x)).list:H()||[])}),[x]),o().useEffect((()=>{D()}),[]);const S=o().useMemo((()=>d?`superSearch_${d}`:""),[d]),w=o().useMemo((()=>i.filter((e=>!!e.filter))),[i]),C=mn(p),T=o().useMemo((()=>!(C&&qr(C))),[C]),I=o().useMemo((()=>!!p.length&&T),[p,T]),N=[{value:"and",text:f("qm.table.highSearch.andText")},{value:"or",text:f("qm.table.highSearch.orText")}],R=i.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:pn(e.title)}))),P=e=>["in","nin"].includes(e),O=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:f("qm.table.highSearch.gtText")},{value:"<",text:f("qm.table.highSearch.ltText")},{value:">=",text:f("qm.table.highSearch.gteText")},{value:"<=",text:f("qm.table.highSearch.lteText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:f("qm.table.highSearch.inText")},{value:"nin",text:f("qm.table.highSearch.ninText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:f("qm.table.highSearch.likeText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}]}return t},[A,_]=o().useState([{title:f("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(be,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},f("qm.table.highSearch.removeText")))},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:f("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=w.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:f("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:f("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:f("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:O(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:N,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),F=()=>{S&&sessionStorage.setItem(S,JSON.stringify(p.filter((e=>!!e.fieldName))))},H=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},D=async()=>{if(!S)return;const e=H();e&&h(e);let t=await Qs().getItem(S);t||(t=await $(S),Array.isArray(t)&&await Qs().setItem(S,t)),Array.isArray(t)&&t.length&&(g(t),!e&&E(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ce("table");return o().createElement("div",{className:`${M}-super-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"container"},o().createElement(ad,{ref:u,size:a,columns:A,dataSource:p,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...p]))},onDataChange:e=>{h(e)}},o().createElement(be,{type:"primary",icon:o().createElement(Te.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),os.highSearch.showSQL&&C&&o().createElement("code",{className:"lang-js"},C)),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:a,value:b,placeholder:f("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;y(t)}}),o().createElement(be,{type:"primary",disabled:!b||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=dn(),t=[...m,{text:b,value:e,list:p.filter((e=>!!e.fieldName))}];g(t),E(e),y(""),await Qs().setItem(S,t),await q(S,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${os.rowHeightMaps[a]}px`}},o().createElement("span",null,f("qm.table.highSearch.savedSetting"))),o().createElement("ul",null,m.map((e=>o().createElement("li",{key:e.value,className:we()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=m.filter((t=>t.value!==e));g(t),e===x&&E(""),await Qs().setItem(S,t),await q(S,t)})(e.value)}},o().createElement(Te.CloseCircleOutlined,null))))),!m.length&&o().createElement("div",{style:{padding:zl}},o().createElement(ft,null)))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.highSearch.closeButton")),o().createElement(be,{type:"primary",disabled:I,onClick:()=>(s(),l(p.map((e=>ue(e,["index","pageIndex"])))),F(),void t())},f("qm.table.highSearch.searchButton"))))},lc=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,a]=o().useState(!1),i=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:i})));const l=Ce("table"),s={visible:n,title:f("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-super-search`,title:f("qm.table.highSearch.text"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.FunnelPlotOutlined,null))),o().createElement(Cr,s,o().createElement(oc,{onClose:()=>a(!1)})))}));lc.displayName="SuperSearch";const sc=lc,cc=o().forwardRef(((e,t)=>{const{tableColumns:r,showFullScreen:n,showReload:a,showPrint:i,showImport:l,showExport:s,showClipboard:d,showCollection:u,showFastSearch:p,showSuperSearch:h,showGroupSummary:m,showToolBox:g}=e,{global:b}=o().useContext(c),{tableRef:y,isFullScreen:x,$size:E}=o().useContext(jl),{uniqueKey:S,exportExcel:w}=y.current.props,C=o().useRef(null),T=o().useRef(null),I=o().useRef(null),N=o().useRef(null),R=o().useRef(null),P=o().useRef(null),O=o().useRef(null),k=o().useRef(null),A=o().useRef(null),_=o().useRef(null),F=o().useRef(!1),H=o().useMemo((()=>S?`toolBox_${S}`:""),[S]),[D,$]=o().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),q={fullScreen:n,reload:a,print:i,import:l,export:s&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:p,superSearch:h,groupSummary:m},[M,j]=o().useState(!1);Me((()=>{F.current&&(V(),F.current=!1)}),[D]),o().useEffect((()=>{K()}),[]),o().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!R.current)return v("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const K=()=>{if(!H||!g)return;const e=JSON.parse(localStorage.getItem(H));e||z(H).then((e=>{e&&($(Object.assign({},D,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&$(Object.assign({},D,e))},V=()=>{if(!H||!g)return;const e={};for(const t in D)D[t]&&(e[t]=D[t]);localStorage.setItem(H,JSON.stringify(e)),B(H,e)},z=async e=>{const t=b?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=b?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},U=async e=>{j(!1),await le(100),e.current.clickHandle()},W=(e,t)=>{F.current=!0,$(Object.assign({},D,{[t]:e}))},G=Ce("table"),Y={"top-toolbox__popper":!0,[`${G}--lg`]:"large"===E,[`${G}--sm`]:"small"===E};return o().createElement(o().Fragment,null,n&&o().createElement(vs,{ref:C,isFullScreen:x,open:!g||D.fullScreen}),a&&o().createElement(Es,{ref:T,open:!g||D.reload}),i&&o().createElement(Cs,{ref:I,tableColumns:r,open:!g||D.print}),l&&o().createElement(qs,{ref:N,tableColumns:r,open:!g||D.import}),s&&o().createElement(Vs,{ref:R,tableColumns:r,open:(!g||D.export)&&!w?.hideIcon}),d&&o().createElement(Us,{ref:P,open:!g||D.clipboard}),u&&o().createElement(Ys,{ref:O,columns:r,open:!g||D.collection}),p&&o().createElement(tc,{ref:k,open:!g||D.fastSearch}),m&&o().createElement(ic,{ref:A,open:!g||D.groupSummary}),h&&o().createElement(sc,{ref:_,open:!g||D.superSearch}),g&&o().createElement(L.Dropdown,{open:M,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.screen.full"))),onClick:()=>U(C)},{key:"reload",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.refresh.text"))),onClick:()=>U(T)},{key:"print",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.print.text"))),onClick:()=>U(I)},{key:"import",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.import.textNoSpace"))),onClick:()=>U(N)},{key:"export",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.export.textNoSpace"))),onClick:()=>U(R)},{key:"clipboard",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.clipboard.textNoSpace"))),onClick:()=>U(P)},{key:"collection",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.selectCollection.text"))),onClick:()=>U(O)},{key:"fastSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.fastSearch.text"))),onClick:()=>U(k)},{key:"groupSummary",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.groupSummary.text"))),onClick:()=>U(A)},{key:"superSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.highSearch.text"))),onClick:()=>U(_)}];return o().createElement(L.Menu,{items:e.filter((e=>q[e.key]))})})(),overlayClassName:we()(Y),overlayStyle:{minWidth:120},onOpenChange:e=>{j(e)}},o().createElement("span",{className:`${G}-toolbox`,title:f("qm.table.toolbox.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.AppstoreAddOutlined,null)))))}));cc.displayName="ToolBox";const dc=cc,uc=(e,t)=>e.map((e=>(e.children&&(e.children=uc(e.children,t)),t(e)))),pc=o().forwardRef(((e,t)=>{const{columns:r}=e,{global:n}=o().useContext(c),{tableRef:a,$size:i}=o().useContext(jl),{showColumnDefine:l,uniqueKey:s,onlyShowIcon:d,columnsChange:u}=a.current.props,p=o().useRef([]),[h,m]=o().useState(!1),g=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),b=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),v=o().useMemo((()=>s?`table_${s}`:""),[s]);Me((()=>{E(r)}),[r]),o().useLayoutEffect((()=>{S()}),[]),o().useImperativeHandle(t,(()=>({initialHandler:S})));const x=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=x(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),{dataIndex:e.dataIndex,...t}})),E=e=>{if(!v)return;const t=x(e),r=JSON.parse(localStorage.getItem(v));a.current.columnsDefined&&!(0,te.isEqual)(t,r)&&(localStorage.setItem(v,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(v,t))},S=()=>{const e=(()=>{if(!v)return;const e=JSON.parse(localStorage.getItem(v));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(v).then((e=>{e?(localStorage.setItem(v,JSON.stringify(e)),S()):n?.getComponentConfigApi&&E(r)})).catch((()=>{})),e?(0,te.xor)(Vr(e).map((e=>e.dataIndex)),Vr(r).map((e=>e.dataIndex))).length>0?uc(r,(t=>{const r=Br(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):uc(e,(e=>{const t=Br(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=w(e),p.current=t,u?.(e))},w=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),t},C=e=>{const t=[];e.forEach((r=>{const{colSpan:n,dataIndex:a}=r;if(0===n)return;if(1===n)return t.push(r);const i=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(r);t.push(...p.current[i].map(((t,n)=>{let{dataIndex:a}=t;const i=e.find((e=>e.dataIndex===a));return n>0&&(void 0!==r.hidden&&(i.hidden=r.hidden),void 0!==r.fixed?i.fixed=r.fixed:i.fixed&&delete i.fixed),i})))})),r.forEach(((e,r)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(r,0,e)})),u?.(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},I=(e,t)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=pn(e.title),l=["svgicon","handle",`${t}-handle`],s=o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,C(r)}}),o().createElement("i",{className:we()(l),title:f("qm.table.columnFilter.draggable")},o().createElement(Te.HolderOutlined,null)),o().createElement("span",{className:"text",title:i},i),"main"===t?o().createElement("span",{className:we()("fixed",a?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},o().createElement(Te.StepBackwardOutlined,null)),o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},o().createElement(Te.StepForwardOutlined,null))):"sub"!==t?o().createElement("span",{className:we()("fixed",a?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},o().createElement(Te.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?o().createElement(L.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:N(e.children,e.dataIndex)},s):s},N=(e,t)=>o().createElement("div",{className:"column-filter--wrap"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:n=>{const a=n.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,te.isEqual)(a,i)||((e,t)=>{Br(r,t).children=e,u?.([...r])})(xn(n),t)}},e.map((e=>I(e,"sub"))))),R=Ce("table"),P={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===i,[`${R}--sm`]:"small"===i},O=[`${R}-column-filter`,{selected:h}];return l?o().createElement(Xa(),{action:["click"],popupVisible:h,popup:o().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"reset"},o().createElement(be,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const n=Br(r,t.dataIndex)||pe(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));u?.(e(a.current.originColumns))}},f("qm.table.columnFilter.reset"))),o().createElement("div",{className:"left"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),r=g.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||C([...xn(e),...y,...b])}},g.map((e=>I(e,"left"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"main"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||C([...g,...xn(e),...b])}},y.map((e=>I(e,"main"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"right"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),r=b.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||C([...g,...y,...xn(e)])}},b.map((e=>I(e,"right")))))),popupClassName:we()(P),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{m(e)},builtinPlacements:Xl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:we()(O),title:d?f("qm.table.columnFilter.text"):void 0},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.SettingOutlined,null)),!d&&o().createElement("span",null,f("qm.table.columnFilter.text")))):null}));pc.displayName="ColumnFilter";const hc=pc,mc=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"}));function fc(){return fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fc.apply(this,arguments)}const gc=e=>{const{column:t,filters:r}=e,{$size:n,setFilters:a,clearSuperFilters:i}=o().useContext(jl),l=o().useRef(null),s=o().useRef(null),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!1),[m,g]=o().useState({}),b=o().useMemo((()=>{const{dataIndex:e,filter:r}=t;return`${e}|${r.type}`}),[t]),y=o().useMemo((()=>{let e=!1;for(const t in r[b])if(!de(r[b][t])||p){e=!0;break}return e}),[b,r,p]);o().useLayoutEffect((()=>{d&&setTimeout((()=>x()),20)}),[d]),o().useEffect((()=>{(0,te.isEqual)(m[b],r[b])||g({[b]:r[b]||{}}),h(""===r[b]?.["=="])}),[r]);const x=()=>{switch(t.filter.type){case"text":l.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&g(e),i(),a((e=>{for(const t in e){for(const r in e[t])if(de(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...r,...m,...e})),u(!1)},S={text:e=>o().createElement(o().Fragment,null,o().createElement(L.Input,{ref:l,size:n,placeholder:f("qm.table.filter.searchText",{text:pn(e.title)}),style:{width:"180px"},value:m[b]?.like??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),textarea:e=>o().createElement(o().Fragment,null,o().createElement(L.Input.TextArea,{ref:c,size:n,placeholder:f("qm.table.filter.searchAreaText",{text:pn(e.title)}),style:{width:"220px"},value:m[b]?.likes??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:m[b]?.[e]??"",size:n,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(L.InputNumber,fc({ref:s},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(L.InputNumber,fc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(L.InputNumber,fc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(L.InputNumber,fc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:sn(m[b]?.[e],Wl),format:Wl,size:n,onChange:t=>{g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:cn(t,Wl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(j,fc({},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(j,fc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(j,fc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(j,fc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Radio.Group,{style:{width:"100%"},value:m[b]?.["=="],onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{"==":t}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Checkbox.Group,{style:{width:"100%"},value:m[b]?.in,onChange:e=>{g((t=>Object.assign({},t,{[b]:{in:e}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("div",{style:{height:200,...t.style}},o().createElement(Ml,{multiple:!0,value:m[b]?.in||[],dataSource:n,onCheckChange:e=>{const t=e.map((e=>e.value));g((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},w=Ce("table"),C={"head-filter__popper":!0,[`${w}--lg`]:"large"===n,[`${w}--sm`]:"small"===n},T=["cell--filter",{selected:d,actived:y}];return o().createElement(Xa(),{action:["click"],popupVisible:d,popup:(()=>{const e=t.filter.type,r=S[e];return r?o().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},o().createElement("div",null,r(t)),o().createElement(L.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},o().createElement(be,{size:n,onClick:()=>(E({[b]:{}}),void h(!1))},f("qm.table.filter.reset")),o().createElement(be,{type:"primary",size:n,onClick:()=>E()},f("qm.table.filter.search")))):(v("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:we()(C),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:Xl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("div",{className:we()(T),title:f("qm.table.filter.text"),onClick:e=>e.stopPropagation()},o().createElement("span",{className:"svgicon icon"},o().createElement(mc,null))))},bc=e=>{const{column:t}=e,{tableRef:r,bordered:n}=o().useContext(jl),{columns:a,resizable:i,columnsChange:l=ie}=r.current.props,s=o().useMemo((()=>Wr(t)),[t]),c={resizable:!0,"is--line":i&&!n};return o().createElement("div",{className:we()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,i=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Zr(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,r=u+t;r<(s.minWidth||os.defaultColumnWidth)||(p=Math.floor(r),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&&(Br(a,s.dataIndex).width=p,l([...a]))},!1}})},yc=e=>{const{selectionKeys:t}=e,{tableRef:r,getRowKey:n,fetchParams:a,createWebPageData:i,setSelectionKeysEffect:l,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=o().useContext(jl),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:g,onSelectAll:b}=p,y=o().useRef([]),v=o().useMemo((()=>d&&!!h),[d,h]),x=o().useMemo((()=>!v&&!!m),[v,m]),E=o().useMemo((()=>(g??!0)&&!x),[g,x]),S=()=>u?i():r.current.tableFullData,w=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>n(e,e.index)))},C=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:a}=p;if(v)return y.current.length?y.current:(0,te.union)(t,w());if(!x)return a?t.filter((t=>!a(e.get(t)))):t;const i=a?S().filter((e=>!a(e))).map((e=>n(e,e.index))):S().map((e=>n(e,e.index)));return(0,te.union)(i,w())})(),T=t.filter((e=>!C.includes(e))),I=t.length-T.length,N=I>0&&I<C.length,R=!!I&&I===C.length;s(T);const P=async()=>{const e=h;let t=[];c(!0);try{const r=await e.api(a);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,te.get)(r.data,e.dataKey)??[];const{disabled:a}=p;a&&(t=(0,te.xor)(t,S().filter((e=>a(e))).map((e=>n(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},O=async e=>{let t=[];t=v?e?await P():[]:e?C.slice(0):[],t=[...new Set([...t,...T])],l(t),b?.(e,t)};return o().createElement("div",{className:"cell--selection"},o().createElement(L.Checkbox,{checked:R,indeterminate:N,disabled:!C.length,onChange:e=>O(e.target.checked)}),E&&o().createElement(L.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:f("qm.table.selection.all"),onClick:()=>{O(!0)}},{key:2,label:f("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,te.xor)(t,await P()):(0,te.xor)(t,C),e=[...new Set([...e,...T])],l(e)})()},{key:3,label:f("qm.table.selection.clear"),onClick:()=>{O(!1)}}];return o().createElement(L.Menu,{items:e})})()},o().createElement(Te.DownOutlined,{className:"svgicon icon"})),x&&o().createElement(L.Tooltip,{placement:"top",title:f("qm.table.selection.currentPage")},o().createElement(Te.InfoCircleOutlined,{className:"info"})))},vc=e=>{const{style:t}=e,{tableRef:r,isTreeTable:n,setRowExpandedKeys:a}=o().useContext(jl),{expandable:i}=r.current.props,[l,s]=o().useState(i?.defaultExpandAllRows||!1);Me((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;a(l?e.filter((e=>!(n&&t.includes(e)))):[])}),[l]);const c=Ce("expand"),d={[`${c}--icon`]:!0,expanded:l,collapsed:!l};return o().createElement("span",{className:we()(d),title:"",onClick:e=>{e.stopPropagation(),s(!l)},style:t})},xc=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Ec=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Sc=e=>{const{tableColumns:t,sorter:r,filters:n}=e,{tableRef:a,layout:i,scrollY:l,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:h,isTreeTable:m,isGroupSubtotal:g,tableChange:b,setSorter:y,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:S,createGroupData:w,createTableFullData:C}=o().useContext(jl),{ellipsis:T,resizable:I,multipleSort:N,rowSelection:R,expandable:P}=a.current.props,[O,k]=os.sortDirections,{tableOriginData:A}=a.current,_=o().useRef(null),F=o().useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),H=o().useMemo((()=>!h),[h]),D=o().useMemo((()=>!h),[h]),$=o().useMemo((()=>!P?.hideExpandAll),[P]),q=o().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);Me((()=>{B(),b(),x()}),[r]),Me((()=>{G(),b(),x()}),[n]),Me((()=>{G(),b(),x()}),[c]),o().useEffect((()=>{!de(r)&&se((()=>B())),!de(n)&&se((()=>G()))}),[]),o().useLayoutEffect((()=>{M()}),[]);const M=()=>{v("$header",_.current)},j=e=>{const{dataIndex:t,type:n,sorter:a,title:i,description:l}=e;if(t===os.selectionColumn&&"checkbox"===n){if("checkbox"===n)return o().createElement("div",{className:"cell"},q?o().createElement(yc,{selectionKeys:d}):f("qm.table.config.selectionText"));if("radio"===n)return o().createElement("div",{className:"cell"},i)}const s=[];return s.push(o().createElement("div",{key:0,className:"cell",title:pn(i)},m&&t===p&&$?o().createElement(vc,null):null,t===os.expandableColumn&&$?o().createElement(vc,null):i)),l&&s.push(o().createElement(L.Tooltip,{key:1,placement:"top",title:l},o().createElement(Te.InfoCircleOutlined,{className:"tip"}))),a&&s.push(K(r[t])),s},K=e=>{const t=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return o().createElement("div",{key:2,className:"cell--sorter",title:f("qm.table.sorter.text")},o().createElement("span",{className:we()(t)},o().createElement(xc,null)),o().createElement("span",{className:we()(r)},o().createElement(Ec,null)))},V=e=>o().createElement(gc,{column:e,filters:n}),z=(e,t)=>{const{sorter:n,dataIndex:a}=t;if(n){const e=r[a],t=e?e===k?null:k:O;N?(delete r[a],y(Object.assign({},r,{[a]:t}))):y(Object.assign({},{[a]:t}))}},B=()=>{H&&U()},U=e=>{const t=(0,te.pickBy)(r,(e=>null!==e));for(const e in t){const r=s.find((t=>t.dataIndex===e));r?W(r,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},O)},W=(e,t)=>{const{tableFullData:r}=a.current,{dataIndex:n,sorter:i}=e,o=(e,r)=>{const a=tn(e,n),i=tn(r,n);return Number.isNaN(a-i)?t===O?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===O?a-i:i-a},l=g?w(hn(r).sort("function"==typeof i?i:o)):r.sort("function"==typeof i?i:o).slice(0);C(l)},G=()=>{D&&Y()},Y=()=>{const e=c.length?mn(c):mn(n),t=""!==e?g?w(Mr(hn(A),e,F)):Mr(A,e,F):A;C(t),U(!0)},X=Qr(t),Q=Ce("table"),{tableBodyWidth:Z}=i;return o().createElement("div",{ref:_,className:`${Q}--header-wrapper`},o().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=i;return o().createElement("colgroup",null,s.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),l&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("thead",null,(e=>{const{isIE:t}=a.current,n=["gutter",{"cell-fix-right":!!u.length}],s=t?null:{right:u.length?0:""};return e.map(((e,t)=>o().createElement("tr",{key:t,className:"header--row"},e.map(((t,n)=>((e,t,n)=>{const{isIE:s}=a.current,{gutterWidth:c}=i,{dataIndex:d,colSpan:u,rowSpan:p,fixed:h,align:m,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===u)return null;const w=f||m,C=["header--column",{"col--ellipsis":e.ellipsis??T,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!r[d],"cell-fix-left":!s&&"left"===h,"cell-fix-right":!s&&"right"===h,"cell-fix-left-last":!s&&"left"===h&&!n[t+(u??1)]?.fixed,"cell-fix-right-first":!s&&"right"===h&&!n[t-1]?.fixed,[g]:!!g}],N=s?null:{left:"left"===h?`${E(d)}px`:"",right:"right"===h?`${S(d,"thead")+(l?c:0)}px`:""},R=I&&![os.expandableColumn,os.selectionColumn].includes(d);return o().createElement("th",{key:d,className:we()(C),colSpan:u,rowSpan:p,style:{...N},onClick:t=>z(t,e)},o().createElement("div",{className:"cell--wrapper"},x?o().createElement("div",{className:"cell--text cell"},x(e,a.current.tableFullData)):o().createElement(o().Fragment,null,o().createElement("div",{className:"cell--text"},j(e)),y?V(e):null)),R&&o().createElement(bc,{column:e}))})(t,n,e))),l&&o().createElement("th",{className:we()(n),style:{...s}}))))})(X))))},wc=o().createContext([]),Cc=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Tc=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),Ic=(e,t)=>{const r=e.target;return!("button"in e&&e.button>0||r&&!Cc(r).contains(r)||t.current?.contains(r))};function Nc(e){let{ref:t,handler:r,enabled:n=!0,omitClassNames:a=[]}=e;const o=Zl(r),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!n)return;const e=e=>{Ic(e,t)&&(l.current.isPointerDown=!0)},i=e=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:r&&l.current.isPointerDown&&Ic(e,t)&&Tc(e,a)&&(l.current.isPointerDown=!1,o(e))},s=e=>{l.current.ignoreEmulatedMouseEvents=!0,r&&l.current.isPointerDown&&Ic(e,t)&&Tc(e,a)&&(l.current.isPointerDown=!1,o(e))},c=Cc(t.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",i,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",i,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[r,t,o,l,n])}function Rc(){const[,e]=i.useReducer((e=>e+1),0);return e}function Pc(){const{locale:e}=i.useContext(c);return{t:f,$locale:e}}const Oc=e=>{const{selectionKeys:t,column:r,record:n,rowKey:a}=e,{tableRef:i,isTreeTable:l,getAllChildRowKeys:s}=o().useContext(jl),{rowSelection:c}=i.current.props,d=o().useMemo((()=>r.type||""),[r.type]),u=e=>{const r=c.checkStrictly??!0;if(!l||r)return!1;const n=Yr(i.current.deriveRowKeys,e);return((e,t)=>{const r=new Set(t);let n=!1,a=!1;for(const t of e)if(r.has(t)?n=!0:a=!0,n&&a)break;return n&&a})(s(n?.children??[]),t)};return"radio"===d?(()=>{const e=c.disabled,r=e?.(n),i=!r&&t[0]===a;return o().createElement(L.Radio,{checked:i,disabled:r})})():(()=>{const e=c.disabled,r=e?.(n),i=!!t.includes(a);return o().createElement(L.Checkbox,{checked:i,indeterminate:u(a),disabled:r})})()},kc=e=>{const{record:t,rowKey:r,style:n}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:l}=o().useContext(jl),{expandable:s={}}=a.current.props,[c]=o().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=o().useMemo((()=>i.includes(r)),[i,r]);Me((()=>{s.onExpand?.(d,t)}),[d]);const u=Ce("expand"),p={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return o().createElement("span",{className:we()(p),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==r)):[...i,r];l(t)},style:n})},Ac=o().forwardRef(((e,t)=>{const{size:r,defaultValue:n,value:a,min:i,max:l,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>l&&(t=l.toString()),t&&Number(t)<i&&(t=i.toString()),p>=0&&""!==t&&(t=new(Pa())(t).toFixed(p)),t},E=void 0!==a,[S,w]=o().useState(n??""),C=b(E?a:S),T=y(C);return Me((()=>{e.onChange?.(T)}),[S]),o().createElement(L.Input,{ref:t,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),i>=0&&r.startsWith("-")&&(n=!1),n){if(!h&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):w(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(T);e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ac.displayName="InputNumber";const Lc=Ac;function _c(){return _c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_c.apply(this,arguments)}const{Search:Fc}=L.Input,Hc=o().forwardRef(((e,t)=>{const{column:r,record:n,rowKey:a,columnKey:i}=e,{tableRef:l,tableBodyRef:s,$size:c,flattenColumns:d,updateTableData:u,doFieldValidate:p,dataChange:h}=o().useContext(jl),m=o().useContext(wc),g=Rc(),{store:b,fieldAuth:y}=l.current,x=r.editRender?.(n,r)||{},E=o().useRef(null),S=o().useRef(null),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),I=o().useRef(!1),N=o().useRef({}),R=o().useRef({}),P=o().useRef([]),[O,k]=o().useState(!1),[A,_]=o().useState(!1),[F,H]=o().useState(!1),[D,$]=o().useState(x.items||[]),[q,M]=o().useState(),K=(x.editable||(0,te.isEqual)(m,[a,i]))&&!x.disabled&&!y[i]?.disabled,V=`${a}|${i}`,z=2===m.length?`${m[0]}|${m[1]}`:"",U=![...b.state.required,...b.state.validate].some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),W=b.state.required.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",G=b.state.validate.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",Y=b.state.edited.some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),X=K||!U||O||F||A,Q=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");o().useLayoutEffect((()=>{X&&z===V&&ne()}),[m]),o().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&re(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const J=()=>{u(),h()},ee=(e,t)=>{k(e),t?.()},re=e=>{P.current=e},ne=()=>{const{type:e}=x;switch(e){case"text":S.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":T.current?.focus()}};o().useImperativeHandle(t,(()=>({focus:ne})));const ae=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},ie=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};b.addToUpdated(e),n&&b.addToEdited({x:t,y:r})},le=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",ce={text:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onInput:u,onChange:h,onEnter:m,onBlur:b}=x,y=tn(e,n),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=r?{rows:v.minRows,autoSize:v}:null,w=s.password?L.Input.Password:r?L.Input.TextArea:L.Input;return o().createElement(w,_c({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||f("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";rn(e,n,r),p(d,r,a,i),g(),u?.({[V]:r}),I.current=!0},onFocus:()=>_(!0),onBlur:t=>{_(!1);const r=t.target.value??"";I.current&&(I.current=!1,ie(e,a,i),h?.({[V]:r},e),b?.({[V]:r},e),J())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";m?.({[V]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&m&&e.preventDefault()}}))},textarea:(e,t)=>ce.text(e,t,!0),number:(e,t)=>{const{dataIndex:r,precision:n,formatType:l}=t,{type:s,extra:d={},rules:u=[],onInput:h,onChange:m,onEnter:b,onBlur:y}=x,v=tn(e,r);let E,S;return"finance"===l&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===l&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Pa())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Pa())(e).times(.01).toString()),o().createElement(Lc,{ref:w,size:c,value:v,min:d.min,max:d.max,precision:n,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===l?"%":void 0),placeholder:d.placeholder||f("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:S,onChange:t=>{rn(e,r,t),p(u,t,a,i),g(),h?.({[V]:t}),I.current=!0},onFocus:()=>_(!0),onBlur:(t,n)=>{if(_(!1),!I.current)return;I.current=!1;let o=d.stringMode?t:le(t);"percent"===l&&"."===n.charAt(n.length-1)&&(o=Number(t)/100),rn(e,r,o),ie(e,a,i),m?.({[V]:o},e),y?.({[V]:o},e),J()},onEnter:(t,r)=>{let n=d.stringMode?t:le(t);"percent"===l&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),b?.({[V]:n},e)}})},select:(e,t,r)=>{const{dataIndex:n,dictItems:l=[]}=t,{type:s,extra:d={},rules:u=[],items:h,onChange:m,onEnter:g}=x,b=h||l,y=tn(e,n);let v=y;return o().createElement(L.Select,{mode:r?"multiple":void 0,size:c,popupClassName:"table-editable__popper",value:y||void 0,placeholder:d.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{rn(e,n,t),p(u,t,a,i),ie(e,a,i),m?.({[V]:t},e),J()},onSelect:e=>{v=e},onInputKeyDown:t=>{13===t.keyCode&&se((()=>g?.({[V]:v},e)))}},b.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ce.select(e,t,!0),date:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onChange:u}=x,h=r||"exactdate",m=tn(e,n);return o().createElement(j,{size:c,popupClassName:"table-editable__popper",value:sn(m,Rn[h])??void 0,picker:Nn[h],format:s.format,showTime:"datetime"===h,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=cn(t,Rn[h]);rn(e,n,r),p(d,r,a,i),ie(e,a,i),u?.({[V]:r},e),J()}})},datetime:(e,t)=>ce.date(e,t,"datetime"),month:(e,t)=>ce.date(e,t,"month"),year:(e,t)=>ce.date(e,t,"year"),time:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:d}=x,u="HH:mm:ss",h=tn(e,r);return o().createElement(B,{size:c,popupClassName:"table-editable__popper",value:sn(h,u)??void 0,format:l.format||u,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=cn(t,u);rn(e,r,n),p(s,n,a,i),ie(e,a,i),d?.({[V]:n},e),J()}})},checkbox:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=Bl,falseValue:u=Ul,disabled:h}=l,m=tn(e,r);return o().createElement(L.Checkbox,{checked:m===d,disabled:h,onChange:t=>{const n=t.target.checked?d:u;rn(e,r,n),p(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},switch:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=Bl,falseValue:u=Ul,disabled:h}=l,m=tn(e,r);return o().createElement(L.Switch,{checked:m===d,disabled:h,onChange:t=>{const n=t?d:u;rn(e,r,n),p(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},"search-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onInput:m,onChange:g,onEnter:b}=x,y=nn(e,Q?h.combinedDataIndex:r),S=h.fieldAliasMap;S||v("Table","helper 需要配置 `fieldAliasMap` 选项");const w="function"==typeof S?S():S||{};Object.keys(w).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(w).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),w[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const T=e=>{const{filterAliasMap:t}=h,n=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[r]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,te.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i},R=e=>{const{autoQueryAssign:t=!0}=h;t&&(N.current=T(e)),k(!0)},P=(r,n)=>{const{beforeOpen:a}=h,i=(a??oe)({[V]:y},e,t);i?.then?i.then((()=>{R(r),n?.()})).catch((()=>{})):!1!==i&&(R(r),n?.())},A=e=>{const t={};for(const n in w){const a=w[n];n!==r&&(t[n]=nn(e,a))}const n=w[r]?nn(e,w[r]):"";_(n,t);const{closed:a}=h;ee(!1,(()=>ae(E.current))),ne(),a?.(e)},L=()=>{const{onlySelect:e=!0}=h;I.current&&_(e?"":y),ee(!1,(()=>ae(E.current)))},_=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,te.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){rn(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&p(i.rules,r,a,t)}else rn(e,t,r)}Q&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return rn(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&rn(e,t,a[r]?.trim())}))})(e,h.combinedDataIndex),rn(e,r,t,n),p(u,t,a,i),ie(e,a,i),g?.({[V]:t},e),J(),N.current={},I.current=!1,M(void 0)},F={visible:O,title:f("qm.searchHelper.text"),width:h.width??"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{L()}},D={...h,size:c,initialValue:Object.assign({},N.current,h.initialValue),onClose:e=>{e?A(e):L()}};return o().createElement(o().Fragment,null,o().createElement(Fc,{ref:C,value:q??y,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=h;if(I.current&&!O)return t&&n&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=h,{beforeFetch:n=oe}=t.fetch;return new Promise((async(a,i)=>{const o=(0,te.merge)({},t.fetch.params,{...r,...T(e)},{currentPage:1,pageSize:500});if(!n(o))return i();H(!0);try{const e=await t.fetch.api(o);200===e.code?a(Array.isArray(e.data)?e.data:(0,te.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{se((()=>H(!1)))}}))})(t).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=>nn(t,w[r]).toString().includes(e)));if(1===t.length)return A(t[0]);P(e)}(e,t))).catch((()=>_(""))):void _(t)},onChange:e=>{const{value:t}=e.target;m?.({[V]:t}),I.current=!0,M(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";b?.({[V]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;P(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&P(e)}}),o().createElement(Cr,F,o().createElement(sd,D)))},"search-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,items:l=[],extra:s={},rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=tn(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,a=(n??oe)({[V]:b},e,t);a?.then?a.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==a&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ae(E.current)))},T=t=>{rn(e,r,t),p(d,t,a,i),ie(e,a,i),m?.({[V]:t},e,P.current),J()},I={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{C()}},N={...u,size:c,multiple:!0,initialValue:(0,te.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=S;re((0,te.uniqBy)([...P.current.filter((e=>t.includes(e[n]))),...e],n));const a=P.current.map((e=>({text:e[r],value:e[n]}))),i=(0,te.uniqBy)([...a,...l],"value").filter((e=>t.includes(e.value)));$(i),T(i.map((e=>e.value)));const{closed:o}=u;ee(!1,(()=>ae(E.current))),o?.(P.current)})(e,t):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&g?.({[V]:b},e)},onDoubleClick:()=>{s.disabled||w()},onChange:e=>{const{valueKey:t}=S;re(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(Cr,I,o().createElement(sd,N)))},"tree-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onChange:m,onEnter:g}=x,b=nn(e,Q?h.combinedDataIndex:r),y=h.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=r=>{const{beforeOpen:n}=h,a=(n??oe)({[V]:b},e,t);a?.then?a.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==a&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ae(E.current)))},I=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,te.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){rn(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&p(i.rules,r,a,t)}else rn(e,t,r)}rn(e,r,t,n),p(u,t,a,i),ie(e,a,i),m?.({[V]:t},e),J()},N={visible:O,title:f("qm.searchHelper.text"),width:h.width??"30%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{C()}},R={...h,defaultSelectedKeys:[b],size:c,onClose:e=>{e?(e=>{const t={};for(const n in S){const a=S[n];n!==r&&(t[n]=nn(e,a))}const n=S[r]?nn(e,S[r]):"";I(n,t);const{closed:a}=h;ee(!1,(()=>ae(E.current))),ne(),a?.(e)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement(Fc,{ref:T,value:b,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";g?.({[V]:r},e)}},onDoubleClick:()=>{w()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?w():I(""))}}),o().createElement(Cr,N,o().createElement(gd,R)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},items:s=[],rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=tn(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,a=(n??oe)({[V]:b},e,t);a?.then?a.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==a&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ae(E.current)))},T=t=>{rn(e,r,t),p(d,t,a,i),ie(e,a,i),m?.({[V]:t},e,P.current),J()},I={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{C()}},N={...u,size:c,multiple:!0,initialValue:(0,te.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=S;re(e);const n=P.current.map((e=>({text:e[t],value:e[r]})));$(n),T(n.map((e=>e.value)));const{closed:a}=u;ee(!1,(()=>ae(E.current))),a?.(P.current)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:l.placeholder||f("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&&g?.({[V]:b},e)},onDoubleClick:()=>{l.disabled||w()},onChange:e=>{const{valueKey:t}=S;re(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:l.disabled,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(Cr,I,o().createElement(gd,N)))}};return o().createElement(o().Fragment,null,X?(()=>{const{type:e}=x,t=ce[e];if(!t)return v("Table","单元格编辑的类型 `type` 配置不正确"),null;const a=["cell--edit",{"is-error":!U}];return o().createElement("div",{ref:E,className:we()(a)},t(n,r),!U&&o().createElement("div",{className:"cell-error"},W||G))})():(()=>{const{extra:t={}}=x;return o().createElement("span",{style:{color:t.disabledColor}},e.children)})(),Y&&o().createElement("i",{className:"cell--sign"}))}));Hc.displayName="CellEdit";const Dc=Hc,$c=require("copy-to-clipboard");var qc=n.n($c);const Mc=function(e){if(!o().isValidElement(e))return null;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o().cloneElement(e,...r)},jc=e=>{const{text:t,options:r,showMessage:n=!0,onCopy:a}=e;return Mc(e.children,{onClick:i=>{const l=o().Children.only(e.children),s=qc()(t,r);a?.(t,s),s&&n&&L.message.success(f("qm.clipboard.success")),l&&l.props&&"function"==typeof l.props.onClick&&l.props.onClick(i)}})};jc.displayName="QmCopyToClipboard";const Kc=jc,Vc=o().forwardRef(((e,t)=>{const{column:r,row:n,rowIndex:a,columnIndex:l,rowKey:s,showTitle:c}=e,{selectionKeys:d,treeExpandIndex:u,updateMark:p,isTreeTable:h}=o().useContext(jl),{dataIndex:m,canCopy:f,render:g,editRender:b,shouldCellUpdate:y}=r,{t:v}=Pc(),{renderText:x,getTitleFromCellNode:E}=Ss(),S=o().useRef(null),w=tn(n,m),[C,T]=function(e,c,d){const u=i.useRef({});return"value"in u.current&&!((e,t)=>{if(y){const[,r]=e,[,a]=t;return y(a,r,n)}return m===os.operationColumn||!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=new Set;return function e(t,a){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n.has(t))return!1;if(t===a)return!0;if(r&&i>1)return!1;n.add(t);const o=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],a[r],o))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const r=Object.keys(t);return r.length===Object.keys(a).length&&r.every((r=>e(t[r],a[r],o)))}return!1}(e,t)}(e,t,!0)})(u.current.condition,c)||(u.current.value=(()=>{const e=g?g(w,n,r,a,l):x(w,r,n);return[e,b?o().createElement(Dc,{ref:t,column:r,record:n,rowKey:s,columnKey:m},e):null]})(),u.current.condition=c),u.current.value}(0,[p,n,w,g,b]);o().useEffect((()=>{if([os.expandableColumn,os.selectionColumn,os.operationColumn].includes(m))return;const e=S.current.parentNode;c?e.title=E(C):e.removeAttribute("title")}),[c,C]);const I=e=>Array.isArray(e.children);return o().createElement("div",{ref:S,className:"cell"},(()=>{if(m===os.expandableColumn)return o().createElement(kc,{record:n,rowKey:s});if(m===os.selectionColumn)return o().createElement(Oc,{selectionKeys:d,column:r,record:n,rowKey:s});if(T)return T;if(h&&m===u)return o().createElement(o().Fragment,null,(e=n._level)?o().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*os.treeTable.textIndent+"px"}}):null,o().createElement(kc,{key:"expand",record:n,rowKey:s,style:I(n)?{}:{visibility:"hidden"}}),C);var e;if(f){const e=E(C);return o().createElement("div",{className:"cell--copy"},o().createElement("span",{className:"text"},C),e&&o().createElement(Kc,{text:e},o().createElement(Te.CopyOutlined,{className:"icon",title:v("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return C})())}));Vc.displayName="Cell";const zc=Vc,Bc={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},Uc={open:!1,offsetX:0,offsetY:0},Wc=o().forwardRef(((e,t)=>{const{tableRef:r,getRowKey:n,flattenColumns:a,mergedTdCells:i,setMergedCells:l}=o().useContext(jl),{areaSelection:s={}}=r.current.props,{elementStore:c,tableFlatData:d}=r.current,{t:u}=Pc(),p=o().useRef(document.onselectstart),h=o().useRef(null),m=o().useRef(null),[f,g]=o().useState(null),[b,y]=o().useState(null),[v,x]=o().useState(null);Nc({ref:h,handler:()=>D()});const E=o().useRef(Bc),S=e=>{E.current=Object.assign({},E.current,e)};o().useEffect((()=>{const e=Qt()(c.$tableBody,"mousedown",k),t=Qt()(c.$tableBody,"contextmenu",P),r=Qt()(document,"keydown",O);return()=>{e.remove(),t.remove(),r.remove()}}),[]);const w=()=>{g(null),y(null),x(null)};o().useImperativeHandle(t,(()=>({blur:w})));const C=()=>c.$tableBody.parentNode,T=e=>{const{offsetLeft:t,offsetTop:r,offsetWidth:n,offsetHeight:a}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:r,w:n,h:a}},I=Ot(((e,t)=>{let r=null;const n=c.$tableBody.querySelectorAll("tbody > tr");for(let a=0;a<n.length;a++){if(n[a].offsetTop>t||n[a].offsetTop+n[a].offsetHeight<t)continue;const i=n[a].querySelectorAll("td");for(let t=0;t<i.length;t++)if(!(i[t].offsetLeft>e||i[t].offsetLeft+i[t].offsetWidth<e)){r=i[t];break}break}r&&y(T(r))}),5),N=Zl((()=>{const e=[];if(!f||!b)return e;const[t,r]=[f.colIndex,b.colIndex],[i,o]=[f.rowKey,b.rowKey];let[l,s]=[0,0];for(let e=0;e<d.length;e++){const t=n(d[e],d[e].index);if(t==i&&(l=e),t==o){s=e;break}}const c=a.slice(Math.min(t,r),Math.max(t,r)+1);return d.slice(l,s+1).forEach((t=>{for(let r=0;r<c.length;r++){const{dataIndex:a}=c[r];e.push({rowKey:n(t,t.index),dataIndex:a,cellValue:tn(t,a)})}})),e})),R=e=>{l(e),s.onCellMerge?.(e),se((()=>w()))},P=Zl((e=>{s.cellMerge&&f&&F(e.clientX,e.clientY)?(e.preventDefault(),H(e)):v?.open&&D()})),O=e=>{27===e.keyCode&&w()},k=Zl((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[r,n]=[c.$tableBody.getBoundingClientRect().top,C().getBoundingClientRect().left],{offsetWidth:a,offsetHeight:i}=C();S({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-n,startOffsetY:e.clientY-r,containerSizeX:a,containerSizeY:i}),document.addEventListener("mousemove",A),document.addEventListener("mouseup",L),p.current=document.onselectstart,document.onselectstart=()=>!1})),A=e=>{const t=e.clientX-E.current.startX,r=e.clientY-E.current.startY,n=E.current.startOffsetX+t,a=E.current.startOffsetY+r;I(Math.min(n,E.current.containerSizeX),Math.min(a,E.current.containerSizeY))},L=()=>{S(Bc),s.onSelectChange?.(N()),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",L),_()},_=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},F=(e,t)=>{const{top:r,left:n}=C().getBoundingClientRect(),[a,i]=[e-n,t-r],{el:o,et:l,ew:s,eh:c}=M();return!(a<o||a>o+s||i<l||i>l+c)},H=e=>{const{top:t,left:r,height:n}=m.current.getBoundingClientRect();x({open:!0,offsetX:e.clientX-r,offsetY:-1*(n-(e.clientY-t))})},D=()=>{x((e=>({...e,open:!1})))},$=()=>{if(!f||!b||(t=b,(e=f).rowKey===t.rowKey&&e.colIndex===t.colIndex))return w();var e,t;const[r,o]=f.t<=b.t?[f.rowKey,b.rowKey]:[b.rowKey,f.rowKey],[l,s]=[f.colIndex,b.colIndex];let[c,u]=[0,0],p=r;for(let e=0;e<d.length;e++){const t=d[e],a=n(t,t.index);if(a==r&&(p=a,c=e),a==o){u=e;break}}const h={rowKey:p,dataIndex:a[Math.min(l,s)].dataIndex,rowSpan:u-c+1,colSpan:Math.abs(s-l+1)};R([...i.filter((e=>!(e.rowKey===h.rowKey&&e.dataIndex===h.dataIndex))),h])},q=()=>{let e=f.rowKey;const t=f.colIndex;for(let t=0;t<d.length;t++){const r=d[t],a=n(r,r.index);if(a==e){e=a;break}}const r=e,o=a[t].dataIndex;R(i.filter((e=>!(e.rowKey===r&&e.dataIndex===o))))},M=()=>{const{w:e,h:t,l:r,t:n}=f;let{w:a,h:i,l:o,t:l}=b;return a=o-r>0?o-r+a:Math.abs(o-r)+e,i=l-n>0?l-n+i:Math.abs(l-n)+t,o=o>r?r:o,l=l>n?n:l,{sl:r,st:n,sw:e,sh:t,el:o,et:l,ew:a,eh:i}},j=Ce("table");return o().createElement("div",{className:`${j}--area-select`},(()=>{if(!f||!b)return null;const{sl:e,st:t,sw:r,sh:n,el:a,et:i,ew:l,eh:s}=M(),{open:c,offsetX:d,offsetY:p}=v||Uc,g=o().createElement("ul",{ref:h,className:"ant-dropdown-menu"},o().createElement("li",{className:"ant-dropdown-menu-item",onClick:$},u("qm.table.areaSelect.mergeCell")),o().createElement("li",{className:"ant-dropdown-menu-item",onClick:q},u("qm.table.areaSelect.cancelMerge")));return o().createElement(o().Fragment,null,o().createElement("div",{className:"active-area",style:{left:e,top:t,width:r,height:n}}),o().createElement(Xa(),{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}}}},o().createElement("div",{ref:m,className:"checked-area",style:{left:a,top:i,width:l,height:s}})))})())}));Wc.displayName="AreaSelect";const Gc=Wc,Yc=o().forwardRef(((e,t)=>{const{tableFlatColumns:r,tableData:n}=e,{getRowKey:a,tableRef:i,flattenColumns:l,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:h,showFooter:m,scrollX:f,scrollY:g,selectionKeys:b,rowExpandedKeys:y,highlightKey:v,isPingLeft:x,isPingRight:E,isTableEmpty:S,isTreeTable:w,isGroupSubtotal:C,isWebPagination:T,setElementStore:I,createTableFullData:N,setSelectionKeysEffect:R,setHighlightKey:P,getStickyLeft:O,getStickyRight:k,scrollXToColumn:A,scrollYToRecord:L,rowInViewport:_,dataChange:F,setPingLeft:H,setPingRight:D,setFullScreen:$,findParentRowKeys:q,getAllChildRowKeys:M,triggerScrollXEvent:j,triggerScrollYEvent:K,scrollBottomDebouncer:V}=o().useContext(jl),{height:z,minHeight:B,maxHeight:U,rowHeight:W,rowSelection:G,rowHighlight:Y,expandable:X,stripe:Q,summation:Z,rowStyle:J,cellStyle:ee,spanMethod:re,tableConfig:ne,areaSelection:ae,nativeScrollBar:le,ellipsis:se,showHeader:ce,rowDraggable:de,onRowClick:ue,onRowDblclick:pe,onRowContextmenu:he,onRowEnter:me}=i.current.props,fe=o().useRef(null),ge=o().useRef({}),be=o().useRef(null),ye=o().useRef(null),ve=o().useRef(null),xe=o().useRef({prevST:0,prevSL:0}),Ee=i.current.scrollXLoad?r:l,Se=o().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=h,i={};return S&&Object.assign(i,{minHeight:"100px"}),B&&Object.assign(i,{minHeight:Jr(B)-e-r+"px"}),U&&Object.assign(i,{maxHeight:Jr(U)-e-r+"px"}),z||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[z,U,B,S,h]),Te=o().useMemo((()=>{const{scrollYStore:e}=i.current,{viewportHeight:t,gutterWidth:r}=h;return Math.floor((f?t-r:t)/e.rowHeight)}),[h,f]),[Ie,Ne]=o().useState([]),Re=Rc();Nc({ref:fe,omitClassNames:[".table-editable__popper"],handler:()=>{Ae([]),ve.current?.blur()}}),o().useImperativeHandle(t,(()=>({setClickedValues:Ae,createFocus:ke,forceUpdate:Re}))),Me((()=>{Ie.length&&i.current.tableManager.focus(i.current.uid)}),[Ie]),o().useLayoutEffect((()=>{Oe();const e=Qt()(document,"keydown",Pe);return()=>e.remove()}),[]);const Pe=Zl((e=>{const{keyCode:t}=e;if(i.current.uid===i.current.tableManager.getFocusInstance()?.id&&(27===t&&(Ae([]),P(""),$(!1)),Ie.length&&(Xe(document.activeElement,fe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===G?.type||Y)){const t=b[0]??v??null,r=n.find((e=>a(e,e.index)===t))??null;r&&me?.(r,e)}if(38===t||40===t){Ve(e);const{allTableData:r}=i.current,o=T?Xr(n):r,l=o.length;let s=o.findIndex((e=>a(e,e.index)===Ie[0]));const c=38===t?(--s+l)%l:++s%l,d=o[c],u=a(d,d.index);"radio"!==G?.type||G.disabled?.(d)||R([u]),Y&&!Y.disabled?.(d)&&P(u),_(c)||(38===t&&L(u,c),40===t&&L(u,Te>c+1?0:c+1-Te)),Ae([u,Ie[1]])}if(9===t){if(Ve(e),!s.length)return Ae([]);const t=s.length;let r=s.findIndex((e=>e.dataIndex===Ie[1]));const n=++r%t,a=s[n].dataIndex;Ae([Ie[0],a]),A(a)}}})),Oe=()=>{I("$tableBody",fe.current),I("$tableXspace",be.current),I("$tableYspace",ye.current)},ke=(e,t)=>{ge.current[`${e}-${t}`]?.focus()},Ae=e=>{(0,te.isEqual)(e,Ie)||Ne(e)},Le=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),_e=(e,t,r)=>{const{disabled:n}=G||{},{deriveRowKeys:a,recordsMap:o}=i.current,l=Yr(a,e);let s=[],c=M(l?.children||[]);return n&&(c=c.filter((e=>!o.has(e)||!n(o.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(bn(a,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Yr(a,e),r=t?.children?.every((e=>s.includes(e.rowKey)));s=r?[...s,e]:s.filter((t=>t!==e))})),s},Fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=[];return e.forEach((e=>{const n=e.index,l=a(e,e.index);if(r.push(He(e,n,l,t)),X?.expandedRowRender){const{expandedRowClassName:t,rowExpandable:a=oe}=X;y.includes(l)&&a(e)&&r.push(o().createElement("tr",{key:`expand_${l}`,className:"body--row-expanded"},o().createElement("td",{colSpan:Ee.length,className:"body--column",style:{paddingLeft:G?2*os.selectionColumnWidth:os.selectionColumnWidth}},o().createElement("div",{className:we()("cell",t)},X.expandedRowRender(e,n)))))}if(!i.current.scrollYLoad&&(e=>Array.isArray(e.children))(e)){const n="function"!=typeof X?.rowExpandable||X.rowExpandable(e);y.includes(l)&&n&&r.push(...Fe(e.children,t+1))}})),r},He=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const{disabled:a}=G||{},i=["body--row",{"body--row-striped":Q&&t%2!=0,"body--row-selected":b.includes(r)&&!a?.(e),"body--row-current":v===r,...C?je(e._group):null}];return o().createElement("tr",{key:r,"data-row-key":r,className:we()(i)},Ee.map(((a,i)=>De(a,i,e,t,r,n))))},De=(e,t,r,n,s,u)=>{const{isIE:h}=i.current,{dataIndex:m,fixed:f,align:g,className:y="",editRender:v}=e;i.current.scrollXLoad&&(t=l.findIndex((e=>e.dataIndex===m)));const{rowSpan:x,colSpan:E}=$e(r,e,n,t);if(!x||!E)return null;const S=e.ellipsis??se,T=!h&&"left"===f,I=!h&&"right"===f,N=["body--column",{"col--ellipsis":S,"col--center":"center"===g,"col--right":"right"===g,"column--sort":!!p[m],"cell-fix-left":T,"cell-fix-right":I,"cell-fix-left-last":T&&c[c.length-E]?.dataIndex===m,"cell-fix-right-first":I&&d[0]?.dataIndex===m,[y]:!!y}],A=I&&E>1?l.slice(t+1,t+E).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,L=h?null:{left:T?`${O(m)}px`:"",right:I?k(m)-A+"px":""},_=J?"function"==typeof J?J(r,n):J:null,F=ee?"function"==typeof ee?ee(r,e,n,t):ee:null,H=C?qe(r._group):null,D=Object.assign({},L,W?{height:W}:null,H,_,F);if(v){const{extra:t}=v(r,e)||{};t?.disabledBackgroundColor&&Object.assign(D,{backgroundColor:t?.disabledBackgroundColor})}return o().createElement("td",{key:m,"data-col-index":t,rowSpan:x>1?x:void 0,colSpan:E>1?E:void 0,className:we()(N),style:D,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([os.expandableColumn,os.operationColumn].includes(n))return;const i=a(t,t.index);Ae([i,n]);const o=r.editRender?.(t,r),l=o&&!o.disabled,{type:s,selectByClickRow:c=!0,disabled:d=ie}=G||{};!s||d(t)||l||(c||n===os.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=G||{};if("radio"===r&&R([e]),"checkbox"===r){const r=!b.includes(e),i=w&&!n?_e(e,b,r):Le(e,b,r);R(i),a?.(r,t,i)}})(i,t),[os.selectionColumn].includes(n)||(!Y||Y.disabled?.(t)||l||P(i),ue?.(t,r,e))})(t,r,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[os.expandableColumn,os.selectionColumn,os.operationColumn].includes(n)||pe?.(t,r,e)})(t,r,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[os.expandableColumn,os.selectionColumn,os.operationColumn].includes(n)||he?.(t,r,e)})(t,r,e)},o().createElement(zc,{ref:e=>ge.current[`${s}-${m}`]=e,row:r,column:e,rowIndex:n,columnIndex:t,rowKey:s,depth:u,showTitle:S}))},$e=(e,t,r,a)=>{let i=1,o=1;if("function"==typeof re){const l=re({row:e,column:t,rowIndex:r,columnIndex:a,tableData:n});if(Array.isArray(l)?(i=l[0],o=l[1]):(0,te.isPlainObject)(l)&&(i=l.rowSpan,o=l.colSpan),e===n[0]&&0===i){i=1;for(let e=1;e<n.length;e++){const{rowSpan:r}=$e(n[e],t,n[e].index,a);if(r>0)break;i++}}}if(u.length>0){const e=u.find((e=>e.row===r&&e.col===a));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}},qe=e=>{const{backgroundColor:t,color:r}=Z.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},je=e=>{const t=Z.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ke=Ce("table");return o().createElement(o().Fragment,null,o().createElement(Ht,{ref:i.current.scrollBarRef,wrapClassName:`${Ke}--body-wrapper`,wrapStyle:Se,native:le,showTopScrollbar:ne?.doubleXScrollbar,onScroll:e=>{const{elementStore:t,scrollXLoad:r,scrollYLoad:n}=i.current,{prevST:a,prevSL:o}=xe.current,l=g?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==o){ce&&(t.$header.scrollLeft=c),m&&(t.$footer.scrollLeft=c);const e=c>0,r=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+l;x!==e&&H(e),E!==r&&D(r)}if(n&&s!==a&&K(s),r&&c!==o&&j(c),g&&s!==a){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-l>=r&&V({type:"scroll",target:e,preventDefault:ie,stopPropagation:ie})}xe.current.prevST=s,xe.current.prevSL=c}},o().createElement("div",{ref:ye,className:"body--y-space"}),o().createElement("div",{ref:be,className:"body--x-space",style:{width:g?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),o().createElement(wc.Provider,{value:Ie},o().createElement("table",{ref:fe,className:`${Ke}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0",style:{width:0}},o().createElement("colgroup",null,Ee.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})}))),de?o().createElement(ga.ReactSortable,{itemKey:e=>a(e,e.index),tag:"tbody",animation:200,list:n,setList:e=>{const t=e.map((e=>a(e,e.index))),r=n.map((e=>a(e,e.index)));if((0,te.isEqual)(t,r))return;const o=xn(e),l=[];i.current.tableFullData.forEach((e=>{n.includes(e)?l.push(o.shift()):l.push(e)})),N(l),F()}},n.map((e=>He(e,e.index,a(e,e.index))))):o().createElement("tbody",null,Fe(n)))),!!ae&&o().createElement(Gc,{ref:ve})))}));Yc.displayName="TableBody";const Xc=Yc,Qc=e=>{const{summationRows:t}=e,{tableRef:r,sorter:n,layout:a,scrollY:i,flattenColumns:l,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=o().useContext(jl),{footRender:h}=r.current.props,m=o().useRef(null);o().useLayoutEffect((()=>{g()}),[]);const g=()=>{d("$footer",m.current)},b=Ce("table"),{tableBodyWidth:y}=a;return o().createElement("div",{ref:m,className:`${b}--footer-wrapper`},h?h(l,r.current.tableFullData):o().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=a;return o().createElement("colgroup",null,l.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),i&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("tfoot",null,(()=>{const{isIE:e}=r.current,d=["gutter",{"cell-fix-right":!!c.length}],h=e?null:{right:c.length?0:""};return t.map(((e,t)=>o().createElement("tr",{key:t,className:"footer--row"},l.map(((t,l)=>((e,t,l)=>{const{isIE:d}=r.current,{gutterWidth:h}=a,{dataIndex:m,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!n[m],"cell-fix-left":!d&&"left"===g,"cell-fix-right":!d&&"right"===g,"cell-fix-left-last":!d&&"left"===g&&s[s.length-1]?.dataIndex===m,"cell-fix-right-first":!d&&"right"===g&&c[0]?.dataIndex===m}],x=d?null:{left:"left"===g?`${u(m)}px`:"",right:"right"===g?`${p(m)+(i?h:0)}px`:""},E=y?.render?y.render(r.current.tableFullData):tn(t,`${m}_text`),S=0===l&&""===E?f("qm.table.config.summaryText"):E;return o().createElement("td",{key:m,title:S,className:we()(v),style:{...x}},o().createElement("div",{className:"cell"},S))})(t,e,l))),i&&o().createElement("td",{className:we()(d),style:{...h}}))))})())))};var Zc=function(e){return e.small="small",e.middle="default",e.large="default",e}(Zc||{});const Jc=e=>{const{current:t,pageSize:r,total:n,onChange:a}=e,{global:i}=o().useContext(c),{tableRef:l,$size:s,setElementStore:d}=o().useContext(jl),{uniqueKey:u,paginationConfig:p,infoBarConfig:h}=l.current.props,m=o().useRef(null),f=o().useMemo((()=>u?`tablePager_${u}`:""),[u]);o().useLayoutEffect((()=>{g(),x()}),[]);const g=()=>{d("$pager",m.current)},b=p?.showSizeChanger??os.pagination.showSizeChanger,y=p?.showQuickJumper??os.pagination.showQuickJumper,v=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||os.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==r&&(a(t,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S=Ce("table"),w={[`${S}-pager`]:!0};return o().createElement("div",{ref:m,className:we()(w)},o().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&o().createElement(bs,{total:n})),o().createElement(L.Pagination,{size:Zc[s],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:t,pageSize:r,total:n,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=i?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},ed=()=>{const{layout:e}=o().useContext(jl),t=o().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),r=Ce("table");return o().createElement("div",{className:`${r}--empty`,style:t},o().createElement(ft,null))},td=()=>{const{setElementStore:e}=o().useContext(jl),t=o().useRef(null);o().useLayoutEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",t.current)},n=Ce("table");return o().createElement("div",{ref:t,className:`${n}--resizable-bar`})};function rd(){return rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rd.apply(this,arguments)}const nd=o().forwardRef(((e,t)=>{const r=((e,t)=>({...e,...Object.keys(t).reduce(((r,n)=>(r[n]=void 0!==t[n]?t[n]:e[n],r)),{})}))(Vl,e),{rowKey:n,columns:a,loading:i,resizable:l,customClass:s,areaSelection:d,tablePrint:u,exportExcel:p,infoBarConfig:h,topSpaceAlign:m,showTableInfo:f,showFullScreen:g,showRefresh:b,showToolBox:y,showHeader:x}=r,{size:E}=o().useContext(c),S=o().useMemo((()=>r.size??E??""),[r.size,E]),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),I=o().useRef(null),N=o().useRef(null),R=Zl(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(v("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),{tableRef:P,tableFullData:O,setElementStore:k,setOriginColumns:A,setTableFullData:L,setTableOriginData:_,setTableFlatData:F,setAllTableData:H,setDeriveRowKeys:D,setInvalidRowKeys:$,setFieldAuth:q,setColumnsDefined:M,setScrollXStore:j,setScrollYStore:K,setScrollXLoad:V,setScrollYLoad:z,setResizeState:B,setHandleState:U,setSummaries:W,setSelectionRows:G,setShouldToTop:Y,setRecordsMap:X,setUnMounted:Q,clearElementStore:Z,clearRecordsMap:J}=((e,t)=>{let{getRowKey:r,$size:n}=t;const{rowHeight:a,dynamicThead:i}=e,l=o().useRef({props:e,uid:ts(),tableManager:ns,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],tableFlatData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!i,scrollBarRef:o().createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:a||os.rowHeightMaps[n]},store:new is,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:!re&&/MSIE|Trident/.test(navigator.userAgent)});(e=>{l.current.props=e})(e);const s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const o=r(e,e.index),l=n?`${n}#${o}`:`${o}`,c=a?`${a}.${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:o,rowKeyPath:l,indexPath:c};return e.indexPath=c,e._level=i,Array.isArray(e.children)&&(d.children=s(e.children,o,l,c,i+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:l,...l.current,setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableFlatData:e=>{l.current.tableFlatData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Xr(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>r(e,e.index)))},setDeriveRowKeys:e=>{const t=l.current.tableFullData.some((e=>Array.isArray(e.children)));l.current.treeTable=t,l.current.deriveRowKeys=t?s(e,""):[],l.current.flattenRowKeys=t?c(l.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setScrollXStore:e=>{l.current.scrollXStore=e},setScrollYStore:e=>{l.current.scrollYStore=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollXLoad:e=>{l.current.scrollXLoad=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.current.recordsMap.clear()}}})(r,{getRowKey:R,$size:S}),{tableData:ee,setTableData:ne,tableFlatColumns:ae,setTableFlatColumns:ie,filters:oe,setFilters:le,sorter:ce,setSorter:de,superFilters:ue,setSuperFilters:he,pagination:me,setPagination:fe,selectionKeys:ge,setSelectionKeys:be,rowExpandedKeys:ye,setRowExpandedKeys:ve,highlightKey:xe,setHighlightKey:Ee,updateMark:Se,forceUpdate:Te,mergedTdCells:Ie,setMergedCells:Ne,layout:Re,setLayout:Pe,permission:Oe,setPermission:ke,spinning:Ae,setSpinning:Le,scrollX:_e,setScrollX:Fe,scrollY:He,setScrollY:De,isPingLeft:$e,setPingLeft:qe,isPingRight:je,setPingRight:Ke,isFullScreen:Ve,setFullScreen:ze,updateTableData:Be}=(e=>{const{uniqueKey:t,nativeScrollBar:r,initialSorter:n={},initialFilter:a={},paginationConfig:i,rowSelection:l,expandable:s,rowHighlight:d,mergedCells:u}=e,{global:p}=o().useContext(c),h={current:i?.current??os.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??i?.pageSize??p?.table?.pagination?.pageSize??os.pagination.pageSize,total:0},m=l?.selectedRowKeys??l?.defaultSelectedRowKeys??[],f=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[g,b]=o().useState([]),[y,v]=o().useState([]),[x,E]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),a),[S,w]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),n),[C,T]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),[]),[I,N]=o().useState(h),[R,P]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),m),[O,k]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),f),[A,L]=o().useState(d?.currentRowKey??""),[_,F]=o().useReducer((e=>e+1),0),[H,D]=ss([],{value:u}),[$,q]=o().useState({gutterWidth:r?ds():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[M,j]=o().useState({export:!0,import:!0,print:!0}),[K,V]=o().useState(!1),[z,B]=o().useState(!1),[U,W]=o().useState(!1),[G,Y]=o().useState(!1),[X,Q]=o().useState(!1),[Z,J]=o().useState(!1);return{tableData:g,setTableData:b,tableFlatColumns:y,setTableFlatColumns:v,filters:x,setFilters:E,sorter:S,setSorter:w,superFilters:C,setSuperFilters:T,pagination:I,setPagination:N,selectionKeys:R,setSelectionKeys:P,rowExpandedKeys:O,setRowExpandedKeys:k,highlightKey:A,setHighlightKey:L,updateMark:_,forceUpdate:F,mergedTdCells:H,setMergedCells:D,layout:$,permission:M,setPermission:j,setLayout:q,spinning:K,setSpinning:V,scrollX:z,setScrollX:B,scrollY:U,setScrollY:W,isPingLeft:G,setPingLeft:Y,isPingRight:X,setPingRight:Q,isFullScreen:Z,setFullScreen:J,updateTableData:()=>b([...g])}})(r),{isFetch:Ue,isWebPagination:We,isScrollPagination:Ge,showPagination:Ye,shouldUpdateHeight:Xe,tableColumns:Qe,flattenColumns:Ze,editableColumns:Je,summationColumns:et,leftFixedColumns:tt,rightFixedColumns:rt,derivedMergeCells:nt,treeExpandIndex:at,showSummary:it,showFooter:ot,isHeadGroup:lt,bordered:st,isHeadSorter:ct,isHeadFilter:dt,isServiceSummation:ut,isSelectCollection:pt,isTableImport:ht,isTableClipboard:mt,isSuperSearch:ft,isFastSearch:gt,isGroupSummary:bt,isGroupSubtotal:yt,isTreeTable:vt,isTableEmpty:Et,summationRows:St,fetchParams:wt}=ps(r,{getRowKey:R,tableRef:P,tableFullData:O,tableData:ee,sorter:ce,filters:oe,superFilters:ue,selectionKeys:ge,pagination:me,mergedTdCells:Ie}),{createElementStore:Ct,tableStyles:Tt,getSpan:It,getStickyLeft:Nt,getStickyRight:Rt,scrollXToColumn:Pt,scrollYToRecord:Ot,rowInViewport:kt,calcTableHeight:At,resetTableScroll:Lt,computeVirtualX:_t,computeVirtualY:Ft,doLayout:Ht}=gs(r,{getRowKey:R,tableRef:P,topElementRef:w,tableElementRef:C,$size:S,tableColumns:Qe,flattenColumns:Ze,leftFixedColumns:tt,derivedMergeCells:nt,layout:Re,scrollX:_e,scrollY:He,showFooter:ot,showPagination:Ye,isFullScreen:Ve,setLayout:Pe,setScrollX:Fe,setScrollY:De,setElementStore:k,setScrollXStore:j,setScrollYStore:K,setShouldToTop:Y}),{initialTable:Dt,checkDataIndex:$t,createTableFullData:qt,getTableData:Mt,handleTableData:jt,createWebPageData:Kt,createTableData:Vt,createGroupData:zt,createSelectionKeys:Bt,createRowExpandedKeys:Ut,setSelectionKeysEffect:Wt,findParentRowKeys:Gt,getAllChildRowKeys:Yt,doFieldValidate:Xt,getTableLog:Qt,dataChange:Zt,tableChange:Jt,toLastPage:er,toFirstPage:tr,getPageCount:rr,pagerChangeHandle:nr,triggerScrollXEvent:ar,triggerScrollYEvent:ir,scrollBottomDebouncer:or,clearTableSorter:lr,clearTableFilter:sr,clearSuperFilters:cr,clearRowSelection:dr,clearRowHighlight:ur,clearTableLog:pr,destroy:hr}=fs(r,{getRowKey:R,tableRef:P,tableElementRef:C,tableBodyRef:T,$size:S,tableColumns:Qe,flattenColumns:Ze,tableFullData:O,pagination:me,layout:Re,filters:oe,sorter:ce,superFilters:ue,fetchParams:wt,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,summationColumns:et,shouldUpdateHeight:Xe,isFetch:Ue,isTreeTable:vt,isWebPagination:We,isScrollPagination:Ge,isServiceSummation:ut,isGroupSubtotal:yt,doLayout:Ht,setTableData:ne,setTableFlatColumns:ie,setTableFullData:L,setTableOriginData:_,setTableFlatData:F,setAllTableData:H,setDeriveRowKeys:D,setPagination:fe,setSpinning:Le,setSorter:de,setFilters:le,setSuperFilters:he,setSelectionKeys:be,setRowExpandedKeys:ve,setHighlightKey:Ee,setSelectionRows:G,setScrollXLoad:V,setScrollYLoad:z,setScrollXStore:j,setScrollYStore:K,computeVirtualX:_t,computeVirtualY:Ft,setFieldAuth:q,setResizeState:B,setSummaries:W,setPermission:ke,setRecordsMap:X,resetTableScroll:Lt,clearElementStore:Z,clearRecordsMap:J});((e,t)=>{const{columns:r,summation:n,rowSelection:a,expandable:i,rowHighlight:l}=e,{tableRef:s,tableBodyRef:c,$size:d,scrollX:u,pagination:p,selectionKeys:h,rowExpandedKeys:m,highlightKey:f,summationRows:g,showSummary:b,isWebPagination:y,isScrollPagination:x,isTreeTable:E,checkDataIndex:S,toLastPage:w,toFirstPage:C,getPageCount:T,setHandleState:I,scrollYToRecord:N,setSelectionKeysEffect:R,setOriginColumns:P,setRowExpandedKeys:O,setHighlightKey:k,setResizeState:A,setPingRight:L,setUnMounted:_,calcTableHeight:F,createSelectionKeys:H,createRowExpandedKeys:D,initialTable:$,destroy:q}=t,M=o().useRef(g);Me((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(h.length?[h[0],""]:[]),h.__prevent__||e?.(h,s.current.selectionRows),delete h.__prevent__}),[h]),Me((()=>{if(!i)return;const{onChange:e}=i;m.__prevent__||e?.(m,m.map((e=>s.current.recordsMap.get(e)))),delete m.__prevent__}),[m]),Me((()=>{E&&O(D()),l&&(c.current.setClickedValues(f?[f,""]:[]),l.onChange?.(f,s.current.recordsMap.get(f)??null))}),[f]),Me((()=>{(0,te.isEqual)(g,M.current)||(M.current=g,b&&n&&n.onChange?.(g))}),[g]),Me((()=>{const e=H(a.selectedRowKeys);(0,te.isEqual)(e,h)||(e.__prevent__=!0,R(e),E&&O(D()))}),[a?.selectedRowKeys]),Me((()=>{const e=D(i.expandedRowKeys);(0,te.isEqual)(e,m)||(e.__prevent__=!0,O(e))}),[i?.expandedRowKeys]),Me((()=>{const{currentRowKey:e}=l;e!==f&&k(e??"")}),[l?.currentRowKey]),Me((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?w():C()),N("","after"===e?1e5:0)),t&&p.current>T()&&w(),(e||t)&&I({insert:null,remove:!1})}),[p.total]),Me((()=>{L(u)}),[u]),Me((()=>{F()}),[d]),Me((()=>{s.current.scrollYLoad&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||v("Table","必须设置组件参数 `ellipsis`")),x&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,x]);const j=Zl((()=>{const{resizeState:e}=s.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(A(Object.assign({},e,{winHeight:r})),F())}));o().useEffect((()=>(P(pe(r)),$(),window.addEventListener("resize",j,!1),S(),se((()=>F())),()=>{q(),window.removeEventListener("resize",j),_(!0)})),[])})(r,{tableRef:P,tableBodyRef:T,$size:S,scrollX:_e,pagination:me,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,showSummary:it,summationRows:St,isWebPagination:We,isScrollPagination:Ge,isTreeTable:vt,checkDataIndex:$t,toLastPage:er,toFirstPage:tr,getPageCount:rr,setHandleState:U,scrollYToRecord:Ot,setOriginColumns:A,setSelectionKeysEffect:Wt,setRowExpandedKeys:ve,setHighlightKey:Ee,setResizeState:B,setPingRight:Ke,setUnMounted:Q,calcTableHeight:At,createSelectionKeys:Bt,createRowExpandedKeys:Ut,initialTable:Dt,destroy:hr});const mr=o().useMemo((()=>({getRowKey:R,tableRef:P,tableBodyRef:T,$size:S,flattenColumns:Ze,editableColumns:Je,leftFixedColumns:tt,rightFixedColumns:rt,treeExpandIndex:at,sorter:ce,filters:oe,superFilters:ue,layout:Re,bordered:st,showFooter:ot,showSummary:it,summationRows:St,scrollX:_e,scrollY:He,pagination:me,fetchParams:wt,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,mergedTdCells:Ie,derivedMergeCells:nt,updateMark:Se,isFetch:Ue,isPingLeft:$e,isPingRight:je,isHeadSorter:ct,isHeadFilter:dt,isFullScreen:Ve,isTableEmpty:Et,isHeadGroup:lt,isTreeTable:vt,isGroupSubtotal:yt,isWebPagination:We,dataChange:Zt,tableChange:Jt,getTableData:Mt,setElementStore:k,createWebPageData:Kt,createTableFullData:qt,updateTableData:Be,setSorter:de,setFilters:le,setSuperFilters:he,setHighlightKey:Ee,setRowExpandedKeys:ve,setSelectionRows:G,setSelectionKeysEffect:Wt,setInvalidRowKeys:$,setMergedCells:Ne,getSpan:It,getStickyLeft:Nt,getStickyRight:Rt,scrollXToColumn:Pt,scrollYToRecord:Ot,rowInViewport:kt,setPagination:fe,setPingLeft:qe,setPingRight:Ke,setSpinning:Le,setFullScreen:ze,setShouldToTop:Y,doFieldValidate:Xt,createTableData:Vt,createGroupData:zt,findParentRowKeys:Gt,getAllChildRowKeys:Yt,triggerScrollXEvent:ar,triggerScrollYEvent:ir,scrollBottomDebouncer:or,resetTableScroll:Lt,clearTableSorter:lr,clearTableFilter:sr,clearSuperFilters:cr,clearRowSelection:dr,clearRowHighlight:ur})),[S,Ze,Je,tt,rt,at,ce,oe,ue,Re,st,ot,it,St,_e,He,me,wt,ge,ye,xe,nt,Se,Ue,$e,je,ct,dt,Ve,Et,lt,vt,yt,We]);((e,t)=>{const{getRowKey:r,tableRef:n,toolBoxRef:a,tableBodyRef:i,columnFilterRef:l,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:b,handleTableData:y,createTableData:x,createTableFullData:E,calcTableHeight:S,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:T,setTableOriginData:I,setHandleState:N,setColumnsDefined:R,setSelectionKeysEffect:P,setRowExpandedKeys:O,setHighlightKey:k,setSelectionRows:A,setOriginColumns:L,forceUpdate:_,getTableLog:F,clearRowSelection:H,clearRowHighlight:D,clearTableSorter:$,clearTableFilter:q,clearSuperFilters:M,clearTableLog:j}=t,{columns:K,columnsChange:V}=n.current.props,z=(e,t,n)=>e.filter((e=>{const a=r(e,e.index);e.children&&(e.children=z(e.children,t,n));const i=t.includes(a);return i&&n?.(e,a),!i}));o().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{S()},DO_REFRESH:async e=>{f&&(await b(),e?.())},GET_LOG:()=>F(),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(),$(),q(),M(),j(),x([]))},CLEAR_LOG:()=>{j()},CREATE_FOCUS:(e,t)=>{i.current.createFocus(e,t)},FORCE_UPDATE:()=>{_()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:(e,t)=>{const r=[...e];t&&(r.__prevent__=!0),P(r)},SET_EXPANDABLE:(e,t)=>{const r=[...e];t&&(r.__prevent__=!0),O(r)},SET_HIGHLIGHT:e=>{k(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),R(!0),l.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Br(K,e);if(!n)return v("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,te.isPlainObject)(t))return v("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return v("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,te.set)(n,e,t[e]);r&&(V?V([...K]):v("Table","需要设置 `columnsChange` 参数"),_())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i}=n.current,o=(Array.isArray(e)?e:[e]).filter((e=>(0,te.isPlainObject)(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[os.expandableColumn,os.selectionColumn,os.operationColumn].includes(r)||rn(e,r,tn(e,r))})),a.addToInserted(e)}));const l="before"===t?.mode,c=void 0===t?.parentRowKey,d=i;if(c)l?d.unshift(...o):d.push(...o);else{const e=yn(i,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?l?e.children.unshift(...o):e.children.push(...o):e.children=o)}c&&N(Object.assign({},n.current.handleState,{insert:l?"before":"after"})),x(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a}=n.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,te.isPlainObject)(e)?r(e,e.index):e));if(!i.length)return;let o=!1;const l=z(a,i,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,o=i?.(e,n);if(!o)return;const{rules:l=[],disabled:s}=o;!s&&l.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),o=!0}));o&&(N(Object.assign({},n.current.handleState,{remove:!0})),E(l),P(p.filter((e=>!i.includes(e)))),i.includes(m)&&D(),O(h.filter((e=>!i.includes(e)))),g(),se((()=>{I(z(n.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{n.current.allTableData.forEach((n=>{c.forEach((a=>{const{dataIndex:i,editRender:o}=a,l=o?.(n,a);if(!l)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:d}=l;!d&&c.length&&T(c,tn(n,i),s,i)}))}));const{required:a,validate:i}=F(),o=[...a,...i];return o.length&&C(o[0].rowKey),_(),{required:a,validate:i}}})))})(t,{getRowKey:R,tableRef:P,toolBoxRef:I,tableBodyRef:T,columnFilterRef:N,flattenColumns:Ze,editableColumns:Je,pagination:me,fetchParams:wt,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,isFetch:Ue,dataChange:Zt,getTableData:Mt,handleTableData:jt,createTableData:Vt,createTableFullData:qt,calcTableHeight:At,scrollXToColumn:Pt,scrollYToRecord:Ot,doFieldValidate:Xt,setTableOriginData:_,setHandleState:U,setColumnsDefined:M,setSelectionKeysEffect:Wt,setRowExpandedKeys:ve,setHighlightKey:Ee,setSelectionRows:G,setOriginColumns:A,forceUpdate:Te,getTableLog:Qt,clearRowSelection:dr,clearRowHighlight:ur,clearTableSorter:lr,clearTableFilter:sr,clearSuperFilters:cr,clearTableLog:pr}),o().useLayoutEffect((()=>{Ct(),P.current.tableManager.register(P.current.uid,t??{current:null})}),[]);const fr=Ce("table"),gr={[`${fr}--wrapper`]:!0,[`${fr}--lg`]:"large"===S,[`${fr}--sm`]:"small"===S,[`${fr}--maximize`]:Ve,[s]:!!s},br={[fr]:!0,"is--border":st,"is--fixed":tt.length||rt.length,"is--sortable":ct,"is--filterable":dt,"is--head-group":lt,"is--area-select":!!d,"is--ping-left":$e,"is--ping-right":je};return o().createElement(jl.Provider,{value:mr},o().createElement("div",{className:we()(gr)},f&&o().createElement("div",{ref:w,className:`${fr}-top`},o().createElement("div",{className:`${fr}-top__space`},"bottom"!==h?.position&&o().createElement(bs,{total:me.total}),o().createElement("div",{className:`${fr}-top__space-slot`,style:{justifyContent:Ql[m]}},r.children)),o().createElement("div",{className:`${fr}-top__actions`},o().createElement(dc,{ref:I,showFullScreen:g,showReload:b&&Ue,showPrint:Oe.print&&!!u,showImport:Oe.import&&ht,showExport:Oe.export&&!!p,showClipboard:mt,showCollection:pt,showFastSearch:gt,showSuperSearch:ft,showGroupSummary:bt,showToolBox:y,tableColumns:Qe}),o().createElement(hc,{ref:N,columns:a}))),o().createElement(xt,{spinning:i??Ae},o().createElement("div",{ref:C,className:we()(br),style:Tt},o().createElement("div",{className:`${fr}--main-wrapper`},x&&o().createElement(Sc,{tableColumns:Qe,sorter:ce,filters:oe}),o().createElement(Xc,{ref:T,tableFlatColumns:ae,tableData:ee}),ot&&o().createElement(Qc,{summationRows:St})),st&&o().createElement("div",{className:`${fr}--border-line`}),Et&&o().createElement(ed,null),l&&o().createElement(td,null))),Ye&&o().createElement(Jc,rd({},me,{onChange:(e,t)=>nr({current:e,pageSize:t})}))))}));nd.displayName="QmTable";const ad=nd,id=ad;function od(){return od=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},od.apply(this,arguments)}const ld=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:l=[],table:s={},className:d,style:u,onClose:p}=e,{size:h}=o().useContext(c),m=o().useMemo((()=>e.size??h??""),[e.size,h]),g=o().useRef(null),b=o().useRef(null),y=o().useRef(null),v=Nt(g),[x,E]=o().useState(s),[S,w]=o().useState(),[C,T]=o().useState(i),[I,N]=o().useState(!1),[R,P]=o().useState(300),[O,k]=o().useState(l),[A,L]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[_,F]=o().useState((0,te.merge)({},s.fetch?.params,n)),[H,D]=o().useState([]),$=()=>{const e=g.current,t=e.querySelector(".form-wrap");P(e.offsetHeight-t.offsetHeight-2*$a[m]-30)},q=Ot($,5);Pt((()=>{q()}),[v.width]),Me((()=>{(0,te.isEqual)(l,O)||k(l)}),[l]),o().useEffect((()=>{M()}),[_]),o().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),o().useEffect((()=>{n&&b.current?.SET_FIELDS_VALUE(n)}),[]);const M=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=oe}=t;if(i(_)){N(!0);try{const e=await n(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,a)??[];r||(T([]),await le(0)),D(t)}}catch(e){}N(!1)}},j=e=>{r||(w(e),p(e))},K=e=>{F(Object.assign({},_,e))},V=Ce("search-helper"),z={[`${V}--wrapper`]:!0},B=x.webPagination?{dataSource:H,loading:I,webPagination:!0}:{fetch:{...x.fetch,params:_}};return o().createElement("div",{ref:g,className:we()(z,d),style:u},o().createElement("div",{className:"form-wrap"},O.length?o().createElement(Qo,{ref:b,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>$(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||K(t)}}):null),o().createElement("div",null,o().createElement(id,od({ref:y,uniqueKey:t,height:R,columns:A,rowKey:x.rowKey||"pageIndex"},B,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{T(e),w(r?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>L(e),onRowDblclick:j,onRowEnter:j}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!S,onClick:()=>p(S,r?C:void 0)},f("qm.dialog.confirm"))))};ld.displayName="SearchHelper";const sd=ld;function cd(){return cd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cd.apply(this,arguments)}const dd=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...dd(e.children)),e.children&&t.push(e.value)})),t},ud=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=ud(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},pd=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&pd(e.children,t),t(e)||e.children&&e.children.length))),hd=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:l=[],table:s={},tree:d={},className:u,style:p,onClose:h}=e,{size:m}=o().useContext(c),g=o().useMemo((()=>e.size??m??""),[e.size,m]),b=o().useRef(null),y=o().useRef(null),x=o().useRef(null),E=Nt(b),[S,w]=o().useState(s),[C,T]=o().useState(),[I,N]=o().useState(i),[R,P]=o().useState(!1),[O,k]=o().useState(300),[A,_]=o().useState(300),[F,H]=o().useState(l),[D,$]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[q,M]=o().useState((0,te.merge)({},s.fetch?.params,n)),[j,K]=o().useState([]),V=()=>{const e=b.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),_(e.offsetHeight-t.offsetHeight-2*$a[g]-30)},z=Ot(V,5);Pt((()=>{z()}),[E.width]),Me((()=>{(0,te.isEqual)(l,F)||H(l)}),[l]),o().useEffect((()=>{B()}),[q]),o().useEffect((()=>{a&&x.current.SET_SELECTION_ROWS(a)}),[a]),o().useEffect((()=>{n&&y.current?.SET_FIELDS_VALUE(n),ne()}),[]);const B=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=oe}=t;if(i(q)){P(!0);try{const e=await n(q);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,a)??[];r||(N([]),await le(0)),K(t)}}catch(e){}P(!1)}},U=e=>{r||(T(e),h(e))},W=e=>{M(Object.assign({},q,e))},[G,Y]=o().useState([]),[X,Q]=o().useState([]),[Z,J]=o().useState(""),ee=o().useRef(G),re=o().useRef([]);Me((()=>{Q(dd(G))}),[G]);const ne=async()=>{if(!d.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=d.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,te.get)(i.data,r)??[],t=$n(e,n,a);Y(t),ee.current=t,re.current=e}}catch(e){}},ae=e=>`${e}|${na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie=Ce("tree-table-helper"),se={[`${ie}--wrapper`]:!0},ce=S.webPagination?{dataSource:j,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:q}};return o().createElement("div",{ref:b,className:we()(se,u),style:p},o().createElement(it,{defaultValue:200,style:{height:"100%"}},o().createElement(it.Pane,{min:100,style:{overflowY:"auto"}},o().createElement(L.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=pd(ee.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==ae(r).indexOf(e)}));J(e),Y(t)})(e.target.value)}),o().createElement(L.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:O,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==ae(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return v("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,r={};for(const n in t)r[n]=(0,te.get)(e,t[n]);W(r)})(ud(re.current,(r=>(0,te.get)(r,t)===e[0]))||{})}})),o().createElement(it.Pane,{className:"split-pane"},o().createElement("div",{className:"form-wrap"},F.length?o().createElement(Qo,{ref:y,items:F,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>H(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||W(t)}}):null),o().createElement("div",null,o().createElement(id,cd({ref:x,uniqueKey:t,height:A,columns:D,rowKey:S.rowKey||"pageIndex"},ce,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:I,onChange:(e,t)=>{N(e),T(r?t:t[0])}},paginationConfig:S.paginationConfig,columnsChange:e=>$(e),onRowDblclick:U,onRowEnter:U}))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[g]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!C,onClick:()=>h(C,r?I:void 0)},f("qm.dialog.confirm"))))};hd.displayName="TreeTableHelper";const md=hd,fd=e=>{const{multiple:t,tree:r={},defaultSelectedKeys:n,className:a,style:i,onClose:l}=e,{size:s}=o().useContext(c),d=o().useMemo((()=>e.size??s??""),[e.size,s]),[u,p]=o().useState(),[h]=o().useState(r.fetch?.params),m=Ce("tree-helper"),g={[`${m}--wrapper`]:!0},b=r.fetch?{...ue(r.fetch,["params","valueKey","textKey"]),params:h}:void 0;return o().createElement("div",{className:we()(g,a),style:i},o().createElement(Ml,{multiple:t,fetch:b,fieldsDefine:{valueKey:r.fetch?.valueKey,textKey:r.fetch?.textKey},asyncLoad:r.asyncLoad,checkStrictly:r.checkStrictly,checkStrategy:r.checkStrategy,defaultSelectedKeys:n,defaultExpandAll:r.defaultExpandAll,onSelectChange:e=>p(e),onCheckChange:e=>p(e)}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>l(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!u,onClick:()=>l(u)},f("qm.dialog.confirm"))))};fd.displayName="TreeHelper";const gd=fd;function bd(){return bd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bd.apply(this,arguments)}const yd="_startSign",vd="_endSign",xd=e=>{const{uniqueKey:t,initialValue:r,filters:n=[],table:a={},onClose:i}=e,{size:l}=o().useContext(c),s=o().useMemo((()=>e.size??l??""),[e.size,l]),d=o().useRef(null),u=o().useRef(null),p=o().useRef(null),h=Nt(d),[m,g]=o().useState(a),[b,y]=o().useState(!1),[v,x]=o().useState([]),[E,S]=o().useState(300),[w,C]=o().useState(n),[T,I]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},{title:f("qm.form.rangeSearchHelper")[0],dataIndex:yd,width:80,align:"right",render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:f("qm.form.rangeSearchHelper")[1],dataIndex:vd,fixed:"right",width:80,render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)}]),[N,R]=o().useState((0,te.merge)({},a.fetch?.params,r)),[P,O]=o().useState([]),k=o().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),A=o().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),_=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*$a[s]-30)},F=Ot(_,5);Pt((()=>{F()}),[h.width]),Me((()=>{(0,te.isEqual)(n,w)||C(n)}),[n]),o().useEffect((()=>{H()}),[N]);const H=async()=>{const{webPagination:e,fetch:t}=m;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=oe}=t;if(a(N)){y(!0);try{const e=await r(N);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[];O(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},$=()=>{v.forEach((e=>{e&&(D(e,yd),D(e,vd))})),x([])},q=e=>{$(),R(Object.assign({},N,e))},M=Ce("range-helper"),j=m.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...m.fetch,params:N}};return o().createElement("div",{ref:d,className:`${M}--wrapper`},o().createElement("div",{className:"form-wrap"},w.length?o().createElement(Qo,{ref:u,items:w,initialValues:r,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>_(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||q(t)}}):null),o().createElement("div",null,o().createElement(id,bd({ref:p,height:E,columns:T,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>I(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[yd,vd].includes(r)&&(r===yd&&(e[r]?(D(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?L.message.warning(f("qm.searchHelper.rangeStartTip")):(v[0]&&D(v[0],r),e[r]="[",x([e,v[1]]))),r===vd&&(e[r]?(D(e,r),x([v[0],void 0])):e.pageIndex<k[0]?L.message.warning(f("qm.searchHelper.rangeEndTip")):(v[1]&&D(v[1],r),e[r]="]",x([v[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[yd]="["),e.pageIndex===k[1]&&(e[vd]="]")}))}}),o().createElement(be,{type:"primary",icon:o().createElement(Te.ClearOutlined,null),title:f("qm.table.alert.clear"),onClick:()=>$()}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>i(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!A,onClick:()=>i(v.map((e=>(e=>{const t={};for(const r in e)[yd,vd].includes(r)||(t[r]=e[r]);return t})(e))))},f("qm.dialog.confirm"))))};xd.displayName="RangeTableHelper";const Ed=xd,Sd=e=>null!=e;function wd(e,t,r,n){const[a,i]=o().useState(void 0);o().useLayoutEffect((()=>{const t="function"==typeof e?e():e;i(t||null)}));const[l,s]=o().useState(null),c=Zl((()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:o}=e.getBoundingClientRect();return n>=0&&o>=0&&a<=t&&i<=r})(a)&&t&&a.scrollIntoView(n);const{left:e,top:r,width:i,height:o}=a.getBoundingClientRect(),l={left:e,top:r,width:i,height:o,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(l)?l:e))}else s(null)}));return o().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[a,t,c]),[o().useMemo((()=>{if(!l)return l;const e=r?.offset||6,t=r?.radius||2;return{left:l.left-e,top:l.top-e,width:l.width+2*e,height:l.height+2*e,radius:t}}),[l,r]),a]}const Cd={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"]}},Td={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"]}},Id=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Nd(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:o}=e,l=t/2,s={};return Object.keys(Cd).forEach((e=>{const c={...n&&Td[e]||Cd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Id.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-l-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=l+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-l-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=l+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":c.offset[1]=-d.arrowOffsetHorizontal-l;break;case"leftBottom":case"rightBottom":c.offset[1]=d.arrowOffsetHorizontal+l}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+r,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+r,i.shiftX=!0,i.adjustX=!0}const o={...i,...a};return o.shiftX||(o.adjustX=!0),o.shiftY||(o.adjustY=!0),o}(e,d,t,r),o&&(c.htmlRegion="visibleFirst")})),s}const Rd=require("@rc-component/portal");var Pd=n.n(Rd);const Od=require("@rc-component/trigger");var kd=n.n(Od);function Ad(){return Ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ad.apply(this,arguments)}const Ld={fill:"transparent",pointerEvents:"auto"},_d=e=>{const{prefixCls:t,rootClassName:r,pos:n,showMask:a,style:i={},fill:l="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${ts()}`,p="object"==typeof c?c?.placeholder:c;return o().createElement(Pd(),{open:s,autoLock:!0},o().createElement("div",{className:we()(`${t}-mask`,r),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...i}},a?o().createElement("svg",{style:{width:"100%",height:"100%"}},o().createElement("defs",null,o().createElement("mask",{id:u},o().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),n&&o().createElement("rect",{x:n.left,y:n.top,rx:n.radius,width:n.width,height:n.height,fill:"black",className:p?`${t}-placeholder-animated`:""}))),o().createElement("rect",Ad({},n?null:Ld,{x:"0",y:"0",width:"100%",height:"100%",fill:l,mask:`url(#${u})`})),n&&o().createElement(o().Fragment,null,o().createElement("rect",Ad({},Ld,{x:"0",y:"0",width:"100%",height:`${n.top}px`})),o().createElement("rect",Ad({},Ld,{x:"0",y:"0",width:n.left,height:"100%"})),o().createElement("rect",Ad({},Ld,{x:"0",y:n.top+n.height,width:"100%",height:`calc(100vh - ${n.top+n.height}px)`})),o().createElement("rect",Ad({},Ld,{x:n.left+n.width,y:"0",width:`calc(100vw - ${n.left+n.width}px)`,height:"100%"})))):null))},Fd=e=>{const{prefixCls:t,zIndex:r,open:n,onPause:a,onPlay:i}=e,[l,s]=ss(void 0,{value:n,postState:e=>e??!0}),c=o().useRef(null),d=o().useRef(!1),u=Zl((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));o().useEffect((()=>{const e=Qt()(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!l),l?a?.():i?.())};return o().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,o=e.clientX-Ge(t).x,l=e.clientY-Ge(t).y;return document.onmousemove=e=>{let s=e.clientX-o,c=e.clientY-l;s<0&&(s=0),s>a-r-1&&(s=a-r-1),c<0&&(c=0),c>i-n-1&&(c=i-n-1),Be(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},l?o().createElement(Te.PauseOutlined,null):o().createElement(Te.CaretRightOutlined,null))},Hd=e=>{const{prefixCls:t,current:r,total:n=0,cover:a,title:i,description:l,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:b}=Pc(),y="primary"!==c?"primary":"default",v=Zl((e=>{w(e),40===e.keyCode&&(r<n-1?h?.():m?.()),38===e.keyCode&&r>0&&p?.()}));o().useEffect((()=>{const e=Qt()(document,"keyup",v);return()=>e.remove()}),[]);const x=Sd(a)?o().createElement("div",{className:`${t}-cover`},a):null,E=Sd(l)?o().createElement("div",{className:`${t}-description`},l):null;let S;S=g?g(r,n):[...Array.from({length:n}).keys()].map(((e,n)=>o().createElement("span",{key:e,className:we()(n===r&&`${t}-indicator-active`,`${t}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return o().createElement("div",{className:we()(`${t}-content`,f)},o().createElement("div",{className:`${t}-inner`},o().createElement(Te.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},o().createElement(Te.QuestionCircleOutlined,{className:we()(`${t}-close`,"help-icon")})),x,o().createElement("div",{className:`${t}-header`},o().createElement("div",{className:`${t}-title`},i)),E,o().createElement("div",{className:`${t}-footer`},n>1&&o().createElement("div",{className:`${t}-indicators`},S),o().createElement(Ee,{className:`${t}-buttons`},0!==r?o().createElement(be,{className:`${t}-prev-btn`,size:"small",onMouseDown:w,onClick:p},b("qm.tour.prevStep")):null,r===n-1?o().createElement(be,{className:`${t}-finish-btn`,type:y,size:"small",onClick:m},b("qm.tour.finish")):o().createElement(be,{className:`${t}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},b("qm.tour.nextStep"))))))},Dd=e=>{const{current:t,renderPanel:r}=e;return o().createElement(o().Fragment,null,"function"==typeof r?r(e,t):o().createElement(Hd,e))};function $d(){return $d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$d.apply(this,arguments)}const qd={left:"50%",top:"50%",width:1,height:1},Md=o().forwardRef(((e,t)=>{const{steps:r=[],defaultCurrent:n,current:a,onChange:i,onClose:l,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:v,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0,...C}=e,T=o().useRef(),[I,N]=ss(0,{value:a,defaultValue:n}),[R,P]=ss(void 0,{value:c,postState:e=>!(I<0||I>=r.length)&&(e??!1)}),[O,k]=ss(1051,{value:y,defaultValue:y}),[A,L]=o().useState(),_=o().useRef(R);o().useLayoutEffect((()=>{R&&!_.current&&N(0),_.current=R,L(R)}),[R]),o().useImperativeHandle(t,(()=>({OPEN:()=>P(!0),CLOSE:()=>P(!1),SET_ZINDEX:e=>k(e)})));const{target:F,type:H,placement:D,trigger:$,delay:q,style:M,arrow:j,className:K,mask:V,scrollIntoViewOptions:z,zIndex:B,action:U}=r[I]||{},W=B||O,G=H||d,Y=R&&(V??u),X=z??w,[Q,Z]=wd(F,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,D),ee=!!Z&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;o().useLayoutEffect((()=>{T.current?.forceAlign()}),[te,I]),Me((()=>{R&&(ae(),U?.(Z,I))}),[R,Z]);const re=e=>{N(e),i?.(e)},ne=()=>{P(!1),l?.(I)},ae=()=>{if(!Z)return;const e=[];!function t(r){if(1===r.nodeType){var n;"INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName||"none"===ze(n=r,"display")||"hidden"===ze(n,"visibility")||"0"===ze(n,"opacity")||e.push(r);for(const e of Array.from(r.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const ie=async()=>{if(!$||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[a,i]=[e+r/2,t+n/2],o=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),l=document.elementFromPoint(a,i);l&&(l.dispatchEvent(o),await le(q??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=Ce("tour"),ue=[{[`${de}-primary`]:"primary"===G},m,K],pe=Nd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(_d,{zIndex:W,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:A,animated:S,rootClassName:m}),o().createElement(Pd(),{open:A,autoLock:!0},o().createElement(kd(),$d({ref:T},C,{zIndex:W,builtinPlacements:pe,popupStyle:ce,popupPlacement:J,popupVisible:A,popupClassName:we()(ue),prefixCls:de,popup:()=>o().createElement(Dd,$d({key:"content",arrow:ee,prefixCls:de,total:r.length,helper:b,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await ie(),re(I-1)},onNext:async()=>{await ie(),re(I+1)},onClose:ne,current:I,onFinish:()=>{ne(),s?.()}},Object.assign({},r[I],{zIndex:W,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),o().createElement("div",{className:we()(m,`${de}-target-placeholder`),style:{...Q||qd,position:"fixed",pointerEvents:"none"}}))),h&&o().createElement(Pd(),{open:R},o().createElement(Fd,{zIndex:W,prefixCls:de,onPause:()=>L(!1),onPlay:()=>L(!0)})))}));Md.displayName="QmTour";const jd=Md,Kd=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Vd=e=>({_s:e,status:Kd[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),zd=e=>e?6:5,Bd=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Vd(e);t(i),r.current=i,a?.({current:i})},Ud=e=>{const{name:t,in:r,timeout:n,preEnter:a=!0,preExit:l}=e,[s,c]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:t=!0,exit:r=!0,preEnter:n,preExit:a,timeout:o,initialEntered:l,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,p]=(0,i.useState)((()=>Vd(l?2:zd(s)))),h=(0,i.useRef)(u),m=(0,i.useRef)(),[f,g]=(e=>(0,te.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(o),b=(0,i.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return zd(t)}})(h.current._s,c);e&&Bd(e,p,h,m,d)}),[d,c]),y=(0,i.useCallback)((e=>{const i=e=>{switch(Bd(e,p,h,m,d),e){case 1:f>=0&&(m.current=setTimeout(b,f));break;case 4:g>=0&&(m.current=setTimeout(b,g));break;case 0:case 3:m.current=setTimeout((()=>i(e+1)),0)}},o=h.current.isEnter;"boolean"!=typeof e&&(e=!o),e?!o&&i(t?n?0:1:2):o&&i(r?a?3:4:zd(c))}),[b,d,t,r,n,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(m.current)),[]),[u,y,b]}({timeout:n,preEnter:a,preExit:l,initialEntered:r});return Pt((()=>{c()}),[r]),o().createElement(o().Fragment,null,o().Children.map(e.children,(e=>o().isValidElement(e)?Mc(e,{className:we()(e.props.className,t,s.status)}):e)))},Wd={previewWidth:1100,defaultDistance:.45,logoHeight:60},Gd=(0,i.createContext)(void 0);var Yd=null;function Xd(){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),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){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 Qd(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Xd()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void L.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:Yd?r=Yd:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),Yd=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Xd(),r}catch(e){L.message.error("getLodop 出错:"+e)}}Xd();const Zd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},Jd=o().forwardRef(((e,t)=>{const{templateRender:r,directPrint:n}=e,{global:a}=o().useContext(c),{$$preview:i}=o().useContext(Gd),{state:l,isWindowsPrinter:s,pageSize:d}=i,u=o().useRef(null),p=o().useRef({}),h=o().useRef([]),m=o().useRef([]),f=o().useRef([]),[g,b]=o().useState(!0);o().useImperativeHandle(t,(()=>({createPreviewDom:k,createExportHtml:L,createPrintHtml:A,SHOW_PREVIEW:_,DIRECT_PRINT:F}))),Me((()=>{O()}),[l.form.printerType,l.form.setting.direction,l.form.setting.distance,l.form.setting.fixedLogo]),o().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const y=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Wd.defaultDistance+10*Wd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[l,s,d]),x=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Wd.defaultDistance+10*Wd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[l,s,d]),E=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Zd(y-10*(e.left-Wd.defaultDistance)-10*(e.right-Wd.defaultDistance))}),[l,y]),S=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Zd(x-10*(e.top-Wd.defaultDistance)-10*(e.bottom-Wd.defaultDistance))}),[l,x]),w=l.form.scale,C=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return{left:Zd(10*e.left),right:Zd(10*e.right),top:Zd(10*e.top),bottom:Zd(10*e.bottom)}}),[l]),T=o().useMemo((()=>{const{form:{printerType:e}}=l,{left:t,right:r,top:n,bottom:a}=C,i=E+t+r,o=Wd.previewWidth-i<=0?0:(Wd.previewWidth-i)/2,s=Math.abs((1-w)*i/2);let c=0;return w>1&&(c=s>o?-1*o:-1*s),w<1&&(c=i-2*s>Wd.previewWidth?0:o>0?s:(Wd.previewWidth-(i-2*s))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[l,g,C,w,S,E]),I=(h.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=a?.print?.leftLogo??"",t=a?.print?.rightLogo??"";return[`<tr style="height: ${Wd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),N=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},P=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}m.current=r,h.current=t},O=()=>{if(!h.current.length)return;const{form:{setting:e,printerType:t}}=l;if(n)return f.current.push([N(),I(),...h.current]);const r=e.fixedLogo?S-Wd.logoHeight:S;let a=[];if(f.current=[],"stylus"===t)f.current.push([N(),...e.fixedLogo?[I()]:[],...h.current]);else{let t=0;for(let n=0,i=m.current.length;n<i;n++){const o=h.current[n],l=m.current[n];e.fixedLogo||0!==n||(t+=Wd.logoHeight),t+=l,t<=r?a.push(o):(f.current.push([N(),...e.fixedLogo?[I()]:[],...a]),a=[],t=0,n-=1),n===i-1&&a.length&&f.current.push([N(),...e.fixedLogo?[I()]:[],...a])}}e.fixedLogo||f.current[0]?.splice(1,0,I());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');i.setState({currentPage:1,totalPage:f.current.length}),k()},k=()=>{const{currentPage:e}=l;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},A=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<h.current.length;t++)e[t]=h.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+I()+N()+e.join("")+"</table>"},_=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return H();p.current.previewEl.innerHTML||(R(),await le(0),P(),O(),b(!1))},F=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return H();R(),await le(0),P(),O(),b(!1),i.doPrint(A()),await le(0),i.doClose()},H=()=>{v("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=Ce("print-container"),$={[D]:!0,"no-visible":n};return o().createElement("div",{ref:u,className:we()($)},o().createElement(xt,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},o().createElement("div",{className:"preview"},o().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},r?.()),o().createElement("div",{className:"workspace",style:T}))))}));Jd.displayName="Container";const eu=Jd;function tu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ru extends i.Component{constructor(){super(...arguments),tu(this,"context",void 0),tu(this,"formRef",o().createRef()),tu(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:f("qm.print.setPanel.printParameter")},{type:"SELECT",label:f("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:f("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:f("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:f("qm.print.setPanel.vertical"),value:"vertical"},{text:f("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:f("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:f("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:f("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:f("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]}])),tu(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})})),tu(this,"getInitialExtra",(()=>({disleft:f("qm.print.setPanel.sizeUnit"),disright:f("qm.print.setPanel.sizeUnit"),distop:f("qm.print.setPanel.sizeUnit"),disbottom:f("qm.print.setPanel.sizeUnit")}))),tu(this,"state",{formList:this.createFormList()}),tu(this,"confirmHandle",(async()=>{const[e,t]=await 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())})),tu(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return o().createElement(o().Fragment,null,o().createElement(Qo,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},f("qm.dialog.close")),o().createElement(be,{type:"primary",onClick:()=>this.confirmHandle()},f("qm.dialog.confirm"))))}}tu(ru,"contextType",c);const nu=ru;function au(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class iu extends i.Component{constructor(){super(...arguments),au(this,"context",void 0),au(this,"provide",{$$preview:this}),au(this,"containRef",o().createRef()),au(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Wd.defaultDistance,right:Wd.defaultDistance,top:Wd.defaultDistance,bottom:Wd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),au(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),au(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),au(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await Qs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),au(this,"doClose",(()=>{this.props.onClose?.()})),au(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),au(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),au(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 ')),au(this,"doPrint",(e=>{const t=Qd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:o,copies:l}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Wd,{left:d,right:u,top:p,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(l),a.doubleSide&&("auto"===a.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"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.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?n&&this.doClose():L.message.error(f("qm.print.printError"))},t.PRINT()})),au(this,"doExport",(e=>{const t=Qd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():L.message.error(f("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${u()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:f("qm.print.laserPrinter"),value:"laser"},{text:f("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Qd(),t=[{text:f("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){v("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}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await Qs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,te.isPlainObject)(e)&&await Qs().setItem(this.printerKey,e)),(0,te.isPlainObject)(e)&&Object.keys(e).length&&(0,te.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:r,form:n,currentPage:a,totalPage:i,printPage:l}=this.state,s=Ce("print-preview"),c={visible:r,title:f("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?o().createElement(o().Fragment,null,o().createElement("div",{className:we()(d)},o().createElement("div",{className:"outer"},o().createElement("div",{className:"header"},o().createElement("span",null,f("qm.print.printer"),":",o().createElement(L.Select,{value:n.printerName,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.type"),":",o().createElement(L.Select,{value:n.printerType,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.copies"),":",o().createElement(L.InputNumber,{value:n.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),o().createElement("span",null,f("qm.print.printPage.0"),o().createElement(L.InputNumber,{value:l,min:1,max:i,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),f("qm.print.printPage.1")),o().createElement("span",null,o().createElement(L.Pagination,{size:"small",current:a,pageSize:1,total:i,onChange:this.pageChangeHandle})),o().createElement("span",null,o().createElement(be,{type:"text",icon:o().createElement(Te.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},f("qm.print.setting"))),o().createElement("span",null,o().createElement(be,{type:"text",icon:o().createElement(Te.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},f("qm.print.export"))),o().createElement("span",null,o().createElement(be,{icon:o().createElement(Te.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},f("qm.print.print")))),o().createElement("div",{className:"main"},o().createElement(Gd.Provider,{value:this.provide},o().createElement(eu,{ref:this.containRef,templateRender:t,directPrint:!1}))),o().createElement("div",{className:"footer"},o().createElement("span",null,f("qm.print.scale"),":",o().createElement(L.Slider,{value:n.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{scale:e}})))}}),o().createElement("em",{className:"scale-text"},`${Math.floor(100*n.scale)}%`)),o().createElement("span",null,f("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),o().createElement("span",null,f("qm.print.pageNumber"),":",f("qm.print.pagination",{currentPage:a,totalPage:i}))))),o().createElement(Cr,c,o().createElement(nu,{setting:n.setting,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):o().createElement(Gd.Provider,{value:this.provide},o().createElement(eu,{ref:this.containRef,templateRender:t,directPrint:!0}))}}au(iu,"contextType",c);const ou=iu;function lu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class su extends i.Component{constructor(){super(...arguments),lu(this,"context",void 0),lu(this,"previewRef",o().createRef()),lu(this,"state",{visible:!1,loading:!1}),lu(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),lu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i}=this.props,l={visible:e,title:f("qm.print.preview"),width:`${Wd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?o().createElement(Cr,l,o().createElement(ou,s)):e?o().createElement(ou,s):null})),lu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await le(0),this.setState({visible:!0}),await le(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:r,type:n,disabled:a,shape:i}=this.props,l={size:t||this.context.size||"",type:n,shape:i,icon:r,loading:e,disabled:a,click:this.clickHandle};return o().createElement(o().Fragment,null,this.props.children&&o().createElement(be,l,this.props.children),this.createRender())}}lu(su,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:s().elementType}),lu(su,"defaultProps",{preview:!0,type:"primary",icon:o().createElement(Te.PrinterOutlined,null)}),lu(su,"contextType",c);const cu=su;function du(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function uu(e){const t=du(e);return t?t.frameElement:null}function pu(e){const t=fu(e);return hu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function hu(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 mu(e,t){const r=uu(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=pu(a);if(n.push(e),a=uu(a),i)break;a&&du(a)===t&&(i=!0)}return hu(n)}return e.getBoundingClientRect()}function fu(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)}}function gu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bu=Object.assign;class yu{constructor(e,t){gu(this,"node",void 0),gu(this,"border",void 0),gu(this,"padding",void 0),gu(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=Su.border,this.padding.style.borderColor=Su.padding,this.content.style.backgroundColor=Su.background,bu(this.node.style,{borderColor:Su.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){Eu(t,"margin",this.node),Eu(t,"border",this.border),Eu(t,"padding",this.padding),bu(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"}),bu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class vu{constructor(e,t){gu(this,"tip",void 0),gu(this,"nameSpan",void 0),gu(this,"dimSpan",void 0),this.tip=e.createElement("div"),bu(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),bu(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),bu(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,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let o=e.left+5;return e.left<t.left&&(o=t.left+5),e.left+a>t.left+t.width&&(o=t.left+t.width-a-5),i+="px",o+="px",{style:{top:i,left:o}}}(e,t,{width:r.width,height:r.height});bu(this.tip.style,n.style)}}class xu{constructor(){gu(this,"window",void 0),gu(this,"tipBoundsWindow",void 0),gu(this,"container",void 0),gu(this,"tip",void 0),gu(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new vu(r,this.container),this.rects=[],r.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 r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new yu(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=mu(e,this.window),a=fu(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=mu(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Eu(e,t,r){bu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const Su={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 wu=null,Cu=null;function Tu(){null!=window.document&&(wu=null,null!==Cu&&(Cu.remove(),Cu=null))}function Iu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nu{constructor(e){Iu(this,"_isRunning",void 0),Iu(this,"_selectIgnore",void 0),Iu(this,"_lastHoveredNode",null),Iu(this,"excludeSelectors",void 0),Iu(this,"onSelect",void 0),Iu(this,"iframesListeningTo",new Set),Iu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Iu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Iu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Iu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Xe(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Tu();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 r;r=[t],null,!1,null!=window.document?(null!==wu&&clearTimeout(wu),null!=r&&(null===Cu&&(Cu=new xu),Cu.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),Iu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Iu(this,"selectFiberForNode",(0,te.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else r.getAttribute("name")?e+=`[name=${r.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.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(){Tu(),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 Ru(e){return document.querySelector(e)}const Pu=e=>{const{action:t,onConfirm:r,onCancel:n,onFinish:a}=e,{t:i}=Pc();return o().createElement(o().Fragment,null,o().createElement("div",{style:{height:100}},i("qm.table.config.emptyText")),o().createElement(Ee,{style:{width:"100%",justifyContent:"flex-end"}},o().createElement(be,{size:"small",onClick:()=>n?.()},i("qm.guideTracker.closeButton")),o().createElement(be,{size:"small",onClick:()=>r?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),o().createElement(be,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Ou={left:"50%",top:"50%",width:1,height:1},ku=o().forwardRef(((e,t)=>{const{open:r,current:n,defaultCurrent:a,steps:i=[],placement:l="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:v}=e,{t:x}=Pc(),E=o().useRef(),S=o().useRef(i.length),[w,C]=ss(0,{value:n,defaultValue:a}),[T,I]=ss(void 0,{value:r,postState:e=>e??!1}),[N,R]=ss(1051,{value:h,defaultValue:h}),[P,O]=o().useState({}),[k,A]=o().useState(!1),[_,F]=o().useState(T),[H,D]=o().useState(!1),[$,q]=wd(P.node,!!r),[M,j]=o().useState(22),K=o().useRef(!1),V=o().useMemo((()=>w>=i.length?"add":"edit"),[w,i]),z=o().useMemo((()=>`${w+1} / ${i.length}`),[w,i]);o().useLayoutEffect((()=>{E.current=new Nu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),O({id:dn(),node:e,path:t}),C(S.current),A(!0),U(),g?.(t,e)}})}),[]),o().useEffect((()=>(T?B():U(),T?setTimeout((()=>F(!0)),16):F(!1),()=>{U()})),[T]),o().useEffect((()=>{S.current=i.length}),[i]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},W=e=>{e.stopPropagation(),e.preventDefault()};o().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:w,selector:P.path})})));const G=Ce("guide-tracker"),Y=[{[`${G}-primary`]:!0}],X=Nd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(Pd(),{open:T&&k,autoLock:!0},o().createElement(kd(),{zIndex:N,builtinPlacements:X,popupPlacement:l,popupVisible:T&&k,popupClassName:we()(Y,c),popupStyle:d,prefixCls:G,popup:()=>{const e=()=>{A(!1),B()};return o().createElement("div",{className:`${G}-content`},o().createElement("div",{className:`${G}-inner`},o().createElement(Te.CloseOutlined,{className:`${G}-close`,onClick:()=>{y?.(w),e()}}),o().createElement(L.Dropdown,{open:H,trigger:["click"],dropdownRender:()=>i.length?o().createElement("div",{className:"ant-dropdown-menu step-list"},o().createElement(ga.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),r=i.map((e=>e.id));if((0,te.isEqual)(t,r))return;const n=t.findIndex((e=>e===P.id)),a=-1!==n?n:w;C(a),b?.(xn(e),a)}},i.map(((e,t)=>o().createElement("li",{key:t,className:we()("item",{actived:e.id===P.id})},o().createElement(Te.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),o().createElement("span",{className:"box"},o().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==w&&(O({id:e.id,node:Ru(e.selector),path:e.selector}),C(t),j(22===M?M+1:M-1),b?.(i,t))}},e.title),o().createElement(L.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:N+1,onConfirm:()=>{const r=i.filter((t=>t.id!==e.id)),n=t===w;let a=t<=w?w-1:w;if(a=a<0?0:a,a=a>r.length?r.length:a,n&&r[a]){const{id:e,selector:t}=r[a];O({id:e,node:Ru(t),path:t})}C(a),b?.(r,a)}},o().createElement(Te.CloseOutlined,{className:"close-icon"})))))))):o().createElement(o().Fragment,null),overlayClassName:`${G}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:N},onOpenChange:e=>D(e)},o().createElement(Te.MenuOutlined,{className:we()(`${G}-close`,"menu-icon"),style:{width:M}})),m.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:N},content:m.content,title:m.title},o().createElement(Te.QuestionCircleOutlined,{className:we()(`${G}-close`,"help-icon")})),o().createElement("div",{className:"panel-label"},o().createElement("span",{className:"title"},x("qm.guideTracker.label")),o().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),z)),p?p({id:P.id,selector:P.path,actionStatus:V,DO_CLOSE:e},w):o().createElement(Pu,{action:V,onConfirm:()=>{b?.("add"===V?[...i,{id:P.id,selector:P.path,title:"Guide Title"}]:[...i],w),e()},onCancel:()=>{y?.(w),e()},onFinish:()=>{e(),y?.(w),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},o().createElement("div",{className:we()(`${G}-target-placeholder`),style:{...$||Ou,position:"fixed",zIndex:N-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:W,onClick:W}))),s&&o().createElement(Pd(),{open:_},o().createElement(Fd,{zIndex:N,prefixCls:G,onPause:()=>{K.current=k,A(!1),U()},onPlay:()=>{K.current?A(!0):B()}})))}));ku.displayName="QmGuideTracker";const Au=ku,Lu=e=>{const{content:t,image:r,width:n,height:a,font:l={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:h=!0,grayscale:m,className:f,style:g}=e,b=o().useRef(null),y=o().useRef(new Map),v=l.fontSize??16,x=l.fontWeight??"normal",E=l.fontStyle??"normal",S=l.fontFamily??"sans-serif",w=l.color??"rgba(0, 0, 0, 0.15)",C=l.textAlign??"center",T=Array.isArray(t)?t:[t],I=s[0],N=s[1],R=I/2,P=N/2,O=c[0]??R,k=c[1]??P,A=o().useMemo((()=>{const e=O-R,t=k-P;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:u}}),[R,P,O,k,u]),L=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const i=(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),[o,l]=(e=>{let t=120,i=64;if(!r&&e.measureText){e.font=`${v}px ${S}`;const r=T.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),i=v*T.length+3*(T.length-1)}return[n??t,a??i]})(t),s=o*i,c=l*i,u=(I+o)*i,h=(N+l)*i,f=I/2*i,g=N/2*i,R=u/2,P=h/2,O=2*(I+o);e.width=2*u,e.height=2*h,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const k=()=>{t.restore(),t.drawImage(e,0,0,u,h,u,h,u,h),m&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...A,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)},L=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${l}px ${S}`,t.fillStyle=w,t.textAlign=C,t.textBaseline="top",t.translate(s/2,0),T.forEach(((r,n)=>{t.fillText(r??"",f,g+n*(e+3*i))})),k()};if(r){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),k()},e.onerror=()=>{L()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=r}else L()},_=e=>Array.from(y.current.values()).includes(e);o().useEffect((()=>{L()}),[t,r,n,a,l,s,c,d,u,p,h,m]),function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=window&&"MutationObserver"in window,a=i.useRef(),o=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(o(),n&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,r)),()=>o())),[e])}(b,(e=>{if(h)for(const t of e){const e=Array.from(t.removedNodes).some((e=>_(e))),r="attributes"===t.type&&_(t.target);if(e||r){L();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const F=Ce("watermark");return o().createElement("div",{ref:b,className:we()(F,f),style:{position:"relative",...g}},e.children)},_u=new Map,Fu=new WeakMap;let Hu=0;function Du(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:undefined;if(void 0===window.IntersectionObserver&&void 0!==n){const a=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:o}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Fu.has(r)||(Hu+=1,Fu.set(r,Hu.toString())),Fu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=_u.get(t);if(!r){const n=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},_u.set(t,r)}return r}(r),l=o.get(e)||[];return o.has(e)||o.set(e,l),l.push(t),i.observe(e),function(){l.splice(l.indexOf(t),1),0===l.length&&(o.delete(e),i.unobserve(e)),0===o.size&&(i.disconnect(),_u.delete(a))}}const $u=e=>{const{forceRender:t,height:r,placeholder:n=null,unmountIfInvisible:a,className:i,style:l}=e,{ref:s,inView:c,entry:d}=function(){let{root:e,rootMargin:t,threshold:r,triggerOnce:n,fallbackInView:a,trackVisibility:i,skip:l,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,u]=o().useState(null),[p,h]=o().useState({inView:!1,entry:void 0}),m=o().useRef(c);o().useEffect((()=>{if(l||!d)return;let o;return o=Du(d,((e,t)=>{h({inView:e,entry:t}),m.current?.(e,t),t.isIntersecting&&n&&o&&(o(),o=void 0)}),{root:e,rootMargin:t,threshold:r,trackVisibility:i,delay:s},a),()=>{o&&o()}}),[Array.isArray(r)?r.toString():r,d,e,t,n,l,i,a,s]);const f=p.entry?.target,g=o().useRef();d||!f||n||l||g.current===f||(g.current=f,h({inView:!1,entry:void 0}));const b=[u,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}(Object.assign({},e,{triggerOnce:!a}));o().useEffect((()=>{r||v("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ce("lazy-load"),p={[u]:!0};return o().createElement("div",{ref:s,className:we()(p,i),style:l},t||c?e.children:o().createElement("div",{className:"placeholder",style:{height:r}},n))},qu=require("html2canvas");var Mu=n.n(qu);function ju(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ku{constructor(e,t,r,n){if(ju(this,"x",void 0),ju(this,"y",void 0),ju(this,"pressure",void 0),ju(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=r||0,this.time=n||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 Vu{static fromPoints(e,t){const r=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Vu(e[1],r,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,r){const n=e.x-t.x,a=e.y-t.y,i=t.x-r.x,o=t.y-r.y,l=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+r.x)/2,d=(t.y+r.y)/2,u=Math.sqrt(n*n+a*a),p=Math.sqrt(i*i+o*o),h=p/(u+p),m=c+(l-c)*h,f=d+(s-d)*h,g=t.x-m,b=t.y-f;return{c1:new Ku(l+g,s+b),c2:new Ku(c+g,d+b)}}constructor(e,t,r,n,a,i){this.startPoint=e,this.control2=t,this.control1=r,this.endPoint=n,this.startWidth=a,this.endWidth=i}length(){let e,t,r=0;for(let n=0;n<=10;n+=1){const a=n/10,i=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(n>0){const n=i-e,a=o-t;r+=Math.sqrt(n*n+a*a)}e=i,t=o}return r}point(e,t,r,n,a){return t*(1-e)*(1-e)*(1-e)+3*r*(1-e)*(1-e)*e+3*n*(1-e)*e*e+a*e*e*e}}function zu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bu{constructor(e,t){var r=this;zu(this,"canvas",void 0),zu(this,"ctx",void 0),zu(this,"textInput",void 0),zu(this,"width",320),zu(this,"height",200),zu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),zu(this,"penColor","rgba(0,0,0,1)"),zu(this,"backgroundColor","rgba(0,0,0,0)"),zu(this,"canAddHistory",!1),zu(this,"mode",void 0),zu(this,"openSmooth",!0),zu(this,"dotSize",0),zu(this,"throttle",16),zu(this,"minDistance",5),zu(this,"velocityFilterWeight",.7),zu(this,"compositeOperation","source-over"),zu(this,"minWidth",.5),zu(this,"maxWidth",2.5),zu(this,"fontSize",16),zu(this,"eraserSize",20),zu(this,"lineHeight",1.25),zu(this,"degreeOfBlur",5),zu(this,"textInputPos",{x:0,y:0}),zu(this,"onStart",(()=>{})),zu(this,"onEnd",(()=>{})),zu(this,"_drawingStroke",!1),zu(this,"_lastPoints",[]),zu(this,"_data",[]),zu(this,"_historyList",[]),zu(this,"_lastVelocity",0),zu(this,"_lastWidth",0),zu(this,"_strokeMoveUpdate",void 0),zu(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)})),zu(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))})),zu(this,"isTouchEvent",(e=>"touches"in e)),zu(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)})),zu(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)})),zu(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),zu(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:this.isTouchEvent(e)?e.touches[0]?.clientX:e.clientX,y:this.isTouchEvent(e)?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),zu(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}))),zu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),r={...t,points:[]};this._data.push(r),this._reset(t),this._strokeUpdate(e,!1)})),zu(this,"_strokeUpdate",(function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!r._drawingStroke)return;if(0===r._data.length)return void r._strokeBegin(e);const n=r._createPoint(e.x,e.y,e.pressure),a=r._data[r._data.length-1],i=a.points,o=i.length>0&&i[i.length-1],l=!!o&&n.distanceTo(o)<=r.minDistance,s=r._getPointGroupOptions(a);if(!o||!o||!l){const e=r._addPoint(n,s);t&&(o?e&&r._drawCurve(e,s):r._drawDot(n,s)),i.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),zu(this,"_strokeEnd",(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r._drawingStroke&&(t&&r._strokeUpdate(e),r._drawingStroke=!1)})),zu(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})),zu(this,"_drawDot",((e,t)=>{const r=this.ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;r.beginPath(),this._drawCurveSegment(e.x,e.y,n),r.closePath(),r.fillStyle=t.penColor,r.fill()})),zu(this,"_drawCurve",((e,t)=>{const r=this.ctx,n=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());r.beginPath(),r.fillStyle=t.penColor;for(let r=0;r<a;r+=1){const i=r/a,o=i*i,l=o*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*o*e.control2.x,u+=l*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*i*e.control1.y,p+=3*s*o*e.control2.y,p+=l*e.endPoint.y;const h=Math.min(e.startWidth+l*n,t.maxWidth);this._drawCurveSegment(u,p,h)}r.closePath(),r.fill()})),zu(this,"_drawCurveSegment",((e,t,r)=>{const n=this.ctx;n.moveTo(e,t),n.arc(e,t,r,0,2*Math.PI,!1)})),zu(this,"_createPoint",((e,t,r)=>{const n=this.canvas.getBoundingClientRect();return new Ku(e-n.left,t-n.top,r,(new Date).getTime())})),zu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),zu(this,"_addPoint",((e,t)=>{const{_lastPoints:r}=this;if(r.push(e),r.length>2){3===r.length&&r.unshift(r[0]);const e=this._calculateCurveWidths(r[1],r[2],t),n=Vu.fromPoints(r,e);return r.shift(),n}return null})),zu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),zu(this,"_calculateCurveWidths",((e,t,r)=>{const n=r.velocityFilterWeight*t.velocityFrom(e)+(1-r.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n,r),i={end:a,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=a,i})),zu(this,"onDrawStart",(e=>{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),this.onStart?.(e))})),zu(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)))})),zu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),zu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),zu(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})),zu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,r,n-t,a-r),this.ctx.stroke(),this.ctx.restore()})),zu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(n,t),o=Math.min(a,r),l=.5*(Math.max(n,t)-i),s=.5*(Math.max(a,r)-o),c=i+l,d=o+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,l,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),zu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(r-a,t-n)/Math.PI,o=(i+25)*Math.PI/180,l=(i-25)*Math.PI/180,s=15*Math.cos(o),c=15*Math.sin(o),d=15*Math.cos(l),u=15*Math.sin(l);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,r),this.ctx.lineTo(n,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n,a);const p=n+s,h=a+c;this.ctx.lineTo(p,h);const m=n+d,f=a+u;this.ctx.lineTo(m,f),this.ctx.lineTo(n,a),this.ctx.fill(),this.ctx.restore()})),zu(this,"getAxisColor",((e,t,r)=>{const n=e.width,a=e.data,i=[];return i[0]=a[4*(r*n+t)],i[1]=a[4*(r*n+t)+1],i[2]=a[4*(r*n+t)+2],i[3]=a[4*(r*n+t)+3],i})),zu(this,"setAxisColor",((e,t,r,n)=>{const a=e.width,i=e.data;i[4*(r*a+t)]=n[0],i[4*(r*a+t)+1]=n[1],i[4*(r*a+t)+2]=n[2],i[4*(r*a+t)+3]=n[3]})),zu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),n=this.ctx.getImageData(t*this.ratio,r*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=n.width,i=n.height,o=a/this.degreeOfBlur,l=i/this.degreeOfBlur;for(let e=0;e<l;e++)for(let t=0;t<o;t++){const r=this.getAxisColor(n,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let a=0;a<this.degreeOfBlur;a++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(n,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,r)}this.ctx.putImageData(n,t*this.ratio,r*this.ratio)})),zu(this,"drawText",(e=>{const{x:t,y:r}=this.textInputPos;if(0===t&&0===r)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const n=this.fontSize*this.lineHeight,a=this.width-t,i=e.target.innerText,o=[];let l="";for(let e=0;e<i.length;e++){const t=l+i[e];this.ctx.measureText(t).width>a&&l.length>0?(o.push(l),l=i[e]):l=t}o.push(l),o.forEach(((e,a)=>{this.ctx.fillText(e,t+1,r+a*n+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),zu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),zu(this,"drawPencil",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.restore()})),zu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),zu(this,"drawEraser",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),zu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),zu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=r?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),zu(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}})),zu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),zu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),zu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),zu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),zu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),zu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),zu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),zu(this,"setDrawMode",(e=>{this.mode=e})),zu(this,"setLineWidth",(e=>{this.maxWidth=e})),zu(this,"setPenColor",(e=>{this.penColor=e})),zu(this,"setFontSize",(e=>{this.fontSize=e})),zu(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()})),zu(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(r.canvas.width===r.width)return r.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),zu(this,"getPNG",(()=>this.toDataURL())),zu(this,"getJPG",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;return r.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,r,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,i=0,o=null;const l=()=>{i=Date.now(),o=null,t=e.apply(r,n),o||(r=null,n=[])};return function(){const s=Date.now(),c=a-(s-i);r=this;for(var d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];return n=u,c<=0||c>a?(o&&(clearTimeout(o),o=null),i=s,t=e.apply(r,n),o||(r=null,n=[])):o||(o=window.setTimeout(l,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)}}zu(Bu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),r=t[0].split(":")[1],n=window.atob(t[1]),a=n.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=n.charCodeAt(e);return new Blob([i],{type:r})})),zu(Bu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),zu(Bu,"canvasToBlob",(e=>new Promise(((t,r)=>{e.toBlob((e=>e?t(e):r(null)),"image/png",1)}))));const Uu=Bu,Wu=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Gu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Yu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Xu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Qu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Zu=o().forwardRef(((e,t)=>{const{open:r,width:n,height:a,imageName:i,penColor:l,minWidth:s,maxWidth:c,backgroundColor:d,className:p,style:h,onOk:m,onCancel:f}=e,{t:g}=Pc(),b=o().useRef(),y=o().useRef(null),x=o().useRef(null),E=o().useRef(null),S=[2,4,6],w=[14,16,18,20,24,28],C=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[T,I]=ss(void 0,{value:r,postState:e=>e??!1}),N=o().useMemo((()=>!!e.children),[e.children]),[R,P]=o().useState(N?"square":"line"),[O,k]=o().useState(S[0]),[A,_]=o().useState(N?C[0]:C[4]),[F,H]=o().useState(w[1]),[D,$]=o().useState("bottomLeft"),[q,M]=o().useState(!1),[j,K]=o().useState(!1);o().useEffect((()=>{const e={width:n??x.current?.offsetWidth,height:a??x.current?.offsetHeight,maxWidth:O,mode:R,penColor:A,fontSize:F,backgroundColor:d,openSmooth:!N};return e.openSmooth&&Object.assign(e,{penColor:l,minWidth:s,maxWidth:c}),b.current=new Uu(y.current,e),()=>b.current.destroy()}),[]);const V=e=>{const[t,r]=[n??x.current?.offsetWidth,a??x.current?.offsetHeight],{width:i,height:o}=b.current;let l=!1;t&&t!==i&&(b.current.width=t,l=!0),r&&r!==o&&(b.current.height=r,l=!0),(l||e)&&b.current.update()};Me((()=>{N&&T&&V()}),[T,N]),Me((()=>{b.current.setDrawMode(R)}),[R]),Me((()=>{b.current.setLineWidth(O)}),[O]),Me((()=>{b.current.setPenColor(A)}),[A]),Me((()=>{b.current.setFontSize(F)}),[F]);const z=async()=>{const e=N?x.current.parentNode:y.current;if(e)try{const t=await Mu()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Uu.canvasToDataURL(t)}catch(e){v("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),f?.()};o().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),CLEAR:()=>b.current.clear(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:V,GET_DATE_URL:z})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},W=e=>o().createElement("div",{className:we()("ant-dropdown-menu","content")},"text"!==e?o().createElement("div",{className:"lineWidth"},S.map((e=>o().createElement("span",{key:e,className:we()("dot",`s${e}`,{active:e===O}),onClick:()=>k(e)})))):o().createElement("div",{className:"fontSize"},o().createElement(L.Select,{size:"small",value:F,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>H(e)})),o().createElement("span",{className:"divider"}),o().createElement("div",{className:"penColor"},C.map((e=>o().createElement("span",{key:e,className:we()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>_(e)},o().createElement(Te.CheckOutlined,{className:"icon"})))))),G=Ce("signature"),Y={[G]:!0,"is-annotation":N},X=n?{...h,width:n}:h;return o().createElement("div",{className:we()(Y,p),style:X},N&&o().createElement(o().Fragment,null,o().createElement("div",{ref:x,className:"content"},e.children),j&&o().createElement(xt,{spinning:!0,className:"spinning"})),o().createElement("div",{className:we()("signature",{show:T})},o().createElement("canvas",{ref:y,className:R}),N&&o().createElement("div",{ref:E,className:"signature__tool-bar"},o().createElement("div",{className:"wrapper"},o().createElement("div",{className:we()("actions",{hidden:q})},o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("square")},o().createElement(Te.BorderOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("round")},o().createElement(Wu,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("arrow")},o().createElement(Yu,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("line")},o().createElement(Te.EditOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:()=>W("text"),overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("text")},o().createElement(Gu,null))),o().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{K(!0);const e=await z();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):u()().format(Yl);qt(Uu.dataURLToBlob(e),`${t}.png`)}K(!1)})(),B()}},o().createElement(Te.DownloadOutlined,null)),o().createElement("button",{className:"btn",onClick:()=>P("eraser")},o().createElement(Xu,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.undo()},o().createElement(Qu,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.clear()},o().createElement(Te.ClearOutlined,null)),o().createElement("span",{className:"divider"}),o().createElement("button",{className:"btn",onClick:()=>f?.()},o().createElement(Te.CloseOutlined,null)),o().createElement("button",{className:"btn",onClick:async()=>{K(!0),await le(10);const e=await z();K(!1),B(),m?.(e)}},o().createElement(Te.CheckOutlined,null))),o().createElement("button",{className:"btn btn-fold",title:g(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!q)},q?o().createElement(Te.LeftOutlined,null):o().createElement(Te.RightOutlined,null))))))}));Zu.displayName="QmSignature";const Ju=Zu,ep="1.10.1";return a})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={442:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};n.r(a),n.d(a,{Affix:()=>L.Affix,Alert:()=>L.Alert,Anchor:()=>L.Anchor,AutoComplete:()=>L.AutoComplete,Avatar:()=>L.Avatar,BackTop:()=>L.BackTop,Badge:()=>L.Badge,Breadcrumb:()=>L.Breadcrumb,Button:()=>L.Button,Calendar:()=>$,Card:()=>L.Card,Carousel:()=>L.Carousel,Cascader:()=>L.Cascader,Checkbox:()=>L.Checkbox,Col:()=>L.Col,Collapse:()=>L.Collapse,Comment:()=>L.Comment,ConfigProvider:()=>L.ConfigProvider,DatePicker:()=>j,DcpAnchor:()=>or,DcpButton:()=>be,DcpCollapse:()=>$e,DcpConfigProvider:()=>ee,DcpCopyToClipboard:()=>Kc,DcpCountup:()=>ut,DcpCropper:()=>Sl,DcpDivider:()=>Re,DcpDownload:()=>Yt,DcpDrawer:()=>gr,DcpEmpty:()=>ft,DcpForm:()=>Qo,DcpGuideTracker:()=>Au,DcpLazyLoad:()=>$u,DcpModal:()=>Cr,DcpPrint:()=>cu,DcpRangeTableHelper:()=>Ed,DcpScrollbar:()=>Ht,DcpSearchHelper:()=>sd,DcpSearchTree:()=>Ml,DcpSignature:()=>Ju,DcpSpace:()=>Ee,DcpSpin:()=>xt,DcpSplit:()=>it,DcpTable:()=>id,DcpTabs:()=>pr,DcpTinymce:()=>bl,DcpTour:()=>jd,DcpTransition:()=>Ud,DcpTreeHelper:()=>gd,DcpTreeTableHelper:()=>md,DcpUploadFile:()=>wl,DcpUploadImg:()=>Ol,DcpWatermark:()=>Lu,Descriptions:()=>L.Descriptions,Divider:()=>L.Divider,Drawer:()=>L.Drawer,Dropdown:()=>L.Dropdown,Empty:()=>L.Empty,Form:()=>L.Form,Grid:()=>L.Grid,Image:()=>L.Image,Input:()=>L.Input,InputNumber:()=>L.InputNumber,Layout:()=>L.Layout,List:()=>L.List,Mentions:()=>L.Mentions,Menu:()=>L.Menu,Modal:()=>L.Modal,PageHeader:()=>L.PageHeader,Pagination:()=>L.Pagination,Popconfirm:()=>L.Popconfirm,Popover:()=>L.Popover,Progress:()=>L.Progress,QmAnchor:()=>or,QmButton:()=>be,QmCollapse:()=>$e,QmConfigProvider:()=>ee,QmCopyToClipboard:()=>Kc,QmCountup:()=>ut,QmCropper:()=>Sl,QmDivider:()=>Re,QmDownload:()=>Yt,QmDrawer:()=>gr,QmEmpty:()=>ft,QmForm:()=>Qo,QmGuideTracker:()=>Au,QmLazyLoad:()=>$u,QmModal:()=>Cr,QmPrint:()=>cu,QmRangeTableHelper:()=>Ed,QmScrollbar:()=>Ht,QmSearchHelper:()=>sd,QmSearchTree:()=>Ml,QmSignature:()=>Ju,QmSpace:()=>Ee,QmSpin:()=>xt,QmSplit:()=>it,QmTable:()=>id,QmTabs:()=>pr,QmTinymce:()=>bl,QmTour:()=>jd,QmTransition:()=>Ud,QmTreeHelper:()=>gd,QmTreeTableHelper:()=>md,QmUploadFile:()=>wl,QmUploadImg:()=>Ol,QmWatermark:()=>Lu,Radio:()=>L.Radio,Rate:()=>L.Rate,Result:()=>L.Result,Row:()=>L.Row,Segmented:()=>L.Segmented,Select:()=>L.Select,Skeleton:()=>L.Skeleton,Slider:()=>L.Slider,Space:()=>L.Space,Spin:()=>L.Spin,Statistic:()=>L.Statistic,Steps:()=>L.Steps,Switch:()=>L.Switch,Table:()=>L.Table,Tabs:()=>L.Tabs,Tag:()=>L.Tag,TimePicker:()=>B,Timeline:()=>L.Timeline,Tooltip:()=>L.Tooltip,Transfer:()=>L.Transfer,Tree:()=>L.Tree,TreeSelect:()=>L.TreeSelect,Typography:()=>L.Typography,Upload:()=>L.Upload,message:()=>L.message,notification:()=>L.notification,pinyin:()=>na,version:()=>ep});var i=n(442),o=n.n(i);const l=require("prop-types");var s=n.n(l);const c=(0,i.createContext)({locale:"zh-cn",size:"middle"}),d=require("dayjs");var u=n.n(d);const p={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:"查找下一个"}}}};require("dayjs/locale/zh-cn");let h=p;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const f=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,a]=t;let i;const o=n.split(".");let l=h;for(let e=0,t=o.length;e<t;e++){if(i=l[o[e]],e===t-1)return m(i,a);if(!i)return"";l=i}return""},g=e=>{h=e||h,h.name&&u().locale(h.name)};class b extends Error{constructor(e){super(e),this.name="QmDesignError"}}function y(e,t){throw new b(`[${e}] ${t}`)}function v(e,t){console.warn(new b(`[${e}] ${t}`))}const x=e=>["","small","middle","large"].includes(e),E=require("dayjs/plugin/localeData");var S=n.n(E);const w=require("dayjs/plugin/advancedFormat");var C=n.n(w);const T=require("dayjs/plugin/customParseFormat");var I=n.n(T);const N=require("dayjs/plugin/quarterOfYear");var R=n.n(N);const P=require("dayjs/plugin/weekOfYear");var O=n.n(P);const k=require("dayjs/plugin/weekday");var A=n.n(k);u().extend(S()),u().extend(C()),u().extend(I()),u().extend(R()),u().extend(O()),u().extend(A());const L=require("antd"),_=require("rc-picker/es/generate/dayjs");var F=n.n(_);const H=require("antd/es/calendar/generateCalendar");var D=n.n(H);require("antd/es/calendar/style");const $=D()(F()),q=require("antd/es/date-picker/generatePicker");var M=n.n(q);require("antd/es/date-picker/style/index");const j=M()(F());function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},K.apply(this,arguments)}const V=i.forwardRef(((e,t)=>i.createElement(j,K({},e,{picker:"time",mode:void 0,ref:t}))));V.displayName="TimePicker";const z=i.forwardRef(((e,t)=>i.createElement(j.RangePicker,K({},e,{picker:"time",mode:void 0,ref:t}))));z.displayName="RangePicker",V.RangePicker=z;const B=V,U={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"}}}},W=require("antd/es/locale/zh_CN");var G=n.n(W);const Y=require("antd/es/locale/en_GB");var X=n.n(Y);function Q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Z={[U.name]:{qm:U,antd:X()},[p.name]:{qm:p,antd:G()}};class J extends i.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},g(Object.assign({},Z,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:a,size:i,global:o}=e;return a!==r&&g(Object.assign({},Z,o.langPackage)[a].qm),a!==r||i!==n?{value:Object.assign({},t.value,{locale:a,size:i})}:null}render(){const{global:e}=this.props,{value:t}=this.state,r=Object.assign({},Z,e.langPackage);return o().createElement(c.Provider,{value:t},o().createElement(L.ConfigProvider,{locale:r[t.locale].antd,componentSize:t.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}Q(J,"propTypes",{locale:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:s().string,global:s().object}),Q(J,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const ee=J,te=require("lodash-es"),re="undefined"==typeof window,ne=e=>o().isValidElement(e),ae=e=>ne(e)&&e.type===o().Fragment,ie=()=>{},oe=()=>!0,le=async e=>new Promise((t=>setTimeout(t,e))),se=e=>{Promise.resolve().then(e)},ce=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),de=e=>!!(!e&&0!==e||(0,te.isArray)(e)&&!e.length||(0,te.isPlainObject)(e)&&!Object.keys(e).length),ue=(e,t)=>{const r={...e};for(const e of t)delete r[e];return r},pe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,te.isPlainObject)(e)||(0,te.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(a||e,((r,i)=>{a&&(i=r),n[i]=pe(e[i],t)})),n}return e},he=e=>(0,te.isNumber)(e)?`${e}px`:e.toString();function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},me.apply(this,arguments)}function fe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ge extends i.Component{constructor(){super(...arguments),fe(this,"context",void 0),fe(this,"state",{isLoading:!1}),fe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){v("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:t,authConfig:r,click:n,confirm:a}=this.props,{isLoading:i}=this.state,l=e||this.context.size||"",s=(0,te.isFunction)(n)?{onClick:this.clickHandle}:null,c={...ue(this.props,["authConfig","click","confirm"]),size:l,loading:i||t||!1,...s};if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(c.disabled=!0)}return a?o().createElement(L.Popconfirm,{title:a.title||f("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{a.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{a.onCancel?.(e)}},o().createElement(L.Button,me({},c,{onClick:ie}),this.props.children)):o().createElement(L.Button,c,this.props.children)}}fe(ge,"propTypes",{click:s().func,confirm:s().shape({title:s().node,onConfirm:s().func,onCancel:s().func})}),fe(ge,"contextType",c);const be=ge;function ye(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ve=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ve||{});class xe extends i.Component{constructor(){super(...arguments),ye(this,"context",void 0)}render(){const{size:e}=this.props,t=e||this.context.size||"",r=(0,te.isNumber)(e)?e:ve[e||t||"default"],n={...this.props,size:r};return o().createElement(L.Space,n,this.props.children)}}ye(xe,"contextType",c);const Ee=xe,Se=require("classnames");var we=n.n(Se);const Ce=e=>`qm-${e}`,Te=require("@ant-design/icons");function Ie(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ne extends i.Component{constructor(){super(...arguments),Ie(this,"context",void 0),Ie(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=ie}=this.props;t(!e)}))}render(){const{size:e,label:t,extra:r,collapse:n,bordered:a,disabled:i,id:l,className:s,style:c}=this.props,d=e||this.context.size||"",u=Ce("divider"),p={[u]:!0,[`${u}-borderless`]:!a,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return o().createElement("div",{id:l,className:we()(p,s),style:c},o().createElement("span",{className:we()(`${u}__title`)},t),o().createElement("div",{className:we()(`${u}__extra`)},r),void 0!==n&&o().createElement(L.Button,{type:"link",className:we()(`${u}__collapse`),disabled:i,onClick:this.clickHandle},f(n?"qm.divider.collect":"qm.divider.spread"),n?o().createElement(Te.UpOutlined,null):o().createElement(Te.DownOutlined,null)))}}Ie(Ne,"contextType",c),Ie(Ne,"propTypes",{label:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:s().oneOfType([s().element,s().string]),collapse:s().bool,bordered:s().bool}),Ie(Ne,"defaultProps",{bordered:!0});const Re=Ne,Pe=()=>({height:0,opacity:0}),Oe=(e,t)=>"height"===t.propertyName,ke={motionName:"rc-collapse-motion",onEnterStart:Pe,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Pe,onEnterEnd:Oe,onLeaveEnd:Oe,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Ae=require("rc-motion");var Le=n.n(Ae);const _e=o().forwardRef(((e,t)=>{const{forceRender:r,className:n,style:a,boxStyle:i,isActive:l}=e,[s,c]=o().useState(l||r);if(o().useEffect((()=>{(r||l)&&c(!0)}),[r,l]),!s)return null;const d=Ce("collapse");return o().createElement("div",{ref:t,className:we()(`${d}-content`,{[`${d}-content-active`]:l,[`${d}-content-inactive`]:!l},n),style:a},o().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));_e.displayName="PanelContent";const Fe=_e;function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},He.apply(this,arguments)}const De=e=>{const{defaultActive:t,label:r,extra:n,className:a,style:i,containerStyle:l,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=o().useState(!!t),f=Ce("collapse"),g=we()({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},a);return o().createElement("div",{className:g,style:i},o().createElement(Re,{label:r,extra:n,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),p?.(e)}}),o().createElement(Le(),He({visible:h},ke,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((t,r)=>{let{className:n,style:a}=t;return o().createElement(Fe,{ref:r,prefixCls:f,className:n,style:a,boxStyle:l,isActive:h,forceRender:d},e.children)})))};De.displayName="QmCollapse";const $e=De,qe=o().createContext(void 0);function Me(e,t){((t,r)=>{const n=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(n.current)),r),i.useEffect((()=>(n.current=!1,()=>{n.current=!0})),[])})(0,t)}const je=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Ke=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},Ve=e=>e.preventDefault(),ze=(e,t)=>{if(re||!e||!t)return null;"float"===(t=ce(t))&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const n=window.getComputedStyle(e);return n?n[t]:""}catch(r){return e.style[t]}},Be=(e,t,r)=>{!re&&e&&t&&((0,te.isPlainObject)(t)?Object.keys(t).forEach((r=>{Be(e,r,t[r])})):(t=ce(t),e.style[t]=r))},Ue=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},We=(e,t)=>Math.abs(Ue(e)-Ue(t)),Ge=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Ye=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},Xe=(e,t)=>{if(re||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Qe=e=>Math.pow(e,3),Ze=e=>e<.5?Qe(2*e)/2:1-Qe(2*(1-e))/2,Je=e=>{const{minValues:t,onDragChange:r,onDragging:n}=e,{splitRef:a,direction:i}=o().useContext(qe),l=o().useRef(re?null:document.onselectstart),s=o().useMemo((()=>"horizontal"===i),[i]),c=o().useMemo((()=>s?"X":"Y"),[s]),d=o().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 r=e[`page${c}`]-d.current[`start${c}`],a=[t[0],d.current[`containerSize${c}`]-t[1]];let i=d.current[`firstElementSize${c}`]+r;i=Math.max(a[0],i),i=Math.min(a[1],i),n(i)},h=()=>{u({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),Ke(document,"mousemove",p),Ke(document,"mouseup",h),m()},m=()=>{document.onselectstart!==l.current&&(document.onselectstart=l.current)},g=Ce("split"),b={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return o().createElement("div",{className:we()(b),title:f("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,n=t.children[0];u({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),je(document,"mousemove",p),je(document,"mouseup",h),r(!0),l.current=document.onselectstart,document.onselectstart=()=>!1}})};Je.displayName="ResizeBar";const et=Je,tt=o().forwardRef(((e,t)=>{const{offset:r,className:n,style:a}=e,{direction:i,dragging:l}=o().useContext(qe),s="vertical"===i?"height":"width",c=Ce("split-pane"),d={[c]:!0,isLocked:l,horizontal:"horizontal"===i,vertical:"vertical"===i,[n]:!!n},u=void 0!==r?{[s]:he(r)}:{flex:1,[s]:0};return o().createElement("div",{ref:t,className:we()(d),style:{...u,...a}},e.children)}));tt.displayName="QmSplitPane";const rt=tt;function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nt.apply(this,arguments)}const at=e=>{const{direction:t="horizontal",defaultValue:r="50%",uniqueKey:n,className:a,style:i,onDragStart:l,onDrag:s=ie,onDragEnd:d}=e,{global:u}=o().useContext(c),p=o().useRef(null),h=o().useRef(null),m=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=o().useMemo((()=>n?`split_${n}`:""),[n]),[y,v]=o().useState(!1),[x,E]=o().useState(m(r));Me((()=>{y?l?.(f(x)):(d?.(f(x)),localStorage.setItem(b,x),C(b,x))}),[y]),o().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(m(e)):w(b).then((e=>{localStorage.setItem(b,m(e||r)),S()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},C=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},T=o().useMemo((()=>({splitRef:p,direction:t,dragging:y})),[t,y]),I=[];o().Children.map(e.children,(e=>{ne(e)&&!ae(e)&&"QmSplitPane"===e.type?.displayName&&I.push(e)}));const[N,R]=I,P=o().useMemo((()=>[g(N),g(R)]),[N,R]),O=Ce("split"),k={[O]:!0,vertical:"vertical"===t};return o().createElement(qe.Provider,{value:T},o().createElement("div",{ref:p,className:we()(k,a),style:i},o().createElement(rt,nt({},N.props,{ref:h,offset:x})),o().createElement(et,{minValues:P,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),s(e)}}),o().createElement(rt,R.props)))};at.Pane=rt,at.displayName="QmSplit";const it=at,ot=require("react-countup");var lt=n.n(ot);function st(){return st=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},st.apply(this,arguments)}function ct(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class dt extends i.Component{constructor(){super(...arguments),ct(this,"context",void 0)}render(){const{size:e,className:t,style:r}=this.props,n=e||this.context.size||"",a=Ce("countup"),i={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return o().createElement(lt(),st({},this.props,{className:we()(i,t),style:r}),this.props.children)}}ct(dt,"defaultProps",{duration:2}),ct(dt,"contextType",c);const ut=dt;function pt(){return pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pt.apply(this,arguments)}function ht(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mt extends i.Component{constructor(){super(...arguments),ht(this,"context",void 0)}render(){const{size:e,className:t}=this.props,r=e||this.context.size||"",n=Ce("empty"),a={...this.props,image:L.Empty.PRESENTED_IMAGE_SIMPLE},i={[n]:!0,[`${n}--lg`]:"large"===r,[`${n}--sm`]:"small"===r};return o().createElement(L.Empty,pt({},a,{className:we()(i,t)}))}}ht(mt,"contextType",c),ht(mt,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ft=mt;class gt extends i.Component{render(){const{fullHeight:e,className:t,style:r={}}=this.props,n=Ce("spin"),a={[`${n}-full-height`]:e},i={wrapperClassName:we()(a,t),...ue(this.props,["fullHeight"]),style:{...r,maxHeight:"none"}};return o().createElement(L.Spin,i,this.props.children)}}var bt,yt,vt;bt=gt,vt={tip:"Loading...",fullHeight:!1},(yt=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(yt="defaultProps"))in bt?Object.defineProperty(bt,yt,{value:vt,enumerable:!0,configurable:!0,writable:!0}):bt[yt]=vt;const xt=gt,Et=o().createContext(void 0),St=require("resize-observer-polyfill");var wt=n.n(St);const Ct=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},Tt=function(e,t){!re&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(wt())(Ct),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},It=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Nt(e){const[t,r]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,n=e=>{const{width:t,height:n}=e.contentRect;r({width:t,height:n})};return t&&Tt(t,n),()=>{t&&It(t,n)}}),[e]),t}const Rt=(e,t)=>{const r=i.useRef(!0);i.useLayoutEffect((()=>e(r.current)),t),i.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function Pt(e,t){Rt((t=>{if(!t)return e()}),t)}function Ot(e,t){var r=this;const n=i.useRef(null);i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]);const a=i.useCallback((function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(r,i)),t)}),[e,t]);return a}const kt=6,At={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"}},Lt=e=>{const{thumb:t,always:r,className:n,barSize:a=kt,direction:i="vertical",onDrag:l=ie}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=o().useContext(Et),u=At[i],p=o().useRef(t),h=o().useRef(null),m=o().useRef(null),f=o().useRef({}),g=o().useRef(!1),b=o().useRef(!1),y=o().useRef(re?null:document.onselectstart),[v,x]=o().useState(!1);o().useLayoutEffect((()=>{p.current=t}),[t]),o().useEffect((()=>{const e=c.current;return je(e,"mousemove",C),je(e,"mouseleave",T),()=>{w(),Ke(document,"mouseup",S),Ke(e,"mousemove",C),Ke(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 r=100*(-1*(h.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=r*d.current[u.scrollSize]/100,l(!0)},S=()=>{g.current=!1,f.current={[u.axis]:0},Ke(document,"mousemove",E),Ke(document,"mouseup",S),w(),b.current&&x(!1),l(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},C=()=>{b.current=!1,x(!!p.current.size)},T=()=>{b.current=!0,x(g.current)},I=Ce("scrollbar"),N={[`${I}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},R={[u.reverse]:a},P={[u.size]:t.size,transform:`translate${u.axis}(${t.offset}%)`};return o().createElement(Ud,{name:"fade",in:r||s||v,timeout:300},o().createElement("div",{ref:h,className:we()(N,n),style:R},o().createElement("div",{ref:m,className:`${I}__thumb`,style:P,onMouseDown:e=>{e.stopPropagation(),je(document,"mousemove",E),je(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])})}})))},_t=20,Ft=o().forwardRef(((e,t)=>{const{wrapClassName:r,wrapStyle:n,barWidth:a,always:i,native:l,showTopScrollbar:s,minSize:c=_t,onScroll:d}=e,u=o().useRef(null),p=o().useRef(null),h=o().useRef(null),[m,f]=o().useState({size:0,offset:0,ratio:1}),[g,b]=o().useState({size:0,offset:0,ratio:1}),[y,x]=o().useState(!1),E=Nt(u),S=Nt(h);Pt((()=>{!l&&w()}),[S.width,S.height,E.width,E.height]);const w=Ot((()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,r=e**2/p.current.scrollHeight,n=t**2/p.current.scrollWidth,a=Math.max(r,c),i=Math.max(n,c),o=r/(e-r)/(a/(e-a)),l=n/(t-n)/(i/(t-i)),s=a+4<e?a:0,d=i+4<t?i:0,u=100*p.current.scrollTop/e*o,h=100*p.current.scrollLeft/t*l;f(Object.assign({},m,{size:d,ratio:l,offset:h})),b(Object.assign({},g,{size:s,ratio:o,offset:u}))}),5),C=e=>{x(e)},T=(e,t)=>{(0,te.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const o=(Date.now()-r)/500;o<1?(e.scrollTop=n+(t-n)*Ze(o),a(i)):e.scrollTop=t};a(i)})(p.current,e):p.current.scrollTop=e:v("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},I=(e,t)=>{(0,te.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const o=(Date.now()-r)/500;o<1?(e.scrollLeft=n+(t-n)*Ze(o),a(i)):e.scrollLeft=t};a(i)})(p.current,e):p.current.scrollLeft=e:v("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};o().useImperativeHandle(t,(()=>({container:u.current,scrollTop:p.current?.scrollTop||0,scrollLeft:p.current?.scrollLeft||0,SET_SCROLL_TOP:T,SET_SCROLL_LEFT:I})));const N=o().useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:p})),[y]),R=Ce("scrollbar"),P={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!l};return o().createElement("div",{ref:u,className:we()(R,e.className),style:e.style},o().createElement("div",{ref:p,className:we()(P,r),style:n,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!l&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,r=100*p.current.scrollTop/e*g.ratio,n=100*p.current.scrollLeft/t*m.ratio;f(Object.assign({},m,{offset:n})),b(Object.assign({},g,{offset:r}))})(),d?.({scrollTop:t,scrollLeft:r})}},o().createElement("div",{ref:h,className:`${R}__view`},e.children)),!l&&o().createElement(Et.Provider,{value:N},s&&o().createElement(Lt,{className:"top",direction:"horizontal",thumb:m,barSize:a,always:i,onDrag:C}),o().createElement(Lt,{direction:"horizontal",thumb:m,barSize:a,always:i,onDrag:C}),o().createElement(Lt,{direction:"vertical",thumb:g,barSize:a,always:i,onDrag:C})))}));Ft.displayName="QmScrollbar";const Ht=Ft,Dt=require("sortablejs");var $t=n.n(Dt);const qt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Mt(){return Mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mt.apply(this,arguments)}function jt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Kt=async(e,t)=>{let{fileName:r,headers:n,params:a}=t;const i=a?new URLSearchParams(a).toString():"",o=i?e.includes("?")?"&":"?":"",l=await fetch(e+`${o+i}`,{method:"GET",headers:n});if(!l.ok)throw new Error(f("qm.download.error"));const s=await l.blob(),c=l.headers.get("content-disposition"),d=r||(c?c.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));qt(s,d)},Vt=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e};class zt extends i.Component{constructor(){super(...arguments),jt(this,"context",void 0),jt(this,"state",{actived:{}}),jt(this,"uploadRef",o().createRef()),jt(this,"sortableInstance",void 0),jt(this,"setActiveState",((e,t)=>{this.setState((r=>({actived:Object.assign({},r.actived,{[e]:t??!r.actived[e]})})))})),jt(this,"createSortable",(()=>{this.props.draggable&&(this.sortableInstance=$t().create(this.getFileListNode(),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:e=>{const{oldIndex:t,newIndex:r}=e,{fileList:n=[],onSortChange:a,onChange:i}=this.props;if(t!==r){const e=[...n],[o]=e.splice(t,1);e.splice(r,0,o),a?.(e),i?.({fileList:e})}}}))})),jt(this,"getFileListNode",(()=>Ye(this.uploadRef.current,Ce("upload-file")).querySelector(".ant-upload-list"))),jt(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,maxCount:o,fileList:l=[],beforeUpload:s}=this.props,c=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!i||e.size/1024/1024<i,u=!(o>1)||l.length<o,p=c&&d&&u;if(c||L.message.warning(f("qm.upload.tooltip",{type:a.join(",")})),d||L.message.warning(f("qm.upload.sizeLimit",{size:i})),u||L.message.warning(f("qm.upload.countLimit",{count:o})),!p)return L.Upload.LIST_IGNORE;if(s){const a=s(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),jt(this,"doDownload",(async e=>{const{downloadWithHeaders:t,headers:r}=this.props;try{e.url&&await Kt(e.url,{fileName:e.name,...t?{headers:r}:null})}catch(e){L.message.error(f("qm.download.error"))}})),jt(this,"itemRender",((e,t)=>{const{fileList:r=[],draggable:n,editable:a,iconRender:i,onChange:l,onEditChange:s}=this.props,{actived:c}=this.state,{uid:d,name:u,url:p,status:h="done"}=e,m="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return o().createElement("div",{className:we()("ant-upload-list-item",`ant-upload-list-item-${h}`,"ant-upload-list-item-list-type-text",{handle:n})},o().createElement("div",{className:"ant-upload-list-item-info"},o().createElement("span",{className:"ant-upload-span"},o().createElement("div",{className:"ant-upload-text-icon"},i?i(e):o().createElement(Te.PaperClipOutlined,null)),o().createElement("div",{className:"ant-upload-list-item-name"},c[d]?o().createElement(L.Input,{size:"small",autoFocus:!0,defaultValue:Vt(u),onBlur:t=>{const{value:n}=t.target;if(n!==Vt(u)){const t=Object.assign({},e,{name:n}),a=r.map((e=>e.uid!==d?e:t));s?.(t,a),l?.({file:t,fileList:a})}this.setActiveState(d,!1)}}):o().createElement("a",{target:"_blank",rel:"noreferrer",title:u,href:p,onClick:e=>{e.preventDefault(),a?this.setActiveState(d,!0):t.preview()}},u)),o().createElement("span",{className:"ant-upload-list-item-card-actions"},a&&o().createElement("button",{type:"button",className:m,onClick:()=>this.setActiveState(d)},c[d]?o().createElement(Te.CheckOutlined,null):o().createElement(Te.EditOutlined,null)),a&&o().createElement("button",{type:"button",className:m,onClick:()=>t.preview()},o().createElement(Te.EyeOutlined,null)),o().createElement("button",{type:"button",className:m,onClick:()=>t.download()},o().createElement(Te.DownloadOutlined,null)),o().createElement("button",{type:"button",className:m,onClick:()=>t.remove()},o().createElement(Te.DeleteOutlined,null))))))}))}get $size(){return this.context.size??""}componentDidMount(){this.createSortable()}componentWillUnmount(){this.sortableInstance?.destroy()}render(){const{fileList:e=[],button:t={},fileDirection:r,disabled:n,readOnly:a,className:i,onPreview:l,onChange:s}=this.props,c=Ce("upload-file"),d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===r};return o().createElement(L.Upload,Mt({className:we()(d,i)},ue(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:n||a,onChange:s,onPreview:async e=>{if("function"==typeof l)return l(e,(t=>this.doDownload(t||e)));n||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)},itemRender:(e,t,r,n)=>this.itemRender(t,n)}),o().createElement("span",{ref:this.uploadRef},this.props.children||a&&e.length?this.props.children:o().createElement(L.Button,{type:t.type??"default",icon:t.icon??o().createElement(Te.UploadOutlined,null),disabled:n||a},t.text||f("qm.upload.text"))))}}jt(zt,"contextType",c),jt(zt,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Bt=zt;function Ut(){return Ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ut.apply(this,arguments)}function Wt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gt extends i.Component{constructor(){super(...arguments),Wt(this,"context",void 0),Wt(this,"state",{loading:!1}),Wt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,fileName:t,headers:r,params:n,beforeDownload:a=oe}=this.props,i=(0,te.isString)(e)?e:await this.getActionUrl();if(!i)return v("Download","参数 `action` 有误!");if(!a(i))return;await Kt(i,{fileName:t,headers:r,params:n}),await le(100),this.props.onSuccess?.(),L.message.success(f("qm.download.success"))}catch(e){this.props.onError?.(e),L.message.error(f("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}render(){const{size:e}=this.props,{loading:t}=this.state,r=e||this.context.size||"",n=ue(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return o().createElement(L.Button,Ut({},n,{size:r,loading:t,onClick:this.downloadHandle}),this.props.children)}}Wt(Gt,"propTypes",{action:s().oneOfType([s().string,s().shape({api:s().func.isRequired,params:s().object})]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:s().string,headers:s().object,withCredentials:s().bool,params:s().object,beforeDownload:s().func,onSuccess:s().func,onError:s().func}),Wt(Gt,"defaultProps",{icon:o().createElement(Te.DownloadOutlined,null),children:f("qm.download.text"),withCredentials:!1}),Wt(Gt,"contextType",c);const Yt=Gt,Xt=require("add-dom-event-listener");var Qt=n.n(Xt);const Zt=require("scroll-into-view-if-needed");var Jt=n.n(Zt);class er extends i.Component{renderLabel(){const{activeKey:e,labels:t,onTabClick:r}=this.props;return t.map(((t,n)=>{const a={item:!0,actived:n===e};return o().createElement("div",{key:n,className:we()(a),onClick:e=>r(n,e)},o().createElement("span",null,t))}))}render(){return o().createElement(o().Fragment,null,this.renderLabel())}}const tr=er;class rr extends i.Component{render(){const{label:e,showDivider:t,className:r,style:n}=this.props,a=Ce("anchor-item"),i={[a]:!0};return o().createElement("div",{className:we()(i,r),style:n},t&&o().createElement(Re,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(rr,"displayName","QmAnchorItem");const nr=rr;function ar(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ir extends i.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(e){super(e),ar(this,"context",void 0),ar(this,"currentState","ready"),ar(this,"itemsTotal",void 0),ar(this,"timer",void 0),ar(this,"scrollEvent",void 0),ar(this,"scrollRef",(0,i.createRef)()),ar(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),ar(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Jt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),ar(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=Qt()(this.scrollRef.current,"scroll",(0,te.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=We(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>We(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const a=r[e],i=r[e+1]||1e4;t>=a-1&&t<i&&(n=e)}return n}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:t,labelWidth:r,tabPosition:n,labelList:a=[],onTabClick:i,className:l,style:s}=this.props,c=t||this.context.size||"",d=Ce("anchor"),u={[d]:!0,[`${d}-left`]:"left"===n,[`${d}-top`]:"top"===n,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];o().Children.map(this.props.children,(e=>{ne(e)&&!ae(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const h=this.__is_conf?a.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?a.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,o().createElement("div",{className:we()(u,l),style:s},o().createElement("div",{className:we()("anchor-nav"),style:{width:r?he(r):""}},o().createElement(tr,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),i?.({label:h[e],id:m[e]},t)}})),o().createElement("div",{ref:this.scrollRef,className:we()("anchor-container")},this.__is_conf?this.props.children:p))}}ar(ir,"Item",nr),ar(ir,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:s().arrayOf(s().shape({id:s().string,label:s().string}))}),ar(ir,"defaultProps",{tabPosition:"left"}),ar(ir,"contextType",c);const or=ir;class lr extends i.Component{render(){return o().createElement(L.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(lr,"displayName","QmTabPane");const sr=lr;function cr(){return cr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cr.apply(this,arguments)}function dr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ur extends i.Component{constructor(){super(...arguments),dr(this,"context",void 0)}render(){const{items:e,size:t,tabPosition:r,tabBarGutter:n,className:a,authConfig:i}=this.props,l=t||this.context.size||"",s=Ce("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===l,[`${s}--sm`]:"small"===l},d={...ue(this.props,["items","authConfig"]),size:l,tabBarGutter:n??(["top","bottom"].includes(r)?30:0)},u=[];o().Children.map(this.props.children,(e=>{ne(e)&&!ae(e)&&"QmTabPane"===e.type?.displayName&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(i){const{fieldList:e=[]}=i||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return o().createElement(L.Tabs,cr({},d,{items:p,className:we()(c,a)}))}}dr(ur,"TabPane",sr),dr(ur,"contextType",c),dr(ur,"defaultProps",{tabPosition:"top"});const pr=ur;function hr(){return hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},hr.apply(this,arguments)}function mr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fr extends i.Component{constructor(){super(...arguments),mr(this,"context",void 0),mr(this,"titleRef",o().createRef()),mr(this,"$drawer",null),mr(this,"opened",!1),mr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),mr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,te.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),mr(this,"toggleHandle",(()=>{this.$drawer=Ye(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),mr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),mr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,o=n??r,l=e.open??e.visible,{fullscreen:s}=this.state;o&&o!==l&&(!i&&this.opened||(0,te.isUndefined)(a)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Be(this.$drawer,s?{width:"100%"}:{width:he(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:t,showHeader:r,showFullScreen:n}=this.props;return o().createElement(o().Fragment,null,o().createElement("span",{ref:this.titleRef,className:we()("text")},r&&t),n&&o().createElement("button",{type:"button",className:we()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Te.FullscreenExitOutlined:Te.FullscreenOutlined)))}render(){const{spinning:e,sloading:t}=this.state,{visible:r,open:n,size:a,className:i,loading:l,showHeader:s,maskClosable:c,onClose:d}=this.props,u=this.context.global,p=a||this.context.size||"",h=Ce("drawer"),m={[h]:!0,"no-header":!s,[`${h}--lg`]:"large"===p,[`${h}--sm`]:"small"===p};return o().createElement(L.Drawer,hr({},ue(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:n??r,maskClosable:c??u?.maskClosable??!1,className:we()(m,i),title:this.renderTitle(),footer:null,onClose:d,afterOpenChange:this.afterVisibleChange}),this.props.children,(l||t||e)&&o().createElement(xt,{spinning:!0,className:we()("spinning")}))}}mr(fr,"contextType",c),mr(fr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),mr(fr,"defaultProps",{width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null});const gr=fr,br=require("react-draggable");var yr=n.n(br);function vr(){return vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vr.apply(this,arguments)}function xr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Er="10vh";var Sr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(Sr||{});class wr extends i.Component{constructor(){super(...arguments),xr(this,"context",void 0),xr(this,"draggleRef",o().createRef()),xr(this,"opened",!1),xr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),xr(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),xr(this,"toggleHandle",(e=>{const t=Ye(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{width:n,height:a,showHeader:i}=this.props,{fullscreen:o}=this.state;o?(Be(t,{width:he(n||"60%"),height:"auto",top:Er}),Be(r,{height:a?he(a):this.defaultHeight,maxHeight:"auto"===a?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${Sr[i?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),xr(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),xr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),xr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${Er} - ${Er} - ${Sr[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,o=n??r,l=e.open??e.visible,{fullscreen:s}=this.state;if(o&&o!==l){if(!i&&this.opened||(0,te.isUndefined)(a)&&this.setState({spinning:!0}),!i&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,te.isUndefined)(a)&&this.setState({spinning:!1})}),400)}s!==t.fullscreen&&(s?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:t}=this.state,{title:r,showHeader:n,showFullScreen:a}=this.props;return o().createElement("div",{onMouseOver:()=>{t&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},o().createElement("span",{className:we()("text")},n&&r),a&&o().createElement("button",{type:"button",className:we()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Te.FullscreenExitOutlined:Te.FullscreenOutlined)))}render(){const{spinning:e,sloading:t,fullscreen:r,disabled:n,bounds:a,position:i}=this.state,{visible:l,open:s,height:c,className:d,loading:u,draggable:p,showHeader:h,maskClosable:m,bodyStyle:f,onClose:g}=this.props,b=this.context.global,y=Ce("modal"),v={height:c?he(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},x={[y]:!0,"no-header":!h,[`${y}--lg`]:"large"===this.$size,[`${y}--sm`]:"small"===this.$size};return o().createElement(L.Modal,vr({},ue(this.props,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:s??l,maskClosable:m??b?.maskClosable??!1,className:we()(x,d),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},v,f),onCancel:g,afterClose:this.afterVisibleChange,modalRender:e=>o().createElement(yr(),{nodeRef:this.draggleRef,bounds:a,position:i,disabled:!p||n||r,onStart:(e,t)=>this.onStart(e,t)},o().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(u||t||e)&&o().createElement(xt,{spinning:!0,className:we()("spinning")}))}}xr(wr,"contextType",c),xr(wr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),xr(wr,"defaultProps",{width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Er}});const Cr=wr,Tr=require("memoize-one");var Ir=n.n(Tr);const Nr=(0,i.createContext)(void 0),Rr=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Pr={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)Rr.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},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 r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-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,r){return e.split(t).join(r)},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 "),this.find_replace(e," NIN "," nin ")}},Or=["==","<",">","<=",">=","!=","like","likes","in","nin"],kr=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)Or.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Or.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},Ar=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Lr=["string","number","boolean","symbol"],_r=e=>Lr.includes(typeof e),Fr=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Hr=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Ar,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Hr(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Hr(t))));break;case"in":_r(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":_r(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(Fr(e)?e.slice(0,10):e)!=r;break;case"<":n=(Fr(e)?e.slice(0,10):e)<r;break;case"<=":n=(Fr(e)?e.slice(0,10):e)<=r;break;case">":n=(Fr(e)?e.slice(0,10):e)>r;break;case">=":n=(Fr(e)?e.slice(0,10):e)>=r;break;default:n=(Fr(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const Dr=Pr.stringify,$r=Pr.array_format,qr=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},Mr=(e,t,r)=>{let n=[];t=Pr.replace_symbols(t);try{if(r){const r=new Function("record",`return ${kr(t,"record")};`);n=vn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${kr(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){v("Table","组件 `initialFilter` 参数有误!"),n=e}return n},jr=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...jr(e.children)):t.push(e)})),t},Kr=e=>e.filter((e=>(e.children&&(e.children=Kr(e.children)),!e.hidden&&!e.noAuth))),Vr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Vr(e.children))})),t},zr=(e,t)=>e.map((e=>(e.children&&(e.children=zr(e.children,t)),t?.(e),e))),Br=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Br(r.children,t);if(e)return e}}return null},Ur=e=>{const t=e.children;return t?t[0].children?Ur(t[0]):t[0]:e},Wr=e=>{const t=e.children;return t?t[t.length-1].children?Wr(t[t.length-1]):t[t.length-1]:e},Gr=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Yr=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Yr(r.children,t);if(e)return e}}return null},Xr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Xr(e.children))})),t},Qr=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Vr(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Zr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Zr(e.offsetParent,t,r)}return r},Jr=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,en=(e,t)=>(0,te.transform)(e,((e,r,n)=>{(0,te.isEqual)(r,t[n])||(e[n]=(0,te.isPlainObject)(r)&&(0,te.isPlainObject)(t[n])?en(r,t[n]):r)})),tn=(e,t)=>(0,te.get)(e,t)??"",rn=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,te.set)(e,t,r??"")},nn=(e,t)=>{if(!t.includes("|"))return tn(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(tn(e,t))})),r.every((e=>!e))?"":r.join(" | ")},an=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),on=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},ln=(e,t)=>{const r=e.toString();if(!an(r)||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},sn=(e,t)=>e?u()(e,t):null,cn=(e,t)=>e?u()(e).format(t):"",dn=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 r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},un=e=>{const t=[];if(o().isValidElement(e)){const{children:r}=e.props;o().Children.forEach(r,(e=>{t.push(...un(e))}))}else t.push(e);return t},pn=e=>un(e).join(""),hn=e=>e.filter((e=>!e._group)),mn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const o=Array.isArray(i.condition)?$r(i.condition):Dr(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${o} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],o=e[n];for(const e in o)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(o[e])?$r(o[e]):Dr(o[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},fn=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((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(tn(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},gn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=gn(e[r].children,t);if(n)return[e[r],n].flat()}}},bn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=bn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},yn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=yn(r.children,t);if(e)return e}if(t(r))return r}return null},vn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vn(e.children,t),t(e)||e.children&&e.children.length))),xn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),En=80,Sn="1",wn="0",Cn=400,Tn=["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"],In={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Nn=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),Rn=function(e){return 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",e}({}),Pn=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const On={items:s().arrayOf(s().shape({type:s().string.isRequired,fieldName:s().string.isRequired})),initialValues:s().object,initialExtras:s().object,layout:s().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:s().number,customClass:s().string,compactMode:s().bool,labelWidth:s().oneOfType([s().number,s().string]),labelAlign:s().oneOf(["left","right"]),labelWrap:s().bool,formType:s().oneOf(["default","search","onlyShow"]),disabled:s().bool,uniqueKey:s().string,defaultRows:s().number,defaultExpand:s().bool,searchButtonCols:s().number,scrollToFirstError:s().bool,authConfig:s().object,isAutoFocus:s().bool,isCollapse:s().bool,isFieldsDefine:s().bool,isSearchBtn:s().bool,isSubmitBtn:s().bool,fieldsChange:s().func,onValuesChange:s().func,onFieldsChange:s().func,onFinish:s().func,onFinishFailed:s().func,onReset:s().func,onCollapse:s().func},kn={layout:"horizontal",labelWidth:En,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ie,onFieldsChange:ie,onFinish:ie,onFinishFailed:ie,onReset:ie,onCollapse:ie},An=(e,t)=>{if(!e)return null;if(t===Rn.week){const t=e.match(/^(\d{4})-(\d+)/);return t?u()().year(Number(t[1])).week(Number(t[2])):null}if(t===Rn.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?u()().year(Number(t[1])).quarter(Number(t[2])):null}return u()(e,t)},Ln=(e,t)=>e?u()(e).format(t):"",_n=e=>""===e||null==e,Fn=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Hn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Dn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},$n=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),(0,te.isUndefined)(e.isLeaf)||(n.isLeaf=!!e.isLeaf),(0,te.isUndefined)(e.selectable)||(n.selectable=!!e.selectable),Array.isArray(e.children)&&(n.children=$n(e.children,t,r)),n})),qn=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=qn(r.children,t);if(e)return e}}return null},Mn=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...Mn(e.children,t,r+1))})),n},jn=e=>ne(e)||"string"==typeof e,Kn=e=>ne(e)?un(e).join(""):e??"",Vn=(e,t,r,n)=>{const a={};return a.filters=e.filters?.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}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},zn={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"}},Bn="阿",Un="鿿",Wn=1,Gn=2,Yn=3;let Xn,Qn=null;function Zn(e){return e||null===Qn?("object"==typeof Intl&&Intl.Collator?(Xn=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Qn=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Qn=!1,Qn):Qn}function Jn(e){const t=zn.UNIHANS,r=zn.PINYINS,n=zn.EXCEPTIONS,a={source:e};if(e in n)return a.type=Gn,a.target=n[e],a;let i,o=-1;if(e.charCodeAt(0)<256)return a.type=Wn,a.target=e,a;if(i=Xn.compare(e,Bn),i<0)return a.type=Yn,a.target=e,a;if(0===i)a.type=Gn,o=0;else{if(i=Xn.compare(e,Un),i>0)return a.type=Yn,a.target=e,a;0===i&&(a.type=Gn,o=t.length-1)}if(a.type=Gn,o<0){let r=0,n=t.length-1;for(;r<=n;){o=~~((r+n)/2);const a=t[o];if(i=Xn.compare(e,a),0===i)break;i>0?r=o+1:n=o-1}}return i<0&&o--,a.target=r[o],a.target||(a.type=Yn,a.target=a.source),a}function ea(e){return"string"==typeof e&&Zn()?e.split("").map((e=>Jn(e))):e}const ta={isSupported:Zn,parse:ea,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(zn)})))},genToken:Jn,convertToPinyin:(e,t,r)=>ea(e).map((e=>t&&e.type===Gn?e.target.toLowerCase():e.target)).join(r||"")},ra={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}};ta.isSupported()&&ra.shouldPatch(ta.genToken)&&ta.patchDict(ra);const na=ta,aa=e=>{const{value:t,bordered:r}=e;return o().createElement(L.Input,{value:t,title:t,bordered:r,readOnly:!0})};aa.displayName="FormItemView";const ia=aa;function oa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function la(){return la=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},la.apply(this,arguments)}const{Option:sa}=L.Select,ca=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,multiple:a,loading:i,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:g,disabled:b}=e.option,{itemList:y=[],filterable:v=!0,listHeight:x=Cn,collapseTags:E,maxTagTextLength:S,dropdownStyle:w,openPyt:C=!0}=d,T=de(y)?n:y,I=e=>T.find((t=>t.value===e))?.text||e?.toString()||"",N=e=>a?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?o().createElement(ia,{value:N(r),bordered:h}):o().createElement(L.Select,la({value:r,mode:a?"multiple":void 0,popupClassName:`form-popper__${c}`,dropdownStyle:w,placeholder:p,style:u,loading:i,bordered:h,allowClear:m,disabled:b,showSearch:v,listHeight:x,maxTagCount:E?"responsive":void 0,maxTagTextLength:S},a?{title:N(r)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,N(e),T)})(e)}}),T.map((e=>o().createElement(sa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class da extends i.Component{constructor(){super(...arguments),oa(this,"context",void 0),oa(this,"state",{itemList:[],loading:!1}),oa(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(a),className:we()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":he(d)},required:e.getFormItemRequired(f)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},o().createElement(ca,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(l,r)}}))),h&&o().createElement(L.Col,null,e.renderFormItemButton(l,h)),p&&o().createElement(L.Col,{flex:he(p.labelWidth||En)},e.renderFormItemExtra({fieldName:l,...p}))))}}oa(da,"contextType",Nr);const ua=da;function pa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ha=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=wn,trueValue:h=Sn}=l;return o().createElement(L.Checkbox,{checked:r===h,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{n?.(e),a(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:p)}},u?i:null)};class ma extends i.Component{constructor(){super(...arguments),pa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option,{labelToCheckbox:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(ha,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}pa(ma,"contextType",Nr);const fa=ma,ga=require("react-sortablejs");function ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ya extends i.Component{constructor(){super(...arguments),ba(this,"context",void 0),ba(this,"linkRef",o().createRef()),ba(this,"state",{visible:!1}),ba(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),ba(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),ba(this,"resetFieldsHandle",(e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||pe(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));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,te.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,te.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,te.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,te.isEqual)(t,r)||(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;t?.([...e])}popupRender(){const{items:e}=this.props;return o().createElement(Nr.Consumer,null,(t=>{const r=t.$$form;return o().createElement("div",{className:we()("ant-dropdown-menu","fields-list")},o().createElement("div",{className:"reset"},o().createElement(be,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(r.getOriginItems())},f("qm.table.columnFilter.reset"))),o().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));if((0,te.isEqual)(n,a))return;r.setExpandHandle(!0);const i=xn(t);this.changeHandle(i),this.setLocalFields(i)}},e.map((t=>o().createElement("li",{key:t.fieldName,className:"item",style:t.noAuth?{display:"none"}:void 0},o().createElement(L.Checkbox,{disabled:t.rules?.findIndex((e=>e.required))>-1,checked:!t.hidden,onChange:r=>{const{checked:n}=r.target;t.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),o().createElement(Te.HolderOutlined,{className:"handle",title:f("qm.form.draggable")}),o().createElement("span",{className:"title"},r.getFormItemLabel(t.label)))))))}))}render(){const{visible:e}=this.state,t=Ce("form-fields-filter");return o().createElement(Nr.Consumer,null,(r=>{const{$size:n}=r.$$form,a={[t]:!0,[`${t}--lg`]:"large"===n,[`${t}--sm`]:"small"===n};return o().createElement(L.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:we()(a),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},o().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},o().createElement(Te.UnorderedListOutlined,null)))}))}}ba(ya,"contextType",c);const va=ya;function xa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ea=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Nr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h,onBlur:m=ie,onEnter:g=ie}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:w,autoFocus:C,autoComplete:T,secretType:I}=l,N=I&&(p||h),R=o().useRef(),P=e=>{a?.(e),i(e)},O=v?L.Input.Password:L.Input,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}(n,I):n;return r.isOnlyShow?o().createElement(ia,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):o().createElement(O,{ref:e=>{R.current=e,"function"==typeof t&&t(e)},value:k,autoComplete:v?"new-password":T,autoFocus:C,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:p,disabled:h,onBlur:t=>{let r=t.target.value??"";if(w){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),m(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),r.isFilterType&&(r.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,te.isRegExp)(E)&&(t=E.test(t)?t:n??""),S&&(t=t.toUpperCase()),P(t)}})}));Ea.displayName="VInput";class Sa extends i.Component{constructor(){super(...arguments),xa(this,"context",void 0),xa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ea,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(a,u)),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}xa(Sa,"contextType",Nr);const wa=Sa;function Ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ta=e=>{const{$$form:t}=o().useContext(Nr),{value:r=[],onChange:n,onValuesChange:a}=e,{options:i={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:p,suffix:h,maxLength:m}=i,g=e=>{const t=e.every((e=>!e))?[]:e;n?.(t),a(t,b(t))},b=e=>e.join(" - ");return t.isOnlyShow?o().createElement(ia,{value:b(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:l[0],prefix:p,suffix:h,maxLength:m,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),o().createElement(L.Input,{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}),o().createElement(L.Input,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:l[1],prefix:p,suffix:h,maxLength:m,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Ia extends i.Component{constructor(){super(...arguments),Ca(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ta,{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(a,t)}}))),c&&o().createElement(L.Col,{flex:he(c.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ca(Ia,"contextType",Nr);const Na=Ia,Ra=require("big.js");var Pa=n.n(Ra);function Oa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ka=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Nr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:p,onBlur:h=ie,onEnter:m=ie}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:w=!0,formatter:C,parser:T}=l,I=o().useRef(),N=o().useRef(n),R=e=>{const t=_n(e)?"":(0,te.isNumber)(e)?e.toFixed(v):new(Pa())(e).toFixed(v);return"function"==typeof C?C(t):t},P={[S]:!0,controls:w};return r.isOnlyShow?o().createElement(ia,{value:R(n),bordered:d}):o().createElement(L.InputNumber,{ref:e=>{I.current=e,"function"==typeof t&&t(e)},value:n,className:we()(P),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:w,precision:v,autoFocus:x,stringMode:E,formatter:C,parser:T,bordered:d,readOnly:u,disabled:p,onBlur:()=>{se((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(N.current),h(N.current)}))},onKeyUp:e=>{13===e.keyCode&&(m(n),r.isFilterType&&(r.SUBMIT_FORM(),I.current?.blur()))},onChange:e=>{const t=e??"";!E&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{N.current=e,a?.(e),i(e,R(e))})(t)}})}));ka.displayName="VInputNumber";class Aa extends i.Component{constructor(){super(...arguments),Oa(this,"context",void 0),Oa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(ka,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(a,u)),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Oa(Aa,"contextType",Nr);const La=Aa;function _a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fa=e=>{const{$$form:t}=o().useContext(Nr),{value:r=[],onChange:n,onValuesChange:a}=e,{options:i={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:p=1,min:h=0,max:m,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=i,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];n?.(t),a(t,w(t))},w=e=>_n(e)?"":e.map((e=>_n(e)?"":Number(e).toFixed(y))),C={[g]:!0,controls:b};return t.isOnlyShow?o().createElement(ia,{value:w(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.InputNumber,{value:r[0],className:we()("site-input-left",C),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:l[0],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([e,r[1]])},onBlur:()=>{E(r)}}),o().createElement(L.Input,{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}),o().createElement(L.InputNumber,{value:r[1],className:we()("site-input-right",C),style:{width:"calc(50% - 5px)"},placeholder:l[1],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([r[0],e])},onBlur:()=>{E(r)}}))};class Ha extends i.Component{constructor(){super(...arguments),_a(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Fa,{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(a,t)}}))),c&&o().createElement(L.Col,{flex:he(c.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...c}))))}}_a(Ha,"contextType",Nr);const Da=Ha;let $a=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Ma}=L.Input;class ja extends i.Component{constructor(e){var t;super(e),t=this,qa(this,"context",void 0),qa(this,"deriveParams",void 0),qa(this,"valueKey",void 0),qa(this,"_is_change",!1),qa(this,"_record",void 0),qa(this,"_prevValue",null),qa(this,"state",{visible:!1,loading:!1}),qa(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),qa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),qa(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),qa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),qa(this,"getDerivedSearchHelper",(()=>this.searchHelper)),qa(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||de(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&Dn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),qa(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),qa(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,te.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),qa(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=oe,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,o)=>{const l=(0,te.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(l))return o();this.setState({loading:!0});try{const e=await t.fetch.api(l);200===e.code?i(Array.isArray(e.data)?e.data:(0,te.get)(e.data,t.fetch.dataKey)??[]):o()}catch(e){o(e)}finally{se((()=>this.setState({loading:!1})))}}))})),qa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Fn(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Fn(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),qa(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>Fn(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(r)})),qa(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??oe)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),qa(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Fn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])});const n=Fn(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),qa(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)})),qa(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),qa(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),qa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),qa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),qa(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(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n}=this.props,{type:a,fieldName:i,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ia,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(Ma,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,onBlur:e=>{const{value:r}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(r),this._is_change&&!t&&(r?n?a?.fetch?.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e,r))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(r):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:r}=e.target;!t&&this.openSearchHelper(r)}},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"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):se((()=>this.clearSearchHelperValue())))}}),o().createElement(Cr,v,o().createElement(sd,x)))}}qa(ja,"contextType",Nr);class Ka extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),qa(this,"context",void 0),qa(this,"promiseRef",void 0),qa(this,"searchRef",void 0),qa(this,"state",{searchHelper:{}}),qa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),qa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ja,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(i,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}qa(Ka,"contextType",Nr);const Va=Ka;function za(){return za=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},za.apply(this,arguments)}function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ua=e=>{class t extends i.Component{constructor(){var e;super(...arguments),e=this,Ba(this,"startClick",void 0),Ba(this,"event1",null),Ba(this,"event2",null),Ba(this,"$el",null),Ba(this,"omitClassNames",[]),Ba(this,"state",{clickOutside:!1}),Ba(this,"mousedownHandler",(e=>{this.startClick=e})),Ba(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Ba(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),o=this.$el===r,l=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=l.some((e=>e?.contains(r)))||l.includes(n);let c;c=!(a||i||o||s),this.setState({clickOutside:c})})),Ba(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Ba(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=Qt()(document,"mousedown",this.mousedownHandler),this.event2=Qt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:r}=this.state;return o().createElement(e,za({ref:t},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ba(t,"displayName",`OutsideClick(${e.displayName||e.name})`),o().forwardRef(((e,r)=>o().createElement(t,za({},e,{forwardedRef:r}))))},Wa=require("rc-trigger");var Ga,Ya,Xa=n.n(Wa);function Qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Za=Ua((Ya=class extends i.Component{constructor(e){var t;super(e),t=this,Qa(this,"context",void 0),Qa(this,"searchRef",o().createRef()),Qa(this,"_records",[]),Qa(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Qa(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),Qa(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Qa(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Qa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Qa(this,"setItemList",(e=>{this.setState({itemList:e})})),Qa(this,"setRecords",(e=>{this._records=e})),Qa(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Qa(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Qa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Qa(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,te.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const a=t.recordsToDict();t.setItemList(a),t.triggerChange(a.map((e=>e.value)));const{closed:i}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>i?.(t._records)),200)}))})),Qa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,te.isEqual)((0,te.intersection)(r,n),[...new Set(n)])||(0,te.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:o,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof l?l():l||{},{value:c}=this.props;if(r&&!de(c)){this.setState({loading:!0});try{const l=await r(a({...n,keys:c}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,te.get)(l.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),o?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,te.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ce("form-multiple-search-helper"),{size:T}=e.context,I={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const N=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ia,{value:N,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Xa(),{popupVisible:!g&&r,popup:S,popupClassName:we()(I),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:In,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:i,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:N,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(Cr,v,o().createElement(sd,x)))}},Qa(Ya,"contextType",Nr),Ga=Ya))||Ga;class Ja extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),Qa(this,"context",void 0),Qa(this,"promiseRef",void 0),Qa(this,"state",{searchHelper:{}}),Qa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Qa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Za,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}Qa(Ja,"contextType",Nr);const ei=Ja;function ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:ri}=L.Input;class ni extends i.Component{constructor(e){super(e),ti(this,"context",void 0),ti(this,"valueKey",void 0),ti(this,"_record",void 0),ti(this,"_prevValue",null),ti(this,"state",{visible:!1,loading:!1}),ti(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),ti(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ti(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),ti(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),ti(this,"getDerivedSearchHelper",(()=>this.searchHelper)),ti(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||de(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&Dn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),ti(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Fn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])})})),ti(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ti(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Fn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])});const n=Fn(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),ti(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),ti(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),ti(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;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(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n=""}=this.props,{type:a,fieldName:i,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,te.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?o().createElement(ia,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(ri,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,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"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),o().createElement(Cr,v,o().createElement(md,x)))}}ti(ni,"contextType",Nr);class ai extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),ti(this,"context",void 0),ti(this,"promiseRef",void 0),ti(this,"state",{searchHelper:{}}),ti(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),ti(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ni,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(i,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}ti(ai,"contextType",Nr);const ii=ai;var oi,li;function si(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ci=Ua((li=class extends i.Component{constructor(e){var t;super(e),t=this,si(this,"context",void 0),si(this,"searchRef",o().createRef()),si(this,"_records",[]),si(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),si(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),si(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),si(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),si(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),si(this,"setItemList",(e=>{this.setState({itemList:e})})),si(this,"setRecords",(e=>{this._records=e})),si(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),si(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),si(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),si(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,te.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const a=t.recordsToDict();t.setItemList(a),t.triggerChange(a.map((e=>e.value)));const{closed:i}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>i?.(t._records)),200)}))})),si(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,te.isEqual)((0,te.intersection)(r,n),[...new Set(n)])||(0,te.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!de(s)){this.setState({loading:!0});try{const o=await r(a({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,te.get)(o.data,i)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,te.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ce("form-multiple-tree-table-helper"),{size:T}=e.context,I={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const N=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ia,{value:N,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Xa(),{popupVisible:!g&&r,popup:S,popupClassName:we()(I),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:In,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:i,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:N,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(Cr,v,o().createElement(md,x)))}},si(li,"contextType",Nr),oi=li))||oi;class di extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),si(this,"context",void 0),si(this,"promiseRef",void 0),si(this,"state",{searchHelper:{}}),si(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),si(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ci,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}si(di,"contextType",Nr);const ui=di;function pi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const hi=new Array(2).fill("");class mi extends i.Component{constructor(e){var t;super(e),t=this,pi(this,"context",void 0),pi(this,"_is_change",!1),pi(this,"_ceho_data",void 0),pi(this,"_records",[]),pi(this,"_is_clear",!1),pi(this,"state",{visible:!1,loading:!1,itemList:[],textValue:hi}),pi(this,"getSearchHelper",Ir()((e=>Object.assign({},this.props.helperConfig,e)))),pi(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),pi(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),pi(this,"setItemList",(e=>{this.setState({itemList:e})})),pi(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),pi(this,"setTextValue",(e=>{this.setState({textValue:e})})),pi(this,"setRecords",(e=>{this._records=e})),pi(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),pi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),pi(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(hi),this.triggerChange([])})),pi(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),pi(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??oe)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),pi(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,r=de(e)?void 0:e;return{[t]:r}})),pi(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=oe,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,o)=>{const l=(0,te.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(l))return o();this.setState({loading:!0});const e=await t.fetch.api(l);if(se((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,te.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}o()}))})),pi(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),pi(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:r=[]}=this.props;(0,te.isEqual)((0,te.intersection)(t,r),[...new Set(r)])||(0,te.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,te.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=hi.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:o}=this.searchHelper.echoRequest||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!de(s)){this.setState({loading:!0});try{const o=await r(a({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,te.get)(o.data,i)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:t=[]}=this.props,{visible:r,loading:n,textValue:a}=this.state,{fieldName:i,options:l={},searchHelper:s={},placeholder:c=f("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=a.every((e=>_n(e)))?"":a.join(" - "),g={visible:r,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${$a[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},b={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,te.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ia,{value:m,bordered:d}):o().createElement(o().Fragment,null,o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:a[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),o().createElement(L.Input,{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}),o().createElement(L.Input.Search,{value:a[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:n,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.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([a[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),o().createElement(Cr,g,o().createElement(Ed,b)))}}pi(mi,"contextType",Nr);class fi extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),pi(this,"context",void 0),pi(this,"promiseRef",void 0),pi(this,"state",{searchHelper:{}}),pi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),pi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(mi,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{m(t,n),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(i,u)),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...d}))))}}pi(fi,"contextType",Nr);const gi=fi;function bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=l,h=de(p)?n:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?o().createElement(ia,{value:m(r),bordered:c}):o().createElement(L.Checkbox.Group,{value:r,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{a?.(e),i(e,m(e))})(e)}},h.map((e=>o().createElement(L.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class vi extends i.Component{constructor(){super(...arguments),bi(this,"context",void 0),bi(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(yi,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}bi(vi,"contextType",Nr);const xi=vi;function Ei(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Si=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},style:l={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=i;return o().createElement(L.Rate,{value:r,count:p,style:l,allowHalf:u,allowClear:s,tooltips:h,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;n?.(e),a(e,(t=e,h?h[Math.ceil(t)-1]:t.toString()))})(e)}})};class wi extends i.Component{constructor(){super(...arguments),Ei(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Si,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ei(wi,"contextType",Nr);const Ci=wi;function Ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ii=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:p=[]}=l,h=de(p)?n:p,m=e=>h.find((t=>t.value===e))?.text??"";return t.isOnlyShow?o().createElement(ia,{value:m(r),bordered:c}):o().createElement(L.Radio.Group,{value:r,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e,m(e))})(t)}},h.map((e=>o().createElement(L.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ni extends i.Component{constructor(){super(...arguments),Ti(this,"context",void 0),Ti(this,"state",{itemList:[]}),Ti(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Ii,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ti(Ni,"contextType",Nr);const Ri=Ni;function Pi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=wn,trueValue:h=Sn}=l;return o().createElement(o().Fragment,null,o().createElement(L.Switch,{checked:r===h,style:s,disabled:d||t.isOnlyShow,checkedChildren:o().createElement(Te.CheckOutlined,null),unCheckedChildren:o().createElement(Te.CloseOutlined,null),onChange:e=>{(e=>{n?.(e),a(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?o().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},i):null)};class ki extends i.Component{constructor(){super(...arguments),Pi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option,{labelToSwitch:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Oi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Pi(ki,"contextType",Nr);const Ai=ki;function Li(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _i=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},style:l={},placeholder:s=f("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p,onBlur:h=ie,onEnter:m=ie}=e.option,{showCount:g,maxLength:b,autoSize:y}=i,v=Object.assign({},{minRows:1,maxRows:3},y);return o().createElement(L.Input.TextArea,{value:r,placeholder:s,style:l,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||t.isOnlyShow,disabled:p,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;m(t)}},onChange:e=>{const{value:t}=e.target;(e=>{n?.(e),a(e)})(t)}})};class Fi extends i.Component{constructor(){super(...arguments),Li(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(_i,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Li(Fi,"contextType",Nr);const Hi=Fi;function Di(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const $i=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.datePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=l,S=o().createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),n?.(e),a(e,C(e))},C=e=>_n(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,T=e=>{let t=Ln(u()().subtract(e,"day"),Rn[g]);"date"===g&&(t=t.slice(0,10)),w(t),S.current.blur(),S.current.focus()};return t.isOnlyShow?o().createElement(ia,{value:C(r),bordered:d}):o().createElement(j,{ref:S,style:{width:"100%",...s},popupClassName:`form-popper__${i}`,picker:Nn[g],format:b,bordered:d,showToday:!1,showTime:"datetime"===g&&{defaultValue:u()("00:00:00","HH:mm:ss")},allowClear:p,disabled:m,inputReadOnly:h,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():o().createElement(o().Fragment,null,o().createElement(L.Tag,{color:"processing",onClick:()=>T(0)},f("qm.form.datePickers")[0]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(1)},f("qm.form.datePickers")[1]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(7)},f("qm.form.datePickers")[2]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(30)},f("qm.form.datePickers")[3])):void 0,value:An(r,Rn[g]),onChange:(e,t)=>{w(Ln(e,Rn[g]))}})};class qi extends i.Component{constructor(){super(...arguments),Di(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement($i,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Di(qi,"contextType",Nr);const Mi=qi;function ji(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ki=e=>[u()().subtract(e,"day"),u()()],Vi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m=t.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:S,shortCuts:w=!0}=l,C={[f("qm.form.dateRangePickers")[0]]:Ki(7),[f("qm.form.dateRangePickers")[1]]:Ki(30),[f("qm.form.dateRangePickers")[2]]:Ki(90),[f("qm.form.dateRangePickers")[3]]:Ki(180)},T=e=>_n(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?o().createElement(ia,{value:T(r),bordered:d}):o().createElement(j.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${i}`,picker:Nn[g],format:b,bordered:d,showTime:"datetime"===g&&{defaultValue:[u()("00:00:00","HH:mm:ss"),u()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:m?[!0,!0]:y,inputReadOnly:h,disabledDate:x??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[E,S])),ranges:w&&g.includes("date")?C:void 0,value:de(r)?null:[An(r?.[0],Rn[g]),An(r?.[1],Rn[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),n?.(e),a(e,T(e))})([Ln(e?.[0],Rn[g]),Ln(e?.[1],Rn[g])])}})};class zi extends i.Component{constructor(){super(...arguments),ji(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Vi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}ji(zi,"contextType",Nr);const Bi=zi;function Ui(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.timePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=l;return t.isOnlyShow?o().createElement(ia,{value:r,bordered:d}):o().createElement(B,{style:{width:"100%",...s},popupClassName:`form-popper__${i}`,bordered:d,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:u,disabled:h,inputReadOnly:p,format:Pn[m],value:An(r,Pn[m]),onChange:(e,t)=>{(e=>{const t=Ln(e,Pn[m]);n?.(t),a(t)})(e)}})};class Gi extends i.Component{constructor(){super(...arguments),Ui(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Wi,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ui(Gi,"contextType",Nr);const Yi=Gi;function Xi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Qi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.timerangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:m="hour-minute-second",disableds:g=[!1,!1],allowEmpty:b,hourStep:y=1,minuteStep:v=1,secondStep:x=1}=l,E=e=>_n(e)?"":e.join(" - ");return t.isOnlyShow?o().createElement(ia,{value:E(r),bordered:d}):o().createElement(B.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${i}`,bordered:d,showNow:!1,hourStep:y,minuteStep:v,secondStep:x,allowClear:u,allowEmpty:b,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Pn[m],value:de(r)?null:[An(r?.[0],Pn[m]),An(r?.[1],Pn[m])],onChange:(e,t)=>{(e=>{const t=[Ln(e?.[0],Pn[m]),Ln(e?.[1],Pn[m])];n?.(t),a(t,E(t))})(e)}})};class Zi extends i.Component{constructor(){super(...arguments),Xi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Qi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Xi(Zi,"contextType",Nr);const Ji=Zi;function eo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class to extends i.Component{constructor(e){super(e),eo(this,"context",void 0),eo(this,"searchRef",o().createRef()),eo(this,"valueKey",void 0),eo(this,"_clicking",!1),eo(this,"_record",void 0),eo(this,"_prevValue",null),eo(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),eo(this,"getSearchHelper",Ir()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),eo(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(n||v("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||v("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&v("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&v("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),eo(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),eo(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||de(d))return this._prevValue=void 0;try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&Dn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}})),eo(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Fn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])})})),eo(this,"fetchHandle",(0,te.debounce)(this.getItemList,200)),eo(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),eo(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),eo(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),eo(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Fn(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Fn(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Fn(e,this.alias[n]);this.triggerChange(a),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){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,te.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=await r(a({...n,[t]:e}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:r,itemList:n,inputText:a}=this.state,{value:i}=this.props,{fieldName:l,options:s={},style:d={},placeholder:u=f("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{listHeight:b=Cn}=s,{hideHeader:y,onlySelect:v=!0}=this.searchHelper||s,x=this.searchHelper.columns||[],E=Ce("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=o().createElement(L.Spin,{spinning:r},n.length?o().createElement("table",{cellSpacing:0,cellPadding:0,className:we()("table")},!y&&o().createElement("thead",null,o().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>o().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),o().createElement("tbody",null,n.map(((e,t)=>o().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((t=>o().createElement("td",{key:t.dataIndex},(0,te.get)(e,t.dataIndex))))))))):o().createElement(ft,null));return o().createElement(c.Consumer,null,(r=>{const s={[E]:!0,[`${E}--lg`]:"large"===r?.size,[`${E}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ia,{value:i,bordered:p}):o().createElement(Xa(),{action:g?[]:["click"],popupVisible:!g&&t,popup:w,popupClassName:we()(s,`form-popper__${l}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:In,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("div",null,o().createElement(L.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:p,readOnly:m,disabled:g,style:{width:"100%",...d},value:a??i,title:i,onFocus:()=>{!n.length&&this.fetchHandle(i)},onBlur:e=>{v&&!this._clicking&&a!==i&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(n[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 r=40===e.keyCode?++t%n.length:(--t+n.length)%n.length;this.setState({activeIndex:r})}},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)}})))}))}}eo(to,"contextType",Nr);class ro extends i.Component{constructor(e,t){let{$$form:r}=t;super(e),eo(this,"context",void 0),eo(this,"promiseRef",void 0),eo(this,"state",{searchHelper:{}}),eo(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),eo(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Vn(Object.assign({},o.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:we()(d),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":he(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(to,{option:this.props.option,helperConfig:t,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(i,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(i,p)),u&&o().createElement(L.Col,{flex:he(u.labelWidth||En)},e.renderFormItemExtra({fieldName:i,...u}))))}}eo(ro,"contextType",Nr);const no=ro;function ao(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class io extends i.Component{constructor(){super(...arguments),ao(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,fieldName:n,className:a,style:i={},collapse:l={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=ie}=l,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===n))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return o().createElement(L.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},o().createElement(Re,{id:n,label:r,className:a,extra:p.map((e=>e.text)).join(" | "),style:{...i},collapse:s[n],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[n]:t})}))),u(t)}}))}}ao(io,"contextType",Nr);const oo=io;function lo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function so(){return so=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},so.apply(this,arguments)}const co=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:co(e.children,t,r,n)}:e)),uo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,multiple:a,loading:i,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:v,filterable:x=!0,listHeight:E=Cn,checkStrictly:S,checkStrategy:w="SHOW_CHILD",collapseTags:C,defaultExpandAll:T=!g,defaultExpandedKeys:I,dropdownStyle:N,openPyt:R=!0}=d,[P,O]=o().useState(de(v)?n:v),k=o().useRef(P);Me((()=>{const e=de(v)?n:v;g?(0,te.isEqual)(e,k.current)||(O(e),k.current=e):O(e)}),[v,n]);const A=e=>qn(P,e)?.text||e?.toString()||"",_=e=>a?e?.map((e=>A(e))).join(",")||"":A(e);return t.isOnlyShow?o().createElement(ia,{value:_(r),bordered:h}):o().createElement(L.TreeSelect,so({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:a,treeCheckable:a,treeCheckStrictly:S,showCheckedStrategy:L.TreeSelect[w],popupClassName:`form-popper__${c}`,dropdownStyle:N,placeholder:p,listHeight:E,style:u,loading:i,bordered:h,allowClear:m,disabled:y,treeDefaultExpandAll:T,treeDefaultExpandedKeys:I,showSearch:x,maxTagCount:C?"responsive":void 0,loadData:g?async e=>{let{key:t,children:r}=e;if(!g||r)return;const{fetchApi:n,params:a,dataKey:i,textKey:o="text",valueKey:l="value",callback:s,formatter:c=(e=>e)}=g;if(n)try{const e=await n(c({...a,[l]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,te.get)(e.data,i)??[],n=co(P,t,l,$n(r,l,o));O(n),s?.(r)}}catch(e){}}:void 0,treeData:P},a?{title:_(r)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,_(e),P)})(e)}}))};class po extends i.Component{constructor(){super(...arguments),lo(this,"context",void 0),lo(this,"state",{itemList:[],loading:!1}),lo(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=$n(t,a,i);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(a),className:we()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":he(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},o().createElement(uo,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:he(p.labelWidth||En)},e.renderFormItemExtra({fieldName:l,...p}))))}}lo(po,"contextType",Nr);const ho=po;function mo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fo(){return fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fo.apply(this,arguments)}const go=e=>{const{$$form:t}=o().useContext(Nr),{value:r,multiple:n,items:a}=e,{fieldName:i,options:l={},style:s={},placeholder:c=f("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,asyncLoad:p,readOnly:h,disabled:m}=e.option,{itemList:g,changeOnSelect:b,checkStrictly:y,checkStrategy:v="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:S=!0}=l,[w,C]=o().useState(de(g)?a:g),T=o().useRef(w);Me((()=>{const e=de(g)?a:g;p?(0,te.isEqual)(e,T.current)||(C(e),T.current=e):C(e)}),[g,a]);const I=e=>Mn(w,e??"").map((e=>e.text)).join("/"),N=e=>n?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?o().createElement(ia,{value:N(r),bordered:d}):o().createElement(L.Cascader,fo({value:(e=>de(e)?[]:n?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:w,multiple:n,maxTagCount:"responsive",changeOnSelect:b||y,showCheckedStrategy:L.Cascader[v],popupClassName:`form-popper__${i}`,dropdownStyle:E,placeholder:c,style:s,bordered:d,allowClear:u,disabled:m,showSearch:x&&!p&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:r,params:n,dataKey:a,textKey:i="text",valueKey:o="value",callback:l,formatter:s=(e=>e)}=p;if(r)try{const e=await r(s({...n,[o]:t.value}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,te.get)(e.data,a)??[],n=co(w,t.value,o,$n(r,o,i));C(n),l?.(r)}}catch(e){}}:void 0},n?{title:N(r)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,N(t),w)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return n?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class bo extends i.Component{constructor(){super(...arguments),mo(this,"context",void 0),mo(this,"state",{itemList:[],loading:!1}),mo(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[],r=$n(t,a,i);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,te.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(a),className:we()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":he(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},o().createElement(go,{option:this.props.option,multiple:t,items:r,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:he(p.labelWidth||En)},e.renderFormItemExtra({fieldName:l,...p}))))}}mo(bo,"contextType",Nr);const yo=bo,vo=require("china-area-data");var xo=n.n(vo);function Eo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const So=["110000","120000","310000","500000"],wo=["810000","820000"],Co=[{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"}],To=[{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"}],Io=e=>na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),No=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...So,...wo].includes(e))):Object.keys(e[t])).map((n=>({l:Io(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:No(e,n,r+1)})))},Ro=(e,t)=>t.map((t=>({l:Io(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Po extends i.Component{constructor(e){super(e),Eo(this,"context",void 0),Eo(this,"searchRef",o().createRef()),Eo(this,"scrollRef",o().createRef()),Eo(this,"zxsAndGa",void 0),Eo(this,"provinces",void 0),Eo(this,"allCities",void 0),Eo(this,"letterCities",void 0),Eo(this,"state",{visible:!1,select_type:"0",active_key:""}),Eo(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Eo(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(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(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Jt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Ro(xo(),So)},{l:"Z2",n:"港澳",c:"",p:"",children:Ro(xo(),wo)}]}createProvince(){return(No(xo(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return To.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...So,...wo].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return o().createElement(L.Radio.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}))}},o().createElement(L.Radio.Button,{value:"0"},f("qm.form.citySelectType.0")),o().createElement(L.Radio.Button,{value:"1"},f("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?Co:To).map((t=>o().createElement("li",{key:t.value,className:we()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return o().createElement(L.Select,{size:"small",placeholder:f("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>o().createElement(L.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,r)=>o().createElement("div",{key:r},o().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),o().createElement("dd",null,t.children?.map((t=>o().createElement("li",{key:t.c,className:we()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ce("form-city-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(r),b=o().createElement("div",{className:"container",style:{...i}},o().createElement("div",{className:"city-drop"},o().createElement("div",{className:"city-drop-toper"},o().createElement("div",{className:"city-drop-toper__type"},this.renderType()),o().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),o().createElement("div",{className:"city-drop-letter"},this.renderLetter()),o().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},o().createElement("dl",null,this.renderCity(r)))));return o().createElement(c.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ia,{value:g,bordered:s}):o().createElement(Xa(),{action:p?[]:["click"],popupVisible:!p&&t,popup:b,popupClassName:we()(a,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:In,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("div",null,o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,readOnly:u,disabled:p,style:{width:"100%",...i},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Eo(Po,"contextType",Nr);class Oo extends i.Component{constructor(){super(...arguments),Eo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Po,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Eo(Oo,"contextType",Nr);const ko=Oo;function Ao(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Lo=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:Lo(e,r)})))};class _o extends i.Component{constructor(e){super(e),Ao(this,"context",void 0),Ao(this,"searchRef",o().createRef()),Ao(this,"prevText",void 0),Ao(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ao(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Lo(xo(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.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 r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=qn(e,t[n]);if(a&&de(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:o="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,te.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,t=this.state.tabs.map(((t,r)=>{const n=t.find((t=>t.value===e[r]))?.text||`${f("qm.form.selectPlaceholder").replace("...","")}(${f("qm.form.regionSelectLabel")[r]})`;return o().createElement(pr.TabPane,{key:r.toString(),tab:n},o().createElement("div",{className:"region-box"},t.map((t=>o().createElement("span",{key:t.value,className:we()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[r]=t.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)}))}},t.text)))))}));return t.length?o().createElement(pr,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):o().createElement(ft,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ce("form-region-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=o().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!t){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return o().createElement(c.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ia,{value:b,bordered:s}):o().createElement(Xa(),{action:p?[]:["click"],popupVisible:!p&&t,popup:g,popupClassName:we()(a,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:In,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("div",null,o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,style:{width:"100%",...i},readOnly:u,disabled:p,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&se((()=>this.initial()))}})))}))}}Ao(_o,"contextType",Nr);class Fo extends i.Component{constructor(){super(...arguments),Ao(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(_o,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(a,r)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ao(Fo,"contextType",Nr);const Ho=Fo;function Do(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const $o=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fileTypes:h,fileSize:m,draggable:g,editable:b,fileDirection:y,onPreview:v,onRemove:x,onSortChange:E,onEditChange:S}=i,{action:w,headers:C,params:T,withCredentials:I=!1,dataKey:N="",downloadWithHeaders:R,fieldAliasMap:P,beforeUpload:O,button:k}=l,A="function"==typeof P?P():P||{};return o().createElement(wl,{name:"file",action:w,multiple:u,headers:C,data:T,withCredentials:I,downloadWithHeaders:R,beforeUpload:O,maxCount:p,fileTypes:h,fileSize:m,draggable:g,editable:b,fileDirection:y,disabled:c,readOnly:t.isOnlyShow||d,button:k,showUploadList:{showDownloadIcon:!0,downloadIcon:o().createElement(Te.DownloadOutlined,null)},fileList:r,onChange:e=>{let{fileList:t}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in A)r[n]=e[n]||t.data?.[A[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(N?(0,te.get)(t.data,N):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(t)},onPreview:v,onRemove:x,onSortChange:E,onEditChange:S})};class qo extends i.Component{constructor(){super(...arguments),Do(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement($o,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Do(qo,"contextType",Nr);const Mo=qo;function jo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ko=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,draggable:v,onRemove:x,onSortChange:E}=i,{action:S,headers:w,params:C,withCredentials:T=!1,dataKey:I="",popupClassName:N,fieldAliasMap:R,beforeUpload:P}=l,O="function"==typeof R?R():R||{};return o().createElement(Ol,{name:"file",action:S,multiple:u,headers:w,data:C,withCredentials:T,popupClassName:N,beforeUpload:P,maxCount:p,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,draggable:v,disabled:c,readOnly:t.isOnlyShow||d,fileList:r,onChange:e=>{let{fileList:t}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in O)r[n]=e[n]||t.data?.[O[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(I?(0,te.get)(t.data,I):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(t)},onRemove:x,onSortChange:E})};class Vo extends i.Component{constructor(){super(...arguments),jo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ko,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}jo(Vo,"contextType",Nr);const zo=Vo;function Bo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Uo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:l,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=i;return o().createElement(bl,{value:r,tinymce:u,upload:l,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{n?.(e),a(e)})(e)}})};class Wo extends i.Component{constructor(){super(...arguments),Bo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=ie}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:we()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":he(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Uo,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&o().createElement(L.Col,{flex:he(d.labelWidth||En)},e.renderFormItemExtra({fieldName:a,...d}))))}}Bo(Wo,"contextType",Nr);const Go=Wo;function Yo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Xo extends i.Component{constructor(e){super(e),Yo(this,"context",void 0),Yo(this,"provide",{$$form:this,echo_data:{}}),Yo(this,"_initialValues",void 0),Yo(this,"_initialOthers",void 0),Yo(this,"_initialExtras",void 0),Yo(this,"_fieldAuth",{}),Yo(this,"wrapperRef",o().createRef()),Yo(this,"formRef",o().createRef()),Yo(this,"originItems",[]),Yo(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Yo(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),Yo(this,"resizeListenerHandle",(0,te.debounce)(this.resizeObserveHandler,10)),Yo(this,"getFormItems",Ir()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Yo(this,"getFlattenItems",Ir()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,te.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),Yo(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Yo(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Yo(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Yo(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),Yo(this,"openValidateInfo",(e=>{const t=o().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return o().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));L.notification.error({message:f("qm.form.validatePrompt"),description:t,duration:10})})),Yo(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Jt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}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(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.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(){Tt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){It(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&&v("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)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,te.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,te.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,Tn.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??wn),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.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=pe(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((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&(this.setState({collapse:e}),this.props.onCollapse?.(e),se((()=>this.props.onCollapse?.(e))))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if(jn(e))return Kn(e);if((0,te.isPlainObject)(e)){const{fieldName:t,label:r,options:n={}}=e;if(jn(r))return Kn(r);const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],a=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=a?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(_n(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{_n(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)de(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=ue(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,te.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:a=1,disabled:i,secretName:o}=n;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),o&&(e.options?e.options.secretType=o:e.options={secretType:o},t.options=Object.assign({},t.options,{secretType:o})),this.setFieldAuth(r,{visible:a,disabled:i,secretName:o})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return o().createElement(wa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return o().createElement(Na,{option:e})}INPUT_NUMBER(e){return o().createElement(La,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return o().createElement(Da,{option:e})}SEARCH_HELPER(e){return o().createElement(Va,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return o().createElement(ei,{option:e})}TREE_TABLE_HELPER(e){return o().createElement(ii,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return o().createElement(ui,{option:e})}RANGE_SEARCH_HELPER(e){return o().createElement(gi,{option:e})}CHECKBOX(e){return o().createElement(fa,{option:e})}MULTIPLE_CHECKBOX(e){return o().createElement(xi,{option:e})}RATE(e){return o().createElement(Ci,{option:e})}RADIO(e){return o().createElement(Ri,{option:e})}SWITCH(e){return o().createElement(Ai,{option:e})}TEXT_AREA(e){return o().createElement(Hi,{option:e})}DATE(e){return o().createElement(Mi,{option:e})}RANGE_DATE(e){return o().createElement(Bi,{option:e})}TIME(e){return o().createElement(Yi,{option:e})}RANGE_TIME(e){return o().createElement(Ji,{option:e})}SELECT(e){return o().createElement(ua,{option:e})}MULTIPLE_SELECT(e){return o().createElement(ua,{option:e,multiple:!0})}IMMEDIATE(e){return o().createElement(no,{option:e})}DIVIDER(e){return o().createElement(oo,{option:e})}TREE_SELECT(e){return o().createElement(ho,{option:e})}MULTIPLE_TREE_SELECT(e){return o().createElement(ho,{option:e,multiple:!0})}CASCADER(e){return o().createElement(yo,{option:e})}MULTIPLE_CASCADER(e){return o().createElement(yo,{option:e,multiple:!0})}CITY_SELECT(e){return o().createElement(ko,{option:e})}REGION_SELECT(e){return o().createElement(Ho,{option:e})}UPLOAD_FILE(e){return o().createElement(Mo,{option:e})}UPLOAD_IMG(e){return o().createElement(zo,{option:e})}TINYMCE(e){return o().createElement(Go,{option:e})}renderFormLabel(e){if(jn(e)||!(0,te.isPlainObject)(e))return e;const{type:t,fieldName:r,label:n,options:a={},onChange:i=ie}=e,{itemList:l=[]}=a;return"SELECT"===t?o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(ca,{option:e,items:l,loading:!1,onValuesChange:(e,t)=>i(e,t)})):"CHECKBOX"===t?o().createElement(o().Fragment,null,o().createElement("span",{style:{paddingRight:5}},n),o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(ha,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:r,style:n={},render:a}=e,{extra:i}=this.state;if(r)return o().createElement(L.Tooltip,{className:"extra-tooltip",title:i[t]},o().createElement(Te.ExclamationCircleOutlined,{style:{marginLeft:4}}));const l=this.formItems.find((e=>e.fieldName===t));return o().createElement("div",{className:"extra-text",title:a?"":i[t],style:n},o().createElement("span",{className:"extra-overflow-cut"},a?a(l,this):i[t]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:t,fieldName:r,invisible:n,tooltip:a,className:i,labelWidth:l=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return de(this.state.formData)?null:o().createElement(L.Form.Item,{label:this.renderFormLabel(t),name:r,rules:c,tooltip:a,hidden:n,className:we()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":he(l)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},u?.(e,this))}createFormItem(e){return(0,te.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(v("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:r,isFieldsDefine:n}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<r;e++)a.push({})}));const i=24/e,l=[],s=a.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return l.push(n),n}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=a.map(((t,r)=>{let{selfCol:n=1}=t;const{type:a,fieldName:s}=t;n=n>=24||"DIVIDER"===a||"TINYMCE"===a?e:n;const u=!(!this.state.collapse&&this.showFilterCollapse)||l[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(l[r]),o().createElement(L.Col,{key:s??r,className:s,span:n*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},a?this.createFormItem(pe(t)):null)}));return n&&"default"===t&&u.push(o().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:t,collapse:r}=this.state,{searchButtonCols:n,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const l=24/t,s=n||1,c=t-e%t-s;return a?o().createElement(L.Col,{key:"-",span:s*l,offset:c*l,style:{textAlign:"right"}},o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(be,{type:"primary",size:this.$size,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},f("qm.form.search")),o().createElement(be,{size:this.$size,icon:o().createElement(Te.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},f("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&o().createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?o().createElement(Te.UpOutlined,null):o().createElement(Te.DownOutlined,null)," ",f(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const n=24/e;return r&&"default"===t?o().createElement(L.Row,{gutter:0},o().createElement(L.Col,{key:"-",span:n},o().createElement(L.Form.Item,null,o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(be,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},f("qm.form.save")),o().createElement(be,{size:this.$size,onClick:()=>this.RESET_FORM()},f("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:r}=this.props;return o().createElement(va,{uniqueKey:e,items:t,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((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[f("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}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))}async GET_FORM_DATA(){try{const e=await 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]}}async VALIDATE_FIELDS(e){try{return[null,await 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)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){v("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return v("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,te.isPlainObject)(t))return v("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return v("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,te.set)(i,r,t[r]));r&&(a?a([...n]):v("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:r,disabled:n,labelWidth:a,labelAlign:i,labelWrap:l,customClass:s}=this.props,c=Ce("form"),d={required:"${label}"+f("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 o().createElement("div",{ref:this.wrapperRef,className:we()(u,e),style:t},o().createElement(L.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:i,labelWrap:l,colon:!1,disabled:n,labelCol:{flex:this.verticalLayout?"initial":he(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},o().createElement(Nr.Provider,{value:this.provide},o().createElement(L.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Yo(Xo,"contextType",c),Yo(Xo,"propTypes",On),Yo(Xo,"defaultProps",kn);const Qo=Xo,Zo={onActivate:l.func,onAddUndo:l.func,onBeforeAddUndo:l.func,onBeforeExecCommand:l.func,onBeforeGetContent:l.func,onBeforeRenderUI:l.func,onBeforeSetContent:l.func,onBeforePaste:l.func,onBlur:l.func,onChange:l.func,onClearUndos:l.func,onClick:l.func,onContextMenu:l.func,onCommentChange:l.func,onCopy:l.func,onCut:l.func,onDblclick:l.func,onDeactivate:l.func,onDirty:l.func,onDrag:l.func,onDragDrop:l.func,onDragEnd:l.func,onDragGesture:l.func,onDragOver:l.func,onDrop:l.func,onExecCommand:l.func,onFocus:l.func,onFocusIn:l.func,onFocusOut:l.func,onGetContent:l.func,onHide:l.func,onInit:l.func,onKeyDown:l.func,onKeyPress:l.func,onKeyUp:l.func,onLoadContent:l.func,onMouseDown:l.func,onMouseEnter:l.func,onMouseLeave:l.func,onMouseMove:l.func,onMouseOut:l.func,onMouseOver:l.func,onMouseUp:l.func,onNodeChange:l.func,onObjectResizeStart:l.func,onObjectResized:l.func,onObjectSelected:l.func,onPaste:l.func,onPostProcess:l.func,onPostRender:l.func,onPreProcess:l.func,onProgressState:l.func,onRedo:l.func,onRemove:l.func,onReset:l.func,onSaveContent:l.func,onSelectionChange:l.func,onSetAttrib:l.func,onSetContent:l.func,onShow:l.func,onSubmit:l.func,onUndo:l.func,onVisualAid:l.func,onSkinLoadError:l.func,onThemeLoadError:l.func,onModelLoadError:l.func,onPluginLoadError:l.func,onIconsLoadError:l.func,onLanguageLoadError:l.func},Jo={apiKey:l.string,id:l.string,inline:l.bool,init:l.object,initialValue:l.string,onEditorChange:l.func,value:l.string,tagName:l.string,cloudChannel:l.string,plugins:l.oneOfType([l.string,l.array]),toolbar:l.oneOfType([l.string,l.array]),disabled:l.bool,textareaName:l.string,tinymceScriptSrc:l.string,rollback:l.oneOfType([l.number,l.oneOf([!1])]),scriptLoading:l.shape({async:l.bool,defer:l.bool,delay:l.number}),...Zo},el=e=>"function"==typeof e,tl=e=>e in Zo,rl=e=>e.substr(2),nl=(e,t,r,n,a)=>((t,r,n,a,i,o,l)=>{const s=Object.keys(i).filter(tl),c=Object.keys(o).filter(tl),d=s.filter((e=>void 0===o[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=rl(e),r=l[t];n(t,r),delete l[t]})),u.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=rl(n);l[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let al=0;const il=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return al++,e+"_"+r+al+String(t)},ol=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),ll=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),sl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},cl=()=>({listeners:[],scriptId:il("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),dl=(()=>{let e=cl();return{load:(t,r,n,a,i,o)=>{const l=()=>((t,r,n,a,i,o)=>{const l=r.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=t,l.src=n,l.async=a,l.defer=i;const s=()=>{l.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};l.addEventListener("load",s),r.head&&r.head.appendChild(l)})(e.scriptId,t,r,n,a);e.scriptLoaded?o():(e.listeners.push(o),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(l,i):l()))},reinitialize:()=>{e=cl()}}})(),ul=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function pl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class hl extends i.Component{constructor(e){var t;super(e),t=this,pl(this,"editor",void 0),pl(this,"id",void 0),pl(this,"elementRef",void 0),pl(this,"inline",void 0),pl(this,"currentContent",void 0),pl(this,"boundHandlers",void 0),pl(this,"rollbackTimer",void 0),pl(this,"valueCursor",void 0),pl(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})),pl(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){}})),pl(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),pl(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))}})),pl(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),pl(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=t.elementRef.current;if(!r)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(r)){if(0===e)setTimeout((()=>t.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>t.initialise(e+1)),100)}return}const n=ul(t.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const a={...t.props.init,selector:void 0,target:r,readonly:t.props.disabled,inline:t.inline,plugins:(i=t.props.init?.plugins,o=t.props.plugins,ll(i).concat(ll(o))),toolbar:t.props.toolbar??t.props.init?.toolbar,setup:e=>{t.editor=e,t.bindHandlers({}),t.inline&&!ol(r)&&e.once("PostRender",(r=>{e.setContent(t.getInitialValue(),{no_events:!0})})),t.props.init&&el(t.props.init.setup)&&t.props.init.setup(e)},init_instance_callback:e=>{const r=t.getInitialValue();t.currentContent=t.currentContent??e.getContent(),t.currentContent!==r&&(t.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=t.props.disabled??!1;sl(t.editor,n?"readonly":"design"),t.props.init&&el(t.props.init.init_instance_callback)&&t.props.init.init_instance_callback(e)}};var i,o;t.inline||(r.style.visibility=""),ol(r)&&(r.value=t.getInitialValue()),n.init(a)})),this.id=this.props.id||il("tiny-react"),this.elementRef=i.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??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 r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;sl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==ul(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&dl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??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(){const e=ul(this.view)?.Env?.browser?.isIE();return e?"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:e="div"}=this.props;return i.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return i.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){nl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(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)):r&&!n&&(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))}}}function ml(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}pl(hl,"propTypes",Jo),pl(hl,"defaultProps",{cloudChannel:"6"});var fl=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(fl||{});class gl extends i.Component{constructor(){super(...arguments),ml(this,"context",void 0),ml(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(){const{size:e,className:t,style:r,tinymce:n={},upload:a={},thresholdSize:i=.5,tinymceScriptSrc:l,disabled:s,value:c,onResizeEditor:d,onChange:u}=this.props,p=this.context.global,h=this.context.locale,m=e||this.context.size||"",g=Ce("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===m,[`${g}--sm`]:"small"===m},y={init:{height:n.height||this.defaultOption.height,plugins:n.plugins||this.defaultOption.plugins,toolbar:n.toolbar||this.defaultOption.toolbar,menubar:n.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:fl[h],skin:"tinymce-5",...ue(n,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:o,dataKey:l}=a,s=`data:image/jpeg;base64,${e.base64()}`,c=new FormData;c.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>i)try{const e=await fetch(n,{method:"POST",body:c,headers:o});if(!e.ok)throw new Error(f("qm.upload.uploadError"));const r=await e.json();200===r.code&&t(l?(0,te.get)(r.data,l):r.data)}catch(e){L.message.error(f("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;d?.({width:r,height:n},t)}))}},value:c,disabled:s,tinymceScriptSrc:l||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{u?.(t.getContent(),t)}};return o().createElement("div",{className:we()(b,t),style:r},o().createElement(hl,y))}}ml(gl,"contextType",c),ml(gl,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const bl=gl,yl=require("cropperjs");var vl=n.n(yl);function xl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class El extends i.Component{constructor(){super(...arguments),xl(this,"imgRef",o().createRef()),xl(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:a,...i}=this.props,o={};for(const e in i)void 0!==this.props[e]&&(o[e]=this.props[e]);this.cropper=new(vl())(this.imgRef.current,o)}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:t,src:r,alt:n,imgStyle:a}=this.props,i=Ce("cropper"),l={[i]:!0};return o().createElement("div",{className:we()(l,e),style:t},o().createElement("img",{ref:this.imgRef,src:r,alt:n,style:{maxWidth:"100%",...a}}))}}xl(El,"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});const Sl=El,wl=Bt;function Cl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Tl extends i.Component{constructor(){super(...arguments),Cl(this,"context",void 0),Cl(this,"cropperRef",o().createRef()),Cl(this,"beforeUploadRef",void 0),Cl(this,"fileRef",void 0),Cl(this,"resolveRef",void 0),Cl(this,"rejectRef",void 0),Cl(this,"state",{src:""}),Cl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],r,{type:t});Object.assign(a,{uid:n});const{fileTypes:i=[],fileSize:o}=this.props;if(i.length&&!i.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return L.message.warning(f("qm.upload.tooltip",{type:i.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const l=this.beforeUploadRef(a,[a]);if("boolean"==typeof l||l){if(!0===l)return this.resolveRef(a);if(!1===l)return this.rejectRef("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else v("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await le(100),this.onClose()})),Cl(this,"onOk",(()=>{this.confirmHandle()})),Cl(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:t}=this.props,r=Array.isArray(e)?e[0]:e;if(!r)return null;const{beforeUpload:n,...a}=r.props;return this.beforeUploadRef=n,o().createElement(r.type,{...a,beforeUpload:(e,r)=>new Promise((async(n,a)=>{const i=()=>n(L.Upload.LIST_IGNORE);if(t&&!await t(e,r))return void i();this.fileRef=e,this.resolveRef=n,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 o().createElement("div",{className:"cropper-preview"},o().createElement("div",{className:"cropper-area"},o().createElement("div",{className:"img-cropper"},o().createElement(Sl,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),o().createElement("div",{className:"actions"},o().createElement(L.Space,{size:"small"},o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},f("qm.uploadCropper.zoomIn")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},f("qm.uploadCropper.zoomOut")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},f("qm.uploadCropper.rotatePlus")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Te.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},f("qm.uploadCropper.rotateSubtract"))))),o().createElement("div",{className:"preview-area"},o().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{className:e}=this.props,{src:t}=this.state,r=Ce("cropper-preview");return o().createElement(o().Fragment,null,this.renderUpload(),t&&o().createElement(L.Modal,{open:!0,wrapClassName:we()(r,e),title:f("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Cl(Tl,"contextType",c);const Il=Tl;function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nl.apply(this,arguments)}function Rl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Pl extends i.Component{constructor(){super(...arguments),Rl(this,"context",void 0),Rl(this,"state",{previewVisible:!1,currentIndex:0}),Rl(this,"uploadRef",o().createRef()),Rl(this,"sortableInstance",void 0),Rl(this,"isFocused",!1),Rl(this,"createSortable",(()=>{this.props.draggable&&(this.sortableInstance=$t().create(this.getFileListNode(),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:e=>{const{oldIndex:t,newIndex:r}=e,{fileList:n=[],onSortChange:a,onChange:i}=this.props;if(t!==r){const e=[...n],[o]=e.splice(t,1);e.splice(r,0,o),a?.(e),i?.({fileList:e})}}}))})),Rl(this,"getFileListNode",(()=>Ye(this.uploadRef.current,Ce("upload-img")).querySelector(".ant-upload-list"))),Rl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,beforeUpload:o}=this.props,l=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!i||e.size/1024/1024<i,c=l&&s;if(l||L.message.warning(f("qm.upload.tooltip",{type:a.join(",")})),s||L.message.warning(f("qm.upload.sizeLimit",{size:i})),!c)return L.Upload.LIST_IGNORE;if(o){const a=o(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Rl(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})})),Rl(this,"handlePaste",(async e=>{const{fileList:t=[],action:r,data:n,headers:a,onChange:i}=this.props;if(this.isFocused&&this.showUploadButton&&r)for(const o of e.clipboardData.items)if("file"===o.kind&&o.type.startsWith("image/")){const e=o.getAsFile(),l=Date.now(),s=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(s,{uid:`rc-upload-${l}`});try{await this.beforeUpload(s,[...t,s]);const e=new FormData;if(e.append("file",s),n)for(const t in n)e.append(t,n[t]);const o="string"==typeof r?r:await r(s),l=await fetch(o,{method:"POST",body:e,headers:a});if(!l.ok)throw new Error(f("qm.upload.uploadError"));const c=await l.json();i?.({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(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}componentDidMount(){this.createSortable(),document.addEventListener("paste",this.handlePaste)}componentDidUpdate(e){const{fileList:t}=e,{fileList:r}=this.props;t===r||this.showUploadButton||(this.isFocused=!1)}componentWillUnmount(){this.sortableInstance?.destroy(),document.removeEventListener("paste",this.handlePaste)}render(){const{previewVisible:e,currentIndex:t}=this.state,{fileList:r=[],fixedSize:n,quality:a,fileTypes:i,fileSize:l,draggable:s,disabled:c,readOnly:d,className:u,popupClassName:p,openCropper:h,beforeCrop:m}=this.props,g=Ce("upload-img"),b={[g]:!0,[`${g}--lg`]:"large"===this.$size,[`${g}--sm`]:"small"===this.$size},y=c||d,v=o().createElement(L.Upload,Nl({className:we()(b,u)},ue(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:y,onPreview:this.handlePreview,showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,r,n)=>o().createElement("div",{className:we()("upload-item",{handle:s})},e,!y&&o().createElement(Te.CloseOutlined,{title:f("qm.upload.remove"),className:"icon",onClick:()=>n.remove()}))}),o().createElement("span",{ref:this.uploadRef},!this.showUploadButton||d&&r.length?null:o().createElement(o().Fragment,null,o().createElement("p",{className:"ant-upload-drag-icon"},o().createElement(Te.InboxOutlined,null)),o().createElement("p",{className:"ant-upload-text"},f("qm.uploadCropper.dragableText")),o().createElement("button",{className:we()("ant-upload-button",{disabled:y}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{this.isFocused=!0},onBlur:()=>{this.isFocused=!1}},f("qm.uploadCropper.pasteText")))));return o().createElement(o().Fragment,null,h?o().createElement(Il,{className:p,fixedSize:n,quality:a,fileTypes:i,fileSize:l,beforeCrop:m},v):v,o().createElement("div",{style:{display:"none"}},o().createElement(L.Image.PreviewGroup,{preview:{visible:e,current:t,rootClassName:p,onVisibleChange:e=>{this.setState({previewVisible:e})}}},r.map(((e,t)=>o().createElement(L.Image,{key:e.uid??t,src:e.url,alt:""}))))))}}Rl(Pl,"contextType",c),Rl(Pl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Ol=Pl,kl=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=kl(i.children,t,r);e&&(n=e)}}return n},Al=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Al(e.children,t),t(e)||e.children&&e.children.length))),Ll=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ll(e.children,t)),t(e)&&r.push(e)})),r},_l=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=_l(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Fl=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Fl(e.children,t,r,n)}:e)),Hl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Hl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},Dl=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=Dl(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},$l=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...$l(e,t)))),r},ql=o().forwardRef(((e,t)=>{const{className:r,style:n,filterable:a=!0,multiple:i,draggable:l,dataSource:s,fetch:d,asyncLoad:u,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:m=f("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:w,onCheckChange:C,onDragStart:T,onDragChange:I,onExpand:N}=e,{size:R}=o().useContext(c),P=o().useMemo((()=>e.size??R??""),[e.size,R]),O=g?.valueKey||"value",k=g?.textKey||"text",A=o().useRef(null),_=Nt(A),[F,H]=o().useState(y),[D,$]=o().useState(!1),q=Ot((()=>{H(A.current.offsetHeight-Z.current.offsetHeight-10)}),5);Pt((()=>{y||q()}),[_.height]);const[M,j]=o().useState([]),[K,V]=o().useState({}),[z,B]=o().useState([]),[U,W]=o().useState([]),[G,Y]=o().useState(""),[X,Q]=o().useState(x),Z=o().useRef(null),J=o().useRef([]),ee=o().useRef([]);o().useEffect((()=>{Array.isArray(s)&&(re(s),B(ne(s)),V({}))}),[s]),o().useEffect((()=>{oe()}),[]),Me((()=>{oe()}),[d?.params]),Me((()=>{W(ie())}),[K]),o().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=_l(M,(t=>e===t[O]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],re([...M]))},REMOVE_RECORD:e=>{const t=kl(M,e,O);if(void 0===t&&M.find((t=>t[O]===e)))re(M.filter((t=>t[O]!==e)));else{const r=_l(M,(e=>t===e[O]));if(!r)return;const n=r.children?.findIndex((t=>e===t[O]));n>=0&&(r.children.splice(n,1),re([...M]))}},UPDATE_RECORD:(e,t)=>{const r=_l(M,(t=>e===t[O]));r&&((0,te.merge)(r,t),re([...M]))}})));const re=e=>{j(e),J.current=e,ee.current=Hl(e,O)},ne=e=>{if(i)return v;const t=Ll(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][O]]:[]},ae=e=>Dl(M,e,O)?.slice(0,-1)||[],ie=()=>{if(x)return ee.current;const e=[];return z.forEach((t=>{if(i){if("SHOW_ALL"===h&&!ee.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const r=qn(M,t);if(r){const n=ae(t),a=$l(r,O);e.push(...n,...[t,...a].filter((e=>ee.current.includes(e))))}}}else e.push(...ae(t))})),[...new Set(e)]},oe=async()=>{if(!d)return;const{api:e,params:t,dataKey:r,afterFetch:n,callback:a}=d;try{$(!0);const i=await e(t);if(200===i.code){let e=Array.isArray(i.data)?i.data:(0,te.get)(i.data,r)??[];e="function"==typeof n?await n(e):e,re(e),B(ne(e)),V({}),a?.(e)}}catch(e){}$(!1)},le=e=>`${e}|${na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ce("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===P,[`${se}--sm`]:"small"===P};return o().createElement("div",{ref:A,className:we()(ce,r),style:n},o().createElement("div",{ref:Z,className:"topper"},E&&o().createElement(L.Input.Search,{value:G,size:P,placeholder:m,allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=Al(J.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==le(r).indexOf(e)}));Y(e),j(t),x||e?W(Hl(t,O)):V({})})(e.target.value)}),S&&o().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:ee.current)}},X?o().createElement(Te.UpOutlined,null):o().createElement(Te.DownOutlined,null)," ",f(X?"qm.form.collect":"qm.form.spread"))),o().createElement(xt,{spinning:D},o().createElement(L.Tree,{fieldNames:{title:k,key:O,children:"children"},multiple:i,draggable:l,blockNode:l,checkable:i,selectable:!i,height:F,disabled:e.disabled,checkStrictly:p,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:U,treeData:M,loadData:u?async e=>{let{key:t,children:r}=e;if(!d||r)return;const{api:n,params:a,dataKey:i,formatter:o=(e=>e),afterFetch:l}=d;try{const e=await n(o({...a,[O]:t}));if(200===e.code){let r=Array.isArray(e.data)?e.data:(0,te.get)(e.data,i)??[];r="function"==typeof l?await l(r):r;const n=Fl(J.current,t,O,r);re(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==le(t).indexOf(G)},onDragStart:T,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][O]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},o=[...M];let l;if(i(o,r,((e,t,r)=>{r.splice(t,1),l=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));else{let e,r=[];i(o,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,l):r.splice(e+1,0,l)}else i(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));re(o)},onDragEnd:e=>{I?.(e,M)},onExpand:(e,t)=>{de(e)&&Q(!1),ee.current.every((t=>e.includes(t)))&&Q(!0),W(e),N?.(e,t)},onSelect:e=>{B(e);const t=Ll(J.current,(t=>e.includes((0,te.get)(t,O))));w?.(i?t:t[0])},onCheck:e=>{p&&(e=e.checked),B(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!ee.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(kl(M,e,O)))));const t=Ll(J.current,(t=>e.includes((0,te.get)(t,O))));C?.(i?t:t[0])}})))}));ql.displayName="QmSearchTree";const Ml=ql,jl=(0,i.createContext)(void 0),Kl={dataIndex:s().string.isRequired,title:s().string.isRequired,description:s().string,colSpan:s().number,width:s().number,minWidth:s().number,fixed:s().oneOf(["left","right"]),align:s().oneOf(["left","center","right"]),theadAlign:s().oneOf(["left","center","right"]),printFixed:s().bool,hidden:s().bool,noAuth:s().bool,noFixed:s().bool,ellipsis:s().bool,className:s().string,theadClassName:s().string,children:s().array,sorter:s().oneOfType([s().bool,s().func]),filter:s().shape({type:s().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),style:s().object}),precision:s().number,displayPrecision:s().number,formatType:s().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:s().bool,canCopy:s().bool,editRender:s().func,dictItems:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),summation:s().shape({sumBySelection:s().bool,displayWhenNotSelect:s().bool,dataKey:s().string,unit:s().string,render:s().func}),groupSummary:s().shape({dataKey:s().string,unit:s().string,render:s().func}),shouldCellUpdate:s().func,headRender:s().func,render:s().func},Vl=(s().arrayOf(s().shape(Kl)).isRequired,s().func,s().array,s().oneOfType([s().string,s().func]).isRequired,s().number,s().bool,s().bool,s().shape({api:s().func.isRequired,params:s().object.isRequired,formatter:s().func,beforeFetch:s().func,afterFetch:s().func,stopToFirst:s().bool,dataKey:s().string,callback:s().func}),s().bool,s().bool,s().string,s().string,s().bool,s().bool,s().bool,s().bool,s().oneOfType([s().object,s().func]),s().oneOfType([s().object,s().func]),s().array,s().func,s().bool,s().object,s().object,s().shape({type:s().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:s().array,selectedRowKeys:s().array,hideSelectAll:s().bool,checkStrictly:s().bool,filterable:s().bool,selectByClickRow:s().bool,selectFirstRowOnChange:s().bool,clearableAfterFetched:s().bool,selectAllOnCurrentPage:s().bool,fetchSelectedRows:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fetchAllRowKeys:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),disabled:s().func,onChange:s().func,onSelect:s().func,onSelectAll:s().func}),s().shape({currentRowKey:s().oneOfType([s().number,s().string]),disabled:s().func,onChange:s().func}),s().shape({virtual:s().bool,doubleXScrollbar:s().bool}),s().shape({virtual:s().bool,expandIconColumn:s().string}),s().shape({defaultExpandAllRows:s().bool,defaultExpandedRowKeys:s().array,expandedRowKeys:s().array,hideExpandAll:s().bool,rowExpandable:s().func,expandedRowClassName:s().string,expandedRowRender:s().func,onExpand:s().func,onChange:s().func}),s().shape({cellMerge:s().bool,onCellMerge:s().func,onSelectChange:s().func}),s().shape({groupItems:s().arrayOf(s().shape({dataIndex:s().string.isRequired,titleIndex:s().string,color:s().string,backgroundColor:s().string})),fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),onChange:s().func}),s().func,s().bool,s().bool,s().bool,s().bool,s().shape({current:s().number,pageSize:s().number,pageSizeOptions:s().array,showSizeChanger:s().bool,showQuickJumper:s().bool}),s().shape({fileName:s().string,fetch:s().shape({api:s().func.isRequired,params:s().object}),beforeExport:s().func,cellStyle:s().bool,hideIcon:s().bool}),s().shape({showLogo:s().bool}),s().shape({fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fieldList:s().arrayOf(s().object)}),s().shape({position:s().oneOf(["top","bottom"]),hideAlert:s().bool,hideClearButton:s().bool}),s().oneOf(["left","right"]),s().func,s().func,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,{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}),zl=10,Bl="1",Ul="0",Wl="YYYY-MM-DD",Gl="YYYY-MM-DD HH:mm:ss",Yl="YYYYMMDDHHmmss",Xl={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Ql=function(e){return e.left="flex-start",e.right="flex-end",e}({});function Zl(e){const t=i.useRef();t.current=e;const r=i.useCallback((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current?.(...r)}),[]);return r}const Jl={...i}.useId;let es=0;const ts=Jl?function(e){const t=Jl();return e||t}:function(e){const[t]=i.useState(`qm_unique_${es}`);return i.useEffect((()=>{es+=1}),[]),e||t};let rs=[];const ns={getFocusInstance:function(){return rs[0]??null},getInstance:function(e){return rs.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==rs.findIndex((e=>e===t))&&(this.deregister(e),rs=[t,...rs])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),rs=[{id:e,vm:t},...rs])},deregister:function(e){e&&(rs=rs.filter((t=>t.id!==e)))}};function as(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const is=class{constructor(){as(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),as(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),as(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)})),as(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),as(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)})),as(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),as(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)})),as(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),as(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),as(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),as(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),as(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),as(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),as(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)}},os={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 ls(e){return void 0!==e}function ss(e,t){const{defaultValue:r,value:n,onChange:a,postState:o}=t||{},[l,s]=i.useState((()=>ls(n)?n:ls(r)?"function"==typeof r?r():r:"function"==typeof e?e():e)),c=ls(n)?n:l,d=o?o(c):c,u=Zl(a),[p,h]=i.useState([c]);return Pt((()=>{const e=p[0];l!==e&&u(l,e)}),[p]),Pt((()=>{ls(n)||s(n)}),[n]),[d,Zl((e=>{s(e),h([c])}))]}let cs;const ds=()=>{if(re)return 0;if(void 0!==cs)return cs;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),cs=t-n,cs},us=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=us(t.children)),t})),ps=(e,t)=>{const{fetch:r,columns:n,height:a,minHeight:i,maxHeight:l,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:h,scrollPagination:m,showSuperSearch:g,showFastSearch:b,showGroupSummary:y,showTableImport:v,showClipboard:x,showSelectCollection:E,footRender:S}=e,{tableRef:w,getRowKey:C,tableFullData:T,tableData:I,selectionKeys:N,sorter:R,filters:P,superFilters:O,pagination:k,mergedTdCells:A}=t,{selectionRows:L,summaries:_}=w.current,{expandIconColumn:F=""}=p||{},H=o().useMemo((()=>!!r?.api),[r?.api]),D=o().useMemo((()=>!H&&!!h),[H,h]),$=o().useMemo((()=>H&&!!m),[H,m]),q=o().useMemo((()=>(H||D)&&!$),[H,D,$]),M=o().useMemo((()=>!!(a||i||l)),[a,i,l]),j=o().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(us(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:os.selectionColumn,title:"radio"===t?f("qm.table.config.selectionText"):"",width:os.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:os.expandableColumn,title:"",width:os.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Kr(t)})(n)),[n]),K=o().useMemo((()=>jr(j)),[j]),V=o().useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),z=o().useMemo((()=>K.filter((e=>!!e.summation))),[K]),B=o().useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),U=o().useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),W=o().useMemo((()=>(e=>{const t=[];return e.forEach((e=>{const r=T.find((t=>C(t,t.index)===e.rowKey)),n=K.findIndex((t=>t.dataIndex===e.dataIndex));if(!r||n<0)return;const a={row:r.index,col:n,rowSpan:e.rowSpan,colSpan:e.colSpan};t.push(a);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:a.row+n,col:a.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:a.row+r,col:a.col+n,rowSpan:0,colSpan:0})})),t})(A)),[A,K,T]),G=o().useMemo((()=>{const e=K.filter((e=>![os.expandableColumn,os.selectionColumn,os.operationColumn].includes(e.dataIndex)));return F&&e.some((e=>e.dataIndex===F))?F:e[0]?.dataIndex??""}),[K,F]),Y=o().useMemo((()=>z.length>0),[z]),X=o().useMemo((()=>!!S||Y),[S,Y]),Q=o().useMemo((()=>Qr(j).length>1),[j]),Z=o().useMemo((()=>s||Q),[s,Q]),J=o().useMemo((()=>K.some((e=>e.sorter))),[K]),ee=o().useMemo((()=>K.some((e=>e.filter))),[K]),te=o().useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),re=o().useMemo((()=>!H&&!!v),[H,v]),ne=o().useMemo((()=>!!x&&V.length>0),[x,V]),ae=o().useMemo((()=>!!E&&"checkbox"===c?.type),[E,c]),ie=o().useMemo((()=>!!g&&ee),[g,ee]),oe=o().useMemo((()=>!H&&!!b&&ee),[H,b,ee]),le=o().useMemo((()=>!!y&&K.some((e=>!!e.groupSummary))),[K]),se=o().useMemo((()=>!!d?.groupItems?.length),[d]),ce=o().useMemo((()=>T.some((e=>Array.isArray(e.children)))),[T]),de=o().useMemo((()=>!I.length),[I]),ue=o().useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:o,displayWhenNotSelect:l,unit:s}=i,c=se?hn(w.current.tableFullData):w.current.tableFullData,d=!L.length&&!!l;let u=(!o||d?c:L).reduce(((e,t)=>{if(t?.[os.summaryIgnore])return e;const n=tn(t,r);return an(n)?e.plus(n):e}),new(Pa())(0));!Object.keys(_).includes(r)||o&&!d||(u=new(Pa())(tn(_,r))),rn(e,r,u.toNumber());let p=n>=0?u.toFixed(n):u.toString();a>=0&&""!==p&&(p=ln(p,a)),p=on(p),rn(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[I,N,_]),pe=o().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),he=o().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=os.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:os.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(P,O);return{...e?{[os.sorterFieldName]:e}:null,...t.length?{[os.filterFieldName]:t}:null,...pe?{[os.groupSummary.summaryFieldName]:pe,usedJH:1}:null,...r?.params??null,[os.currentPageName]:k.current,[os.pageSizeName]:k.pageSize}}),[r?.params,k.current,k.pageSize,R,P,O,pe]);return{isFetch:H,isWebPagination:D,isScrollPagination:$,showPagination:q,shouldUpdateHeight:M,tableColumns:j,flattenColumns:K,editableColumns:V,summationColumns:z,leftFixedColumns:B,rightFixedColumns:U,derivedMergeCells:W,treeExpandIndex:G,showSummary:Y,showFooter:X,isHeadGroup:Q,bordered:Z,isHeadSorter:J,isHeadFilter:ee,isServiceSummation:te,isSelectCollection:ae,isTableImport:re,isTableClipboard:ne,isSuperSearch:ie,isFastSearch:oe,isGroupSummary:le,isGroupSubtotal:se,isTreeTable:ce,isTableEmpty:de,summationRows:ue,fetchParams:he}},hs=require("react-dom");var ms=n.n(hs);const fs=(e,t)=>{const{rowKey:r,height:n,dataSource:a,summation:i,fetch:l,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,treeConfig:h,authConfig:m,ignorePageIndex:f,columnsChange:g,onChange:b,onDataChange:y,onDataLoad:x,onScrollEnd:E,onFetchError:S}=e,{getRowKey:w,tableRef:C,tableElementRef:T,tableBodyRef:I,$size:N,tableColumns:R,flattenColumns:P,tableFullData:O,pagination:k,layout:A,filters:L,sorter:_,superFilters:F,fetchParams:H,selectionKeys:D,rowExpandedKeys:$,highlightKey:q,summationColumns:M,shouldUpdateHeight:j,isFetch:K,isTreeTable:V,isWebPagination:z,isScrollPagination:B,isServiceSummation:U,isGroupSubtotal:W,doLayout:G,setTableData:Y,setTableFlatColumns:X,setTableFullData:Q,setTableOriginData:Z,setTableFlatData:J,setAllTableData:ee,setDeriveRowKeys:re,setPagination:ne,setSpinning:ae,setSorter:ie,setFilters:le,setSuperFilters:se,setSelectionKeys:ce,setRowExpandedKeys:pe,setHighlightKey:he,setSelectionRows:me,setScrollXLoad:fe,setScrollYLoad:ge,setScrollXStore:be,setScrollYStore:ye,computeVirtualX:ve,computeVirtualY:xe,setFieldAuth:Ee,setResizeState:Se,setSummaries:we,setPermission:Ce,setRecordsMap:Te,resetTableScroll:Ie,clearElementStore:Ne,clearRecordsMap:Re}=t,{store:Pe,scrollBarRef:Oe}=C.current,ke=Number.parseInt(o().version)>=18?ms().flushSync:null,Ae=o().useRef({...H}),Le=o().useRef(new Map),_e=o().useRef(!1),Fe=Nt(T);Pt((()=>{je(),C.current.scrollXLoad?Ve(Oe.current.scrollLeft):ze(),G()}),[R]),Pt((()=>{He()}),[Fe,N,n,A.tableAutoHeight]),Me((()=>{It(),Rt(),kt(),K||(z&>(),dt(a)),s&&ie(s),c&&le(c)}),[a,l?.params]),Me((()=>{const e=ot(H,Ae.current);e||K&&d?.clearableAfterFetched&&At(),!e&&H[os.currentPageName]>1&&!l?.stopToFirst?gt():K&&st(),Ae.current=H}),[H]),Me((()=>{z&&St(),B||Ie(),nt()}),[k.current,k.pageSize]),Me((()=>{C.current.scrollYLoad&&We(Oe.current.scrollTop),K||De(O.length),G()}),[O]),Me((()=>{V&&C.current.scrollYLoad&&(bt(),St())}),[$]);const He=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:r}=C.current,{width:n,height:a}=r,{width:i,height:o}=Fe,l=i!==n,s=o!==a;G(),l&&e&&ze(),s&&j&&t&&Ge(),Se(Object.assign({},r,{width:i,height:o}))},De=e=>{e!==k.total&&ne((t=>Object.assign({},t,{total:e})))},$e=e=>{_e.current=e},qe=Ot((e=>{ht(),E?.(e)})),je=()=>{fe(P.length>os.virtualScrollX)},Ke=function(){let e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).length>os.virtualScrollY;p?.virtual&&(e=!0),h?.virtual&&(e=!0),ge(e)},Ve=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollXStore:t}=C.current,{startIndex:r,endIndex:n,offsetSize:a}=t,{toVisibleIndex:i,visibleSize:o}=ve(e,A.tableWidth),l=Math.max(0,i-1-a),s=i+o+a;(i<=r||i>=n-o-1)&&(r===l&&n===s||(be(Object.assign({},t,{startIndex:l,endIndex:s})),ze()))},ze=()=>{Be(),Ue()},Be=()=>{const{scrollXLoad:e,scrollXStore:t}=C.current;if(!e)return;const r=[],n=[],a=[];for(let e=0;e<P.length;e++){const i=P[e];i.fixed?"left"===i.fixed?r.push(i):a.push(i):e>=t.startIndex&&e<t.endIndex&&n.push(i)}ke?queueMicrotask((()=>ke((()=>X([...r,...n,...a]))))):X([...r,...n,...a])},Ue=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:r}=C.current,{tableBodyWidth:n,gutterWidth:a}=A;let i="",o="";r&&(i=`${P.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,o=`${scrollY?n-a:n}px`),e.$tableBody.style.marginLeft=i,e.$tableXspace.style.width=o},We=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=C.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:o}=t,{toVisibleIndex:l}=xe(e,o),s=Math.max(0,l-1-a),c=l+i+a;(l<=r||l>=n-i-1)&&(r===s&&n===c||(ye(Object.assign({},t,{startIndex:s,endIndex:c})),Ge()))},Ge=()=>{const{tableFlatData:e}=C.current;Et(e),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=C.current,{startIndex:a,rowHeight:i}=r;let o="",l="";n&&(o=`${Math.max(0,a*i)}px`,l=e.length*i+"px"),t.$tableBody.style.marginTop=o,t.$tableYspace.style.height=l})(e)},Ye=e=>W?Xe(Qe(e,0)):e,Xe=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Xe(e.children)),delete e.children,t.push(e)})),t},Qe=(e,t)=>{const n=i.groupItems?.[t];return n?fn(e,[n.dataIndex]).map((e=>{const a={children:Qe(e,t+1),_group:n.dataIndex};return"function"!=typeof r&&rn(a,r.toString(),dn()),n.titleIndex&&rn(a,n.titleIndex,tn(e[0],n.titleIndex)),rn(a,n.dataIndex,tn(e[0],n.dataIndex)),M.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[os.summaryIgnore])return e;const n=Number(tn(r,t));return Number.isNaN(n)?e:e+n}),0);rn(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Ze=e=>{ce(e),me((e=>{const{selectionRows:t,recordsMap:r}=C.current,n=new Map;t.forEach((e=>n.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=n.get(e[t])||r.get(e[t]);i&&a.push(i)}return a})(e))},Je=e=>{const{type:t,checkStrictly:r=!0}=d||{},n=Array.isArray(e)?e:D;let a=[];return C.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{disabled:r}=d||{},{deriveRowKeys:n,recordsMap:a}=C.current,i=Yr(n,e);let o=[];if(!i)return o;let l=tt(i?.children||[]);return r&&(l=l.filter((e=>!a.has(e)||!r(a.get(e))))),o=[...new Set([...t,...l])],(bn(n,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Yr(n,e),r=t?.children?.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},et=e=>{const{allRowKeys:t,flattenRowKeys:r,deriveRowKeys:n}=C.current,{defaultExpandAllRows:a,expandedRowRender:i}=u||{},o=Array.isArray(e)?e:$;if(C.current.treeTable){i&&v("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];q&&e.unshift(q);let l=[];return e.forEach((e=>{const t=bn(n,e)||[];l.push(...t.length>1?t.slice(0,-1).reverse():t)})),l=a?t:[...new Set([...o,...l])],l.filter((e=>!r.includes(e)))}return u?a?t.slice(0):[...o]:[]},tt=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...tt(e[r].children)),t.push(e[r].rowKey);return t},rt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...rt(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...rt(e,r[r.length-1])),r},nt=Ot((()=>{b?.(k,it(L),at(_),F,{currentDataSource:xt()})})),at=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},it=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[os.showFilterType?`${n}|${a}`:n]=e[r]}return t},ot=(e,t)=>{const r=Object.keys(en(e,t));return 1===r.length&&(r.includes(os.currentPageName)||r.includes(os.pageSizeName))},lt=async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=oe,afterFetch:r,callback:n}=l;if(!t(H))return;const a=!!i?.fetch?.api;ae(!0);try{const[t,o]=a?await Promise.all([l.api(e(H)),i.fetch.api(e(H))]):[await l.api(e(H))];if(C.current.unMounted)return;if(a?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??os.dataKey;let a=(0,te.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,te.get)(t.data,e.replace(/[^.]+$/,os.totalKey))||a.length||0,s=Math.max(Math.ceil(i/k.pageSize),1);if(H[os.currentPageName]>s)return mt({...k,current:s});dt(_e.current?C.current.tableFullData.concat(a):a),De(i),ut(o?.data||t.data),n?.(t.data,t)}}catch(e){S?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),ae(!1),$e(!1)},st=Ot(lt),ct=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=ct(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:r}=k;return!K||B?e:(t-1)*r+e})(t)),e))),dt=e=>{const t=Ye(ct(e));wt(t),Ct(t),Ze(Je()),pe(et()),pt(),x?.(t)},ut=e=>{if(!U)return;const t=i?.fetch?.dataKey??os.summationKey,r=(t?(0,te.get)(e,t):e)??{},n={};M.filter((e=>!!e.summation.dataKey)).forEach((e=>{rn(n,e.dataIndex,Number(tn(r,e.summation.dataKey)))})),we(n)},pt=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=xt();if(e.length){const t=w(e[0],e[0].index);Ze([t])}else Ze([])}},ht=()=>{if(!B)return;const e=ft();_e.current||k.current>=e||($e(!0),mt({...k,current:k.current+1}))},mt=e=>{let{current:t,pageSize:r}=e;ne((e=>Object.assign({},e,{current:t,pageSize:r})))},ft=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},gt=()=>{mt(Object.assign({},k,{current:1}))},bt=()=>{const{scrollYLoad:e,deriveRowKeys:t}=C.current;if(!C.current.treeTable||!e)return;const r=yt(t,(()=>{const{allTableData:e,allRowKeys:t}=C.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?$.filter((e=>!n.includes(e))):$})());Le.current.clear(),r.forEach(((e,t)=>Le.current.set(e,t)))},yt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...yt(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},vt=()=>{const{current:e,pageSize:t}=k;return C.current.tableFullData.slice((e-1)*t,e*t)},xt=()=>z?vt():C.current.tableFullData,Et=e=>{const{scrollYLoad:t,scrollYStore:r}=C.current;if(!t)return Y(e);const{startIndex:n,endIndex:a}=r;ke?queueMicrotask((()=>ke((()=>Y(e.slice(n,a)))))):Y(e.slice(n,a))},St=()=>{(()=>{let e=xt();C.current.treeTable&&h?.virtual&&(e=(e=>{const{recordsMap:t,allRowKeys:r}=C.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];Le.current.has(a)&&n.push(t.get(a))}return n})()),Ke(e),J(e)})(),Ge()},wt=e=>{Q(e),ee(e),re(e),Tt(),bt(),St()},Ct=e=>{Z(e)},Tt=()=>{Re(),C.current.allTableData.forEach((e=>Te(w(e,e.index),e)))},It=()=>{ie({})},Rt=()=>{le({})},kt=()=>{se([])},At=()=>{Ze([])};return{initialTable:()=>{(async()=>{if(!m)return;let t=ue(m,["fetch"]);if(m.fetch){const{api:e,params:r,dataKey:n}=m.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,te.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;Ce((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=C.current,n=zr(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:o}=a,l=Br(r,n);Ee(n,{visible:t,disabled:i,secretName:o}),t||(e.noAuth=!0,l.noAuth=!0),o&&(e.formatType=`secret-${o}`,l.formatType=`secret-${o}`)}}));g?.(n)}})(),q&&I.current.setClickedValues([q,""]),"radio"===d?.type&&D.length&&I.current.setClickedValues([D[0],""]),je(),Ke(),K?lt():dt(a)},checkDataIndex:()=>{const e=P.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&v("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:wt,getTableData:lt,handleTableData:Et,createWebPageData:vt,createTableData:dt,createGroupData:Ye,createSelectionKeys:Je,createRowExpandedKeys:et,setSelectionKeysEffect:Ze,findParentRowKeys:rt,getAllChildRowKeys:tt,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return v("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Pe.removeFromRequired({x:r,y:n}),Pe.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&de(t)&&Pe.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Pe.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Pe.state,i=(0,te.intersection)(r,a),o=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:o(e),validate:o(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,te.intersection)(n,r),...(0,te.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{y?.(C.current.tableFullData)},tableChange:nt,toLastPage:()=>{const e=ft();k.current!==e&&mt(Object.assign({},k,{current:e}))},toFirstPage:gt,getPageCount:ft,pagerChangeHandle:mt,triggerScrollXEvent:e=>{Ve(e)},triggerScrollYEvent:e=>{We(e)},scrollBottomDebouncer:qe,clearTableSorter:It,clearTableFilter:Rt,clearSuperFilters:kt,clearRowSelection:At,clearRowHighlight:()=>{he("")},clearTableLog:()=>{Pe.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;Ne(),Pe.destroy(),e.deregister(t)}}},gs=(e,t)=>{const{height:r,minHeight:n,maxHeight:a,ellipsis:i,showHeader:l,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,$size:h,tableColumns:m,flattenColumns:f,leftFixedColumns:g,derivedMergeCells:b,layout:y,scrollX:v,scrollY:x,showFooter:E,showPagination:S,isFullScreen:w,setLayout:C,setScrollX:T,setScrollY:I,setElementStore:N,setScrollXStore:R,setScrollYStore:P,setShouldToTop:O}=t,k=o().useRef(x),A=o().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=y,i={};return n&&Object.assign(i,{minHeight:`${Jr(n)}px`}),a&&Object.assign(i,{maxHeight:`${Jr(a)}px`}),w?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:r?{...i,height:"auto"!==r?`${Jr(r)}px`:`${t}px`}:i}),[r,a,n,w,y]),L=()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=l?e.$header.offsetHeight:y.headerHeight,i=E?e.$footer.offsetHeight:y.footerHeight,o=n-a-i,s=e.$tableBody.offsetHeight,c=t||s>o;let u=0;if(w){const t=e.$toper?e.$toper.offsetHeight+zl:0,n=e.$pager?e.$pager.offsetHeight+zl:0;u=r.winHeight-t-n-20}(t||o!==y.viewportHeight)&&F(o),k.current=c,I(c),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:o,tableBodyHeight:s,tableFullHeight:u})))},_=(e,t)=>{const r=e+t;let n=-1,a=0,i=0;for(let t=0,o=f.length;t<o;t++){const o=f[t];if(a+=o.width||o.renderWidth,-1===n&&e<a&&(n=t),n>=0&&(i++,a>r))break}return{toVisibleIndex:Math.max(0,n),visibleSize:Math.max(8,i)}},F=e=>{const{scrollBarRef:t,scrollYStore:r,isIE:n}=d.current,a=t.current.scrollTop,{rowHeight:i}=r,{toVisibleIndex:o}=H(a,i),l=Math.max(8,Math.ceil(e/i)+2),s=n?5:0,c=Math.max(0,o-1-s),u=Math.max(o+l+s,r.endIndex);P(Object.assign({},r,{visibleSize:l,offsetSize:s,startIndex:c,endIndex:u}))},H=(e,t)=>{const r=Math.floor(e/t);return{toVisibleIndex:Math.max(0,r)}},D=(e,t)=>{const{scrollBarRef:r,elementStore:n,scrollYStore:a,scrollYLoad:i,tableFlatData:o}=d.current;if(void 0!==t&&t>=0)r.current.SET_SCROLL_TOP(t*a.rowHeight);else if(i){const t=o.findIndex((t=>e===c(t,t.index)));t>=0&&r.current.SET_SCROLL_TOP(t*a.rowHeight)}else{const t=n.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);t&&r.current.SET_SCROLL_TOP(t.offsetTop)}};return{createElementStore:()=>{N("$toper",u.current),N("$table",p.current)},tableStyles:A,getSpan:(e,t,r,n,a)=>{let i=1,o=1;if("function"==typeof s){const l=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(l)?(i=l[0],o=l[1]):(0,te.isPlainObject)(l)&&(i=l.rowSpan,o=l.colSpan)}if(b.length>0){const e=b.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}},getStickyLeft:e=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Ur(Br(m,e)).dataIndex);let t=0;for(let r=0;r<f.length;r++){const n=f[r];if(n.dataIndex===e)break;t+=n.width||n.renderWidth||0}return t},getStickyRight:(e,t)=>{f.findIndex((t=>t.dataIndex===e))<0&&(e=Wr(Br(m,e)).dataIndex);const r="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let r=[];return e.forEach((e=>{e.colSpan>0&&r.length>0&&(t.push(r),r=[]),r.push(e)})),r.length>0&&t.push(r),t.map((e=>{const[t,r]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...r,...t.reverse()]})).flat()})(f):f;let n=0;for(let t=r.length-1;t>=0;t--){const a=r[t];if(a.dataIndex===e)break;n+=a.width||a.renderWidth||0}return n},scrollXToColumn:(e,t)=>{const{scrollBarRef:r}=d.current,n=void 0===t?f.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=g.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=f.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:D,rowInViewport:e=>{const{scrollBarRef:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=y,i=e*r.rowHeight;return!(i<t.current.scrollTop||i+r.rowHeight>t.current.scrollTop+(v?n-a:n))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(S?$a["small"!==h?"middle":h]+zl:0)-zl;C((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&D("",0),O(!0)},computeVirtualX:_,computeVirtualY:H,doLayout:()=>{i?L():se((()=>L())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,r=e.$table.clientWidth,n=k.current?y.gutterWidth:0,{defaultColumnWidth:a}=os,i=[];let o=0;if(f.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,o+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=f.reduce(((e,t)=>e+(t.width||t.minWidth||a)),0);if(e<=r-n){T(!1);const t=r-n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||a)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||a)),0);let r=0;i.forEach(((t,n)=>{if(0===n)return;const i=Math.floor((t.minWidth||a)*e);r+=i,t.renderWidth=(t.minWidth||a)+i})),i[0].renderWidth=(i[0].minWidth||a)+t-r}}else T(!0),i.forEach((e=>{e.renderWidth=e.minWidth||a}));C((t=>({...t,tableBodyWidth:Math.max(e,r)})))}else o=f.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||a)),0),T(o>r),C((e=>({...e,tableBodyWidth:o})));C((e=>({...e,tableWidth:r}))),t&&(e=>{const{scrollXStore:t,isIE:r,scrollBarRef:n}=d.current,a=n.current.scrollLeft,{toVisibleIndex:i,visibleSize:o}=_(a,e),l=r?5:0,s=Math.max(0,i-1-l),c=Math.max(i+o+l,t.endIndex);R(Object.assign({},t,{visibleSize:o,offsetSize:l,startIndex:s,endIndex:c}))})(r)})()}}},bs=e=>{const{total:t}=e,{tableRef:r,selectionKeys:n,isHeadSorter:a,isHeadFilter:i,isTreeTable:l,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=o().useContext(jl),{infoBarConfig:h,rowSelection:m,rowHighlight:g}=r.current.props,{allTableData:b,invalidRowKeys:y}=r.current,{hideAlert:v,hideClearButton:x}=h||{},E=o().useMemo((()=>!v),[v]),S=o().useMemo((()=>!x&&!!(a||i||m||g)),[x,a,i,m,g]),w=Ce("table"),C={[`${w}__alert`]:!0};return E?o().createElement("div",{className:we()(C)},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.InfoCircleFilled,null)),o().createElement("span",null,f("qm.table.alert.total",{total:l?b.length:t}),m?`,${f("qm.table.alert.selected",{total:Math.max(n.length-y.length,0)})}`:""),S&&o().createElement("em",{onClick:()=>{c(),d(),u(),p(),se((()=>s()))}},f("qm.table.alert.clear"))):null},ys=o().forwardRef(((e,t)=>{const{isFullScreen:r,open:n=!0}=e,{setFullScreen:a}=o().useContext(jl),i=()=>{a(!r)};o().useImperativeHandle(t,(()=>({clickHandle:i})));const l=Ce("table");return n?o().createElement("span",{className:`${l}-full-screen`,title:f(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},r?o().createElement(Te.FullscreenExitOutlined,null):o().createElement(Te.FullscreenOutlined,null))):null}));ys.displayName="FullScreen";const vs=ys,xs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{getTableData:n}=o().useContext(jl),a=()=>{n()};o().useImperativeHandle(t,(()=>({clickHandle:a})));const i=Ce("table");return r?o().createElement("span",{className:`${i}-reload`,title:f("qm.table.refresh.text"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.ReloadOutlined,null))):null}));xs.displayName="Reload";const Es=xs,Ss=()=>{const e={dateFormat:e=>{const t=e?u()(e).format(Wl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?u()(e).format(Gl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?u()(e).format(Gl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>an(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>on(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,r,n)=>{const{dictItems:a,precision:i,displayPrecision:o,formatType:l,editRender:s}=r,c=a||s?.(n,r)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==d&&(d=an(d)?new(Pa())(d).toFixed(i):d),o>=0&&""!==d&&(d=ln(d,o)),l){const t=e[`${ce(l)}Format`];t?d=t(d):v("Table","字段的格式化类型 `formatType` 配置不正确")}return d},r=e=>ne(e)?un(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,a,i)=>{const o=tn(e,n.dataIndex),l=n.render?n.render(o,e,n,a,i):t(o,n,e);return r(l)}}},ws=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=o().useContext(c),{tableRef:i,flattenColumns:l,summationRows:s,showSummary:d,getSpan:u}=o().useContext(jl),{tablePrint:p,showHeader:h}=i.current.props,{getTitleFromCellValue:m}=Ss(),g=a?.print?.leftLogo??"",b=a?.print?.rightLogo??"",y=!(!g&&!b),v=o().useMemo((()=>pe(Gr(r,[os.expandableColumn,os.selectionColumn,os.operationColumn]))),[r]),x=o().useMemo((()=>pe(Gr(l,[os.expandableColumn,os.selectionColumn,os.operationColumn]))),[l]),E=o().useMemo((()=>pe(r.filter((e=>e.printFixed)))),[r]),S=e=>{const t=Object.assign({},gn(v,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},w=(e,t)=>(0,te.map)((0,te.groupBy)((0,te.flatten)(e),t),(0,te.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,te.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))}))),C=()=>{const{tableFullData:e}=i.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||os.defaultColumnWidth,n<=os.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),E.length&&e.unshift(...E),t.push(r),r=[],n=0,a=0):(i.width=os.printWidth,r.push(i),t.push(r),a++)}return t})([...x]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(r),t.push(Qr(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=T(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},T=(e,t,r)=>{const{showLogo:n=!0}=p;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||os.defaultColumnWidth}px">`})).join("")}</colgroup>`,h&&(a+=["<thead>",n&&y?`<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">',g?`<img src="${g}" 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:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${pn(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${Xr(r).map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=u(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${n<=0?`<span style="padding-left:${e._level*os.treeTable.textIndent}px"></span>`:""}${m(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),d&&s.length&&(a+=["<tfoot>",s.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,o=i?.render?i.render(r):tn(e,`${a}_text`);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ne(o)?un(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},I=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});qt(e,i)}})(0,C())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),i.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(r))}))};o().useImperativeHandle(t,(()=>({clickHandle:I})));const N=Ce("table");return n?o().createElement("span",{className:`${N}-print`,title:f("qm.table.print.text"),onClick:()=>I()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.PrinterOutlined,null))):null}));ws.displayName="TablePrint";const Cs=ws,Ts=require("exceljs");var Is=n.n(Ts);const Ns="606060",Rs="thin",Ps="d4d4d4",Os=(e,t)=>{t&&(e.height=Math.floor(.75*t))},ks=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},As=()=>({top:{style:Rs,color:{argb:Ps}},left:{style:Rs,color:{argb:Ps}},bottom:{style:Rs,color:{argb:Ps}},right:{style:Rs,color:{argb:Ps}}}),Ls=e=>{const{children:t}=e;return t&&t.length?Ls(t[0]):e},_s=e=>{const{precision:t,formatType:r}=e,n=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===r?{numFmt:n?`0${n}%`:"0%"}:"finance"===r?{numFmt:n?`#,##0${n}`:"#,##0"}:n?{numFmt:`0${n}`}:null},Fs=()=>{const{tableRef:e,getSpan:t,showSummary:r,isHeadGroup:n}=o().useContext(jl),{spanMethod:a,showHeader:i}=e.current.props,l=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(o,l,s,c)=>{const{columns:d,footSummation:u}=o,{scrollYStore:{rowHeight:p}}=e.current,h=jr(d),m=Qr(d),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:r,minWidth:n,renderWidth:a}=e;E[t]=pn(e.title),y.push({key:t,width:(r||a||n||os.defaultColumnWidth)/8})})),i&&(n?m.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Ls(e),o=h.findIndex((e=>{let{dataIndex:t}=e;return t===i.dataIndex}));r[i.dataIndex]=pn(e.title),0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:o},e:{r:t+a-1,c:o+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=Xr(l).map(((e,r)=>{const n={};return h.forEach(((i,o)=>{if("function"==typeof a){const{rowSpan:n,colSpan:a}=t(e,i,r,o,l);(a>1||n>1)&&v.push({s:{r:r+x,c:o},e:{r:r+x+n-1,c:o+a-1}})}const s=["percent","finance"].includes(i.formatType);n[i.dataIndex]=s?tn(e,i.dataIndex):c(e,r,i,o)})),n._level=e._level,n}));x+=S.length,r&&u&&s(h,l).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:a,summation:i}=t,o=i?.render?i.render(l):tn(e,a);r[a]=0===n&&""===o?f("qm.table.config.summaryText"):ne(o)?un(o).join(""):o})),b.push(r)}));const{sheetName:w,useStyle:C}=o,T=new(Is().Workbook),I=T.addWorksheet(w);I.columns=y,i&&I.addRows(g).forEach((e=>{C&&Os(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),r=Br(d,t.key),{align:n,theadAlign:a}=r;ks(e,a||n),C&&Object.assign(e,{font:{bold:!0,color:{argb:Ns}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:As()})}))})),I.addRows(S).forEach(((e,t)=>{const{_level:r}=S[t];C&&Os(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),n=Br(d,t.key),{align:a}=n;ks(e,a),Object.assign(e,_s(n)),C&&Object.assign(e,{font:{color:{argb:Ns}},border:As()}),1===Number(e.col)&&r&&(e.alignment={...e.alignment,indent:r})}))})),r&&u&&I.addRows(b).forEach((e=>{C&&Os(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),r=Br(d,t.key),{align:n}=r;ks(e,n),Object.assign(e,_s(r)),C&&Object.assign(e,{font:{color:{argb:Ns}},border:As()})}))})),v.forEach((e=>{let{s:t,e:r}=e;I.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const N=await T.xlsx.writeBuffer();return new Blob([N],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,o="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],o=o+(n?",":"")+r(i.textContent.trim());o+="\r\n"}return o})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let o;for(o=0;o<e.length;o+=1)t[o]=e.charCodeAt(o);const l=new window.Uint8Array(t);a.push(l)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=jr(r),i=new FileReader;i.onerror=()=>{L.message.error(f("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>pn(e.title))),n=new(Is().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),o=e[i],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,o);if(s){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;Array.isArray(n?.richText)&&(n=n.richText.map((e=>e.text)).join("")),(0,te.isPlainObject)(n)&&"text"in n&&(n=n.text),(0,te.isDate)(n)&&(n=cn(n,Gl)),n?.formula&&(n=n.result??n.value),t[o[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:o}=a[r];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>l(o,e))).filter((e=>""!==e)):t[e]=l(o,t[e])),rn(n,i,t[e])})),n}));t?.(n)}else L.message.error(f("qm.table.import.error"))}else L.message.error(f("qm.table.import.error"))})):L.message.error(f("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},Hs=e=>{const{fileType:t,onChange:r}=e;let n,a;const i=Ce("table"),l=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return o().createElement(be,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return n||(n=document.createElement("form"),a=document.createElement("input"),n.className=`${i}--file-form`,a.name="file",a.type="file",n.appendChild(a),document.body.appendChild(n)),new Promise(((e,r)=>{const i=!t.type;a.multiple=!!t.multiple,a.accept=i?"":`.${t.type}`,a.onchange=o=>{const{files:s}=o.target,c=s[0];let d="";if(!i)for(let e=0;e<s.length;e++){const{type:r}=l(s[e]);if(t.type!==r){d=r;break}}d?(L.message.warning(f("qm.upload.notType",{type:d})),r()):e(c),document.body.removeChild(n),n=null,a=null},n.reset(),a.click()}))})({type:t});r?.(e.name,e)}catch(e){}})()},f("qm.upload.text"))},Ds=e=>{const{columns:t,onClose:r}=e,{tableRef:n,createTableData:a,dataChange:i}=o().useContext(jl),{beforeTableImport:l}=n.current.props,{importXLSX:s}=Fs(),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!0),m=e=>e.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:r}=t.GET_FIELDS_VALUE(["fileName"]);return o().createElement(o().Fragment,null,r?o().createElement("span",null,r):o().createElement(Hs,{fileType:t.state.formData.fileType,onChange:(e,r)=>{t.SET_FIELDS_VALUE({fileName:e,file:r}),r&&h(!1)}}))}},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:f("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:f("qm.table.import.fillText"),value:"fill"},{text:f("qm.table.import.addText"),value:"add"},{text:f("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{g.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,b([...g])}},{type:"INPUT_NUMBER",label:f("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:n.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),y=Ce("table");return o().createElement("div",{className:`${y}-import__setting`},o().createElement(Qo,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(be,{type:"primary",loading:d,disabled:p,onClick:()=>(async()=>{const[e,o]=await c.current.GET_FORM_DATA();e||(u(!0),s({columns:m(t),file:o.file},(async e=>{const{tableFullData:t,store:s}=n.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof l)try{e=await l(e)}catch(e){}if("fill"===o.importType&&a(e),"add"===o.importType&&a([...t,...e]),"insert"===o.importType){const{tableFullData:t}=n.current,r=o.posIndex,i=t.slice(0,r).concat(e).concat(t.slice(r));a(i)}e.forEach((e=>{s.addToInserted(e)})),i(),L.message.success(f("qm.table.import.success",{total:e.length})),u(!1),r()})))})()},f("qm.table.import.text"))))},$s=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,[a,i]=o().useState(!1),l=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ce("table"),c={[`${s}-import`]:!0},d={visible:a,title:f("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:we()(c),title:f("qm.table.import.textNoSpace"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.ImportOutlined,null))),o().createElement(Cr,d,o().createElement(Ds,{columns:r,onClose:()=>i(!1)})))}));$s.displayName="TableImport";const qs=$s,Ms=e=>{const{columns:t,onChange:r}=e,{$size:n}=o().useContext(jl),a=o().useRef([]),[i,l]=o().useState(!1),[s,c]=o().useState(t);Me((()=>{u()}),[s]),o().useEffect((()=>{d()}),[t]);const d=()=>{const e=[];t.forEach(((r,n)=>{const a=r.colSpan;a>1&&t.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(t.slice(n,n+a))})),a.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const i=a.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===i)return e.push(t);e.push(...a.current[i].map(((e,r)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),r?.(e)},p=Ce("table"),h={[`${p}__popper`]:!0,"column-filter__popper":!0,[`${p}--lg`]:"large"===n,[`${p}--sm`]:"small"===n},m=[`${p}-column-filter`,{selected:i}];return o().createElement(Xa(),{action:["click"],popupVisible:i,popup:o().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"main"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||c(xn(e))}},s.map((e=>((e,t)=>{const{colSpan:r}=e;if(0===r)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),o().createElement("i",{className:we()(n),title:f("qm.table.columnFilter.draggable")},o().createElement(Te.HolderOutlined,null)),o().createElement("span",{className:"text"},pn(e.title)))})(e)))))),popupClassName:we()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{l(e)},builtinPlacements:Xl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:we()(m),title:f("qm.table.columnFilter.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.SettingOutlined,null)),o().createElement("span",null,f("qm.table.columnFilter.text"))))},js=e=>{const{defaultValue:t,onClose:r,onOk:n}=e,{tableRef:a,selectionKeys:i,pagination:l,showSummary:s}=o().useContext(jl),{rowSelection:c}=a.current.props,d=o().useRef(null),[p,h]=o().useState(!1),m=o().useMemo((()=>Object.assign({},{fileName:`${u()().format(Yl)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:i.length?"selected":"all","startIndex|endIndex":[1,l.total],footSummation:s?1:0,useStyle:0},t,{columns:pe(t.columns||[])})),[]),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:f("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:f("qm.table.export.all"),value:"all"},{text:f("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==c?.type},{text:f("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:f("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>o().createElement(Ms,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:f("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:f("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ce("table");return o().createElement("div",{className:`${y}-export__setting`},o().createElement(Qo,{ref:d,initialValues:m,items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(be,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);n(t),await le(1e3),h(!1),r()}})()},f("qm.table.export.text"))))},Ks=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=o().useContext(c),{tableRef:i,flattenColumns:l,pagination:s,fetchParams:d,isFetch:p,isGroupSubtotal:h,showSummary:m,getSpan:g}=o().useContext(jl),{exportExcel:b,fetch:y,showHeader:v}=i.current.props,{getTitleFromCellValue:x}=Ss(),[E,S]=o().useState(!1),[w,C]=o().useState(!1),T=o().useMemo((()=>!!b?.fetch?.api),[b]),I=o().useMemo((()=>!s.total||w),[s.total,w]),N=o().useMemo((()=>Gr(r,[os.expandableColumn,os.selectionColumn,os.operationColumn])),[r]),R=o().useMemo((()=>Gr(l,[os.expandableColumn,os.selectionColumn,os.operationColumn])),[l]),P=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map(((e,n)=>{const a={...e,index:n,pageIndex:n},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=r,Array.isArray(e.children)&&(a.children=P(e.children,i,r+1)),R.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&rn(a,t,tn(a,t))})),a}))},O=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(h?hn(t):t).reduce(((e,t)=>{if(t?.[os.summaryIgnore])return e;const r=Number(tn(t,n));return Number.isNaN(r)?e:e+r}),0);rn(r,n,a)})),[r]},k=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let o=x(e,r,t,n);return a>=0&&!i&&""!==o&&(o=Number(o)),o},{exportXLSX:A,exportCSV:_}=Fs(),F=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=y;let i=[];try{C(!0);const o=await t({...r(d),[os.currentPageName]:1,[os.pageSizeName]:e??s.total});if(200===o.code){let e=Array.isArray(o.data)?o.data:(0,te.get)(o.data,a)??[];e="function"==typeof n?await n(e):e,i=P(e)}}catch(e){}return C(!1),i},H=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=b?.fileName??`${u()().format(Yl)}.xlsx`,$=D.slice(D.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return L.message.warning(f("qm.table.export.warnText"));T?(async e=>{C(!0);try{const{api:t,params:r}=b.fetch,n=await t({columns:R.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...d,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[os.currentPageName]:void 0,[os.pageSizeName]:void 0});n.data&&(qt(n.data,e),H(e))}catch(e){}C(!1)})(D):S(!0)};o().useImperativeHandle(t,(()=>({clickHandle:q})));const M=Ce("table"),j={[`${M}-export`]:!0},K={visible:E,title:f("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},V={fileName:D.slice(0,D.lastIndexOf(".")),fileType:$,columns:N,useStyle:b?.cellStyle?1:0};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:we()(j),title:f("qm.table.export.textNoSpace"),onClick:()=>q()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.DownloadOutlined,null))),o().createElement(Cr,K,o().createElement(js,{defaultValue:V,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:o}=e,{tableFullData:l,selectionRows:s}=i.current;let c=[];if(p?("all"===n&&(c=await F()),"custom"===n&&(c=await F(o),c=c.slice(a-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(a-1,o||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof b?.beforeExport)try{c=b?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await A(e,c,O,k);qt(r,`${t}.xlsx`),H(`${t}.xlsx`)}if("csv"===r){const r=_(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Qr(r),i=jr(r);let o='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return o+=`<colgroup>${i.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||os.defaultColumnWidth}px">`})).join("")}</colgroup>`,v&&(o+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${pn(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(o+=`<tbody>${Xr(t).map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=g(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),m&&n&&(o+=["<tfoot>",O(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,o=i?.render?i.render(t):tn(e,a);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ne(o)?un(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),o+="</table>",o})(e,c));qt(r,`${t}.csv`),H(`${t}.csv`)}})(Object.assign({},e,{columns:Kr(e.columns)}))}})))}));Ks.displayName="TableExport";const Vs=Ks,zs=e=>{const{columns:t,onClose:r}=e,{tableRef:n,tableBodyRef:a,dataChange:i}=o().useContext(jl),{beforeClipboard:l}=n.current.props,s=o().useRef(null),[c,d]=o().useState([{type:"INPUT_NUMBER",label:f("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:f("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:pn(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:f("qm.table.clipboard.content"),fieldName:"content",placeholder:f("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[u,p]=o().useState(!1),h=Ce("table");return o().createElement("div",{className:`${h}-clipboard__setting`},o().createElement("h3",{className:"info"},f("qm.table.clipboard.supportText")),o().createElement(Qo,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:c,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(be,{type:"primary",loading:u,onClick:()=>(async()=>{const[e,o]=await s.current.GET_FORM_DATA();if(e)return;const{tableFullData:c,store:d}=n.current;p(!0);const u=o.content.trim().replace(/(\r|\n)$/,"");let h=u.replace(/"[^"]+"/g,"^");(u.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let m=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof l)try{m=await l(m,m[0].map(((e,r)=>t[o.colIndex+r].dataIndex)))}catch(e){}m.forEach(((e,r)=>{e.forEach(((e,a)=>{const i=c[o.rowIndex-1+r],l=t[o.colIndex+a];if(i&&l){let t=!1;if(l.editRender){const e=l.editRender(i,l);t=!(e.disabled||e.extra?.disabled||n.current.fieldAuth[l.dataIndex]?.disabled)}t&&l.dictItems&&(t=l.dictItems.some((t=>t.value==e))),t&&(rn(i,l.dataIndex,e),d.addToUpdated(i))}}))})),a.current.forceUpdate(),i(),L.message.success(f("qm.table.clipboard.success",{total:m.length})),p(!1),r()})()},f("qm.table.clipboard.text"))))},Bs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{flattenColumns:n}=o().useContext(jl),[a,i]=o().useState(!1),l=o().useMemo((()=>(e=>e.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:s})));const c=Ce("table"),d={[`${c}-clipboard`]:!0},u={visible:a,title:f("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:we()(d),title:f("qm.table.clipboard.textNoSpace"),onClick:()=>s()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.CopyOutlined,null))),o().createElement(Cr,u,o().createElement(zs,{columns:l,onClose:()=>i(!1)})))}));Bs.displayName="TableClipboard";const Us=Bs,Ws=e=>{const{columns:t,onClose:r}=e,{tableRef:n,$size:a,selectionKeys:i,setSelectionKeysEffect:l}=o().useContext(jl),{rowKey:s,rowSelection:c}=n.current.props,d=o().useRef(null),u=Nt(d),p=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=p(e.children)),t})),[h,m]=o().useState([{title:f("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(t.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))))]),[g]=o().useState((()=>{const{disabled:e}=c||{},t=n.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[b,y]=o().useState(300),v=Ot((()=>{const e=d.current;y(e.offsetHeight-2*$a[a]-30)}),5);return Pt((()=>{v()}),[u.width]),o().createElement("div",{ref:d,style:{height:"100%"}},o().createElement(ad,{size:a,columns:h,dataSource:g,rowKey:s,height:b,rowSelection:{type:"checkbox",selectedRowKeys:i,onChange:e=>l(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>m(e)}),o().createElement("div",{style:{height:10}}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>r()},f("qm.table.selectCollection.closeButton"))))},Gs=o().forwardRef(((e,t)=>{const{columns:r,open:n=!0}=e,{tableRef:a,getRowKey:i,selectionKeys:l,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=o().useContext(jl),{rowSelection:p}=a.current.props,[h,m]=o().useState(!1),g=o().useRef(!1);Me((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:l},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,te.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>i(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{m(!0)};o().useImperativeHandle(t,(()=>({clickHandle:y})));const v=Ce("table"),x={visible:h,title:f("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:`${v}-select-collection`,title:f("qm.table.selectCollection.text"),onClick:()=>y()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.CheckSquareOutlined,null))),o().createElement(Cr,x,o().createElement(Ws,{columns:r,onClose:()=>m(!1)})))}));Gs.displayName="SelectCollection";const Ys=Gs,Xs=require("localforage");var Qs=n.n(Xs);const Zs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),Js=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,getRowKey:a,$size:i,flattenColumns:l,pagination:s,createWebPageData:d,setPagination:u,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:m,isTreeTable:g,isWebPagination:b}=o().useContext(jl),{uniqueKey:y}=n.current.props,x=o().useRef(null),E=o().useRef(null),S=o().useRef([]),w=o().useRef(""),C=o().useRef(-1),T=o().useRef("stop");Me((()=>{const e=Xr(d()).findIndex((e=>a(e,e.index)===w.current));p("",e)}),[s.current]);const I=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},N=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:I(e.filter.type),fieldName:e.dataIndex,label:pn(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[r,n]=await E.current.GET_FORM_DATA(),a=(0,te.omitBy)(Object.assign({},t,n),de);k(a)}}))),R={case:0,fullchar:0},P=o().useMemo((()=>l.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[l]),[O,k]=o().useState({}),[A,_]=o().useState(R),[F]=o().useState(N([P[0]])),[H]=o().useState(N(P.slice(1))),[D,$]=o().useState(0),q=o().useMemo((()=>!Object.keys(O).length),[O]);Me((()=>{T.current="ready"}),[O,A]);const M=e=>{_(Object.assign({},A,e))},j=(e,t,r)=>new Promise(((n,a)=>{L.Modal.confirm({title:f("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),K=async e=>{if(!Object.keys(O).length)return L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.queryCondition")});if("ready"===T.current&&(T.current="stop",S.current=(e=>{const{allTableData:t}=n.current,r=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let i=!0;for(const t in e){const{type:r}=P.find((e=>e.dataIndex===t)).filter;let n=tn(a,t),o=!0;if("text"===r||"textarea"===r?o=new RegExp(A.fullchar?`^${e[t]}$`:e[t],A.case?"":"i").test(n):(n=Zs(n)?n.slice(0,10):n,o=n==e[t]),!o){i=!1;break}}i&&r.push(a)}return r})(O),$(S.current.length)),!S.current.length)return h(""),L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>S.current.length-1&&await j(f("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=S.current.length-1))),"prev"===e&&(C.current=C.current<0?S.current.length-1:C.current-1,C.current<0&&await j(f("qm.table.fastSearch.toStart"),(()=>C.current=S.current.length-1),(()=>C.current=0)));const t=S.current[C.current],r=a(t,t.index);let i=t.index;if(g&&b){const e=bn(n.current.deriveRowKeys,r)[0];i=n.current.tableFullData.findIndex((t=>a(t,t.index)===e))}((e,t)=>{if(w.current=e,b){const{pageSize:e}=s,r=Math.ceil((t+1)/e);m(!1),u(Object.assign({},s,{current:r}))}else p(e)})(r,i),h(r)},V=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=o().useMemo((()=>y?`fastSearch_${y}`:""),[y]),[B,U]=o().useState([]),[W,G]=o().useState(""),[Y,X]=o().useState("");Me((()=>{if(Y){const{filters:e,config:t}=B.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(ue(e,H.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(ue(e,F.map((e=>e.fieldName)))),k(e),_(t)}else V(),k({}),_(R)}),[Y]),o().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await Qs().getItem(z);e||(e=await Z(z),Array.isArray(e)&&await Qs().setItem(z,e)),Array.isArray(e)&&e.length&&(U(e),X(e[0].value))},Z=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},J=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},ee=Ce("table");return o().createElement("div",{className:`${ee}-fast-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"top"},o().createElement("div",{className:"container"},o().createElement(pr,{defaultActiveKey:"1",size:"small",tabBarExtraContent:o().createElement("span",null,f("qm.table.alert.total",{total:D}))},o().createElement(pr.TabPane,{tab:f("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},o().createElement(Qo,{ref:x,items:F,cols:1,labelWidth:110})),o().createElement(pr.TabPane,{tab:f("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},o().createElement(Qo,{ref:E,items:H,cols:1,labelWidth:110})))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:i,value:W,placeholder:f("qm.table.highSearch.configText"),disabled:q,onChange:e=>{const{value:t}=e.target;G(t)}}),o().createElement(be,{type:"primary",disabled:!W||q,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=dn(),t=[...B,{text:W,value:e,list:{filters:O,config:A}}];U(t),X(e),G(""),await Qs().setItem(z,t),await J(z,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${os.rowHeightMaps[i]}px`}},o().createElement("span",null,f("qm.table.fastSearch.savedSetting"))),o().createElement("ul",null,B.map((e=>o().createElement("li",{key:e.value,className:we()({selected:e.value===Y}),title:e.text,onClick:()=>(e=>{X(e!==Y?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=B.filter((t=>t.value!==e));U(t),e===Y&&X(""),await Qs().setItem(z,t),await J(z,t)})(e.value)}},o().createElement(Te.CloseCircleOutlined,null))))),!B.length&&o().createElement("div",{style:{padding:zl}},o().createElement(ft,null)))))),o().createElement("div",{className:"bottom"},o().createElement("div",null,o().createElement(L.Checkbox,{checked:!!A.case,onChange:e=>M({case:e.target.checked})},f("qm.table.fastSearch.matchCase")),o().createElement(L.Checkbox,{checked:!!A.fullchar,onChange:e=>M({fullchar:e.target.checked})},f("qm.table.fastSearch.matchFullchar"))),o().createElement("div",null,o().createElement(be,{onClick:()=>V()},f("qm.table.fastSearch.clear"))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${$a[i]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.fastSearch.closeButton")),o().createElement(be,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},f("qm.table.fastSearch.queryPrev")),o().createElement(be,{type:"primary",onClick:()=>K("next")},f("qm.table.fastSearch.queryNext"))))},ec=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{$size:n}=o().useContext(jl),[a,i]=o().useState(!1),l=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ce("table"),c={visible:a,title:f("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${$a[n]+20}px`},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${s}-super-search`,title:f("qm.table.fastSearch.text"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.MonitorOutlined,null))),o().createElement(Cr,c,o().createElement(Js,{onClose:()=>i(!1)})))}));ec.displayName="FastSearch";const tc=ec,rc=e=>{const{columns:t,group:r,summary:n}=e,{tableRef:a,$size:i,pagination:l,fetchParams:s,isFetch:c}=o().useContext(jl),{fetch:d}=a.current.props,p=e=>{const r=t.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:r.dictItems??[]}},h=r.map((e=>({dataIndex:e.group,...p(e.group)}))),m=n.map((e=>e.summary===os.groupSummary.total.value?{dataIndex:e.summary,title:os.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=o().useMemo((()=>Object.assign({},s,{[os.sorterFieldName]:void 0,[os.groupSummary.summaryFieldName]:n.map((e=>`${e.formula}|${e.summary}`)).join(","),[os.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[os.currentPageName]:1})),[s,r,n]),[b,y]=o().useState(((e,r)=>[{title:f("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...r.map((e=>{const r=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=r?{summation:r}:null;return e.dataIndex===os.groupSummary.total.value&&(n={dataIndex:os.groupSummary.recordTotalIndex,summation:{render:()=>l.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,m)),[v]=o().useState(c?[]:(e=>{const t=fn(e,r.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&rn(t,n,tn(e[0],n))})),n.forEach((r=>{const n=r.summary!==os.groupSummary.total.value?r.summary:os.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&rn(t,n,e.length),"sum"===a&&rn(t,n,(0,te.sumBy)(e,n)),"max"===a&&rn(t,n,(0,te.maxBy)(e,n)[n]),"min"===a&&rn(t,n,(0,te.minBy)(e,n)[n]),"avg"===a&&rn(t,n,((0,te.sumBy)(e,n)/e.length).toFixed(2))})),a.push(t)})),a})(a.current.tableFullData)),x={size:i,height:400,...c?{fetch:{api:d.api,params:g,dataKey:d?.dataKey}}:{dataSource:v},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${u()().format(Yl)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return o().createElement(ad,x)},nc=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:a,flattenColumns:i}=o().useContext(jl),{uniqueKey:l}=n.current.props,s=o().useRef(null),d=o().useRef(null),[u,p]=o().useState(!1),[h,m]=o().useState([]),[g,b]=o().useState(""),[y,x]=o().useState("");Me((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;N(e),k(t)}else{const e=H();N(e?.group||[]),k(e?.summary||[])}}),[y]),o().useEffect((()=>{D()}),[]);const E=o().useMemo((()=>l?`summary_${l}`:""),[l]),S=o().useMemo((()=>i.filter((e=>![os.expandableColumn,os.selectionColumn,"index","pageIndex",os.operationColumn].includes(e.dataIndex)))),[i]),w=S.filter((e=>!e.groupSummary)).map((e=>({text:pn(e.title),value:e.dataIndex}))),C=[os.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:pn(e.title),value:e.dataIndex})))],T=[{text:f("qm.table.groupSummary.sumText"),value:"sum"},{text:f("qm.table.groupSummary.maxText"),value:"max"},{text:f("qm.table.groupSummary.minText"),value:"min"},{text:f("qm.table.groupSummary.avgText"),value:"avg"},{text:f("qm.table.groupSummary.countText"),value:"count"}],[I,N]=o().useState([]),[R,P]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(be,{type:"text",onClick:()=>{s.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:f("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>({...e,disabled:I.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=o().useState([]),[A,_]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(be,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:f("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>({...e,disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:f("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===os.groupSummary.total.value?T.slice(T.length-1):T})}]),F=o().useMemo((()=>{const e=I.length&&I.every((e=>Object.values(e).every((e=>""!==e)))),t=O.length&&O.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[I,O]),H=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=H();if(e){const{group:t,summary:r}=e;N(t),k(r)}let t=await Qs().getItem(E);t||(t=await $(E),Array.isArray(t)&&await Qs().setItem(E,t)),Array.isArray(t)&&t.length&&(m(t),!e&&x(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ce("table"),j={visible:u,title:f("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return o().createElement("div",{className:`${M}-group-summary__setting`},o().createElement("div",{className:"main"},o().createElement("div",{style:{width:"30%"}},o().createElement(ad,{ref:s,size:a,columns:R,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{N(e)}},o().createElement(be,{type:"primary",icon:o().createElement(Te.PlusOutlined,null),onClick:()=>{s.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"container line"},o().createElement(ad,{ref:d,size:a,columns:A,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onDataChange:e=>{k(e)}},o().createElement(be,{type:"primary",icon:o().createElement(Te.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:a,value:g,placeholder:f("qm.table.groupSummary.configText"),disabled:F,onChange:e=>{const{value:t}=e.target;b(t)}}),o().createElement(be,{type:"primary",disabled:!g||F,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=dn(),t=[...h,{text:g,value:e,list:{group:I.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];m(t),x(e),b(""),await Qs().setItem(E,t),await q(E,t)})()},f("qm.table.groupSummary.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${os.rowHeightMaps[a]}px`}},o().createElement("span",null,f("qm.table.groupSummary.savedSetting"))),o().createElement("ul",null,h.map((e=>o().createElement("li",{key:e.value,className:we()({selected:e.value===y}),title:e.text,onClick:()=>(e=>{x(e!==y?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));m(t),e===y&&x(""),await Qs().setItem(E,t),await q(E,t)})(e.value)}},o().createElement(Te.CloseCircleOutlined,null))))),!h.length&&o().createElement("div",{style:{padding:zl}},o().createElement(ft,null)))))),o().createElement(Cr,j,o().createElement(rc,{columns:S,group:I,summary:O})),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.groupSummary.closeButton")),o().createElement(be,{type:"primary",disabled:F,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:I.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))})),void p(!0))},f("qm.table.groupSummary.confirmButton"))))},ac=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,a]=o().useState(!1),i=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:i})));const l=Ce("table"),s={visible:n,title:f("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-group-summary`,title:f("qm.table.groupSummary.text"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.PieChartOutlined,null))),o().createElement(Cr,s,o().createElement(nc,{onClose:()=>a(!1)})))}));ac.displayName="GroupSummary";const ic=ac,oc=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:a,flattenColumns:i,setSuperFilters:l,clearTableFilter:s}=o().useContext(jl),{uniqueKey:d}=n.current.props,u=o().useRef(null),[p,h]=o().useState([]),[m,g]=o().useState([]),[b,y]=o().useState(""),[x,E]=o().useState("");Me((()=>{h(x?m.find((e=>e.value===x)).list:H()||[])}),[x]),o().useEffect((()=>{D()}),[]);const S=o().useMemo((()=>d?`superSearch_${d}`:""),[d]),w=o().useMemo((()=>i.filter((e=>!!e.filter))),[i]),C=mn(p),T=o().useMemo((()=>!(C&&qr(C))),[C]),I=o().useMemo((()=>!!p.length&&T),[p,T]),N=[{value:"and",text:f("qm.table.highSearch.andText")},{value:"or",text:f("qm.table.highSearch.orText")}],R=i.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:pn(e.title)}))),P=e=>["in","nin"].includes(e),O=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:f("qm.table.highSearch.gtText")},{value:"<",text:f("qm.table.highSearch.ltText")},{value:">=",text:f("qm.table.highSearch.gteText")},{value:"<=",text:f("qm.table.highSearch.lteText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:f("qm.table.highSearch.inText")},{value:"nin",text:f("qm.table.highSearch.ninText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:f("qm.table.highSearch.likeText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}]}return t},[A,_]=o().useState([{title:f("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(be,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},f("qm.table.highSearch.removeText")))},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:f("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=w.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:f("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:f("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:f("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:O(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:N,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),F=()=>{S&&sessionStorage.setItem(S,JSON.stringify(p.filter((e=>!!e.fieldName))))},H=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},D=async()=>{if(!S)return;const e=H();e&&h(e);let t=await Qs().getItem(S);t||(t=await $(S),Array.isArray(t)&&await Qs().setItem(S,t)),Array.isArray(t)&&t.length&&(g(t),!e&&E(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ce("table");return o().createElement("div",{className:`${M}-super-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"container"},o().createElement(ad,{ref:u,size:a,columns:A,dataSource:p,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...p]))},onDataChange:e=>{h(e)}},o().createElement(be,{type:"primary",icon:o().createElement(Te.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),os.highSearch.showSQL&&C&&o().createElement("code",{className:"lang-js"},C)),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:a,value:b,placeholder:f("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;y(t)}}),o().createElement(be,{type:"primary",disabled:!b||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=dn(),t=[...m,{text:b,value:e,list:p.filter((e=>!!e.fieldName))}];g(t),E(e),y(""),await Qs().setItem(S,t),await q(S,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${os.rowHeightMaps[a]}px`}},o().createElement("span",null,f("qm.table.highSearch.savedSetting"))),o().createElement("ul",null,m.map((e=>o().createElement("li",{key:e.value,className:we()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=m.filter((t=>t.value!==e));g(t),e===x&&E(""),await Qs().setItem(S,t),await q(S,t)})(e.value)}},o().createElement(Te.CloseCircleOutlined,null))))),!m.length&&o().createElement("div",{style:{padding:zl}},o().createElement(ft,null)))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.highSearch.closeButton")),o().createElement(be,{type:"primary",disabled:I,onClick:()=>(s(),l(p.map((e=>ue(e,["index","pageIndex"])))),F(),void t())},f("qm.table.highSearch.searchButton"))))},lc=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,a]=o().useState(!1),i=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:i})));const l=Ce("table"),s={visible:n,title:f("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-super-search`,title:f("qm.table.highSearch.text"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.FunnelPlotOutlined,null))),o().createElement(Cr,s,o().createElement(oc,{onClose:()=>a(!1)})))}));lc.displayName="SuperSearch";const sc=lc,cc=o().forwardRef(((e,t)=>{const{tableColumns:r,showFullScreen:n,showReload:a,showPrint:i,showImport:l,showExport:s,showClipboard:d,showCollection:u,showFastSearch:p,showSuperSearch:h,showGroupSummary:m,showToolBox:g}=e,{global:b}=o().useContext(c),{tableRef:y,isFullScreen:x,$size:E}=o().useContext(jl),{uniqueKey:S,exportExcel:w}=y.current.props,C=o().useRef(null),T=o().useRef(null),I=o().useRef(null),N=o().useRef(null),R=o().useRef(null),P=o().useRef(null),O=o().useRef(null),k=o().useRef(null),A=o().useRef(null),_=o().useRef(null),F=o().useRef(!1),H=o().useMemo((()=>S?`toolBox_${S}`:""),[S]),[D,$]=o().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),q={fullScreen:n,reload:a,print:i,import:l,export:s&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:p,superSearch:h,groupSummary:m},[M,j]=o().useState(!1);Me((()=>{F.current&&(V(),F.current=!1)}),[D]),o().useEffect((()=>{K()}),[]),o().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!R.current)return v("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const K=()=>{if(!H||!g)return;const e=JSON.parse(localStorage.getItem(H));e||z(H).then((e=>{e&&($(Object.assign({},D,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&$(Object.assign({},D,e))},V=()=>{if(!H||!g)return;const e={};for(const t in D)D[t]&&(e[t]=D[t]);localStorage.setItem(H,JSON.stringify(e)),B(H,e)},z=async e=>{const t=b?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=b?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},U=async e=>{j(!1),await le(100),e.current.clickHandle()},W=(e,t)=>{F.current=!0,$(Object.assign({},D,{[t]:e}))},G=Ce("table"),Y={"top-toolbox__popper":!0,[`${G}--lg`]:"large"===E,[`${G}--sm`]:"small"===E};return o().createElement(o().Fragment,null,n&&o().createElement(vs,{ref:C,isFullScreen:x,open:!g||D.fullScreen}),a&&o().createElement(Es,{ref:T,open:!g||D.reload}),i&&o().createElement(Cs,{ref:I,tableColumns:r,open:!g||D.print}),l&&o().createElement(qs,{ref:N,tableColumns:r,open:!g||D.import}),s&&o().createElement(Vs,{ref:R,tableColumns:r,open:(!g||D.export)&&!w?.hideIcon}),d&&o().createElement(Us,{ref:P,open:!g||D.clipboard}),u&&o().createElement(Ys,{ref:O,columns:r,open:!g||D.collection}),p&&o().createElement(tc,{ref:k,open:!g||D.fastSearch}),m&&o().createElement(ic,{ref:A,open:!g||D.groupSummary}),h&&o().createElement(sc,{ref:_,open:!g||D.superSearch}),g&&o().createElement(L.Dropdown,{open:M,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.screen.full"))),onClick:()=>U(C)},{key:"reload",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.refresh.text"))),onClick:()=>U(T)},{key:"print",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.print.text"))),onClick:()=>U(I)},{key:"import",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.import.textNoSpace"))),onClick:()=>U(N)},{key:"export",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.export.textNoSpace"))),onClick:()=>U(R)},{key:"clipboard",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.clipboard.textNoSpace"))),onClick:()=>U(P)},{key:"collection",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.selectCollection.text"))),onClick:()=>U(O)},{key:"fastSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.fastSearch.text"))),onClick:()=>U(k)},{key:"groupSummary",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.groupSummary.text"))),onClick:()=>U(A)},{key:"superSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.highSearch.text"))),onClick:()=>U(_)}];return o().createElement(L.Menu,{items:e.filter((e=>q[e.key]))})})(),overlayClassName:we()(Y),overlayStyle:{minWidth:120},onOpenChange:e=>{j(e)}},o().createElement("span",{className:`${G}-toolbox`,title:f("qm.table.toolbox.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.AppstoreAddOutlined,null)))))}));cc.displayName="ToolBox";const dc=cc,uc=(e,t)=>e.map((e=>(e.children&&(e.children=uc(e.children,t)),t(e)))),pc=o().forwardRef(((e,t)=>{const{columns:r}=e,{global:n}=o().useContext(c),{tableRef:a,$size:i}=o().useContext(jl),{showColumnDefine:l,uniqueKey:s,onlyShowIcon:d,columnsChange:u}=a.current.props,p=o().useRef([]),[h,m]=o().useState(!1),g=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),b=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),v=o().useMemo((()=>s?`table_${s}`:""),[s]);Me((()=>{E(r)}),[r]),o().useLayoutEffect((()=>{S()}),[]),o().useImperativeHandle(t,(()=>({initialHandler:S})));const x=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=x(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),{dataIndex:e.dataIndex,...t}})),E=e=>{if(!v)return;const t=x(e),r=JSON.parse(localStorage.getItem(v));a.current.columnsDefined&&!(0,te.isEqual)(t,r)&&(localStorage.setItem(v,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(v,t))},S=()=>{const e=(()=>{if(!v)return;const e=JSON.parse(localStorage.getItem(v));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(v).then((e=>{e?(localStorage.setItem(v,JSON.stringify(e)),S()):n?.getComponentConfigApi&&E(r)})).catch((()=>{})),e?(0,te.xor)(Vr(e).map((e=>e.dataIndex)),Vr(r).map((e=>e.dataIndex))).length>0?uc(r,(t=>{const r=Br(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):uc(e,(e=>{const t=Br(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=w(e),p.current=t,u?.(e))},w=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),t},C=e=>{const t=[];e.forEach((r=>{const{colSpan:n,dataIndex:a}=r;if(0===n)return;if(1===n)return t.push(r);const i=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(r);t.push(...p.current[i].map(((t,n)=>{let{dataIndex:a}=t;const i=e.find((e=>e.dataIndex===a));return n>0&&(void 0!==r.hidden&&(i.hidden=r.hidden),void 0!==r.fixed?i.fixed=r.fixed:i.fixed&&delete i.fixed),i})))})),r.forEach(((e,r)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(r,0,e)})),u?.(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},I=(e,t)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=pn(e.title),l=["svgicon","handle",`${t}-handle`],s=o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,C(r)}}),o().createElement("i",{className:we()(l),title:f("qm.table.columnFilter.draggable")},o().createElement(Te.HolderOutlined,null)),o().createElement("span",{className:"text",title:i},i),"main"===t?o().createElement("span",{className:we()("fixed",a?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},o().createElement(Te.StepBackwardOutlined,null)),o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},o().createElement(Te.StepForwardOutlined,null))):"sub"!==t?o().createElement("span",{className:we()("fixed",a?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},o().createElement(Te.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?o().createElement(L.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:N(e.children,e.dataIndex)},s):s},N=(e,t)=>o().createElement("div",{className:"column-filter--wrap"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:n=>{const a=n.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,te.isEqual)(a,i)||((e,t)=>{Br(r,t).children=e,u?.([...r])})(xn(n),t)}},e.map((e=>I(e,"sub"))))),R=Ce("table"),P={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===i,[`${R}--sm`]:"small"===i},O=[`${R}-column-filter`,{selected:h}];return l?o().createElement(Xa(),{action:["click"],popupVisible:h,popup:o().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"reset"},o().createElement(be,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const n=Br(r,t.dataIndex)||pe(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));u?.(e(a.current.originColumns))}},f("qm.table.columnFilter.reset"))),o().createElement("div",{className:"left"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),r=g.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||C([...xn(e),...y,...b])}},g.map((e=>I(e,"left"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"main"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||C([...g,...xn(e),...b])}},y.map((e=>I(e,"main"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"right"},o().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),r=b.map((e=>e.dataIndex));(0,te.isEqual)(t,r)||C([...g,...y,...xn(e)])}},b.map((e=>I(e,"right")))))),popupClassName:we()(P),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{m(e)},builtinPlacements:Xl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:we()(O),title:d?f("qm.table.columnFilter.text"):void 0},o().createElement("i",{className:"svgicon icon"},o().createElement(Te.SettingOutlined,null)),!d&&o().createElement("span",null,f("qm.table.columnFilter.text")))):null}));pc.displayName="ColumnFilter";const hc=pc,mc=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"}));function fc(){return fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fc.apply(this,arguments)}const gc=e=>{const{column:t,filters:r}=e,{$size:n,setFilters:a,clearSuperFilters:i}=o().useContext(jl),l=o().useRef(null),s=o().useRef(null),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!1),[m,g]=o().useState({}),b=o().useMemo((()=>{const{dataIndex:e,filter:r}=t;return`${e}|${r.type}`}),[t]),y=o().useMemo((()=>{let e=!1;for(const t in r[b])if(!de(r[b][t])||p){e=!0;break}return e}),[b,r,p]);o().useLayoutEffect((()=>{d&&setTimeout((()=>x()),20)}),[d]),o().useEffect((()=>{(0,te.isEqual)(m[b],r[b])||g({[b]:r[b]||{}}),h(""===r[b]?.["=="])}),[r]);const x=()=>{switch(t.filter.type){case"text":l.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&g(e),i(),a((e=>{for(const t in e){for(const r in e[t])if(de(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...r,...m,...e})),u(!1)},S={text:e=>o().createElement(o().Fragment,null,o().createElement(L.Input,{ref:l,size:n,placeholder:f("qm.table.filter.searchText",{text:pn(e.title)}),style:{width:"180px"},value:m[b]?.like??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),textarea:e=>o().createElement(o().Fragment,null,o().createElement(L.Input.TextArea,{ref:c,size:n,placeholder:f("qm.table.filter.searchAreaText",{text:pn(e.title)}),style:{width:"220px"},value:m[b]?.likes??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:m[b]?.[e]??"",size:n,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(L.InputNumber,fc({ref:s},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(L.InputNumber,fc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(L.InputNumber,fc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(L.InputNumber,fc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:sn(m[b]?.[e],Wl),format:Wl,size:n,onChange:t=>{g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:cn(t,Wl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(j,fc({},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(j,fc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(j,fc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(j,fc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Radio.Group,{style:{width:"100%"},value:m[b]?.["=="],onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{"==":t}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Checkbox.Group,{style:{width:"100%"},value:m[b]?.in,onChange:e=>{g((t=>Object.assign({},t,{[b]:{in:e}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("div",{style:{height:200,...t.style}},o().createElement(Ml,{multiple:!0,value:m[b]?.in||[],dataSource:n,onCheckChange:e=>{const t=e.map((e=>e.value));g((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},w=Ce("table"),C={"head-filter__popper":!0,[`${w}--lg`]:"large"===n,[`${w}--sm`]:"small"===n},T=["cell--filter",{selected:d,actived:y}];return o().createElement(Xa(),{action:["click"],popupVisible:d,popup:(()=>{const e=t.filter.type,r=S[e];return r?o().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},o().createElement("div",null,r(t)),o().createElement(L.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},o().createElement(be,{size:n,onClick:()=>(E({[b]:{}}),void h(!1))},f("qm.table.filter.reset")),o().createElement(be,{type:"primary",size:n,onClick:()=>E()},f("qm.table.filter.search")))):(v("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:we()(C),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:Xl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("div",{className:we()(T),title:f("qm.table.filter.text"),onClick:e=>e.stopPropagation()},o().createElement("span",{className:"svgicon icon"},o().createElement(mc,null))))},bc=e=>{const{column:t}=e,{tableRef:r,bordered:n}=o().useContext(jl),{columns:a,resizable:i,columnsChange:l=ie}=r.current.props,s=o().useMemo((()=>Wr(t)),[t]),c={resizable:!0,"is--line":i&&!n};return o().createElement("div",{className:we()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,i=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Zr(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,r=u+t;r<(s.minWidth||os.defaultColumnWidth)||(p=Math.floor(r),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&&(Br(a,s.dataIndex).width=p,l([...a]))},!1}})},yc=e=>{const{selectionKeys:t}=e,{tableRef:r,getRowKey:n,fetchParams:a,createWebPageData:i,setSelectionKeysEffect:l,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=o().useContext(jl),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:g,onSelectAll:b}=p,y=o().useRef([]),v=o().useMemo((()=>d&&!!h),[d,h]),x=o().useMemo((()=>!v&&!!m),[v,m]),E=o().useMemo((()=>(g??!0)&&!x),[g,x]),S=()=>u?i():r.current.tableFullData,w=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>n(e,e.index)))},C=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:a}=p;if(v)return y.current.length?y.current:(0,te.union)(t,w());if(!x)return a?t.filter((t=>!a(e.get(t)))):t;const i=a?S().filter((e=>!a(e))).map((e=>n(e,e.index))):S().map((e=>n(e,e.index)));return(0,te.union)(i,w())})(),T=t.filter((e=>!C.includes(e))),I=t.length-T.length,N=I>0&&I<C.length,R=!!I&&I===C.length;s(T);const P=async()=>{const e=h;let t=[];c(!0);try{const r=await e.api(a);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,te.get)(r.data,e.dataKey)??[];const{disabled:a}=p;a&&(t=(0,te.xor)(t,S().filter((e=>a(e))).map((e=>n(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},O=async e=>{let t=[];t=v?e?await P():[]:e?C.slice(0):[],t=[...new Set([...t,...T])],l(t),b?.(e,t)};return o().createElement("div",{className:"cell--selection"},o().createElement(L.Checkbox,{checked:R,indeterminate:N,disabled:!C.length,onChange:e=>O(e.target.checked)}),E&&o().createElement(L.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:f("qm.table.selection.all"),onClick:()=>{O(!0)}},{key:2,label:f("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,te.xor)(t,await P()):(0,te.xor)(t,C),e=[...new Set([...e,...T])],l(e)})()},{key:3,label:f("qm.table.selection.clear"),onClick:()=>{O(!1)}}];return o().createElement(L.Menu,{items:e})})()},o().createElement(Te.DownOutlined,{className:"svgicon icon"})),x&&o().createElement(L.Tooltip,{placement:"top",title:f("qm.table.selection.currentPage")},o().createElement(Te.InfoCircleOutlined,{className:"info"})))},vc=e=>{const{style:t}=e,{tableRef:r,isTreeTable:n,setRowExpandedKeys:a}=o().useContext(jl),{expandable:i}=r.current.props,[l,s]=o().useState(i?.defaultExpandAllRows||!1);Me((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;a(l?e.filter((e=>!(n&&t.includes(e)))):[])}),[l]);const c=Ce("expand"),d={[`${c}--icon`]:!0,expanded:l,collapsed:!l};return o().createElement("span",{className:we()(d),title:"",onClick:e=>{e.stopPropagation(),s(!l)},style:t})},xc=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Ec=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Sc=e=>{const{tableColumns:t,sorter:r,filters:n}=e,{tableRef:a,layout:i,scrollY:l,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:h,isTreeTable:m,isGroupSubtotal:g,tableChange:b,setSorter:y,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:S,createGroupData:w,createTableFullData:C}=o().useContext(jl),{ellipsis:T,resizable:I,multipleSort:N,rowSelection:R,expandable:P}=a.current.props,[O,k]=os.sortDirections,{tableOriginData:A}=a.current,_=o().useRef(null),F=o().useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),H=o().useMemo((()=>!h),[h]),D=o().useMemo((()=>!h),[h]),$=o().useMemo((()=>!P?.hideExpandAll),[P]),q=o().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);Me((()=>{B(),b(),x()}),[r]),Me((()=>{G(),b(),x()}),[n]),Me((()=>{G(),b(),x()}),[c]),o().useEffect((()=>{!de(r)&&se((()=>B())),!de(n)&&se((()=>G()))}),[]),o().useLayoutEffect((()=>{M()}),[]);const M=()=>{v("$header",_.current)},j=e=>{const{dataIndex:t,type:n,sorter:a,title:i,description:l}=e;if(t===os.selectionColumn&&"checkbox"===n){if("checkbox"===n)return o().createElement("div",{className:"cell"},q?o().createElement(yc,{selectionKeys:d}):f("qm.table.config.selectionText"));if("radio"===n)return o().createElement("div",{className:"cell"},i)}const s=[];return s.push(o().createElement("div",{key:0,className:"cell",title:pn(i)},m&&t===p&&$?o().createElement(vc,null):null,t===os.expandableColumn&&$?o().createElement(vc,null):i)),l&&s.push(o().createElement(L.Tooltip,{key:1,placement:"top",title:l},o().createElement(Te.InfoCircleOutlined,{className:"tip"}))),a&&s.push(K(r[t])),s},K=e=>{const t=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return o().createElement("div",{key:2,className:"cell--sorter",title:f("qm.table.sorter.text")},o().createElement("span",{className:we()(t)},o().createElement(xc,null)),o().createElement("span",{className:we()(r)},o().createElement(Ec,null)))},V=e=>o().createElement(gc,{column:e,filters:n}),z=(e,t)=>{const{sorter:n,dataIndex:a}=t;if(n){const e=r[a],t=e?e===k?null:k:O;N?(delete r[a],y(Object.assign({},r,{[a]:t}))):y(Object.assign({},{[a]:t}))}},B=()=>{H&&U()},U=e=>{const t=(0,te.pickBy)(r,(e=>null!==e));for(const e in t){const r=s.find((t=>t.dataIndex===e));r?W(r,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},O)},W=(e,t)=>{const{tableFullData:r}=a.current,{dataIndex:n,sorter:i}=e,o=(e,r)=>{const a=tn(e,n),i=tn(r,n);return Number.isNaN(a-i)?t===O?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===O?a-i:i-a},l=g?w(hn(r).sort("function"==typeof i?i:o)):r.sort("function"==typeof i?i:o).slice(0);C(l)},G=()=>{D&&Y()},Y=()=>{const e=c.length?mn(c):mn(n),t=""!==e?g?w(Mr(hn(A),e,F)):Mr(A,e,F):A;C(t),U(!0)},X=Qr(t),Q=Ce("table"),{tableBodyWidth:Z}=i;return o().createElement("div",{ref:_,className:`${Q}--header-wrapper`},o().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=i;return o().createElement("colgroup",null,s.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),l&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("thead",null,(e=>{const{isIE:t}=a.current,n=["gutter",{"cell-fix-right":!!u.length}],s=t?null:{right:u.length?0:""};return e.map(((e,t)=>o().createElement("tr",{key:t,className:"header--row"},e.map(((t,n)=>((e,t,n)=>{const{isIE:s}=a.current,{gutterWidth:c}=i,{dataIndex:d,colSpan:u,rowSpan:p,fixed:h,align:m,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===u)return null;const w=f||m,C=["header--column",{"col--ellipsis":e.ellipsis??T,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!r[d],"cell-fix-left":!s&&"left"===h,"cell-fix-right":!s&&"right"===h,"cell-fix-left-last":!s&&"left"===h&&!n[t+(u??1)]?.fixed,"cell-fix-right-first":!s&&"right"===h&&!n[t-1]?.fixed,[g]:!!g}],N=s?null:{left:"left"===h?`${E(d)}px`:"",right:"right"===h?`${S(d,"thead")+(l?c:0)}px`:""},R=I&&![os.expandableColumn,os.selectionColumn].includes(d);return o().createElement("th",{key:d,className:we()(C),colSpan:u,rowSpan:p,style:{...N},onClick:t=>z(t,e)},o().createElement("div",{className:"cell--wrapper"},x?o().createElement("div",{className:"cell--text cell"},x(e,a.current.tableFullData)):o().createElement(o().Fragment,null,o().createElement("div",{className:"cell--text"},j(e)),y?V(e):null)),R&&o().createElement(bc,{column:e}))})(t,n,e))),l&&o().createElement("th",{className:we()(n),style:{...s}}))))})(X))))},wc=o().createContext([]),Cc=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Tc=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),Ic=(e,t)=>{const r=e.target;return!("button"in e&&e.button>0||r&&!Cc(r).contains(r)||t.current?.contains(r))};function Nc(e){let{ref:t,handler:r,enabled:n=!0,omitClassNames:a=[]}=e;const o=Zl(r),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!n)return;const e=e=>{Ic(e,t)&&(l.current.isPointerDown=!0)},i=e=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:r&&l.current.isPointerDown&&Ic(e,t)&&Tc(e,a)&&(l.current.isPointerDown=!1,o(e))},s=e=>{l.current.ignoreEmulatedMouseEvents=!0,r&&l.current.isPointerDown&&Ic(e,t)&&Tc(e,a)&&(l.current.isPointerDown=!1,o(e))},c=Cc(t.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",i,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",i,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[r,t,o,l,n])}function Rc(){const[,e]=i.useReducer((e=>e+1),0);return e}function Pc(){const{locale:e}=i.useContext(c);return{t:f,$locale:e}}const Oc=e=>{const{selectionKeys:t,column:r,record:n,rowKey:a}=e,{tableRef:i,isTreeTable:l,getAllChildRowKeys:s}=o().useContext(jl),{rowSelection:c}=i.current.props,d=o().useMemo((()=>r.type||""),[r.type]),u=e=>{const r=c.checkStrictly??!0;if(!l||r)return!1;const n=Yr(i.current.deriveRowKeys,e);return((e,t)=>{const r=new Set(t);let n=!1,a=!1;for(const t of e)if(r.has(t)?n=!0:a=!0,n&&a)break;return n&&a})(s(n?.children??[]),t)};return"radio"===d?(()=>{const e=c.disabled,r=e?.(n),i=!r&&t[0]===a;return o().createElement(L.Radio,{checked:i,disabled:r})})():(()=>{const e=c.disabled,r=e?.(n),i=!!t.includes(a);return o().createElement(L.Checkbox,{checked:i,indeterminate:u(a),disabled:r})})()},kc=e=>{const{record:t,rowKey:r,style:n}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:l}=o().useContext(jl),{expandable:s={}}=a.current.props,[c]=o().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=o().useMemo((()=>i.includes(r)),[i,r]);Me((()=>{s.onExpand?.(d,t)}),[d]);const u=Ce("expand"),p={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return o().createElement("span",{className:we()(p),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==r)):[...i,r];l(t)},style:n})},Ac=o().forwardRef(((e,t)=>{const{size:r,defaultValue:n,value:a,min:i,max:l,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>l&&(t=l.toString()),t&&Number(t)<i&&(t=i.toString()),p>=0&&""!==t&&(t=new(Pa())(t).toFixed(p)),t},E=void 0!==a,[S,w]=o().useState(n??""),C=b(E?a:S),T=y(C);return Me((()=>{e.onChange?.(T)}),[S]),o().createElement(L.Input,{ref:t,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),i>=0&&r.startsWith("-")&&(n=!1),n){if(!h&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):w(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(T);e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ac.displayName="InputNumber";const Lc=Ac;function _c(){return _c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_c.apply(this,arguments)}const{Search:Fc}=L.Input,Hc=o().forwardRef(((e,t)=>{const{column:r,record:n,rowKey:a,columnKey:i}=e,{tableRef:l,tableBodyRef:s,$size:c,flattenColumns:d,updateTableData:u,doFieldValidate:p,dataChange:h}=o().useContext(jl),m=o().useContext(wc),g=Rc(),{store:b,fieldAuth:y}=l.current,x=o().useMemo((()=>r.editRender?.(n,r)||{}),[n,r]),E=o().useRef(null),S=o().useRef(null),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),I=o().useRef(!1),N=o().useRef({}),R=o().useRef({}),P=o().useRef([]),[O,k]=o().useState(!1),[A,_]=o().useState(!1),[F,H]=o().useState(!1),[D,$]=o().useState(x.items||[]),[q,M]=o().useState(),K=(x.editable||(0,te.isEqual)(m,[a,i]))&&!x.disabled&&!y[i]?.disabled,V=`${a}|${i}`,z=2===m.length?`${m[0]}|${m[1]}`:"",U=![...b.state.required,...b.state.validate].some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),W=b.state.required.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",G=b.state.validate.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",Y=b.state.edited.some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),X=K||!U||O||F||A,Q=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");o().useLayoutEffect((()=>{X&&z===V&&ne()}),[m]),o().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&re(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const J=()=>{u(),h()},ee=(e,t)=>{k(e),t?.()},re=e=>{P.current=e},ne=()=>{const{type:e}=x;switch(e){case"text":S.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":T.current?.focus()}};o().useImperativeHandle(t,(()=>({focus:ne})));const ae=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},ie=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};b.addToUpdated(e),n&&b.addToEdited({x:t,y:r})},le=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",ce={text:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onInput:u,onChange:h,onEnter:m,onBlur:b}=x,y=tn(e,n),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=r?{rows:v.minRows,autoSize:v}:null,w=s.password?L.Input.Password:r?L.Input.TextArea:L.Input;return o().createElement(w,_c({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||f("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";rn(e,n,r),p(d,r,a,i),g(),u?.({[V]:r}),I.current=!0},onFocus:()=>_(!0),onBlur:t=>{_(!1);const r=t.target.value??"";I.current&&(I.current=!1,ie(e,a,i),h?.({[V]:r},e),b?.({[V]:r},e),J())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";m?.({[V]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&m&&e.preventDefault()}}))},textarea:(e,t)=>ce.text(e,t,!0),number:(e,t)=>{const{dataIndex:r,precision:n,formatType:l}=t,{type:s,extra:d={},rules:u=[],onInput:h,onChange:m,onEnter:b,onBlur:y}=x,v=tn(e,r);let E,S;return"finance"===l&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===l&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Pa())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Pa())(e).times(.01).toString()),o().createElement(Lc,{ref:w,size:c,value:v,min:d.min,max:d.max,precision:n,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===l?"%":void 0),placeholder:d.placeholder||f("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:S,onChange:t=>{rn(e,r,t),p(u,t,a,i),g(),h?.({[V]:t}),I.current=!0},onFocus:()=>_(!0),onBlur:(t,n)=>{if(_(!1),!I.current)return;I.current=!1;let o=d.stringMode?t:le(t);"percent"===l&&"."===n.charAt(n.length-1)&&(o=Number(t)/100),rn(e,r,o),ie(e,a,i),m?.({[V]:o},e),y?.({[V]:o},e),J()},onEnter:(t,r)=>{let n=d.stringMode?t:le(t);"percent"===l&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),b?.({[V]:n},e)}})},select:(e,t,r)=>{const{dataIndex:n,dictItems:l=[]}=t,{type:s,extra:d={},rules:u=[],items:h,onChange:m,onEnter:g}=x,b=h||l,y=tn(e,n);let v=y;return o().createElement(L.Select,{mode:r?"multiple":void 0,size:c,popupClassName:"table-editable__popper",value:y||void 0,placeholder:d.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{rn(e,n,t),p(u,t,a,i),ie(e,a,i),m?.({[V]:t},e),J()},onSelect:e=>{v=e},onInputKeyDown:t=>{13===t.keyCode&&se((()=>g?.({[V]:v},e)))}},b.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ce.select(e,t,!0),date:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onChange:u}=x,h=r||"exactdate",m=tn(e,n);return o().createElement(j,{size:c,popupClassName:"table-editable__popper",value:sn(m,Rn[h])??void 0,picker:Nn[h],format:s.format,showTime:"datetime"===h,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=cn(t,Rn[h]);rn(e,n,r),p(d,r,a,i),ie(e,a,i),u?.({[V]:r},e),J()}})},datetime:(e,t)=>ce.date(e,t,"datetime"),month:(e,t)=>ce.date(e,t,"month"),year:(e,t)=>ce.date(e,t,"year"),time:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:d}=x,u="HH:mm:ss",h=tn(e,r);return o().createElement(B,{size:c,popupClassName:"table-editable__popper",value:sn(h,u)??void 0,format:l.format||u,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=cn(t,u);rn(e,r,n),p(s,n,a,i),ie(e,a,i),d?.({[V]:n},e),J()}})},checkbox:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=Bl,falseValue:u=Ul,disabled:h}=l,m=tn(e,r);return o().createElement(L.Checkbox,{checked:m===d,disabled:h,onChange:t=>{const n=t.target.checked?d:u;rn(e,r,n),p(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},switch:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=Bl,falseValue:u=Ul,disabled:h}=l,m=tn(e,r);return o().createElement(L.Switch,{checked:m===d,disabled:h,onChange:t=>{const n=t?d:u;rn(e,r,n),p(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},"search-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onInput:m,onChange:g,onEnter:b}=x,y=nn(e,Q?h.combinedDataIndex:r),S=h.fieldAliasMap;S||v("Table","helper 需要配置 `fieldAliasMap` 选项");const w="function"==typeof S?S():S||{};Object.keys(w).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(w).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),w[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const T=e=>{const{filterAliasMap:t}=h,n=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[r]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,te.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i},R=e=>{const{autoQueryAssign:t=!0}=h;t&&(N.current=T(e)),k(!0)},P=(r,n)=>{const{beforeOpen:a}=h,i=(a??oe)({[V]:y},e,t);i?.then?i.then((()=>{R(r),n?.()})).catch((()=>{})):!1!==i&&(R(r),n?.())},A=e=>{const t={};for(const n in w){const a=w[n];n!==r&&(t[n]=nn(e,a))}const n=w[r]?nn(e,w[r]):"";_(n,t);const{closed:a}=h;ee(!1,(()=>ae(E.current))),ne(),a?.(e)},L=()=>{const{onlySelect:e=!0}=h;I.current&&_(e?"":y),ee(!1,(()=>ae(E.current)))},_=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,te.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){rn(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&p(i.rules,r,a,t)}else rn(e,t,r)}Q&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return rn(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&rn(e,t,a[r]?.trim())}))})(e,h.combinedDataIndex),rn(e,r,t,n),p(u,t,a,i),ie(e,a,i),g?.({[V]:t},e),J(),N.current={},I.current=!1,M(void 0)},F={visible:O,title:f("qm.searchHelper.text"),width:h.width??"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{L()}},D={...h,size:c,initialValue:Object.assign({},N.current,h.initialValue),onClose:e=>{e?A(e):L()}};return o().createElement(o().Fragment,null,o().createElement(Fc,{ref:C,value:q??y,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=h;if(I.current&&!O)return t&&n&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=h,{beforeFetch:n=oe}=t.fetch;return new Promise((async(a,i)=>{const o=(0,te.merge)({},t.fetch.params,{...r,...T(e)},{currentPage:1,pageSize:500});if(!n(o))return i();H(!0);try{const e=await t.fetch.api(o);200===e.code?a(Array.isArray(e.data)?e.data:(0,te.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{se((()=>H(!1)))}}))})(t).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=>nn(t,w[r]).toString().includes(e)));if(1===t.length)return A(t[0]);P(e)}(e,t))).catch((()=>_(""))):void _(t)},onChange:e=>{const{value:t}=e.target;m?.({[V]:t}),I.current=!0,M(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";b?.({[V]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;P(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&P(e)}}),o().createElement(Cr,F,o().createElement(sd,D)))},"search-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,items:l=[],extra:s={},rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=tn(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,a=(n??oe)({[V]:b},e,t);a?.then?a.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==a&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ae(E.current)))},T=t=>{rn(e,r,t),p(d,t,a,i),ie(e,a,i),m?.({[V]:t},e,P.current),J()},I={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{C()}},N={...u,size:c,multiple:!0,initialValue:(0,te.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=S;re((0,te.uniqBy)([...P.current.filter((e=>t.includes(e[n]))),...e],n));const a=P.current.map((e=>({text:e[r],value:e[n]}))),i=(0,te.uniqBy)([...a,...l],"value").filter((e=>t.includes(e.value)));$(i),T(i.map((e=>e.value)));const{closed:o}=u;ee(!1,(()=>ae(E.current))),o?.(P.current)})(e,t):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&g?.({[V]:b},e)},onDoubleClick:()=>{s.disabled||w()},onChange:e=>{const{valueKey:t}=S;re(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(Cr,I,o().createElement(sd,N)))},"tree-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onChange:m,onEnter:g}=x,b=nn(e,Q?h.combinedDataIndex:r),y=h.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=r=>{const{beforeOpen:n}=h,a=(n??oe)({[V]:b},e,t);a?.then?a.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==a&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ae(E.current)))},I=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,te.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){rn(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&p(i.rules,r,a,t)}else rn(e,t,r)}rn(e,r,t,n),p(u,t,a,i),ie(e,a,i),m?.({[V]:t},e),J()},N={visible:O,title:f("qm.searchHelper.text"),width:h.width??"30%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{C()}},R={...h,defaultSelectedKeys:[b],size:c,onClose:e=>{e?(e=>{const t={};for(const n in S){const a=S[n];n!==r&&(t[n]=nn(e,a))}const n=S[r]?nn(e,S[r]):"";I(n,t);const{closed:a}=h;ee(!1,(()=>ae(E.current))),ne(),a?.(e)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement(Fc,{ref:T,value:b,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";g?.({[V]:r},e)}},onDoubleClick:()=>{w()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?w():I(""))}}),o().createElement(Cr,N,o().createElement(gd,R)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},items:s=[],rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=tn(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,a=(n??oe)({[V]:b},e,t);a?.then?a.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==a&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ae(E.current)))},T=t=>{rn(e,r,t),p(d,t,a,i),ie(e,a,i),m?.({[V]:t},e,P.current),J()},I={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:"table-editable__popper",bodyStyle:{paddingBottom:`${$a[c]+20}px`},onClose:()=>{C()}},N={...u,size:c,multiple:!0,initialValue:(0,te.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=S;re(e);const n=P.current.map((e=>({text:e[t],value:e[r]})));$(n),T(n.map((e=>e.value)));const{closed:a}=u;ee(!1,(()=>ae(E.current))),a?.(P.current)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:l.placeholder||f("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&&g?.({[V]:b},e)},onDoubleClick:()=>{l.disabled||w()},onChange:e=>{const{valueKey:t}=S;re(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:l.disabled,icon:o().createElement(Te.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(Cr,I,o().createElement(gd,N)))}};return o().createElement(o().Fragment,null,X?(()=>{const{type:e}=x,t=ce[e];if(!t)return v("Table","单元格编辑的类型 `type` 配置不正确"),null;const a=["cell--edit",{"is-error":!U}];return o().createElement("div",{ref:E,className:we()(a)},t(n,r),!U&&o().createElement("div",{className:"cell-error"},W||G))})():(()=>{const{disabled:t,extra:r={}}=x,{disabledColor:n,disabledBgColor:a}=r,i=["cell--show",{"is-cell-bg":t&&a}];return o().createElement(o().Fragment,null,o().createElement("span",{className:we()(i),style:{color:t?n:""}},e.children),t&&a&&o().createElement("i",{className:"cell--bg",style:{background:a}}))})(),Y&&o().createElement("i",{className:"cell--sign"}))}));Hc.displayName="CellEdit";const Dc=Hc,$c=require("copy-to-clipboard");var qc=n.n($c);const Mc=function(e){if(!o().isValidElement(e))return null;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o().cloneElement(e,...r)},jc=e=>{const{text:t,options:r,showMessage:n=!0,onCopy:a}=e;return Mc(e.children,{onClick:i=>{const l=o().Children.only(e.children),s=qc()(t,r);a?.(t,s),s&&n&&L.message.success(f("qm.clipboard.success")),l&&l.props&&"function"==typeof l.props.onClick&&l.props.onClick(i)}})};jc.displayName="QmCopyToClipboard";const Kc=jc,Vc=o().forwardRef(((e,t)=>{const{column:r,row:n,rowIndex:a,columnIndex:l,rowKey:s,showTitle:c}=e,{selectionKeys:d,treeExpandIndex:u,updateMark:p,isTreeTable:h}=o().useContext(jl),{dataIndex:m,canCopy:f,render:g,editRender:b,shouldCellUpdate:y}=r,{t:v}=Pc(),{renderText:x,getTitleFromCellNode:E}=Ss(),S=o().useRef(null),w=tn(n,m),[C,T]=function(e,c,d){const u=i.useRef({});return"value"in u.current&&!((e,t)=>{if(y){const[,r]=e,[,a]=t;return y(a,r,n)}return m===os.operationColumn||!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=new Set;return function e(t,a){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n.has(t))return!1;if(t===a)return!0;if(r&&i>1)return!1;n.add(t);const o=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],a[r],o))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const r=Object.keys(t);return r.length===Object.keys(a).length&&r.every((r=>e(t[r],a[r],o)))}return!1}(e,t)}(e,t,!0)})(u.current.condition,c)||(u.current.value=(()=>{const e=g?g(w,n,r,a,l):x(w,r,n);return[e,b?o().createElement(Dc,{ref:t,column:r,record:n,rowKey:s,columnKey:m},e):null]})(),u.current.condition=c),u.current.value}(0,[p,n,w,g,b]);o().useEffect((()=>{if([os.expandableColumn,os.selectionColumn,os.operationColumn].includes(m))return;const e=S.current.parentNode;c?e.title=E(C):e.removeAttribute("title")}),[c,C]);const I=e=>Array.isArray(e.children);return o().createElement("div",{ref:S,className:"cell"},(()=>{if(m===os.expandableColumn)return o().createElement(kc,{record:n,rowKey:s});if(m===os.selectionColumn)return o().createElement(Oc,{selectionKeys:d,column:r,record:n,rowKey:s});if(T)return T;if(h&&m===u)return o().createElement(o().Fragment,null,(e=n._level)?o().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*os.treeTable.textIndent+"px"}}):null,o().createElement(kc,{key:"expand",record:n,rowKey:s,style:I(n)?{}:{visibility:"hidden"}}),C);var e;if(f){const e=E(C);return o().createElement("div",{className:"cell--copy"},o().createElement("span",{className:"text"},C),e&&o().createElement(Kc,{text:e},o().createElement(Te.CopyOutlined,{className:"icon",title:v("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return C})())}));Vc.displayName="Cell";const zc=Vc,Bc={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},Uc={open:!1,offsetX:0,offsetY:0},Wc=o().forwardRef(((e,t)=>{const{tableRef:r,getRowKey:n,flattenColumns:a,mergedTdCells:i,setMergedCells:l}=o().useContext(jl),{areaSelection:s={}}=r.current.props,{elementStore:c,tableFlatData:d}=r.current,{t:u}=Pc(),p=o().useRef(document.onselectstart),h=o().useRef(null),m=o().useRef(null),[f,g]=o().useState(null),[b,y]=o().useState(null),[v,x]=o().useState(null);Nc({ref:h,handler:()=>D()});const E=o().useRef(Bc),S=e=>{E.current=Object.assign({},E.current,e)};o().useEffect((()=>{const e=Qt()(c.$tableBody,"mousedown",k),t=Qt()(c.$tableBody,"contextmenu",P),r=Qt()(document,"keydown",O);return()=>{e.remove(),t.remove(),r.remove()}}),[]);const w=()=>{g(null),y(null),x(null)};o().useImperativeHandle(t,(()=>({blur:w})));const C=()=>c.$tableBody.parentNode,T=e=>{const{offsetLeft:t,offsetTop:r,offsetWidth:n,offsetHeight:a}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:r,w:n,h:a}},I=Ot(((e,t)=>{let r=null;const n=c.$tableBody.querySelectorAll("tbody > tr");for(let a=0;a<n.length;a++){if(n[a].offsetTop>t||n[a].offsetTop+n[a].offsetHeight<t)continue;const i=n[a].querySelectorAll("td");for(let t=0;t<i.length;t++)if(!(i[t].offsetLeft>e||i[t].offsetLeft+i[t].offsetWidth<e)){r=i[t];break}break}r&&y(T(r))}),5),N=Zl((()=>{const e=[];if(!f||!b)return e;const[t,r]=[f.colIndex,b.colIndex],[i,o]=[f.rowKey,b.rowKey];let[l,s]=[0,0];for(let e=0;e<d.length;e++){const t=n(d[e],d[e].index);if(t==i&&(l=e),t==o){s=e;break}}const c=a.slice(Math.min(t,r),Math.max(t,r)+1);return d.slice(l,s+1).forEach((t=>{for(let r=0;r<c.length;r++){const{dataIndex:a}=c[r];e.push({rowKey:n(t,t.index),dataIndex:a,cellValue:tn(t,a)})}})),e})),R=e=>{l(e),s.onCellMerge?.(e),se((()=>w()))},P=Zl((e=>{s.cellMerge&&f&&F(e.clientX,e.clientY)?(e.preventDefault(),H(e)):v?.open&&D()})),O=e=>{27===e.keyCode&&w()},k=Zl((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[r,n]=[c.$tableBody.getBoundingClientRect().top,C().getBoundingClientRect().left],{offsetWidth:a,offsetHeight:i}=C();S({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-n,startOffsetY:e.clientY-r,containerSizeX:a,containerSizeY:i}),document.addEventListener("mousemove",A),document.addEventListener("mouseup",L),p.current=document.onselectstart,document.onselectstart=()=>!1})),A=e=>{const t=e.clientX-E.current.startX,r=e.clientY-E.current.startY,n=E.current.startOffsetX+t,a=E.current.startOffsetY+r;I(Math.min(n,E.current.containerSizeX),Math.min(a,E.current.containerSizeY))},L=()=>{S(Bc),s.onSelectChange?.(N()),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",L),_()},_=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},F=(e,t)=>{const{top:r,left:n}=C().getBoundingClientRect(),[a,i]=[e-n,t-r],{el:o,et:l,ew:s,eh:c}=M();return!(a<o||a>o+s||i<l||i>l+c)},H=e=>{const{top:t,left:r,height:n}=m.current.getBoundingClientRect();x({open:!0,offsetX:e.clientX-r,offsetY:-1*(n-(e.clientY-t))})},D=()=>{x((e=>({...e,open:!1})))},$=()=>{if(!f||!b||(t=b,(e=f).rowKey===t.rowKey&&e.colIndex===t.colIndex))return w();var e,t;const[r,o]=f.t<=b.t?[f.rowKey,b.rowKey]:[b.rowKey,f.rowKey],[l,s]=[f.colIndex,b.colIndex];let[c,u]=[0,0],p=r;for(let e=0;e<d.length;e++){const t=d[e],a=n(t,t.index);if(a==r&&(p=a,c=e),a==o){u=e;break}}const h={rowKey:p,dataIndex:a[Math.min(l,s)].dataIndex,rowSpan:u-c+1,colSpan:Math.abs(s-l+1)};R([...i.filter((e=>!(e.rowKey===h.rowKey&&e.dataIndex===h.dataIndex))),h])},q=()=>{let e=f.rowKey;const t=f.colIndex;for(let t=0;t<d.length;t++){const r=d[t],a=n(r,r.index);if(a==e){e=a;break}}const r=e,o=a[t].dataIndex;R(i.filter((e=>!(e.rowKey===r&&e.dataIndex===o))))},M=()=>{const{w:e,h:t,l:r,t:n}=f;let{w:a,h:i,l:o,t:l}=b;return a=o-r>0?o-r+a:Math.abs(o-r)+e,i=l-n>0?l-n+i:Math.abs(l-n)+t,o=o>r?r:o,l=l>n?n:l,{sl:r,st:n,sw:e,sh:t,el:o,et:l,ew:a,eh:i}},j=Ce("table");return o().createElement("div",{className:`${j}--area-select`},(()=>{if(!f||!b)return null;const{sl:e,st:t,sw:r,sh:n,el:a,et:i,ew:l,eh:s}=M(),{open:c,offsetX:d,offsetY:p}=v||Uc,g=o().createElement("ul",{ref:h,className:"ant-dropdown-menu"},o().createElement("li",{className:"ant-dropdown-menu-item",onClick:$},u("qm.table.areaSelect.mergeCell")),o().createElement("li",{className:"ant-dropdown-menu-item",onClick:q},u("qm.table.areaSelect.cancelMerge")));return o().createElement(o().Fragment,null,o().createElement("div",{className:"active-area",style:{left:e,top:t,width:r,height:n}}),o().createElement(Xa(),{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}}}},o().createElement("div",{ref:m,className:"checked-area",style:{left:a,top:i,width:l,height:s}})))})())}));Wc.displayName="AreaSelect";const Gc=Wc,Yc=o().forwardRef(((e,t)=>{const{tableFlatColumns:r,tableData:n}=e,{getRowKey:a,tableRef:i,flattenColumns:l,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:h,showFooter:m,scrollX:f,scrollY:g,selectionKeys:b,rowExpandedKeys:y,highlightKey:v,isPingLeft:x,isPingRight:E,isTableEmpty:S,isTreeTable:w,isGroupSubtotal:C,isWebPagination:T,setElementStore:I,createTableFullData:N,setSelectionKeysEffect:R,setHighlightKey:P,getStickyLeft:O,getStickyRight:k,scrollXToColumn:A,scrollYToRecord:L,rowInViewport:_,dataChange:F,setPingLeft:H,setPingRight:D,setFullScreen:$,findParentRowKeys:q,getAllChildRowKeys:M,triggerScrollXEvent:j,triggerScrollYEvent:K,scrollBottomDebouncer:V}=o().useContext(jl),{height:z,minHeight:B,maxHeight:U,rowHeight:W,rowSelection:G,rowHighlight:Y,expandable:X,stripe:Q,summation:Z,rowStyle:J,cellStyle:ee,spanMethod:re,tableConfig:ne,areaSelection:ae,nativeScrollBar:le,ellipsis:se,showHeader:ce,rowDraggable:de,onRowClick:ue,onRowDblclick:pe,onRowContextmenu:he,onRowEnter:me}=i.current.props,fe=o().useRef(null),ge=o().useRef({}),be=o().useRef(null),ye=o().useRef(null),ve=o().useRef(null),xe=o().useRef({prevST:0,prevSL:0}),Ee=i.current.scrollXLoad?r:l,Se=o().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=h,i={};return S&&Object.assign(i,{minHeight:"100px"}),B&&Object.assign(i,{minHeight:Jr(B)-e-r+"px"}),U&&Object.assign(i,{maxHeight:Jr(U)-e-r+"px"}),z||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[z,U,B,S,h]),Te=o().useMemo((()=>{const{scrollYStore:e}=i.current,{viewportHeight:t,gutterWidth:r}=h;return Math.floor((f?t-r:t)/e.rowHeight)}),[h,f]),[Ie,Ne]=o().useState([]),Re=Rc();Nc({ref:fe,omitClassNames:[".table-editable__popper"],handler:()=>{Ae([]),ve.current?.blur()}}),o().useImperativeHandle(t,(()=>({setClickedValues:Ae,createFocus:ke,forceUpdate:Re}))),Me((()=>{Ie.length&&i.current.tableManager.focus(i.current.uid)}),[Ie]),o().useLayoutEffect((()=>{Oe();const e=Qt()(document,"keydown",Pe);return()=>e.remove()}),[]);const Pe=Zl((e=>{const{keyCode:t}=e;if(i.current.uid===i.current.tableManager.getFocusInstance()?.id&&(27===t&&(Ae([]),P(""),$(!1)),Ie.length&&(Xe(document.activeElement,fe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===G?.type||Y)){const t=b[0]??v??null,r=n.find((e=>a(e,e.index)===t))??null;r&&me?.(r,e)}if(38===t||40===t){Ve(e);const{allTableData:r}=i.current,o=T?Xr(n):r,l=o.length;let s=o.findIndex((e=>a(e,e.index)===Ie[0]));const c=38===t?(--s+l)%l:++s%l,d=o[c],u=a(d,d.index);"radio"!==G?.type||G.disabled?.(d)||R([u]),Y&&!Y.disabled?.(d)&&P(u),_(c)||(38===t&&L(u,c),40===t&&L(u,Te>c+1?0:c+1-Te)),Ae([u,Ie[1]])}if(9===t){if(Ve(e),!s.length)return Ae([]);const t=s.length;let r=s.findIndex((e=>e.dataIndex===Ie[1]));const n=++r%t,a=s[n].dataIndex;Ae([Ie[0],a]),A(a)}}})),Oe=()=>{I("$tableBody",fe.current),I("$tableXspace",be.current),I("$tableYspace",ye.current)},ke=(e,t)=>{ge.current[`${e}-${t}`]?.focus()},Ae=e=>{(0,te.isEqual)(e,Ie)||Ne(e)},Le=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),_e=(e,t,r)=>{const{disabled:n}=G||{},{deriveRowKeys:a,recordsMap:o}=i.current,l=Yr(a,e);let s=[],c=M(l?.children||[]);return n&&(c=c.filter((e=>!o.has(e)||!n(o.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(bn(a,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Yr(a,e),r=t?.children?.every((e=>s.includes(e.rowKey)));s=r?[...s,e]:s.filter((t=>t!==e))})),s},Fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=[];return e.forEach((e=>{const n=e.index,l=a(e,e.index);if(r.push(He(e,n,l,t)),X?.expandedRowRender){const{expandedRowClassName:t,rowExpandable:a=oe}=X;y.includes(l)&&a(e)&&r.push(o().createElement("tr",{key:`expand_${l}`,className:"body--row-expanded"},o().createElement("td",{colSpan:Ee.length,className:"body--column",style:{paddingLeft:G?2*os.selectionColumnWidth:os.selectionColumnWidth}},o().createElement("div",{className:we()("cell",t)},X.expandedRowRender(e,n)))))}if(!i.current.scrollYLoad&&(e=>Array.isArray(e.children))(e)){const n="function"!=typeof X?.rowExpandable||X.rowExpandable(e);y.includes(l)&&n&&r.push(...Fe(e.children,t+1))}})),r},He=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const{disabled:a}=G||{},i=["body--row",{"body--row-striped":Q&&t%2!=0,"body--row-selected":b.includes(r)&&!a?.(e),"body--row-current":v===r,...C?je(e._group):null}];return o().createElement("tr",{key:r,"data-row-key":r,className:we()(i)},Ee.map(((a,i)=>De(a,i,e,t,r,n))))},De=(e,t,r,n,s,u)=>{const{isIE:h}=i.current,{dataIndex:m,fixed:f,align:g,className:y=""}=e;i.current.scrollXLoad&&(t=l.findIndex((e=>e.dataIndex===m)));const{rowSpan:v,colSpan:x}=$e(r,e,n,t);if(!v||!x)return null;const E=e.ellipsis??se,S=!h&&"left"===f,T=!h&&"right"===f,I=["body--column",{"col--ellipsis":E,"col--center":"center"===g,"col--right":"right"===g,"column--sort":!!p[m],"cell-fix-left":S,"cell-fix-right":T,"cell-fix-left-last":S&&c[c.length-x]?.dataIndex===m,"cell-fix-right-first":T&&d[0]?.dataIndex===m,[y]:!!y}],N=T&&x>1?l.slice(t+1,t+x).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,A=h?null:{left:S?`${O(m)}px`:"",right:T?k(m)-N+"px":""},L=J?"function"==typeof J?J(r,n):J:null,_=ee?"function"==typeof ee?ee(r,e,n,t):ee:null,F=C?qe(r._group):null,H=Object.assign({},A,W?{height:W}:null,F,L,_);return o().createElement("td",{key:m,"data-col-index":t,rowSpan:v>1?v:void 0,colSpan:x>1?x:void 0,className:we()(I),style:H,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([os.expandableColumn,os.operationColumn].includes(n))return;const i=a(t,t.index);Ae([i,n]);const o=r.editRender?.(t,r),l=o&&!o.disabled,{type:s,selectByClickRow:c=!0,disabled:d=ie}=G||{};!s||d(t)||l||(c||n===os.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=G||{};if("radio"===r&&R([e]),"checkbox"===r){const r=!b.includes(e),i=w&&!n?_e(e,b,r):Le(e,b,r);R(i),a?.(r,t,i)}})(i,t),[os.selectionColumn].includes(n)||(!Y||Y.disabled?.(t)||l||P(i),ue?.(t,r,e))})(t,r,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[os.expandableColumn,os.selectionColumn,os.operationColumn].includes(n)||pe?.(t,r,e)})(t,r,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[os.expandableColumn,os.selectionColumn,os.operationColumn].includes(n)||he?.(t,r,e)})(t,r,e)},o().createElement(zc,{ref:e=>ge.current[`${s}-${m}`]=e,row:r,column:e,rowIndex:n,columnIndex:t,rowKey:s,depth:u,showTitle:E}))},$e=(e,t,r,a)=>{let i=1,o=1;if("function"==typeof re){const l=re({row:e,column:t,rowIndex:r,columnIndex:a,tableData:n});if(Array.isArray(l)?(i=l[0],o=l[1]):(0,te.isPlainObject)(l)&&(i=l.rowSpan,o=l.colSpan),e===n[0]&&0===i){i=1;for(let e=1;e<n.length;e++){const{rowSpan:r}=$e(n[e],t,n[e].index,a);if(r>0)break;i++}}}if(u.length>0){const e=u.find((e=>e.row===r&&e.col===a));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}},qe=e=>{const{backgroundColor:t,color:r}=Z.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},je=e=>{const t=Z.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ke=Ce("table");return o().createElement(o().Fragment,null,o().createElement(Ht,{ref:i.current.scrollBarRef,wrapClassName:`${Ke}--body-wrapper`,wrapStyle:Se,native:le,showTopScrollbar:ne?.doubleXScrollbar,onScroll:e=>{const{elementStore:t,scrollXLoad:r,scrollYLoad:n}=i.current,{prevST:a,prevSL:o}=xe.current,l=g?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==o){ce&&(t.$header.scrollLeft=c),m&&(t.$footer.scrollLeft=c);const e=c>0,r=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+l;x!==e&&H(e),E!==r&&D(r)}if(n&&s!==a&&K(s),r&&c!==o&&j(c),g&&s!==a){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-l>=r&&V({type:"scroll",target:e,preventDefault:ie,stopPropagation:ie})}xe.current.prevST=s,xe.current.prevSL=c}},o().createElement("div",{ref:ye,className:"body--y-space"}),o().createElement("div",{ref:be,className:"body--x-space",style:{width:g?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),o().createElement(wc.Provider,{value:Ie},o().createElement("table",{ref:fe,className:`${Ke}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0",style:{width:0}},o().createElement("colgroup",null,Ee.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})}))),de?o().createElement(ga.ReactSortable,{itemKey:e=>a(e,e.index),tag:"tbody",animation:200,list:n,setList:e=>{const t=e.map((e=>a(e,e.index))),r=n.map((e=>a(e,e.index)));if((0,te.isEqual)(t,r))return;const o=xn(e),l=[];i.current.tableFullData.forEach((e=>{n.includes(e)?l.push(o.shift()):l.push(e)})),N(l),F()}},n.map((e=>He(e,e.index,a(e,e.index))))):o().createElement("tbody",null,Fe(n)))),!!ae&&o().createElement(Gc,{ref:ve})))}));Yc.displayName="TableBody";const Xc=Yc,Qc=e=>{const{summationRows:t}=e,{tableRef:r,sorter:n,layout:a,scrollY:i,flattenColumns:l,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=o().useContext(jl),{footRender:h}=r.current.props,m=o().useRef(null);o().useLayoutEffect((()=>{g()}),[]);const g=()=>{d("$footer",m.current)},b=Ce("table"),{tableBodyWidth:y}=a;return o().createElement("div",{ref:m,className:`${b}--footer-wrapper`},h?h(l,r.current.tableFullData):o().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=a;return o().createElement("colgroup",null,l.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),i&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("tfoot",null,(()=>{const{isIE:e}=r.current,d=["gutter",{"cell-fix-right":!!c.length}],h=e?null:{right:c.length?0:""};return t.map(((e,t)=>o().createElement("tr",{key:t,className:"footer--row"},l.map(((t,l)=>((e,t,l)=>{const{isIE:d}=r.current,{gutterWidth:h}=a,{dataIndex:m,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!n[m],"cell-fix-left":!d&&"left"===g,"cell-fix-right":!d&&"right"===g,"cell-fix-left-last":!d&&"left"===g&&s[s.length-1]?.dataIndex===m,"cell-fix-right-first":!d&&"right"===g&&c[0]?.dataIndex===m}],x=d?null:{left:"left"===g?`${u(m)}px`:"",right:"right"===g?`${p(m)+(i?h:0)}px`:""},E=y?.render?y.render(r.current.tableFullData):tn(t,`${m}_text`),S=0===l&&""===E?f("qm.table.config.summaryText"):E;return o().createElement("td",{key:m,title:S,className:we()(v),style:{...x}},o().createElement("div",{className:"cell"},S))})(t,e,l))),i&&o().createElement("td",{className:we()(d),style:{...h}}))))})())))};var Zc=function(e){return e.small="small",e.middle="default",e.large="default",e}(Zc||{});const Jc=e=>{const{current:t,pageSize:r,total:n,onChange:a}=e,{global:i}=o().useContext(c),{tableRef:l,$size:s,setElementStore:d}=o().useContext(jl),{uniqueKey:u,paginationConfig:p,infoBarConfig:h}=l.current.props,m=o().useRef(null),f=o().useMemo((()=>u?`tablePager_${u}`:""),[u]);o().useLayoutEffect((()=>{g(),x()}),[]);const g=()=>{d("$pager",m.current)},b=p?.showSizeChanger??os.pagination.showSizeChanger,y=p?.showQuickJumper??os.pagination.showQuickJumper,v=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||os.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==r&&(a(t,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S=Ce("table"),w={[`${S}-pager`]:!0};return o().createElement("div",{ref:m,className:we()(w)},o().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&o().createElement(bs,{total:n})),o().createElement(L.Pagination,{size:Zc[s],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:t,pageSize:r,total:n,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=i?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},ed=()=>{const{layout:e}=o().useContext(jl),t=o().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),r=Ce("table");return o().createElement("div",{className:`${r}--empty`,style:t},o().createElement(ft,null))},td=()=>{const{setElementStore:e}=o().useContext(jl),t=o().useRef(null);o().useLayoutEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",t.current)},n=Ce("table");return o().createElement("div",{ref:t,className:`${n}--resizable-bar`})};function rd(){return rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rd.apply(this,arguments)}const nd=o().forwardRef(((e,t)=>{const r=((e,t)=>({...e,...Object.keys(t).reduce(((r,n)=>(r[n]=void 0!==t[n]?t[n]:e[n],r)),{})}))(Vl,e),{rowKey:n,columns:a,loading:i,resizable:l,customClass:s,areaSelection:d,tablePrint:u,exportExcel:p,infoBarConfig:h,topSpaceAlign:m,showTableInfo:f,showFullScreen:g,showRefresh:b,showToolBox:y,showHeader:x}=r,{size:E}=o().useContext(c),S=o().useMemo((()=>r.size??E??""),[r.size,E]),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),I=o().useRef(null),N=o().useRef(null),R=Zl(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(v("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),{tableRef:P,tableFullData:O,setElementStore:k,setOriginColumns:A,setTableFullData:L,setTableOriginData:_,setTableFlatData:F,setAllTableData:H,setDeriveRowKeys:D,setInvalidRowKeys:$,setFieldAuth:q,setColumnsDefined:M,setScrollXStore:j,setScrollYStore:K,setScrollXLoad:V,setScrollYLoad:z,setResizeState:B,setHandleState:U,setSummaries:W,setSelectionRows:G,setShouldToTop:Y,setRecordsMap:X,setUnMounted:Q,clearElementStore:Z,clearRecordsMap:J}=((e,t)=>{let{getRowKey:r,$size:n}=t;const{rowHeight:a,dynamicThead:i}=e,l=o().useRef({props:e,uid:ts(),tableManager:ns,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],tableFlatData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!i,scrollBarRef:o().createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:a||os.rowHeightMaps[n]},store:new is,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:!re&&/MSIE|Trident/.test(navigator.userAgent)});(e=>{l.current.props=e})(e);const s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const o=r(e,e.index),l=n?`${n}#${o}`:`${o}`,c=a?`${a}.${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:o,rowKeyPath:l,indexPath:c};return e.indexPath=c,e._level=i,Array.isArray(e.children)&&(d.children=s(e.children,o,l,c,i+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:l,...l.current,setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableFlatData:e=>{l.current.tableFlatData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Xr(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>r(e,e.index)))},setDeriveRowKeys:e=>{const t=l.current.tableFullData.some((e=>Array.isArray(e.children)));l.current.treeTable=t,l.current.deriveRowKeys=t?s(e,""):[],l.current.flattenRowKeys=t?c(l.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setScrollXStore:e=>{l.current.scrollXStore=e},setScrollYStore:e=>{l.current.scrollYStore=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollXLoad:e=>{l.current.scrollXLoad=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.current.recordsMap.clear()}}})(r,{getRowKey:R,$size:S}),{tableData:ee,setTableData:ne,tableFlatColumns:ae,setTableFlatColumns:ie,filters:oe,setFilters:le,sorter:ce,setSorter:de,superFilters:ue,setSuperFilters:he,pagination:me,setPagination:fe,selectionKeys:ge,setSelectionKeys:be,rowExpandedKeys:ye,setRowExpandedKeys:ve,highlightKey:xe,setHighlightKey:Ee,updateMark:Se,forceUpdate:Te,mergedTdCells:Ie,setMergedCells:Ne,layout:Re,setLayout:Pe,permission:Oe,setPermission:ke,spinning:Ae,setSpinning:Le,scrollX:_e,setScrollX:Fe,scrollY:He,setScrollY:De,isPingLeft:$e,setPingLeft:qe,isPingRight:je,setPingRight:Ke,isFullScreen:Ve,setFullScreen:ze,updateTableData:Be}=(e=>{const{uniqueKey:t,nativeScrollBar:r,initialSorter:n={},initialFilter:a={},paginationConfig:i,rowSelection:l,expandable:s,rowHighlight:d,mergedCells:u}=e,{global:p}=o().useContext(c),h={current:i?.current??os.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??i?.pageSize??p?.table?.pagination?.pageSize??os.pagination.pageSize,total:0},m=l?.selectedRowKeys??l?.defaultSelectedRowKeys??[],f=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[g,b]=o().useState([]),[y,v]=o().useState([]),[x,E]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),a),[S,w]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),n),[C,T]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),[]),[I,N]=o().useState(h),[R,P]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),m),[O,k]=o().useReducer(((e,t)=>(0,te.isEqual)(e,t)?e:t),f),[A,L]=o().useState(d?.currentRowKey??""),[_,F]=o().useReducer((e=>e+1),0),[H,D]=ss([],{value:u}),[$,q]=o().useState({gutterWidth:r?ds():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[M,j]=o().useState({export:!0,import:!0,print:!0}),[K,V]=o().useState(!1),[z,B]=o().useState(!1),[U,W]=o().useState(!1),[G,Y]=o().useState(!1),[X,Q]=o().useState(!1),[Z,J]=o().useState(!1);return{tableData:g,setTableData:b,tableFlatColumns:y,setTableFlatColumns:v,filters:x,setFilters:E,sorter:S,setSorter:w,superFilters:C,setSuperFilters:T,pagination:I,setPagination:N,selectionKeys:R,setSelectionKeys:P,rowExpandedKeys:O,setRowExpandedKeys:k,highlightKey:A,setHighlightKey:L,updateMark:_,forceUpdate:F,mergedTdCells:H,setMergedCells:D,layout:$,permission:M,setPermission:j,setLayout:q,spinning:K,setSpinning:V,scrollX:z,setScrollX:B,scrollY:U,setScrollY:W,isPingLeft:G,setPingLeft:Y,isPingRight:X,setPingRight:Q,isFullScreen:Z,setFullScreen:J,updateTableData:()=>b([...g])}})(r),{isFetch:Ue,isWebPagination:We,isScrollPagination:Ge,showPagination:Ye,shouldUpdateHeight:Xe,tableColumns:Qe,flattenColumns:Ze,editableColumns:Je,summationColumns:et,leftFixedColumns:tt,rightFixedColumns:rt,derivedMergeCells:nt,treeExpandIndex:at,showSummary:it,showFooter:ot,isHeadGroup:lt,bordered:st,isHeadSorter:ct,isHeadFilter:dt,isServiceSummation:ut,isSelectCollection:pt,isTableImport:ht,isTableClipboard:mt,isSuperSearch:ft,isFastSearch:gt,isGroupSummary:bt,isGroupSubtotal:yt,isTreeTable:vt,isTableEmpty:Et,summationRows:St,fetchParams:wt}=ps(r,{getRowKey:R,tableRef:P,tableFullData:O,tableData:ee,sorter:ce,filters:oe,superFilters:ue,selectionKeys:ge,pagination:me,mergedTdCells:Ie}),{createElementStore:Ct,tableStyles:Tt,getSpan:It,getStickyLeft:Nt,getStickyRight:Rt,scrollXToColumn:Pt,scrollYToRecord:Ot,rowInViewport:kt,calcTableHeight:At,resetTableScroll:Lt,computeVirtualX:_t,computeVirtualY:Ft,doLayout:Ht}=gs(r,{getRowKey:R,tableRef:P,topElementRef:w,tableElementRef:C,$size:S,tableColumns:Qe,flattenColumns:Ze,leftFixedColumns:tt,derivedMergeCells:nt,layout:Re,scrollX:_e,scrollY:He,showFooter:ot,showPagination:Ye,isFullScreen:Ve,setLayout:Pe,setScrollX:Fe,setScrollY:De,setElementStore:k,setScrollXStore:j,setScrollYStore:K,setShouldToTop:Y}),{initialTable:Dt,checkDataIndex:$t,createTableFullData:qt,getTableData:Mt,handleTableData:jt,createWebPageData:Kt,createTableData:Vt,createGroupData:zt,createSelectionKeys:Bt,createRowExpandedKeys:Ut,setSelectionKeysEffect:Wt,findParentRowKeys:Gt,getAllChildRowKeys:Yt,doFieldValidate:Xt,getTableLog:Qt,dataChange:Zt,tableChange:Jt,toLastPage:er,toFirstPage:tr,getPageCount:rr,pagerChangeHandle:nr,triggerScrollXEvent:ar,triggerScrollYEvent:ir,scrollBottomDebouncer:or,clearTableSorter:lr,clearTableFilter:sr,clearSuperFilters:cr,clearRowSelection:dr,clearRowHighlight:ur,clearTableLog:pr,destroy:hr}=fs(r,{getRowKey:R,tableRef:P,tableElementRef:C,tableBodyRef:T,$size:S,tableColumns:Qe,flattenColumns:Ze,tableFullData:O,pagination:me,layout:Re,filters:oe,sorter:ce,superFilters:ue,fetchParams:wt,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,summationColumns:et,shouldUpdateHeight:Xe,isFetch:Ue,isTreeTable:vt,isWebPagination:We,isScrollPagination:Ge,isServiceSummation:ut,isGroupSubtotal:yt,doLayout:Ht,setTableData:ne,setTableFlatColumns:ie,setTableFullData:L,setTableOriginData:_,setTableFlatData:F,setAllTableData:H,setDeriveRowKeys:D,setPagination:fe,setSpinning:Le,setSorter:de,setFilters:le,setSuperFilters:he,setSelectionKeys:be,setRowExpandedKeys:ve,setHighlightKey:Ee,setSelectionRows:G,setScrollXLoad:V,setScrollYLoad:z,setScrollXStore:j,setScrollYStore:K,computeVirtualX:_t,computeVirtualY:Ft,setFieldAuth:q,setResizeState:B,setSummaries:W,setPermission:ke,setRecordsMap:X,resetTableScroll:Lt,clearElementStore:Z,clearRecordsMap:J});((e,t)=>{const{columns:r,summation:n,rowSelection:a,expandable:i,rowHighlight:l}=e,{tableRef:s,tableBodyRef:c,$size:d,scrollX:u,pagination:p,selectionKeys:h,rowExpandedKeys:m,highlightKey:f,summationRows:g,showSummary:b,isWebPagination:y,isScrollPagination:x,isTreeTable:E,checkDataIndex:S,toLastPage:w,toFirstPage:C,getPageCount:T,setHandleState:I,scrollYToRecord:N,setSelectionKeysEffect:R,setOriginColumns:P,setRowExpandedKeys:O,setHighlightKey:k,setResizeState:A,setPingRight:L,setUnMounted:_,calcTableHeight:F,createSelectionKeys:H,createRowExpandedKeys:D,initialTable:$,destroy:q}=t,M=o().useRef(g);Me((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(h.length?[h[0],""]:[]),h.__prevent__||e?.(h,s.current.selectionRows),delete h.__prevent__}),[h]),Me((()=>{if(!i)return;const{onChange:e}=i;m.__prevent__||e?.(m,m.map((e=>s.current.recordsMap.get(e)))),delete m.__prevent__}),[m]),Me((()=>{E&&O(D()),l&&(c.current.setClickedValues(f?[f,""]:[]),l.onChange?.(f,s.current.recordsMap.get(f)??null))}),[f]),Me((()=>{(0,te.isEqual)(g,M.current)||(M.current=g,b&&n&&n.onChange?.(g))}),[g]),Me((()=>{const e=H(a.selectedRowKeys);(0,te.isEqual)(e,h)||(e.__prevent__=!0,R(e),E&&O(D()))}),[a?.selectedRowKeys]),Me((()=>{const e=D(i.expandedRowKeys);(0,te.isEqual)(e,m)||(e.__prevent__=!0,O(e))}),[i?.expandedRowKeys]),Me((()=>{const{currentRowKey:e}=l;e!==f&&k(e??"")}),[l?.currentRowKey]),Me((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?w():C()),N("","after"===e?1e5:0)),t&&p.current>T()&&w(),(e||t)&&I({insert:null,remove:!1})}),[p.total]),Me((()=>{L(u)}),[u]),Me((()=>{F()}),[d]),Me((()=>{s.current.scrollYLoad&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||v("Table","必须设置组件参数 `ellipsis`")),x&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,x]);const j=Zl((()=>{const{resizeState:e}=s.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(A(Object.assign({},e,{winHeight:r})),F())}));o().useEffect((()=>(P(pe(r)),$(),window.addEventListener("resize",j,!1),S(),se((()=>F())),()=>{q(),window.removeEventListener("resize",j),_(!0)})),[])})(r,{tableRef:P,tableBodyRef:T,$size:S,scrollX:_e,pagination:me,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,showSummary:it,summationRows:St,isWebPagination:We,isScrollPagination:Ge,isTreeTable:vt,checkDataIndex:$t,toLastPage:er,toFirstPage:tr,getPageCount:rr,setHandleState:U,scrollYToRecord:Ot,setOriginColumns:A,setSelectionKeysEffect:Wt,setRowExpandedKeys:ve,setHighlightKey:Ee,setResizeState:B,setPingRight:Ke,setUnMounted:Q,calcTableHeight:At,createSelectionKeys:Bt,createRowExpandedKeys:Ut,initialTable:Dt,destroy:hr});const mr=o().useMemo((()=>({getRowKey:R,tableRef:P,tableBodyRef:T,$size:S,flattenColumns:Ze,editableColumns:Je,leftFixedColumns:tt,rightFixedColumns:rt,treeExpandIndex:at,sorter:ce,filters:oe,superFilters:ue,layout:Re,bordered:st,showFooter:ot,showSummary:it,summationRows:St,scrollX:_e,scrollY:He,pagination:me,fetchParams:wt,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,mergedTdCells:Ie,derivedMergeCells:nt,updateMark:Se,isFetch:Ue,isPingLeft:$e,isPingRight:je,isHeadSorter:ct,isHeadFilter:dt,isFullScreen:Ve,isTableEmpty:Et,isHeadGroup:lt,isTreeTable:vt,isGroupSubtotal:yt,isWebPagination:We,dataChange:Zt,tableChange:Jt,getTableData:Mt,setElementStore:k,createWebPageData:Kt,createTableFullData:qt,updateTableData:Be,setSorter:de,setFilters:le,setSuperFilters:he,setHighlightKey:Ee,setRowExpandedKeys:ve,setSelectionRows:G,setSelectionKeysEffect:Wt,setInvalidRowKeys:$,setMergedCells:Ne,getSpan:It,getStickyLeft:Nt,getStickyRight:Rt,scrollXToColumn:Pt,scrollYToRecord:Ot,rowInViewport:kt,setPagination:fe,setPingLeft:qe,setPingRight:Ke,setSpinning:Le,setFullScreen:ze,setShouldToTop:Y,doFieldValidate:Xt,createTableData:Vt,createGroupData:zt,findParentRowKeys:Gt,getAllChildRowKeys:Yt,triggerScrollXEvent:ar,triggerScrollYEvent:ir,scrollBottomDebouncer:or,resetTableScroll:Lt,clearTableSorter:lr,clearTableFilter:sr,clearSuperFilters:cr,clearRowSelection:dr,clearRowHighlight:ur})),[S,Ze,Je,tt,rt,at,ce,oe,ue,Re,st,ot,it,St,_e,He,me,wt,ge,ye,xe,nt,Se,Ue,$e,je,ct,dt,Ve,Et,lt,vt,yt,We]);((e,t)=>{const{getRowKey:r,tableRef:n,toolBoxRef:a,tableBodyRef:i,columnFilterRef:l,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:b,handleTableData:y,createTableData:x,createTableFullData:E,calcTableHeight:S,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:T,setTableOriginData:I,setHandleState:N,setColumnsDefined:R,setSelectionKeysEffect:P,setRowExpandedKeys:O,setHighlightKey:k,setSelectionRows:A,setOriginColumns:L,forceUpdate:_,getTableLog:F,clearRowSelection:H,clearRowHighlight:D,clearTableSorter:$,clearTableFilter:q,clearSuperFilters:M,clearTableLog:j}=t,{columns:K,columnsChange:V}=n.current.props,z=(e,t,n)=>e.filter((e=>{const a=r(e,e.index);e.children&&(e.children=z(e.children,t,n));const i=t.includes(a);return i&&n?.(e,a),!i}));o().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{S()},DO_REFRESH:async e=>{f&&(await b(),e?.())},GET_LOG:()=>F(),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(),$(),q(),M(),j(),x([]))},CLEAR_LOG:()=>{j()},CREATE_FOCUS:(e,t)=>{i.current.createFocus(e,t)},FORCE_UPDATE:()=>{_()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:(e,t)=>{const r=[...e];t&&(r.__prevent__=!0),P(r)},SET_EXPANDABLE:(e,t)=>{const r=[...e];t&&(r.__prevent__=!0),O(r)},SET_HIGHLIGHT:e=>{k(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),R(!0),l.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Br(K,e);if(!n)return v("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,te.isPlainObject)(t))return v("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return v("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,te.set)(n,e,t[e]);r&&(V?V([...K]):v("Table","需要设置 `columnsChange` 参数"),_())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i}=n.current,o=(Array.isArray(e)?e:[e]).filter((e=>(0,te.isPlainObject)(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[os.expandableColumn,os.selectionColumn,os.operationColumn].includes(r)||rn(e,r,tn(e,r))})),a.addToInserted(e)}));const l="before"===t?.mode,c=void 0===t?.parentRowKey,d=i;if(c)l?d.unshift(...o):d.push(...o);else{const e=yn(i,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?l?e.children.unshift(...o):e.children.push(...o):e.children=o)}c&&N(Object.assign({},n.current.handleState,{insert:l?"before":"after"})),x(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a}=n.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,te.isPlainObject)(e)?r(e,e.index):e));if(!i.length)return;let o=!1;const l=z(a,i,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,o=i?.(e,n);if(!o)return;const{rules:l=[],disabled:s}=o;!s&&l.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),o=!0}));o&&(N(Object.assign({},n.current.handleState,{remove:!0})),E(l),P(p.filter((e=>!i.includes(e)))),i.includes(m)&&D(),O(h.filter((e=>!i.includes(e)))),g(),se((()=>{I(z(n.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{n.current.allTableData.forEach((n=>{c.forEach((a=>{const{dataIndex:i,editRender:o}=a,l=o?.(n,a);if(!l)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:d}=l;!d&&c.length&&T(c,tn(n,i),s,i)}))}));const{required:a,validate:i}=F(),o=[...a,...i];return o.length&&C(o[0].rowKey),_(),{required:a,validate:i}}})))})(t,{getRowKey:R,tableRef:P,toolBoxRef:I,tableBodyRef:T,columnFilterRef:N,flattenColumns:Ze,editableColumns:Je,pagination:me,fetchParams:wt,selectionKeys:ge,rowExpandedKeys:ye,highlightKey:xe,isFetch:Ue,dataChange:Zt,getTableData:Mt,handleTableData:jt,createTableData:Vt,createTableFullData:qt,calcTableHeight:At,scrollXToColumn:Pt,scrollYToRecord:Ot,doFieldValidate:Xt,setTableOriginData:_,setHandleState:U,setColumnsDefined:M,setSelectionKeysEffect:Wt,setRowExpandedKeys:ve,setHighlightKey:Ee,setSelectionRows:G,setOriginColumns:A,forceUpdate:Te,getTableLog:Qt,clearRowSelection:dr,clearRowHighlight:ur,clearTableSorter:lr,clearTableFilter:sr,clearSuperFilters:cr,clearTableLog:pr}),o().useLayoutEffect((()=>{Ct(),P.current.tableManager.register(P.current.uid,t??{current:null})}),[]);const fr=Ce("table"),gr={[`${fr}--wrapper`]:!0,[`${fr}--lg`]:"large"===S,[`${fr}--sm`]:"small"===S,[`${fr}--maximize`]:Ve,[s]:!!s},br={[fr]:!0,"is--border":st,"is--fixed":tt.length||rt.length,"is--sortable":ct,"is--filterable":dt,"is--head-group":lt,"is--area-select":!!d,"is--ping-left":$e,"is--ping-right":je};return o().createElement(jl.Provider,{value:mr},o().createElement("div",{className:we()(gr)},f&&o().createElement("div",{ref:w,className:`${fr}-top`},o().createElement("div",{className:`${fr}-top__space`},"bottom"!==h?.position&&o().createElement(bs,{total:me.total}),o().createElement("div",{className:`${fr}-top__space-slot`,style:{justifyContent:Ql[m]}},r.children)),o().createElement("div",{className:`${fr}-top__actions`},o().createElement(dc,{ref:I,showFullScreen:g,showReload:b&&Ue,showPrint:Oe.print&&!!u,showImport:Oe.import&&ht,showExport:Oe.export&&!!p,showClipboard:mt,showCollection:pt,showFastSearch:gt,showSuperSearch:ft,showGroupSummary:bt,showToolBox:y,tableColumns:Qe}),o().createElement(hc,{ref:N,columns:a}))),o().createElement(xt,{spinning:i??Ae},o().createElement("div",{ref:C,className:we()(br),style:Tt},o().createElement("div",{className:`${fr}--main-wrapper`},x&&o().createElement(Sc,{tableColumns:Qe,sorter:ce,filters:oe}),o().createElement(Xc,{ref:T,tableFlatColumns:ae,tableData:ee}),ot&&o().createElement(Qc,{summationRows:St})),st&&o().createElement("div",{className:`${fr}--border-line`}),Et&&o().createElement(ed,null),l&&o().createElement(td,null))),Ye&&o().createElement(Jc,rd({},me,{onChange:(e,t)=>nr({current:e,pageSize:t})}))))}));nd.displayName="QmTable";const ad=nd,id=ad;function od(){return od=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},od.apply(this,arguments)}const ld=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:l=[],table:s={},className:d,style:u,onClose:p}=e,{size:h}=o().useContext(c),m=o().useMemo((()=>e.size??h??""),[e.size,h]),g=o().useRef(null),b=o().useRef(null),y=o().useRef(null),v=Nt(g),[x,E]=o().useState(s),[S,w]=o().useState(),[C,T]=o().useState(i),[I,N]=o().useState(!1),[R,P]=o().useState(300),[O,k]=o().useState(l),[A,L]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[_,F]=o().useState((0,te.merge)({},s.fetch?.params,n)),[H,D]=o().useState([]),$=()=>{const e=g.current,t=e.querySelector(".form-wrap");P(e.offsetHeight-t.offsetHeight-2*$a[m]-30)},q=Ot($,5);Pt((()=>{q()}),[v.width]),Me((()=>{(0,te.isEqual)(l,O)||k(l)}),[l]),o().useEffect((()=>{M()}),[_]),o().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),o().useEffect((()=>{n&&b.current?.SET_FIELDS_VALUE(n)}),[]);const M=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=oe}=t;if(i(_)){N(!0);try{const e=await n(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,a)??[];r||(T([]),await le(0)),D(t)}}catch(e){}N(!1)}},j=e=>{r||(w(e),p(e))},K=e=>{F(Object.assign({},_,e))},V=Ce("search-helper"),z={[`${V}--wrapper`]:!0},B=x.webPagination?{dataSource:H,loading:I,webPagination:!0}:{fetch:{...x.fetch,params:_}};return o().createElement("div",{ref:g,className:we()(z,d),style:u},o().createElement("div",{className:"form-wrap"},O.length?o().createElement(Qo,{ref:b,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>$(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||K(t)}}):null),o().createElement("div",null,o().createElement(id,od({ref:y,uniqueKey:t,height:R,columns:A,rowKey:x.rowKey||"pageIndex"},B,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{T(e),w(r?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>L(e),onRowDblclick:j,onRowEnter:j}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!S,onClick:()=>p(S,r?C:void 0)},f("qm.dialog.confirm"))))};ld.displayName="SearchHelper";const sd=ld;function cd(){return cd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cd.apply(this,arguments)}const dd=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...dd(e.children)),e.children&&t.push(e.value)})),t},ud=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=ud(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},pd=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&pd(e.children,t),t(e)||e.children&&e.children.length))),hd=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:l=[],table:s={},tree:d={},className:u,style:p,onClose:h}=e,{size:m}=o().useContext(c),g=o().useMemo((()=>e.size??m??""),[e.size,m]),b=o().useRef(null),y=o().useRef(null),x=o().useRef(null),E=Nt(b),[S,w]=o().useState(s),[C,T]=o().useState(),[I,N]=o().useState(i),[R,P]=o().useState(!1),[O,k]=o().useState(300),[A,_]=o().useState(300),[F,H]=o().useState(l),[D,$]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[q,M]=o().useState((0,te.merge)({},s.fetch?.params,n)),[j,K]=o().useState([]),V=()=>{const e=b.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),_(e.offsetHeight-t.offsetHeight-2*$a[g]-30)},z=Ot(V,5);Pt((()=>{z()}),[E.width]),Me((()=>{(0,te.isEqual)(l,F)||H(l)}),[l]),o().useEffect((()=>{B()}),[q]),o().useEffect((()=>{a&&x.current.SET_SELECTION_ROWS(a)}),[a]),o().useEffect((()=>{n&&y.current?.SET_FIELDS_VALUE(n),ne()}),[]);const B=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=oe}=t;if(i(q)){P(!0);try{const e=await n(q);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,a)??[];r||(N([]),await le(0)),K(t)}}catch(e){}P(!1)}},U=e=>{r||(T(e),h(e))},W=e=>{M(Object.assign({},q,e))},[G,Y]=o().useState([]),[X,Q]=o().useState([]),[Z,J]=o().useState(""),ee=o().useRef(G),re=o().useRef([]);Me((()=>{Q(dd(G))}),[G]);const ne=async()=>{if(!d.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=d.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,te.get)(i.data,r)??[],t=$n(e,n,a);Y(t),ee.current=t,re.current=e}}catch(e){}},ae=e=>`${e}|${na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie=Ce("tree-table-helper"),se={[`${ie}--wrapper`]:!0},ce=S.webPagination?{dataSource:j,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:q}};return o().createElement("div",{ref:b,className:we()(se,u),style:p},o().createElement(it,{defaultValue:200,style:{height:"100%"}},o().createElement(it.Pane,{min:100,style:{overflowY:"auto"}},o().createElement(L.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=pd(ee.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==ae(r).indexOf(e)}));J(e),Y(t)})(e.target.value)}),o().createElement(L.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:O,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==ae(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return v("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,r={};for(const n in t)r[n]=(0,te.get)(e,t[n]);W(r)})(ud(re.current,(r=>(0,te.get)(r,t)===e[0]))||{})}})),o().createElement(it.Pane,{className:"split-pane"},o().createElement("div",{className:"form-wrap"},F.length?o().createElement(Qo,{ref:y,items:F,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>H(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||W(t)}}):null),o().createElement("div",null,o().createElement(id,cd({ref:x,uniqueKey:t,height:A,columns:D,rowKey:S.rowKey||"pageIndex"},ce,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:I,onChange:(e,t)=>{N(e),T(r?t:t[0])}},paginationConfig:S.paginationConfig,columnsChange:e=>$(e),onRowDblclick:U,onRowEnter:U}))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[g]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!C,onClick:()=>h(C,r?I:void 0)},f("qm.dialog.confirm"))))};hd.displayName="TreeTableHelper";const md=hd,fd=e=>{const{multiple:t,tree:r={},defaultSelectedKeys:n,className:a,style:i,onClose:l}=e,{size:s}=o().useContext(c),d=o().useMemo((()=>e.size??s??""),[e.size,s]),[u,p]=o().useState(),[h]=o().useState(r.fetch?.params),m=Ce("tree-helper"),g={[`${m}--wrapper`]:!0},b=r.fetch?{...ue(r.fetch,["params","valueKey","textKey"]),params:h}:void 0;return o().createElement("div",{className:we()(g,a),style:i},o().createElement(Ml,{multiple:t,fetch:b,fieldsDefine:{valueKey:r.fetch?.valueKey,textKey:r.fetch?.textKey},asyncLoad:r.asyncLoad,checkStrictly:r.checkStrictly,checkStrategy:r.checkStrategy,defaultSelectedKeys:n,defaultExpandAll:r.defaultExpandAll,onSelectChange:e=>p(e),onCheckChange:e=>p(e)}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>l(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!u,onClick:()=>l(u)},f("qm.dialog.confirm"))))};fd.displayName="TreeHelper";const gd=fd;function bd(){return bd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bd.apply(this,arguments)}const yd="_startSign",vd="_endSign",xd=e=>{const{uniqueKey:t,initialValue:r,filters:n=[],table:a={},onClose:i}=e,{size:l}=o().useContext(c),s=o().useMemo((()=>e.size??l??""),[e.size,l]),d=o().useRef(null),u=o().useRef(null),p=o().useRef(null),h=Nt(d),[m,g]=o().useState(a),[b,y]=o().useState(!1),[v,x]=o().useState([]),[E,S]=o().useState(300),[w,C]=o().useState(n),[T,I]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},{title:f("qm.form.rangeSearchHelper")[0],dataIndex:yd,width:80,align:"right",render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:f("qm.form.rangeSearchHelper")[1],dataIndex:vd,fixed:"right",width:80,render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)}]),[N,R]=o().useState((0,te.merge)({},a.fetch?.params,r)),[P,O]=o().useState([]),k=o().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),A=o().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),_=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*$a[s]-30)},F=Ot(_,5);Pt((()=>{F()}),[h.width]),Me((()=>{(0,te.isEqual)(n,w)||C(n)}),[n]),o().useEffect((()=>{H()}),[N]);const H=async()=>{const{webPagination:e,fetch:t}=m;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=oe}=t;if(a(N)){y(!0);try{const e=await r(N);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,te.get)(e.data,n)??[];O(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},$=()=>{v.forEach((e=>{e&&(D(e,yd),D(e,vd))})),x([])},q=e=>{$(),R(Object.assign({},N,e))},M=Ce("range-helper"),j=m.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...m.fetch,params:N}};return o().createElement("div",{ref:d,className:`${M}--wrapper`},o().createElement("div",{className:"form-wrap"},w.length?o().createElement(Qo,{ref:u,items:w,initialValues:r,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>_(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||q(t)}}):null),o().createElement("div",null,o().createElement(id,bd({ref:p,height:E,columns:T,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>I(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[yd,vd].includes(r)&&(r===yd&&(e[r]?(D(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?L.message.warning(f("qm.searchHelper.rangeStartTip")):(v[0]&&D(v[0],r),e[r]="[",x([e,v[1]]))),r===vd&&(e[r]?(D(e,r),x([v[0],void 0])):e.pageIndex<k[0]?L.message.warning(f("qm.searchHelper.rangeEndTip")):(v[1]&&D(v[1],r),e[r]="]",x([v[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[yd]="["),e.pageIndex===k[1]&&(e[vd]="]")}))}}),o().createElement(be,{type:"primary",icon:o().createElement(Te.ClearOutlined,null),title:f("qm.table.alert.clear"),onClick:()=>$()}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${$a[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(be,{onClick:()=>i(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(be,{type:"primary",disabled:!A,onClick:()=>i(v.map((e=>(e=>{const t={};for(const r in e)[yd,vd].includes(r)||(t[r]=e[r]);return t})(e))))},f("qm.dialog.confirm"))))};xd.displayName="RangeTableHelper";const Ed=xd,Sd=e=>null!=e;function wd(e,t,r,n){const[a,i]=o().useState(void 0);o().useLayoutEffect((()=>{const t="function"==typeof e?e():e;i(t||null)}));const[l,s]=o().useState(null),c=Zl((()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:o}=e.getBoundingClientRect();return n>=0&&o>=0&&a<=t&&i<=r})(a)&&t&&a.scrollIntoView(n);const{left:e,top:r,width:i,height:o}=a.getBoundingClientRect(),l={left:e,top:r,width:i,height:o,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(l)?l:e))}else s(null)}));return o().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[a,t,c]),[o().useMemo((()=>{if(!l)return l;const e=r?.offset||6,t=r?.radius||2;return{left:l.left-e,top:l.top-e,width:l.width+2*e,height:l.height+2*e,radius:t}}),[l,r]),a]}const Cd={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"]}},Td={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"]}},Id=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Nd(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:o}=e,l=t/2,s={};return Object.keys(Cd).forEach((e=>{const c={...n&&Td[e]||Cd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Id.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-l-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=l+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-l-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=l+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":c.offset[1]=-d.arrowOffsetHorizontal-l;break;case"leftBottom":case"rightBottom":c.offset[1]=d.arrowOffsetHorizontal+l}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+r,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+r,i.shiftX=!0,i.adjustX=!0}const o={...i,...a};return o.shiftX||(o.adjustX=!0),o.shiftY||(o.adjustY=!0),o}(e,d,t,r),o&&(c.htmlRegion="visibleFirst")})),s}const Rd=require("@rc-component/portal");var Pd=n.n(Rd);const Od=require("@rc-component/trigger");var kd=n.n(Od);function Ad(){return Ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ad.apply(this,arguments)}const Ld={fill:"transparent",pointerEvents:"auto"},_d=e=>{const{prefixCls:t,rootClassName:r,pos:n,showMask:a,style:i={},fill:l="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${ts()}`,p="object"==typeof c?c?.placeholder:c;return o().createElement(Pd(),{open:s,autoLock:!0},o().createElement("div",{className:we()(`${t}-mask`,r),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...i}},a?o().createElement("svg",{style:{width:"100%",height:"100%"}},o().createElement("defs",null,o().createElement("mask",{id:u},o().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),n&&o().createElement("rect",{x:n.left,y:n.top,rx:n.radius,width:n.width,height:n.height,fill:"black",className:p?`${t}-placeholder-animated`:""}))),o().createElement("rect",Ad({},n?null:Ld,{x:"0",y:"0",width:"100%",height:"100%",fill:l,mask:`url(#${u})`})),n&&o().createElement(o().Fragment,null,o().createElement("rect",Ad({},Ld,{x:"0",y:"0",width:"100%",height:`${n.top}px`})),o().createElement("rect",Ad({},Ld,{x:"0",y:"0",width:n.left,height:"100%"})),o().createElement("rect",Ad({},Ld,{x:"0",y:n.top+n.height,width:"100%",height:`calc(100vh - ${n.top+n.height}px)`})),o().createElement("rect",Ad({},Ld,{x:n.left+n.width,y:"0",width:`calc(100vw - ${n.left+n.width}px)`,height:"100%"})))):null))},Fd=e=>{const{prefixCls:t,zIndex:r,open:n,onPause:a,onPlay:i}=e,[l,s]=ss(void 0,{value:n,postState:e=>e??!0}),c=o().useRef(null),d=o().useRef(!1),u=Zl((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));o().useEffect((()=>{const e=Qt()(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!l),l?a?.():i?.())};return o().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,o=e.clientX-Ge(t).x,l=e.clientY-Ge(t).y;return document.onmousemove=e=>{let s=e.clientX-o,c=e.clientY-l;s<0&&(s=0),s>a-r-1&&(s=a-r-1),c<0&&(c=0),c>i-n-1&&(c=i-n-1),Be(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},l?o().createElement(Te.PauseOutlined,null):o().createElement(Te.CaretRightOutlined,null))},Hd=e=>{const{prefixCls:t,current:r,total:n=0,cover:a,title:i,description:l,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:b}=Pc(),y="primary"!==c?"primary":"default",v=Zl((e=>{w(e),40===e.keyCode&&(r<n-1?h?.():m?.()),38===e.keyCode&&r>0&&p?.()}));o().useEffect((()=>{const e=Qt()(document,"keyup",v);return()=>e.remove()}),[]);const x=Sd(a)?o().createElement("div",{className:`${t}-cover`},a):null,E=Sd(l)?o().createElement("div",{className:`${t}-description`},l):null;let S;S=g?g(r,n):[...Array.from({length:n}).keys()].map(((e,n)=>o().createElement("span",{key:e,className:we()(n===r&&`${t}-indicator-active`,`${t}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return o().createElement("div",{className:we()(`${t}-content`,f)},o().createElement("div",{className:`${t}-inner`},o().createElement(Te.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},o().createElement(Te.QuestionCircleOutlined,{className:we()(`${t}-close`,"help-icon")})),x,o().createElement("div",{className:`${t}-header`},o().createElement("div",{className:`${t}-title`},i)),E,o().createElement("div",{className:`${t}-footer`},n>1&&o().createElement("div",{className:`${t}-indicators`},S),o().createElement(Ee,{className:`${t}-buttons`},0!==r?o().createElement(be,{className:`${t}-prev-btn`,size:"small",onMouseDown:w,onClick:p},b("qm.tour.prevStep")):null,r===n-1?o().createElement(be,{className:`${t}-finish-btn`,type:y,size:"small",onClick:m},b("qm.tour.finish")):o().createElement(be,{className:`${t}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},b("qm.tour.nextStep"))))))},Dd=e=>{const{current:t,renderPanel:r}=e;return o().createElement(o().Fragment,null,"function"==typeof r?r(e,t):o().createElement(Hd,e))};function $d(){return $d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$d.apply(this,arguments)}const qd={left:"50%",top:"50%",width:1,height:1},Md=o().forwardRef(((e,t)=>{const{steps:r=[],defaultCurrent:n,current:a,onChange:i,onClose:l,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:v,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0,...C}=e,T=o().useRef(),[I,N]=ss(0,{value:a,defaultValue:n}),[R,P]=ss(void 0,{value:c,postState:e=>!(I<0||I>=r.length)&&(e??!1)}),[O,k]=ss(1051,{value:y,defaultValue:y}),[A,L]=o().useState(),_=o().useRef(R);o().useLayoutEffect((()=>{R&&!_.current&&N(0),_.current=R,L(R)}),[R]),o().useImperativeHandle(t,(()=>({OPEN:()=>P(!0),CLOSE:()=>P(!1),SET_ZINDEX:e=>k(e)})));const{target:F,type:H,placement:D,trigger:$,delay:q,style:M,arrow:j,className:K,mask:V,scrollIntoViewOptions:z,zIndex:B,action:U}=r[I]||{},W=B||O,G=H||d,Y=R&&(V??u),X=z??w,[Q,Z]=wd(F,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,D),ee=!!Z&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;o().useLayoutEffect((()=>{T.current?.forceAlign()}),[te,I]),Me((()=>{R&&(ae(),U?.(Z,I))}),[R,Z]);const re=e=>{N(e),i?.(e)},ne=()=>{P(!1),l?.(I)},ae=()=>{if(!Z)return;const e=[];!function t(r){if(1===r.nodeType){var n;"INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName||"none"===ze(n=r,"display")||"hidden"===ze(n,"visibility")||"0"===ze(n,"opacity")||e.push(r);for(const e of Array.from(r.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const ie=async()=>{if(!$||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[a,i]=[e+r/2,t+n/2],o=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),l=document.elementFromPoint(a,i);l&&(l.dispatchEvent(o),await le(q??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=Ce("tour"),ue=[{[`${de}-primary`]:"primary"===G},m,K],pe=Nd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(_d,{zIndex:W,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:A,animated:S,rootClassName:m}),o().createElement(Pd(),{open:A,autoLock:!0},o().createElement(kd(),$d({ref:T},C,{zIndex:W,builtinPlacements:pe,popupStyle:ce,popupPlacement:J,popupVisible:A,popupClassName:we()(ue),prefixCls:de,popup:()=>o().createElement(Dd,$d({key:"content",arrow:ee,prefixCls:de,total:r.length,helper:b,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await ie(),re(I-1)},onNext:async()=>{await ie(),re(I+1)},onClose:ne,current:I,onFinish:()=>{ne(),s?.()}},Object.assign({},r[I],{zIndex:W,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),o().createElement("div",{className:we()(m,`${de}-target-placeholder`),style:{...Q||qd,position:"fixed",pointerEvents:"none"}}))),h&&o().createElement(Pd(),{open:R},o().createElement(Fd,{zIndex:W,prefixCls:de,onPause:()=>L(!1),onPlay:()=>L(!0)})))}));Md.displayName="QmTour";const jd=Md,Kd=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Vd=e=>({_s:e,status:Kd[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),zd=e=>e?6:5,Bd=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Vd(e);t(i),r.current=i,a?.({current:i})},Ud=e=>{const{name:t,in:r,timeout:n,preEnter:a=!0,preExit:l}=e,[s,c]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:t=!0,exit:r=!0,preEnter:n,preExit:a,timeout:o,initialEntered:l,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,p]=(0,i.useState)((()=>Vd(l?2:zd(s)))),h=(0,i.useRef)(u),m=(0,i.useRef)(),[f,g]=(e=>(0,te.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(o),b=(0,i.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return zd(t)}})(h.current._s,c);e&&Bd(e,p,h,m,d)}),[d,c]),y=(0,i.useCallback)((e=>{const i=e=>{switch(Bd(e,p,h,m,d),e){case 1:f>=0&&(m.current=setTimeout(b,f));break;case 4:g>=0&&(m.current=setTimeout(b,g));break;case 0:case 3:m.current=setTimeout((()=>i(e+1)),0)}},o=h.current.isEnter;"boolean"!=typeof e&&(e=!o),e?!o&&i(t?n?0:1:2):o&&i(r?a?3:4:zd(c))}),[b,d,t,r,n,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(m.current)),[]),[u,y,b]}({timeout:n,preEnter:a,preExit:l,initialEntered:r});return Pt((()=>{c()}),[r]),o().createElement(o().Fragment,null,o().Children.map(e.children,(e=>o().isValidElement(e)?Mc(e,{className:we()(e.props.className,t,s.status)}):e)))},Wd={previewWidth:1100,defaultDistance:.45,logoHeight:60},Gd=(0,i.createContext)(void 0);var Yd=null;function Xd(){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),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){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 Qd(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Xd()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void L.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:Yd?r=Yd:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),Yd=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Xd(),r}catch(e){L.message.error("getLodop 出错:"+e)}}Xd();const Zd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},Jd=o().forwardRef(((e,t)=>{const{templateRender:r,directPrint:n}=e,{global:a}=o().useContext(c),{$$preview:i}=o().useContext(Gd),{state:l,isWindowsPrinter:s,pageSize:d}=i,u=o().useRef(null),p=o().useRef({}),h=o().useRef([]),m=o().useRef([]),f=o().useRef([]),[g,b]=o().useState(!0);o().useImperativeHandle(t,(()=>({createPreviewDom:k,createExportHtml:L,createPrintHtml:A,SHOW_PREVIEW:_,DIRECT_PRINT:F}))),Me((()=>{O()}),[l.form.printerType,l.form.setting.direction,l.form.setting.distance,l.form.setting.fixedLogo]),o().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const y=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Wd.defaultDistance+10*Wd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[l,s,d]),x=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Wd.defaultDistance+10*Wd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[l,s,d]),E=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Zd(y-10*(e.left-Wd.defaultDistance)-10*(e.right-Wd.defaultDistance))}),[l,y]),S=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Zd(x-10*(e.top-Wd.defaultDistance)-10*(e.bottom-Wd.defaultDistance))}),[l,x]),w=l.form.scale,C=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return{left:Zd(10*e.left),right:Zd(10*e.right),top:Zd(10*e.top),bottom:Zd(10*e.bottom)}}),[l]),T=o().useMemo((()=>{const{form:{printerType:e}}=l,{left:t,right:r,top:n,bottom:a}=C,i=E+t+r,o=Wd.previewWidth-i<=0?0:(Wd.previewWidth-i)/2,s=Math.abs((1-w)*i/2);let c=0;return w>1&&(c=s>o?-1*o:-1*s),w<1&&(c=i-2*s>Wd.previewWidth?0:o>0?s:(Wd.previewWidth-(i-2*s))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[l,g,C,w,S,E]),I=(h.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=a?.print?.leftLogo??"",t=a?.print?.rightLogo??"";return[`<tr style="height: ${Wd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),N=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},P=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}m.current=r,h.current=t},O=()=>{if(!h.current.length)return;const{form:{setting:e,printerType:t}}=l;if(n)return f.current.push([N(),I(),...h.current]);const r=e.fixedLogo?S-Wd.logoHeight:S;let a=[];if(f.current=[],"stylus"===t)f.current.push([N(),...e.fixedLogo?[I()]:[],...h.current]);else{let t=0;for(let n=0,i=m.current.length;n<i;n++){const o=h.current[n],l=m.current[n];e.fixedLogo||0!==n||(t+=Wd.logoHeight),t+=l,t<=r?a.push(o):(f.current.push([N(),...e.fixedLogo?[I()]:[],...a]),a=[],t=0,n-=1),n===i-1&&a.length&&f.current.push([N(),...e.fixedLogo?[I()]:[],...a])}}e.fixedLogo||f.current[0]?.splice(1,0,I());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');i.setState({currentPage:1,totalPage:f.current.length}),k()},k=()=>{const{currentPage:e}=l;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},A=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<h.current.length;t++)e[t]=h.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+I()+N()+e.join("")+"</table>"},_=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return H();p.current.previewEl.innerHTML||(R(),await le(0),P(),O(),b(!1))},F=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return H();R(),await le(0),P(),O(),b(!1),i.doPrint(A()),await le(0),i.doClose()},H=()=>{v("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=Ce("print-container"),$={[D]:!0,"no-visible":n};return o().createElement("div",{ref:u,className:we()($)},o().createElement(xt,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},o().createElement("div",{className:"preview"},o().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},r?.()),o().createElement("div",{className:"workspace",style:T}))))}));Jd.displayName="Container";const eu=Jd;function tu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ru extends i.Component{constructor(){super(...arguments),tu(this,"context",void 0),tu(this,"formRef",o().createRef()),tu(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:f("qm.print.setPanel.printParameter")},{type:"SELECT",label:f("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:f("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:f("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:f("qm.print.setPanel.vertical"),value:"vertical"},{text:f("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:f("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:f("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:f("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:f("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Wd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]}])),tu(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})})),tu(this,"getInitialExtra",(()=>({disleft:f("qm.print.setPanel.sizeUnit"),disright:f("qm.print.setPanel.sizeUnit"),distop:f("qm.print.setPanel.sizeUnit"),disbottom:f("qm.print.setPanel.sizeUnit")}))),tu(this,"state",{formList:this.createFormList()}),tu(this,"confirmHandle",(async()=>{const[e,t]=await 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())})),tu(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return o().createElement(o().Fragment,null,o().createElement(Qo,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(be,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},f("qm.dialog.close")),o().createElement(be,{type:"primary",onClick:()=>this.confirmHandle()},f("qm.dialog.confirm"))))}}tu(ru,"contextType",c);const nu=ru;function au(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class iu extends i.Component{constructor(){super(...arguments),au(this,"context",void 0),au(this,"provide",{$$preview:this}),au(this,"containRef",o().createRef()),au(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Wd.defaultDistance,right:Wd.defaultDistance,top:Wd.defaultDistance,bottom:Wd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),au(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),au(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),au(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await Qs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),au(this,"doClose",(()=>{this.props.onClose?.()})),au(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),au(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),au(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 ')),au(this,"doPrint",(e=>{const t=Qd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:o,copies:l}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Wd,{left:d,right:u,top:p,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(l),a.doubleSide&&("auto"===a.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"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.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?n&&this.doClose():L.message.error(f("qm.print.printError"))},t.PRINT()})),au(this,"doExport",(e=>{const t=Qd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():L.message.error(f("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${u()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:f("qm.print.laserPrinter"),value:"laser"},{text:f("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Qd(),t=[{text:f("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){v("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}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await Qs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,te.isPlainObject)(e)&&await Qs().setItem(this.printerKey,e)),(0,te.isPlainObject)(e)&&Object.keys(e).length&&(0,te.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:r,form:n,currentPage:a,totalPage:i,printPage:l}=this.state,s=Ce("print-preview"),c={visible:r,title:f("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?o().createElement(o().Fragment,null,o().createElement("div",{className:we()(d)},o().createElement("div",{className:"outer"},o().createElement("div",{className:"header"},o().createElement("span",null,f("qm.print.printer"),":",o().createElement(L.Select,{value:n.printerName,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.type"),":",o().createElement(L.Select,{value:n.printerType,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.copies"),":",o().createElement(L.InputNumber,{value:n.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),o().createElement("span",null,f("qm.print.printPage.0"),o().createElement(L.InputNumber,{value:l,min:1,max:i,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),f("qm.print.printPage.1")),o().createElement("span",null,o().createElement(L.Pagination,{size:"small",current:a,pageSize:1,total:i,onChange:this.pageChangeHandle})),o().createElement("span",null,o().createElement(be,{type:"text",icon:o().createElement(Te.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},f("qm.print.setting"))),o().createElement("span",null,o().createElement(be,{type:"text",icon:o().createElement(Te.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},f("qm.print.export"))),o().createElement("span",null,o().createElement(be,{icon:o().createElement(Te.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},f("qm.print.print")))),o().createElement("div",{className:"main"},o().createElement(Gd.Provider,{value:this.provide},o().createElement(eu,{ref:this.containRef,templateRender:t,directPrint:!1}))),o().createElement("div",{className:"footer"},o().createElement("span",null,f("qm.print.scale"),":",o().createElement(L.Slider,{value:n.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{scale:e}})))}}),o().createElement("em",{className:"scale-text"},`${Math.floor(100*n.scale)}%`)),o().createElement("span",null,f("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),o().createElement("span",null,f("qm.print.pageNumber"),":",f("qm.print.pagination",{currentPage:a,totalPage:i}))))),o().createElement(Cr,c,o().createElement(nu,{setting:n.setting,onChange:e=>{this.setState((t=>(0,te.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):o().createElement(Gd.Provider,{value:this.provide},o().createElement(eu,{ref:this.containRef,templateRender:t,directPrint:!0}))}}au(iu,"contextType",c);const ou=iu;function lu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class su extends i.Component{constructor(){super(...arguments),lu(this,"context",void 0),lu(this,"previewRef",o().createRef()),lu(this,"state",{visible:!1,loading:!1}),lu(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),lu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i}=this.props,l={visible:e,title:f("qm.print.preview"),width:`${Wd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?o().createElement(Cr,l,o().createElement(ou,s)):e?o().createElement(ou,s):null})),lu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await le(0),this.setState({visible:!0}),await le(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:r,type:n,disabled:a,shape:i}=this.props,l={size:t||this.context.size||"",type:n,shape:i,icon:r,loading:e,disabled:a,click:this.clickHandle};return o().createElement(o().Fragment,null,this.props.children&&o().createElement(be,l,this.props.children),this.createRender())}}lu(su,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:s().elementType}),lu(su,"defaultProps",{preview:!0,type:"primary",icon:o().createElement(Te.PrinterOutlined,null)}),lu(su,"contextType",c);const cu=su;function du(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function uu(e){const t=du(e);return t?t.frameElement:null}function pu(e){const t=fu(e);return hu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function hu(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 mu(e,t){const r=uu(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=pu(a);if(n.push(e),a=uu(a),i)break;a&&du(a)===t&&(i=!0)}return hu(n)}return e.getBoundingClientRect()}function fu(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)}}function gu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bu=Object.assign;class yu{constructor(e,t){gu(this,"node",void 0),gu(this,"border",void 0),gu(this,"padding",void 0),gu(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=Su.border,this.padding.style.borderColor=Su.padding,this.content.style.backgroundColor=Su.background,bu(this.node.style,{borderColor:Su.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){Eu(t,"margin",this.node),Eu(t,"border",this.border),Eu(t,"padding",this.padding),bu(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"}),bu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class vu{constructor(e,t){gu(this,"tip",void 0),gu(this,"nameSpan",void 0),gu(this,"dimSpan",void 0),this.tip=e.createElement("div"),bu(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),bu(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),bu(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,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let o=e.left+5;return e.left<t.left&&(o=t.left+5),e.left+a>t.left+t.width&&(o=t.left+t.width-a-5),i+="px",o+="px",{style:{top:i,left:o}}}(e,t,{width:r.width,height:r.height});bu(this.tip.style,n.style)}}class xu{constructor(){gu(this,"window",void 0),gu(this,"tipBoundsWindow",void 0),gu(this,"container",void 0),gu(this,"tip",void 0),gu(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new vu(r,this.container),this.rects=[],r.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 r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new yu(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=mu(e,this.window),a=fu(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=mu(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Eu(e,t,r){bu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const Su={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 wu=null,Cu=null;function Tu(){null!=window.document&&(wu=null,null!==Cu&&(Cu.remove(),Cu=null))}function Iu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nu{constructor(e){Iu(this,"_isRunning",void 0),Iu(this,"_selectIgnore",void 0),Iu(this,"_lastHoveredNode",null),Iu(this,"excludeSelectors",void 0),Iu(this,"onSelect",void 0),Iu(this,"iframesListeningTo",new Set),Iu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Iu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Iu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Iu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Xe(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Tu();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 r;r=[t],null,!1,null!=window.document?(null!==wu&&clearTimeout(wu),null!=r&&(null===Cu&&(Cu=new xu),Cu.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),Iu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Iu(this,"selectFiberForNode",(0,te.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else r.getAttribute("name")?e+=`[name=${r.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.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(){Tu(),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 Ru(e){return document.querySelector(e)}const Pu=e=>{const{action:t,onConfirm:r,onCancel:n,onFinish:a}=e,{t:i}=Pc();return o().createElement(o().Fragment,null,o().createElement("div",{style:{height:100}},i("qm.table.config.emptyText")),o().createElement(Ee,{style:{width:"100%",justifyContent:"flex-end"}},o().createElement(be,{size:"small",onClick:()=>n?.()},i("qm.guideTracker.closeButton")),o().createElement(be,{size:"small",onClick:()=>r?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),o().createElement(be,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Ou={left:"50%",top:"50%",width:1,height:1},ku=o().forwardRef(((e,t)=>{const{open:r,current:n,defaultCurrent:a,steps:i=[],placement:l="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:v}=e,{t:x}=Pc(),E=o().useRef(),S=o().useRef(i.length),[w,C]=ss(0,{value:n,defaultValue:a}),[T,I]=ss(void 0,{value:r,postState:e=>e??!1}),[N,R]=ss(1051,{value:h,defaultValue:h}),[P,O]=o().useState({}),[k,A]=o().useState(!1),[_,F]=o().useState(T),[H,D]=o().useState(!1),[$,q]=wd(P.node,!!r),[M,j]=o().useState(22),K=o().useRef(!1),V=o().useMemo((()=>w>=i.length?"add":"edit"),[w,i]),z=o().useMemo((()=>`${w+1} / ${i.length}`),[w,i]);o().useLayoutEffect((()=>{E.current=new Nu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),O({id:dn(),node:e,path:t}),C(S.current),A(!0),U(),g?.(t,e)}})}),[]),o().useEffect((()=>(T?B():U(),T?setTimeout((()=>F(!0)),16):F(!1),()=>{U()})),[T]),o().useEffect((()=>{S.current=i.length}),[i]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},W=e=>{e.stopPropagation(),e.preventDefault()};o().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:w,selector:P.path})})));const G=Ce("guide-tracker"),Y=[{[`${G}-primary`]:!0}],X=Nd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(Pd(),{open:T&&k,autoLock:!0},o().createElement(kd(),{zIndex:N,builtinPlacements:X,popupPlacement:l,popupVisible:T&&k,popupClassName:we()(Y,c),popupStyle:d,prefixCls:G,popup:()=>{const e=()=>{A(!1),B()};return o().createElement("div",{className:`${G}-content`},o().createElement("div",{className:`${G}-inner`},o().createElement(Te.CloseOutlined,{className:`${G}-close`,onClick:()=>{y?.(w),e()}}),o().createElement(L.Dropdown,{open:H,trigger:["click"],dropdownRender:()=>i.length?o().createElement("div",{className:"ant-dropdown-menu step-list"},o().createElement(ga.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),r=i.map((e=>e.id));if((0,te.isEqual)(t,r))return;const n=t.findIndex((e=>e===P.id)),a=-1!==n?n:w;C(a),b?.(xn(e),a)}},i.map(((e,t)=>o().createElement("li",{key:t,className:we()("item",{actived:e.id===P.id})},o().createElement(Te.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),o().createElement("span",{className:"box"},o().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==w&&(O({id:e.id,node:Ru(e.selector),path:e.selector}),C(t),j(22===M?M+1:M-1),b?.(i,t))}},e.title),o().createElement(L.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:N+1,onConfirm:()=>{const r=i.filter((t=>t.id!==e.id)),n=t===w;let a=t<=w?w-1:w;if(a=a<0?0:a,a=a>r.length?r.length:a,n&&r[a]){const{id:e,selector:t}=r[a];O({id:e,node:Ru(t),path:t})}C(a),b?.(r,a)}},o().createElement(Te.CloseOutlined,{className:"close-icon"})))))))):o().createElement(o().Fragment,null),overlayClassName:`${G}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:N},onOpenChange:e=>D(e)},o().createElement(Te.MenuOutlined,{className:we()(`${G}-close`,"menu-icon"),style:{width:M}})),m.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:N},content:m.content,title:m.title},o().createElement(Te.QuestionCircleOutlined,{className:we()(`${G}-close`,"help-icon")})),o().createElement("div",{className:"panel-label"},o().createElement("span",{className:"title"},x("qm.guideTracker.label")),o().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),z)),p?p({id:P.id,selector:P.path,actionStatus:V,DO_CLOSE:e},w):o().createElement(Pu,{action:V,onConfirm:()=>{b?.("add"===V?[...i,{id:P.id,selector:P.path,title:"Guide Title"}]:[...i],w),e()},onCancel:()=>{y?.(w),e()},onFinish:()=>{e(),y?.(w),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},o().createElement("div",{className:we()(`${G}-target-placeholder`),style:{...$||Ou,position:"fixed",zIndex:N-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:W,onClick:W}))),s&&o().createElement(Pd(),{open:_},o().createElement(Fd,{zIndex:N,prefixCls:G,onPause:()=>{K.current=k,A(!1),U()},onPlay:()=>{K.current?A(!0):B()}})))}));ku.displayName="QmGuideTracker";const Au=ku,Lu=e=>{const{content:t,image:r,width:n,height:a,font:l={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:h=!0,grayscale:m,className:f,style:g}=e,b=o().useRef(null),y=o().useRef(new Map),v=l.fontSize??16,x=l.fontWeight??"normal",E=l.fontStyle??"normal",S=l.fontFamily??"sans-serif",w=l.color??"rgba(0, 0, 0, 0.15)",C=l.textAlign??"center",T=Array.isArray(t)?t:[t],I=s[0],N=s[1],R=I/2,P=N/2,O=c[0]??R,k=c[1]??P,A=o().useMemo((()=>{const e=O-R,t=k-P;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:u}}),[R,P,O,k,u]),L=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const i=(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),[o,l]=(e=>{let t=120,i=64;if(!r&&e.measureText){e.font=`${v}px ${S}`;const r=T.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),i=v*T.length+3*(T.length-1)}return[n??t,a??i]})(t),s=o*i,c=l*i,u=(I+o)*i,h=(N+l)*i,f=I/2*i,g=N/2*i,R=u/2,P=h/2,O=2*(I+o);e.width=2*u,e.height=2*h,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const k=()=>{t.restore(),t.drawImage(e,0,0,u,h,u,h,u,h),m&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...A,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)},L=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${l}px ${S}`,t.fillStyle=w,t.textAlign=C,t.textBaseline="top",t.translate(s/2,0),T.forEach(((r,n)=>{t.fillText(r??"",f,g+n*(e+3*i))})),k()};if(r){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),k()},e.onerror=()=>{L()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=r}else L()},_=e=>Array.from(y.current.values()).includes(e);o().useEffect((()=>{L()}),[t,r,n,a,l,s,c,d,u,p,h,m]),function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=window&&"MutationObserver"in window,a=i.useRef(),o=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(o(),n&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,r)),()=>o())),[e])}(b,(e=>{if(h)for(const t of e){const e=Array.from(t.removedNodes).some((e=>_(e))),r="attributes"===t.type&&_(t.target);if(e||r){L();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const F=Ce("watermark");return o().createElement("div",{ref:b,className:we()(F,f),style:{position:"relative",...g}},e.children)},_u=new Map,Fu=new WeakMap;let Hu=0;function Du(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:undefined;if(void 0===window.IntersectionObserver&&void 0!==n){const a=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:o}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Fu.has(r)||(Hu+=1,Fu.set(r,Hu.toString())),Fu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=_u.get(t);if(!r){const n=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},_u.set(t,r)}return r}(r),l=o.get(e)||[];return o.has(e)||o.set(e,l),l.push(t),i.observe(e),function(){l.splice(l.indexOf(t),1),0===l.length&&(o.delete(e),i.unobserve(e)),0===o.size&&(i.disconnect(),_u.delete(a))}}const $u=e=>{const{forceRender:t,height:r,placeholder:n=null,unmountIfInvisible:a,className:i,style:l}=e,{ref:s,inView:c,entry:d}=function(){let{root:e,rootMargin:t,threshold:r,triggerOnce:n,fallbackInView:a,trackVisibility:i,skip:l,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,u]=o().useState(null),[p,h]=o().useState({inView:!1,entry:void 0}),m=o().useRef(c);o().useEffect((()=>{if(l||!d)return;let o;return o=Du(d,((e,t)=>{h({inView:e,entry:t}),m.current?.(e,t),t.isIntersecting&&n&&o&&(o(),o=void 0)}),{root:e,rootMargin:t,threshold:r,trackVisibility:i,delay:s},a),()=>{o&&o()}}),[Array.isArray(r)?r.toString():r,d,e,t,n,l,i,a,s]);const f=p.entry?.target,g=o().useRef();d||!f||n||l||g.current===f||(g.current=f,h({inView:!1,entry:void 0}));const b=[u,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}(Object.assign({},e,{triggerOnce:!a}));o().useEffect((()=>{r||v("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ce("lazy-load"),p={[u]:!0};return o().createElement("div",{ref:s,className:we()(p,i),style:l},t||c?e.children:o().createElement("div",{className:"placeholder",style:{height:r}},n))},qu=require("html2canvas");var Mu=n.n(qu);function ju(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ku{constructor(e,t,r,n){if(ju(this,"x",void 0),ju(this,"y",void 0),ju(this,"pressure",void 0),ju(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=r||0,this.time=n||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 Vu{static fromPoints(e,t){const r=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Vu(e[1],r,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,r){const n=e.x-t.x,a=e.y-t.y,i=t.x-r.x,o=t.y-r.y,l=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+r.x)/2,d=(t.y+r.y)/2,u=Math.sqrt(n*n+a*a),p=Math.sqrt(i*i+o*o),h=p/(u+p),m=c+(l-c)*h,f=d+(s-d)*h,g=t.x-m,b=t.y-f;return{c1:new Ku(l+g,s+b),c2:new Ku(c+g,d+b)}}constructor(e,t,r,n,a,i){this.startPoint=e,this.control2=t,this.control1=r,this.endPoint=n,this.startWidth=a,this.endWidth=i}length(){let e,t,r=0;for(let n=0;n<=10;n+=1){const a=n/10,i=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(n>0){const n=i-e,a=o-t;r+=Math.sqrt(n*n+a*a)}e=i,t=o}return r}point(e,t,r,n,a){return t*(1-e)*(1-e)*(1-e)+3*r*(1-e)*(1-e)*e+3*n*(1-e)*e*e+a*e*e*e}}function zu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bu{constructor(e,t){var r=this;zu(this,"canvas",void 0),zu(this,"ctx",void 0),zu(this,"textInput",void 0),zu(this,"width",320),zu(this,"height",200),zu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),zu(this,"penColor","rgba(0,0,0,1)"),zu(this,"backgroundColor","rgba(0,0,0,0)"),zu(this,"canAddHistory",!1),zu(this,"mode",void 0),zu(this,"openSmooth",!0),zu(this,"dotSize",0),zu(this,"throttle",16),zu(this,"minDistance",5),zu(this,"velocityFilterWeight",.7),zu(this,"compositeOperation","source-over"),zu(this,"minWidth",.5),zu(this,"maxWidth",2.5),zu(this,"fontSize",16),zu(this,"eraserSize",20),zu(this,"lineHeight",1.25),zu(this,"degreeOfBlur",5),zu(this,"textInputPos",{x:0,y:0}),zu(this,"onStart",(()=>{})),zu(this,"onEnd",(()=>{})),zu(this,"_drawingStroke",!1),zu(this,"_lastPoints",[]),zu(this,"_data",[]),zu(this,"_historyList",[]),zu(this,"_lastVelocity",0),zu(this,"_lastWidth",0),zu(this,"_strokeMoveUpdate",void 0),zu(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)})),zu(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))})),zu(this,"isTouchEvent",(e=>"touches"in e)),zu(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)})),zu(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)})),zu(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),zu(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:this.isTouchEvent(e)?e.touches[0]?.clientX:e.clientX,y:this.isTouchEvent(e)?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),zu(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}))),zu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),r={...t,points:[]};this._data.push(r),this._reset(t),this._strokeUpdate(e,!1)})),zu(this,"_strokeUpdate",(function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!r._drawingStroke)return;if(0===r._data.length)return void r._strokeBegin(e);const n=r._createPoint(e.x,e.y,e.pressure),a=r._data[r._data.length-1],i=a.points,o=i.length>0&&i[i.length-1],l=!!o&&n.distanceTo(o)<=r.minDistance,s=r._getPointGroupOptions(a);if(!o||!o||!l){const e=r._addPoint(n,s);t&&(o?e&&r._drawCurve(e,s):r._drawDot(n,s)),i.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),zu(this,"_strokeEnd",(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r._drawingStroke&&(t&&r._strokeUpdate(e),r._drawingStroke=!1)})),zu(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})),zu(this,"_drawDot",((e,t)=>{const r=this.ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;r.beginPath(),this._drawCurveSegment(e.x,e.y,n),r.closePath(),r.fillStyle=t.penColor,r.fill()})),zu(this,"_drawCurve",((e,t)=>{const r=this.ctx,n=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());r.beginPath(),r.fillStyle=t.penColor;for(let r=0;r<a;r+=1){const i=r/a,o=i*i,l=o*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*o*e.control2.x,u+=l*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*i*e.control1.y,p+=3*s*o*e.control2.y,p+=l*e.endPoint.y;const h=Math.min(e.startWidth+l*n,t.maxWidth);this._drawCurveSegment(u,p,h)}r.closePath(),r.fill()})),zu(this,"_drawCurveSegment",((e,t,r)=>{const n=this.ctx;n.moveTo(e,t),n.arc(e,t,r,0,2*Math.PI,!1)})),zu(this,"_createPoint",((e,t,r)=>{const n=this.canvas.getBoundingClientRect();return new Ku(e-n.left,t-n.top,r,(new Date).getTime())})),zu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),zu(this,"_addPoint",((e,t)=>{const{_lastPoints:r}=this;if(r.push(e),r.length>2){3===r.length&&r.unshift(r[0]);const e=this._calculateCurveWidths(r[1],r[2],t),n=Vu.fromPoints(r,e);return r.shift(),n}return null})),zu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),zu(this,"_calculateCurveWidths",((e,t,r)=>{const n=r.velocityFilterWeight*t.velocityFrom(e)+(1-r.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n,r),i={end:a,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=a,i})),zu(this,"onDrawStart",(e=>{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),this.onStart?.(e))})),zu(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)))})),zu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),zu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),zu(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})),zu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,r,n-t,a-r),this.ctx.stroke(),this.ctx.restore()})),zu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(n,t),o=Math.min(a,r),l=.5*(Math.max(n,t)-i),s=.5*(Math.max(a,r)-o),c=i+l,d=o+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,l,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),zu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(r-a,t-n)/Math.PI,o=(i+25)*Math.PI/180,l=(i-25)*Math.PI/180,s=15*Math.cos(o),c=15*Math.sin(o),d=15*Math.cos(l),u=15*Math.sin(l);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,r),this.ctx.lineTo(n,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n,a);const p=n+s,h=a+c;this.ctx.lineTo(p,h);const m=n+d,f=a+u;this.ctx.lineTo(m,f),this.ctx.lineTo(n,a),this.ctx.fill(),this.ctx.restore()})),zu(this,"getAxisColor",((e,t,r)=>{const n=e.width,a=e.data,i=[];return i[0]=a[4*(r*n+t)],i[1]=a[4*(r*n+t)+1],i[2]=a[4*(r*n+t)+2],i[3]=a[4*(r*n+t)+3],i})),zu(this,"setAxisColor",((e,t,r,n)=>{const a=e.width,i=e.data;i[4*(r*a+t)]=n[0],i[4*(r*a+t)+1]=n[1],i[4*(r*a+t)+2]=n[2],i[4*(r*a+t)+3]=n[3]})),zu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),n=this.ctx.getImageData(t*this.ratio,r*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=n.width,i=n.height,o=a/this.degreeOfBlur,l=i/this.degreeOfBlur;for(let e=0;e<l;e++)for(let t=0;t<o;t++){const r=this.getAxisColor(n,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let a=0;a<this.degreeOfBlur;a++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(n,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,r)}this.ctx.putImageData(n,t*this.ratio,r*this.ratio)})),zu(this,"drawText",(e=>{const{x:t,y:r}=this.textInputPos;if(0===t&&0===r)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const n=this.fontSize*this.lineHeight,a=this.width-t,i=e.target.innerText,o=[];let l="";for(let e=0;e<i.length;e++){const t=l+i[e];this.ctx.measureText(t).width>a&&l.length>0?(o.push(l),l=i[e]):l=t}o.push(l),o.forEach(((e,a)=>{this.ctx.fillText(e,t+1,r+a*n+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),zu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),zu(this,"drawPencil",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.restore()})),zu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),zu(this,"drawEraser",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),zu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),zu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=r?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),zu(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}})),zu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),zu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),zu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),zu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),zu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),zu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),zu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),zu(this,"setDrawMode",(e=>{this.mode=e})),zu(this,"setLineWidth",(e=>{this.maxWidth=e})),zu(this,"setPenColor",(e=>{this.penColor=e})),zu(this,"setFontSize",(e=>{this.fontSize=e})),zu(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()})),zu(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(r.canvas.width===r.width)return r.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),zu(this,"getPNG",(()=>this.toDataURL())),zu(this,"getJPG",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;return r.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,r,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,i=0,o=null;const l=()=>{i=Date.now(),o=null,t=e.apply(r,n),o||(r=null,n=[])};return function(){const s=Date.now(),c=a-(s-i);r=this;for(var d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];return n=u,c<=0||c>a?(o&&(clearTimeout(o),o=null),i=s,t=e.apply(r,n),o||(r=null,n=[])):o||(o=window.setTimeout(l,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)}}zu(Bu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),r=t[0].split(":")[1],n=window.atob(t[1]),a=n.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=n.charCodeAt(e);return new Blob([i],{type:r})})),zu(Bu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),zu(Bu,"canvasToBlob",(e=>new Promise(((t,r)=>{e.toBlob((e=>e?t(e):r(null)),"image/png",1)}))));const Uu=Bu,Wu=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Gu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Yu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Xu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Qu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Zu=o().forwardRef(((e,t)=>{const{open:r,width:n,height:a,imageName:i,penColor:l,minWidth:s,maxWidth:c,backgroundColor:d,className:p,style:h,onOk:m,onCancel:f}=e,{t:g}=Pc(),b=o().useRef(),y=o().useRef(null),x=o().useRef(null),E=o().useRef(null),S=[2,4,6],w=[14,16,18,20,24,28],C=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[T,I]=ss(void 0,{value:r,postState:e=>e??!1}),N=o().useMemo((()=>!!e.children),[e.children]),[R,P]=o().useState(N?"square":"line"),[O,k]=o().useState(S[0]),[A,_]=o().useState(N?C[0]:C[4]),[F,H]=o().useState(w[1]),[D,$]=o().useState("bottomLeft"),[q,M]=o().useState(!1),[j,K]=o().useState(!1);o().useEffect((()=>{const e={width:n??x.current?.offsetWidth,height:a??x.current?.offsetHeight,maxWidth:O,mode:R,penColor:A,fontSize:F,backgroundColor:d,openSmooth:!N};return e.openSmooth&&Object.assign(e,{penColor:l,minWidth:s,maxWidth:c}),b.current=new Uu(y.current,e),()=>b.current.destroy()}),[]);const V=e=>{const[t,r]=[n??x.current?.offsetWidth,a??x.current?.offsetHeight],{width:i,height:o}=b.current;let l=!1;t&&t!==i&&(b.current.width=t,l=!0),r&&r!==o&&(b.current.height=r,l=!0),(l||e)&&b.current.update()};Me((()=>{N&&T&&V()}),[T,N]),Me((()=>{b.current.setDrawMode(R)}),[R]),Me((()=>{b.current.setLineWidth(O)}),[O]),Me((()=>{b.current.setPenColor(A)}),[A]),Me((()=>{b.current.setFontSize(F)}),[F]);const z=async()=>{const e=N?x.current.parentNode:y.current;if(e)try{const t=await Mu()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Uu.canvasToDataURL(t)}catch(e){v("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),f?.()};o().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),CLEAR:()=>b.current.clear(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:V,GET_DATE_URL:z})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},W=e=>o().createElement("div",{className:we()("ant-dropdown-menu","content")},"text"!==e?o().createElement("div",{className:"lineWidth"},S.map((e=>o().createElement("span",{key:e,className:we()("dot",`s${e}`,{active:e===O}),onClick:()=>k(e)})))):o().createElement("div",{className:"fontSize"},o().createElement(L.Select,{size:"small",value:F,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>H(e)})),o().createElement("span",{className:"divider"}),o().createElement("div",{className:"penColor"},C.map((e=>o().createElement("span",{key:e,className:we()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>_(e)},o().createElement(Te.CheckOutlined,{className:"icon"})))))),G=Ce("signature"),Y={[G]:!0,"is-annotation":N},X=n?{...h,width:n}:h;return o().createElement("div",{className:we()(Y,p),style:X},N&&o().createElement(o().Fragment,null,o().createElement("div",{ref:x,className:"content"},e.children),j&&o().createElement(xt,{spinning:!0,className:"spinning"})),o().createElement("div",{className:we()("signature",{show:T})},o().createElement("canvas",{ref:y,className:R}),N&&o().createElement("div",{ref:E,className:"signature__tool-bar"},o().createElement("div",{className:"wrapper"},o().createElement("div",{className:we()("actions",{hidden:q})},o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("square")},o().createElement(Te.BorderOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("round")},o().createElement(Wu,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("arrow")},o().createElement(Yu,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("line")},o().createElement(Te.EditOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:()=>W("text"),overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("text")},o().createElement(Gu,null))),o().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{K(!0);const e=await z();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):u()().format(Yl);qt(Uu.dataURLToBlob(e),`${t}.png`)}K(!1)})(),B()}},o().createElement(Te.DownloadOutlined,null)),o().createElement("button",{className:"btn",onClick:()=>P("eraser")},o().createElement(Xu,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.undo()},o().createElement(Qu,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.clear()},o().createElement(Te.ClearOutlined,null)),o().createElement("span",{className:"divider"}),o().createElement("button",{className:"btn",onClick:()=>f?.()},o().createElement(Te.CloseOutlined,null)),o().createElement("button",{className:"btn",onClick:async()=>{K(!0),await le(10);const e=await z();K(!1),B(),m?.(e)}},o().createElement(Te.CheckOutlined,null))),o().createElement("button",{className:"btn btn-fold",title:g(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!q)},q?o().createElement(Te.LeftOutlined,null):o().createElement(Te.RightOutlined,null))))))}));Zu.displayName="QmSignature";const Ju=Zu,ep="1.10.2";return a})()));
|