import{a as v,s as b}from"./assetStore-BSVLrDIW.js";import{a8 as h,a9 as y,p as g,a as k,c as n,o as a,d as s,t as x,g as _,k as u,b as i,F as w}from"./app-fEKA3BkQ.js";const S={for:""},A={class:"relative"},M={class:"card my-1 flex max-w-full flex-wrap gap-2 rounded-md border bg-black/50 bg-slate-100 p-1 dark:border-slate-700"},V={key:0,class:"relative h-16 w-16 rounded-md"},B={class:"h-full w-full"},C=["src"],I=["src"],F={__name:"AssetInput",props:h({label:{type:String,default:""},type:{type:String,default:"image"},multiple:{type:Boolean,default:!1}},{modelValue:{type:[Array,String],default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const d=v();b();const e=y(l,"modelValue"),c=l,m=()=>{d.openModal({load:c.type,multiple:c.multiple,onOpen:()=>{},onSelect:t=>{c.multiple||(e.value=t.path,d.closeModal())},onSubmit:t=>{e.value=t.map(o=>o.path)}})},p=g(()=>Array.isArray(e.value)),f=t=>{p.value?e.value=e.value.filter(o=>o.path!==t):e.value=null};return(t,o)=>{const r=k("Icon");return a(),n(w,null,[s("label",S,x(l.label),1),s("div",A,[s("div",null,[s("div",M,[e.value?(a(),n("div",V,[s("div",B,[l.type==="image"?(a(),n("img",{key:0,src:e.value,class:"h-full w-full rounded object-cover",alt:"img"},null,8,C)):l.type==="video"?(a(),n("video",{key:1,src:e.value,class:"h-full w-full rounded object-cover"},null,8,I)):l.type==="audio"?(a(),u(r,{key:2,src:e.value,icon:"bx:microphone",class:"h-12 w-12"},null,8,["src"])):(a(),u(r,{key:3,icon:"bx:file",class:"absolute right-0 top-0 z-10 h-full w-full p-1 hover:bg-black/50"})),i(r,{icon:"bx:x",onClick:o[0]||(o[0]=j=>f(e.value)),class:"absolute right-0 top-0 z-10 h-4 w-4 cursor-pointer rounded hover:bg-red-600"})])])):_("",!0),s("button",{type:"button",class:"flex h-16 w-16 items-center justify-center rounded border dark:border-slate-500",onClick:m},[i(r,{icon:"bx:upload",class:"text-2xl text-slate-500 dark:text-slate-400"})])])])])],64)}}};export{F as _};
