Files
xin-school/public/assets/upload-DrAEBKrg.js
T
2026-06-17 13:08:53 +08:00

24 lines
41 KiB
JavaScript

import{$ as e,$i as t,$r as n,Bi as r,Br as i,Ca as a,Ci as o,Dn as s,Ea as c,Ei as l,Fi as u,Gr as d,Ir as f,Ji as p,Li as m,Lr as h,Mr as g,Ni as _,Or as v,Ot as y,Qr as b,Ri as x,Sa as S,Si as C,Wn as w,Wr as T,Xr as E,Yi as D,Yr as O,_i as k,ai as A,br as j,cr as M,di as N,et as P,fa as F,ni as I,nt as L,oi as ee,ot as te,pa as R,pi as z,si as ne,ti as re,tt as B,xi as V,xr as H,yi as U,zi as W,zr as ie}from"./index-DThTpSPU.js";var G=c(S()),K=c(a()),q={percent:0,prefixCls:`rc-progress`,strokeColor:`#2db7f5`,strokeLinecap:`round`,strokeWidth:1,railColor:`#D9D9D9`,railWidth:1,gapPosition:`bottom`,loading:!1},ae=()=>{let e=(0,K.useRef)([]),t=(0,K.useRef)(null);return(0,K.useEffect)(()=>{let n=Date.now(),r=!1;e.current.forEach(e=>{if(!e)return;r=!0;let i=e.style;i.transitionDuration=`.3s, .3s, .3s, .06s`,t.current&&n-t.current<100&&(i.transitionDuration=`0s, 0s`)}),r&&(t.current=Date.now())}),e.current},J=({bg:e,children:t})=>K.createElement(`div`,{style:{width:`100%`,height:`100%`,background:e}},t);function oe(e,t){return Object.keys(e).map(n=>{let r=`${Math.floor(parseFloat(n)*t)}%`;return`${e[n]} ${r}`})}var se=K.forwardRef((e,t)=>{let{prefixCls:n,color:i,gradientId:a,radius:o,className:s,style:c,ptg:l,strokeLinecap:u,strokeWidth:d,size:f,gapDegree:p}=e,m=i&&typeof i==`object`,h=m?`#FFF`:void 0,g=f/2,_=K.createElement(`circle`,{className:r(`${n}-circle-path`,s),r:o,cx:g,cy:g,stroke:h,strokeLinecap:u,strokeWidth:d,opacity:l===0?0:1,style:c,ref:t});if(!m)return _;let v=`${a}-conic`,y=p?`${180+p/2}deg`:`0deg`,b=oe(i,(360-p)/360),x=oe(i,1),S=`conic-gradient(from ${y}, ${b.join(`, `)})`,C=`linear-gradient(to ${p?`bottom`:`top`}, ${x.join(`, `)})`;return K.createElement(K.Fragment,null,K.createElement(`mask`,{id:v},_),K.createElement(`foreignObject`,{x:0,y:0,width:f,height:f,mask:`url(#${v})`},K.createElement(J,{bg:C},K.createElement(J,{bg:S}))))}),Y=(e,t,n,r,i,a,o,s,c,l,u=0)=>{let d=n/100*360*((360-a)/360),f=a===0?0:{bottom:0,top:180,left:90,right:-90}[o],p=(100-r)/100*t;return c===`round`&&r!==100&&(p+=l/2,p>=t&&(p=t-.01)),{stroke:typeof s==`string`?s:void 0,strokeDasharray:`${t}px ${e}`,strokeDashoffset:p+u,transform:`rotate(${i+d+f}deg)`,transformOrigin:`50px 50px`,transition:`stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s`,fillOpacity:0}},ce=(({id:e,loading:t})=>{if(!t)return{indeterminateStyleProps:{},indeterminateStyleAnimation:null};let n=`${e}-indeterminate-animate`;return{indeterminateStyleProps:{transform:`rotate(0deg)`,animation:`${n} 1s linear infinite`},indeterminateStyleAnimation:K.createElement(`style`,null,`@keyframes ${n} {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}`)}});function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(this,arguments)}function le(e){let t=e??[];return Array.isArray(t)?t:[t]}var ue=e=>{let{id:t,prefixCls:n,classNames:i={},styles:a={},steps:o,strokeWidth:s,railWidth:c,gapDegree:l=0,gapPosition:u,railColor:d,strokeLinecap:f,style:p,className:m,strokeColor:h,percent:g,loading:_,...v}={...q,...e},y=F(t),b=`${y}-gradient`,x=50-s/2,S=Math.PI*2*x,C=l>0?90+l/2:-90,w=S*((360-l)/360),{count:T,gap:E}=typeof o==`object`?o:{count:o,gap:2},D=le(g),O=le(h),k=O.find(e=>e&&typeof e==`object`),A=k&&typeof k==`object`?`butt`:f,{indeterminateStyleProps:j,indeterminateStyleAnimation:M}=ce({id:y,loading:_}),N=Y(S,w,0,100,C,l,u,d,A,s),P=ae(),I=()=>{let e=0;return D.map((t,r)=>{let o=O[r]||O[O.length-1],c=Y(S,w,e,t,C,l,u,o,A,s);return e+=t,K.createElement(se,{key:r,color:o,ptg:t,radius:x,prefixCls:n,gradientId:b,className:i.track,style:{...c,...j,...a.track},strokeLinecap:A,strokeWidth:s,gapDegree:l,ref:e=>{P[r]=e},size:100})}).reverse()},L=()=>{let e=Math.round(T*(D[0]/100)),t=100/T,o=0;return Array(T).fill(null).map((c,f)=>{let p=f<=e-1?O[0]:d,m=p&&typeof p==`object`?`url(#${b})`:void 0,h=Y(S,w,o,t,C,l,u,p,`butt`,s,E);return o+=(w-h.strokeDashoffset+E)*100/w,K.createElement(`circle`,{key:f,className:r(`${n}-circle-path`,i.track),r:x,cx:50,cy:50,stroke:m,strokeWidth:s,opacity:1,style:{...h,...a.track},ref:e=>{P[f]=e}})})};return K.createElement(`svg`,X({className:r(`${n}-circle`,i.root,m),viewBox:`0 0 100 100`,style:{...a.root,...p},id:t,role:`presentation`},v),!T&&K.createElement(`circle`,{className:r(`${n}-circle-rail`,i.rail),r:x,cx:50,cy:50,stroke:d,strokeLinecap:A,strokeWidth:c||s,style:{...N,...a.rail}}),T?L():I(),M)};function Z(e){return!e||e<0?0:e>100?100:e}function de({success:e}){let t;return e&&`percent`in e&&(t=e.percent),t}var fe=({percent:e,success:t})=>{let n=Z(de({success:t}));return[n,Z(Z(e)-n)]},pe=({success:e={},strokeColor:t})=>{let{strokeColor:n}=e;return[n||C.green,t||null]},me=(e,t,n)=>{let r=-1,i=-1;if(t===`step`){let t=n.steps,a=n.strokeWidth;typeof e==`string`||e===void 0?(r=e===`small`?2:14,i=a??8):b(e)?[r,i]=[e,e]:[r=14,i=8]=Array.isArray(e)?e:[e.width,e.height],r*=t}else if(t===`line`){let t=n?.strokeWidth;typeof e==`string`||e===void 0?i=t||(e===`small`?6:8):b(e)?[r,i]=[e,e]:[r=-1,i=8]=Array.isArray(e)?e:[e.width,e.height]}else (t===`circle`||t===`dashboard`)&&(typeof e==`string`||e===void 0?[r,i]=e===`small`?[60,60]:[120,120]:b(e)?[r,i]=[e,e]:Array.isArray(e)&&(r=e[0]??e[1]??120,i=e[0]??e[1]??120));return[r,i]},he=3,ge=e=>he/e*100,_e=[`root`,`body`,`indicator`],ve=e=>{let{prefixCls:t,classNames:i,styles:a,railColor:o,trailColor:c,strokeLinecap:l=`round`,gapPosition:u,gapPlacement:d,gapDegree:f,width:p=120,type:m,children:h,success:g,size:_=p,steps:v}=e,{direction:y}=x(`progress`),b=o??c,[S,C]=me(_,`circle`),{strokeWidth:w}=e;w===void 0&&(w=Math.max(ge(S),6));let T={width:S,height:C,fontSize:S*.15+6},E=K.useMemo(()=>{if(f||f===0)return f;if(m===`dashboard`)return 75},[f,m]),O=fe(e),k=K.useMemo(()=>{let e=(d??u)||m===`dashboard`&&`bottom`||void 0,t=y===`rtl`;switch(e){case`start`:return t?`right`:`left`;case`end`:return t?`left`:`right`;default:return e}},[y,d,u,m]),A=n(e.strokeColor),j=pe({success:g,strokeColor:e.strokeColor}),M=r(`${t}-body`,{[`${t}-circle-gradient`]:A},i.body),N=K.createElement(ue,{steps:v,percent:v?O[1]:O,strokeWidth:w,railWidth:w,strokeColor:v?j[1]:j,strokeLinecap:l,railColor:b,prefixCls:t,gapDegree:E,gapPosition:k,classNames:D(i,_e),styles:D(a,_e)}),P=S<=20,F=K.createElement(`div`,{className:M,style:{...T,...a.body}},N,!P&&h);return P?K.createElement(s,{title:h},F):F},ye=`--progress-line-stroke-color`,be=e=>{let t=e?`100%`:`-100%`;return new _(`antProgress${e?`RTL`:`LTR`}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:`translateX(0) scaleX(1)`,opacity:0}})},Q=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:{...k(e),display:`inline-flex`,"&-rtl":{direction:`rtl`},[`${t}-indicator`]:{color:e.colorText,lineHeight:1,whiteSpace:`nowrap`,verticalAlign:`middle`,wordBreak:`normal`,[n]:{fontSize:e.fontSize}},[`&${t}-status-exception`]:{[`${t}-indicator`]:{color:e.colorError}},[`&${t}-status-success`]:{[`${t}-indicator`]:{color:e.colorSuccess}}}}},xe=e=>{let{componentCls:t}=e;return{[`${t}-line`]:{position:`relative`,width:`100%`,fontSize:e.fontSize,[`${t}-body`]:{display:`inline-flex`,alignItems:`center`,width:`100%`,gap:e.marginXS},[`${t}-rail`]:{flex:`auto`,background:e.remainingColor,borderRadius:e.lineBorderRadius,position:`relative`,width:`100%`,overflow:`hidden`},[`&${t}-status-active`]:{[`${t}-track:after`]:{content:`""`,position:`absolute`,inset:0,backgroundColor:e.colorBgContainer,borderRadius:`inherit`,opacity:0,animationName:be(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:`infinite`}},[`${t}-track`]:{position:`absolute`,insetInlineStart:0,insetBlock:0,borderRadius:`inherit`,background:e.defaultColor,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,minWidth:`max-content`,display:`flex`,alignItems:`center`,"&-success":{background:e.colorSuccess}},[`&${t}-status-exception`]:{[`${t}-track`]:{background:e.colorError}},[`&${t}-status-success`]:{[`${t}-track`]:{background:e.colorSuccess}},[`${t}-indicator-outer`]:{[`&${t}-indicator-start`]:{order:-1}},[`${t}-body-layout-bottom`]:{flexDirection:`column`,alignItems:`center`,gap:e.marginXXS},[`${t}-indicator${t}-indicator-inner`]:{color:e.colorWhite,paddingInline:e.paddingXXS,width:`100%`,display:`flex`,justifyContent:`center`,[`&${t}-indicator-end`]:{justifyContent:`end`},[`&${t}-indicator-start`]:{justifyContent:`start`},[`&${t}-indicator-bright`]:{color:`rgba(0, 0, 0, 0.45)`}}}}},Se=e=>{let{componentCls:t,iconCls:n}=e;return{[`${t}-circle`]:{[`${t}-circle-rail`]:{stroke:e.remainingColor},[`${t}-body:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-body`]:{position:`relative`,lineHeight:1,backgroundColor:`transparent`},[`${t}-indicator`]:{position:`absolute`,insetBlockStart:`50%`,insetInlineStart:0,width:`100%`,margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:`normal`,textAlign:`center`,transform:`translateY(-50%)`,[n]:{fontSize:e.circleIconFontSize}},[`&${t}-status-exception`]:{[`${t}-body:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}}},[`&${t}-status-success`]:{[`${t}-body:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:`bottom`}}}},Ce=e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:`inline-block`,"&-body":{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:e.progressStepMarginInlineEnd,[`${t}-indicator`]:{marginInlineStart:e.marginXS}},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}},we=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-indicator ${n}`]:{fontSize:e.fontSizeSM}}}},Te=N(`Progress`,e=>{let t=e.calc(e.marginXXS).div(2).equal(),n=l(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:`2.4s`});return[Q(n),xe(n),Se(n),Ce(n),we(n)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:`1em`,circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`})),Ee=e=>{let t=[];return Object.keys(e).forEach(n=>{let r=Number.parseFloat(n.replace(/%/g,``));Number.isNaN(r)||t.push({key:r,value:e[n]})}),t=t.sort((e,t)=>e.key-t.key),t.map(({key:e,value:t})=>`${t} ${e}%`).join(`, `)},De=(e,t)=>{let{from:n=C.blue,to:r=C.blue,direction:i=t===`rtl`?`to left`:`to right`,...a}=e;if(Object.keys(a).length!==0){let e=`linear-gradient(${i}, ${Ee(a)})`;return{background:e,[ye]:e}}let o=`linear-gradient(${i}, ${n}, ${r})`;return{background:o,[ye]:o}},Oe=e=>{let{prefixCls:t,classNames:n,styles:i,direction:a,percent:o,size:s,strokeWidth:c,strokeColor:l,strokeLinecap:u=`round`,children:d,railColor:f,trailColor:p,percentPosition:m,success:h}=e,{align:g,type:_}=m,v=f??p,y=u===`square`||u===`butt`?0:void 0,[b,x]=me(s??[-1,c||(s===`small`?6:8)],`line`,{strokeWidth:c}),S={backgroundColor:v||void 0,borderRadius:y,height:x},C=`${t}-track`,w=l&&typeof l!=`string`?De(l,a):{[ye]:l,background:l},T={width:`${Z(o)}%`,height:x,borderRadius:y,...w},E=de(e),D={width:`${Z(E)}%`,height:x,borderRadius:y,backgroundColor:h?.strokeColor};return K.createElement(`div`,{className:r(`${t}-body`,n.body,{[`${t}-body-layout-bottom`]:g===`center`&&_===`outer`}),style:{width:b>0?b:`100%`,...i.body}},K.createElement(`div`,{className:r(`${t}-rail`,n.rail),style:{...S,...i.rail}},K.createElement(`div`,{className:r(C,n.track),style:{...T,...i.track}},_===`inner`&&d),E!==void 0&&K.createElement(`div`,{className:r(C,`${C}-success`,n.track),style:{...D,...i.track}})),_===`outer`&&d)},ke=e=>{let{classNames:t,styles:n,size:i,steps:a,rounding:o=Math.round,percent:s=0,strokeWidth:c=8,strokeColor:l,railColor:u,trailColor:d,prefixCls:f,children:p}=e,m=o(s/100*a),[h,g]=me(i??[i===`small`?2:14,c],`step`,{steps:a,strokeWidth:c}),_=h/a,v=Array.from({length:a}),y=u??d;for(let e=0;e<a;e++){let i=Array.isArray(l)?l[e]:l;v[e]=K.createElement(`div`,{key:e,className:r(`${f}-steps-item`,{[`${f}-steps-item-active`]:e<=m-1},t.track),style:{backgroundColor:e<=m-1?i:y,width:_,height:g,...n.track}})}return K.createElement(`div`,{className:r(`${f}-steps-body`,t.body),style:n.body},v,p)},Ae=[`normal`,`exception`,`active`,`success`],je=K.forwardRef((e,t)=>{let{prefixCls:i,className:a,rootClassName:s,classNames:c,styles:l,steps:u,strokeColor:d,percent:f=0,size:p=`medium`,showInfo:m=!0,type:h=`line`,status:g,format:_,style:v,percentPosition:y={},...b}=e,{align:S=`end`,type:C=`outer`}=y,T=Array.isArray(d)?d[0]:d,E=typeof d==`string`||Array.isArray(d)?d:void 0,k=K.useMemo(()=>T?new o(typeof T==`string`?T:Object.values(T)[0]).isLight():!1,[d]),j=K.useMemo(()=>{let t=de(e);return Number.parseInt(t===void 0?(f??0)?.toString():(t??0)?.toString(),10)},[f,e.success]),M=K.useMemo(()=>!Ae.includes(g)&&j>=100?`success`:g||`normal`,[g,j]),{getPrefixCls:N,direction:P,className:F,style:I,classNames:L,styles:te}=x(`progress`),R=N(`progress`,i),[z,re]=Te(R),B={...e,percent:f,type:h,size:p,showInfo:m,percentPosition:y},[V,H]=O([L,c],[te,l],{props:B}),U=h===`line`,W=U&&!u,ie=K.useMemo(()=>{if(!m)return null;let t=de(e),n,i=_||(e=>`${e}%`),a=U&&k&&C===`inner`;return C===`inner`||_||M!==`exception`&&M!==`success`?n=i(Z(f),Z(t)):M===`exception`?n=U?K.createElement(ee,null):K.createElement(A,null):M===`success`&&(n=U?K.createElement(ne,null):K.createElement(w,null)),K.createElement(`span`,{className:r(`${R}-indicator`,{[`${R}-indicator-bright`]:a,[`${R}-indicator-${S}`]:W,[`${R}-indicator-${C}`]:W},V.indicator),style:H.indicator,title:typeof n==`string`?n:void 0},n)},[m,f,j,M,h,R,_,U,k,C,S,W,V.indicator,H.indicator]),G={...e,classNames:V,styles:H},q;h===`line`?q=u?K.createElement(ke,{...G,strokeColor:E,prefixCls:R,steps:n(u)?u.count:u},ie):K.createElement(Oe,{...G,strokeColor:T,prefixCls:R,direction:P,percentPosition:{align:S,type:C}},ie):(h===`circle`||h===`dashboard`)&&(q=K.createElement(ve,{...G,strokeColor:T,prefixCls:R,progressStatus:M},ie));let ae=r(R,`${R}-status-${M}`,{[`${R}-${h===`dashboard`&&`circle`||h}`]:h!==`line`,[`${R}-inline-circle`]:h===`circle`&&me(p,`circle`)[0]<=20,[`${R}-line`]:W,[`${R}-line-align-${S}`]:W,[`${R}-line-position-${C}`]:W,[`${R}-steps`]:u,[`${R}-show-info`]:m,[`${R}-small`]:p===`small`,[`${R}-rtl`]:P===`rtl`},F,a,s,V.root,z,re);return K.createElement(`div`,{ref:t,style:{...I,...H.root,...v},className:ae,role:`progressbar`,"aria-valuenow":j,"aria-valuemin":0,"aria-valuemax":100,...D(b,[`railColor`,`trailColor`,`strokeWidth`,`width`,`gapDegree`,`gapPosition`,`gapPlacement`,`strokeLinecap`,`success`])},q)}),Me=((e,n)=>{if(e&&n){let r=Array.isArray(n)?n:n.split(`,`),i=e.name||``,a=e.type||``,o=a.replace(/\/.*$/,``);return r.some(e=>{let n=e.trim();if(/^\*(\/\*)?$/.test(e))return!0;if(n.charAt(0)===`.`){let e=i.toLowerCase(),t=n.toLowerCase(),r=[t];return(t===`.jpg`||t===`.jpeg`)&&(r=[`.jpg`,`.jpeg`]),r.some(t=>e.endsWith(t))}return/\/\*$/.test(n)?o===n.replace(/\/.*$/,``):a===n?!0:/^\w+$/.test(n)?(t(!1,`Upload takes an invalidate 'accept' type '${n}'.Skip for check.`),!0):!1})}return!0});function Ne(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 Pe(e){let t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}function Fe(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(Ne(e,t),Pe(t)):e.onSuccess(Pe(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 Ie=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<r;t++)n.push(e[t])}return n}async function a(e){return new Promise(n=>{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<r.length;)await o(r[s]),s++;return n},Le=+new Date,Re=0;function ze(){return`rc-upload-${Le}-${++Re}`}function Be(){return Be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Be.apply(this,arguments)}var Ve=class extends K.Component{state={uid:ze()};reqs={};fileInput;_isMounted;filterFile=(e,t=!1)=>{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=>Me(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 Ie(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=ze(),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||Fe,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:Fe})}reset(){this.setState({uid:ze()})}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:i={},disabled:a,id:o,name:s,style:c,styles:l={},multiple:u,accept:d,capture:f,children:m,directory:h,openFileDialogOnClick:g,onMouseEnter:_,onMouseLeave:v,hasControlInside:y,...b}=this.props,x=typeof d==`string`?d:d?.format,S=r(t,{[`${t}-disabled`]:a,[n]:n}),C=h?{directory:`directory`,webkitdirectory:`webkitdirectory`}:{},w=a?{}:{onClick:g?this.onClick:()=>{},onKeyDown:g?this.onKeyDown:()=>{},onMouseEnter:_,onMouseLeave:v,onDrop:this.onFileDrop,onDragOver:this.onFileDragOver,tabIndex:y?void 0:`0`};return K.createElement(e,Be({},w,{className:S,role:y?void 0:`button`,style:c}),K.createElement(`input`,Be({},p(b,{aria:!0,data:!0}),{id:o,name:s,disabled:a,type:`file`,ref:this.saveFileInput,onClick:e=>e.stopPropagation(),key:this.state.uid,style:{display:`none`,...l.input},className:i.input,accept:x},C,{multiple:u,onChange:this.onChange},f==null?{}:{capture:f})),m)}};function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},He.apply(this,arguments)}function Ue(){}var We=class extends K.Component{static defaultProps={component:`span`,prefixCls:`rc-upload`,data:{},headers:{},name:`file`,multipart:!1,onStart:Ue,onError:Ue,onSuccess:Ue,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0,hasControlInside:!1};uploader;abort(e){this.uploader.abort(e)}saveUploader=e=>{this.uploader=e};render(){return K.createElement(Ve,He({},this.props,{ref:this.saveUploader}))}},Ge=e=>{let{componentCls:t,iconCls:n}=e;return{[`${t}-wrapper`]:{[`${t}-drag`]:{position:`relative`,width:`100%`,height:`100%`,textAlign:`center`,background:e.colorFillAlter,border:`${u(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:`${u(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 ${u(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}}}}}},Ke=e=>{let{componentCls:t,iconCls:n,fontSize:r,lineHeight:i,motionDurationSlow:a,calc:o}=e,s=`${t}-list-item`,c=`${s}-actions`,l=`${s}-action`;return{[`${t}-wrapper`]:{[`${t}-list`]:{...z(),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`]:{...U,padding:`0 ${u(e.paddingXS)}`,lineHeight:i,flex:`auto`,transition:`all ${a}`},[c]:{whiteSpace:`nowrap`,[l]:{opacity:0},"@media (hover: none), (pointer: coarse)":{[l]:{opacity:1}},[n]:{color:e.actionsColor,transition:`all ${a}`},[`
${l}:focus-visible,
&.picture ${l}
`]:{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 ${l}`]:{opacity:1},[`${s}-error`]:{color:e.colorError,[`${s}-name, ${t}-icon ${n}`]:{color:e.colorError},[c]:{[`${n}, ${n}:hover`]:{color:e.colorError},[l]:{opacity:1}}},[`${t}-list-item-container`]:{transition:[`opacity`,`height`].map(e=>`${e} ${a}`).join(`, `),"&::before":{display:`table`,width:0,height:0,content:`""`}}}}}},qe=e=>{let{componentCls:t}=e,n=new _(`uploadAnimateInlineIn`,{from:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),r=new _(`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`]:j(e)},n,r]},Je=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:`${u(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusLG,"&:hover":{background:`transparent`},[`${s}-thumbnail`]:{...U,width:r,height:r,lineHeight:u(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% - ${u(a(e.paddingSM).mul(2).equal())})`,marginTop:0,paddingInlineStart:a(r).add(e.paddingXS).equal()}},[`${s}-error`]:{borderColor:e.colorError,[`${s}-thumbnail ${n}`]:{[`svg path[fill='${V[0]}']`]:{fill:e.colorErrorBg},[`svg path[fill='${V.primary}']`]:{fill:e.colorError}}},[`${s}-uploading`]:{borderStyle:`dashed`,[`${s}-name`]:{marginBottom:i}}},[`${o}${o}-picture-circle ${s}`]:{[`&, &::before, ${s}-thumbnail`]:{borderRadius:`50%`}}}}},Ye=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
`]:{...z(),display:`block`,[`${t}${t}-select`]:{width:c,height:c,textAlign:`center`,verticalAlign:`top`,backgroundColor:e.colorFillAlter,border:`${u(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% - ${u(a(e.paddingXS).mul(2).equal())})`,height:`calc(100% - ${u(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 ${u(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% - ${u(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% - ${u(a(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}},[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:`50%`}}}},Xe=e=>{let{componentCls:t}=e;return{[`${t}-rtl`]:{direction:`rtl`}}},Ze=e=>{let{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:{...k(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`}}}},Qe=N(`Upload`,e=>{let{fontSizeHeading3:t,marginXS:n,lineWidth:r,pictureCardSize:i,calc:a}=e,o=l(e,{uploadThumbnailSize:a(t).mul(2).equal(),uploadProgressOffset:a(a(n).div(2)).add(r).equal(),uploadPicCardSize:i});return[Ze(o),Ge(o),Je(o),Ye(o),Ke(o),qe(o),Xe(o),H(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 et(e,t){let n=W(t),r=n.findIndex(({uid:t})=>t===e.uid);return r===-1?n.push(e):n[r]=e,n}function tt(e,t){let n=e.uid===void 0?`name`:`uid`;return t.filter(t=>t[n]===e[n])[0]}function nt(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 rt=(e=``)=>{let t=e.split(`/`),n=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[``])[0]},it=e=>e.indexOf(`image/`)===0,at=[`.avif`,`.bmp`,`.dpg`,`.gif`,`.heic`,`.heif`,`.ico`,`.jfif`,`.jpg`,`.jpeg`,`.png`,`.svg`,`.tif`,`.tiff`,`.webp`],ot=e=>{if(e.type&&!e.thumbUrl)return it(e.type);let t=e.thumbUrl||e.url||``,n=rt(t);return/^data:image\//.test(t)||at.includes(n?.toLowerCase()||``)?!0:!(/^data:/.test(t)||n)},$=200;function st(e){return new Promise(t=>{if(!e.type||!it(e.type)){t(``);return}let n=document.createElement(`canvas`);n.width=$,n.height=$,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${$}px; height: ${$}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=$,s=$,c=0,l=0;e>a?(s=$/e*a,l=-(s-o)/2):(o=$/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 if(e.type.startsWith(`image/gif`)){let n=new FileReader;n.onload=()=>{n.result&&t(n.result)},n.readAsDataURL(e)}else i.src=window.URL.createObjectURL(e)})}var ct=K.forwardRef(({prefixCls:t,className:n,style:i,classNames:a,styles:o,locale:c,listType:l,file:u,items:d,progress:f,iconRender:p,actionIconRender:h,itemRender:g,isImgUrl:_,showPreviewIcon:v,showRemoveIcon:b,showDownloadIcon:x,previewIcon:S,removeIcon:C,downloadIcon:w,extra:T,onPreview:D,onDownload:O,onClose:k},A)=>{let{status:j}=u,[M,N]=K.useState(j);K.useEffect(()=>{j!==`removed`&&N(j)},[j]);let[P,F]=K.useState(!1);K.useEffect(()=>{let e=setTimeout(()=>{F(!0)},300);return()=>{clearTimeout(e)}},[]);let I=p(u),L=K.createElement(`div`,{className:`${t}-icon`},I);if(l===`picture`||l===`picture-card`||l===`picture-circle`)if(M===`uploading`||!u.thumbUrl&&!u.url){let e=r(`${t}-list-item-thumbnail`,{[`${t}-list-item-file`]:M!==`uploading`});L=K.createElement(`div`,{className:e},I)}else{let e=_?.(u)?K.createElement(`img`,{src:u.thumbUrl||u.url,alt:u.name,className:`${t}-list-item-image`,crossOrigin:u.crossOrigin}):I,n=r(`${t}-list-item-thumbnail`,{[`${t}-list-item-file`]:_&&!_(u)});L=K.createElement(`a`,{className:n,onClick:e=>D(u,e),href:u.url||u.thumbUrl,target:`_blank`,rel:`noopener noreferrer`},e)}let ee=r(`${t}-list-item`,`${t}-list-item-${M}`,a?.item),R=typeof u.linkProps==`string`?JSON.parse(u.linkProps):u.linkProps,z=(E(b)?b(u):b)?h((E(C)?C(u):C)||K.createElement(te,null),()=>k(u),t,c.removeFile,!0):null,ne=(E(x)?x(u):x)&&M===`done`?h((E(w)?w(u):w)||K.createElement(e,null),()=>O(u),t,c.downloadFile):null,B=l!==`picture-card`&&l!==`picture-circle`&&K.createElement(`span`,{key:`download-delete`,className:r(`${t}-list-item-actions`,{picture:l===`picture`})},ne,z),V=E(T)?T(u):T,H=V&&K.createElement(`span`,{className:`${t}-list-item-extra`},V),U=r(`${t}-list-item-name`),W=u.url?K.createElement(`a`,{key:`view`,target:`_blank`,rel:`noopener noreferrer`,className:U,title:u.name,...R,href:u.url,onClick:e=>D(u,e)},u.name,H):K.createElement(`span`,{key:`view`,className:U,onClick:e=>D(u,e),title:u.name},u.name,H),ie=(E(v)?v(u):v)&&(u.url||u.thumbUrl)?K.createElement(`a`,{href:u.url||u.thumbUrl,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>D(u,e),title:c.previewFile},E(S)?S(u):S||K.createElement(y,null)):null,G=(l===`picture-card`||l===`picture-circle`)&&M!==`uploading`&&K.createElement(`span`,{className:`${t}-list-item-actions`},ie,M===`done`&&ne,z),{getPrefixCls:q}=K.useContext(m),ae=q(),J=K.createElement(`div`,{className:ee,style:o?.item},L,W,B,G,P&&K.createElement(re,{motionName:`${ae}-fade`,visible:M===`uploading`,motionDeadline:2e3},({className:e})=>{let n=`percent`in u?K.createElement(je,{type:`line`,percent:u.percent,"aria-label":u[`aria-label`],"aria-labelledby":u[`aria-labelledby`],...f}):null;return K.createElement(`div`,{className:r(`${t}-list-item-progress`,e)},n)})),oe=u.response&&typeof u.response==`string`?u.response:u.error?.statusText||u.error?.message||c.uploadError,se=M===`error`?K.createElement(s,{title:oe,getPopupContainer:e=>e.parentNode},J):J;return K.createElement(`div`,{className:r(`${t}-list-item-container`,n),style:i,ref:A},g?g(se,u,d,{download:O.bind(null,u),preview:D.bind(null,u),remove:k.bind(null,u)}):se)}),lt=K.forwardRef((e,t)=>{let{listType:n=`text`,previewFile:a=st,onPreview:o,onDownload:s,onRemove:c,locale:l,iconRender:u,isImageUrl:d=ot,prefixCls:f,items:p=[],showPreviewIcon:_=!0,showRemoveIcon:y=!0,showDownloadIcon:b=!1,removeIcon:x,previewIcon:S,downloadIcon:C,extra:w,progress:T={size:[-1,2],showInfo:!1},appendAction:O,appendActionVisible:k=!0,itemRender:A,disabled:j,classNames:N,styles:F}=e,[,ee]=g(),[te,R]=K.useState(!1),z=[`picture-card`,`picture-circle`].includes(n);K.useEffect(()=>{n.startsWith(`picture`)&&(p||[]).forEach(e=>{!(e.originFileObj instanceof File||e.originFileObj instanceof Blob)||e.thumbUrl!==void 0||(e.thumbUrl=``,a?.(e.originFileObj).then(t=>{e.thumbUrl=t||``,ee()}))})},[n,p,a]),K.useEffect(()=>{R(!0)},[]);let ne=(e,t)=>{if(o)return t?.preventDefault(),o(e)},V=e=>{E(s)?s(e):e.url&&window.open(e.url)},H=e=>{c?.(e)},U=e=>{if(u)return u(e,n);let t=e.status===`uploading`;if(n.startsWith(`picture`)){let r=n===`picture`?K.createElement(h,null):l.uploading,i=d?.(e)?K.createElement(P,null):K.createElement(L,null);return t?r:i}return t?K.createElement(h,null):K.createElement(B,null)},ie=(e,t,n,r,a)=>{let o={type:`text`,size:`small`,title:r,onClick:n=>{t(),K.isValidElement(e)&&e.props.onClick?.(n)},className:`${n}-list-item-action`,disabled:a?j:!1};return K.isValidElement(e)?K.createElement(M,{...o,icon:i(e,{...e.props,onClick:()=>{}})}):K.createElement(M,{...o},K.createElement(`span`,null,e))};K.useImperativeHandle(t,()=>({handlePreview:ne,handleDownload:V}));let{getPrefixCls:G}=K.useContext(m),q=G(`upload`,f),ae=G(),J=r(`${q}-list`,`${q}-list-${n}`,N?.list),oe=K.useMemo(()=>D(v(ae),[`onAppearEnd`,`onEnterEnd`,`onLeaveEnd`]),[ae]),se={...z?{}:oe,motionDeadline:2e3,motionName:`${q}-${z?`animate-inline`:`animate`}`,keys:W(p.map(e=>({key:e.uid,file:e}))),motionAppear:te};return K.createElement(`div`,{className:J,style:F?.list},K.createElement(I,{...se,component:!1},({key:e,file:t,className:r,style:i})=>K.createElement(ct,{key:e,locale:l,prefixCls:q,className:r,style:i,classNames:N,styles:F,file:t,items:p,progress:T,listType:n,isImgUrl:d,showPreviewIcon:_,showRemoveIcon:y,showDownloadIcon:b,removeIcon:x,previewIcon:S,downloadIcon:C,extra:w,iconRender:U,actionIconRender:ie,itemRender:A,onPreview:ne,onDownload:V,onClose:H})),O&&K.createElement(re,{...se,visible:k,forceRender:!0},({className:e,style:t})=>i(O,n=>({className:r(n.className,e),style:{...t,pointerEvents:e?`none`:void 0,...n.style}}))))}),ut=`__LIST_IGNORE_${Date.now()}__`,dt=K.forwardRef((e,t)=>{let i=x(`upload`),{fileList:a,defaultFileList:o,onRemove:s,showUploadList:c=!0,listType:l=`text`,onPreview:u,onDownload:p,onChange:m,onDrop:h,previewFile:g,disabled:_,locale:v,iconRender:y,isImageUrl:b,progress:S,prefixCls:C,className:w,type:D=`select`,children:k,style:A,itemRender:j,maxCount:M,data:N={},multiple:P=!1,hasControlInside:F=!0,action:I=``,accept:L,supportServerRender:ee=!0,rootClassName:te,styles:z,classNames:ne}=e,re=K.useContext(ie),B=_??re,V=e.customRequest||i.customRequest,H={...i.progress,...S},U=f(L,i.accept,``),[q,ae]=R(o,a),J=q||[],[oe,se]=K.useState(`drop`),Y=K.useRef(null),ce=K.useRef(null);K.useMemo(()=>{let e=Date.now();(a||[]).forEach((t,n)=>{!t.uid&&!Object.isFrozen(t)&&(t.uid=`__AUTO__${e}_${n}__`)})},[a]);let X=(e,t,n)=>{let r=W(t),i=!1;M===1?r=r.slice(-1):M&&(i=r.length>M,r=r.slice(0,M)),(0,G.flushSync)(()=>{ae(r)});let a={file:e,fileList:r};n&&(a.event=n),(!i||e.status===`removed`||r.some(t=>t.uid===e.uid))&&(0,G.flushSync)(()=>{m?.(a)})},le=async(t,r)=>{let{beforeUpload:i}=e,a=t;if(i){let e=await i(t,r);if(e===!1)return!1;if(delete t[ut],e===ut)return Object.defineProperty(t,ut,{value:!0,configurable:!0}),!1;n(e)&&(a=e)}return a},ue=e=>{let t=e.filter(e=>!e.file[ut]);if(!t.length)return;let n=t.map(e=>$e(e.file)),r=W(J);n.forEach(e=>{r=et(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)})},Z=(e,t,n)=>{try{typeof e==`string`&&(e=JSON.parse(e))}catch{}if(!tt(t,J))return;let r=$e(t);r.status=`done`,r.percent=100,r.response=e,r.xhr=n,X(r,et(r,J))},de=(e,t)=>{if(!tt(t,J))return;let n=$e(t);n.status=`uploading`,n.percent=e.percent,X(n,et(n,J),e)},fe=(e,t,n)=>{if(!tt(n,J))return;let r=$e(n);r.error=e,r.response=t,r.status=`error`,X(r,et(r,J))},pe=e=>{let t;Promise.resolve(E(s)?s(e):s).then(n=>{if(n===!1)return;let r=nt(e,J);r&&(t={...e,status:`removed`},J?.forEach(e=>{let n=t.uid===void 0?`name`:`uid`;e[n]===t[n]&&!Object.isFrozen(e)&&(e.status=`removed`)}),Y.current?.abort(t),X(t,r))})},me=e=>{se(e.type),e.type===`drop`&&h?.(e)};K.useImperativeHandle(t,()=>({onBatchStart:ue,onSuccess:Z,onProgress:de,onError:fe,fileList:J,upload:Y.current,nativeElement:ce.current}));let{getPrefixCls:he,direction:ge,className:_e,style:ve,classNames:ye,styles:be}=x(`upload`),Q=he(`upload`,C),xe={...e,listType:l,showUploadList:c,type:D,multiple:P,hasControlInside:F,supportServerRender:ee,disabled:B},[Se,Ce]=O([ye,ne],[be,z],{props:xe}),we={onBatchStart:ue,onError:fe,onProgress:de,onSuccess:Z,...e,customRequest:V,data:N,multiple:P,action:I,accept:U,supportServerRender:ee,prefixCls:Q,disabled:B,beforeUpload:le,onChange:void 0,hasControlInside:F};delete we.className,delete we.style,(!k||B)&&delete we.id;let Te=`${Q}-wrapper`,[Ee,De]=Qe(Q,Te),[Oe]=T(`Upload`,d.Upload),{showRemoveIcon:ke,showPreviewIcon:Ae,showDownloadIcon:je,removeIcon:Me,previewIcon:Ne,downloadIcon:Pe,extra:Fe}=typeof c==`boolean`?{}:c,Ie=ke===void 0?!B:ke,Le=(e,t)=>c?K.createElement(lt,{classNames:Se,styles:Ce,prefixCls:Q,listType:l,items:J,previewFile:g,onPreview:u,onDownload:p,onRemove:pe,showRemoveIcon:Ie,showPreviewIcon:Ae,showDownloadIcon:je,removeIcon:Me,previewIcon:Ne,downloadIcon:Pe,iconRender:y,extra:Fe,locale:{...Oe,...v},isImageUrl:b,progress:H,appendAction:e,appendActionVisible:t,itemRender:j,disabled:B}):e,Re=r(Te,w,te,Ee,De,_e,Se.root,{[`${Q}-rtl`]:ge===`rtl`,[`${Q}-picture-card-wrapper`]:l===`picture-card`,[`${Q}-picture-circle-wrapper`]:l===`picture-circle`}),ze={...Ce.root},Be={...ve,...A};if(D===`drag`){let e=r(Ee,Q,`${Q}-drag`,{[`${Q}-drag-uploading`]:J.some(e=>e.status===`uploading`),[`${Q}-drag-hover`]:oe===`dragover`,[`${Q}-disabled`]:B,[`${Q}-rtl`]:ge===`rtl`},Se.trigger);return K.createElement(`span`,{className:Re,ref:ce,style:ze},K.createElement(`div`,{className:e,style:{...Be,...Ce.trigger},onDrop:me,onDragOver:me,onDragLeave:me},K.createElement(We,{...we,ref:Y,className:`${Q}-btn`},K.createElement(`div`,{className:`${Q}-drag-container`},k))),Le())}let Ve=r(Q,`${Q}-select`,{[`${Q}-disabled`]:B,[`${Q}-hidden`]:!k},Se.trigger),He=K.createElement(`div`,{className:Ve,style:{...Be,...Ce.trigger}},K.createElement(We,{...we,ref:Y}));return l===`picture-card`||l===`picture-circle`?K.createElement(`span`,{className:Re,ref:ce,style:ze},Le(He,!!k)):K.createElement(`span`,{className:Re,ref:ce,style:ze},He,Le())}),ft=K.forwardRef((e,t)=>{let{style:n,height:r,hasControlInside:i=!1,children:a,...o}=e,s={...n,height:r};return K.createElement(dt,{ref:t,hasControlInside:i,...o,style:s,type:`drag`},a)}),pt=dt;pt.Dragger=ft,pt.LIST_IGNORE=ut;export{je as n,pt as t};