mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-01-31 00:53:20 +08:00
2 lines
76 KiB
JavaScript
2 lines
76 KiB
JavaScript
(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[282],{200:function(e,t,o){"use strict";o(5331)},213:function(e,t,o){"use strict";o(5331),o(9104)},333:function(e,t,o){"use strict";o(5331),o(6711)},670:function(e,t,o){"use strict";o(5331),o(9648),o(9104),o(5970)},1393:function(e,t,o){o(6573),o(8100),o(7936),o(9577),o(1549),o(9797),o(9631),o(5623),o(4979),o(4603),o(7566),o(8721),function(t,o){e.exports=o()}(0,function(){return function(e){var t={};function o(s){if(t[s])return t[s].exports;var l=t[s]={i:s,l:!1,exports:{}};return e[s].call(l.exports,l,l.exports,o),l.l=!0,l.exports}return o.m=e,o.c=t,o.d=function(e,t,s){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(o.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)o.d(s,l,function(t){return e[t]}.bind(null,l));return s},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";var s;function l(e){return["image/png","image/jpeg","image/gif"].some(t=>t===e)}o.r(t),o.d(t,"canvastoDataURL",function(){return i}),o.d(t,"canvastoFile",function(){return n}),o.d(t,"dataURLtoFile",function(){return c}),o.d(t,"dataURLtoImage",function(){return d}),o.d(t,"downloadFile",function(){return u}),o.d(t,"filetoDataURL",function(){return p}),o.d(t,"imagetoCanvas",function(){return m}),o.d(t,"urltoBlob",function(){return g}),o.d(t,"urltoImage",function(){return f}),o.d(t,"compress",function(){return y}),o.d(t,"compressAccurately",function(){return C}),o.d(t,"EImageType",function(){return s}),function(e){e.PNG="image/png",e.JPEG="image/jpeg",e.GIF="image/gif"}(s||(s={}));var a=function(e,t,o,s){return new(o||(o=Promise))(function(l,a){function i(e){try{r(s.next(e))}catch(e){a(e)}}function n(e){try{r(s.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?l(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(i,n)}r((s=s.apply(e,t||[])).next())})};function i(e,t=.92,o=s.JPEG){return a(this,void 0,void 0,function*(){return l(o)||(o=s.JPEG),e.toDataURL(o,t)})}function n(e,t=.92,o=s.JPEG){return new Promise(s=>e.toBlob(e=>s(e),o,t))}var r=function(e,t,o,s){return new(o||(o=Promise))(function(l,a){function i(e){try{r(s.next(e))}catch(e){a(e)}}function n(e){try{r(s.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?l(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(i,n)}r((s=s.apply(e,t||[])).next())})};function c(e,t){return r(this,void 0,void 0,function*(){const o=e.split(",");let s=o[0].match(/:(.*?);/)[1];const a=atob(o[1]);let i=a.length;const n=new Uint8Array(i);for(;i--;)n[i]=a.charCodeAt(i);return l(t)&&(s=t),new Blob([n],{type:s})})}function d(e){return new Promise((t,o)=>{const s=new Image;s.onload=()=>t(s),s.onerror=()=>o(new Error("dataURLtoImage(): dataURL is illegal")),s.src=e})}function u(e,t){const o=document.createElement("a");o.href=window.URL.createObjectURL(e),o.download=t||Date.now().toString(36),document.body.appendChild(o);const s=document.createEvent("MouseEvents");s.initEvent("click",!1,!1),o.dispatchEvent(s),document.body.removeChild(o)}function p(e){return new Promise(t=>{const o=new FileReader;o.onloadend=e=>t(e.target.result),o.readAsDataURL(e)})}var h=function(e,t,o,s){return new(o||(o=Promise))(function(l,a){function i(e){try{r(s.next(e))}catch(e){a(e)}}function n(e){try{r(s.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?l(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(i,n)}r((s=s.apply(e,t||[])).next())})};function m(e,t={}){return h(this,void 0,void 0,function*(){const o=Object.assign({},t),s=document.createElement("canvas"),l=s.getContext("2d");let a,i;for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&(o[e]=Number(o[e]));if(o.scale){const t=o.scale>0&&o.scale<10?o.scale:1;i=e.width*t,a=e.height*t}else i=o.width||o.height*e.width/e.height||e.width,a=o.height||o.width*e.height/e.width||e.height;switch([5,6,7,8].some(e=>e===o.orientation)?(s.height=i,s.width=a):(s.height=a,s.width=i),o.orientation){case 3:l.rotate(180*Math.PI/180),l.drawImage(e,-s.width,-s.height,s.width,s.height);break;case 6:l.rotate(90*Math.PI/180),l.drawImage(e,0,-s.width,s.height,s.width);break;case 8:l.rotate(270*Math.PI/180),l.drawImage(e,-s.height,0,s.height,s.width);break;case 2:l.translate(s.width,0),l.scale(-1,1),l.drawImage(e,0,0,s.width,s.height);break;case 4:l.translate(s.width,0),l.scale(-1,1),l.rotate(180*Math.PI/180),l.drawImage(e,-s.width,-s.height,s.width,s.height);break;case 5:l.translate(s.width,0),l.scale(-1,1),l.rotate(90*Math.PI/180),l.drawImage(e,0,-s.width,s.height,s.width);break;case 7:l.translate(s.width,0),l.scale(-1,1),l.rotate(270*Math.PI/180),l.drawImage(e,-s.height,0,s.height,s.width);break;default:l.drawImage(e,0,0,s.width,s.height)}return s})}function g(e){return fetch(e).then(e=>e.blob())}function f(e){return new Promise((t,o)=>{const s=new Image;s.onload=()=>t(s),s.onerror=()=>o(new Error("urltoImage(): Image failed to load, please check the image URL")),s.src=e})}var b=function(e,t,o,s){return new(o||(o=Promise))(function(l,a){function i(e){try{r(s.next(e))}catch(e){a(e)}}function n(e){try{r(s.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?l(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(i,n)}r((s=s.apply(e,t||[])).next())})};function y(e,t={}){return b(this,void 0,void 0,function*(){if(!(e instanceof Blob))throw new Error("compress(): First arg must be a Blob object or a File object.");if("object"!=typeof t&&(t=Object.assign({quality:t})),t.quality=Number(t.quality),Number.isNaN(t.quality))return e;const o=yield p(e);let a=o.split(",")[0].match(/:(.*?);/)[1],n=s.JPEG;l(t.type)&&(n=t.type,a=t.type);const r=yield d(o),u=yield m(r,Object.assign({},t)),h=yield i(u,t.quality,n),g=yield c(h,a);return g.size>e.size?e:g})}function C(e,t={}){return b(this,void 0,void 0,function*(){if(!(e instanceof Blob))throw new Error("compressAccurately(): First arg must be a Blob object or a File object.");if("object"!=typeof t&&(t=Object.assign({size:t})),t.size=Number(t.size),Number.isNaN(t.size))return e;if(1024*t.size>e.size)return e;t.accuracy=Number(t.accuracy),(!t.accuracy||t.accuracy<.8||t.accuracy>.99)&&(t.accuracy=.95);const o=t.size*(2-t.accuracy)*1024,a=1024*t.size,n=t.size*t.accuracy*1024,r=yield p(e);let u=r.split(",")[0].match(/:(.*?);/)[1],h=s.JPEG;l(t.type)&&(h=t.type,u=t.type);const g=yield d(r),f=yield m(g,Object.assign({},t));let b,y=.5;const C=[null,null];for(let e=1;e<=7;e++){b=yield i(f,y,h);const t=.75*b.length;if(7===e){(o<t||n>t)&&(b=[b,...C].filter(e=>e).sort((e,t)=>Math.abs(.75*e.length-a)-Math.abs(.75*t.length-a))[0]);break}if(o<t)C[1]=b,y-=Math.pow(.5,e+1);else{if(!(n>t))break;C[0]=b,y+=Math.pow(.5,e+1)}}const k=yield c(b,u);return k.size>e.size?e:k})}}])})},2388:function(e,t,o){"use strict";function s(e){if(!e||""===e.trim())return{valid:!0};if("/"===e)return{valid:!0};if(!e.startsWith("/"))return{valid:!1,error:'目标目录必须以 "/" 开头'};const t=/[\\:\*\?"'<>\| \(\)\[\]\{\}#%\^`~;@&=\+\$,]/;return t.test(e)?{valid:!1,error:"目标目录包含非法字符,请使用合法的路径格式"}:e.includes("//")?{valid:!1,error:"目标目录不能包含连续的斜杠"}:{valid:!0}}o.d(t,{G:function(){return s}})},2893:function(e,t,o){"use strict";o(5331)},3597:function(e,t,o){"use strict";o(5331)},4396:function(e,t,o){"use strict";o(5331),o(4885)},4885:function(e,t,o){"use strict";o(5331)},5385:function(e,t,o){"use strict";o(5331)},5616:function(e,t,o){"use strict";o(5331),o(7197)},5970:function(e,t,o){"use strict";o(5331)},6334:function(e,t,o){e.exports=o(1393)},6682:function(e,t,o){"use strict";e.exports=o.p+"img/404.8ed11fb3.png"},6808:function(e,t,o){"use strict";o(5331),o(8785),o(200),o(5970),o(9104)},7618:function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return Nt}});var s=o(8507),l=(o(5331),o(213),o(47)),a=(o(9648),o(6768)),i=o(4232);const n={class:"history-header"},r={class:"header-left"},c={class:"record-count"},d={class:"header-right"},u={class:"timeline-header"},p={class:"date-label"},h={key:0,class:"grid-view"},m={class:"grid-preview"},g=["src"],f=["src"],b={key:2,class:"file-icon-wrapper"},y={class:"grid-overlay"},C={class:"grid-actions"},k={class:"grid-info"},v=["title"],w={class:"upload-time"},F={key:1,class:"list-view"},L={class:"list-preview"},U=["src"],x=["src"],S={key:2,class:"file-icon-wrapper-small"},T={class:"list-info"},M=["title"],$=["title"],_={class:"list-meta"},E={class:"upload-time"},R={class:"list-actions"},A={key:0,class:"load-more-container"},I={key:0,class:"loading-indicator"},P={key:1,class:"load-more-hint"},N={key:1,class:"no-more-hint"},V={key:1,class:"empty-state"};function z(e,t,o,z,D,B){const W=(0,a.g2)("font-awesome-icon"),H=l.S2,j=s.R7;return(0,a.uX)(),(0,a.CE)("div",{class:(0,i.C4)(["history-container",{active:o.show}])},[(0,a.Lk)("div",n,[(0,a.Lk)("div",r,[t[4]||(t[4]=(0,a.Lk)("h2",null,"历史记录",-1)),(0,a.Lk)("span",c,"共 "+(0,i.v_)(D.totalCount)+" 条",1)]),(0,a.Lk)("div",d,[(0,a.bF)(j,{content:"切换视图",placement:"bottom"},{default:(0,a.k6)(()=>[(0,a.bF)(H,{circle:"",onClick:B.toggleViewMode},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"grid"===D.viewMode?"list":"th-large"},null,8,["icon"])]),_:1},8,["onClick"])]),_:1}),(0,a.bF)(j,{content:"清空记录",placement:"bottom"},{default:(0,a.k6)(()=>[(0,a.bF)(H,{circle:"",type:"danger",onClick:B.clearHistory},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"trash-alt"})]),_:1},8,["onClick"])]),_:1}),(0,a.bF)(H,{circle:"",onClick:t[0]||(t[0]=t=>e.$emit("close"))},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"times"})]),_:1})])]),D.historyList.length>0?((0,a.uX)(),(0,a.CE)("div",{key:0,class:"history-content",ref:"historyContent",onScroll:t[3]||(t[3]=(...e)=>B.handleScroll&&B.handleScroll(...e))},[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(B.groupedHistory,e=>((0,a.uX)(),(0,a.CE)("div",{key:e.date,class:"history-group"},[(0,a.Lk)("div",u,[t[5]||(t[5]=(0,a.Lk)("div",{class:"timeline-dot"},null,-1)),(0,a.Lk)("span",p,(0,i.v_)(e.date),1)]),"grid"===D.viewMode?((0,a.uX)(),(0,a.CE)("div",h,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(e.items,e=>((0,a.uX)(),(0,a.CE)("div",{key:e.time,class:"grid-item"},[(0,a.Lk)("div",m,[B.isImage(e.name)?((0,a.uX)(),(0,a.CE)("img",{key:0,src:e.url,loading:"lazy",onError:t[1]||(t[1]=(...e)=>B.handleImageError&&B.handleImageError(...e))},null,40,g)):B.isVideo(e.name)?((0,a.uX)(),(0,a.CE)("video",{key:1,src:e.url,muted:""},null,8,f)):((0,a.uX)(),(0,a.CE)("div",b,[(0,a.bF)(W,{icon:"file",class:"file-icon"})])),(0,a.Lk)("div",y,[(0,a.Lk)("div",C,[(0,a.bF)(H,{circle:"",size:"default",type:"primary",onClick:t=>B.copyLink(e.url)},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"copy"})]),_:1},8,["onClick"]),(0,a.bF)(H,{circle:"",size:"default",class:"action-btn-view",onClick:t=>B.openLink(e.url)},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"external-link-alt"})]),_:1},8,["onClick"]),(0,a.bF)(H,{circle:"",size:"default",type:"danger",onClick:t=>B.deleteItem(e)},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"trash-alt"})]),_:1},8,["onClick"])])])]),(0,a.Lk)("div",k,[(0,a.Lk)("div",{class:"file-name",title:e.name},(0,i.v_)(e.name),9,v),(0,a.Lk)("div",w,(0,i.v_)(B.formatTime(e.time)),1)])]))),128))])):((0,a.uX)(),(0,a.CE)("div",F,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(e.items,e=>((0,a.uX)(),(0,a.CE)("div",{key:e.time,class:"list-item"},[(0,a.Lk)("div",L,[B.isImage(e.name)?((0,a.uX)(),(0,a.CE)("img",{key:0,src:e.url,loading:"lazy",onError:t[2]||(t[2]=(...e)=>B.handleImageError&&B.handleImageError(...e))},null,40,U)):B.isVideo(e.name)?((0,a.uX)(),(0,a.CE)("video",{key:1,src:e.url,muted:""},null,8,x)):((0,a.uX)(),(0,a.CE)("div",S,[(0,a.bF)(W,{icon:"file"})]))]),(0,a.Lk)("div",T,[(0,a.Lk)("div",{class:"file-name",title:e.name},(0,i.v_)(e.name),9,M),(0,a.Lk)("div",{class:"file-url",title:e.url},(0,i.v_)(e.url),9,$)]),(0,a.Lk)("div",_,[(0,a.Lk)("div",E,(0,i.v_)(B.formatTime(e.time)),1)]),(0,a.Lk)("div",R,[(0,a.bF)(H,{circle:"",size:"small",type:"primary",onClick:t=>B.copyLink(e.url)},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"copy"})]),_:1},8,["onClick"]),(0,a.bF)(H,{circle:"",size:"small",class:"action-btn-view",onClick:t=>B.openLink(e.url)},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"external-link-alt"})]),_:1},8,["onClick"]),(0,a.bF)(H,{circle:"",size:"small",type:"danger",onClick:t=>B.deleteItem(e)},{default:(0,a.k6)(()=>[(0,a.bF)(W,{icon:"trash-alt"})]),_:1},8,["onClick"])])]))),128))]))]))),128)),B.hasMore?((0,a.uX)(),(0,a.CE)("div",A,[D.loadingMore?((0,a.uX)(),(0,a.CE)("div",I,[(0,a.bF)(W,{icon:"spinner",spin:""}),t[6]||(t[6]=(0,a.Lk)("span",null,"加载中...",-1))])):((0,a.uX)(),(0,a.CE)("div",P,"下拉加载更多"))])):D.historyList.length>0?((0,a.uX)(),(0,a.CE)("div",N,"没有更多记录了")):(0,a.Q3)("",!0)],544)):((0,a.uX)(),(0,a.CE)("div",V,[(0,a.bF)(W,{icon:"history",class:"empty-icon"}),t[7]||(t[7]=(0,a.Lk)("p",null,"暂无上传记录",-1))]))],2)}o(4114),o(8111),o(2489),o(7588),o(1701),o(3110),o(8335);var D={name:"UploadHistory",props:{show:{type:Boolean,default:!1}},data(){return{historyList:[],allHistory:[],viewMode:"grid",pageSize:30,currentPage:0,loadingMore:!1,totalCount:0}},watch:{show(e){e&&this.resetAndLoad()}},computed:{hasMore(){return this.historyList.length<this.totalCount},groupedHistory(){const e={};return this.historyList.forEach(t=>{const o=new Date(t.time),s=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`;e[s]||(e[s]=[]),e[s].push(t)}),Object.keys(e).sort((e,t)=>new Date(t)-new Date(e)).map(t=>({date:t,items:e[t]}))}},mounted(){const e=localStorage.getItem("historyViewMode");e&&(this.viewMode=e)},methods:{resetAndLoad(){this.historyList=[],this.currentPage=0,this.loadAllHistory(),this.loadMore()},loadAllHistory(){try{const e=JSON.parse(localStorage.getItem("uploadHistory")||"[]");this.allHistory=e.sort((e,t)=>t.time-e.time),this.totalCount=this.allHistory.length}catch(e){console.error("Failed to load history",e),this.allHistory=[],this.totalCount=0}},loadMore(){!this.loadingMore&&this.hasMore&&(this.loadingMore=!0,setTimeout(()=>{const e=this.currentPage*this.pageSize,t=e+this.pageSize,o=this.allHistory.slice(e,t);this.historyList=[...this.historyList,...o],this.currentPage++,this.loadingMore=!1},50))},handleScroll(e){const t=e.target,o=t.scrollTop,s=t.scrollHeight,l=t.clientHeight;s-o-l<100&&this.loadMore()},toggleViewMode(){this.viewMode="grid"===this.viewMode?"list":"grid",localStorage.setItem("historyViewMode",this.viewMode)},clearHistory(){this.$confirm("确定要清空所有上传记录吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{this.historyList=[],this.allHistory=[],this.totalCount=0,this.currentPage=0,localStorage.removeItem("uploadHistory"),this.$message.success("记录已清空")}).catch(()=>{})},deleteItem(e){this.$confirm("确定要删除这条记录吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{this.historyList=this.historyList.filter(t=>t.time!==e.time),this.allHistory=this.allHistory.filter(t=>t.time!==e.time),this.totalCount=this.allHistory.length;try{localStorage.setItem("uploadHistory",JSON.stringify(this.allHistory)),this.$message.success("记录已删除")}catch(t){console.error("Failed to update history",t)}}).catch(()=>{})},isImage(e){const t=["jpg","jpeg","png","gif","bmp","webp","svg","tiff","ico","avif","heic","jfif","pjpeg","pjp"],o=e?e.split(".").pop().toLowerCase():"";return t.includes(o)},isVideo(e){const t=["mp4","webm","ogg","mkv"],o=e?e.split(".").pop().toLowerCase():"";return t.includes(o)},formatTime(e){const t=new Date(e),o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),n=String(t.getSeconds()).padStart(2,"0");return`${o}-${s}-${l} ${a}:${i}:${n}`},copyLink(e){navigator.clipboard.writeText(e).then(()=>{this.$message.success("链接已复制")}).catch(()=>{this.$message.error("复制失败")})},openLink(e){window.open(e,"_blank")},handleImageError(e){e.target.src=o(6682)}}},B=o(1241);const W=(0,B.A)(D,[["render",z],["__scopeId","data-v-12200cbe"]]);var H=W,j=o(6975),X=o(1418),O=(o(333),o(4757)),Q=o(6018),q=(o(6808),o(200),o(9267)),G=(o(5616),o(5558)),J=(o(8075),o(6810)),K=(o(4396),o(4885),o(8559)),Y=(o(5970),o(9655)),Z=(o(2893),o(2086)),ee=(o(670),o(8830),o(3597),o(4253)),te=o(683),oe=(o(5385),o(9623)),se=(o(6711),o(7358)),le=o(813);o(4896);const ae={class:"upload-form"},ie={class:"upload-card-glow",ref:"uploadCardGlow"},ne={key:0,class:"upload-card"},re={class:"paste-card-actions"},ce={class:"upload-list-dashboard-action"},de={class:"modern-action-group"},ue={class:"modern-dropdown-item-content"},pe={class:"modern-action-btn modern-action-btn-danger"},he=["href"],me={key:0,style:{width:"10vw","border-radius":"12px"},autoplay:"",muted:"",playsinline:"",loop:""},ge=["src"],fe=["src","onError"],be={key:2,style:{width:"10vw","border-radius":"12px"}},ye={class:"upload-list-item-content"},Ce={class:"upload-list-item-name-wrapper"},ke={key:0,class:"upload-list-item-url"},ve={class:"upload-list-item-url-row"},we={class:"upload-list-item-url-row"},Fe={key:1,class:"upload-list-item-progress"},Le={class:"upload-list-item-action"},Ue=["onClick"],xe=["onClick"];function Se(e,t,n,r,c,d){const u=(0,a.g2)("CameraFilled"),p=le.tk,h=se.j5,m=oe.WK,g=l.S2,f=J.Zh,b=J.MQ,y=te.Ik,C=(0,a.g2)("List"),k=(0,a.g2)("Checked"),v=(0,a.g2)("Failed"),w=ee.$g,F=(0,a.g2)("font-awesome-icon"),L=s.R7,U=G.qi,x=Z.c6,S=Z.Iy,T=Z.dW,M=Y.ve,$=(0,a.g2)("Link"),_=(0,a.g2)("Delete"),E=K.kA;return(0,a.uX)(),(0,a.CE)("div",ae,[(0,a.Lk)("div",{class:"upload-card-wrapper",onMousemove:t[0]||(t[0]=(...e)=>d.handleUploadCardMouseMove&&d.handleUploadCardMouseMove(...e)),onMouseleave:t[1]||(t[1]=(...e)=>d.handleUploadCardMouseLeave&&d.handleUploadCardMouseLeave(...e))},[(0,a.Lk)("div",ie,null,512),"default"===n.uploadMethod?((0,a.uX)(),(0,a.Wv)(h,{key:0,class:(0,i.C4)(["upload-card",{"is-uploading":c.uploading,"upload-card-busy":c.fileList.length}]),drag:"",multiple:"","http-request":d.uploadFile,onSuccess:d.handleSuccess,"on-error":d.handleError,"before-upload":d.beforeUpload,"on-progress":d.handleProgress,"file-list":c.fileList,"show-file-list":!1},{default:(0,a.k6)(()=>[(0,a.bF)(p,{class:(0,i.C4)(["el-icon--upload",{"upload-list-busy":c.fileList.length}])},{default:(0,a.k6)(()=>[(0,a.bF)(u)]),_:1},8,["class"]),(0,a.Lk)("div",{class:(0,i.C4)(["el-upload__text",{"upload-list-busy":c.fileList.length}])},[...t[7]||(t[7]=[(0,a.Lk)("em",null,"拖拽",-1),(0,a.eW)(),(0,a.Lk)("em",null,"点击",-1),(0,a.eW)(" 或 ",-1),(0,a.Lk)("em",null,"Ctrl + V",-1),(0,a.eW)(" 粘贴上传",-1)])],2)]),_:1},8,["class","http-request","onSuccess","on-error","before-upload","on-progress","file-list"])):(0,a.Q3)("",!0)],32),"paste"===n.uploadMethod?((0,a.uX)(),(0,a.CE)("div",ne,[(0,a.bF)(y,{class:(0,i.C4)(["paste-card",{"is-uploading":c.uploading,"upload-card-busy":c.fileList.length}])},{default:(0,a.k6)(()=>[(0,a.bF)(m,{modelValue:c.pastedUrls,"onUpdate:modelValue":t[2]||(t[2]=e=>c.pastedUrls=e),class:"upload-card-textarea",placeholder:"粘贴外链上传,多个外链用换行分隔",type:"textarea",rows:c.fileList.length?4:14},null,8,["modelValue","rows"]),(0,a.Lk)("div",re,[(0,a.bF)(g,{class:"paste-card-upload-button",type:"primary",size:d.pasteCardMethodButtonSize,onClick:d.handleUploadPasteUrls},{default:(0,a.k6)(()=>[...t[8]||(t[8]=[(0,a.eW)(" 上 传 ",-1)])]),_:1},8,["size","onClick"]),(0,a.bF)(b,{modelValue:c.pasteUploadMethod,"onUpdate:modelValue":t[3]||(t[3]=e=>c.pasteUploadMethod=e),class:"paste-card-method-group",size:d.pasteCardMethodButtonSize},{default:(0,a.k6)(()=>[(0,a.bF)(f,{label:"save"},{default:(0,a.k6)(()=>[...t[9]||(t[9]=[(0,a.eW)("转存",-1)])]),_:1}),(0,a.bF)(f,{label:"external"},{default:(0,a.k6)(()=>[...t[10]||(t[10]=[(0,a.eW)("外链",-1)])]),_:1})]),_:1},8,["modelValue","size"])])]),_:1},8,["class"])])):(0,a.Q3)("",!0),(0,a.bF)(y,{class:(0,i.C4)(["upload-list-card",{"upload-list-busy":c.fileList.length,"is-uploading":c.uploading}])},{default:(0,a.k6)(()=>[(0,a.Lk)("div",{class:(0,i.C4)(["upload-list-container",{"upload-list-busy":c.fileList.length}])},[(0,a.bF)(E,{onScroll:d.handleScroll,ref:"scrollContainer"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",{class:(0,i.C4)(["upload-list-dashboard",{"list-scrolled":c.listScrolled}])},[(0,a.bF)(w,{class:"upload-list-dashboard-title"},{default:(0,a.k6)(()=>[(0,a.bF)(p,null,{default:(0,a.k6)(()=>[(0,a.bF)(C)]),_:1}),(0,a.eW)((0,i.v_)(d.uploadingCount+d.waitingCount)+" ",1),(0,a.bF)(p,null,{default:(0,a.k6)(()=>[(0,a.bF)(k)]),_:1}),(0,a.eW)((0,i.v_)(d.uploadSuccessCount)+" ",1),(0,a.bF)(p,null,{default:(0,a.k6)(()=>[(0,a.bF)(v)]),_:1}),(0,a.eW)((0,i.v_)(d.uploadErrorCount),1)]),_:1}),(0,a.Lk)("div",ce,[(0,a.Lk)("div",de,[(0,a.bF)(L,{disabled:d.disableTooltip,content:"整体复制",placement:"top"},{default:(0,a.k6)(()=>[(0,a.Lk)("button",{class:"modern-action-btn",onClick:t[4]||(t[4]=(...e)=>d.copyAll&&d.copyAll(...e))},[(0,a.bF)(F,{icon:"copy"})])]),_:1},8,["disabled"]),(0,a.bF)(L,{disabled:d.disableTooltip,content:"失败重试",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(T,null,{dropdown:(0,a.k6)(()=>[(0,a.bF)(S,{class:"modern-dropdown-menu"},{default:(0,a.k6)(()=>[(0,a.bF)(x,null,{default:(0,a.k6)(()=>[(0,a.Lk)("div",ue,[t[11]||(t[11]=(0,a.Lk)("span",null,"自动重试",-1)),(0,a.bF)(U,{modelValue:c.autoReUpload,"onUpdate:modelValue":t[6]||(t[6]=e=>c.autoReUpload=e),onChange:d.handleAutoRetryChange,size:"small"},null,8,["modelValue","onChange"])])]),_:1})]),_:1})]),default:(0,a.k6)(()=>[(0,a.Lk)("button",{class:"modern-action-btn",onClick:t[5]||(t[5]=(...e)=>d.retryError&&d.retryError(...e))},[(0,a.bF)(F,{icon:"redo"})])]),_:1})]),_:1},8,["disabled"]),(0,a.bF)(L,{disabled:d.disableTooltip,content:"清空列表",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(T,null,{dropdown:(0,a.k6)(()=>[(0,a.bF)(S,{class:"modern-dropdown-menu"},{default:(0,a.k6)(()=>[(0,a.bF)(x,{onClick:d.clearFileList},{default:(0,a.k6)(()=>[...t[12]||(t[12]=[(0,a.eW)("清空全部",-1)])]),_:1},8,["onClick"]),(0,a.bF)(x,{onClick:d.clearSuccessList},{default:(0,a.k6)(()=>[...t[13]||(t[13]=[(0,a.eW)("清空已上传",-1)])]),_:1},8,["onClick"])]),_:1})]),default:(0,a.k6)(()=>[(0,a.Lk)("button",pe,[(0,a.bF)(F,{icon:"trash-alt"})])]),_:1})]),_:1},8,["disabled"])])])],2),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(c.fileList.slice().reverse(),e=>((0,a.uX)(),(0,a.CE)("div",{class:"upload-list-item",key:e.name,span:8},[(0,a.Lk)("a",{href:e.url,target:"_blank",class:"upload-list-item-preview"},[d.isVideo(e.name)?((0,a.uX)(),(0,a.CE)("video",me,[(0,a.Lk)("source",{src:e.url,type:"video/mp4"},null,8,ge),t[14]||(t[14]=(0,a.eW)(" Your browser does not support the video tag. ",-1))])):d.isImage(e.name)?((0,a.uX)(),(0,a.CE)("img",{key:1,style:{width:"10vw","border-radius":"12px"},src:e.url,onError:t=>e.url=o(6682)},null,40,fe)):((0,a.uX)(),(0,a.CE)("div",be,[(0,a.bF)(F,{icon:"file",class:"file-icon"})]))],8,he),(0,a.Lk)("div",ye,[(0,a.Lk)("div",Ce,[(0,a.bF)(w,{class:"upload-list-item-name",truncated:""},{default:(0,a.k6)(()=>[(0,a.eW)((0,i.v_)(d.truncateFilename(e.name)),1)]),_:2},1024)]),"done"===e.status?((0,a.uX)(),(0,a.CE)("div",ke,[(0,a.Lk)("div",ve,[(0,a.bF)(m,{modelValue:e.finalURL,"onUpdate:modelValue":t=>e.finalURL=t,readonly:"",onClick:d.selectAllText,size:d.urlSize},{prepend:(0,a.k6)(()=>[...t[15]||(t[15]=[(0,a.eW)("URL",-1)])]),_:1},8,["modelValue","onUpdate:modelValue","onClick","size"]),(0,a.bF)(m,{modelValue:e.mdURL,"onUpdate:modelValue":t=>e.mdURL=t,readonly:"",onClick:d.selectAllText,size:d.urlSize},{prepend:(0,a.k6)(()=>[...t[16]||(t[16]=[(0,a.eW)("MarkDown",-1)])]),_:1},8,["modelValue","onUpdate:modelValue","onClick","size"])]),(0,a.Lk)("div",we,[(0,a.bF)(m,{modelValue:e.htmlURL,"onUpdate:modelValue":t=>e.htmlURL=t,readonly:"",onClick:d.selectAllText,size:d.urlSize},{prepend:(0,a.k6)(()=>[...t[17]||(t[17]=[(0,a.eW)("HTML",-1)])]),_:1},8,["modelValue","onUpdate:modelValue","onClick","size"]),(0,a.bF)(m,{modelValue:e.ubbURL,"onUpdate:modelValue":t=>e.ubbURL=t,readonly:"",onClick:d.selectAllText,size:d.urlSize},{prepend:(0,a.k6)(()=>[...t[18]||(t[18]=[(0,a.eW)("BBCode",-1)])]),_:1},8,["modelValue","onUpdate:modelValue","onClick","size"])])])):((0,a.uX)(),(0,a.CE)("div",Fe,[(0,a.bF)(M,{percentage:e.progreess,status:e.status,"show-text":!1},null,8,["percentage","status"])]))]),(0,a.Lk)("div",Le,[(0,a.Lk)("button",{class:"modern-file-action-btn modern-file-action-btn-primary",onClick:t=>d.handleCopy(e)},[(0,a.bF)(p,null,{default:(0,a.k6)(()=>[(0,a.bF)($)]),_:1})],8,Ue),(0,a.Lk)("button",{class:"modern-file-action-btn modern-file-action-btn-danger",onClick:t=>d.handleRemove(e)},[(0,a.bF)(p,null,{default:(0,a.k6)(()=>[(0,a.bF)(_)]),_:1})],8,xe)])]))),128))]),_:1},8,["onScroll"])],2)]),_:1},8,["class"])])}o(6573),o(8100),o(7936),o(116),o(8237),o(9577),o(1549),o(9797),o(9631),o(5623),o(4979),o(4603),o(7566),o(8721);var Te=o(457),Me=o(6334),$e=o(8401),_e={name:"UploadForm",props:{selectedUrlForm:{type:String,default:"url",required:!1},customerCompress:{type:Boolean,default:!0,required:!1},compressQuality:{type:Number,default:4,required:!1},compressBar:{type:Number,default:5,required:!1},serverCompress:{type:Boolean,default:!0,required:!1},uploadChannel:{type:String,default:"telegram",required:!1},channelName:{type:String,default:"",required:!1},uploadNameType:{type:String,default:"default",required:!1},useCustomUrl:{type:String,default:"false",required:!1},customUrlPrefix:{type:String,default:"",required:!1},autoRetry:{type:Boolean,default:!0,required:!1},urlPrefix:{type:String,default:"",required:!1},uploadMethod:{type:String,default:"default",required:!1},uploadFolder:{type:String,default:"",required:!1},convertToWebp:{type:Boolean,default:!1,required:!1}},data(){return{fileList:[],uploading:!1,maxUploading:6,exceptionList:[],listScrolled:!1,fileListLength:0,uploadCount:0,pastedUrls:"",pasteUploadMethod:"save",autoReUpload:!0,maxRetryCount:10,retryTimer:null,retryDelay:12e3,uploadQueue:[],activeUploads:0,maxConcurrentUploads:6,abortControllers:new Map}},watch:{fileList:{handler(){this.fileList.length>this.fileListLength&&this.$nextTick(()=>{setTimeout(()=>{this.$refs.scrollContainer&&this.$refs.scrollContainer.setScrollTop(0)},100)}),this.fileListLength=this.fileList.length},deep:!0},useCustomUrl:{handler(){"true"===this.useCustomUrl?this.fileList.forEach(e=>{"external"!==e.uploadChannel&&(e.finalURL=this.customUrlPrefix+e.srcID,e.mdURL=``,e.htmlURL=`<img src="${this.customUrlPrefix+e.srcID}" alt="${e.name}" width=100% />`,e.ubbURL=`[img]${this.customUrlPrefix+e.srcID}[/img]`)}):this.fileList.forEach(e=>{"external"!==e.uploadChannel&&(e.finalURL=this.rootUrl+e.srcID,e.mdURL=``,e.htmlURL=`<img src="${this.rootUrl+e.srcID}" alt="${e.name}" width=100% />`,e.ubbURL=`[img]${this.rootUrl+e.srcID}[/img]`)})},immediate:!0},customUrlPrefix:{handler(){"true"===this.useCustomUrl&&this.fileList.forEach(e=>{"external"!==e.uploadChannel&&(e.finalURL=this.customUrlPrefix+e.srcID,e.mdURL=``,e.htmlURL=`<img src="${this.customUrlPrefix+e.srcID}" alt="${e.name}" width=100% />`,e.ubbURL=`[img]${this.customUrlPrefix+e.srcID}[/img]`)})},immediate:!0},autoReUpload(e){this.$store.commit("setStoreAutoReUpload",e)}},computed:{...(0,$e.L8)(["storeAutoReUpload"]),uploadSuccessCount(){return this.fileList.filter(e=>"done"===e.status||"success"===e.status).length},uploadErrorCount(){return this.fileList.filter(e=>"exception"===e.status).length},uploadingCount(){return this.fileList.filter(e=>"uploading"===e.status).length},waitingCount(){return this.uploadQueue.length},urlSize(){return window.innerWidth<768?"small":"default"},disableTooltip(){return window.innerWidth<768},rootUrl(){return"true"===this.useCustomUrl?this.customUrlPrefix:this.urlPrefix||`${window.location.protocol}//${window.location.host}/file/`},pasteCardMethodButtonSize(){return this.fileList.length||window.innerWidth<768?"small":"medium"}},mounted(){document.addEventListener("paste",this.handlePaste),this.autoReUpload=this.storeAutoReUpload},beforeUnmount(){document.removeEventListener("paste",this.handlePaste),this.uploadQueue=[],this.fileList=[],this.activeUploads=0},methods:{truncateFilename(e,t=20){if(!e||e.length<=t)return e;const o=e.lastIndexOf(".");let s,l;o>0?(s=e.substring(0,o),l=e.substring(o)):(s=e,l="");const a=l.length+4,i=t-a-3;return i<=0?e.substring(0,t-3)+"...":s.substring(0,i)+"..."+s.slice(-4)+l},uploadFile(e){if(!this.fileList.find(t=>t.uid===e.file.uid))return;if(this.activeUploads>=this.maxConcurrentUploads){this.uploadQueue.push(e);const t=this.fileList.find(t=>t.uid===e.file.uid);return void(t&&(t.status="waiting"))}this.activeUploads++;const t=this.fileList.find(t=>t.uid===e.file.uid);t&&(t.status="uploading");const o=this.fileList.find(t=>t.uid===e.file.uid),s=o?.uploadChannel||this.uploadChannel;if("external"===s)return void this.uploadSingleFile(e);if("huggingface"===s){const t=20971520;return void(e.file.size>=t?this.uploadToHuggingFaceDirect(e):this.uploadSingleFile(e))}if("discord"===s){const t=9437184;return void(e.file.size>t?this.uploadFileInChunks(e):this.uploadSingleFile(e))}const l=20971520;e.file.size>l?this.uploadFileInChunks(e):this.uploadSingleFile(e)},processUploadQueue(){if(0===this.uploadQueue.length||this.activeUploads>=this.maxConcurrentUploads)return;const e=this.uploadQueue.shift();e&&this.fileList.find(t=>t.uid===e.file.uid)?this.uploadFile(e):this.processUploadQueue()},onUploadComplete(){this.activeUploads=Math.max(0,this.activeUploads-1),this.processUploadQueue(),0===this.activeUploads&&0===this.uploadQueue.length&&(this.uploading=!1)},async uploadSingleFile(e){const t=this.fileList.find(t=>t.uid===e.file.uid);if(!t)return;const o=t.serverCompress,s=t.uploadChannel||this.uploadChannel,l=this.autoRetry&&"external"!==s,a="external"===s?"default":this.uploadNameType,i=new AbortController;this.abortControllers.set(e.file.uid,i);const n=new FormData;if(n.append("file",e.file),"external"===s&&n.append("url",e.file.url),"huggingface"===s)try{console.log("Computing SHA256 for HuggingFace upload...");const t=await this.computeSha256(e.file);n.append("sha256",t),console.log("SHA256 computed:",t)}catch(r){console.error("Failed to compute SHA256:",r)}(0,Te.A)({url:"/upload?serverCompress="+o+"&uploadChannel="+s+(this.channelName?"&channelName="+encodeURIComponent(this.channelName):"")+"&uploadNameType="+a+"&autoRetry="+l+"&uploadFolder="+this.uploadFolder,method:"post",data:n,withAuthCode:!0,signal:i.signal,onUploadProgress:t=>{const o=Math.round(t.loaded/t.total*100);e.onProgress({percent:o,file:e.file})}}).then(t=>{e.onSuccess(t,e.file)}).catch(t=>{"CanceledError"!==t.name&&"ERR_CANCELED"!==t.code?t.response&&401!==t.response.status?(this.exceptionList.push(e),e.onError(t,e.file)):t.response||(this.exceptionList.push(e),e.onError(t,e.file)):console.log("上传已取消:",e.file.name)}).finally(()=>{this.abortControllers.delete(e.file.uid),this.onUploadComplete()})},async uploadFileInChunks(e){const t=this.fileList.find(t=>t.uid===e.file.uid);if(!t)return;const o=t.uploadChannel||this.uploadChannel,s=new AbortController;this.abortControllers.set(e.file.uid,s);const l="discord"===o?9437184:16777216,a=e.file.size,i=Math.ceil(a/l),n=t.serverCompress,r=this.autoRetry&&"external"!==o,c="external"===o?"default":this.uploadNameType;let d=null;if("huggingface"===o)try{console.log("Computing SHA256 for HuggingFace chunked upload..."),d=await this.computeSha256(e.file),console.log("SHA256 computed:",d)}catch(u){console.error("Failed to compute SHA256:",u)}try{const t=new FormData;t.append("originalFileName",e.file.name),t.append("originalFileType",e.file.type),t.append("totalChunks",i.toString());const p=await(0,Te.A)({url:"/upload?serverCompress="+n+"&uploadChannel="+o+(this.channelName?"&channelName="+encodeURIComponent(this.channelName):"")+"&uploadNameType="+c+"&autoRetry="+r+"&uploadFolder="+this.uploadFolder+"&initChunked=true",method:"post",data:t,withAuthCode:!0});if(!p.data.success)throw new Error("初始化分块上传失败: "+p.data.message);const h=p.data.uploadId;console.log("分块上传初始化成功,uploadId:",h);const m=this.fileList.find(t=>t.uid===e.file.uid);m&&(m.totalChunks=i,m.uploadId=h);const g=3,f=new Array(i).fill(0);let b=0,y=!1,C="",k=!1;const v=async t=>{if(y||k)return;const d=t*l,p=Math.min(d+l,a),m=e.file.slice(d,p),g=new FormData;g.append("file",m,`${e.file.name}.part${t.toString().padStart(3,"0")}`),g.append("chunkIndex",t.toString()),g.append("totalChunks",i.toString()),g.append("uploadId",h),g.append("originalFileName",e.file.name),g.append("originalFileType",e.file.type);let b=0;const v=3;while(b<v){if(y||k)return;try{return void await(0,Te.A)({url:"/upload?serverCompress="+n+"&uploadChannel="+o+(this.channelName?"&channelName="+encodeURIComponent(this.channelName):"")+"&uploadNameType="+c+"&autoRetry="+r+"&uploadFolder="+this.uploadFolder+"&chunked=true",method:"post",data:g,withAuthCode:!0,signal:s.signal,onUploadProgress:o=>{if(y||k)return;const s=Math.round(o.loaded/o.total*100);f[t]=s;const l=Math.round(f.reduce((e,t)=>e+t,0)/i);e.onProgress({percent:l,file:e.file})}})}catch(u){if("CanceledError"===u.name||"ERR_CANCELED"===u.code)return k=!0,void console.log("分块上传已取消:",e.file.name);if(b++,console.warn(`分块 ${t+1}/${i} 上传失败 (重试 ${b}/${v}):`,u),b>=v)throw y=!0,C=`分块 ${t+1}/${i} 上传失败: ${u.message}`,new Error(C);await new Promise(e=>setTimeout(e,2e3*b))}}},w=[];for(let e=0;e<g;e++)w.push((async()=>{while(b<i&&!y&&!k){const t=b++;try{await v(t)}catch(e){k||(y=!0,C=e.message);break}}})());if(await Promise.all(w),k)return void console.log("分块上传已取消,跳过合并步骤");if(y)throw new Error(C||"上传过程中发生错误");this.$message({type:"info",message:"分块上传完成,正在合并文件,请耐心等待...",duration:0});const F=new FormData;F.append("uploadId",h),F.append("totalChunks",i.toString()),F.append("originalFileName",e.file.name),F.append("originalFileType",e.file.type),d&&F.append("sha256",d);const L=await(0,Te.A)({url:"/upload?serverCompress="+n+"&uploadChannel="+o+(this.channelName?"&channelName="+encodeURIComponent(this.channelName):"")+"&uploadNameType="+c+"&autoRetry="+r+"&uploadFolder="+this.uploadFolder+"&chunked=true&merge=true",method:"post",data:F,withAuthCode:!0});this.$message.closeAll(),e.onSuccess(L,e.file)}catch(u){if("CanceledError"===u.name||"ERR_CANCELED"===u.code)return void console.log("分块上传已取消:",e.file.name);console.error("分块上传失败:",u);const t=this.fileList.find(t=>t.uid===e.file.uid);t&&t.uploadId&&this.cleanupUploadResources(t.uploadId,t.totalChunks).then(()=>{console.log(`已清理分块上传失败的资源: ${t.uploadId}`)}).catch(e=>{console.warn("清理分块上传失败资源时出错:",e)}),u.response&&401!==u.response.status?(this.exceptionList.push(e),e.onError(u,e.file)):u.response||(this.exceptionList.push(e),e.onError(u,e.file))}finally{this.abortControllers.delete(e.file.uid),this.onUploadComplete()}},handleRemove(e){this.abortControllers.has(e.uid)&&(this.abortControllers.get(e.uid).abort(),this.abortControllers.delete(e.uid)),this.uploadQueue=this.uploadQueue.filter(t=>t.file.uid!==e.uid),this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.$message({type:"info",message:this.truncateFilename(e.name)+"已删除"})},async cleanupUploadResources(e,t=0){try{await(0,Te.A)({url:`/upload?cleanup=true&uploadId=${e}&totalChunks=${t}`,method:"get",withAuthCode:!0,timeout:5e3}),console.log(`清理上传资源成功: ${e}`)}catch(o){console.warn("清理上传资源失败:",o)}},handleSuccess(e,t){const o=this.fileList.find(e=>e.uid===t.uid);if(o)try{const s=o.uploadChannel||this.uploadChannel;if("external"!==s){const s=e.data[0].src.replace("/file/","");o.url=`${window.location.protocol}//${window.location.host}/file/`+s,o.finalURL=this.rootUrl+s,o.mdURL=``,o.htmlURL=`<img src="${this.rootUrl+s}" alt="${t.name}" width=100% />`,o.ubbURL=`[img]${this.rootUrl+s}[/img]`,o.srcID=s}o.progreess=100,o.status="success",this.saveToHistory(o),this.$message({type:"success",message:this.truncateFilename(t.name)+"上传成功"}),setTimeout(()=>{const e=this.fileList.find(e=>e.uid===t.uid);e&&(e.status="done")},1e3)}catch(s){this.$message.error(this.truncateFilename(t.name)+"上传失败"),o.status="exception"}},saveToHistory(e){try{const t=JSON.parse(localStorage.getItem("uploadHistory")||"[]"),o={name:e.name,url:e.finalURL,time:Date.now(),type:e.name.split(".").pop().toLowerCase()};t.push(o),localStorage.setItem("uploadHistory",JSON.stringify(t))}catch(t){console.error("Failed to save history",t)}},handleError(e,t){const o=this.fileList.find(e=>e.uid===t.uid);o&&(this.$message.error(this.truncateFilename(t.name)+"上传失败"),o.status="exception",this.autoReUpload&&this.scheduleAutoRetry())},handleCopy(e){const t=this.fileList.find(t=>t.uid===e.uid).status;"done"===t||"success"===t?("url"===this.selectedUrlForm?navigator.clipboard.writeText(e.finalURL):"md"===this.selectedUrlForm?navigator.clipboard.writeText(e.mdURL):"html"===this.selectedUrlForm?navigator.clipboard.writeText(e.htmlURL):"ubb"===this.selectedUrlForm?navigator.clipboard.writeText(e.ubbURL):navigator.clipboard.writeText(e.finalURL),this.$message({type:"success",message:"复制成功"})):this.$message({type:"warning",message:"文件未上传成功,无法复制链接"})},beforeUpload(e){return new Promise(async(t,o)=>{let s=e;const l=this.convertToWebp&&e.type.includes("image")&&!e.type.includes("webp")&&!e.type.includes("gif")&&!e.type.includes("svg");if(l)try{const t=await this.convertImageToWebp(e);t&&(s=t,console.log(`WebP转换成功: ${e.name} -> ${t.name}, 大小: ${(e.size/1024).toFixed(1)}KB -> ${(t.size/1024).toFixed(1)}KB`))}catch(r){console.warn("WebP转换失败,使用原文件:",r)}const a=s.type.includes("image")&&this.customerCompress&&s.size/1024/1024>this.compressBar,i=s.size/1024/1024<=1024||"telegram"!==this.uploadChannel,n=(e,o)=>{const s=URL.createObjectURL(e);this.fileList.push({uid:e.uid,name:e.name,url:s,finalURL:"",mdURL:"",htmlURL:"",ubbURL:"",srcID:"",status:"uploading",progreess:0,serverCompress:o,retryCount:0}),t(e)};if(a)Me.compressAccurately(s,1024*this.compressQuality).then(t=>{t.size/1024/1024>1024&&"telegram"===this.uploadChannel&&(this.$message.error(s.name+"压缩后文件过大,无法上传!"),o("文件过大")),this.uploading=!0;const l=new File([t],s.name,{type:t.type});l.uid=e.uid;const a=this.uploadCount++,i=this.serverCompress&&l.size/1024/1024<10&&"telegram"===this.uploadChannel;0===a?n(l,i):setTimeout(()=>{n(l,i),this.uploadCount--},300*a)}).catch(e=>{this.$message.error(s.name+"压缩失败,无法上传!"),o(e)});else if(i){this.uploading=!0;const e=this.uploadCount++,t="telegram"===this.uploadChannel&&this.serverCompress&&(!s.type.includes("image")||s.size/1024/1024<10);0===e?n(s,t):setTimeout(()=>{n(s,t),this.uploadCount--},300*e)}else this.$message.error(s.name+"文件过大,无法上传!"),o("文件过大")})},handleProgress(e){const t=this.fileList.find(t=>t.uid===e.file.uid);t&&(t.progreess=e.percent)},copyAll(){if("url"===this.selectedUrlForm){const e=this.fileList.map(e=>{if("done"===e.status||"success"===e.status)return e.finalURL}).join("\n");navigator.clipboard.writeText(e)}else if("md"===this.selectedUrlForm){const e=this.fileList.map(e=>{if("done"===e.status||"success"===e.status)return e.mdURL}).join("\n");navigator.clipboard.writeText(e)}else if("html"===this.selectedUrlForm){const e=this.fileList.map(e=>{if("done"===e.status||"success"===e.status)return e.htmlURL}).join("\n");navigator.clipboard.writeText(e)}else if("ubb"===this.selectedUrlForm){const e=this.fileList.map(e=>{if("done"===e.status||"success"===e.status)return e.ubbURL}).join("\n");navigator.clipboard.writeText(e)}else{const e=this.fileList.map(e=>{if("done"===e.status||"success"===e.status)return e.finalURL}).join("\n");navigator.clipboard.writeText(e)}this.$message({type:"success",message:"整体复制成功"})},clearFileList(){this.fileList.length>0?(this.abortControllers.forEach((e,t)=>{e.abort()}),this.abortControllers.clear(),this.uploadQueue=[],this.fileList=[],this.$message({type:"success",message:"文件列表已清空"})):this.$message({type:"info",message:"文件列表为空"})},clearSuccessList(){this.uploadSuccessCount>0?(this.fileList=this.fileList.filter(e=>"done"!==e.status&&"success"!==e.status),this.$message({type:"success",message:"成功上传文件已清空"})):this.$message({type:"info",message:"成功上传文件为空"})},handlePaste(e){if("INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName)return;const t=e.clipboardData.items;t.length>0&&this.uploadFromUrl(t)},handleUploadPasteUrls(){const e=this.pastedUrls.split("\n"),t=e.map(e=>e.trim()).filter(e=>""!==e).filter(e=>/^(https?:\/\/[^\s$.?#].[^\s]*)$/.test(e));if("save"===this.pasteUploadMethod)this.uploadFromUrl(t.map(e=>({kind:"string",getAsString:t=>{t(e)}})));else if("external"===this.pasteUploadMethod)for(let o=0;o<t.length;o++){const e=t[o],s=e.split("/").pop(),l=``,a=`<img src="${e}" alt="${s}" width=100% />`,i=`[img]${e}[/img]`,n=new File([],e.split("/").pop(),{type:"text/plain"});n.uid=Date.now()+o,n.url=e,this.fileList.push({uid:n.uid,name:n.name,url:e,finalURL:e,mdURL:l,htmlURL:a,ubbURL:i,srcID:e,status:"uploading",progreess:0,serverCompress:!1,uploadChannel:"external",retryCount:0}),this.uploadFile({file:n,onProgress:e=>this.handleProgress(e),onSuccess:(e,t)=>this.handleSuccess(e,t),onError:(e,t)=>this.handleError(e,t)})}},uploadFromUrl(e){for(let t=0;t<e.length;t++)if("file"===e[t].kind){const o=e[t].getAsFile();o.uid=Date.now()+t;const s=this.beforeUpload(o);s instanceof Promise&&s.then(e=>{e instanceof File&&this.uploadFile({file:e,onProgress:e=>this.handleProgress(e),onSuccess:(e,t)=>this.handleSuccess(e,t),onError:(e,t)=>this.handleError(e,t)})}).catch(e=>{console.log(e)})}else"string"===e[t].kind&&e[t].getAsString(e=>{const o=/^(https?:\/\/[^\s$.?#].[^\s]*)$/;let s="";o.test(e)&&Te.A.post("/api/fetchRes",{url:e},{responseType:"blob"}).then(o=>{o.headers["content-type"];if(200!=o.status)throw new Error("URL地址请求失败");{const a=o.headers["content-disposition"];if(a){const e=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/,t=/filename\*\s*=\s*UTF-8''([^;\n]*)/;let o=e.exec(a);if(null!=o&&o[1]){s=o[1].replace(/['"]/g,"");try{s=decodeURIComponent(s)}catch(l){s=""}}""===s&&(o=t.exec(a),null!=o&&o[1]&&(s=decodeURIComponent(o[1])))}if(""===s){const t=new URL(e);s=t.pathname.split("/").pop()}if(""===s){const o=new URL(e);let l=o.pathname.split(".").pop();(!l||""===l||l.length>10)&&(l="bin"),s="PastedFile"+Date.now()+t+"."+l}const i=o.data,n=new File([i],s,{type:i.type});n.uid=Date.now()+t;const r=this.beforeUpload(n);r instanceof Promise&&r.then(e=>{e instanceof File&&this.uploadFile({file:e,onProgress:e=>this.handleProgress(e),onSuccess:(e,t)=>this.handleSuccess(e,t),onError:(e,t)=>this.handleError(e,t)})}).catch(e=>{console.log(e)})}}).catch(e=>{this.$message({type:"warning",message:"粘贴板中的URL地址请求失败"})})})},selectAllText(e){navigator.clipboard.writeText(e.target.value).then(()=>{this.$message({type:"success",message:"复制成功"})}).catch(()=>{this.$message({type:"error",message:"复制失败"})})},isImage(e){const t=["jpg","jpeg","png","gif","bmp","webp","svg","tiff","ico","avif","heic","jfif","pjpeg","pjp","raw","cr2","nef","dng","eps","ai","emf","wmf"],o=e.split(".").pop().toLowerCase();return t.includes(o)},isVideo(e){const t=["mp4","webm","ogg","mkv"],o=e.split(".").pop().toLowerCase();return t.includes(o)},handleScroll(e){this.listScrolled=e.scrollTop>0&&this.fileList.length>0},retryError(){this.exceptionList.length>0?(this.retryFailedFiles(this.exceptionList),this.exceptionList=[]):this.$message({type:"info",message:"无上传失败文件"})},handleAutoRetryChange(e){this.$message({type:e?"success":"info",message:e?"自动重试已开启":"自动重试已关闭"}),e&&this.exceptionList.length>0&&this.scheduleAutoRetry()},retryFailedFiles(e){e.forEach(e=>{const t=e.retryCount||0;t<this.maxRetryCount?(e.retryCount=t+1,this.uploadFile({file:e.file,onProgress:e=>this.handleProgress(e),onSuccess:(e,t)=>this.handleSuccess(e,t),onError:(e,t)=>this.handleError(e,t)})):this.$message({type:"warning",message:`${e.name} 已达到最大重试次数(${this.maxRetryCount}),停止重试`})})},scheduleAutoRetry(){this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{if(this.autoReUpload&&this.exceptionList.length>0){const e=[...this.exceptionList];this.exceptionList=[],this.retryFailedFiles(e)}},this.retryDelay)},async uploadToHuggingFaceDirect(e){const t=this.fileList.find(t=>t.uid===e.file.uid);if(!t)return;const o=new AbortController;this.abortControllers.set(e.file.uid,o);try{console.log("=== HuggingFace Direct Upload ==="),console.log("File:",e.file.name,"Size:",e.file.size),e.onProgress({percent:5,file:e.file}),console.log("Computing SHA256...");const t=await this.computeSha256(e.file);if(console.log("SHA256:",t),o.signal.aborted)return void console.log("HuggingFace 上传已取消:",e.file.name);const s=new Uint8Array(await e.file.slice(0,512).arrayBuffer()),l=btoa(String.fromCharCode(...s));e.onProgress({percent:10,file:e.file}),console.log("Getting LFS upload URL...");const a=await(0,Te.A)({url:"/api/huggingface/getUploadUrl",method:"post",data:{fileSize:e.file.size,fileName:e.file.name,fileType:e.file.type,sha256:t,fileSample:l,channelName:this.channelName,uploadNameType:this.uploadNameType,uploadFolder:this.uploadFolder},withAuthCode:!0,signal:o.signal});if(!a.data.success)throw new Error(a.data.error||"Failed to get upload URL");const i=a.data;if(console.log("Upload info:",i),i.alreadyExists)console.log("File already exists in LFS, skipping upload"),e.onProgress({percent:90,file:e.file});else if(i.needsLfs&&i.uploadAction){const{href:t,header:s}=i.uploadAction;if(s?.chunk_size)await this.uploadToHuggingFaceMultipart(e,i,o);else{console.log("Uploading to S3 (basic)...");const l=await fetch(t,{method:"PUT",headers:s||{},body:e.file,signal:o.signal});if(!l.ok){const e=await l.text();throw new Error(`S3 upload failed: ${l.status} - ${e}`)}console.log("S3 upload complete")}}if(o.signal.aborted)return void console.log("HuggingFace 上传已取消:",e.file.name);e.onProgress({percent:95,file:e.file}),console.log("Committing file...");const n=await(0,Te.A)({url:"/api/huggingface/commitUpload",method:"post",data:{fullId:i.fullId,filePath:i.filePath,sha256:t,fileSize:e.file.size,fileName:e.file.name,fileType:e.file.type,channelName:i.channelName},withAuthCode:!0,signal:o.signal});if(!n.data.success)throw new Error(n.data.error||"Failed to commit file");console.log("Upload complete:",n.data);const r={data:[{src:n.data.src}]};e.onSuccess(r,e.file)}catch(s){if("CanceledError"===s.name||"ERR_CANCELED"===s.code||"AbortError"===s.name)return void console.log("HuggingFace 上传已取消:",e.file.name);console.error("HuggingFace direct upload error:",s),this.exceptionList.push(e),e.onError(s,e.file)}finally{this.abortControllers.delete(e.file.uid),this.onUploadComplete()}},async uploadToHuggingFaceMultipart(e,t,o){const{uploadAction:s}=t,{href:l,header:a}=s,i=parseInt(a.chunk_size),n=Object.keys(a).filter(e=>/^[0-9]+$/.test(e));console.log(`Multipart upload: ${n.length} parts, chunk size: ${i}`);const r=[],c=n.length;for(const u of n){if(o&&o.signal.aborted)throw console.log("HuggingFace 分片上传已取消"),new DOMException("Upload cancelled","AbortError");const t=parseInt(u)-1,s=t*i,l=Math.min(s+i,e.file.size),n=e.file.slice(s,l);console.log(`Uploading part ${u}/${c}`);const d=await fetch(a[u],{method:"PUT",body:n,signal:o?o.signal:void 0});if(!d.ok)throw new Error(`Failed to upload part ${u}: ${d.status}`);const p=d.headers.get("ETag");if(!p)throw new Error(`No ETag for part ${u}`);r.push({partNumber:parseInt(u),etag:p});const h=10+Math.round(parseInt(u)/c*80);e.onProgress({percent:h,file:e.file})}if(o&&o.signal.aborted)throw console.log("HuggingFace 分片上传已取消"),new DOMException("Upload cancelled","AbortError");console.log("Completing multipart upload...");const d=await fetch(l,{method:"POST",headers:{Accept:"application/vnd.git-lfs+json","Content-Type":"application/vnd.git-lfs+json"},body:JSON.stringify({oid:t.oid,parts:r}),signal:o?o.signal:void 0});if(!d.ok){const e=await d.text();throw new Error(`Multipart complete failed: ${d.status} - ${e}`)}console.log("Multipart upload complete")},async computeSha256(e){const t=this.createSha256(),o=4194304;let s=0;while(s<e.size){const l=e.slice(s,Math.min(s+o,e.size)),a=await l.arrayBuffer();t.update(new Uint8Array(a)),s+=o,s%20971520<o&&console.log(`SHA256 progress: ${Math.min(100,Math.round(s/e.size*100))}%`)}return t.digest()},createSha256(){const e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let t=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=new Uint8Array(64),s=0,l=0;const a=(e,t)=>e>>>t|e<<32-t,i=o=>{const s=new Uint32Array(64);for(let e=0;e<16;e++)s[e]=o[4*e]<<24|o[4*e+1]<<16|o[4*e+2]<<8|o[4*e+3];for(let e=16;e<64;e++){const t=a(s[e-15],7)^a(s[e-15],18)^s[e-15]>>>3,o=a(s[e-2],17)^a(s[e-2],19)^s[e-2]>>>10;s[e]=s[e-16]+t+s[e-7]+o>>>0}let[l,i,n,r,c,d,u,p]=t;for(let t=0;t<64;t++){const o=a(c,6)^a(c,11)^a(c,25),h=c&d^~c&u,m=p+o+h+e[t]+s[t]>>>0,g=a(l,2)^a(l,13)^a(l,22),f=l&i^l&n^i&n,b=g+f>>>0;p=u,u=d,d=c,c=r+m>>>0,r=n,n=i,i=l,l=m+b>>>0}t[0]=t[0]+l>>>0,t[1]=t[1]+i>>>0,t[2]=t[2]+n>>>0,t[3]=t[3]+r>>>0,t[4]=t[4]+c>>>0,t[5]=t[5]+d>>>0,t[6]=t[6]+u>>>0,t[7]=t[7]+p>>>0};return{update(e){l+=e.length;let t=0;if(s>0){const l=64-s,a=Math.min(l,e.length);o.set(e.subarray(0,a),s),s+=a,t=a,64===s&&(i(o),s=0)}while(t+64<=e.length)i(e.subarray(t,t+64)),t+=64;t<e.length&&(o.set(e.subarray(t),0),s=e.length-t)},digest(){const e=8*l;o[s++]=128,s>56&&(o.fill(0,s,64),i(o),s=0),o.fill(0,s,56);const a=new DataView(o.buffer);a.setUint32(56,Math.floor(e/4294967296),!1),a.setUint32(60,e>>>0,!1),i(o);let n="";for(let o=0;o<8;o++)n+=t[o].toString(16).padStart(8,"0");return n}}},async convertImageToWebp(e){return new Promise((t,o)=>{if(e.type.includes("gif")||e.type.includes("svg")||e.type.includes("webp"))return void t(null);const s=new Image,l=document.createElement("canvas"),a=l.getContext("2d");s.onload=()=>{l.width=s.width,l.height=s.height,a.drawImage(s,0,0),l.toBlob(l=>{if(l){const o=e.name,s=o.lastIndexOf("."),a=s>0?o.substring(0,s)+".webp":o+".webp",i=new File([l],a,{type:"image/webp"});i.uid=e.uid,t(i)}else o(new Error("WebP 转换失败"));URL.revokeObjectURL(s.src)},"image/webp",.92)},s.onerror=()=>{URL.revokeObjectURL(s.src),o(new Error("图片加载失败"))},s.src=URL.createObjectURL(e)})},handleUploadCardMouseMove(e){const t=this.$refs.uploadCardGlow;if(!t)return;const o=e.currentTarget.getBoundingClientRect(),s=e.clientX-o.left,l=e.clientY-o.top;t.style.opacity="1",t.style.left=s+"px",t.style.top=l+"px"},handleUploadCardMouseLeave(){const e=this.$refs.uploadCardGlow;e&&(e.style.opacity="0")}},beforeDestroy(){this.retryTimer&&clearTimeout(this.retryTimer)}};const Ee=(0,B.A)(_e,[["render",Se],["__scopeId","data-v-6a7fc61f"]]);var Re=Ee,Ae=o(732),Ie=o(4453);const Pe={class:"container"},Ne={class:"upload-home"},Ve={href:"https://cfbed.sanyue.de/qa/",target:"_blank",class:"info-container"},ze={class:"toolbar-manage"},De={class:"toolbar"},Be={class:"header"},We={class:"title"},He={class:"main-title",href:"https://github.com/MarSeventh/CloudFlare-ImgBed",target:"_blank"},je={class:"dialog-section"},Xe={class:"section-content"},Oe={class:"dialog-section"},Qe={class:"section-header"},qe={class:"section-content"},Ge={class:"setting-item"},Je={key:0,class:"setting-item"},Ke={class:"dialog-action"},Ye={class:"dialog-section"},Ze={class:"section-content"},et={class:"setting-item"},tt={key:0,class:"setting-item"},ot={class:"setting-label"},st={class:"setting-item"},lt={class:"setting-item"},at={class:"setting-label"},it={class:"dialog-section"},nt={class:"section-content"},rt={class:"dialog-section"},ct={class:"section-header"},dt={class:"section-content"},ut={class:"setting-item"},pt={class:"setting-label"},ht={class:"setting-item"},mt={key:0,class:"setting-item slider-item"},gt={class:"setting-label"},ft={class:"slider-wrapper"},bt={class:"slider-input-wrapper"},yt={key:1,class:"setting-item slider-item"},Ct={class:"setting-label"},kt={class:"slider-wrapper"},vt={class:"slider-input-wrapper"},wt={key:0,class:"dialog-section"},Ft={class:"section-header"},Lt={class:"section-content"},Ut={class:"setting-item"},xt={class:"dialog-action"},St=["innerHTML"],Tt={class:"dialog-footer"};function Mt(e,t,o,n,r,c){const d=Ie.A,u=(0,a.g2)("font-awesome-icon"),p=s.R7,h=oe.WK,m=l.S2,g=Z.c6,f=Z.Iy,b=Z.dW,y=Ae.A,C=Re,k=J.ll,v=J.MQ,w=G.qi,F=q.kZ,L=Q.P9,U=Q.AV,x=O.B8,S=X.lq,T=j.A,M=H;return(0,a.uX)(),(0,a.CE)("div",Pe,[(0,a.Lk)("div",Ne,[(0,a.bF)(d,{class:"toggle-dark-button desktop-only"}),(0,a.bF)(p,{content:"查看文档",placement:"bottom",disabled:c.disableTooltip},{default:(0,a.k6)(()=>[(0,a.Lk)("a",Ve,[(0,a.bF)(u,{icon:"book",class:"info-icon",size:"lg"})])]),_:1},8,["disabled"]),(0,a.bF)(h,{class:(0,i.C4)(["upload-folder",{active:r.isFolderInputActive,"no-announcement":!c.announcementAvailable}]),modelValue:r.uploadFolder,"onUpdate:modelValue":t[0]||(t[0]=e=>r.uploadFolder=e),placeholder:"上传目录",onFocus:t[1]||(t[1]=e=>r.isFolderInputActive=!0),onBlur:t[2]||(t[2]=e=>r.isFolderInputActive=!1)},null,8,["class","modelValue"]),(0,a.bF)(p,{content:"切换上传方式",placement:"bottom",disabled:c.disableTooltip},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:"upload-method-button desktop-only",onClick:c.handleChangeUploadMethod},{default:(0,a.k6)(()=>["default"===r.uploadMethod?((0,a.uX)(),(0,a.Wv)(u,{key:0,icon:"folder-open",class:"upload-method-icon",size:"lg"})):"paste"===r.uploadMethod?((0,a.uX)(),(0,a.Wv)(u,{key:1,icon:"paste",class:"upload-method-icon",size:"lg"})):(0,a.Q3)("",!0)]),_:1},8,["onClick"])]),_:1},8,["disabled"]),(0,a.bF)(p,{content:"上传记录",placement:"bottom",disabled:c.disableTooltip},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:"history-button desktop-only",onClick:t[3]||(t[3]=e=>r.showHistory=!0)},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"history",class:"history-icon",size:"lg"})]),_:1})]),_:1},8,["disabled"]),c.announcementAvailable?((0,a.uX)(),(0,a.Wv)(p,{key:0,content:"查看公告",placement:"bottom",disabled:c.disableTooltip},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:"announcement-button desktop-only",onClick:c.handleShowAnnouncement},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"bullhorn",class:"announcement-icon",size:"lg"})]),_:1},8,["onClick"])]),_:1},8,["disabled"])):(0,a.Q3)("",!0),(0,a.bF)(b,{class:"mobile-more-dropdown mobile-only",trigger:"click",onCommand:c.handleMobileMenuCommand},{dropdown:(0,a.k6)(()=>[(0,a.bF)(f,null,{default:(0,a.k6)(()=>[(0,a.bF)(g,{command:"toggleTheme"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:c.getThemeIcon(),style:{"margin-right":"8px"}},null,8,["icon"]),(0,a.eW)(" "+(0,i.v_)(c.getThemeText()),1)]),_:1}),(0,a.bF)(g,{command:"toggleUploadMethod"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"default"===r.uploadMethod?"paste":"folder-open",style:{"margin-right":"8px"}},null,8,["icon"]),(0,a.eW)(" "+(0,i.v_)("default"===r.uploadMethod?"粘贴上传":"文件上传"),1)]),_:1}),(0,a.bF)(g,{command:"showHistory"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"history",style:{"margin-right":"8px"}}),t[26]||(t[26]=(0,a.eW)(" 上传记录 ",-1))]),_:1}),(0,a.bF)(g,{command:"showAnnouncement",disabled:!c.announcementAvailable},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"bullhorn",style:{"margin-right":"8px"}}),t[27]||(t[27]=(0,a.eW)(" 查看公告 ",-1))]),_:1},8,["disabled"])]),_:1})]),default:(0,a.k6)(()=>[(0,a.bF)(m,{class:"mobile-more-button"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"ellipsis-v",size:"lg"})]),_:1})]),_:1},8,["onCommand"]),(0,a.Lk)("div",ze,[(0,a.bF)(m,{class:(0,i.C4)(["toolbar-manage-button",{active:r.isToolBarOpen}]),size:"large",onClick:c.handleOpenToolbar,circle:""},{default:(0,a.k6)(()=>[r.isToolBarOpen?((0,a.uX)(),(0,a.Wv)(u,{key:1,icon:"times",class:"manage-icon",size:"lg"})):((0,a.uX)(),(0,a.Wv)(u,{key:0,icon:"bars",class:"manage-icon",size:"lg"}))]),_:1},8,["class","onClick"])]),(0,a.Lk)("div",De,[(0,a.bF)(p,{disabled:c.disableTooltip,content:"上传设置",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:(0,i.C4)(["toolbar-button compress-button",{active:r.isToolBarOpen}]),size:"large",onClick:c.openCompressDialog,circle:""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"cloud-upload",class:"compress-icon",size:"lg"})]),_:1},8,["class","onClick"])]),_:1},8,["disabled"]),(0,a.bF)(p,{disabled:c.disableTooltip,content:"链接格式",placement:"left"},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:(0,i.C4)(["toolbar-button link-button",{active:r.isToolBarOpen}]),size:"large",onClick:c.openUrlDialog,circle:""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"link",class:"link-icon",size:"lg"})]),_:1},8,["class","onClick"])]),_:1},8,["disabled"]),(0,a.bF)(p,{disabled:c.disableTooltip,content:"系统管理",placement:"left"},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:(0,i.C4)(["toolbar-button config-button",{active:r.isToolBarOpen}]),size:"large",onClick:c.handleManage,circle:""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"cog",class:"config-icon",size:"lg"})]),_:1},8,["class","onClick"])]),_:1},8,["disabled"]),(0,a.bF)(p,{disabled:c.disableTooltip,content:"退出登录",placement:"left"},{default:(0,a.k6)(()=>[(0,a.bF)(m,{class:(0,i.C4)(["toolbar-button sign-out-button",{active:r.isToolBarOpen}]),size:"large",onClick:c.handleLogout,circle:""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"sign-out-alt",class:"sign-out-icon",size:"lg"})]),_:1},8,["class","onClick"])]),_:1},8,["disabled"])]),(0,a.Lk)("div",Be,[(0,a.bF)(y,{useConfigLink:!0}),(0,a.Lk)("h1",We,[(0,a.Lk)("a",He,(0,i.v_)(c.ownerName),1),t[28]||(t[28]=(0,a.eW)(" ImgHub",-1))])]),(0,a.bF)(C,{selectedUrlForm:r.selectedUrlForm,customerCompress:r.customerCompress,compressQuality:r.compressQuality,compressBar:r.compressBar,serverCompress:r.serverCompress,uploadChannel:r.uploadChannel,channelName:r.channelName,uploadNameType:r.uploadNameType,useCustomUrl:r.useCustomUrl,customUrlPrefix:r.customUrlPrefix,autoRetry:r.autoRetry,urlPrefix:c.urlPrefix,uploadMethod:r.uploadMethod,uploadFolder:r.uploadFolder,convertToWebp:r.convertToWebp,class:"upload"},null,8,["selectedUrlForm","customerCompress","compressQuality","compressBar","serverCompress","uploadChannel","channelName","uploadNameType","useCustomUrl","customUrlPrefix","autoRetry","urlPrefix","uploadMethod","uploadFolder","convertToWebp"]),(0,a.bF)(F,{title:"链接格式设置",modelValue:r.showUrlDialog,"onUpdate:modelValue":t[8]||(t[8]=e=>r.showUrlDialog=e),width:c.dialogWidth,"show-close":!1,class:"settings-dialog"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",je,[t[33]||(t[33]=(0,a.Lk)("div",{class:"section-header"},[(0,a.Lk)("span",{class:"section-title"},"默认复制链接")],-1)),(0,a.Lk)("div",Xe,[(0,a.bF)(v,{modelValue:r.selectedUrlForm,"onUpdate:modelValue":t[4]||(t[4]=e=>r.selectedUrlForm=e),onChange:c.changeUrlForm,class:"radio-card-group grid-2x2"},{default:(0,a.k6)(()=>[(0,a.bF)(k,{value:"url",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"link",class:"radio-icon"}),t[29]||(t[29]=(0,a.Lk)("span",null,"原始链接",-1))]),_:1}),(0,a.bF)(k,{value:"md",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"code",class:"radio-icon"}),t[30]||(t[30]=(0,a.Lk)("span",null,"MarkDown",-1))]),_:1}),(0,a.bF)(k,{value:"html",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"code-branch",class:"radio-icon"}),t[31]||(t[31]=(0,a.Lk)("span",null,"HTML",-1))]),_:1}),(0,a.bF)(k,{value:"ubb",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"quote-right",class:"radio-icon"}),t[32]||(t[32]=(0,a.Lk)("span",null,"BBCode",-1))]),_:1})]),_:1},8,["modelValue","onChange"])])]),(0,a.Lk)("div",Oe,[(0,a.Lk)("div",Qe,[t[34]||(t[34]=(0,a.Lk)("span",{class:"section-title"},"自定义链接",-1)),(0,a.bF)(p,{content:"默认链接为https://your.domain/file/xxx.jpg <br> 如果启用自定义链接格式,只保留xxx.jpg部分,其他部分请自行输入",placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"section-help-icon"})]),_:1})]),(0,a.Lk)("div",qe,[(0,a.Lk)("div",Ge,[t[35]||(t[35]=(0,a.Lk)("span",{class:"setting-label"},"启用自定义",-1)),(0,a.bF)(w,{modelValue:r.useCustomUrl,"onUpdate:modelValue":t[5]||(t[5]=e=>r.useCustomUrl=e),"active-value":"true","inactive-value":"false"},null,8,["modelValue"])]),"true"===r.useCustomUrl?((0,a.uX)(),(0,a.CE)("div",Je,[t[36]||(t[36]=(0,a.Lk)("span",{class:"setting-label"},"自定义前缀",-1)),(0,a.bF)(h,{modelValue:r.customUrlPrefix,"onUpdate:modelValue":t[6]||(t[6]=e=>r.customUrlPrefix=e),placeholder:"请输入自定义链接前缀",class:"setting-input"},null,8,["modelValue"])])):(0,a.Q3)("",!0)])]),(0,a.Lk)("div",Ke,[(0,a.bF)(m,{type:"primary",onClick:t[7]||(t[7]=e=>r.showUrlDialog=!1),class:"confirm-btn"},{default:(0,a.k6)(()=>[...t[37]||(t[37]=[(0,a.eW)("确定",-1)])]),_:1})])]),_:1},8,["modelValue","width"]),(0,a.bF)(F,{title:"上传设置",modelValue:r.showCompressDialog,"onUpdate:modelValue":t[22]||(t[22]=e=>r.showCompressDialog=e),width:c.dialogWidth,"show-close":!1,class:"settings-dialog"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Ye,[t[47]||(t[47]=(0,a.Lk)("div",{class:"section-header"},[(0,a.Lk)("span",{class:"section-title"},"上传渠道")],-1)),(0,a.Lk)("div",Ze,[(0,a.Lk)("div",et,[t[43]||(t[43]=(0,a.Lk)("span",{class:"setting-label"},"渠道类型",-1)),(0,a.bF)(v,{modelValue:r.uploadChannel,"onUpdate:modelValue":t[9]||(t[9]=e=>r.uploadChannel=e),class:"radio-card-group compact"},{default:(0,a.k6)(()=>[(0,a.bF)(k,{label:"telegram",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"paper-plane",class:"channel-icon"}),t[38]||(t[38]=(0,a.Lk)("span",null,"TG",-1))]),_:1}),(0,a.bF)(k,{label:"cfr2",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"cloud",class:"channel-icon"}),t[39]||(t[39]=(0,a.Lk)("span",null,"R2",-1))]),_:1}),(0,a.bF)(k,{label:"s3",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"database",class:"channel-icon"}),t[40]||(t[40]=(0,a.Lk)("span",null,"S3",-1))]),_:1}),(0,a.bF)(k,{label:"discord",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"comments",class:"channel-icon"}),t[41]||(t[41]=(0,a.Lk)("span",null,"DC",-1))]),_:1}),(0,a.bF)(k,{label:"huggingface",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"robot",class:"channel-icon"}),t[42]||(t[42]=(0,a.Lk)("span",null,"HF",-1))]),_:1})]),_:1},8,["modelValue"])]),c.currentChannelList.length>1?((0,a.uX)(),(0,a.CE)("div",tt,[(0,a.Lk)("span",ot,[t[44]||(t[44]=(0,a.eW)(" 渠道名称 ",-1)),(0,a.bF)(p,{content:"选择具体的渠道名称,不选择则使用负载均衡或默认渠道",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"inline-help-icon"})]),_:1})]),(0,a.bF)(U,{modelValue:r.channelName,"onUpdate:modelValue":t[10]||(t[10]=e=>r.channelName=e),placeholder:"自动选择",clearable:"",class:"setting-input"},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(c.currentChannelList,e=>((0,a.uX)(),(0,a.Wv)(L,{key:e.name,label:e.name,value:e.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",st,[t[45]||(t[45]=(0,a.Lk)("span",{class:"setting-label"},"上传目录",-1)),(0,a.bF)(h,{modelValue:r.uploadFolder,"onUpdate:modelValue":t[11]||(t[11]=e=>r.uploadFolder=e),placeholder:"请输入上传目录路径",class:"setting-input"},null,8,["modelValue"])]),(0,a.Lk)("div",lt,[(0,a.Lk)("span",at,[t[46]||(t[46]=(0,a.eW)(" 自动切换 ",-1)),(0,a.bF)(p,{content:"对于非分块上传文件,上传失败自动切换到其他渠道上传",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"inline-help-icon"})]),_:1})]),(0,a.bF)(w,{modelValue:r.autoRetry,"onUpdate:modelValue":t[12]||(t[12]=e=>r.autoRetry=e)},null,8,["modelValue"])])])]),(0,a.Lk)("div",it,[t[52]||(t[52]=(0,a.Lk)("div",{class:"section-header"},[(0,a.Lk)("span",{class:"section-title"},"文件命名方式")],-1)),(0,a.Lk)("div",nt,[(0,a.bF)(v,{modelValue:r.uploadNameType,"onUpdate:modelValue":t[13]||(t[13]=e=>r.uploadNameType=e),class:"radio-card-group grid-2x2"},{default:(0,a.k6)(()=>[(0,a.bF)(k,{label:"default",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"cog",class:"radio-icon"}),t[48]||(t[48]=(0,a.Lk)("span",null,"默认",-1))]),_:1}),(0,a.bF)(k,{label:"index",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"hashtag",class:"radio-icon"}),t[49]||(t[49]=(0,a.Lk)("span",null,"仅前缀",-1))]),_:1}),(0,a.bF)(k,{label:"origin",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"file-signature",class:"radio-icon"}),t[50]||(t[50]=(0,a.Lk)("span",null,"仅原名",-1))]),_:1}),(0,a.bF)(k,{label:"short",class:"radio-card"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"compress-alt",class:"radio-icon"}),t[51]||(t[51]=(0,a.Lk)("span",null,"短链接",-1))]),_:1})]),_:1},8,["modelValue"])])]),(0,a.Lk)("div",rt,[(0,a.Lk)("div",ct,[t[53]||(t[53]=(0,a.Lk)("span",{class:"section-title"},"文件预处理",-1)),(0,a.bF)(p,{content:"上传前在本地进行格式转换和压缩,仅对图片文件生效",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"section-help-icon"})]),_:1})]),(0,a.Lk)("div",dt,[(0,a.Lk)("div",ut,[(0,a.Lk)("span",pt,[t[54]||(t[54]=(0,a.eW)(" 转换为WebP ",-1)),(0,a.bF)(p,{content:"上传前将图片转换为WebP格式,可有效减小文件体积。转换失败时保持原格式上传",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"inline-help-icon"})]),_:1})]),(0,a.bF)(w,{modelValue:r.convertToWebp,"onUpdate:modelValue":t[14]||(t[14]=e=>r.convertToWebp=e)},null,8,["modelValue"])]),(0,a.Lk)("div",ht,[t[55]||(t[55]=(0,a.Lk)("span",{class:"setting-label"},"文件压缩",-1)),(0,a.bF)(w,{modelValue:r.customerCompress,"onUpdate:modelValue":t[15]||(t[15]=e=>r.customerCompress=e)},null,8,["modelValue"])]),r.customerCompress?((0,a.uX)(),(0,a.CE)("div",mt,[(0,a.Lk)("span",gt,[t[56]||(t[56]=(0,a.eW)(" 压缩阈值 ",-1)),(0,a.bF)(p,{content:"设置图片大小阈值,超过此值将自动压缩,单位MB",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"inline-help-icon"})]),_:1})]),(0,a.Lk)("div",ft,[(0,a.bF)(x,{modelValue:r.compressBar,"onUpdate:modelValue":t[16]||(t[16]=e=>r.compressBar=e),min:1,max:20,"format-tooltip":e=>`${e} MB`},null,8,["modelValue","format-tooltip"]),(0,a.Lk)("div",bt,[(0,a.bF)(S,{modelValue:r.compressBar,"onUpdate:modelValue":t[17]||(t[17]=e=>r.compressBar=e),min:1,max:20,step:1,"value-on-clear":1,class:"slider-input","controls-position":"right"},null,8,["modelValue"]),t[57]||(t[57]=(0,a.Lk)("span",{class:"slider-unit"},"MB",-1))])])])):(0,a.Q3)("",!0),r.customerCompress?((0,a.uX)(),(0,a.CE)("div",yt,[(0,a.Lk)("span",Ct,[t[58]||(t[58]=(0,a.eW)(" 期望大小 ",-1)),(0,a.bF)(p,{content:"设置压缩后图片大小期望值,单位MB",placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"inline-help-icon"})]),_:1})]),(0,a.Lk)("div",kt,[(0,a.bF)(x,{modelValue:r.compressQuality,"onUpdate:modelValue":t[18]||(t[18]=e=>r.compressQuality=e),min:.5,max:r.compressBar,step:.1,"format-tooltip":e=>`${e} MB`},null,8,["modelValue","max","format-tooltip"]),(0,a.Lk)("div",vt,[(0,a.bF)(S,{modelValue:r.compressQuality,"onUpdate:modelValue":t[19]||(t[19]=e=>r.compressQuality=e),min:.5,max:r.compressBar,step:.1,precision:1,"value-on-clear":.5,class:"slider-input","controls-position":"right"},null,8,["modelValue","max"]),t[59]||(t[59]=(0,a.Lk)("span",{class:"slider-unit"},"MB",-1))])])])):(0,a.Q3)("",!0)])]),"telegram"===r.uploadChannel?((0,a.uX)(),(0,a.CE)("div",wt,[(0,a.Lk)("div",Ft,[t[60]||(t[60]=(0,a.Lk)("span",{class:"section-title"},"服务端压缩",-1)),(0,a.bF)(p,{content:"1. 在 Telegram 端进行压缩,仅对上传渠道为 Telegram 的图片文件生效 <br> 2. 若图片大小(本地压缩后大小)大于10MB,本设置自动失效 <br> 3. 若上传分辨率过大、透明背景等图片,建议关闭服务端压缩,否则可能出现未知问题",placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"section-help-icon"})]),_:1})]),(0,a.Lk)("div",Lt,[(0,a.Lk)("div",Ut,[t[61]||(t[61]=(0,a.Lk)("span",{class:"setting-label"},"开启压缩",-1)),(0,a.bF)(w,{modelValue:r.serverCompress,"onUpdate:modelValue":t[20]||(t[20]=e=>r.serverCompress=e)},null,8,["modelValue"])])])])):(0,a.Q3)("",!0),(0,a.Lk)("div",xt,[(0,a.bF)(m,{type:"primary",onClick:t[21]||(t[21]=e=>r.showCompressDialog=!1),class:"confirm-btn"},{default:(0,a.k6)(()=>[...t[62]||(t[62]=[(0,a.eW)("确定",-1)])]),_:1})])]),_:1},8,["modelValue","width"])]),(0,a.bF)(T,{class:"footer"}),(0,a.bF)(F,{title:"公告",modelValue:r.showAnnouncementDialog,"onUpdate:modelValue":t[24]||(t[24]=e=>r.showAnnouncementDialog=e),width:c.dialogWidth,"show-close":!1,"close-on-click-modal":!1,"close-on-press-escape":!1,center:""},{footer:(0,a.k6)(()=>[(0,a.Lk)("span",Tt,[(0,a.bF)(m,{type:"primary",onClick:t[23]||(t[23]=e=>r.showAnnouncementDialog=!1)},{default:(0,a.k6)(()=>[...t[63]||(t[63]=[(0,a.eW)("我已知晓!",-1)])]),_:1})])]),default:(0,a.k6)(()=>[(0,a.Lk)("div",{innerHTML:r.announcementContent},null,8,St)]),_:1},8,["modelValue","width"]),(0,a.bF)(M,{show:r.showHistory,onClose:t[25]||(t[25]=e=>r.showHistory=!1)},null,8,["show"])])}o(3579);var $t=o(8903),_t=o(144),Et=o(4570),Rt=o.n(Et),At=o(2388),It={name:"UploadHome",mixins:[$t.A],data(){return{selectedUrlForm:(0,_t.KR)(""),showUrlDialog:!1,showCompressDialog:!1,customerCompress:!0,compressQuality:4,compressBar:5,convertToWebp:!1,serverCompress:!0,uploadChannel:"",channelName:"",availableChannels:{},uploadNameType:"",customUrlPrefix:"",useCustomUrl:"false",autoRetry:!0,useDefaultWallPaper:!1,isToolBarOpen:!1,uploadMethod:"default",uploadFolder:"",isFolderInputActive:!1,showAnnouncementDialog:!1,announcementContent:"",showHistory:!1,themeMode:"auto"}},watch:{customerCompress(e){this.updateCompressConfig("customerCompress",e)},compressQuality(e){this.updateCompressConfig("compressQuality",e)},compressBar(e){null===e||void 0===e||e<1?this.compressBar=1:(this.compressQuality>e&&(this.compressQuality=e),this.updateCompressConfig("compressBar",e))},serverCompress(e){this.updateCompressConfig("serverCompress",e)},convertToWebp(e){this.updateCompressConfig("convertToWebp",e)},uploadChannel(e){this.updateStoreUploadChannel(e);const t=this.availableChannels[e]||[],o=this.storeChannelName;o&&t.some(e=>e.name===o)?this.channelName=o:this.channelName=""},channelName(e){this.$store.commit("setStoreChannelName",e)},uploadNameType(e){this.updateStoreUploadNameType(e)},customUrlPrefix(e){this.$store.commit("setCustomUrlSettings",{key:"customUrlPrefix",value:e})},useCustomUrl(e){this.$store.commit("setCustomUrlSettings",{key:"useCustomUrl",value:e})},autoRetry(e){this.$store.commit("setStoreAutoRetry",e)},uploadFolder(e){this.validateUploadFolder(e)?this.$store.commit("setStoreUploadFolder",e):this.$nextTick(()=>{this.uploadFolder=this.storeUploadFolder})}},computed:{...(0,$e.L8)(["userConfig","uploadCopyUrlForm","compressConfig","storeUploadChannel","storeChannelName","storeUploadNameType","customUrlSettings","storeAutoRetry","storeUploadMethod","storeUploadFolder"]),ownerName(){return this.userConfig?.ownerName||"Sanyue"},dialogWidth(){return window.innerWidth>768?"50%":"90%"},disableTooltip(){return window.innerWidth<768},urlPrefix(){return this.userConfig?.urlPrefix||`${window.location.protocol}//${window.location.host}/file/`},announcementAvailable(){return!!this.userConfig?.announcement},currentChannelList(){return this.availableChannels[this.uploadChannel]||[]}},mounted(){this.initializeBackground("uploadBkImg",".container",!1,!0),this.selectedUrlForm=this.uploadCopyUrlForm||"url",this.customerCompress=this.compressConfig.customerCompress??this.parseBoolean(this.userConfig?.defaultCustomerCompress,!0),this.compressQuality=this.compressConfig.compressQuality??this.parseNumber(this.userConfig?.defaultCompressQuality,4),this.compressBar=this.compressConfig.compressBar??this.parseNumber(this.userConfig?.defaultCompressBar,5),this.serverCompress=this.compressConfig.serverCompress??!0,this.convertToWebp=this.compressConfig.convertToWebp??this.parseBoolean(this.userConfig?.defaultConvertToWebp,!1),this.uploadChannel=this.storeUploadChannel||this.userConfig?.defaultUploadChannel||"telegram",this.autoRetry=this.storeAutoRetry,this.uploadNameType=this.storeUploadNameType||this.userConfig?.defaultUploadNameType||"default",this.customUrlPrefix=this.customUrlSettings.customUrlPrefix,this.useCustomUrl=this.customUrlSettings.useCustomUrl,this.uploadMethod=this.storeUploadMethod,this.fetchAvailableChannels(),this.uploadFolder=this.storeUploadFolder||this.userConfig?.defaultUploadFolder||"";const e=this.$store.getters.cusDarkMode,t=this.$store.getters.useDarkMode;this.themeMode=e?t?"dark":"light":"auto";const o=localStorage.getItem("visitedUploadHome"),s=this.userConfig?.announcement;!o&&s&&(this.announcementContent=s,this.showAnnouncementDialog=!0,localStorage.setItem("visitedUploadHome","true"))},components:{UploadForm:Re,Footer:j.A,ToggleDark:Ie.A,Logo:Ae.A,UploadHistory:H},methods:{async fetchAvailableChannels(){try{const e=await Te.A.get("/api/channels");if(e.data){this.availableChannels=e.data;const t=this.storeChannelName,o=this.userConfig?.defaultChannelName,s=this.availableChannels[this.uploadChannel]||[];t&&s.some(e=>e.name===t)?this.channelName=t:o&&s.some(e=>e.name===o)&&(this.channelName=o)}}catch(e){console.error("Failed to fetch available channels:",e)}},validateUploadFolder(e){const t=(0,At.G)(e);if(!t.valid){const e=t.error.replace("目标目录","上传目录");return this.$message.error(e),!1}return!0},handleManage(){this.$router.push("/dashboard")},parseBoolean(e,t){return void 0===e||null===e?t:"boolean"===typeof e?e:"string"===typeof e?"true"===e:t},parseNumber(e,t){if(void 0===e||null===e)return t;const o=parseFloat(e);return isNaN(o)?t:o},openUrlDialog(){this.showUrlDialog=!0},handleLogout(){Rt().remove("authCode"),this.$router.push("/login"),this.$message.success("已退出登录")},changeUrlForm(){this.$store.commit("setUploadCopyUrlForm",this.selectedUrlForm)},openCompressDialog(){this.showCompressDialog=!0},updateCompressConfig(e,t){this.$store.commit("setCompressConfig",{key:e,value:t})},updateStoreUploadChannel(e){this.$store.commit("setStoreUploadChannel",e)},updateStoreUploadNameType(e){this.$store.commit("setStoreUploadNameType",e)},handleOpenToolbar(){this.isToolBarOpen=!this.isToolBarOpen,setTimeout(()=>{const e=document.querySelectorAll(".toolbar-button");e.forEach(e=>{e.style.pointerEvents=this.isToolBarOpen?"auto":"none"})},300)},handleChangeUploadMethod(){this.uploadMethod="default"===this.uploadMethod?"paste":"default",this.$store.commit("setUploadMethod",this.uploadMethod)},handleMobileMenuCommand(e){"toggleTheme"===e?"auto"===this.themeMode?(this.themeMode="light",this.$store.commit("setCusDarkMode",!0),this.$store.commit("setUseDarkMode",!1)):"light"===this.themeMode?(this.themeMode="dark",this.$store.commit("setCusDarkMode",!0),this.$store.commit("setUseDarkMode",!0)):(this.themeMode="auto",this.$store.commit("setCusDarkMode",!1)):"toggleUploadMethod"===e?this.handleChangeUploadMethod():"showHistory"===e?this.showHistory=!0:"showAnnouncement"===e&&this.handleShowAnnouncement()},getThemeIcon(){return"auto"===this.themeMode?"sun":"light"===this.themeMode?"moon":"adjust"},getThemeText(){return"auto"===this.themeMode?"浅色模式":"light"===this.themeMode?"深色模式":"自动模式"},handleShowAnnouncement(){const e=this.userConfig?.announcement;e?(this.announcementContent=e,this.showAnnouncementDialog=!0):this.$message.info("暂无公告")}}};const Pt=(0,B.A)(It,[["render",Mt],["__scopeId","data-v-5db1b684"]]);var Nt=Pt},8075:function(e,t,o){"use strict";o(5331)},8785:function(e,t,o){"use strict";o(5331)},8830:function(e,t,o){"use strict";o(5331)},9104:function(e,t,o){"use strict";o(5331)}}]);
|
||
//# sourceMappingURL=282.326e16ce.js.map
|