1 line
27 KiB
JavaScript
1 line
27 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2938],{48689:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(1413),o=n(67294),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},i=n(42135),c=function(e,t){return o.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:a}))};c.displayName="DeleteOutlined";var l=o.forwardRef(c)},77916:function(e,t,n){"use strict";n.d(t,{Z:function(){return eE}});var r=n(87462),o=n(67294),a=n(4942),i=n(74165),c=n(71002),l=n(74902),s=n(97685),u=n(94184),d=n.n(u),f=n(15671),p=n(43144),v=n(60136),m=n(33643),h=n(45987),y=n(15861),w=n(64217);function g(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(n){return t}}function b(e){var t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress(t)});var n=new FormData;e.data&&Object.keys(e.data).forEach(function(t){var r=e.data[t];if(Array.isArray(r)){r.forEach(function(e){n.append("".concat(t,"[]"),e)});return}n.append(t,r)}),e.file instanceof Blob?n.append(e.filename,e.file,e.file.name):n.append(e.filename,e.file),t.onerror=function(t){e.onError(t)},t.onload=function(){if(t.status<200||t.status>=300){var n;return e.onError(((n=Error("cannot ".concat(e.method," ").concat(e.action," ").concat(t.status,"'"))).status=t.status,n.method=e.method,n.url=e.action,n),g(t))}return e.onSuccess(g(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);var r=e.headers||{};return null!==r["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(r).forEach(function(e){null!==r[e]&&t.setRequestHeader(e,r[e])}),t.send(n),{abort:function(){t.abort()}}}var Z=+new Date,E=0;function k(){return"rc-upload-".concat(Z,"-").concat(++E)}var x=n(80334),C=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(","),r=e.name||"",o=e.type||"",a=o.replace(/\/.*$/,"");return n.some(function(e){var t=e.trim();if(/^\*(\/\*)?$/.test(e))return!0;if("."===t.charAt(0)){var n=r.toLowerCase(),i=t.toLowerCase(),c=[i];return(".jpg"===i||".jpeg"===i)&&(c=[".jpg",".jpeg"]),c.some(function(e){return n.endsWith(e)})}return/\/\*$/.test(t)?a===t.replace(/\/.*$/,""):o===t||!!/^\w+$/.test(t)&&((0,x.ZP)(!1,"Upload takes an invalidate 'accept' type '".concat(t,"'.Skip for check.")),!0)})}return!0},R=function(e,t,n){var r=function e(r,o){if(r.path=o||"",r.isFile)r.file(function(e){n(e)&&(r.fullPath&&!e.webkitRelativePath&&(Object.defineProperties(e,{webkitRelativePath:{writable:!0}}),e.webkitRelativePath=r.fullPath.replace(/^\//,""),Object.defineProperties(e,{webkitRelativePath:{writable:!1}})),t([e]))});else if(r.isDirectory){var a,i,c;a=function(t){t.forEach(function(t){e(t,"".concat(o).concat(r.name,"/"))})},i=r.createReader(),c=[],function e(){i.readEntries(function(t){var n=Array.prototype.slice.apply(t);c=c.concat(n),n.length?e():a(c)})}()}};e.forEach(function(e){r(e.webkitGetAsEntry())})},I=["component","prefixCls","className","disabled","id","style","multiple","accept","capture","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"],N=function(e){(0,v.Z)(n,e);var t=(0,m.Z)(n);function n(){(0,f.Z)(this,n);for(var e,r,o=arguments.length,a=Array(o),s=0;s<o;s++)a[s]=arguments[s];return(e=t.call.apply(t,[this].concat(a))).state={uid:k()},e.reqs={},e.fileInput=void 0,e._isMounted=void 0,e.onChange=function(t){var n=e.props,r=n.accept,o=n.directory,a=t.target.files,i=(0,l.Z)(a).filter(function(e){return!o||C(e,r)});e.uploadFiles(i),e.reset()},e.onClick=function(t){var n=e.fileInput;if(n){var r=e.props,o=r.children,a=r.onClick;if(o&&"button"===o.type){var i=n.parentNode;i.focus(),i.querySelector("button").blur()}n.click(),a&&a(t)}},e.onKeyDown=function(t){"Enter"===t.key&&e.onClick(t)},e.onFileDrop=function(t){var n=e.props.multiple;if(t.preventDefault(),"dragover"!==t.type){if(e.props.directory)R(Array.prototype.slice.call(t.dataTransfer.items),e.uploadFiles,function(t){return C(t,e.props.accept)});else{var r=(0,l.Z)(t.dataTransfer.files).filter(function(t){return C(t,e.props.accept)});!1===n&&(r=r.slice(0,1)),e.uploadFiles(r)}}},e.uploadFiles=function(t){var n=(0,l.Z)(t);Promise.all(n.map(function(t){return t.uid=k(),e.processFile(t,n)})).then(function(t){var n=e.props.onBatchStart;null==n||n(t.map(function(e){return{file:e.origin,parsedFile:e.parsedFile}})),t.filter(function(e){return null!==e.parsedFile}).forEach(function(t){e.post(t)})})},e.processFile=(r=(0,y.Z)((0,i.Z)().mark(function t(n,r){var o,a,l,s,u,d,f,p;return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=e.props.beforeUpload,a=n,!o){t.next=14;break}return t.prev=3,t.next=6,o(n,r);case 6:a=t.sent,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),a=!1;case 12:if(!1!==a){t.next=14;break}return t.abrupt("return",{origin:n,parsedFile:null,action:null,data:null});case 14:if("function"!=typeof(l=e.props.action)){t.next=21;break}return t.next=18,l(n);case 18:s=t.sent,t.next=22;break;case 21:s=l;case 22:if("function"!=typeof(u=e.props.data)){t.next=29;break}return t.next=26,u(n);case 26:d=t.sent,t.next=30;break;case 29:d=u;case 30:return(p=(f=("object"===(0,c.Z)(a)||"string"==typeof a)&&a?a:n)instanceof File?f:new File([f],n.name,{type:n.type})).uid=n.uid,t.abrupt("return",{origin:n,data:d,parsedFile:p,action:s});case 35:case"end":return t.stop()}},t,null,[[3,9]])})),function(e,t){return r.apply(this,arguments)}),e.saveFileInput=function(t){e.fileInput=t},e}return(0,p.Z)(n,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"post",value:function(e){var t=this,n=e.data,r=e.origin,o=e.action,a=e.parsedFile;if(this._isMounted){var i=this.props,c=i.onStart,l=i.customRequest,s=i.name,u=i.headers,d=i.withCredentials,f=i.method,p=r.uid;c(r),this.reqs[p]=(l||b)({action:o,filename:s,data:n,file:a,headers:u,withCredentials:d,method:f||"post",onProgress:function(e){var n=t.props.onProgress;null==n||n(e,a)},onSuccess:function(e,n){var r=t.props.onSuccess;null==r||r(e,a,n),delete t.reqs[p]},onError:function(e,n){var r=t.props.onError;null==r||r(e,n,a),delete t.reqs[p]}})}}},{key:"reset",value:function(){this.setState({uid:k()})}},{key:"abort",value:function(e){var t=this.reqs;if(e){var n=e.uid?e.uid:e;t[n]&&t[n].abort&&t[n].abort(),delete t[n]}else Object.keys(t).forEach(function(e){t[e]&&t[e].abort&&t[e].abort(),delete t[e]})}},{key:"render",value:function(){var e,t=this.props,n=t.component,i=t.prefixCls,c=t.className,l=t.disabled,s=t.id,u=t.style,f=t.multiple,p=t.accept,v=t.capture,m=t.children,y=t.directory,g=t.openFileDialogOnClick,b=t.onMouseEnter,Z=t.onMouseLeave,E=(0,h.Z)(t,I),k=d()((e={},(0,a.Z)(e,i,!0),(0,a.Z)(e,"".concat(i,"-disabled"),l),(0,a.Z)(e,c,c),e)),x=l?{}:{onClick:g?this.onClick:function(){},onKeyDown:g?this.onKeyDown:function(){},onMouseEnter:b,onMouseLeave:Z,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return o.createElement(n,(0,r.Z)({},x,{className:k,role:"button",style:u}),o.createElement("input",(0,r.Z)({},(0,w.Z)(E,{aria:!0,data:!0}),{id:s,type:"file",ref:this.saveFileInput,onClick:function(e){return e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:p},y?{directory:"directory",webkitdirectory:"webkitdirectory"}:{},{multiple:f,onChange:this.onChange},null!=v?{capture:v}:{})),m)}}]),n}(o.Component);function D(){}var F=function(e){(0,v.Z)(n,e);var t=(0,m.Z)(n);function n(){var e;(0,f.Z)(this,n);for(var r=arguments.length,o=Array(r),a=0;a<r;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).uploader=void 0,e.saveUploader=function(t){e.uploader=t},e}return(0,p.Z)(n,[{key:"abort",value:function(e){this.uploader.abort(e)}},{key:"render",value:function(){return o.createElement(N,(0,r.Z)({},this.props,{ref:this.saveUploader}))}}]),n}(o.Component);F.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:D,onError:D,onSuccess:D,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var P=n(21770),O=n(73935),M=n(53124),L=n(98866),U=n(23715),S=n(6213),T=n(1413),_={icon:function(e,t){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:t}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:e}}]}},name:"file",theme:"twotone"},j=n(42135),z=function(e,t){return o.createElement(j.Z,(0,T.Z)((0,T.Z)({},e),{},{ref:t,icon:_}))};z.displayName="FileTwoTone";var H=o.forwardRef(z),A=n(50888),V={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"},q=function(e,t){return o.createElement(j.Z,(0,T.Z)((0,T.Z)({},e),{},{ref:t,icon:V}))};q.displayName="PaperClipOutlined";var B=o.forwardRef(q),$={icon:function(e,t){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:e}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:t}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:t}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:t}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:e}}]}},name:"picture",theme:"twotone"},W=function(e,t){return o.createElement(j.Z,(0,T.Z)((0,T.Z)({},e),{},{ref:t,icon:$}))};W.displayName="PictureTwoTone";var X=o.forwardRef(W),G=n(62874),J=n(71577),K=n(57838),Q=n(33603),Y=n(96159);function ee(e){return(0,r.Z)((0,r.Z)({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function et(e,t){var n=(0,l.Z)(t),r=n.findIndex(function(t){return t.uid===e.uid});return -1===r?n.push(e):n[r]=e,n}function en(e,t){var n=void 0!==e.uid?"uid":"name";return t.filter(function(t){return t[n]===e[n]})[0]}var er=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.split("/"),n=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[""])[0]},eo=function(e){return 0===e.indexOf("image/")},ea=function(e){if(e.type&&!e.thumbUrl)return eo(e.type);var t=e.thumbUrl||e.url||"",n=er(t);return!!(/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n))||!/^data:/.test(t)&&!n};function ei(e){return new Promise(function(t){if(!e.type||!eo(e.type)){t("");return}var n=document.createElement("canvas");n.width=200,n.height=200,n.style.cssText="position: fixed; left: 0; top: 0; width: ".concat(200,"px; height: ").concat(200,"px; z-index: 9999; display: none;"),document.body.appendChild(n);var r=n.getContext("2d"),o=new Image;if(o.onload=function(){var e=o.width,a=o.height,i=200,c=200,l=0,s=0;e>a?s=-((c=a*(200/e))-i)/2:l=-((i=e*(200/a))-c)/2,r.drawImage(o,l,s,i,c);var u=n.toDataURL();document.body.removeChild(n),t(u)},o.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){var a=new FileReader;a.addEventListener("load",function(){a.result&&(o.src=a.result)}),a.readAsDataURL(e)}else o.src=window.URL.createObjectURL(e)})}var ec=n(48689),el={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"},es=function(e,t){return o.createElement(j.Z,(0,T.Z)((0,T.Z)({},e),{},{ref:t,icon:el}))};es.displayName="DownloadOutlined";var eu=o.forwardRef(es),ed=n(99611),ef=n(97910),ep=n(94199),ev=o.forwardRef(function(e,t){var n,i=e.prefixCls,c=e.className,l=e.style,u=e.locale,f=e.listType,p=e.file,v=e.items,m=e.progress,h=e.iconRender,y=e.actionIconRender,w=e.itemRender,g=e.isImgUrl,b=e.showPreviewIcon,Z=e.showRemoveIcon,E=e.showDownloadIcon,k=e.previewIcon,x=e.removeIcon,C=e.downloadIcon,R=e.onPreview,I=e.onDownload,N=e.onClose,D=p.status,F=o.useState(D),P=(0,s.Z)(F,2),O=P[0],L=P[1];o.useEffect(function(){"removed"!==D&&L(D)},[D]);var U=o.useState(!1),S=(0,s.Z)(U,2),T=S[0],_=S[1],j=o.useRef(null);o.useEffect(function(){return j.current=setTimeout(function(){_(!0)},300),function(){j.current&&clearTimeout(j.current)}},[]);var z=h(p),H=o.createElement("div",{className:"".concat(i,"-text-icon")},z);if("picture"===f||"picture-card"===f){if("uploading"!==O&&(p.thumbUrl||p.url)){var A,V=(null==g?void 0:g(p))?o.createElement("img",{src:p.thumbUrl||p.url,alt:p.name,className:"".concat(i,"-list-item-image"),crossOrigin:p.crossOrigin}):z,q=d()((A={},(0,a.Z)(A,"".concat(i,"-list-item-thumbnail"),!0),(0,a.Z)(A,"".concat(i,"-list-item-file"),g&&!g(p)),A));H=o.createElement("a",{className:q,onClick:function(e){return R(p,e)},href:p.url||p.thumbUrl,target:"_blank",rel:"noopener noreferrer"},V)}else{var B,$,W,X,J=d()((X={},(0,a.Z)(X,"".concat(i,"-list-item-thumbnail"),!0),(0,a.Z)(X,"".concat(i,"-list-item-file"),"uploading"!==O),X));H=o.createElement("div",{className:J},z)}}var K=d()((B={},(0,a.Z)(B,"".concat(i,"-list-item"),!0),(0,a.Z)(B,"".concat(i,"-list-item-").concat(O),!0),(0,a.Z)(B,"".concat(i,"-list-item-list-type-").concat(f),!0),B)),Q="string"==typeof p.linkProps?JSON.parse(p.linkProps):p.linkProps,Y=Z?y(("function"==typeof x?x(p):x)||o.createElement(ec.Z,null),function(){return N(p)},i,u.removeFile):null,ee=E&&"done"===O?y(("function"==typeof C?C(p):C)||o.createElement(eu,null),function(){return I(p)},i,u.downloadFile):null,et="picture-card"!==f&&o.createElement("span",{key:"download-delete",className:d()("".concat(i,"-list-item-card-actions"),{picture:"picture"===f})},ee,Y),en=d()("".concat(i,"-list-item-name")),er=p.url?[o.createElement("a",(0,r.Z)({key:"view",target:"_blank",rel:"noopener noreferrer",className:en,title:p.name},Q,{href:p.url,onClick:function(e){return R(p,e)}}),p.name),et]:[o.createElement("span",{key:"view",className:en,onClick:function(e){return R(p,e)},title:p.name},p.name),et],eo=b?o.createElement("a",{href:p.url||p.thumbUrl,target:"_blank",rel:"noopener noreferrer",style:p.url||p.thumbUrl?void 0:{pointerEvents:"none",opacity:.5},onClick:function(e){return R(p,e)},title:u.previewFile},"function"==typeof k?k(p):k||o.createElement(ed.Z,null)):null,ea="picture-card"===f&&"uploading"!==O&&o.createElement("span",{className:"".concat(i,"-list-item-actions")},eo,"done"===O&&ee,Y);n=p.response&&"string"==typeof p.response?p.response:(null===($=p.error)||void 0===$?void 0:$.statusText)||(null===(W=p.error)||void 0===W?void 0:W.message)||u.uploadError;var ei=o.createElement("span",{className:"".concat(i,"-span")},H,er),el=(0,o.useContext(M.E_).getPrefixCls)(),es=o.createElement("div",{className:K},o.createElement("div",{className:"".concat(i,"-list-item-info")},ei),ea,T&&o.createElement(G.Z,{motionName:"".concat(el,"-fade"),visible:"uploading"===O,motionDeadline:2e3},function(e){var t=e.className,n="percent"in p?o.createElement(ef.Z,(0,r.Z)({},m,{type:"line",percent:p.percent})):null;return o.createElement("div",{className:d()("".concat(i,"-list-item-progress"),t)},n)})),ev=d()("".concat(i,"-list-").concat(f,"-container"),c),em="error"===O?o.createElement(ep.Z,{title:n,getPopupContainer:function(e){return e.parentNode}},es):es;return o.createElement("div",{className:ev,style:l,ref:t},w?w(em,p,v,{download:I.bind(null,p),preview:R.bind(null,p),remove:N.bind(null,p)}):em)}),em=(0,r.Z)({},Q.ZP);delete em.onAppearEnd,delete em.onEnterEnd,delete em.onLeaveEnd;var eh=o.forwardRef(function(e,t){var n,i=e.listType,c=void 0===i?"text":i,u=e.previewFile,f=void 0===u?ei:u,p=e.onPreview,v=e.onDownload,m=e.onRemove,h=e.locale,y=e.iconRender,w=e.isImageUrl,g=void 0===w?ea:w,b=e.prefixCls,Z=e.items,E=void 0===Z?[]:Z,k=e.showPreviewIcon,x=void 0===k||k,C=e.showRemoveIcon,R=void 0===C||C,I=e.showDownloadIcon,N=void 0!==I&&I,D=e.removeIcon,F=e.previewIcon,P=e.downloadIcon,O=e.progress,L=void 0===O?{strokeWidth:2,showInfo:!1}:O,U=e.appendAction,S=e.appendActionVisible,T=e.itemRender,_=(0,K.Z)(),j=o.useState(!1),z=(0,s.Z)(j,2),V=z[0],q=z[1];o.useEffect(function(){("picture"===c||"picture-card"===c)&&(E||[]).forEach(function(e){"undefined"!=typeof document&&"undefined"!=typeof window&&window.FileReader&&window.File&&(e.originFileObj instanceof File||e.originFileObj instanceof Blob)&&void 0===e.thumbUrl&&(e.thumbUrl="",f&&f(e.originFileObj).then(function(t){e.thumbUrl=t||"",_()}))})},[c,E,f]),o.useEffect(function(){q(!0)},[]);var $=function(e,t){if(p)return null==t||t.preventDefault(),p(e)},W=function(e){"function"==typeof v?v(e):e.url&&window.open(e.url)},Q=function(e){null==m||m(e)},ee=function(e){if(y)return y(e,c);var t="uploading"===e.status,n=g&&g(e)?o.createElement(X,null):o.createElement(H,null),r=t?o.createElement(A.Z,null):o.createElement(B,null);return"picture"===c?r=t?o.createElement(A.Z,null):n:"picture-card"===c&&(r=t?h.uploading:n),r},et=function(e,t,n,a){var i={type:"text",size:"small",title:a,onClick:function(n){t(),(0,Y.l$)(e)&&e.props.onClick&&e.props.onClick(n)},className:"".concat(n,"-list-item-card-actions-btn")};if((0,Y.l$)(e)){var c=(0,Y.Tm)(e,(0,r.Z)((0,r.Z)({},e.props),{onClick:function(){}}));return o.createElement(J.Z,(0,r.Z)({},i,{icon:c}))}return o.createElement(J.Z,(0,r.Z)({},i),o.createElement("span",null,e))};o.useImperativeHandle(t,function(){return{handlePreview:$,handleDownload:W}});var en=o.useContext(M.E_),er=en.getPrefixCls,eo=en.direction,ec=er("upload",b),el=d()((n={},(0,a.Z)(n,"".concat(ec,"-list"),!0),(0,a.Z)(n,"".concat(ec,"-list-").concat(c),!0),(0,a.Z)(n,"".concat(ec,"-list-rtl"),"rtl"===eo),n)),es=(0,l.Z)(E.map(function(e){return{key:e.uid,file:e}})),eu={motionDeadline:2e3,motionName:"".concat(ec,"-").concat("picture-card"===c?"animate-inline":"animate"),keys:es,motionAppear:V};return"picture-card"!==c&&(eu=(0,r.Z)((0,r.Z)({},em),eu)),o.createElement("div",{className:el},o.createElement(G.V,(0,r.Z)({},eu,{component:!1}),function(e){var t=e.key,n=e.file,r=e.className,a=e.style;return o.createElement(ev,{key:t,locale:h,prefixCls:ec,className:r,style:a,file:n,items:E,progress:L,listType:c,isImgUrl:g,showPreviewIcon:x,showRemoveIcon:R,showDownloadIcon:N,removeIcon:D,previewIcon:F,downloadIcon:P,iconRender:ee,actionIconRender:et,itemRender:T,onPreview:$,onDownload:W,onClose:Q})}),U&&o.createElement(G.Z,(0,r.Z)({},eu,{visible:void 0===S||S,forceRender:!0}),function(e){var t=e.className,n=e.style;return(0,Y.Tm)(U,function(e){return{className:d()(e.className,t),style:(0,r.Z)((0,r.Z)((0,r.Z)({},n),{pointerEvents:t?"none":void 0}),e.style)}})}))}),ey="__LIST_IGNORE_".concat(Date.now(),"__"),ew=o.forwardRef(function(e,t){var n=e.fileList,u=e.defaultFileList,f=e.onRemove,p=e.showUploadList,v=void 0===p||p,m=e.listType,h=void 0===m?"text":m,y=e.onPreview,w=e.onDownload,g=e.onChange,b=e.onDrop,Z=e.previewFile,E=e.disabled,k=e.locale,x=e.iconRender,C=e.isImageUrl,R=e.progress,I=e.prefixCls,N=e.className,D=e.type,T=e.children,_=e.style,j=e.itemRender,z=e.maxCount,H=e.data,A=e.multiple,V=e.action,q=e.accept,B=e.supportServerRender,$=o.useContext(L.Z),W=null!=E?E:$,X=(0,P.Z)(u||[],{value:n,postState:function(e){return null!=e?e:[]}}),G=(0,s.Z)(X,2),J=G[0],K=G[1],Q=o.useState("drop"),Y=(0,s.Z)(Q,2),er=Y[0],eo=Y[1],ea=o.useRef(null);o.useMemo(function(){var e=Date.now();(n||[]).forEach(function(t,n){t.uid||Object.isFrozen(t)||(t.uid="__AUTO__".concat(e,"_").concat(n,"__"))})},[n]);var ei=function(e,t,n){var r=(0,l.Z)(t);1===z?r=r.slice(-1):z&&(r=r.slice(0,z)),(0,O.flushSync)(function(){K(r)});var o={file:e,fileList:r};n&&(o.event=n),null==g||g(o)},ec=function(e){var t=e.filter(function(e){return!e.file[ey]});if(t.length){var n=t.map(function(e){return ee(e.file)}),r=(0,l.Z)(J);n.forEach(function(e){r=et(e,r)}),n.forEach(function(e,n){var o=e;if(t[n].parsedFile)e.status="uploading";else{var a,i=e.originFileObj;try{a=new File([i],i.name,{type:i.type})}catch(c){(a=new Blob([i],{type:i.type})).name=i.name,a.lastModifiedDate=new Date,a.lastModified=new Date().getTime()}a.uid=e.uid,o=a}ei(o,r)})}},el=function(e,t,n){try{"string"==typeof e&&(e=JSON.parse(e))}catch(r){}if(en(t,J)){var o=ee(t);o.status="done",o.percent=100,o.response=e,o.xhr=n;var a=et(o,J);ei(o,a)}},es=function(e,t){if(en(t,J)){var n=ee(t);n.status="uploading",n.percent=e.percent;var r=et(n,J);ei(n,r,e)}},eu=function(e,t,n){if(en(n,J)){var r=ee(n);r.error=e,r.response=t,r.status="error";var o=et(r,J);ei(r,o)}},ed=function(e){var t;Promise.resolve("function"==typeof f?f(e):f).then(function(n){if(!1!==n){var o,a,i,c=(o=void 0!==e.uid?"uid":"name",(a=J.filter(function(t){return t[o]!==e[o]})).length===J.length?null:a);c&&(t=(0,r.Z)((0,r.Z)({},e),{status:"removed"}),null==J||J.forEach(function(e){var n=void 0!==t.uid?"uid":"name";e[n]!==t[n]||Object.isFrozen(e)||(e.status="removed")}),null===(i=ea.current)||void 0===i||i.abort(t),ei(t,c))}})},ef=function(e){eo(e.type),"drop"===e.type&&(null==b||b(e))};o.useImperativeHandle(t,function(){return{onBatchStart:ec,onSuccess:el,onProgress:es,onError:eu,fileList:J,upload:ea.current}});var ep=o.useContext(M.E_),ev=ep.getPrefixCls,em=ep.direction,ew=ev("upload",I),eg=(0,r.Z)((0,r.Z)({onBatchStart:ec,onError:eu,onProgress:es,onSuccess:el},e),{data:void 0===H?{}:H,multiple:void 0!==A&&A,action:void 0===V?"":V,accept:void 0===q?"":q,supportServerRender:void 0===B||B,prefixCls:ew,disabled:W,beforeUpload:function(t,n){var r,o,a,l;return r=void 0,o=void 0,a=void 0,l=(0,i.Z)().mark(function r(){var o,a,l,s;return(0,i.Z)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=e.beforeUpload,a=e.transformFile,l=t,!o){r.next=13;break}return r.next=5,o(t,n);case 5:if(!1!==(s=r.sent)){r.next=8;break}return r.abrupt("return",!1);case 8:if(delete t[ey],s!==ey){r.next=12;break}return Object.defineProperty(t,ey,{value:!0,configurable:!0}),r.abrupt("return",!1);case 12:"object"===(0,c.Z)(s)&&s&&(l=s);case 13:if(!a){r.next=17;break}return r.next=16,a(l);case 16:l=r.sent;case 17:return r.abrupt("return",l);case 18:case"end":return r.stop()}},r)}),new(a||(a=Promise))(function(e,t){function n(e){try{c(l.next(e))}catch(n){t(n)}}function i(e){try{c(l.throw(e))}catch(n){t(n)}}function c(t){var r;t.done?e(t.value):((r=t.value)instanceof a?r:new a(function(e){e(r)})).then(n,i)}c((l=l.apply(r,o||[])).next())})},onChange:void 0});delete eg.className,delete eg.style,(!T||W)&&delete eg.id;var eb=function(e,t){return v?o.createElement(U.Z,{componentName:"Upload",defaultLocale:S.Z.Upload},function(n){var a="boolean"==typeof v?{}:v,i=a.showRemoveIcon,c=a.showPreviewIcon,l=a.showDownloadIcon,s=a.removeIcon,u=a.previewIcon,d=a.downloadIcon;return o.createElement(eh,{prefixCls:ew,listType:h,items:J,previewFile:Z,onPreview:y,onDownload:w,onRemove:ed,showRemoveIcon:!W&&i,showPreviewIcon:c,showDownloadIcon:l,removeIcon:s,previewIcon:u,downloadIcon:d,iconRender:x,locale:(0,r.Z)((0,r.Z)({},n),k),isImageUrl:C,progress:R,appendAction:e,appendActionVisible:t,itemRender:j})}):e};if("drag"===(void 0===D?"select":D)){var eZ,eE,ek=d()(ew,(eE={},(0,a.Z)(eE,"".concat(ew,"-drag"),!0),(0,a.Z)(eE,"".concat(ew,"-drag-uploading"),J.some(function(e){return"uploading"===e.status})),(0,a.Z)(eE,"".concat(ew,"-drag-hover"),"dragover"===er),(0,a.Z)(eE,"".concat(ew,"-disabled"),W),(0,a.Z)(eE,"".concat(ew,"-rtl"),"rtl"===em),eE),N);return o.createElement("span",null,o.createElement("div",{className:ek,onDrop:ef,onDragOver:ef,onDragLeave:ef,style:_},o.createElement(F,(0,r.Z)({},eg,{ref:ea,className:"".concat(ew,"-btn")}),o.createElement("div",{className:"".concat(ew,"-drag-container")},T))),eb())}var ex=d()(ew,(eZ={},(0,a.Z)(eZ,"".concat(ew,"-select"),!0),(0,a.Z)(eZ,"".concat(ew,"-select-").concat(h),!0),(0,a.Z)(eZ,"".concat(ew,"-disabled"),W),(0,a.Z)(eZ,"".concat(ew,"-rtl"),"rtl"===em),eZ)),eC=o.createElement("div",{className:ex,style:T?void 0:{display:"none"}},o.createElement(F,(0,r.Z)({},eg,{ref:ea})));return"picture-card"===h?o.createElement("span",{className:d()("".concat(ew,"-picture-card-wrapper"),N)},eb(eC,!!T)):o.createElement("span",{className:N},eC,eb())}),eg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},eb=o.forwardRef(function(e,t){var n=e.style,a=e.height,i=eg(e,["style","height"]);return o.createElement(ew,(0,r.Z)({ref:t},i,{type:"drag",style:(0,r.Z)((0,r.Z)({},n),{height:a})}))}),eZ=ew;eZ.Dragger=eb,eZ.LIST_IGNORE=ey;var eE=eZ},23279:function(e,t,n){var r=n(13218),o=n(7771),a=n(14841),i=Math.max,c=Math.min;e.exports=function(e,t,n){var l,s,u,d,f,p,v=0,m=!1,h=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function w(t){var n=l,r=s;return l=s=void 0,v=t,d=e.apply(r,n)}function g(e){var n=e-p,r=e-v;return void 0===p||n>=t||n<0||h&&r>=u}function b(){var e,n,r,a=o();if(g(a))return Z(a);f=setTimeout(b,(e=a-p,n=a-v,r=t-e,h?c(r,u-n):r))}function Z(e){return(f=void 0,y&&l)?w(e):(l=s=void 0,d)}function E(){var e,n=o(),r=g(n);if(l=arguments,s=this,p=n,r){if(void 0===f)return v=e=p,f=setTimeout(b,t),m?w(e):d;if(h)return clearTimeout(f),f=setTimeout(b,t),w(p)}return void 0===f&&(f=setTimeout(b,t)),d}return t=a(t)||0,r(n)&&(m=!!n.leading,u=(h="maxWait"in n)?i(a(n.maxWait)||0,t):u,y="trailing"in n?!!n.trailing:y),E.cancel=function(){void 0!==f&&clearTimeout(f),v=0,l=p=s=f=void 0},E.flush=function(){return void 0===f?d:Z(o())},E}},7771:function(e,t,n){var r=n(55639);e.exports=function(){return r.Date.now()}}}]); |