import"./rolldown-runtime-BM3Ffeng.js";import{a as e,ot as t}from"./element-plus-vendor-BF9PNysW.js";import{A as n,D as r,E as i,I as a,N as o,O as s,P as c,Pt as l,Tt as u,Xt as d,et as f,gt as p,ht as m,k as h,nt as g,pt as _,x as v}from"./vue-vendor-DMUmTARL.js";import{Qo as y,Xo as b,Zo as x}from"./icons-vendor-Buq6V-Ga.js";import{Et as S,I as C,R as w,Tt as T,y as E}from"./index-y6crcKNt.js";import{t as D}from"./Breadcrumb-sJw2NsAs.js";var O={class:`mt-3 text-sm text-secondary`},k={class:`zf-storage-folder-picker__list max-h-96 overflow-y-auto py-3`},A={role:`list`,class:`space-y-1`,"aria-label":`文件夹列表`},j=[`onClick`],M={class:`select-none truncate`},N={key:0,class:`flex min-h-48 w-full select-none flex-col items-center justify-center p-6 text-center`},P={class:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-zp/10 dark:bg-zp/15`},F={class:`flex flex-1 items-center justify-between gap-3`},I={class:`truncate text-sm text-placeholder`},L={class:`flex shrink-0 gap-2.5`},R=T(a({__name:`StorageFolderPickerDialog`,props:{modelValue:{type:Boolean},loadFolders:{},title:{default:`选择文件夹`},initPath:{default:`/`}},emits:[`update:modelValue`,`confirm`],setup(a,{emit:T}){let R=E(),z=a,B=T,V=i({get:()=>z.modelValue,set:e=>B(`update:modelValue`,e)}),H=u(`/`),U=u([]),W=u(!1),G=i(()=>{let e=[{name:`根目录`,href:`/`,disable:!1}];return H.value.split(`/`).filter(Boolean).forEach((t,n,r)=>{e.push({name:t,href:C(`/`,r.slice(0,n+1).join(`/`)),disable:n===r.length-1})}),e}),K=async()=>{W.value=!0;try{U.value=await z.loadFolders(H.value)}catch(e){R.error(e?.message||`加载目录失败，请检查存储源是否可用`),U.value=[]}finally{W.value=!1}},q=e=>{H.value=e.fullPath,K()},J=e=>{e.href&&(H.value=decodeURI(e.href),K())},Y=()=>{B(`confirm`,H.value),V.value=!1},X=()=>{V.value=!1},Z=()=>{V.value=!1};return _(()=>z.modelValue,e=>{e&&(H.value=z.initPath?.startsWith(`/`)?z.initPath:`/`,K())},{immediate:!0}),(i,u)=>{let _=D,C=b,T=x,E=y,R=t,z=S,B=e;return f(),s(z,{modelValue:V.value,"onUpdate:modelValue":u[0]||=e=>V.value=e,width:`420px`,"hidden-full-btn":!0,title:a.title,onClose:Z},{footer:m(()=>[r(`div`,F,[r(`span`,I,` 当前：`+d(l(w)(H.value)),1),r(`div`,L,[c(R,{onClick:X},{default:m(()=>[...u[3]||=[o(`取消`,-1)]]),_:1}),c(R,{type:`primary`,onClick:Y},{default:m(()=>[...u[4]||=[o(`选择当前目录`,-1)]]),_:1})])])]),default:m(()=>[r(`div`,O,[c(_,{items:G.value,onBreadcrumbClick:J},null,8,[`items`])]),p((f(),n(`div`,k,[r(`div`,A,[(f(!0),n(v,null,g(U.value,e=>(f(),n(`button`,{key:e.fullPath,type:`button`,class:`group flex w-full cursor-pointer select-none items-center rounded-lg py-2.5 text-left text-sm font-medium text-regular transition-colors duration-150 hover:bg-zf-hover hover:text-primary`,onClick:t=>q(e)},[c(C,{class:`mr-3 h-6 w-6 flex-shrink-0 text-2xl`}),r(`span`,M,d(e.name),1),c(T,{class:`ml-auto h-4 w-4 -translate-x-2 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100`})],8,j))),128)),!W.value&&U.value.length===0?(f(),n(`div`,N,[r(`div`,P,[c(E,{class:`h-8 w-8 text-zp`})]),u[1]||=r(`h3`,{class:`mb-1.5 text-base font-medium text-regular`},`暂无子文件夹`,-1),u[2]||=r(`p`,{class:`text-sm text-placeholder`},`当前目录下没有更多子文件夹，可直接选择此目录`,-1)])):h(``,!0)])])),[[B,W.value]])]),_:1},8,[`modelValue`,`title`])}}}),[[`__scopeId`,`data-v-95fcc450`]]);export{R as t};