import{a6 as H,bQ as X,cj as Y,c5 as Z,ag as ee,b4 as le,bl as te,bT as ne,an as s,ck as M,r as b,w as ae,as as oe,bV as ue,bW as $,c9 as ie,f as o,ca as se,L as C,F as V,aM as re,cc as ce,bJ as de,bK as fe,cd as ve}from"./index.737529e8.1750111005555.js";const pe=H({chips:Boolean,counter:Boolean,counterSizeString:{type:String,default:"$vuetify.fileInput.counterSize"},counterString:{type:String,default:"$vuetify.fileInput.counter"},multiple:Boolean,showSize:{type:[Boolean,Number],default:!1,validator:e=>typeof e=="boolean"||[1e3,1024].includes(e)},...X({prependIcon:"$file"}),modelValue:{type:Array,default:()=>[],validator:e=>Y(e).every(f=>f!=null&&typeof f=="object")},...Z({clearable:!0})},"VFileInput"),be=ee()({name:"VFileInput",inheritAttrs:!1,props:pe(),emits:{"click:control":e=>!0,"mousedown:control":e=>!0,"update:focused":e=>!0,"update:modelValue":e=>!0},setup(e,f){let{attrs:x,emit:g,slots:n}=f;const{t:h}=le(),a=te(e,"modelValue"),{isFocused:v,focus:D,blur:N}=ne(e),k=s(()=>typeof e.showSize!="boolean"?e.showSize:void 0),I=s(()=>(a.value??[]).reduce((l,t)=>{let{size:r=0}=t;return l+r},0)),F=s(()=>M(I.value,k.value)),m=s(()=>(a.value??[]).map(l=>{const{name:t="",size:r=0}=l;return e.showSize?`${t} (${M(r,k.value)})`:t})),j=s(()=>{var t;const l=((t=a.value)==null?void 0:t.length)??0;return e.showSize?h(e.counterSizeString,l,F.value):h(e.counterString,l)}),S=b(),P=b(),i=b(),E=s(()=>v.value||e.active),w=s(()=>["plain","underlined"].includes(e.variant));function y(){var l;i.value!==document.activeElement&&((l=i.value)==null||l.focus()),v.value||D()}function L(l){z(l)}function T(l){g("mousedown:control",l)}function z(l){var t;(t=i.value)==null||t.click(),g("click:control",l)}function U(l){l.stopPropagation(),y(),fe(()=>{a.value=[],ve(e["onClick:clear"],l)})}return ae(a,l=>{(!Array.isArray(l)||!l.length)&&i.value&&(i.value.value="")}),oe(()=>{const l=!!(n.counter||e.counter),t=!!(l||n.details),[r,J]=ue(x),[{modelValue:me,...K}]=$.filterProps(e),[O]=ie(e);return o($,C({ref:S,modelValue:a.value,"onUpdate:modelValue":c=>a.value=c,class:["v-file-input",{"v-text-field--plain-underlined":w.value},e.class],style:e.style,"onClick:prepend":L},r,K,{centerAffix:!w.value,focused:v.value}),{...n,default:c=>{let{id:p,isDisabled:d,isDirty:R,isReadonly:A,isValid:Q}=c;return o(se,C({ref:P,"prepend-icon":e.prependIcon,onMousedown:T,onClick:z,"onClick:clear":U,"onClick:prependInner":e["onClick:prependInner"],"onClick:appendInner":e["onClick:appendInner"]},O,{id:p.value,active:E.value||R.value,dirty:R.value,disabled:d.value,focused:v.value,error:Q.value===!1}),{...n,default:W=>{var B;let{props:{class:_,...q}}=W;return o(V,null,[o("input",C({ref:i,type:"file",readonly:A.value,disabled:d.value,multiple:e.multiple,name:e.name,onClick:u=>{u.stopPropagation(),A.value&&u.preventDefault(),y()},onChange:u=>{if(!u.target)return;const G=u.target;a.value=[...G.files??[]]},onFocus:y,onBlur:N},q,J),null),o("div",{class:_},[!!((B=a.value)!=null&&B.length)&&(n.selection?n.selection({fileNames:m.value,totalBytes:I.value,totalBytesReadable:F.value}):e.chips?m.value.map(u=>o(re,{key:u,size:"small",color:e.color},{default:()=>[u]})):m.value.join(", "))])])}})},details:t?c=>{var p,d;return o(V,null,[(p=n.details)==null?void 0:p.call(n,c),l&&o(V,null,[o("span",null,null),o(ce,{active:!!((d=a.value)!=null&&d.length),value:j.value},n.counter)])])}:void 0})}),de({},S,P,i)}});export{be as V};
