import{a as e,n as t,t as n}from"./jsx-runtime-CutOxEx1.js";var r=e(t(),1),i=n();function a({label:e,accept:t,file:n,onPick:a,hint:o,disabled:s=!1}){let c=(0,r.useMemo)(()=>`fp_${Math.random().toString(16).slice(2)}`,[]),l=n?`${n.name} · ${(n.size/1024/1024).toFixed(2)}MB`:`未选择文件`;return(0,i.jsxs)(`div`,{className:`he-file-row`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`he-label`,children:e}),(0,i.jsxs)(`div`,{className:`he-file-meta`,children:[(0,i.jsx)(`strong`,{children:l}),o?(0,i.jsx)(`div`,{className:`he-muted`,style:{marginTop:6},children:o}):null]})]}),(0,i.jsxs)(`div`,{className:`he-actions`,children:[(0,i.jsx)(`input`,{id:c,type:`file`,accept:t,disabled:s,style:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},onChange:e=>a(e.target.files?.[0]||null)}),(0,i.jsx)(`label`,{className:`btn-secondary he-file-action`,htmlFor:s?void 0:c,style:{cursor:s?`not-allowed`:`pointer`,opacity:s?.55:1},children:`选择文件`}),n?(0,i.jsx)(`button`,{type:`button`,className:`btn-secondary he-file-action`,onClick:()=>a(null),disabled:s,children:`清除`}):null]})]})}export{a as t};