import{cZ as g,v as k,cE as m,l as h,az as t,X as a,y as o,a3 as n,bH as b,bS as i,a2 as p,F as f,Y as d,b2 as u,bM as x,W as A}from"./index.69621fe4.js";const O={key:0},B={key:0},T=["href"],j=["src","type"],C=["src","type"],z={key:3,style:{height:"150px",width:"150px"},class:"displayAnexo row justify-center items-center text-center"},D=d("br",null,null,-1),H={class:"full-width row justify-center"},N=["href","download"],P={key:1,style:{height:"150px",width:"150px"},class:"displayAnexo row justify-center items-center text-center"},S={key:1,style:{height:"150px",width:"150px"},class:"displayAnexo row justify-center items-center text-center"},V={class:"filename-text"},L={__name:"DisplayAnexos",props:{anexo:Object,downloadPermit:Boolean,imgPreviewOpen:Boolean,dataHora:String},setup(y){const s=y,{getAttatch:_}=g(),e=k(s,"anexo"),w=m(s.dataHora),v=m().subtract(7,"days"),l=h(!1),c=h(!1);e.value.filename=e.value.caminho?e.value.caminho.split("/").pop():"Sem nome";async function r(){c.value=!0,e.value.caminho=await _(s.anexo),l.value=!1,c.value=!1}return e.value.caminho&&e.value.caminho.indexOf("blob")===-1&&(v.isBefore(w)?r():l.value=!0),(Q,E)=>l.value?(t(),a("div",S,[n(x,{size:"xl",flat:"",onClick:r,loading:c.value,color:"primary"},{default:u(()=>[n(i,{name:"download"}),d("span",V,f(o(e).filename),1)]),_:1},8,["loading"])])):(t(),a("span",O,[o(e).caminho?(t(),a("span",B,[o(e).mimeType.indexOf("image")!==-1?(t(),a("a",{key:0,href:s.imgPreviewOpen?o(e).caminho:null,target:"_blank"},[n(b,{src:o(e).caminho,"spinner-color":"white",style:{height:"400px",width:"400px"}},null,8,["src"])],8,T)):o(e).mimeType.indexOf("audio")!==-1?(t(),a("audio",{key:1,preload:"none",controls:"",controlsList:"nodownload",style:{height:"50px"},src:o(e).caminho,type:o(e).mimeType},null,8,j)):o(e).mimeType.indexOf("video")!==-1?(t(),a("video",{key:2,height:"300",controls:"",controlsList:"nodownload",src:o(e).caminho,type:o(e).mimeType},null,8,C)):(t(),a("div",z,[n(i,{size:"xl",name:"description"}),p(" "+f(o(e).filename),1)])),D,d("span",H,[s.downloadPermit===!0?(t(),a("a",{key:0,href:o(e).caminho,style:{"text-decoration":"none"},download:o(e).filename},[n(x,{flat:"",label:"Download"},{default:u(()=>[n(i,{name:"download",class:"q-pl-xs"})]),_:1})],8,N)):A("",!0)])])):(t(),a("div",P,[n(i,{size:"xl",name:"file_download_off"}),p(" Anexo n\xE3o encontrado. ")]))]))}};export{L as _};
