import{_ as g}from"./DocsButton.vue_vue_type_script_setup_true_lang.30c09690.js";import{C}from"./ContentLayout.b536adcf.js";import{f as b,F as v,s as $}from"./FilesNavigator.4fa596a1.js";import{a as F}from"./asyncComputed.5f4a7018.js";import{d as D,ef as R,f as N,o as P,c as x,w as l,a as _,b as d,aG as p,u as c,dd as B,$ as U,db as S,eF as k,eG as A,a0 as G}from"./index.a1506152.js";import{C as r}from"./gateway.36e126ca.js";import"./tables.ca746641.js";import"./BookOutlined.989c2e9e.js";import"./popupNotifcation.7c2101f3.js";import"./ant-design.2f4e4d05.js";import"./string.a9f2e2e2.js";import"./PhFolder.vue.e18e9642.js";import"./record.d6bf7292.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[e]="ef087f9e-5cc6-4c10-9932-d1c711383dc2",o._sentryDebugIdIdentifier="sentry-dbid-ef087f9e-5cc6-4c10-9932-d1c711383dc2")}catch{}})();class u{constructor(e){this.projectId=e}static fromProjectId(e){return new u(e)}async list(){return r.get(`projects/${this.projectId}/files`)}async upload(e,s){const n={"Content-Type":"multipart/form-data"},i=new File([new Blob(s?[s]:[])],b(e));return r.post(`projects/${this.projectId}/files/upload?path=${encodeURIComponent(e)}`,i,n)}async download(e){return r.getBlob(`projects/${this.projectId}/files/download?path=${encodeURIComponent(e)}`)}async delete(e){return r.delete(`projects/${this.projectId}/files?path=${encodeURIComponent(e)}`)}async move(e,s){return r.patch(`projects/${this.projectId}/files?path=${encodeURIComponent(e)}&newPath=${encodeURIComponent(s)}`,{})}}const T=o=>(k("data-v-59df18c9"),o=o(),A(),o),V={class:"files-layout"},z=T(()=>_("br",null,null,-1)),H=D({__name:"Files",setup(o){const s=R().params.projectId,n=u.fromProjectId(s),{loading:i,result:f,refetch:m}=F(()=>n.list()),h=N(()=>f.value?f.value.map(t=>({pathParts:t.path.split("/"),size:t.type==="file"?$(t.size):0,lastModified:t.date,type:t.type})):[]);async function y(t,a){const j=t.join("/");await n.upload(j,a),await m()}function I(t){const a=t.join("/");return n.download(a)}function w(t){const a=t.join("/");return n.delete(a)}return(t,a)=>(P(),x(C,null,{default:l(()=>[_("div",V,[d(c(B),null,{default:l(()=>[p("Files")]),_:1}),d(c(S),null,{default:l(()=>[p(" Here you can upload, download and delete files in your persistent dir."),z,p(" Files can be used in your scripts. "),d(g,{path:"cloud/files"}),U(t.$slots,"description",{},void 0,!0)]),_:3}),d(v,{files:h.value,loading:c(i),separator:"/",onCreate:y,onDownload:I,onDelete:w,onRefetch:c(m)},null,8,["files","loading","onRefetch"])])]),_:3}))}});const te=G(H,[["__scopeId","data-v-59df18c9"]]);export{te as default};
//# sourceMappingURL=Files.cea1ee93.js.map
