fileuploadsdk 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("axios"),t=require("react");function n(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var i,s={exports:{}};var o=(i||(i=1,s.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&i|~r&s)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|s>>>20)+n|0)&n|~s&r)+t[2]+606105819|0)<<17|i>>>15)+s|0)&s|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&i|~r&s)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|s>>>20)+n|0)&n|~s&r)+t[6]-1473231341|0)<<17|i>>>15)+s|0)&s|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&i|~r&s)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|s>>>20)+n|0)&n|~s&r)+t[10]-42063|0)<<17|i>>>15)+s|0)&s|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&i|~r&s)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|s>>>20)+n|0)&n|~s&r)+t[14]-1502002290|0)<<17|i>>>15)+s|0)&s|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&s|i&~s)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|s>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+s|0)&n|s&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&s|i&~s)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|s>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+s|0)&n|s&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&s|i&~s)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|s>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+s|0)&n|s&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r&s|i&~s)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|s>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+s|0)&n|s&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r^i^s)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|s>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+s|0)^s^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r^i^s)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|s>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+s|0)^s^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r^i^s)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|s>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+s|0)^s^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((s=((s+=((n=((n+=(r^i^s)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|s>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+s|0)^s^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((s=((s+=(r^((n=((n+=(i^(r|~s))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|s>>>22)+n|0)^((i=((i+=(n^(s|~r))+t[14]-1416354905|0)<<15|i>>>17)+s|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((s=((s+=(r^((n=((n+=(i^(r|~s))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|s>>>22)+n|0)^((i=((i+=(n^(s|~r))+t[10]-1051523|0)<<15|i>>>17)+s|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((s=((s+=(r^((n=((n+=(i^(r|~s))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|s>>>22)+n|0)^((i=((i+=(n^(s|~r))+t[6]-1560198380|0)<<15|i>>>17)+s|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((s=((s+=(r^((n=((n+=(i^(r|~s))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|s>>>22)+n|0)^((i=((i+=(n^(s|~r))+t[2]+718787259|0)<<15|i>>>17)+s|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=s+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function s(e){var t,i,s,o,a,l,c=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(u,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)s[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(s[t>>2]|=128<<(t%4<<3),t>55)for(n(u,s),t=0;t<16;t+=1)s[t]=0;return o=(o=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(o[2],16),l=parseInt(o[1],16)||0,s[14]=a,s[15]=l,n(u,s),u}function o(e){var t,r,s,o,a,l,c=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(u,i(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)s[t>>2]|=e[t]<<(t%4<<3);if(s[t>>2]|=128<<(t%4<<3),t>55)for(n(u,s),t=0;t<16;t+=1)s[t]=0;return o=(o=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(o[2],16),l=parseInt(o[1],16)||0,s[14]=a,s[15]=l,n(u,s),u}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function l(e){var t;for(t=0;t<e.length;t+=1)e[t]=a(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function u(e,t){var n,r=e.length,i=new ArrayBuffer(r),s=new Uint8Array(i);for(n=0;n<r;n+=1)s[n]=e.charCodeAt(n);return t?s:i}function d(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function p(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),r}function h(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function f(){this.reset()}return l(s("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,s,o,a,l=this.byteLength,c=t(n,l),u=l;return r!==e&&(u=t(r,l)),c>u?new ArrayBuffer(0):(i=u-c,s=new ArrayBuffer(i),o=new Uint8Array(s),a=new Uint8Array(this,c,i),o.set(a),s)}}(),f.prototype.append=function(e){return this.appendBinary(c(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,n,r=this._buff,i=r.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)s[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(s,i),n=l(this._hash),e&&(n=h(n)),this.reset(),n},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var r,i,s,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(n(this._hash,e),o=0;o<16;o+=1)e[o]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),s=parseInt(r[1],16)||0,e[14]=i,e[15]=s,n(this._hash,e)},f.hash=function(e,t){return f.hashBinary(c(e),t)},f.hashBinary=function(e,t){var n=l(s(e));return t?h(n):n},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,r=p(this._buff.buffer,e),s=r.length;for(this._length+=e.byteLength,t=64;t<=s;t+=64)n(this._hash,i(r.subarray(t-64,t)));return this._buff=t-64<s?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)s[t>>2]|=r[t]<<(t%4<<3);return this._finish(s,i),n=l(this._hash),e&&(n=h(n)),this.reset(),n},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e=f.prototype.getState.call(this);return e.buff=d(e.buff),e},f.ArrayBuffer.prototype.setState=function(e){return e.buff=u(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var n=l(o(new Uint8Array(e)));return t?h(n):n},f}()),s.exports),a=r(o);const l=e=>`${e.name}-${e.size}-${e.type}-${e.lastModified}`,c=e=>e.slice(e.lastIndexOf(".")+1),u=(e,t)=>{if(!t)return!0;const n=t.split(",").map(e=>e.trim()),r=e.type,i=c(e.name);return n.some(e=>{if(e.startsWith("."))return i===e.slice(1);if(e.includes("/")){const t=e.split("/")[0];return r.startsWith(t)}return r===e})},d=(e,t,n)=>!(t&&e.size>t)&&!(n&&e.size<n),p=(e,t)=>{const n=[];let r=0;for(;r<e.size;){const i=Math.min(r+t,e.size),s=e.slice(r,i);n.push(s),r=i}return n},h=e=>new Promise(t=>{const n=new a.ArrayBuffer,r=new FileReader,i=2097152,s=p(e,i);let o=0;r.onload=e=>{var r;n.append(null===(r=e.target)||void 0===r?void 0:r.result),o++,o<s.length?l():t(n.end())},r.onerror=()=>{t("")};const l=()=>{const t=o*i,n=t+i>=e.size?e.size:t+i;r.readAsArrayBuffer(e.slice(t,n))};l()});class f{constructor(t){this.fileList=[],this.abortControllers=new Map,this.config=Object.assign({method:"POST",headers:{},timeout:3e4,maxRetries:3,retryDelay:1e3,chunkSize:5242880,chunkRetry:3,concurrency:3,autoUpload:!0,multiple:!1,withCredentials:!1},t),this.axiosInstance=e.create({timeout:this.config.timeout,headers:this.config.headers,withCredentials:this.config.withCredentials})}addFile(e){var t,n;const r={uid:l(e),file:e,name:e.name,size:e.size,type:e.type,status:"pending",percent:0,uploadedSize:0};return this.fileList.push(r),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList),this.config.autoUpload&&this.upload(r),r}addFiles(e){return e.map(e=>this.addFile(e))}removeFile(e){var t,n;const r=this.fileList.findIndex(t=>t.uid===e);-1!==r&&(this.abortUpload(e),this.fileList.splice(r,1),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList))}clearFiles(){var e,t;this.fileList.forEach(e=>{this.abortUpload(e.uid)}),this.fileList=[],null===(t=(e=this.config).onFileListChange)||void 0===t||t.call(e,this.fileList)}getFileList(){return[...this.fileList]}uploadAll(){return n(this,void 0,void 0,function*(){const e=this.fileList.filter(e=>"pending"===e.status);yield Promise.all(e.map(e=>this.upload(e)))})}abortUpload(e){var t,n,r,i;const s=this.abortControllers.get(e);if(s){s.abort(),this.abortControllers.delete(e);const o=this.fileList.find(t=>t.uid===e);o&&(o.status="canceled",o.percent=0,null===(n=(t=this.config).onCancel)||void 0===n||n.call(t,o),null===(i=(r=this.config).onFileListChange)||void 0===i||i.call(r,this.fileList))}}retryUpload(e){return n(this,void 0,void 0,function*(){var t,n;const r=this.fileList.find(t=>t.uid===e);!r||"error"!==r.status&&"canceled"!==r.status||(r.status="pending",r.percent=0,r.error=void 0,null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList),yield this.upload(r))})}checkFastUpload(e){return n(this,void 0,void 0,function*(){if(!this.config.url)return{shouldUpload:!0};try{return(yield this.axiosInstance.post(`${this.config.url}/check`,{fileName:e.name,fileSize:e.size,lastModified:e.file.lastModified})).data}catch(e){return console.warn("秒传检查失败,继续正常上传:",e),{shouldUpload:!0}}})}updateProgress(e,t,n){var r,i;if(e.uploadedSize=t,e.percent=n>0?Math.round(t/n*100):0,this.config.onProgress){const e=new ProgressEvent("progress",{loaded:t,total:n,lengthComputable:!0});this.config.onProgress(e)}null===(i=(r=this.config).onFileListChange)||void 0===i||i.call(r,this.fileList)}request(e){return n(this,arguments,void 0,function*(e,t=this.config.maxRetries){var n,r;let i;for(let s=0;s<t;s++)try{const t=new AbortController;(null===(n=e.data)||void 0===n?void 0:n.uid)&&this.abortControllers.set(e.data.uid,t);const i=yield this.axiosInstance(Object.assign(Object.assign({},e),{signal:t.signal}));return(null===(r=e.data)||void 0===r?void 0:r.uid)&&this.abortControllers.delete(e.data.uid),i.data}catch(e){if(i=e,"ERR_CANCELED"===e.code)throw e;s<t-1&&(yield new Promise(e=>setTimeout(e,this.config.retryDelay*Math.pow(2,s))))}throw i})}}class m{value;next;constructor(e){this.value=e}}class g{#e;#t;#n;constructor(){this.clear()}enqueue(e){const t=new m(e);this.#e?(this.#t.next=t,this.#t=t):(this.#e=t,this.#t=t),this.#n++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,this.#e||(this.#t=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}}function y(e){v(e);const t=new g;let n=0;const r=()=>{n<e&&t.size>0&&(n++,t.dequeue()())},i=async(e,t,i)=>{const s=(async()=>e(...i))();t(s);try{await s}catch{}n--,r()},s=(s,...o)=>new Promise(a=>{((s,o,a)=>{new Promise(e=>{t.enqueue(e)}).then(i.bind(void 0,s,o,a)),n<e&&r()})(s,a,o)});return Object.defineProperties(s,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}},concurrency:{get:()=>e,set(i){v(i),e=i,queueMicrotask(()=>{for(;n<e&&t.size>0;)r()})}},map:{async value(e,t){const n=Array.from(e,(e,n)=>this(t,e,n));return Promise.all(n)}}}),s}function v(e){if(!Number.isInteger(e)&&e!==Number.POSITIVE_INFINITY||!(e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}class x extends f{constructor(e){super(e),this.chunkSize=e.chunkSize||5242880}upload(e){return n(this,void 0,void 0,function*(){try{if(!(yield this.validateFile(e)))return;const t=yield this.checkFastUpload(e);if(!0===(null==t?void 0:t.fileExists))return void(yield this.handleFastUpload(e,t));e.hash=yield h(e.file);const n=p(e.file,this.chunkSize);e.chunkList=n.map((t,n)=>({index:n,chunk:t,hash:`${e.hash}-${n}`,size:t.size,progress:0,status:"pending"})),yield this.uploadChunks(e,t.uploadedList||[]),yield this.mergeChunks(e)}catch(t){this.handleUploadError(e,t)}})}validateFile(e){return n(this,void 0,void 0,function*(){var t,n;if(this.config.beforeUpload){if(!(yield Promise.resolve(this.config.beforeUpload(e.file))))return this.removeFile(e.uid),!1}return e.status="uploading",null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList),!0})}handleFastUpload(e,t){return n(this,void 0,void 0,function*(){var t,n;e.status="success",e.percent=100,e.response={message:"秒传成功"},this.config.onSuccess&&this.config.onSuccess(e.response,e),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList)})}uploadChunks(e,t){return n(this,void 0,void 0,function*(){const{chunkList:n}=e;if(!n)return;const r=y(this.config.concurrency||3),i=[];n.filter(e=>!t.includes(e.hash)).forEach(t=>{const n=r(()=>this.uploadChunk(e,t));i.push(n)}),yield Promise.all(i)})}uploadChunk(e,t){return n(this,void 0,void 0,function*(){t.status="uploading";const n=new FormData;n.append("file",t.chunk),n.append("chunkIndex",t.index.toString()),n.append("chunkHash",t.hash),n.append("fileHash",e.hash),n.append("fileName",e.name),n.append("totalChunks",e.chunkList.length.toString()),n.append("uid",e.uid);try{yield this.request({method:this.config.method,url:this.config.url,data:n,onUploadProgress:n=>{const r=n.loaded,i=n.total||t.size;t.progress=Math.round(r/i*100);const s=e.chunkList.reduce((e,n)=>e+(n.index===t.index?r:n.size*(n.progress/100)),0),o=e.size;this.updateProgress(e,s,o)}},this.config.chunkRetry),t.status="success",t.progress=100}catch(e){throw t.status="error",e}})}mergeChunks(e){return n(this,void 0,void 0,function*(){var t,n;const r=yield this.request({method:"POST",url:`${this.config.url}/merge`,data:{fileName:e.name,fileHash:e.hash,totalChunks:e.chunkList.length,uid:e.uid}});e.status="success",e.percent=100,e.response=r,this.config.onSuccess&&this.config.onSuccess(r,e),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList)})}handleUploadError(e,t){var n,r;e.status="error",e.error=t,this.config.onError&&this.config.onError(t,e),null===(r=(n=this.config).onFileListChange)||void 0===r||r.call(n,this.fileList)}resumeUpload(e){return n(this,void 0,void 0,function*(){const t=this.fileList.find(t=>t.uid===e);if(t&&"error"===t.status)try{const e=(yield this.request({method:"GET",url:`${this.config.url}/uploaded`,params:{fileHash:t.hash,fileName:t.name}})).uploadedList||[];yield this.uploadChunks(t,e),yield this.mergeChunks(t)}catch(e){this.handleUploadError(t,e)}})}}class b extends f{constructor(e){super(e),this.concurrent=e.concurrent||3}upload(e){return n(this,void 0,void 0,function*(){var t,n,r,i;try{if(!(yield this.validateFile(e)))return;e.status="uploading",null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList);const r=new FormData;r.append("file",e.file),r.append("fileName",e.name),r.append("uid",e.uid);const i=yield this.request({method:this.config.method,url:this.config.url,data:r,onUploadProgress:t=>{this.updateProgress(e,t.loaded,t.total||e.size)}});e.status="success",e.percent=100,e.response=i,this.config.onSuccess&&this.config.onSuccess(i,e)}catch(t){this.handleUploadError(e,t)}null===(i=(r=this.config).onFileListChange)||void 0===i||i.call(r,this.fileList)})}uploadAll(){return n(this,void 0,void 0,function*(){const e=this.fileList.filter(e=>"pending"===e.status),t=y(this.concurrent),n=e.map(e=>t(()=>this.upload(e)));yield Promise.all(n)})}validateFile(e){return n(this,void 0,void 0,function*(){if(this.config.beforeUpload){if(!(yield Promise.resolve(this.config.beforeUpload(e.file))))return this.removeFile(e.uid),!1}return!0})}handleUploadError(e,t){e.status="error",e.error=t,this.config.onError&&this.config.onError(t,e)}}var j,k={exports:{}},w={};var C,N,S={};
1
+ "use strict";var e=require("axios"),t=require("react"),n=require("vue");function r(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var o,a={exports:{}};var s=(o||(o=1,a.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&r)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&r)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&r)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&r)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|o>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|o>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function o(e){var t,i,o,a,s,l,c=e.length,d=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(d,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(d,o),t=0;t<16;t+=1)o[t]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,o[14]=s,o[15]=l,n(d,o),d}function a(e){var t,r,o,a,s,l,c=e.length,d=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(d,i(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)o[t>>2]|=e[t]<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(d,o),t=0;t<16;t+=1)o[t]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,o[14]=s,o[15]=l,n(d,o),d}function s(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function l(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function d(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}function u(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function p(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),r}function f(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function h(){this.reset()}return l(o("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,a,s,l=this.byteLength,c=t(n,l),d=l;return r!==e&&(d=t(r,l)),c>d?new ArrayBuffer(0):(i=d-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),h.prototype.append=function(e){return this.appendBinary(c(e)),this},h.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},h.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=l(this._hash),e&&(n=f(n)),this.reset(),n},h.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},h.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},h.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},h.prototype._finish=function(e,t){var r,i,o,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,n(this._hash,e)},h.hash=function(e,t){return h.hashBinary(c(e),t)},h.hashBinary=function(e,t){var n=l(o(e));return t?f(n):n},h.ArrayBuffer=function(){this.reset()},h.ArrayBuffer.prototype.append=function(e){var t,r=p(this._buff.buffer,e),o=r.length;for(this._length+=e.byteLength,t=64;t<=o;t+=64)n(this._hash,i(r.subarray(t-64,t)));return this._buff=t-64<o?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},h.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=l(this._hash),e&&(n=f(n)),this.reset(),n},h.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},h.ArrayBuffer.prototype.getState=function(){var e=h.prototype.getState.call(this);return e.buff=u(e.buff),e},h.ArrayBuffer.prototype.setState=function(e){return e.buff=d(e.buff,!0),h.prototype.setState.call(this,e)},h.ArrayBuffer.prototype.destroy=h.prototype.destroy,h.ArrayBuffer.prototype._finish=h.prototype._finish,h.ArrayBuffer.hash=function(e,t){var n=l(a(new Uint8Array(e)));return t?f(n):n},h}()),a.exports),l=i(s);const c=e=>`${e.name}-${e.size}-${e.type}-${e.lastModified}`,d=e=>e.slice(e.lastIndexOf(".")+1),u=(e,t)=>{if(!t)return!0;const n=t.split(",").map(e=>e.trim()),r=e.type,i=d(e.name);return n.some(e=>{if(e.startsWith("."))return i===e.slice(1);if(e.includes("/")){const t=e.split("/")[0];return r.startsWith(t)}return r===e})},p=(e,t,n)=>!(t&&e.size>t)&&!(n&&e.size<n),f=(e,t)=>{const n=[];let r=0;for(;r<e.size;){const i=Math.min(r+t,e.size),o=e.slice(r,i);n.push(o),r=i}return n},h=e=>new Promise(t=>{const n=new l.ArrayBuffer,r=new FileReader,i=2097152,o=f(e,i);let a=0;r.onload=e=>{var r;n.append(null===(r=e.target)||void 0===r?void 0:r.result),a++,a<o.length?s():t(n.end())},r.onerror=()=>{t("")};const s=()=>{const t=a*i,n=t+i>=e.size?e.size:t+i;r.readAsArrayBuffer(e.slice(t,n))};s()});class m{constructor(t){this.fileList=[],this.abortControllers=new Map,this.config=Object.assign({method:"POST",headers:{},timeout:3e4,maxRetries:3,retryDelay:1e3,chunkSize:5242880,chunkRetry:3,concurrency:3,autoUpload:!0,multiple:!1,withCredentials:!1},t),this.axiosInstance=e.create({timeout:this.config.timeout,headers:this.config.headers,withCredentials:this.config.withCredentials})}addFile(e){var t,n;const r={uid:c(e),file:e,name:e.name,size:e.size,type:e.type,status:"pending",percent:0,uploadedSize:0};return this.fileList.push(r),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList),this.config.autoUpload&&this.upload(r),r}addFiles(e){return e.map(e=>this.addFile(e))}removeFile(e){var t,n;const r=this.fileList.findIndex(t=>t.uid===e);-1!==r&&(this.abortUpload(e),this.fileList.splice(r,1),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList))}clearFiles(){var e,t;this.fileList.forEach(e=>{this.abortUpload(e.uid)}),this.fileList=[],null===(t=(e=this.config).onFileListChange)||void 0===t||t.call(e,this.fileList)}getFileList(){return[...this.fileList]}uploadAll(){return r(this,void 0,void 0,function*(){const e=this.fileList.filter(e=>"pending"===e.status);yield Promise.all(e.map(e=>this.upload(e)))})}abortUpload(e){var t,n,r,i;const o=this.abortControllers.get(e);if(o){o.abort(),this.abortControllers.delete(e);const a=this.fileList.find(t=>t.uid===e);a&&(a.status="canceled",a.percent=0,null===(n=(t=this.config).onCancel)||void 0===n||n.call(t,a),null===(i=(r=this.config).onFileListChange)||void 0===i||i.call(r,this.fileList))}}retryUpload(e){return r(this,void 0,void 0,function*(){var t,n;const r=this.fileList.find(t=>t.uid===e);!r||"error"!==r.status&&"canceled"!==r.status||(r.status="pending",r.percent=0,r.error=void 0,null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList),yield this.upload(r))})}checkFastUpload(e){return r(this,void 0,void 0,function*(){if(!this.config.url)return{shouldUpload:!0};try{return(yield this.axiosInstance.post(`${this.config.url}/check`,{fileName:e.name,fileSize:e.size,lastModified:e.file.lastModified})).data}catch(e){return console.warn("秒传检查失败,继续正常上传:",e),{shouldUpload:!0}}})}updateProgress(e,t,n){var r,i;if(e.uploadedSize=t,e.percent=n>0?Math.round(t/n*100):0,this.config.onProgress){const e=new ProgressEvent("progress",{loaded:t,total:n,lengthComputable:!0});this.config.onProgress(e)}null===(i=(r=this.config).onFileListChange)||void 0===i||i.call(r,this.fileList)}request(e){return r(this,arguments,void 0,function*(e,t=this.config.maxRetries){var n,r;let i;for(let o=0;o<t;o++)try{const t=new AbortController;(null===(n=e.data)||void 0===n?void 0:n.uid)&&this.abortControllers.set(e.data.uid,t);const i=yield this.axiosInstance(Object.assign(Object.assign({},e),{signal:t.signal}));return(null===(r=e.data)||void 0===r?void 0:r.uid)&&this.abortControllers.delete(e.data.uid),i.data}catch(e){if(i=e,"ERR_CANCELED"===e.code)throw e;o<t-1&&(yield new Promise(e=>setTimeout(e,this.config.retryDelay*Math.pow(2,o))))}throw i})}}class g{value;next;constructor(e){this.value=e}}class v{#e;#t;#n;constructor(){this.clear()}enqueue(e){const t=new g(e);this.#e?(this.#t.next=t,this.#t=t):(this.#e=t,this.#t=t),this.#n++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,this.#e||(this.#t=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}}function y(e){x(e);const t=new v;let n=0;const r=()=>{n<e&&t.size>0&&(n++,t.dequeue()())},i=async(e,t,i)=>{const o=(async()=>e(...i))();t(o);try{await o}catch{}n--,r()},o=(o,...a)=>new Promise(s=>{((o,a,s)=>{new Promise(e=>{t.enqueue(e)}).then(i.bind(void 0,o,a,s)),n<e&&r()})(o,s,a)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}},concurrency:{get:()=>e,set(i){x(i),e=i,queueMicrotask(()=>{for(;n<e&&t.size>0;)r()})}},map:{async value(e,t){const n=Array.from(e,(e,n)=>this(t,e,n));return Promise.all(n)}}}),o}function x(e){if(!Number.isInteger(e)&&e!==Number.POSITIVE_INFINITY||!(e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}class b extends m{constructor(e){super(e),this.chunkSize=e.chunkSize||5242880}upload(e){return r(this,void 0,void 0,function*(){try{if(!(yield this.validateFile(e)))return;const t=yield this.checkFastUpload(e);if(!0===(null==t?void 0:t.fileExists))return void(yield this.handleFastUpload(e,t));e.hash=yield h(e.file);const n=f(e.file,this.chunkSize);e.chunkList=n.map((t,n)=>({index:n,chunk:t,hash:`${e.hash}-${n}`,size:t.size,progress:0,status:"pending"})),yield this.uploadChunks(e,t.uploadedList||[]),yield this.mergeChunks(e)}catch(t){this.handleUploadError(e,t)}})}validateFile(e){return r(this,void 0,void 0,function*(){var t,n;if(this.config.beforeUpload){if(!(yield Promise.resolve(this.config.beforeUpload(e.file))))return this.removeFile(e.uid),!1}return e.status="uploading",null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList),!0})}handleFastUpload(e,t){return r(this,void 0,void 0,function*(){var t,n;e.status="success",e.percent=100,e.response={message:"秒传成功"},this.config.onSuccess&&this.config.onSuccess(e.response,e),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList)})}uploadChunks(e,t){return r(this,void 0,void 0,function*(){const{chunkList:n}=e;if(!n)return;const r=y(this.config.concurrency||3),i=[];n.filter(e=>!t.includes(e.hash)).forEach(t=>{const n=r(()=>this.uploadChunk(e,t));i.push(n)}),yield Promise.all(i)})}uploadChunk(e,t){return r(this,void 0,void 0,function*(){t.status="uploading";const n=new FormData;n.append("file",t.chunk),n.append("chunkIndex",t.index.toString()),n.append("chunkHash",t.hash),n.append("fileHash",e.hash),n.append("fileName",e.name),n.append("totalChunks",e.chunkList.length.toString()),n.append("uid",e.uid);try{yield this.request({method:this.config.method,url:this.config.url,data:n,onUploadProgress:n=>{const r=n.loaded,i=n.total||t.size;t.progress=Math.round(r/i*100);const o=e.chunkList.reduce((e,n)=>e+(n.index===t.index?r:n.size*(n.progress/100)),0),a=e.size;this.updateProgress(e,o,a)}},this.config.chunkRetry),t.status="success",t.progress=100}catch(e){throw t.status="error",e}})}mergeChunks(e){return r(this,void 0,void 0,function*(){var t,n;const r=yield this.request({method:"POST",url:`${this.config.url}/merge`,data:{fileName:e.name,fileHash:e.hash,totalChunks:e.chunkList.length,uid:e.uid}});e.status="success",e.percent=100,e.response=r,this.config.onSuccess&&this.config.onSuccess(r,e),null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList)})}handleUploadError(e,t){var n,r;e.status="error",e.error=t,this.config.onError&&this.config.onError(t,e),null===(r=(n=this.config).onFileListChange)||void 0===r||r.call(n,this.fileList)}resumeUpload(e){return r(this,void 0,void 0,function*(){const t=this.fileList.find(t=>t.uid===e);if(t&&"error"===t.status)try{const e=(yield this.request({method:"GET",url:`${this.config.url}/uploaded`,params:{fileHash:t.hash,fileName:t.name}})).uploadedList||[];yield this.uploadChunks(t,e),yield this.mergeChunks(t)}catch(e){this.handleUploadError(t,e)}})}}class k extends m{constructor(e){super(e),this.concurrent=e.concurrent||3}upload(e){return r(this,void 0,void 0,function*(){var t,n,r,i;try{if(!(yield this.validateFile(e)))return;e.status="uploading",null===(n=(t=this.config).onFileListChange)||void 0===n||n.call(t,this.fileList);const r=new FormData;r.append("file",e.file),r.append("fileName",e.name),r.append("uid",e.uid);const i=yield this.request({method:this.config.method,url:this.config.url,data:r,onUploadProgress:t=>{this.updateProgress(e,t.loaded,t.total||e.size)}});e.status="success",e.percent=100,e.response=i,this.config.onSuccess&&this.config.onSuccess(i,e)}catch(t){this.handleUploadError(e,t)}null===(i=(r=this.config).onFileListChange)||void 0===i||i.call(r,this.fileList)})}uploadAll(){return r(this,void 0,void 0,function*(){const e=this.fileList.filter(e=>"pending"===e.status),t=y(this.concurrent),n=e.map(e=>t(()=>this.upload(e)));yield Promise.all(n)})}validateFile(e){return r(this,void 0,void 0,function*(){if(this.config.beforeUpload){if(!(yield Promise.resolve(this.config.beforeUpload(e.file))))return this.removeFile(e.uid),!1}return!0})}handleUploadError(e,t){e.status="error",e.error=t,this.config.onError&&this.config.onError(t,e)}}var j,C={exports:{}},N={};var w,S,L={};
2
2
  /**
3
3
  * @license React
4
4
  * react-jsx-runtime.development.js
@@ -7,5 +7,5 @@
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */function L(){return C||(C=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===N?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case f:return"Fragment";case g:return"Profiler";case m:return"StrictMode";case b:return"Suspense";case j:return"SuspenseList";case C:return"Activity"}if("object"==typeof t)switch("number"==typeof t.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case h:return"Portal";case v:return t.displayName||"Context";case y:return(t._context.displayName||"Context")+".Consumer";case x:var n=t.render;return(t=t.displayName)||(t=""!==(t=n.displayName||n.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case k:return null!==(n=t.displayName||null)?n:e(t.type)||"Memo";case w:n=t._payload,t=t._init;try{return e(t(n))}catch(e){}}return null}function n(e){return""+e}function r(e){try{n(e);var t=!1}catch(e){t=!0}if(t){var r=(t=console).error,i="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",i),n(e)}}function i(t){if(t===f)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===w)return"<...>";try{var n=e(t);return n?"<"+n+">":"<...>"}catch(e){return"<...>"}}function s(){return Error("react-stack-top-frame")}function o(){var t=e(this.type);return z[t]||(z[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(t=this.props.ref)?t:null}function a(t,n,i,s,a,c){var d,h=n.children;if(void 0!==h)if(s)if(F(h)){for(s=0;s<h.length;s++)l(h[s]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(h);if(_.call(n,"key")){h=e(t);var f=Object.keys(n).filter(function(e){return"key"!==e});s=0<f.length?"{key: someKey, "+f.join(": ..., ")+": ...}":"{key: someKey}",R[h+s]||(f=0<f.length?"{"+f.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',s,h,f,h),R[h+s]=!0)}if(h=null,void 0!==i&&(r(i),h=""+i),function(e){if(_.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(n)&&(r(n.key),h=""+n.key),"key"in n)for(var m in i={},n)"key"!==m&&(i[m]=n[m]);else i=n;return h&&function(e,t){function n(){u||(u=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(i,"function"==typeof t?t.displayName||t.name||"Unknown":t),function(e,t,n,r,i,s){var a=n.ref;return e={$$typeof:p,type:e,key:t,props:n,_owner:r},null!==(void 0!==a?a:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:o}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:s}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,h,i,null===(d=L.A)?null:d.getOwner(),a,c)}function l(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===w&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===p}var u,d=t,p=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),v=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),L=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_=Object.prototype.hasOwnProperty,F=Array.isArray,U=console.createTask?console.createTask:function(){return null},z={},A=(d={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(d,s)(),O=U(i(s)),R={};S.Fragment=f,S.jsx=function(e,t,n){var r=1e4>L.recentlyCreatedOwnerStacks++;return a(e,t,n,!1,r?Error("react-stack-top-frame"):A,r?U(i(e)):O)},S.jsxs=function(e,t,n){var r=1e4>L.recentlyCreatedOwnerStacks++;return a(e,t,n,!0,r?Error("react-stack-top-frame"):A,r?U(i(e)):O)}}()),S}var _=(N||(N=1,"production"===process.env.NODE_ENV?k.exports=function(){if(j)return w;j=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(t,n,r){var i=null;if(void 0!==r&&(i=""+r),void 0!==n.key&&(i=""+n.key),"key"in n)for(var s in r={},n)"key"!==s&&(r[s]=n[s]);else r=n;return n=r.ref,{$$typeof:e,type:t,key:i,ref:void 0!==n?n:null,props:r}}return w.Fragment=t,w.jsx=n,w.jsxs=n,w}():k.exports=L()),k.exports);const F=e=>{const[r,i]=t.useState([]),[s,o]=t.useState(!1),a=t.useRef(null),l=t.useCallback(()=>{e.chunkSize&&e.chunkSize>0?a.current=new x(Object.assign(Object.assign({},e),{onFileListChange:t=>{var n;i(t),null===(n=e.onFileListChange)||void 0===n||n.call(e,t)}})):a.current=new b(Object.assign(Object.assign({},e),{onFileListChange:t=>{var n;i(t),null===(n=e.onFileListChange)||void 0===n||n.call(e,t)}}))},[e]);return{fileList:r,uploading:s,handleFileSelect:t.useCallback(t=>{a.current||l();const n=Array.from(t).filter(t=>!(e.accept&&!u(t,e.accept))&&!!d(t,e.maxSize,e.minSize));n.length>0&&a.current.addFiles(n)},[e,l]),uploadAll:t.useCallback(()=>n(void 0,void 0,void 0,function*(){if(a.current){o(!0);try{yield a.current.uploadAll()}finally{o(!1)}}}),[]),cancelUpload:t.useCallback(e=>{var t;null===(t=a.current)||void 0===t||t.abortUpload(e)},[]),retryUpload:t.useCallback(e=>n(void 0,void 0,void 0,function*(){var t;yield null===(t=a.current)||void 0===t?void 0:t.retryUpload(e)}),[]),removeFile:t.useCallback(e=>{var t;null===(t=a.current)||void 0===t||t.removeFile(e)},[]),clearFiles:t.useCallback(()=>{var e;null===(e=a.current)||void 0===e||e.clearFiles()},[]),uploader:a.current}},U=({fileList:e,listType:t,onCancel:n,onRetry:r,onRemove:i})=>0===e.length?null:(()=>{switch(t){case"picture":return _.jsx("div",{className:"upload-list upload-list-picture",children:e.map(e=>_.jsxs("div",{className:"upload-list-item upload-list-item-picture",children:[_.jsx("div",{className:"upload-list-item-thumbnail",children:e.type.startsWith("image/")?_.jsx("img",{src:URL.createObjectURL(e.file),alt:e.name,onLoad:()=>URL.revokeObjectURL(URL.createObjectURL(e.file))}):_.jsx("div",{className:"upload-list-item-icon",children:e.type.split("/")[0]})}),_.jsxs("div",{className:"upload-list-item-info",children:[_.jsx("div",{className:"upload-list-item-name",children:e.name}),_.jsxs("div",{className:"upload-list-item-status",children:["uploading"===e.status&&_.jsxs(_.Fragment,{children:[_.jsxs("span",{className:"upload-list-item-progress",children:[e.percent,"%"]}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>n(e.uid),children:"取消"})]}),"success"===e.status&&_.jsx("span",{className:"upload-list-item-success",children:"✓ 成功"}),"error"===e.status&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"upload-list-item-error",children:"✗ 失败"}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),"canceled"===e.status&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"upload-list-item-canceled",children:"已取消"}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),_.jsx("button",{className:"upload-list-item-action upload-list-item-remove",onClick:()=>i(e.uid),children:"删除"})]})]})]},e.uid))});case"picture-card":return _.jsx("div",{className:"upload-list upload-list-picture-card",children:e.map(e=>_.jsxs("div",{className:"upload-list-item upload-list-item-picture-card",children:[_.jsxs("div",{className:"upload-list-item-thumbnail",children:[e.type.startsWith("image/")?_.jsx("img",{src:URL.createObjectURL(e.file),alt:e.name,onLoad:()=>URL.revokeObjectURL(URL.createObjectURL(e.file))}):_.jsx("div",{className:"upload-list-item-icon",children:e.type.split("/")[0]}),_.jsx("div",{className:"upload-list-item-overlay",children:_.jsxs("div",{className:"upload-list-item-status",children:["uploading"===e.status&&_.jsxs(_.Fragment,{children:[_.jsxs("span",{className:"upload-list-item-progress",children:[e.percent,"%"]}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>n(e.uid),children:"取消"})]}),"success"===e.status&&_.jsx("span",{className:"upload-list-item-success",children:"✓"}),"error"===e.status&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"upload-list-item-error",children:"✗"}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),"canceled"===e.status&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"upload-list-item-canceled",children:"已取消"}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),_.jsx("button",{className:"upload-list-item-action upload-list-item-remove",onClick:()=>i(e.uid),children:"删除"})]})})]}),_.jsx("div",{className:"upload-list-item-name",children:e.name})]},e.uid))});default:return _.jsx("div",{className:"upload-list upload-list-text",children:e.map(e=>{return _.jsxs("div",{className:"upload-list-item",children:[_.jsxs("div",{className:"upload-list-item-name",children:[_.jsx("span",{children:e.name}),_.jsxs("span",{className:"upload-list-item-size",children:["(",(t=e.size,t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(2)} KB`:`${(t/1048576).toFixed(2)} MB`),")"]})]}),_.jsxs("div",{className:"upload-list-item-status",children:["uploading"===e.status&&_.jsxs(_.Fragment,{children:[_.jsxs("span",{className:"upload-list-item-progress",children:[e.percent,"%"]}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>n(e.uid),children:"取消"})]}),"success"===e.status&&_.jsx("span",{className:"upload-list-item-success",children:"✓ 成功"}),"error"===e.status&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"upload-list-item-error",children:"✗ 失败"}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),"canceled"===e.status&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"upload-list-item-canceled",children:"已取消"}),_.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),_.jsx("button",{className:"upload-list-item-action upload-list-item-remove",onClick:()=>i(e.uid),children:"删除"})]})]},e.uid);var t})})}})(),z=({fileList:e,onUploadAll:t,onClear:n})=>{const r=(()=>{if(0===e.length)return 0;const t=e.reduce((e,t)=>e+t.size,0),n=e.reduce((e,t)=>e+(t.uploadedSize||0),0);return Math.round(n/t*100)})(),i=e.filter(e=>"uploading"===e.status).length,s=e.filter(e=>"success"===e.status).length,o=e.filter(e=>"error"===e.status).length;return 0===e.length?null:_.jsxs("div",{className:"upload-progress",children:[_.jsxs("div",{className:"upload-progress-header",children:[_.jsxs("div",{className:"upload-progress-status",children:[i>0&&_.jsxs("span",{className:"upload-progress-uploading",children:["正在上传 ",i," 个文件..."]}),0===i&&s>0&&_.jsxs("span",{className:"upload-progress-success",children:["已成功上传 ",s," 个文件"]}),o>0&&_.jsxs("span",{className:"upload-progress-error",children:["有 ",o," 个文件上传失败"]})]}),_.jsxs("div",{className:"upload-progress-actions",children:[_.jsx("button",{className:"upload-progress-action upload-progress-start",onClick:t,disabled:i>0,children:"开始上传"}),_.jsx("button",{className:"upload-progress-action upload-progress-clear",onClick:n,children:"清空"})]})]}),_.jsxs("div",{className:"upload-progress-bar-container",children:[_.jsx("div",{className:"upload-progress-bar",style:{width:`${r}%`}}),_.jsxs("div",{className:"upload-progress-text",children:[r,"%"]})]}),_.jsx("div",{className:"upload-progress-footer",children:_.jsxs("div",{className:"upload-progress-stats",children:[_.jsxs("span",{children:["总数: ",e.length]}),_.jsxs("span",{children:["成功: ",s]}),_.jsxs("span",{children:["失败: ",o]}),_.jsxs("span",{children:["等待: ",e.length-s-o-i]})]})})]})};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("/* 上传组件共享样式 */\n\n/* 基础样式 */\n.upload-container {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.upload-drag {\n border: 2px dashed #d9d9d9;\n border-radius: 6px;\n padding: 40px 20px;\n text-align: center;\n cursor: pointer;\n transition: border-color 0.3s;\n}\n\n.upload-drag:hover,\n.upload-dragover {\n border-color: #1890ff;\n}\n\n.upload-trigger {\n display: inline-block;\n cursor: pointer;\n}\n\n.upload-default {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n color: #666;\n}\n\n.upload-icon {\n font-size: 32px;\n color: #999;\n margin-bottom: 8px;\n}\n\n.upload-text {\n font-size: 14px;\n}\n\n/* UploadList 样式 */\n.upload-list {\n margin-top: 12px;\n}\n\n.upload-list-item {\n display: flex;\n align-items: center;\n padding: 8px 0;\n border-bottom: 1px solid #f0f0f0;\n}\n\n.upload-list-item-name {\n flex: 1;\n font-size: 14px;\n color: #333;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.upload-list-item-size {\n font-size: 12px;\n color: #999;\n margin-left: 8px;\n}\n\n.upload-list-item-status {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.upload-list-item-progress {\n font-size: 12px;\n color: #1890ff;\n}\n\n.upload-list-item-success {\n font-size: 12px;\n color: #52c41a;\n}\n\n.upload-list-item-error {\n font-size: 12px;\n color: #ff4d4f;\n}\n\n.upload-list-item-canceled {\n font-size: 12px;\n color: #999;\n}\n\n.upload-list-item-action {\n font-size: 12px;\n color: #1890ff;\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n}\n\n.upload-list-item-action:hover {\n text-decoration: underline;\n}\n\n.upload-list-item-remove {\n color: #999;\n}\n\n/* 图片类型样式 */\n.upload-list-item-picture {\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n}\n\n.upload-list-item-thumbnail {\n position: relative;\n width: 100px;\n height: 100px;\n border-radius: 4px;\n overflow: hidden;\n border: 1px solid #f0f0f0;\n}\n\n.upload-list-item-thumbnail img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.upload-list-item-icon {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #f5f5f5;\n font-size: 12px;\n color: #999;\n}\n\n.upload-list-item-info {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n/* 图片卡片类型样式 */\n.upload-list-picture-card {\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n}\n\n.upload-list-item-picture-card {\n width: 120px;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n border: none;\n padding: 0;\n}\n\n.upload-list-item-picture-card .upload-list-item-thumbnail {\n width: 120px;\n height: 120px;\n}\n\n.upload-list-item-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n color: white;\n}\n\n.upload-list-item-picture-card .upload-list-item-status {\n color: white;\n flex-direction: column;\n gap: 8px;\n}\n\n.upload-list-item-picture-card .upload-list-item-action {\n color: white;\n border: 1px solid white;\n padding: 2px 8px;\n border-radius: 4px;\n}\n\n.upload-list-item-picture-card .upload-list-item-action:hover {\n background-color: white;\n color: #1890ff;\n text-decoration: none;\n}\n\n.upload-list-item-picture-card .upload-list-item-name {\n font-size: 12px;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n}\n\n/* Progress 组件样式 */\n.upload-progress {\n margin-top: 12px;\n padding: 12px;\n background-color: #fafafa;\n border-radius: 6px;\n}\n\n.upload-progress-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 12px;\n}\n\n.upload-progress-status {\n font-size: 14px;\n color: #333;\n}\n\n.upload-progress-uploading {\n color: #1890ff;\n}\n\n.upload-progress-success {\n color: #52c41a;\n}\n\n.upload-progress-error {\n color: #ff4d4f;\n}\n\n.upload-progress-actions {\n display: flex;\n gap: 8px;\n}\n\n.upload-progress-action {\n font-size: 12px;\n padding: 4px 12px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n background-color: white;\n cursor: pointer;\n transition: all 0.3s;\n}\n\n.upload-progress-action:hover {\n border-color: #1890ff;\n color: #1890ff;\n}\n\n.upload-progress-action:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.upload-progress-action:disabled:hover {\n border-color: #d9d9d9;\n color: #999;\n}\n\n.upload-progress-start {\n color: #1890ff;\n border-color: #1890ff;\n}\n\n.upload-progress-start:hover {\n background-color: #e6f7ff;\n}\n\n.upload-progress-clear {\n color: #666;\n}\n\n.upload-progress-bar-container {\n position: relative;\n height: 8px;\n background-color: #f0f0f0;\n border-radius: 4px;\n overflow: hidden;\n margin-bottom: 8px;\n}\n\n.upload-progress-bar {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background-color: #1890ff;\n transition: width 0.3s ease;\n}\n\n.upload-progress-text {\n position: absolute;\n top: 0;\n right: 8px;\n height: 100%;\n display: flex;\n align-items: center;\n font-size: 12px;\n color: #666;\n}\n\n.upload-progress-footer {\n margin-top: 8px;\n}\n\n.upload-progress-stats {\n display: flex;\n gap: 16px;\n font-size: 12px;\n color: #999;\n}");exports.BaseUploader=f,exports.ParallelUploader=b,exports.ReactUpload=e=>{var{children:n,className:r="",style:i,drag:s=!1,showFileList:o=!0,listType:a="text"}=e,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["children","className","style","drag","showFileList","listType"]);const c=t.useRef(null),u=t.useRef(null),{fileList:d,uploading:p,handleFileSelect:h,uploadAll:f,cancelUpload:m,retryUpload:g,removeFile:y,clearFiles:v}=F(l),x=t.useCallback(()=>{var e;null===(e=c.current)||void 0===e||e.click()},[]),b=t.useCallback(e=>{e.target.files&&(h(e.target.files),e.target.value="")},[h]),j=t.useCallback(e=>{var t,n;e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?null===(t=u.current)||void 0===t||t.classList.add("upload-dragover"):"dragleave"===e.type&&(null===(n=u.current)||void 0===n||n.classList.remove("upload-dragover"))},[]),k=t.useCallback(e=>{var t;e.preventDefault(),e.stopPropagation(),null===(t=u.current)||void 0===t||t.classList.remove("upload-dragover"),e.dataTransfer.files&&h(e.dataTransfer.files)},[h]),w=()=>n||_.jsxs("div",{className:"upload-default",children:[_.jsx("div",{className:"upload-icon",children:"+"}),_.jsx("div",{className:"upload-text",children:"点击或拖拽文件到此区域上传"})]});return _.jsxs("div",{className:`upload-container ${r}`,style:i,children:[_.jsx("input",{ref:c,type:"file",style:{display:"none"},multiple:l.multiple,accept:l.accept,onChange:b}),s?_.jsx("div",{ref:u,className:"upload-drag",onClick:x,onDragEnter:j,onDragOver:j,onDragLeave:j,onDrop:k,children:w()}):_.jsx("div",{className:"upload-trigger",onClick:x,children:w()}),o&&_.jsx(U,{fileList:d,listType:a,onCancel:m,onRetry:g,onRemove:y}),p&&_.jsx(z,{fileList:d,onUploadAll:f,onClear:v})]})},exports.SliceUploader=x,exports.calculateChunkSize=e=>e<=10485760?e:e<=104857600?5242880:e<=1073741824?10485760:20971520,exports.calculateFileHash=h,exports.createFileChunks=p,exports.defaultConfig={url:"",method:"POST",timeout:3e4,maxRetries:3,retryDelay:1e3,chunkSize:5242880,chunkRetry:3,concurrent:3,autoUpload:!0,multiple:!1,withCredentials:!1},exports.formatFileSize=e=>{if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB","TB"][t]},exports.generateFileId=l,exports.getFileExtension=c,exports.useReactUpload=F,exports.validateFileSize=d,exports.validateFileType=u;
10
+ */function B(){return w||(w=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===w?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case h:return"Fragment";case g:return"Profiler";case m:return"StrictMode";case b:return"Suspense";case k:return"SuspenseList";case N:return"Activity"}if("object"==typeof t)switch("number"==typeof t.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case f:return"Portal";case y:return t.displayName||"Context";case v:return(t._context.displayName||"Context")+".Consumer";case x:var n=t.render;return(t=t.displayName)||(t=""!==(t=n.displayName||n.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case j:return null!==(n=t.displayName||null)?n:e(t.type)||"Memo";case C:n=t._payload,t=t._init;try{return e(t(n))}catch(e){}}return null}function n(e){return""+e}function r(e){try{n(e);var t=!1}catch(e){t=!0}if(t){var r=(t=console).error,i="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",i),n(e)}}function i(t){if(t===h)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===C)return"<...>";try{var n=e(t);return n?"<"+n+">":"<...>"}catch(e){return"<...>"}}function o(){return Error("react-stack-top-frame")}function a(){var t=e(this.type);return z[t]||(z[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(t=this.props.ref)?t:null}function s(t,n,i,o,s,c){var u,f=n.children;if(void 0!==f)if(o)if(F(f)){for(o=0;o<f.length;o++)l(f[o]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(f);if(B.call(n,"key")){f=e(t);var h=Object.keys(n).filter(function(e){return"key"!==e});o=0<h.length?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}",A[f+o]||(h=0<h.length?"{"+h.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',o,f,h,f),A[f+o]=!0)}if(f=null,void 0!==i&&(r(i),f=""+i),function(e){if(B.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(n)&&(r(n.key),f=""+n.key),"key"in n)for(var m in i={},n)"key"!==m&&(i[m]=n[m]);else i=n;return f&&function(e,t){function n(){d||(d=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(i,"function"==typeof t?t.displayName||t.name||"Unknown":t),function(e,t,n,r,i,o){var s=n.ref;return e={$$typeof:p,type:e,key:t,props:n,_owner:r},null!==(void 0!==s?s:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:a}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,f,i,null===(u=S.A)?null:u.getOwner(),s,c)}function l(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===C&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===p}var d,u=t,p=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),y=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),w=Symbol.for("react.client.reference"),S=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,F=Array.isArray,_=console.createTask?console.createTask:function(){return null},z={},E=(u={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(u,o)(),U=_(i(o)),A={};L.Fragment=h,L.jsx=function(e,t,n){var r=1e4>S.recentlyCreatedOwnerStacks++;return s(e,t,n,!1,r?Error("react-stack-top-frame"):E,r?_(i(e)):U)},L.jsxs=function(e,t,n){var r=1e4>S.recentlyCreatedOwnerStacks++;return s(e,t,n,!0,r?Error("react-stack-top-frame"):E,r?_(i(e)):U)}}()),L}var F=(S||(S=1,"production"===process.env.NODE_ENV?C.exports=function(){if(j)return N;j=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(t,n,r){var i=null;if(void 0!==r&&(i=""+r),void 0!==n.key&&(i=""+n.key),"key"in n)for(var o in r={},n)"key"!==o&&(r[o]=n[o]);else r=n;return n=r.ref,{$$typeof:e,type:t,key:i,ref:void 0!==n?n:null,props:r}}return N.Fragment=t,N.jsx=n,N.jsxs=n,N}():C.exports=B()),C.exports);const _=e=>{const[n,i]=t.useState([]),[o,a]=t.useState(!1),s=t.useRef(null),l=t.useCallback(()=>{e.chunkSize&&e.chunkSize>0?s.current=new b(Object.assign(Object.assign({},e),{onFileListChange:t=>{var n;i(t),null===(n=e.onFileListChange)||void 0===n||n.call(e,t)}})):s.current=new k(Object.assign(Object.assign({},e),{onFileListChange:t=>{var n;i(t),null===(n=e.onFileListChange)||void 0===n||n.call(e,t)}}))},[e]);return{fileList:n,uploading:o,handleFileSelect:t.useCallback(t=>{s.current||l();const n=Array.from(t).filter(t=>!(e.accept&&!u(t,e.accept))&&!!p(t,e.maxSize,e.minSize));n.length>0&&s.current.addFiles(n)},[e,l]),uploadAll:t.useCallback(()=>r(void 0,void 0,void 0,function*(){if(s.current){a(!0);try{yield s.current.uploadAll()}finally{a(!1)}}}),[]),cancelUpload:t.useCallback(e=>{var t;null===(t=s.current)||void 0===t||t.abortUpload(e)},[]),retryUpload:t.useCallback(e=>r(void 0,void 0,void 0,function*(){var t;yield null===(t=s.current)||void 0===t?void 0:t.retryUpload(e)}),[]),removeFile:t.useCallback(e=>{var t;null===(t=s.current)||void 0===t||t.removeFile(e)},[]),clearFiles:t.useCallback(()=>{var e;null===(e=s.current)||void 0===e||e.clearFiles()},[]),uploader:s.current}},z=({fileList:e,listType:t,onCancel:n,onRetry:r,onRemove:i})=>0===e.length?null:(()=>{switch(t){case"picture":return F.jsx("div",{className:"upload-list upload-list-picture",children:e.map(e=>F.jsxs("div",{className:"upload-list-item upload-list-item-picture",children:[F.jsx("div",{className:"upload-list-item-thumbnail",children:e.type.startsWith("image/")?F.jsx("img",{src:URL.createObjectURL(e.file),alt:e.name,onLoad:()=>URL.revokeObjectURL(URL.createObjectURL(e.file))}):F.jsx("div",{className:"upload-list-item-icon",children:e.type.split("/")[0]})}),F.jsxs("div",{className:"upload-list-item-info",children:[F.jsx("div",{className:"upload-list-item-name",children:e.name}),F.jsxs("div",{className:"upload-list-item-status",children:["uploading"===e.status&&F.jsxs(F.Fragment,{children:[F.jsxs("span",{className:"upload-list-item-progress",children:[e.percent,"%"]}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>n(e.uid),children:"取消"})]}),"success"===e.status&&F.jsx("span",{className:"upload-list-item-success",children:"✓ 成功"}),"error"===e.status&&F.jsxs(F.Fragment,{children:[F.jsx("span",{className:"upload-list-item-error",children:"✗ 失败"}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),"canceled"===e.status&&F.jsxs(F.Fragment,{children:[F.jsx("span",{className:"upload-list-item-canceled",children:"已取消"}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),F.jsx("button",{className:"upload-list-item-action upload-list-item-remove",onClick:()=>i(e.uid),children:"删除"})]})]})]},e.uid))});case"picture-card":return F.jsx("div",{className:"upload-list upload-list-picture-card",children:e.map(e=>F.jsxs("div",{className:"upload-list-item upload-list-item-picture-card",children:[F.jsxs("div",{className:"upload-list-item-thumbnail",children:[e.type.startsWith("image/")?F.jsx("img",{src:URL.createObjectURL(e.file),alt:e.name,onLoad:()=>URL.revokeObjectURL(URL.createObjectURL(e.file))}):F.jsx("div",{className:"upload-list-item-icon",children:e.type.split("/")[0]}),F.jsx("div",{className:"upload-list-item-overlay",children:F.jsxs("div",{className:"upload-list-item-status",children:["uploading"===e.status&&F.jsxs(F.Fragment,{children:[F.jsxs("span",{className:"upload-list-item-progress",children:[e.percent,"%"]}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>n(e.uid),children:"取消"})]}),"success"===e.status&&F.jsx("span",{className:"upload-list-item-success",children:"✓"}),"error"===e.status&&F.jsxs(F.Fragment,{children:[F.jsx("span",{className:"upload-list-item-error",children:"✗"}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),"canceled"===e.status&&F.jsxs(F.Fragment,{children:[F.jsx("span",{className:"upload-list-item-canceled",children:"已取消"}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),F.jsx("button",{className:"upload-list-item-action upload-list-item-remove",onClick:()=>i(e.uid),children:"删除"})]})})]}),F.jsx("div",{className:"upload-list-item-name",children:e.name})]},e.uid))});default:return F.jsx("div",{className:"upload-list upload-list-text",children:e.map(e=>{return F.jsxs("div",{className:"upload-list-item",children:[F.jsxs("div",{className:"upload-list-item-name",children:[F.jsx("span",{children:e.name}),F.jsxs("span",{className:"upload-list-item-size",children:["(",(t=e.size,t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(2)} KB`:`${(t/1048576).toFixed(2)} MB`),")"]})]}),F.jsxs("div",{className:"upload-list-item-status",children:["uploading"===e.status&&F.jsxs(F.Fragment,{children:[F.jsxs("span",{className:"upload-list-item-progress",children:[e.percent,"%"]}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>n(e.uid),children:"取消"})]}),"success"===e.status&&F.jsx("span",{className:"upload-list-item-success",children:"✓ 成功"}),"error"===e.status&&F.jsxs(F.Fragment,{children:[F.jsx("span",{className:"upload-list-item-error",children:"✗ 失败"}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),"canceled"===e.status&&F.jsxs(F.Fragment,{children:[F.jsx("span",{className:"upload-list-item-canceled",children:"已取消"}),F.jsx("button",{className:"upload-list-item-action",onClick:()=>r(e.uid),children:"重试"})]}),F.jsx("button",{className:"upload-list-item-action upload-list-item-remove",onClick:()=>i(e.uid),children:"删除"})]})]},e.uid);var t})})}})(),E=({fileList:e,onUploadAll:t,onClear:n})=>{const r=(()=>{if(0===e.length)return 0;const t=e.reduce((e,t)=>e+t.size,0),n=e.reduce((e,t)=>e+(t.uploadedSize||0),0);return Math.round(n/t*100)})(),i=e.filter(e=>"uploading"===e.status).length,o=e.filter(e=>"success"===e.status).length,a=e.filter(e=>"error"===e.status).length;return 0===e.length?null:F.jsxs("div",{className:"upload-progress",children:[F.jsxs("div",{className:"upload-progress-header",children:[F.jsxs("div",{className:"upload-progress-status",children:[i>0&&F.jsxs("span",{className:"upload-progress-uploading",children:["正在上传 ",i," 个文件..."]}),0===i&&o>0&&F.jsxs("span",{className:"upload-progress-success",children:["已成功上传 ",o," 个文件"]}),a>0&&F.jsxs("span",{className:"upload-progress-error",children:["有 ",a," 个文件上传失败"]})]}),F.jsxs("div",{className:"upload-progress-actions",children:[F.jsx("button",{className:"upload-progress-action upload-progress-start",onClick:t,disabled:i>0,children:"开始上传"}),F.jsx("button",{className:"upload-progress-action upload-progress-clear",onClick:n,children:"清空"})]})]}),F.jsxs("div",{className:"upload-progress-bar-container",children:[F.jsx("div",{className:"upload-progress-bar",style:{width:`${r}%`}}),F.jsxs("div",{className:"upload-progress-text",children:[r,"%"]})]}),F.jsx("div",{className:"upload-progress-footer",children:F.jsxs("div",{className:"upload-progress-stats",children:[F.jsxs("span",{children:["总数: ",e.length]}),F.jsxs("span",{children:["成功: ",o]}),F.jsxs("span",{children:["失败: ",a]}),F.jsxs("span",{children:["等待: ",e.length-o-a-i]})]})})]})};function U(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}U("/* 上传组件共享样式 */\n\n/* 基础样式 */\n.upload-container {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.upload-drag {\n border: 2px dashed #d9d9d9;\n border-radius: 6px;\n padding: 40px 20px;\n text-align: center;\n cursor: pointer;\n transition: border-color 0.3s;\n}\n\n.upload-drag:hover,\n.upload-dragover {\n border-color: #1890ff;\n}\n\n.upload-trigger {\n display: inline-block;\n cursor: pointer;\n}\n\n.upload-default {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n color: #666;\n}\n\n.upload-icon {\n font-size: 32px;\n color: #999;\n margin-bottom: 8px;\n}\n\n.upload-text {\n font-size: 14px;\n}\n\n/* UploadList 样式 */\n.upload-list {\n margin-top: 12px;\n}\n\n.upload-list-item {\n display: flex;\n align-items: center;\n padding: 8px 0;\n border-bottom: 1px solid #f0f0f0;\n}\n\n.upload-list-item-name {\n flex: 1;\n font-size: 14px;\n color: #333;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.upload-list-item-size {\n font-size: 12px;\n color: #999;\n margin-left: 8px;\n}\n\n.upload-list-item-status {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.upload-list-item-progress {\n font-size: 12px;\n color: #1890ff;\n}\n\n.upload-list-item-success {\n font-size: 12px;\n color: #52c41a;\n}\n\n.upload-list-item-error {\n font-size: 12px;\n color: #ff4d4f;\n}\n\n.upload-list-item-canceled {\n font-size: 12px;\n color: #999;\n}\n\n.upload-list-item-action {\n font-size: 12px;\n color: #1890ff;\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n}\n\n.upload-list-item-action:hover {\n text-decoration: underline;\n}\n\n.upload-list-item-remove {\n color: #999;\n}\n\n/* 图片类型样式 */\n.upload-list-item-picture {\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n}\n\n.upload-list-item-thumbnail {\n position: relative;\n width: 100px;\n height: 100px;\n border-radius: 4px;\n overflow: hidden;\n border: 1px solid #f0f0f0;\n}\n\n.upload-list-item-thumbnail img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.upload-list-item-icon {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #f5f5f5;\n font-size: 12px;\n color: #999;\n}\n\n.upload-list-item-info {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n/* 图片卡片类型样式 */\n.upload-list-picture-card {\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n}\n\n.upload-list-item-picture-card {\n width: 120px;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n border: none;\n padding: 0;\n}\n\n.upload-list-item-picture-card .upload-list-item-thumbnail {\n width: 120px;\n height: 120px;\n}\n\n.upload-list-item-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n color: white;\n}\n\n.upload-list-item-picture-card .upload-list-item-status {\n color: white;\n flex-direction: column;\n gap: 8px;\n}\n\n.upload-list-item-picture-card .upload-list-item-action {\n color: white;\n border: 1px solid white;\n padding: 2px 8px;\n border-radius: 4px;\n}\n\n.upload-list-item-picture-card .upload-list-item-action:hover {\n background-color: white;\n color: #1890ff;\n text-decoration: none;\n}\n\n.upload-list-item-picture-card .upload-list-item-name {\n font-size: 12px;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n}\n\n/* Progress 组件样式 */\n.upload-progress {\n margin-top: 12px;\n padding: 12px;\n background-color: #fafafa;\n border-radius: 6px;\n}\n\n.upload-progress-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 12px;\n}\n\n.upload-progress-status {\n font-size: 14px;\n color: #333;\n}\n\n.upload-progress-uploading {\n color: #1890ff;\n}\n\n.upload-progress-success {\n color: #52c41a;\n}\n\n.upload-progress-error {\n color: #ff4d4f;\n}\n\n.upload-progress-actions {\n display: flex;\n gap: 8px;\n}\n\n.upload-progress-action {\n font-size: 12px;\n padding: 4px 12px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n background-color: white;\n cursor: pointer;\n transition: all 0.3s;\n}\n\n.upload-progress-action:hover {\n border-color: #1890ff;\n color: #1890ff;\n}\n\n.upload-progress-action:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.upload-progress-action:disabled:hover {\n border-color: #d9d9d9;\n color: #999;\n}\n\n.upload-progress-start {\n color: #1890ff;\n border-color: #1890ff;\n}\n\n.upload-progress-start:hover {\n background-color: #e6f7ff;\n}\n\n.upload-progress-clear {\n color: #666;\n}\n\n.upload-progress-bar-container {\n position: relative;\n height: 8px;\n background-color: #f0f0f0;\n border-radius: 4px;\n overflow: hidden;\n margin-bottom: 8px;\n}\n\n.upload-progress-bar {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background-color: #1890ff;\n transition: width 0.3s ease;\n}\n\n.upload-progress-text {\n position: absolute;\n top: 0;\n right: 8px;\n height: 100%;\n display: flex;\n align-items: center;\n font-size: 12px;\n color: #666;\n}\n\n.upload-progress-footer {\n margin-top: 8px;\n}\n\n.upload-progress-stats {\n display: flex;\n gap: 16px;\n font-size: 12px;\n color: #999;\n}");const A=e=>{const t=n.ref([]),i=n.ref(!1);let o=null;return{fileList:t,uploading:i,handleFileSelect:n=>{o||(o=e.chunkSize&&e.chunkSize>0?new b(Object.assign(Object.assign({},e),{onFileListChange:n=>{var r;t.value=n,null===(r=e.onFileListChange)||void 0===r||r.call(e,n)}})):new k(Object.assign(Object.assign({},e),{onFileListChange:n=>{var r;t.value=n,null===(r=e.onFileListChange)||void 0===r||r.call(e,n)}})));const r=Array.from(n).filter(t=>!(e.accept&&!u(t,e.accept))&&!!p(t,e.maxSize,e.minSize));r.length>0&&o.addFiles(r)},uploadAll:()=>r(void 0,void 0,void 0,function*(){if(o){i.value=!0;try{yield o.uploadAll()}finally{i.value=!1}}}),cancelUpload:e=>{null==o||o.abortUpload(e)},retryUpload:e=>r(void 0,void 0,void 0,function*(){yield null==o?void 0:o.retryUpload(e)}),removeFile:e=>{null==o||o.removeFile(e)},clearFiles:()=>{null==o||o.clearFiles()},uploader:o}},O={key:0,class:"upload-list-item-thumbnail"},R=["src","alt","onLoad"],T={key:1,class:"upload-list-item-icon"},V={key:2,class:"upload-list-item-overlay"},P={class:"upload-list-item-status"},$={key:0,class:"upload-list-item-progress"},q={key:1,class:"upload-list-item-success"},D={key:2,class:"upload-list-item-error"},I={key:3,class:"upload-list-item-canceled"},M=["onClick"],W=["onClick"],H=["onClick"],K={key:1,class:"upload-list-item-info"},G={class:"upload-list-item-name"},J={class:"upload-list-item-size"},X={class:"upload-list-item-status"},Y={key:0,class:"upload-list-item-progress"},Q={key:1,class:"upload-list-item-success"},Z={key:2,class:"upload-list-item-error"},ee={key:3,class:"upload-list-item-canceled"},te=["onClick"],ne=["onClick"],re=["onClick"],ie={key:2,class:"upload-list-item-name"};var oe=n.defineComponent({__name:"UploadList",props:{fileList:{type:Array,required:!0},listType:{type:String,required:!0}},emits:["cancel","retry","remove"],setup(e,{emit:t}){const r=e=>URL.createObjectURL(e);return(t,i)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["upload-list",{"upload-list-text":"text"===e.listType,"upload-list-picture":"picture"===e.listType,"upload-list-picture-card":"picture-card"===e.listType}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.fileList,i=>{return n.openBlock(),n.createElementBlock("div",{key:i.uid,class:n.normalizeClass(["upload-list-item",{"upload-list-item-picture":"picture"===e.listType,"upload-list-item-picture-card":"picture-card"===e.listType}])},[n.createCommentVNode(" 图片类型显示缩略图 "),"picture"===e.listType||"picture-card"===e.listType?(n.openBlock(),n.createElementBlock("div",O,[i.type.startsWith("image/")?(n.openBlock(),n.createElementBlock("img",{key:0,src:r(i.file),alt:i.name,onLoad:e=>(e=>{setTimeout(()=>{URL.revokeObjectURL(URL.createObjectURL(e))},100)})(i.file)},null,40,R)):(n.openBlock(),n.createElementBlock("div",T,n.toDisplayString(i.type.split("/")[0]),1)),n.createCommentVNode(" 图片卡片类型显示覆盖层 "),"picture-card"===e.listType?(n.openBlock(),n.createElementBlock("div",V,[n.createElementVNode("div",P,["uploading"===i.status?(n.openBlock(),n.createElementBlock("span",$,n.toDisplayString(i.percent)+"% ",1)):"success"===i.status?(n.openBlock(),n.createElementBlock("span",q,"✓")):"error"===i.status?(n.openBlock(),n.createElementBlock("span",D,"✗")):"canceled"===i.status?(n.openBlock(),n.createElementBlock("span",I,"已取消")):n.createCommentVNode("v-if",!0),"uploading"===i.status?(n.openBlock(),n.createElementBlock("button",{key:4,class:"upload-list-item-action",onClick:e=>t.$emit("cancel",i.uid)}," 取消 ",8,M)):n.createCommentVNode("v-if",!0),"error"===i.status||"canceled"===i.status?(n.openBlock(),n.createElementBlock("button",{key:5,class:"upload-list-item-action",onClick:e=>t.$emit("retry",i.uid)}," 重试 ",8,W)):n.createCommentVNode("v-if",!0),n.createElementVNode("button",{class:"upload-list-item-action upload-list-item-remove",onClick:e=>t.$emit("remove",i.uid)}," 删除 ",8,H)])])):n.createCommentVNode("v-if",!0)])):n.createCommentVNode("v-if",!0),n.createCommentVNode(" 文件信息 "),"text"===e.listType||"picture"===e.listType?(n.openBlock(),n.createElementBlock("div",K,[n.createElementVNode("div",G,[n.createElementVNode("span",null,n.toDisplayString(i.name),1),n.createElementVNode("span",J,"("+n.toDisplayString((o=i.size,o<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(2)} KB`:`${(o/1048576).toFixed(2)} MB`))+")",1)]),n.createElementVNode("div",X,["uploading"===i.status?(n.openBlock(),n.createElementBlock("span",Y,n.toDisplayString(i.percent)+"% ",1)):"success"===i.status?(n.openBlock(),n.createElementBlock("span",Q,"✓ 成功")):"error"===i.status?(n.openBlock(),n.createElementBlock("span",Z,"✗ 失败")):"canceled"===i.status?(n.openBlock(),n.createElementBlock("span",ee,"已取消")):n.createCommentVNode("v-if",!0),"uploading"===i.status?(n.openBlock(),n.createElementBlock("button",{key:4,class:"upload-list-item-action",onClick:e=>t.$emit("cancel",i.uid)}," 取消 ",8,te)):n.createCommentVNode("v-if",!0),"error"===i.status||"canceled"===i.status?(n.openBlock(),n.createElementBlock("button",{key:5,class:"upload-list-item-action",onClick:e=>t.$emit("retry",i.uid)}," 重试 ",8,ne)):n.createCommentVNode("v-if",!0),n.createElementVNode("button",{class:"upload-list-item-action upload-list-item-remove",onClick:e=>t.$emit("remove",i.uid)}," 删除 ",8,re)])])):n.createCommentVNode("v-if",!0),n.createCommentVNode(" 图片卡片类型显示文件名 "),"picture-card"===e.listType?(n.openBlock(),n.createElementBlock("div",ie,n.toDisplayString(i.name),1)):n.createCommentVNode("v-if",!0)],2);var o}),128))],2))}});U("\n.upload-list[data-v-019ff626] {\n margin-top: 12px;\n}\n.upload-list-item[data-v-019ff626] {\n display: flex;\n align-items: center;\n padding: 8px 0;\n border-bottom: 1px solid #f0f0f0;\n}\n.upload-list-item-name[data-v-019ff626] {\n flex: 1;\n font-size: 14px;\n color: #333;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.upload-list-item-size[data-v-019ff626] {\n font-size: 12px;\n color: #999;\n margin-left: 8px;\n}\n.upload-list-item-status[data-v-019ff626] {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.upload-list-item-progress[data-v-019ff626] {\n font-size: 12px;\n color: #1890ff;\n}\n.upload-list-item-success[data-v-019ff626] {\n font-size: 12px;\n color: #52c41a;\n}\n.upload-list-item-error[data-v-019ff626] {\n font-size: 12px;\n color: #ff4d4f;\n}\n.upload-list-item-canceled[data-v-019ff626] {\n font-size: 12px;\n color: #999;\n}\n.upload-list-item-action[data-v-019ff626] {\n font-size: 12px;\n color: #1890ff;\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n}\n.upload-list-item-action[data-v-019ff626]:hover {\n text-decoration: underline;\n}\n.upload-list-item-remove[data-v-019ff626] {\n color: #999;\n}\n\n/* 图片类型样式 */\n.upload-list-item-picture[data-v-019ff626] {\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n}\n.upload-list-item-thumbnail[data-v-019ff626] {\n position: relative;\n width: 100px;\n height: 100px;\n border-radius: 4px;\n overflow: hidden;\n border: 1px solid #f0f0f0;\n}\n.upload-list-item-thumbnail img[data-v-019ff626] {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.upload-list-item-icon[data-v-019ff626] {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #f5f5f5;\n font-size: 12px;\n color: #999;\n}\n.upload-list-item-info[data-v-019ff626] {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n/* 图片卡片类型样式 */\n.upload-list-picture-card[data-v-019ff626] {\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n}\n.upload-list-item-picture-card[data-v-019ff626] {\n width: 120px;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n border: none;\n padding: 0;\n}\n.upload-list-item-picture-card .upload-list-item-thumbnail[data-v-019ff626] {\n width: 120px;\n height: 120px;\n}\n.upload-list-item-overlay[data-v-019ff626] {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n color: white;\n}\n.upload-list-item-picture-card .upload-list-item-status[data-v-019ff626] {\n color: white;\n flex-direction: column;\n gap: 8px;\n}\n.upload-list-item-picture-card .upload-list-item-action[data-v-019ff626] {\n color: white;\n border: 1px solid white;\n padding: 2px 8px;\n border-radius: 4px;\n}\n.upload-list-item-picture-card .upload-list-item-action[data-v-019ff626]:hover {\n background-color: white;\n color: #1890ff;\n text-decoration: none;\n}\n.upload-list-item-picture-card .upload-list-item-name[data-v-019ff626] {\n font-size: 12px;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n}\n"),oe.__scopeId="data-v-019ff626",oe.__file="src/vue/components/UploadList.vue";const ae={class:"upload-progress"},se={class:"upload-progress-header"},le={class:"upload-progress-status"},ce={key:0,class:"upload-progress-uploading"},de={key:1,class:"upload-progress-success"},ue={key:2,class:"upload-progress-error"},pe={class:"upload-progress-actions"},fe=["disabled"],he={class:"upload-progress-bar-container"},me={class:"upload-progress-text"},ge={class:"upload-progress-footer"},ve={class:"upload-progress-stats"};var ye=n.defineComponent({__name:"Progress",props:{fileList:{type:Array,required:!0}},emits:["upload-all","clear"],setup(e,{emit:t}){const r=e,i=n.computed(()=>{if(0===r.fileList.length)return 0;const e=r.fileList.reduce((e,t)=>e+t.size,0),t=r.fileList.reduce((e,t)=>e+(t.uploadedSize||0),0);return Math.round(t/e*100)}),o=n.computed(()=>r.fileList.filter(e=>"uploading"===e.status).length),a=n.computed(()=>r.fileList.filter(e=>"success"===e.status).length),s=n.computed(()=>r.fileList.filter(e=>"error"===e.status).length),l=n.computed(()=>r.fileList.length-a.value-s.value-o.value);return(t,r)=>(n.openBlock(),n.createElementBlock("div",ae,[n.createElementVNode("div",se,[n.createElementVNode("div",le,[o.value>0?(n.openBlock(),n.createElementBlock("span",ce," 正在上传 "+n.toDisplayString(o.value)+" 个文件... ",1)):a.value>0?(n.openBlock(),n.createElementBlock("span",de," 已成功上传 "+n.toDisplayString(a.value)+" 个文件 ",1)):n.createCommentVNode("v-if",!0),s.value>0?(n.openBlock(),n.createElementBlock("span",ue," 有 "+n.toDisplayString(s.value)+" 个文件上传失败 ",1)):n.createCommentVNode("v-if",!0)]),n.createElementVNode("div",pe,[n.createElementVNode("button",{class:"upload-progress-action upload-progress-start",onClick:r[0]||(r[0]=e=>t.$emit("upload-all")),disabled:o.value>0}," 开始上传 ",8,fe),n.createElementVNode("button",{class:"upload-progress-action upload-progress-clear",onClick:r[1]||(r[1]=e=>t.$emit("clear"))}," 清空 ")])]),n.createElementVNode("div",he,[n.createElementVNode("div",{class:"upload-progress-bar",style:n.normalizeStyle({width:`${i.value}%`})},null,4),n.createElementVNode("div",me,n.toDisplayString(i.value)+"% ",1)]),n.createElementVNode("div",ge,[n.createElementVNode("div",ve,[n.createElementVNode("span",null,"总数: "+n.toDisplayString(e.fileList.length),1),n.createElementVNode("span",null,"成功: "+n.toDisplayString(a.value),1),n.createElementVNode("span",null,"失败: "+n.toDisplayString(s.value),1),n.createElementVNode("span",null,"等待: "+n.toDisplayString(l.value),1)])])]))}});U("\n.upload-progress[data-v-3a5faed4] {\n margin-top: 12px;\n padding: 12px;\n background-color: #fafafa;\n border-radius: 6px;\n}\n.upload-progress-header[data-v-3a5faed4] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 12px;\n}\n.upload-progress-status[data-v-3a5faed4] {\n font-size: 14px;\n color: #333;\n}\n.upload-progress-uploading[data-v-3a5faed4] {\n color: #1890ff;\n}\n.upload-progress-success[data-v-3a5faed4] {\n color: #52c41a;\n}\n.upload-progress-error[data-v-3a5faed4] {\n color: #ff4d4f;\n}\n.upload-progress-actions[data-v-3a5faed4] {\n display: flex;\n gap: 8px;\n}\n.upload-progress-action[data-v-3a5faed4] {\n font-size: 12px;\n padding: 4px 12px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n background-color: white;\n cursor: pointer;\n transition: all 0.3s;\n}\n.upload-progress-action[data-v-3a5faed4]:hover {\n border-color: #1890ff;\n color: #1890ff;\n}\n.upload-progress-action[data-v-3a5faed4]:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.upload-progress-action[data-v-3a5faed4]:disabled:hover {\n border-color: #d9d9d9;\n color: #999;\n}\n.upload-progress-start[data-v-3a5faed4] {\n color: #1890ff;\n border-color: #1890ff;\n}\n.upload-progress-start[data-v-3a5faed4]:hover {\n background-color: #e6f7ff;\n}\n.upload-progress-clear[data-v-3a5faed4] {\n color: #666;\n}\n.upload-progress-bar-container[data-v-3a5faed4] {\n position: relative;\n height: 8px;\n background-color: #f0f0f0;\n border-radius: 4px;\n overflow: hidden;\n margin-bottom: 8px;\n}\n.upload-progress-bar[data-v-3a5faed4] {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background-color: #1890ff;\n transition: width 0.3s ease;\n}\n.upload-progress-text[data-v-3a5faed4] {\n position: absolute;\n top: 0;\n right: 8px;\n height: 100%;\n display: flex;\n align-items: center;\n font-size: 12px;\n color: #666;\n}\n.upload-progress-footer[data-v-3a5faed4] {\n margin-top: 8px;\n}\n.upload-progress-stats[data-v-3a5faed4] {\n display: flex;\n gap: 16px;\n font-size: 12px;\n color: #999;\n}\n"),ye.__scopeId="data-v-3a5faed4",ye.__file="src/vue/components/Progress.vue";const xe=["multiple","accept"];var be=n.defineComponent({__name:"Upload",props:{className:{type:String,required:!1},style:{type:Object,required:!1},drag:{type:Boolean,required:!1,default:!1},showFileList:{type:Boolean,required:!1,default:!0},listType:{type:String,required:!1,default:"text"},url:{type:String,required:!0},method:{type:String,required:!1,default:"POST"},headers:{type:Object,required:!1},timeout:{type:Number,required:!1,default:3e4},withCredentials:{type:Boolean,required:!1,default:!1},chunkSize:{type:Number,required:!1,default:5242880},chunkRetry:{type:Number,required:!1,default:3},concurrent:{type:Number,required:!1,default:3},autoUpload:{type:Boolean,required:!1,default:!0},multiple:{type:Boolean,required:!1,default:!1},accept:{type:String,required:!1},maxSize:{type:Number,required:!1},minSize:{type:Number,required:!1},onProgress:{type:Function,required:!1},onSuccess:{type:Function,required:!1},onError:{type:Function,required:!1},onCancel:{type:Function,required:!1},beforeUpload:{type:Function,required:!1},onFileListChange:{type:Function,required:!1}},setup(e){const t=e,r=n.ref(),i=n.ref(),o=n.ref(!1),{fileList:a,uploading:s,handleFileSelect:l,uploadAll:c,cancelUpload:d,retryUpload:u,removeFile:p,clearFiles:f}=A(t),h=()=>{var e;null===(e=r.value)||void 0===e||e.click()},m=e=>{const t=e.target;t.files&&(l(t.files),t.value="")},g=e=>{const t=e;t.preventDefault(),"dragenter"===t.type||"dragover"===t.type?o.value=!0:"dragleave"===t.type&&(o.value=!1)},v=e=>{var t;const n=e;n.preventDefault(),o.value=!1,(null===(t=n.dataTransfer)||void 0===t?void 0:t.files)&&l(n.dataTransfer.files)};return(t,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["upload-container",e.className]),style:n.normalizeStyle(e.style)},[n.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",multiple:e.multiple,accept:e.accept,onChange:m,style:{display:"none"}},null,40,xe),e.drag?(n.openBlock(),n.createElementBlock("div",{key:0,ref_key:"dragArea",ref:i,class:n.normalizeClass(["upload-drag",{"upload-dragover":o.value}]),onClick:h,onDragenter:n.withModifiers(g,["prevent"]),onDragover:n.withModifiers(g,["prevent"]),onDragleave:n.withModifiers(g,["prevent"]),onDrop:n.withModifiers(v,["prevent"])},[n.renderSlot(t.$slots,"default",{},()=>[l[0]||(l[0]=n.createElementVNode("div",{class:"upload-default"},[n.createElementVNode("div",{class:"upload-icon"},"+"),n.createElementVNode("div",{class:"upload-text"},"点击或拖拽文件到此区域上传")],-1))])],34)):(n.openBlock(),n.createElementBlock("div",{key:1,class:"upload-trigger",onClick:h},[n.renderSlot(t.$slots,"default",{},()=>[l[1]||(l[1]=n.createElementVNode("div",{class:"upload-default"},[n.createElementVNode("div",{class:"upload-icon"},"+"),n.createElementVNode("div",{class:"upload-text"},"点击上传文件")],-1))])])),e.showFileList?(n.openBlock(),n.createBlock(oe,{key:2,"file-list":n.unref(a),"list-type":e.listType,onCancel:n.unref(d),onRetry:n.unref(u),onRemove:n.unref(p)},null,8,["file-list","list-type","onCancel","onRetry","onRemove"])):n.createCommentVNode("v-if",!0),n.unref(s)?(n.openBlock(),n.createBlock(ye,{key:3,"file-list":n.unref(a),onUploadAll:n.unref(c),onClear:n.unref(f)},null,8,["file-list","onUploadAll","onClear"])):n.createCommentVNode("v-if",!0)],6))}});U("\n.upload-container[data-v-7a506f30] {\r\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n.upload-drag[data-v-7a506f30] {\r\n border: 2px dashed #d9d9d9;\r\n border-radius: 6px;\r\n padding: 40px 20px;\r\n text-align: center;\r\n cursor: pointer;\r\n transition: border-color 0.3s;\n}\n.upload-drag[data-v-7a506f30]:hover,\r\n.upload-dragover[data-v-7a506f30] {\r\n border-color: #1890ff;\n}\n.upload-trigger[data-v-7a506f30] {\r\n display: inline-block;\r\n cursor: pointer;\n}\n.upload-default[data-v-7a506f30] {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n color: #666;\n}\n.upload-icon[data-v-7a506f30] {\r\n font-size: 32px;\r\n color: #999;\r\n margin-bottom: 8px;\n}\n.upload-text[data-v-7a506f30] {\r\n font-size: 14px;\n}\r\n"),be.__scopeId="data-v-7a506f30",be.__file="src/vue/components/Upload.vue";exports.BaseUploader=m,exports.ParallelUploader=k,exports.Progress=ye,exports.ReactUpload=e=>{var{children:n,className:r="",style:i,drag:o=!1,showFileList:a=!0,listType:s="text"}=e,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["children","className","style","drag","showFileList","listType"]);const c=t.useRef(null),d=t.useRef(null),{fileList:u,uploading:p,handleFileSelect:f,uploadAll:h,cancelUpload:m,retryUpload:g,removeFile:v,clearFiles:y}=_(l),x=t.useCallback(()=>{var e;null===(e=c.current)||void 0===e||e.click()},[]),b=t.useCallback(e=>{e.target.files&&(f(e.target.files),e.target.value="")},[f]),k=t.useCallback(e=>{var t,n;e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?null===(t=d.current)||void 0===t||t.classList.add("upload-dragover"):"dragleave"===e.type&&(null===(n=d.current)||void 0===n||n.classList.remove("upload-dragover"))},[]),j=t.useCallback(e=>{var t;e.preventDefault(),e.stopPropagation(),null===(t=d.current)||void 0===t||t.classList.remove("upload-dragover"),e.dataTransfer.files&&f(e.dataTransfer.files)},[f]),C=()=>n||F.jsxs("div",{className:"upload-default",children:[F.jsx("div",{className:"upload-icon",children:"+"}),F.jsx("div",{className:"upload-text",children:"点击或拖拽文件到此区域上传"})]});return F.jsxs("div",{className:`upload-container ${r}`,style:i,children:[F.jsx("input",{ref:c,type:"file",style:{display:"none"},multiple:l.multiple,accept:l.accept,onChange:b}),o?F.jsx("div",{ref:d,className:"upload-drag",onClick:x,onDragEnter:k,onDragOver:k,onDragLeave:k,onDrop:j,children:C()}):F.jsx("div",{className:"upload-trigger",onClick:x,children:C()}),a&&F.jsx(z,{fileList:u,listType:s,onCancel:m,onRetry:g,onRemove:v}),p&&F.jsx(E,{fileList:u,onUploadAll:h,onClear:y})]})},exports.SliceUploader=b,exports.UploadList=oe,exports.VueUpload=be,exports.calculateChunkSize=e=>e<=10485760?e:e<=104857600?5242880:e<=1073741824?10485760:20971520,exports.calculateFileHash=h,exports.createFileChunks=f,exports.defaultConfig={url:"",method:"POST",timeout:3e4,maxRetries:3,retryDelay:1e3,chunkSize:5242880,chunkRetry:3,concurrent:3,autoUpload:!0,multiple:!1,withCredentials:!1},exports.formatFileSize=e=>{if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB","TB"][t]},exports.generateFileId=c,exports.getFileExtension=d,exports.useReactUpload=_,exports.useVueUpload=A,exports.validateFileSize=p,exports.validateFileType=u;
11
11
  //# sourceMappingURL=index.cjs.js.map