import{_ as b}from"./DocsButton.vue_vue_type_script_setup_true_lang.bb86d69b.js";import{C as g}from"./ContentLayout.31b35780.js";import{f as C,F as v,s as $}from"./FilesNavigator.4ee3727e.js";import{a as F}from"./asyncComputed.cb5b1d6d.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.a95f3dfe.js";import{C as r}from"./gateway.f96afce5.js";import"./tables.941abe23.js";import"./BookOutlined.7316cf92.js";import"./popupNotifcation.98fdb9df.js";import"./ant-design.3e9e4740.js";import"./string.9fd91434.js";import"./PhFolder.vue.b2502f43.js";import"./record.1896cfd9.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]="762e4fcc-cc28-4def-b33c-6ca66c234e12",o._sentryDebugIdIdentifier="sentry-dbid-762e4fcc-cc28-4def-b33c-6ca66c234e12")}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 a={"Content-Type":"multipart/form-data"},i=new File([new Blob(s?[s]:[])],C(e));return r.post(`projects/${this.projectId}/files/upload?path=${encodeURIComponent(e)}`,i,a)}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,a=u.fromProjectId(s),{loading:i,result:f,refetch:m}=F(()=>a.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,n){const j=t.join("/");await a.upload(j,n),await m()}function I(t){const n=t.join("/");return a.download(n)}function w(t){const n=t.join("/");return a.delete(n)}return(t,n)=>(P(),x(g,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(b,{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.b4cff446.js.map
