import{_ as j}from"./FilterDropdown-9268f1dc.js";import{_ as B}from"./NoDataFound-bc81d7fa.js";import{_ as I}from"./Paginate-f61b79b2.js";import{s as T,h as C,x as D,o,c as n,r as F,b as e,a as l,j as b,i as $,t as g,e as i,u as A,d as N,F as v,m as x,T as O,A as L,n as k,g as S,Z as U}from"./app-13978987.js";import{_ as V}from"./FloatingDropdown-0be3e47c.js";import{_ as q}from"./CreatePostCard-92b6d387.js";import{_ as E}from"./UserLayout-6a50516d.js";import"./SpinnerBtn-899a94c2.js";import"./dropdown-45d66330.js";const M={class:"absolute right-1 top-1 z-10"},P={class:"flex h-full flex-col"},W={class:"text-sm"},G={class:"text-sm"},R={key:0,class:"h-52 w-full object-cover",alt:"image"},Z={key:1,controls:"",class:"h-52 w-full"},H=["src"],J={key:2,controls:"",class:"h-52 w-full"},K=["src"],Q=["src"],X={class:"ml-auto mt-1 flex max-w-max items-center rounded-md px-1"},Y=e("i",{class:"bx bx-file-blank mr-1 text-base"},null,-1),ee={class:"text-xs font-semibold capitalize"},w={__name:"AssetCard",props:{assets:[Object,Array]},setup(_){const{deleteRow:c}=T();return(s,f)=>{const m=C("Icon"),d=C("Link"),u=D("lazy");return o(!0),n(v,null,F(_.assets,(t,y)=>(o(),n("div",{key:y,class:"relative h-60 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800"},[e("div",M,[l(V,{"btn-type":"icon","icon-name":"bx:dots-vertical-rounded",btnClass:"p-1 bg-dark-100 dark:bg-dark-800 rounded-full"},{default:b(()=>[e("div",P,[t.mime_type==="image"?(o(),$(d,{key:0,href:s.route("user.image-editor.edit",t.uuid),class:"dropdown-link py-1.5"},{default:b(()=>[l(m,{icon:"fe:edit"}),e("span",W,g(s.trans("Edit")),1)]),_:2},1032,["href"])):i("",!0),l(d,{as:"button",class:"dropdown-link py-1.5",onClick:h=>A(c)(s.route("user.assets.destroy",t.id))},{default:b(()=>[l(m,{icon:"fe:trash"}),e("span",G,g(s.trans("Delete")),1)]),_:2},1032,["onClick"])])]),_:2},1024)]),t.mime_type==="image"?N((o(),n("img",R,null,512)),[[u,t.path]]):i("",!0),t.mime_type==="video"?(o(),n("video",Z,[e("source",{src:t.path,type:"video/mp4"},null,8,H)])):i("",!0),t.mime_type==="voice"?(o(),n("audio",J,[e("source",{src:t.path,type:"audio/wav"},null,8,K),e("source",{src:t.path,type:"audio/mp3"},null,8,Q)])):i("",!0),e("div",X,[Y,e("span",ee,g(t.file_size)+" MB",1)])]))),128)}}},se={class:"container flex-grow p-4 sm:p-6"},te={class:"mt-4 flex items-start justify-between md:items-center"},ae={class:"card max-w-max p-1"},oe=e("span",{class:"text-xs md:text-sm"},"All",-1),le=[oe],ne=e("span",{class:"text-xs md:text-sm"},"Uploads",-1),ie=[ne],re=e("span",{class:"text-xs md:text-sm"},"Ai Generated",-1),ce=[re],de={class:"w-80"},ue={class:"mt-8"},pe={class:"grid w-full grid-cols-1 gap-6 overflow-y-auto pb-8 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"},me=S({layout:E}),we=Object.assign(me,{__name:"Assets",props:["request","assets","type"],setup(_){var h;const c=_,s=x(((h=c.request)==null?void 0:h.active_tab)??""),f=x(0),m=x(null),d=O({image:"",video:""}),u=L(()=>s.value=="uploads"?c.assets.data.filter(r=>r.type==="uploaded"):s.value=="ai"?c.assets.data.filter(r=>r.type==="generated"):c.assets.data),t=r=>{const a=r.target.files[0],p=a.type;if(p.startsWith("image/"))d.image=a;else if(p.startsWith("video/"))d.video=a;else return;d.post(route("user.assets.store"),{onProgress:z=>{f.value=z.percentage},onFinish:()=>{setTimeout(()=>f.value=0,1e3)}})},y=[{label:"File Size",value:"file_size"},{label:"Media Type",value:"mime_type"}];return(r,a)=>(o(),n(v,null,[l(A(U),{title:r.trans("Assets")},null,8,["title"]),e("main",se,[e("div",te,[e("div",ae,[e("button",{class:k(["btn w-full px-14 py-2 md:w-auto",{"btn-primary":s.value===""}]),onClick:a[0]||(a[0]=p=>s.value="")},le,2),e("button",{class:k(["btn w-full px-14 py-2 md:w-auto",{"btn-primary":s.value==="uploads"}]),onClick:a[1]||(a[1]=p=>s.value="uploads")},ie,2),e("button",{class:k(["btn w-full px-14 py-2 md:w-auto",{"btn-primary":s.value==="ai"}]),onClick:a[2]||(a[2]=p=>s.value="ai")},ce,2)]),e("div",de,[l(j,{options:y,appends:{active_tab:s.value},formOptions:{preserveState:!0}},null,8,["appends"])])]),e("div",ue,[e("div",pe,[s.value==="uploads"?(o(),n(v,{key:0},[e("input",{ref_key:"assetInput",ref:m,onInput:t,accept:"image/*,video/*",type:"file",hidden:""},null,544),l(q,{percentage:f.value,onAction:a[3]||(a[3]=p=>m.value.click()),classes:"h-60",text:"Upload New"},null,8,["percentage"]),l(w,{assets:u.value},null,8,["assets"])],64)):i("",!0),s.value==="ai"?(o(),$(w,{key:1,assets:u.value},null,8,["assets"])):i("",!0),s.value===""?(o(),n(v,{key:2},[l(w,{assets:u.value},null,8,["assets"]),l(I,{class:"col-span-full",links:_.assets.links},null,8,["links"])],64)):i("",!0)])]),u.value.length<1&&s.value!=="uploads"?(o(),$(B,{key:0})):i("",!0)])],64))}});export{we as default};
