import{I as c}from"./iconify-56cbf3ff.js";import{d as b,c as _,e as v,h as l,w as t,j as o,n as r,J as a,a6 as s,s as f,g as d,q as u,k as p,M as h}from"./index-a0da86f0.js";import{_ as C}from"./_plugin-vue_export-helper-c27b6911.js";const F={class:"file-toolbar"},I=b({__name:"file_toolbar",props:{context:{}},setup(m){const n=m,w=_(()=>{const e=n.context.record;return e.is_folder||!e.file_size||e.file_size<=0?!1:/\.(gif|jpg|jpeg|tiff|png)$/i.test(e.file_url)}),g=_(()=>{const e=n.context.record;return e.file_name&&e.file_name.split(".").pop()==="zip"}),x=()=>{const e=n.context.record;e.file_url&&(e.file_url.startsWith("http")?window.open(e.file_url):window.open(window.location.origin+e.file_url))},k=()=>{const e=n.context.record;if(!e.file_url)return;let i=e.file_url;e.file_name&&(i=i.replace(/#/g,"%23")),window.open(i)},y=()=>{console.log("Optimize file:",n.context.record.name)},z=()=>{console.log("Unzip file:",n.context.record.name)};return(e,i)=>(r(),v("div",F,[l(o(h),null,{default:t(()=>[e.context.record.file_url?(r(),a(o(u),{key:0,type:"default",onClick:x},{icon:t(()=>[l(o(s),null,{default:t(()=>[l(o(c),{icon:"tabler:eye"})]),_:1})]),default:t(()=>[f(" "+d(e.context.t("View File")),1)]),_:1})):p("",!0),e.context.record.file_url&&!e.context.record.is_folder?(r(),a(o(u),{key:1,type:"default",onClick:k},{icon:t(()=>[l(o(s),null,{default:t(()=>[l(o(c),{icon:"tabler:download"})]),_:1})]),default:t(()=>[f(" "+d(e.context.t("Download")),1)]),_:1})):p("",!0),w.value?(r(),a(o(u),{key:2,type:"default",onClick:y},{icon:t(()=>[l(o(s),null,{default:t(()=>[l(o(c),{icon:"tabler:compress"})]),_:1})]),default:t(()=>[f(" "+d(e.context.t("Optimize")),1)]),_:1})):p("",!0),g.value?(r(),a(o(u),{key:3,type:"default",onClick:z},{icon:t(()=>[l(o(s),null,{default:t(()=>[l(o(c),{icon:"tabler:archive"})]),_:1})]),default:t(()=>[f(" "+d(e.context.t("Unzip")),1)]),_:1})):p("",!0)]),_:1})]))}});const j=C(I,[["__scopeId","data-v-047e2ff3"]]);export{j as default};
