Files
aaPanel/BTPanel/static/vite/js/Upload2.js
T
Jack 1459724ba3 Update to 7.10.0
[+] Add Mail Server to the left menu.
[+] Add Mail Server - WebMail (requires Mail Server upgrade 5.1)
[+] Add WP Toolkit Plugin, Theme installation.
[+] Add Mail Server Login info.
[+] Add Mail Server WebMail One-click Login (requires Mail Server upgrade 5.2).
[+] Redesigned Security - Firewall.

[*] Optimized Mass Mail sending speed.
[*] Optimized the CPU usage problem of aaPanel startup service.

[-] Fix apache application, renew SSL issue.
[-] Fix Let's Encrypt account registeration failed.
[-] Fix openlitespeed using capital letters on domain name caused the website cannot be accessed issue.
[-] Fix problem of failure to reset root password in some versions of MariaDB.
[-] Fix an error in modifying Permission in some cases of MySQL.
[-] Fix the Website category display problem.
2024-08-09 09:57:59 +08:00

2 lines
31 KiB
JavaScript

import{cC as e,bz as n,aK as t,bJ as r,bn as o,aY as i,b1 as a,co as l,aQ as s,b5 as d,cx as u,aJ as c,b0 as p,B as f,cN as h,bW as g,b_ as m,aC as v,aE as b,aG as y,aV as w,aH as x,c1 as R,aM as C,aN as k,bN as B,aX as T,aP as P,a$ as L,aZ as O}from"./index.js?v=1723125373998";import{p as D,l as F,a as U,k as j,r as z,I as S,d as E,A as H,T as I,F as A,n as M}from"./vue.js?v=1723125373998";import{p as _,_ as q}from"./Progress.js?v=1723125373998";import{_ as V,D as X,N as G}from"./Image.js?v=1723125373998";import{d as N}from"./DataTable.js?v=1723125373998";const $=e("attach",D("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},D("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},D("g",{fill:"currentColor","fill-rule":"nonzero"},D("path",{d:"M3.25735931,8.70710678 L7.85355339,4.1109127 C8.82986412,3.13460197 10.4127766,3.13460197 11.3890873,4.1109127 C12.365398,5.08722343 12.365398,6.67013588 11.3890873,7.64644661 L6.08578644,12.9497475 C5.69526215,13.3402718 5.06209717,13.3402718 4.67157288,12.9497475 C4.28104858,12.5592232 4.28104858,11.9260582 4.67157288,11.5355339 L9.97487373,6.23223305 C10.1701359,6.0369709 10.1701359,5.72038841 9.97487373,5.52512627 C9.77961159,5.32986412 9.4630291,5.32986412 9.26776695,5.52512627 L3.96446609,10.8284271 C3.18341751,11.6094757 3.18341751,12.8758057 3.96446609,13.6568542 C4.74551468,14.4379028 6.01184464,14.4379028 6.79289322,13.6568542 L12.0961941,8.35355339 C13.4630291,6.98671837 13.4630291,4.77064094 12.0961941,3.40380592 C10.7293591,2.0369709 8.51328163,2.0369709 7.14644661,3.40380592 L2.55025253,8 C2.35499039,8.19526215 2.35499039,8.51184464 2.55025253,8.70710678 C2.74551468,8.90236893 3.06209717,8.90236893 3.25735931,8.70710678 Z"}))))),W=e("trash",D("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},D("path",{d:"M432,144,403.33,419.74A32,32,0,0,1,371.55,448H140.46a32,32,0,0,1-31.78-28.26L80,144",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),D("rect",{x:"32",y:"64",width:"448",height:"80",rx:"16",ry:"16",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),D("line",{x1:"312",y1:"240",x2:"200",y2:"352",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),D("line",{x1:"312",y1:"352",x2:"200",y2:"240",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),Z=e("cancel",D("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},D("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},D("g",{fill:"currentColor","fill-rule":"nonzero"},D("path",{d:"M2.58859116,2.7156945 L2.64644661,2.64644661 C2.82001296,2.47288026 3.08943736,2.45359511 3.2843055,2.58859116 L3.35355339,2.64644661 L8,7.293 L12.6464466,2.64644661 C12.8417088,2.45118446 13.1582912,2.45118446 13.3535534,2.64644661 C13.5488155,2.84170876 13.5488155,3.15829124 13.3535534,3.35355339 L8.707,8 L13.3535534,12.6464466 C13.5271197,12.820013 13.5464049,13.0894374 13.4114088,13.2843055 L13.3535534,13.3535534 C13.179987,13.5271197 12.9105626,13.5464049 12.7156945,13.4114088 L12.6464466,13.3535534 L8,8.707 L3.35355339,13.3535534 C3.15829124,13.5488155 2.84170876,13.5488155 2.64644661,13.3535534 C2.45118446,13.1582912 2.45118446,12.8417088 2.64644661,12.6464466 L7.293,8 L2.64644661,3.35355339 C2.47288026,3.17998704 2.45359511,2.91056264 2.58859116,2.7156945 L2.64644661,2.64644661 L2.58859116,2.7156945 Z"}))))),J=e("retry",D("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},D("path",{d:"M320,146s24.36-12-64-12A160,160,0,1,0,416,294",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-miterlimit: 10; stroke-width: 32px;"}),D("polyline",{points:"256 58 336 138 256 218",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),K=n({name:"Upload",common:t,peers:{Button:r,Progress:_},self:e=>{const{iconColor:n,primaryColor:t,errorColor:r,textColor2:i,successColor:a,opacityDisabled:l,actionColor:s,borderColor:d,hoverColor:u,lineHeight:c,borderRadius:p,fontSize:f}=e;return{fontSize:f,lineHeight:c,borderRadius:p,draggerColor:s,draggerBorder:"1px dashed ".concat(d),draggerBorderHover:"1px dashed ".concat(t),itemColorHover:u,itemColorHoverError:o(r,{alpha:.06}),itemTextColor:i,itemTextColorError:r,itemTextColorSuccess:a,itemIconColor:n,itemDisabledOpacity:l,itemBorderImageCardError:"1px solid ".concat(r),itemBorderImageCard:"1px solid ".concat(d)}}}),Q=i("n-upload"),Y="__UPLOAD_DRAGGER__",ee=F({name:"UploadDragger",[Y]:!0,setup(e,{slots:n}){const t=U(Q,null);return t||a("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:e},mergedDisabledRef:{value:r},maxReachedRef:{value:o}}=t;return D("div",{class:["".concat(e,"-upload-dragger"),(r||o)&&"".concat(e,"-upload-dragger--disabled")]},n)}}});var ne=function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(n){i(n)}}function l(e){try{s(r.throw(e))}catch(n){i(n)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,l)}s((r=r.apply(e,n||[])).next())}))};const te=e=>e.includes("image/"),re=(e="")=>{const n=e.split("/"),t=n[n.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(t)||[""])[0]},oe=/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i,ie=e=>{if(e.type)return te(e.type);const n=re(e.name||"");if(oe.test(n))return!0;const t=e.thumbnailUrl||e.url||"",r=re(t);return!(!/^data:image\//.test(t)&&!oe.test(r))};const ae=l&&window.FileReader&&window.File;function le(e){return e.isFile}function se(e){const{id:n,name:t,percentage:r,status:o,url:i,file:a,thumbnailUrl:l,type:s,fullPath:d,batchId:u}=e;return{id:n,name:t,percentage:null!=r?r:null,status:o,url:null!=i?i:null,file:null!=a?a:null,thumbnailUrl:null!=l?l:null,type:null!=s?s:null,fullPath:null!=d?d:null,batchId:null!=u?u:null}}const de=F({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:n}){const t=U(Q,null);t||a("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:r,mergedDisabledRef:o,maxReachedRef:i,listTypeRef:l,dragOverRef:c,openOpenFileDialog:p,draggerInsideRef:f,handleFileAddition:h,mergedDirectoryDndRef:g,triggerClassRef:m,triggerStyleRef:v}=t,b=j((()=>"image-card"===l.value));function y(){o.value||i.value||p()}function w(e){e.preventDefault(),c.value=!0}function x(e){e.preventDefault(),c.value=!0}function R(e){e.preventDefault(),c.value=!1}function C(e){var n;if(e.preventDefault(),!f.value||o.value||i.value)return void(c.value=!1);const t=null===(n=e.dataTransfer)||void 0===n?void 0:n.items;(null==t?void 0:t.length)?function(e,t){return ne(this,void 0,void 0,(function*(){const r=[];return yield function e(o){return ne(this,void 0,void 0,(function*(){for(const a of o)if(a)if(t&&a.isDirectory){const t=a.createReader();try{const n=yield new Promise(((e,n)=>{t.readEntries(e,n)}));yield e(n)}catch(n){}}else if(le(a))try{const e=yield new Promise(((e,n)=>{a.file(e,n)}));r.push({file:e,entry:a,source:"dnd"})}catch(i){}}))}(e),r}))}(Array.from(t).map((e=>e.webkitGetAsEntry())),g.value).then((e=>{h(e)})).finally((()=>{c.value=!1})):c.value=!1}return()=>{var t;const{value:a}=r;return e.abstract?null===(t=n.default)||void 0===t?void 0:t.call(n,{handleClick:y,handleDrop:C,handleDragOver:w,handleDragEnter:x,handleDragLeave:R}):D("div",{class:["".concat(a,"-upload-trigger"),(o.value||i.value)&&"".concat(a,"-upload-trigger--disabled"),b.value&&"".concat(a,"-upload-trigger--image-card"),m.value],style:v.value,onClick:y,onDrop:C,onDragover:w,onDragenter:x,onDragleave:R},b.value?D(ee,null,{default:()=>s(n.default,(()=>[D(d,{clsPrefix:a},{default:()=>D(u,null)})]))}):n)}}}),ue=F({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup:()=>({mergedTheme:U(Q).mergedThemeRef}),render(){return D(c,null,{default:()=>this.show?D(q,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}}),ce=D("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},D("g",{fill:"none"},D("path",{d:"M21.75 3A3.25 3.25 0 0 1 25 6.25v15.5A3.25 3.25 0 0 1 21.75 25H6.25A3.25 3.25 0 0 1 3 21.75V6.25A3.25 3.25 0 0 1 6.25 3h15.5zm.583 20.4l-7.807-7.68a.75.75 0 0 0-.968-.07l-.084.07l-7.808 7.68c.183.065.38.1.584.1h15.5c.204 0 .4-.035.583-.1l-7.807-7.68l7.807 7.68zM21.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v15.5c0 .208.036.408.103.593l7.82-7.692a2.25 2.25 0 0 1 3.026-.117l.129.117l7.82 7.692c.066-.185.102-.385.102-.593V6.25a1.75 1.75 0 0 0-1.75-1.75zm-3.25 3a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5zm0 1.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2z",fill:"currentColor"}))),pe=D("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},D("g",{fill:"none"},D("path",{d:"M6.4 2A2.4 2.4 0 0 0 4 4.4v19.2A2.4 2.4 0 0 0 6.4 26h15.2a2.4 2.4 0 0 0 2.4-2.4V11.578c0-.729-.29-1.428-.805-1.944l-6.931-6.931A2.4 2.4 0 0 0 14.567 2H6.4zm-.9 2.4a.9.9 0 0 1 .9-.9H14V10a2 2 0 0 0 2 2h6.5v11.6a.9.9 0 0 1-.9.9H6.4a.9.9 0 0 1-.9-.9V4.4zm16.44 6.1H16a.5.5 0 0 1-.5-.5V4.06l6.44 6.44z",fill:"currentColor"})));var fe=function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(n){i(n)}}function l(e){try{s(r.throw(e))}catch(n){i(n)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,l)}s((r=r.apply(e,n||[])).next())}))};const he={paddingMedium:"0 3px",heightMedium:"24px",iconSizeMedium:"18px"},ge=F({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0},index:{type:Number,required:!0}},setup(e){const n=U(Q),t=z(null),r=z(""),o=j((()=>{const{file:n}=e;return"finished"===n.status?"success":"error"===n.status?"error":"info"})),i=j((()=>{const{file:n}=e;if("error"===n.status)return"error"})),a=j((()=>{const{file:n}=e;return"uploading"===n.status})),l=j((()=>{if(!n.showCancelButtonRef.value)return!1;const{file:t}=e;return["uploading","pending","error"].includes(t.status)})),s=j((()=>{if(!n.showRemoveButtonRef.value)return!1;const{file:t}=e;return["finished"].includes(t.status)})),d=j((()=>{if(!n.showDownloadButtonRef.value)return!1;const{file:t}=e;return["finished"].includes(t.status)})),u=j((()=>{if(!n.showRetryButtonRef.value)return!1;const{file:t}=e;return["error"].includes(t.status)})),c=p((()=>r.value||e.file.thumbnailUrl||e.file.url)),f=j((()=>{if(!n.showPreviewButtonRef.value)return!1;const{file:{status:t},listType:r}=e;return["finished"].includes(t)&&c.value&&"image-card"===r}));function h(t){const{xhrMap:r,doChange:o,onRemoveRef:{value:i},mergedFileListRef:{value:a}}=n;Promise.resolve(!i||i({file:Object.assign({},t),fileList:a,index:e.index})).then((e=>{if(!1===e)return;const n=Object.assign({},t,{status:"removed"});r.delete(t.id),o(n,void 0,{remove:!0})}))}const g=()=>fe(this,void 0,void 0,(function*(){const{listType:t}=e;"image"!==t&&"image-card"!==t||n.shouldUseThumbnailUrlRef.value(e.file)&&(r.value=yield n.getFileThumbnailUrlResolver(e.file))}));return S((()=>{g()})),{mergedTheme:n.mergedThemeRef,progressStatus:o,buttonType:i,showProgress:a,disabled:n.mergedDisabledRef,showCancelButton:l,showRemoveButton:s,showDownloadButton:d,showRetryButton:u,showPreviewButton:f,mergedThumbnailUrl:c,shouldUseThumbnailUrl:n.shouldUseThumbnailUrlRef,renderIcon:n.renderIconRef,imageRef:t,handleRemoveOrCancelClick:function(t){t.preventDefault();const{file:r}=e;["finished","pending","error"].includes(r.status)?h(r):["uploading"].includes(r.status)?function(e){const{xhrMap:t}=n,r=t.get(e.id);null==r||r.abort(),h(Object.assign({},e))}(r):m("upload","The button clicked type is unknown.")},handleDownloadClick:function(t){t.preventDefault(),function(e){const{onDownloadRef:{value:t}}=n;Promise.resolve(!t||t(Object.assign({},e))).then((n=>{!1!==n&&N(e.url,e.name)}))}(e.file)},handleRetryClick:function(){n.submit(e.file.id)},handlePreviewClick:function(){const{onPreviewRef:{value:r}}=n;if(r)r(e.file);else if("image-card"===e.listType){const{value:e}=t;if(!e)return;e.click()}}}},render(){const{clsPrefix:e,mergedTheme:n,listType:t,file:r,renderIcon:o}=this;let i;const a="image"===t;i=a||"image-card"===t?this.shouldUseThumbnailUrl(r)&&this.mergedThumbnailUrl?D("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,class:"".concat(e,"-upload-file-info__thumbnail"),onClick:this.handlePreviewClick},"image-card"===t?D(V,{src:this.mergedThumbnailUrl||void 0,previewSrc:r.url||void 0,alt:r.name,ref:"imageRef"}):D("img",{src:this.mergedThumbnailUrl||void 0,alt:r.name})):D("span",{class:"".concat(e,"-upload-file-info__thumbnail")},o?o(r):ie(r)?D(d,{clsPrefix:e},{default:()=>ce}):D(d,{clsPrefix:e},{default:()=>pe})):D("span",{class:"".concat(e,"-upload-file-info__thumbnail")},o?o(r):D(d,{clsPrefix:e},{default:()=>D($,null)}));const l=D(ue,{show:this.showProgress,percentage:r.percentage||0,status:this.progressStatus}),s="text"===t||"image"===t;return D("div",{class:["".concat(e,"-upload-file"),"".concat(e,"-upload-file--").concat(this.progressStatus,"-status"),r.url&&"error"!==r.status&&"image-card"!==t&&"".concat(e,"-upload-file--with-url"),"".concat(e,"-upload-file--").concat(t,"-type")]},D("div",{class:"".concat(e,"-upload-file-info")},i,D("div",{class:"".concat(e,"-upload-file-info__name")},s&&(r.url&&"error"!==r.status?D("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,onClick:this.handlePreviewClick},r.name):D("span",{onClick:this.handlePreviewClick},r.name)),a&&l),D("div",{class:["".concat(e,"-upload-file-info__action"),"".concat(e,"-upload-file-info__action--").concat(t,"-type")]},this.showPreviewButton?D(f,{key:"preview",quaternary:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button,builtinThemeOverrides:he},{icon:()=>D(d,{clsPrefix:e},{default:()=>D(h,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&D(f,{key:"cancelOrTrash",theme:n.peers.Button,themeOverrides:n.peerOverrides.Button,quaternary:!0,builtinThemeOverrides:he,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>D(g,null,{default:()=>this.showRemoveButton?D(d,{clsPrefix:e,key:"trash"},{default:()=>D(W,null)}):D(d,{clsPrefix:e,key:"cancel"},{default:()=>D(Z,null)})})}),this.showRetryButton&&!this.disabled&&D(f,{key:"retry",quaternary:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button,builtinThemeOverrides:he},{icon:()=>D(d,{clsPrefix:e},{default:()=>D(J,null)})}),this.showDownloadButton?D(f,{key:"download",quaternary:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button,builtinThemeOverrides:he},{icon:()=>D(d,{clsPrefix:e},{default:()=>D(X,null)})}):null)),!a&&l)}}),me=F({name:"UploadFileList",setup(e,{slots:n}){const t=U(Q,null);t||a("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:r,mergedClsPrefixRef:o,listTypeRef:i,mergedFileListRef:l,fileListClassRef:s,fileListStyleRef:d,cssVarsRef:u,themeClassRef:p,maxReachedRef:f,showTriggerRef:h,imageGroupPropsRef:g}=t,m=j((()=>"image-card"===i.value)),v=()=>l.value.map(((e,n)=>D(ge,{clsPrefix:o.value,key:e.id,file:e,index:n,listType:i.value})));return()=>{const{value:e}=o,{value:t}=r;return D("div",{class:["".concat(e,"-upload-file-list"),m.value&&"".concat(e,"-upload-file-list--grid"),t?null==p?void 0:p.value:void 0,s.value],style:[t&&u?u.value:"",d.value]},m.value?D(G,Object.assign({},g.value),{default:v}):D(c,{group:!0},{default:v}),h.value&&!f.value&&m.value&&D(de,null,n))}}}),ve=v([b("upload","width: 100%;",[y("dragger-inside",[b("upload-trigger","\n display: block;\n ")]),y("drag-over",[b("upload-dragger","\n border: var(--n-dragger-border-hover);\n ")])]),b("upload-dragger","\n cursor: pointer;\n box-sizing: border-box;\n width: 100%;\n text-align: center;\n border-radius: var(--n-border-radius);\n padding: 24px;\n opacity: 1;\n transition:\n opacity .3s var(--n-bezier),\n border-color .3s var(--n-bezier),\n background-color .3s var(--n-bezier);\n background-color: var(--n-dragger-color);\n border: var(--n-dragger-border);\n ",[v("&:hover","\n border: var(--n-dragger-border-hover);\n "),y("disabled","\n cursor: not-allowed;\n ")]),b("upload-trigger","\n display: inline-block;\n box-sizing: border-box;\n opacity: 1;\n transition: opacity .3s var(--n-bezier);\n ",[v("+",[b("upload-file-list","margin-top: 8px;")]),y("disabled","\n opacity: var(--n-item-disabled-opacity);\n cursor: not-allowed;\n "),y("image-card","\n width: 96px;\n height: 96px;\n ",[b("base-icon","\n font-size: 24px;\n "),b("upload-dragger","\n padding: 0;\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n ")])]),b("upload-file-list","\n line-height: var(--n-line-height);\n opacity: 1;\n transition: opacity .3s var(--n-bezier);\n ",[v("a, img","outline: none;"),y("disabled","\n opacity: var(--n-item-disabled-opacity);\n cursor: not-allowed;\n ",[b("upload-file","cursor: not-allowed;")]),y("grid","\n display: grid;\n grid-template-columns: repeat(auto-fill, 96px);\n grid-gap: 8px;\n margin-top: 0;\n "),b("upload-file","\n display: block;\n box-sizing: border-box;\n cursor: default;\n padding: 0px 12px 0 6px;\n transition: background-color .3s var(--n-bezier);\n border-radius: var(--n-border-radius);\n ",[w(),b("progress",[w({foldPadding:!0})]),v("&:hover","\n background-color: var(--n-item-color-hover);\n ",[b("upload-file-info",[x("action","\n opacity: 1;\n ")])]),y("image-type","\n border-radius: var(--n-border-radius);\n text-decoration: underline;\n text-decoration-color: #0000;\n ",[b("upload-file-info","\n padding-top: 0px;\n padding-bottom: 0px;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 6px 0;\n ",[b("progress","\n padding: 2px 0;\n margin-bottom: 0;\n "),x("name","\n padding: 0 8px;\n "),x("thumbnail","\n width: 32px;\n height: 32px;\n font-size: 28px;\n display: flex;\n justify-content: center;\n align-items: center;\n ",[v("img","\n width: 100%;\n ")])])]),y("text-type",[b("progress","\n box-sizing: border-box;\n padding-bottom: 6px;\n margin-bottom: 6px;\n ")]),y("image-card-type","\n position: relative;\n width: 96px;\n height: 96px;\n border: var(--n-item-border-image-card);\n border-radius: var(--n-border-radius);\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: border-color .3s var(--n-bezier), background-color .3s var(--n-bezier);\n border-radius: var(--n-border-radius);\n overflow: hidden;\n ",[b("progress","\n position: absolute;\n left: 8px;\n bottom: 8px;\n right: 8px;\n width: unset;\n "),b("upload-file-info","\n padding: 0;\n width: 100%;\n height: 100%;\n ",[x("thumbnail","\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n font-size: 36px;\n ",[v("img","\n width: 100%;\n ")])]),v("&::before",'\n position: absolute;\n z-index: 1;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n border-radius: inherit;\n opacity: 0;\n transition: opacity .2s var(--n-bezier);\n content: "";\n '),v("&:hover",[v("&::before","opacity: 1;"),b("upload-file-info",[x("thumbnail","opacity: .12;")])])]),y("error-status",[v("&:hover","\n background-color: var(--n-item-color-hover-error);\n "),b("upload-file-info",[x("name","color: var(--n-item-text-color-error);"),x("thumbnail","color: var(--n-item-text-color-error);")]),y("image-card-type","\n border: var(--n-item-border-image-card-error);\n ")]),y("with-url","\n cursor: pointer;\n ",[b("upload-file-info",[x("name","\n color: var(--n-item-text-color-success);\n text-decoration-color: var(--n-item-text-color-success);\n ",[v("a","\n text-decoration: underline;\n ")])])]),b("upload-file-info","\n position: relative;\n padding-top: 6px;\n padding-bottom: 6px;\n display: flex;\n flex-wrap: nowrap;\n ",[x("thumbnail","\n font-size: 18px;\n opacity: 1;\n transition: opacity .2s var(--n-bezier);\n color: var(--n-item-icon-color);\n ",[b("base-icon","\n margin-right: 2px;\n vertical-align: middle;\n transition: color .3s var(--n-bezier);\n ")]),x("action","\n padding-top: inherit;\n padding-bottom: inherit;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n width: 80px;\n display: flex;\n align-items: center;\n transition: opacity .2s var(--n-bezier);\n justify-content: flex-end;\n opacity: 0;\n ",[b("button",[v("&:not(:last-child)",{marginRight:"4px"}),b("base-icon",[v("svg",[R()])])]),y("image-type","\n position: relative;\n max-width: 80px;\n width: auto;\n "),y("image-card-type","\n z-index: 2;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n ")]),x("name","\n color: var(--n-item-text-color);\n flex: 1;\n display: flex;\n justify-content: center;\n text-overflow: ellipsis;\n overflow: hidden;\n flex-direction: column;\n text-decoration-color: #0000;\n font-size: var(--n-font-size);\n transition:\n color .3s var(--n-bezier),\n text-decoration-color .3s var(--n-bezier); \n ",[v("a","\n color: inherit;\n text-decoration: underline;\n ")])])])]),b("upload-file-input","\n display: none;\n width: 0;\n height: 0;\n opacity: 0;\n ")]);var be=function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(n){i(n)}}function l(e){try{s(r.throw(e))}catch(n){i(n)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,l)}s((r=r.apply(e,n||[])).next())}))};function ye(e,n,t){const r=function(e,n,t){const{doChange:r,xhrMap:o}=e;let i=0;function a(t){var a;let l=Object.assign({},n,{status:"error",percentage:i});o.delete(n.id),l=se((null===(a=e.onError)||void 0===a?void 0:a.call(e,{file:l,event:t}))||l),r(l,t)}return{handleXHRLoad:function(l){var s;if(e.isErrorState){if(e.isErrorState(t))return void a(l)}else if(t.status<200||t.status>=300)return void a(l);let d=Object.assign({},n,{status:"finished",percentage:i});o.delete(n.id),d=se((null===(s=e.onFinish)||void 0===s?void 0:s.call(e,{file:d,event:l}))||d),r(d,l)},handleXHRError:a,handleXHRAbort(e){const t=Object.assign({},n,{status:"removed",file:null,percentage:i});o.delete(n.id),r(t,e)},handleXHRProgress(e){const t=Object.assign({},n,{status:"uploading"});if(e.lengthComputable){const n=Math.ceil(e.loaded/e.total*100);t.percentage=n,i=n}r(t,e)}}}(e,n,t);t.onabort=r.handleXHRAbort,t.onerror=r.handleXHRError,t.onload=r.handleXHRLoad,t.upload&&(t.upload.onprogress=r.handleXHRProgress)}function we(e,n){return"function"==typeof e?e({file:n}):e||{}}function xe(e,n,t,{method:r,action:o,withCredentials:i,responseType:a,headers:l,data:s}){const d=new XMLHttpRequest;d.responseType=a,e.xhrMap.set(t.id,d),d.withCredentials=i;const u=new FormData;if(function(e,n,t){const r=we(n,t);r&&Object.keys(r).forEach((n=>{e.append(n,r[n])}))}(u,s,t),null!==t.file&&u.append(n,t.file),ye(e,t,d),void 0!==o){d.open(r.toUpperCase(),o),function(e,n,t){const r=we(n,t);r&&Object.keys(r).forEach((n=>{e.setRequestHeader(n,r[n])}))}(d,l,t),d.send(u);const n=Object.assign({},t,{status:"uploading"});e.doChange(n)}}const Re=F({name:"Upload",props:Object.assign(Object.assign({},k.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,directory:Boolean,directoryDnd:{type:Boolean,default:void 0},method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,responseType:{type:String,default:""},disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload:Function,isErrorState:Function,onDownload:Function,defaultUpload:{type:Boolean,default:!0},fileList:Array,"onUpdate:fileList":[Function,Array],onUpdateFileList:[Function,Array],fileListClass:String,fileListStyle:[String,Object],defaultFileList:{type:Array,default:()=>[]},showCancelButton:{type:Boolean,default:!0},showRemoveButton:{type:Boolean,default:!0},showDownloadButton:Boolean,showRetryButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},listType:{type:String,default:"text"},onPreview:Function,shouldUseThumbnailUrl:{type:Function,default:e=>!!ae&&ie(e)},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerClass:String,triggerStyle:[String,Object],renderIcon:Function}),setup(e){e.abstract&&"image-card"===e.listType&&a("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:n,inlineThemeDisabled:t}=C(e),r=k("Upload","-upload",ve,K,e,n),o=B(e),i=j((()=>{const{max:n}=e;return void 0!==n&&h.value.length>=n})),l=z(e.defaultFileList),s=E(e,"fileList"),d=z(null),u={value:!1},c=z(!1),p=new Map,f=T(s,l),h=j((()=>f.value.map(se)));function g(){var e;null===(e=d.value)||void 0===e||e.click()}const m=j((()=>e.multiple||e.directory));function v(n,t){if(!n||0===n.length)return;const{onBeforeUpload:r}=e;n=m.value?n:[n[0]];const{max:o,accept:i}=e;n=n.filter((({file:e,source:n})=>"dnd"!==n||!(null==i?void 0:i.trim())||function(e,n,t){return e=e.toLowerCase(),n=n.toLocaleLowerCase(),(t=t.toLocaleLowerCase()).split(",").map((e=>e.trim())).filter(Boolean).some((t=>{if(t.startsWith(".")){if(e.endsWith(t))return!0}else{if(!t.includes("/"))return!0;{const[e,r]=n.split("/"),[o,i]=t.split("/");if(("*"===o||e&&o&&o===e)&&("*"===i||r&&i&&i===r))return!0}}return!1}))}(e.name,e.type,i))),o&&(n=n.slice(0,o-h.value.length));const a=L();Promise.all(n.map((e=>be(this,[e],void 0,(function*({file:e,entry:n}){var t;const o={id:L(),batchId:a,name:e.name,status:"pending",percentage:0,file:e,url:null,type:e.type,thumbnailUrl:null,fullPath:null!==(t=null==n?void 0:n.fullPath)&&void 0!==t?t:"/".concat(e.webkitRelativePath||e.name)};return r&&!1===(yield r({file:o,fileList:h.value}))?null:o}))))).then((e=>be(this,void 0,void 0,(function*(){let n=Promise.resolve();e.forEach((e=>{n=n.then(M).then((()=>{e&&y(e,t,{append:!0})}))})),yield n})))).then((()=>{e.defaultUpload&&b()}))}function b(n){const{method:t,action:r,withCredentials:o,headers:i,data:a,name:l}=e,s=void 0!==n?h.value.filter((e=>e.id===n)):h.value,d=void 0!==n;s.forEach((n=>{const{status:s}=n;("pending"===s||"error"===s&&d)&&(e.customRequest?function(e){const{inst:n,file:t,data:r,headers:o,withCredentials:i,action:a,customRequest:l}=e,{doChange:s}=e.inst;let d=0;l({file:t,data:r,headers:o,withCredentials:i,action:a,onProgress(e){const n=Object.assign({},t,{status:"uploading"}),r=e.percent;n.percentage=r,d=r,s(n)},onFinish(){var e;let r=Object.assign({},t,{status:"finished",percentage:d});r=se((null===(e=n.onFinish)||void 0===e?void 0:e.call(n,{file:r}))||r),s(r)},onError(){var e;let r=Object.assign({},t,{status:"error",percentage:d});r=se((null===(e=n.onError)||void 0===e?void 0:e.call(n,{file:r}))||r),s(r)}})}({inst:{doChange:y,xhrMap:p,onFinish:e.onFinish,onError:e.onError},file:n,action:r,withCredentials:o,headers:i,data:a,customRequest:e.customRequest}):xe({doChange:y,xhrMap:p,onFinish:e.onFinish,onError:e.onError,isErrorState:e.isErrorState},l,n,{method:t,action:r,withCredentials:o,responseType:e.responseType,headers:i,data:a}))}))}const y=(n,t,r={append:!1,remove:!1})=>{const{append:o,remove:i}=r,a=Array.from(h.value),s=a.findIndex((e=>e.id===n.id));if(o||i||~s){o?a.push(n):i?a.splice(s,1):a.splice(s,1,n);const{onChange:r}=e;r&&r({file:n,fileList:a,event:t}),function(n){const{"onUpdate:fileList":t,onUpdateFileList:r}=e;t&&O(t,n),r&&O(r,n),l.value=n}(a)}};const w=j((()=>{const{common:{cubicBezierEaseInOut:e},self:{draggerColor:n,draggerBorder:t,draggerBorderHover:o,itemColorHover:i,itemColorHoverError:a,itemTextColorError:l,itemTextColorSuccess:s,itemTextColor:d,itemIconColor:u,itemDisabledOpacity:c,lineHeight:p,borderRadius:f,fontSize:h,itemBorderImageCardError:g,itemBorderImageCard:m}}=r.value;return{"--n-bezier":e,"--n-border-radius":f,"--n-dragger-border":t,"--n-dragger-border-hover":o,"--n-dragger-color":n,"--n-font-size":h,"--n-item-color-hover":i,"--n-item-color-hover-error":a,"--n-item-disabled-opacity":c,"--n-item-icon-color":u,"--n-item-text-color":d,"--n-item-text-color-error":l,"--n-item-text-color-success":s,"--n-line-height":p,"--n-item-border-image-card-error":g,"--n-item-border-image-card":m}})),x=t?P("upload",void 0,w,e):void 0;H(Q,{mergedClsPrefixRef:n,mergedThemeRef:r,showCancelButtonRef:E(e,"showCancelButton"),showDownloadButtonRef:E(e,"showDownloadButton"),showRemoveButtonRef:E(e,"showRemoveButton"),showRetryButtonRef:E(e,"showRetryButton"),onRemoveRef:E(e,"onRemove"),onDownloadRef:E(e,"onDownload"),mergedFileListRef:h,triggerClassRef:E(e,"triggerClass"),triggerStyleRef:E(e,"triggerStyle"),shouldUseThumbnailUrlRef:E(e,"shouldUseThumbnailUrl"),renderIconRef:E(e,"renderIcon"),xhrMap:p,submit:b,doChange:y,showPreviewButtonRef:E(e,"showPreviewButton"),onPreviewRef:E(e,"onPreview"),getFileThumbnailUrlResolver:function(n){var t;if(n.thumbnailUrl)return n.thumbnailUrl;const{createThumbnailUrl:r}=e;return r?null!==(t=r(n.file,n))&&void 0!==t?t:n.url||"":n.url?n.url:n.file?function(e){return ne(this,void 0,void 0,(function*(){return yield new Promise((n=>{e.type&&te(e.type)?n(window.URL.createObjectURL(e)):n("")}))}))}(n.file):""},listTypeRef:E(e,"listType"),dragOverRef:c,openOpenFileDialog:g,draggerInsideRef:u,handleFileAddition:v,mergedDisabledRef:o.mergedDisabledRef,maxReachedRef:i,fileListClassRef:E(e,"fileListClass"),fileListStyleRef:E(e,"fileListStyle"),abstractRef:E(e,"abstract"),acceptRef:E(e,"accept"),cssVarsRef:t?void 0:w,themeClassRef:null==x?void 0:x.themeClass,onRender:null==x?void 0:x.onRender,showTriggerRef:E(e,"showTrigger"),imageGroupPropsRef:E(e,"imageGroupProps"),mergedDirectoryDndRef:j((()=>{var n;return null!==(n=e.directoryDnd)&&void 0!==n?n:e.directory}))});const R={clear:()=>{l.value=[]},submit:b,openOpenFileDialog:g};return Object.assign({mergedClsPrefix:n,draggerInsideRef:u,inputElRef:d,mergedTheme:r,dragOver:c,mergedMultiple:m,cssVars:t?void 0:w,themeClass:null==x?void 0:x.themeClass,onRender:null==x?void 0:x.onRender,handleFileInputChange:function(e){const n=e.target;v(n.files?Array.from(n.files).map((e=>({file:e,entry:null,source:"input"}))):null,e),n.value=""}},R)},render(){var e,n;const{draggerInsideRef:t,mergedClsPrefix:r,$slots:o,directory:i,onRender:a}=this;if(o.default&&!this.abstract){const n=o.default()[0];(null===(e=null==n?void 0:n.type)||void 0===e?void 0:e[Y])&&(t.value=!0)}const l=D("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:"".concat(r,"-upload-file-input"),accept:this.accept,multiple:this.mergedMultiple,onChange:this.handleFileInputChange,webkitdirectory:i||void 0,directory:i||void 0}));return this.abstract?D(A,null,null===(n=o.default)||void 0===n?void 0:n.call(o),D(I,{to:"body"},l)):(null==a||a(),D("div",{class:["".concat(r,"-upload"),t.value&&"".concat(r,"-upload--dragger-inside"),this.dragOver&&"".concat(r,"-upload--drag-over"),this.themeClass],style:this.cssVars},l,this.showTrigger&&"image-card"!==this.listType&&D(de,null,o),this.showFileList&&D(me,null,o)))}});export{Re as _,ee as a};