import{Q as e}from"./utils-lib.js?v=1761009159";import{m as a,n as t,g as s,s as l,o}from"./api.js?v=1761009159";import{c as n,y as i,r as c,o as r,q as m,H as d,v as u,x as p,e as f,B as v,I as y,N as _,F as h,b0 as g,D as w,C as k,z as x,Q as b,A as D}from"./base-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const j={key:0,class:"mr-1rem"},I={class:"inline-block w-full flex items-center justify-between"},E=["title"],V={class:"truncate max-w-[12rem]"},C={key:0,class:"h-4rem flex items-center justify-center text-tertiaryer"},A={key:1,class:"h-4rem flex items-center justify-center text-tertiaryer text-small"},B=n({__name:"cosfs-mount",props:{dependencies:{default:()=>({})}},setup(n){const B=n,{BtDialog:F,BtInputIcon:N,BtSvgIcon:S,ElDropdown:q,ElDropdownItem:L,ElDropdownMenu:z,ElForm:H,ElButton:M,ElFormItem:O}=i(B.dependencies.components),{useAxios:P,useMessage:Q,useDialog:R}=i(B.dependencies.hooks),{fileSelectionDialog:U}=i(B.dependencies.dialog),{getDiskList:T}=i(B.dependencies.custom),$=Q(),G=c(!1),J=c(!1),K=c([]),W=c(!1),X=c(!1),Y=c(),Z=r({region:"",bucket_name:"",path:""}),ee=r({path:[{required:!0,message:"请选择文件目录",trigger:"blur"}]}),ae=()=>{U({type:"dir",change:e=>{Z.path=e}})},te=()=>{R({isAsync:!0,component:()=>e(()=>import("./config5.js?v=1761009159"),__vite__mapDeps([]),import.meta.url),title:!1,area:[48],compData:{dependencies:B.dependencies}})},se=e=>{const{Name:a,Location:t}=K.value[e];Z.region=t,Z.bucket_name=a,Z.path="/www/cosfs/".concat(a.replace(/([-][^-]+)$/,"")),X.value=!0},le=async()=>{try{await Y.value.validate();const e=$.load("正在挂载，请稍后..."),t=await a(Z);$.request(t),t.status&&(X.value=!1,oe(),T()),e.close()}catch(e){}},oe=async()=>{try{J.value=!0;const e=await t();e.status&&(K.value=e.data.list)}catch(e){}finally{J.value=!1}},ne=async()=>{try{const{data:e}=await s();!1===(null==e?void 0:e.status)&&(null==e?void 0:e.msg)&&(W.value=!0),e&&(async()=>{try{const e=await o({sName:"cosfs"});e.data.setup&&oe(),G.value=e.data.setup}catch(e){}})(),G.value=!!e}catch(e){}};return m(()=>{l(P),ne()}),(e,a)=>{const t=d("bt-loading"),s=d("trim");return i(G)?(u(),p("div",j,[f(i(q),{placement:"bottom-start",onCommand:se},{dropdown:v(()=>[y((u(),_(i(z),{class:"w-20rem"},{default:v(()=>[i(W)?(u(),p("div",A,[a[4]||(a[4]=k("未关联腾讯云API密钥",-1)),x("a",{class:"bt-link cursor-pointer ml-4px",onClick:te},">>关联密钥")])):(u(),p(h,{key:0},[(u(!0),p(h,null,g(i(K),(e,t)=>(u(),_(i(L),{key:t,command:t},{default:v(()=>[x("div",I,[x("div",{class:"flex items-center",title:e.Name.split("-")[0]},[f(i(S),{name:"file-hdd",size:"1.4",class:"mr-4px"}),x("div",V,D(e.Name.split("-")[0]),1)],8,E),a[3]||(a[3]=x("div",{class:"text-primary"},"挂载",-1))])]),_:2},1032,["command"]))),128)),i(K).length?w("",!0):(u(),p("div",C,"暂无未挂载存储桶"))],64))]),_:1})),[[t,i(J)]])]),default:v(()=>[f(i(M),null,{default:v(()=>a[2]||(a[2]=[k("腾讯云COSFS挂载工具",-1),x("i",{class:"svgtofont-el-arrow-down el-icon--right"},null,-1)])),_:1,__:[2]})]),_:1}),f(i(F),{title:"【".concat(i(Z).bucket_name,"】本地挂载"),modelValue:i(X),"onUpdate:modelValue":a[1]||(a[1]=e=>b(X)?X.value=e:null),"show-footer":!0,area:[50],"confirm-text":"挂载",onConfirm:le},{default:v(()=>[f(i(H),{ref_key:"mountFromRef",ref:Y,class:"p-2rem",model:i(Z),rules:i(ee)},{default:v(()=>[f(i(O),{label:"挂载地址",prop:"path"},{default:v(()=>[y(f(i(N),{modelValue:i(Z).path,"onUpdate:modelValue":a[0]||(a[0]=e=>i(Z).path=e),name:"path",icon:"el-folder-opened",width:"32rem",placeholder:"请选择文件目录",onIconClick:ae},null,8,["modelValue"]),[[s]])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])):w("",!0)}}});export{B as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
