import{o as e}from"./request-DWqS4XYU.js";import{$n as t,Bn as n,Ct as r,Er as i,Et as a,Ft as o,Hn as s,It as c,Ln as l,Nn as u,Nr as d,Pr as f,Qn as p,Un as m,Wn as h,Yt as g,ar as _,at as v,en as y,et as b,ht as x,jr as S,kt as C,nn as w,nt as T,pt as ee,qt as E,st as D,wn as O,wr as te,wt as k}from"./jsx-runtime-Dk2XcqH2.js";import{_ as A,t as j}from"./tooltip-Up9y7xD6.js";import{g as ne}from"./style-DRVsp3wL.js";import{a as re}from"./useBreakpoint-oUFNqAoS.js";import{r as M}from"./ColorPresets-BZbQ_VEs.js";import{n as N}from"./button-CdrnzceP.js";import{t as ie}from"./EyeOutlined-BK7I_5TI.js";import{t as ae}from"./progress-DsJoGX7l.js";import{at as oe,ct as se,ot as ce,st as le,vt as ue}from"./index-kOY0oRfZ.js";var P=e(f()),F=e(d()),I=((e,t)=>{if(e&&t){let n=Array.isArray(t)?t:t.split(`,`),r=e.name||``,i=e.type||``,a=i.replace(/\/.*$/,``);return n.some(e=>{let t=e.trim();if(/^\*(\/\*)?$/.test(e))return!0;if(t.charAt(0)===`.`){let e=r.toLowerCase(),n=t.toLowerCase(),i=[n];return(n===`.jpg`||n===`.jpeg`)&&(i=[`.jpg`,`.jpeg`]),i.some(t=>e.endsWith(t))}return/\/\*$/.test(t)?a===t.replace(/\/.*$/,``):i===t?!0:/^\w+$/.test(t)?(_(!1,`Upload takes an invalidate 'accept' type '${t}'.Skip for check.`),!0):!1})}return!0});function L(e,t){let n=`cannot ${e.method} ${e.action} ${t.status}'`,r=Error(n);return r.status=t.status,r.method=e.method,r.url=e.action,r}function R(e){let t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}function z(e){let 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)});let n=new FormData;e.data&&Object.keys(e.data).forEach(t=>{let r=e.data[t];if(Array.isArray(r)){r.forEach(e=>{n.append(`${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(){return t.status<200||t.status>=300?e.onError(L(e,t),R(t)):e.onSuccess(R(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&`withCredentials`in t&&(t.withCredentials=!0);let r=e.headers||{};return r[`X-Requested-With`]!==null&&t.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`),Object.keys(r).forEach(e=>{r[e]!==null&&t.setRequestHeader(e,r[e])}),t.send(n),{abort(){t.abort()}}}var B=async(e,t)=>{let n=[],r=[];e.forEach(e=>r.push(e.webkitGetAsEntry()));async function i(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise(e=>{t.readEntries(e,()=>e([]))}),r=e.length;if(!r)break;for(let t=0;t{e.file(r=>{t(r)?(e.fullPath&&!r.webkitRelativePath&&(Object.defineProperties(r,{webkitRelativePath:{writable:!0}}),r.webkitRelativePath=e.fullPath.replace(/^\//,``),Object.defineProperties(r,{webkitRelativePath:{writable:!1}})),n(r)):n(null)})})}let o=async(e,t)=>{if(e){if(e.path=t||``,e.isFile){let t=await a(e);t&&n.push(t)}else if(e.isDirectory){let t=await i(e);r.push(...t)}}},s=0;for(;s{let{accept:n,directory:r}=this.props,i,a;if(typeof n==`string`)a=n;else{let{filter:e,format:t}=n||{};a=t,i=e===`native`?()=>!0:e}return(i||(r||t?e=>I(e,a):()=>!0))(e)};onChange=e=>{let{files:t}=e.target,n=[...t].filter(e=>this.filterFile(e));this.uploadFiles(n),this.reset()};onClick=e=>{let t=this.fileInput;if(!t)return;let n=e.target,{onClick:r}=this.props;n&&n.tagName===`BUTTON`&&(t.parentNode.focus(),n.blur()),t.click(),r&&r(e)};onKeyDown=e=>{e.key===`Enter`&&this.onClick(e)};onDataTransferFiles=async(e,t)=>{let{multiple:n,directory:r}=this.props,i=[...e.items||[]],a=[...e.files||[]];if((a.length>0||i.some(e=>e.kind===`file`))&&t?.(),r)a=await B(Array.prototype.slice.call(i),this.filterFile),this.uploadFiles(a);else{let e=[...a].filter(e=>this.filterFile(e,!0));n===!1&&(e=a.slice(0,1)),this.uploadFiles(e)}};onFilePaste=async e=>{let{pastable:t}=this.props;if(t&&e.type===`paste`){let t=e.clipboardData;return this.onDataTransferFiles(t,()=>{e.preventDefault()})}};onFileDragOver=e=>{e.preventDefault()};onFileDrop=async e=>{if(e.preventDefault(),e.type===`drop`){let t=e.dataTransfer;return this.onDataTransferFiles(t)}};componentDidMount(){this._isMounted=!0;let{pastable:e}=this.props;e&&document.addEventListener(`paste`,this.onFilePaste)}componentWillUnmount(){this._isMounted=!1,this.abort(),document.removeEventListener(`paste`,this.onFilePaste)}componentDidUpdate(e){let{pastable:t}=this.props;t&&!e.pastable?document.addEventListener(`paste`,this.onFilePaste):!t&&e.pastable&&document.removeEventListener(`paste`,this.onFilePaste)}uploadFiles=e=>{let t=[...e],n=t.map(e=>(e.uid=U(),this.processFile(e,t)));Promise.all(n).then(e=>{let{onBatchStart:t}=this.props;t?.(e.map(({origin:e,parsedFile:t})=>({file:e,parsedFile:t}))),e.filter(e=>e.parsedFile!==null).forEach(e=>{this.post(e)})})};processFile=async(e,t)=>{let{beforeUpload:n}=this.props,r=e;if(n){try{r=await n(e,t)}catch{r=!1}if(r===!1)return{origin:e,parsedFile:null,action:null,data:null}}let{action:i}=this.props,a;a=typeof i==`function`?await i(e):i;let{data:o}=this.props,s;s=typeof o==`function`?await o(e):o;let c=(typeof r==`object`||typeof r==`string`)&&r?r:e,l;l=c instanceof File?c:new File([c],e.name,{type:e.type});let u=l;return u.uid=e.uid,{origin:e,data:s,parsedFile:u,action:a}};post({data:e,origin:t,action:n,parsedFile:r}){if(!this._isMounted)return;let{onStart:i,customRequest:a,name:o,headers:s,withCredentials:c,method:l}=this.props,{uid:u}=t,d=a||z,f={action:n,filename:o,data:e,file:r,headers:s,withCredentials:c,method:l||`post`,onProgress:e=>{let{onProgress:t}=this.props;t?.(e,r)},onSuccess:(e,t)=>{let{onSuccess:n}=this.props;n?.(e,r,t),delete this.reqs[u]},onError:(e,t)=>{let{onError:n}=this.props;n?.(e,t,r),delete this.reqs[u]}};i(t),this.reqs[u]=d(f,{defaultRequest:z})}reset(){this.setState({uid:U()})}abort(e){let{reqs:t}=this;if(e){let n=e.uid?e.uid:e;t[n]&&t[n].abort&&t[n].abort(),delete t[n]}else Object.keys(t).forEach(e=>{t[e]&&t[e].abort&&t[e].abort(),delete t[e]})}saveFileInput=e=>{this.fileInput=e};render(){let{component:e,prefixCls:t,className:n,classNames:r={},disabled:i,id:a,name:o,style:s,styles:c={},multiple:l,accept:u,capture:d,children:f,directory:m,openFileDialogOnClick:g,onMouseEnter:_,onMouseLeave:v,hasControlInside:y,...b}=this.props,x=typeof u==`string`?u:u?.format,S=h(t,{[`${t}-disabled`]:i,[n]:n}),C=m?{directory:`directory`,webkitdirectory:`webkitdirectory`}:{},w=i?{}:{onClick:g?this.onClick:()=>{},onKeyDown:g?this.onKeyDown:()=>{},onMouseEnter:_,onMouseLeave:v,onDrop:this.onFileDrop,onDragOver:this.onFileDragOver,tabIndex:y?void 0:`0`};return P.createElement(e,W({},w,{className:S,role:y?void 0:`button`,style:s}),P.createElement(`input`,W({},p(b,{aria:!0,data:!0}),{id:a,name:o,disabled:i,type:`file`,ref:this.saveFileInput,onClick:e=>e.stopPropagation(),key:this.state.uid,style:{display:`none`,...c.input},className:r.input,accept:x},C,{multiple:l,onChange:this.onChange},d==null?{}:{capture:d})),f)}};function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t{this.uploader=e};render(){return P.createElement(G,K({},this.props,{ref:this.saveUploader}))}},fe=e=>{let{componentCls:t,iconCls:n}=e;return{[`${t}-wrapper`]:{[`${t}-drag`]:{position:`relative`,width:`100%`,height:`100%`,textAlign:`center`,background:e.colorFillAlter,border:`${l(e.lineWidth)} dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:`pointer`,transition:`border-color ${e.motionDurationSlow}`,[t]:{padding:e.padding},[`${t}-btn`]:{display:`table`,width:`100%`,height:`100%`,outline:`none`,borderRadius:e.borderRadiusLG,"&:focus-visible":{outline:`${l(e.lineWidthFocus)} solid ${e.colorPrimaryBorder}`}},[`${t}-drag-container`]:{display:`table-cell`,verticalAlign:`middle`},[` &:not(${t}-disabled):hover, &-hover:not(${t}-disabled) `]:{borderColor:e.colorPrimaryHover},[`p${t}-drag-icon`]:{marginBottom:e.margin,[n]:{color:e.colorPrimary,fontSize:e.uploadThumbnailSize}},[`p${t}-text`]:{margin:`0 0 ${l(e.marginXXS)}`,color:e.colorTextHeading,fontSize:e.fontSizeLG},[`p${t}-hint`]:{color:e.colorTextDescription,fontSize:e.fontSize},[`&${t}-disabled`]:{[`p${t}-drag-icon ${n}, p${t}-text, p${t}-hint `]:{color:e.colorTextDisabled}}}}}},J=e=>{let{componentCls:t,iconCls:n,fontSize:r,lineHeight:i,motionDurationSlow:a,calc:o}=e,s=`${t}-list-item`,c=`${s}-actions`,u=`${s}-action`;return{[`${t}-wrapper`]:{[`${t}-list`]:{...g(),lineHeight:e.lineHeight,[s]:{position:`relative`,height:o(e.lineHeight).mul(r).equal(),marginTop:e.marginXS,fontSize:r,display:`flex`,alignItems:`center`,transition:`background-color ${a}`,borderRadius:e.borderRadiusSM,"&:hover":{backgroundColor:e.controlItemBgHover},[`${s}-name`]:{...w,padding:`0 ${l(e.paddingXS)}`,lineHeight:i,flex:`auto`,transition:`all ${a}`},[c]:{whiteSpace:`nowrap`,[u]:{opacity:0},"@media (hover: none), (pointer: coarse)":{[u]:{opacity:1}},[n]:{color:e.actionsColor,transition:`all ${a}`},[` ${u}:focus-visible, &.picture ${u} `]:{opacity:1}},[`${t}-icon ${n}`]:{color:e.colorIcon,fontSize:r},[`${s}-progress`]:{position:`absolute`,bottom:e.calc(e.uploadProgressOffset).mul(-1).equal(),width:`100%`,paddingInlineStart:o(r).add(e.paddingXS).equal(),fontSize:r,lineHeight:0,pointerEvents:`none`,"> div":{margin:0}}},[`${s}:hover ${u}`]:{opacity:1},[`${s}-error`]:{color:e.colorError,[`${s}-name, ${t}-icon ${n}`]:{color:e.colorError},[c]:{[`${n}, ${n}:hover`]:{color:e.colorError},[u]:{opacity:1}}},[`${t}-list-item-container`]:{transition:[`opacity`,`height`].map(e=>`${e} ${a}`).join(`, `),"&::before":{display:`table`,width:0,height:0,content:`""`}}}}}},Y=e=>{let{componentCls:t}=e,n=new u(`uploadAnimateInlineIn`,{from:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),r=new u(`uploadAnimateInlineOut`,{to:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),i=`${t}-animate-inline`;return[{[`${t}-wrapper`]:{[`${i}-appear, ${i}-enter, ${i}-leave`]:{animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseInOutCirc,animationFillMode:`forwards`},[`${i}-appear, ${i}-enter`]:{animationName:n},[`${i}-leave`]:{animationName:r}}},{[`${t}-wrapper`]:A(e)},n,r]},X=e=>{let{componentCls:t,iconCls:n,uploadThumbnailSize:r,uploadProgressOffset:i,calc:a}=e,o=`${t}-list`,s=`${o}-item`;return{[`${t}-wrapper`]:{[` ${o}${o}-picture, ${o}${o}-picture-card, ${o}${o}-picture-circle `]:{[s]:{position:`relative`,height:a(r).add(a(e.lineWidth).mul(2)).add(a(e.paddingXS).mul(2)).equal(),padding:e.paddingXS,border:`${l(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusLG,"&:hover":{background:`transparent`},[`${s}-thumbnail`]:{...w,width:r,height:r,lineHeight:l(a(r).add(e.paddingSM).equal()),textAlign:`center`,flex:`none`,[n]:{fontSize:e.fontSizeHeading2,color:e.colorPrimary},img:{display:`block`,width:`100%`,height:`100%`,overflow:`hidden`}},[`${s}-progress`]:{bottom:a(e.fontSize).mul(e.lineHeight).div(2).add(i).equal(),width:`calc(100% - ${l(a(e.paddingSM).mul(2).equal())})`,marginTop:0,paddingInlineStart:a(r).add(e.paddingXS).equal()}},[`${s}-error`]:{borderColor:e.colorError,[`${s}-thumbnail${s}-file ${n}`]:{color:e.colorError}},[`${s}-uploading`]:{borderStyle:`dashed`,[`${s}-name`]:{marginBottom:i}}},[`${o}${o}-picture-circle ${s}`]:{[`&, &::before, ${s}-thumbnail`]:{borderRadius:`50%`}}}}},pe=e=>{let{componentCls:t,iconCls:n,fontSizeLG:r,colorTextLightSolid:i,calc:a}=e,o=`${t}-list`,s=`${o}-item`,c=e.uploadPicCardSize;return{[` ${t}-wrapper${t}-picture-card-wrapper, ${t}-wrapper${t}-picture-circle-wrapper `]:{...g(),display:`block`,[`${t}${t}-select`]:{width:c,height:c,textAlign:`center`,verticalAlign:`top`,backgroundColor:e.colorFillAlter,border:`${l(e.lineWidth)} dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:`pointer`,transition:`border-color ${e.motionDurationSlow}`,[`> ${t}`]:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,textAlign:`center`},[`&:not(${t}-disabled):hover`]:{borderColor:e.colorPrimary}},[`${o}${o}-picture-card, ${o}${o}-picture-circle`]:{display:`flex`,flexWrap:`wrap`,"&:not(:empty)":{minHeight:c},"@supports not (gap: 1px)":{"& > *":{marginBlockEnd:e.marginXS,marginInlineEnd:e.marginXS}},"@supports (gap: 1px)":{gap:e.marginXS},[`${o}-item-container`]:{display:`inline-block`,width:c,height:c,verticalAlign:`top`},"&::after":{display:`none`},"&::before":{display:`none`},[s]:{height:`100%`,margin:0,"&::before":{position:`absolute`,zIndex:1,width:`calc(100% - ${l(a(e.paddingXS).mul(2).equal())})`,height:`calc(100% - ${l(a(e.paddingXS).mul(2).equal())})`,backgroundColor:e.colorBgMask,opacity:0,transition:`all ${e.motionDurationSlow}`,content:`" "`}},[`${s}:hover`]:{[`&::before, ${s}-actions`]:{opacity:1}},[`${s}-actions`]:{position:`absolute`,insetInlineStart:0,zIndex:10,width:`100%`,whiteSpace:`nowrap`,textAlign:`center`,opacity:0,transition:`all ${e.motionDurationSlow}`,[` ${n}-eye, ${n}-download, ${n}-delete `]:{zIndex:10,width:r,margin:`0 ${l(e.marginXXS)}`,fontSize:r,cursor:`pointer`,transition:`all ${e.motionDurationSlow}`,color:i,"&:hover":{color:i},svg:{verticalAlign:`baseline`}}},[`${s}-thumbnail, ${s}-thumbnail img`]:{position:`static`,display:`block`,width:`100%`,height:`100%`,objectFit:`contain`},[`${s}-name`]:{display:`none`,textAlign:`center`},[`${s}-file + ${s}-name`]:{position:`absolute`,bottom:e.margin,display:`block`,width:`calc(100% - ${l(a(e.paddingXS).mul(2).equal())})`},[`${s}-uploading`]:{[`&${s}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:`none`}},[`${s}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${l(a(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}},[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:`50%`}}}},me=e=>{let{componentCls:t}=e;return{[`${t}-rtl`]:{direction:`rtl`}}},he=e=>{let{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:{...y(e),[t]:{outline:0,"input[type='file']":{cursor:`pointer`}},[`${t}-select`]:{display:`inline-block`},[`${t}-hidden`]:{display:`none`},[`${t}-disabled`]:{color:n,cursor:`not-allowed`}}}},ge=E(`Upload`,e=>{let{fontSizeHeading3:t,marginXS:n,lineWidth:r,pictureCardSize:i,calc:a}=e,o=O(e,{uploadThumbnailSize:a(t).mul(2).equal(),uploadProgressOffset:a(a(n).div(2)).add(r).equal(),uploadPicCardSize:i});return[he(o),fe(o),X(o),pe(o),J(o),Y(o),me(o),M(o)]},e=>({actionsColor:e.colorIcon,pictureCardSize:e.controlHeightLG*2.55}));function _e(e){return{...e,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e}}function ve(e,t){let n=m(t),r=n.findIndex(({uid:t})=>t===e.uid);return r===-1?n.push(e):n[r]=e,n}function ye(e,t){let n=e.uid===void 0?`name`:`uid`;return t.filter(t=>t[n]===e[n])[0]}function be(e,t){let n=e.uid===void 0?`name`:`uid`,r=t.filter(t=>t[n]!==e[n]);return r.length===t.length?null:r}var xe=(e=``)=>{let t=e.split(`/`),n=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[``])[0]},Se=e=>e.indexOf(`image/`)===0,Ce=[`.avif`,`.bmp`,`.dpg`,`.gif`,`.heic`,`.heif`,`.ico`,`.jfif`,`.jpg`,`.jpeg`,`.png`,`.svg`,`.tif`,`.tiff`,`.webp`],we=e=>{if(e.type&&!e.thumbUrl)return Se(e.type);let t=e.thumbUrl||e.url||``,n=xe(t||e.name);return/^data:image\//.test(t)||Ce.includes(n?.toLowerCase()||``)?!0:!(/^data:/.test(t)||n)},Z=200;function Te(e){return new Promise(t=>{if(!e.type||!Se(e.type)){t(``);return}if(e.type.startsWith(`image/gif`)){let n=new FileReader;n.onload=()=>{n.result&&t(n.result)},n.readAsDataURL(e);return}let n=document.createElement(`canvas`);n.width=Z,n.height=Z,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${Z}px; height: ${Z}px; z-index: 9999; display: none;`,document.body.appendChild(n);let r=n.getContext(`2d`),i=new Image;if(i.onload=()=>{let{width:e,height:a}=i,o=Z,s=Z,c=0,l=0;e>a?(s=Z/e*a,l=-(s-o)/2):(o=Z/a*e,c=-(o-s)/2),r.drawImage(i,c,l,o,s);let u=n.toDataURL();document.body.removeChild(n),window.URL.revokeObjectURL(i.src),t(u)},i.crossOrigin=`anonymous`,e.type.startsWith(`image/svg+xml`)){let t=new FileReader;t.onload=()=>{t.result&&typeof t.result==`string`&&(i.src=t.result)},t.readAsDataURL(e)}else i.src=window.URL.createObjectURL(e)})}var Ee=P.forwardRef(({prefixCls:e,className:t,style:r,classNames:i,styles:s,locale:c,listType:l,file:u,items:d,progress:f,iconRender:p,actionIconRender:m,itemRender:g,isImgUrl:_,showPreviewIcon:v,showRemoveIcon:y,showDownloadIcon:b,previewIcon:x,removeIcon:S,downloadIcon:C,extra:w,onPreview:T,onDownload:ee,onClose:E},D)=>{let{status:O}=u,[k,A]=P.useState(O);P.useEffect(()=>{O!==`removed`&&A(O)},[O]);let[ne,re]=te(!1);P.useEffect(()=>{re(!0,{ms:300})},[]);let M=p(u),N=P.createElement(`div`,{className:`${e}-icon`},M);if(l===`picture`||l===`picture-card`||l===`picture-circle`){if(k===`uploading`||!u.thumbUrl&&!u.url){let t=h(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:k!==`uploading`});N=P.createElement(`div`,{className:t},M)}else{let t=_?.(u)?P.createElement(`img`,{src:u.thumbUrl||u.url,alt:u.name,className:`${e}-list-item-image`,crossOrigin:u.crossOrigin}):M,n=h(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:_&&!_(u)});N=P.createElement(`a`,{className:n,onClick:e=>T(u,e),href:u.url||u.thumbUrl,target:`_blank`,rel:`noopener noreferrer`},t)}}let ce=h(`${e}-list-item`,`${e}-list-item-${k}`,i?.item),le=typeof u.linkProps==`string`?JSON.parse(u.linkProps):u.linkProps,ue=(a(y)?y(u):y)?m((a(S)?S(u):S)||P.createElement(se,null),()=>E(u),e,c.removeFile,!0):null,F=(a(b)?b(u):b)&&k===`done`?m((a(C)?C(u):C)||P.createElement(oe,null),()=>ee(u),e,c.downloadFile):null,I=l!==`picture-card`&&l!==`picture-circle`&&P.createElement(`span`,{key:`download-delete`,className:h(`${e}-list-item-actions`,{picture:l===`picture`})},F,ue),L=a(w)?w(u):w,R=L&&P.createElement(`span`,{className:`${e}-list-item-extra`},L),z=h(`${e}-list-item-name`),B=u.url?P.createElement(`a`,{key:`view`,target:`_blank`,rel:`noopener noreferrer`,className:z,title:u.name,...le,href:u.url,onClick:e=>T(u,e)},u.name,R):P.createElement(`span`,{key:`view`,role:`button`,tabIndex:0,className:z,onClick:e=>T(u,e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T(u,e))},title:u.name},u.name,R),V=(a(v)?v(u):v)&&(u.url||u.thumbUrl)?P.createElement(`a`,{href:u.url||u.thumbUrl,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>T(u,e),title:c.previewFile,"aria-label":c.previewFile||void 0},a(x)?x(u):x||P.createElement(ie,null)):null,H=(l===`picture-card`||l===`picture-circle`)&&k!==`uploading`&&P.createElement(`span`,{className:`${e}-list-item-actions`},V,k===`done`&&F,ue),{getPrefixCls:U}=P.useContext(n),W=U(),G=P.createElement(`div`,{className:ce,style:s?.item},N,B,I,H,ne&&P.createElement(o,{motionName:`${W}-fade`,visible:k===`uploading`,motionDeadline:2e3},({className:t})=>{let n=`percent`in u?P.createElement(ae,{type:`line`,percent:u.percent,"aria-label":u[`aria-label`],"aria-labelledby":u[`aria-labelledby`],...f}):null;return P.createElement(`div`,{className:h(`${e}-list-item-progress`,t)},n)})),K=u.response&&typeof u.response==`string`?u.response:u.error?.statusText||u.error?.message||c.uploadError,q=k===`error`?P.createElement(j,{title:K,getPopupContainer:e=>e.parentNode},G):G;return P.createElement(`div`,{className:h(`${e}-list-item-container`,t),style:r,ref:D},g?g(q,u,d,{download:ee.bind(null,u),preview:T.bind(null,u),remove:E.bind(null,u)}):q)}),De=P.forwardRef((e,r)=>{let{listType:i=`text`,previewFile:s=Te,onPreview:l,onDownload:u,onRemove:d,locale:f,iconRender:p,isImageUrl:g=we,prefixCls:_,items:v=[],showPreviewIcon:y=!0,showRemoveIcon:x=!0,showDownloadIcon:S=!1,removeIcon:C,previewIcon:w,downloadIcon:ee,extra:E,progress:O={size:[-1,2],showInfo:!1},appendAction:te,appendActionVisible:k=!0,itemRender:A,disabled:j,classNames:ne,styles:M}=e,[,ie]=re(),[ae,oe]=P.useState(!1),se=[`picture-card`,`picture-circle`].includes(i);P.useEffect(()=>{i.startsWith(`picture`)&&(v||[]).forEach(e=>{(e.originFileObj instanceof File||e.originFileObj instanceof Blob)&&e.thumbUrl===void 0&&(e.thumbUrl=``,s?.(e.originFileObj).then(t=>{e.thumbUrl=t||``,ie()}))})},[i,v,s]),P.useEffect(()=>{oe(!0)},[]);let F=(e,t)=>{if(l)return t?.preventDefault(),l(e)},I=e=>{a(u)?u(e):e.url&&window.open(e.url,`_blank`,`noopener`)},L=e=>{d?.(e)},R=e=>{if(p)return p(e,i);let t=e.status===`uploading`;if(i.startsWith(`picture`)){let n=i===`picture`?P.createElement(T,null):f.uploading,r=g?.(e)?P.createElement(ce,null):P.createElement(ue,null);return t?n:r}return t?P.createElement(T,null):P.createElement(le,null)},z=(e,t,n,r,i)=>{let a={type:`text`,size:`small`,title:r,"aria-label":r||void 0,onClick:n=>{t(),P.isValidElement(e)&&e.props.onClick?.(n)},className:`${n}-list-item-action`,disabled:i?j:!1};return P.isValidElement(e)?P.createElement(N,{...a,icon:D(e,{...e.props,onClick:()=>{}})}):P.createElement(N,{...a},P.createElement(`span`,null,e))};P.useImperativeHandle(r,()=>({handlePreview:F,handleDownload:I}));let{getPrefixCls:B}=P.useContext(n),V=B(`upload`,_),H=B(),U=h(`${V}-list`,`${V}-list-${i}`,ne?.list),W=P.useMemo(()=>t(b(H),[`onAppearEnd`,`onEnterEnd`,`onLeaveEnd`]),[H]),G={...se?{}:W,motionDeadline:2e3,motionName:`${V}-${se?`animate-inline`:`animate`}`,keys:m(v.map(e=>({key:e.uid,file:e}))),motionAppear:ae};return P.createElement(`div`,{className:U,style:M?.list},P.createElement(c,{...G,component:!1},({key:e,file:t,className:n,style:r})=>P.createElement(Ee,{key:e,locale:f,prefixCls:V,className:n,style:r,classNames:ne,styles:M,file:t,items:v,progress:O,listType:i,isImgUrl:g,showPreviewIcon:y,showRemoveIcon:x,showDownloadIcon:S,removeIcon:C,previewIcon:w,downloadIcon:ee,extra:E,iconRender:R,actionIconRender:z,itemRender:A,onPreview:F,onDownload:I,onClose:L})),te&&P.createElement(o,{...G,visible:k,forceRender:!0},({className:e,style:t})=>D(te,n=>({className:h(n.className,e),style:{...t,pointerEvents:e?`none`:void 0,...n.style}}))))}),Q=`__LIST_IGNORE_${Date.now()}__`,Oe=P.forwardRef((e,t)=>{let n=s(`upload`),{fileList:o,defaultFileList:c,onRemove:l,showUploadList:u=!0,listType:d=`text`,onPreview:f,onDownload:p,onChange:g,onDrop:_,previewFile:y,disabled:b,locale:w,iconRender:T,isImageUrl:E,progress:D,prefixCls:O,className:te,type:A=`select`,children:j,style:re,itemRender:M,maxCount:N,data:ie={},multiple:ae=!1,hasControlInside:oe=!0,action:se=``,accept:ce,supportServerRender:le=!0,rootClassName:ue,styles:I,classNames:L}=e,R=P.useContext(v),z=b??R,B=e.customRequest||n.customRequest,V=n.progress||D?{...n.progress,...D}:void 0,H=ne(ce,n.accept,``),[U,W]=i(c,o),G=U||[],K=S(()=>G),[q,fe]=P.useState(`drop`),J=P.useRef(null),Y=P.useRef(null);P.useMemo(()=>{let e=Date.now();(o||[]).forEach((t,n)=>{!t.uid&&!Object.isFrozen(t)&&(t.uid=`__AUTO__${e}_${n}__`)})},[o]);let X=(e,t,n)=>{let r=m(t),i=!1;N===1?r=r.slice(-1):N&&(i=r.length>N,r=r.slice(0,N)),(0,F.flushSync)(()=>{W(r)});let a={file:e,fileList:r};n&&(a.event=n),(!i||e.status===`removed`||r.some(t=>t.uid===e.uid))&&(0,F.flushSync)(()=>{g?.(a)})},pe=async(t,n)=>{let{beforeUpload:r}=e,i=t;if(r){let e=await r(t,n);if(e===!1)return!1;if(delete t[Q],e===Q)return Object.defineProperty(t,Q,{value:!0,configurable:!0}),!1;C(e)&&(i=e)}return i},me=e=>{let t=e.filter(e=>!e.file[Q]);if(!t.length)return;let n=t.map(e=>_e(e.file)),r=m(G);n.forEach(e=>{r=ve(e,r)}),n.forEach((e,n)=>{let i=e;if(t[n].parsedFile)e.status=`uploading`;else{let{originFileObj:t}=e,n;try{n=new File([t],t.name,{type:t.type})}catch{n=new Blob([t],{type:t.type}),n.name=t.name,n.lastModifiedDate=new Date,n.lastModified=new Date().getTime()}n.uid=e.uid,i=n}X(i,r)})},he=(e,t,n)=>{try{typeof e==`string`&&(e=JSON.parse(e))}catch{}if(!ye(t,G))return;let r=_e(t);r.status=`done`,r.percent=100,r.response=e,r.xhr=n;let i=ve(r,G);X(r,i)},xe=(e,t)=>{if(!ye(t,G))return;let n=_e(t);n.status=`uploading`,n.percent=e.percent;let r=ve(n,G);X(n,r,e)},Se=(e,t,n)=>{if(!ye(n,G))return;let r=_e(n);r.error=e,r.response=t,r.status=`error`;let i=ve(r,G);X(r,i)},Ce=e=>{let t;Promise.resolve(a(l)?l(e):l).then(n=>{if(n===!1)return;let r=K(),i=be(e,r);i&&(t={...e,status:`removed`},r.forEach(e=>{let n=t.uid===void 0?`name`:`uid`;e[n]===t[n]&&!Object.isFrozen(e)&&(e.status=`removed`)}),J.current?.abort(t),X(t,i))})},we=e=>{fe(e.type),e.type===`drop`&&_?.(e)};P.useImperativeHandle(t,()=>({onBatchStart:me,onSuccess:he,onProgress:xe,onError:Se,fileList:G,upload:J.current,nativeElement:Y.current}));let{getPrefixCls:Z,direction:Te,className:Ee,style:Oe,classNames:ke,styles:Ae}=s(`upload`),$=Z(`upload`,O),je={...e,listType:d,showUploadList:u,type:A,multiple:ae,hasControlInside:oe,supportServerRender:le,disabled:z},Me=k(Oe,`trigger`),Ne=k(re,`trigger`),[Pe,Fe]=r([ke,L],[Ae,Me,I,Ne],{props:je}),Ie={onBatchStart:me,onError:Se,onProgress:xe,onSuccess:he,...e,customRequest:B,data:ie,multiple:ae,action:se,accept:H,supportServerRender:le,prefixCls:$,disabled:z,beforeUpload:pe,onChange:void 0,hasControlInside:oe};delete Ie.className,delete Ie.style,(!j||z)&&delete Ie.id;let Le=`${$}-wrapper`,[Re,ze]=ge($,Le),[Be]=ee(`Upload`,x.Upload),{showRemoveIcon:Ve,showPreviewIcon:He,showDownloadIcon:Ue,removeIcon:We,previewIcon:Ge,downloadIcon:Ke,extra:qe}=typeof u==`boolean`?{}:u,Je=Ve===void 0?!z:Ve,Ye=(e,t)=>u?P.createElement(De,{classNames:Pe,styles:Fe,prefixCls:$,listType:d,items:G,previewFile:y,onPreview:f,onDownload:p,onRemove:Ce,showRemoveIcon:Je,showPreviewIcon:He,showDownloadIcon:Ue,removeIcon:We,previewIcon:Ge,downloadIcon:Ke,iconRender:T,extra:qe,locale:{...Be,...w},isImageUrl:E,progress:V,appendAction:e,appendActionVisible:t,itemRender:M,disabled:z}):e,Xe=h(Le,te,ue,Re,ze,Ee,Pe.root,{[`${$}-rtl`]:Te===`rtl`,[`${$}-picture-card-wrapper`]:d===`picture-card`,[`${$}-picture-circle-wrapper`]:d===`picture-circle`}),Ze={...Fe.root};if(A===`drag`){let e=h(Re,$,`${$}-drag`,{[`${$}-drag-uploading`]:G.some(e=>e.status===`uploading`),[`${$}-drag-hover`]:q===`dragover`,[`${$}-disabled`]:z,[`${$}-rtl`]:Te===`rtl`},Pe.trigger);return P.createElement(`span`,{className:Xe,ref:Y,style:Ze},P.createElement(`div`,{className:e,style:Fe.trigger,onDrop:we,onDragOver:we,onDragLeave:we},P.createElement(de,{...Ie,ref:J,className:`${$}-btn`},P.createElement(`div`,{className:`${$}-drag-container`},j))),Ye())}let Qe=h($,`${$}-select`,{[`${$}-disabled`]:z,[`${$}-hidden`]:!j},Pe.trigger),$e=P.createElement(`div`,{className:Qe,style:Fe.trigger},P.createElement(de,{...Ie,ref:J}));return d===`picture-card`||d===`picture-circle`?P.createElement(`span`,{className:Xe,ref:Y,style:Ze},Ye($e,!!j)):P.createElement(`span`,{className:Xe,ref:Y,style:Ze},$e,Ye())}),ke=P.forwardRef((e,t)=>{let{style:n,height:r,hasControlInside:i=!1,children:a,...o}=e,s={...n,height:r};return P.createElement(Oe,{ref:t,hasControlInside:i,...o,style:s,type:`drag`},a)}),Ae=Oe;Ae.Dragger=ke,Ae.LIST_IGNORE=Q;export{Ae as t};