const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/CredentialsDialog-DZ0jeWK3.chunk.mjs'),window.OC.filePath('', '', 'dist/translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs'),window.OC.filePath('', '', 'dist/index-C6ey-Mhx.chunk.mjs'),window.OC.filePath('', '', 'dist/index-BRuD4Qrz.chunk.mjs'),window.OC.filePath('', '', 'dist/NcModal-DUWLRm_F-C0gD58QY.chunk.mjs'),window.OC.filePath('', '', 'dist/Web-ByHSuvRG.chunk.mjs'),window.OC.filePath('', '', 'dist/public-C1mLBHT3.chunk.mjs'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-B261d025.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs'),window.OC.filePath('', '', 'dist/common-createElementId-DhjFt1I9-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/common-logger-D3RVzcfQ-BE3lcFW4.chunk.css'),window.OC.filePath('', '', 'dist/common-NcModal-DUWLRm_F-BsKc2RT9.chunk.css'),window.OC.filePath('', '', 'dist/TrashCanOutline-CW4_EEhq.chunk.mjs'),window.OC.filePath('', '', 'dist/common-TrashCanOutline-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/common-index-DYA_tnKg.chunk.css'),window.OC.filePath('', '', 'dist/mdi-Ci0zJ0QG.chunk.mjs'),window.OC.filePath('', '', 'dist/common-mdi-BWNFKLbC.chunk.css'),window.OC.filePath('', '', 'dist/NcPasswordField-Be5_qcfm-DrwSQ-mu.chunk.mjs'),window.OC.filePath('', '', 'dist/index-D-iKxf2E.chunk.mjs'),window.OC.filePath('', '', 'dist/util-djQ-4xJ5.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-B1bGxYHt-DVZQKody.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcInputField-B1bGxYHt-BYHxARP-.chunk.css'),window.OC.filePath('', '', 'dist/common-NcPasswordField-Be5_qcfm-Crp_EMfV.chunk.css'),window.OC.filePath('', '', 'dist/NcTextField.vue_vue_type_script_setup_true_lang-BQHjkK8r-Dv0_ThWG.chunk.mjs')])))=>i.map(i=>d[i]);
import{D as x,b as C,V as E,C as p,a as c}from"./index-Cza7fYcZ.chunk.mjs";import{l as V}from"./public-C1mLBHT3.chunk.mjs";import{t as s}from"./translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs";import{a as M,_ as L}from"./Web-ByHSuvRG.chunk.mjs";import{c as l}from"./index-D-iKxf2E.chunk.mjs";import{d as w,a as h,s as S,e as T}from"./index-DL1yHC1K-orb-zzee.chunk.mjs";import{b as m,f as _,a as u,c as A,h as v}from"./index-C6ey-Mhx.chunk.mjs";import{a as N,P as D}from"./index-BTFugZfg.chunk.mjs";import{s as I}from"./index-BRuD4Qrz.chunk.mjs";import{S as a}from"./types-D2JNyhvY.chunk.mjs";import{i as y,b as H,P as d}from"./externalStorageUtils-CpkXDsx2.chunk.mjs";import"./util-djQ-4xJ5.chunk.mjs";import"./createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs";import"./mdi-Ci0zJ0QG.chunk.mjs";import"./logger-D3RVzcfQ-B261d025.chunk.mjs";import"./NcPasswordField-Be5_qcfm-DrwSQ-mu.chunk.mjs";import"./NcInputField-B1bGxYHt-DVZQKody.chunk.mjs";import"./NcModal-DUWLRm_F-C0gD58QY.chunk.mjs";import"./TrashCanOutline-CW4_EEhq.chunk.mjs";const P='',k='';function b(e){return e.status===void 0||e.status===a.Success?!1:e.userProvided||e.authMechanism==="password::global::user"}N(l);async function O(e,t,n){const r=(await l.request({method:"PUT",url:m("apps/files_external/userglobalstorages/{id}",{id:e.id}),confirmPassword:D.Strict,data:{backendOptions:{user:t,password:n}}})).data;return r.status!==a.Success?(h(s("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:r?.statusMessage||""})),null):(w(s("files_external","New configuration successfully saved")),e.attributes.config=r,_("files:node:updated",e),!0)}const R="credentials-external-storage",U={id:R,displayName:()=>s("files","Enter missing credentials"),iconSvgInline:()=>k,enabled:({nodes:e})=>{if(e.length!==1||!e[0])return!1;const t=e[0];if(!y(t))return!1;const n=t.attributes?.config||{};return!!b(n)},async exec({nodes:e}){const{login:t,password:n}=await I(M(()=>L(()=>import("./CredentialsDialog-DZ0jeWK3.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)))??{};if(t&&n)try{await O(e[0],t,n),w(s("files_external","Credentials successfully set"))}catch(r){h(s("files_external","Error while setting credentials: {error}",{error:r.message}))}return null},order:-1e3,default:x.DEFAULT,inline:()=>!0},$='',o=`/files/${u()?.uid}`;function B(e){const t=(e.path+"/"+e.name).replace(/^\//gm,"");return new H({id:e.id,source:v("dav"+o+"/"+t),root:o,owner:u()?.uid||null,permissions:e.config.status!==a.Success?d.NONE:e?.permissions||d.READ,attributes:{displayName:t,...e}})}async function F(){const e=(await l.get(A("apps/files_external/api/v1/mounts"))).data.ocs.data.map(B);return{folder:new H({id:0,source:v("dav"+o),root:o,owner:u()?.uid||null,permissions:d.READ}),contents:e}}function Z(e,t=!0){const n=t?"userglobalstorages":"userstorages";return l.get(m(`apps/files_external/${n}/${e}?testOnly=false`))}const j={id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:({nodes:e})=>e.every(t=>y(t)===!0),exec:async()=>null,async renderInline({nodes:e}){if(e.length!==1||!e[0])return null;const t=e[0],n=document.createElement("span");n.className="files-list__row-status",n.innerHTML=s("files_external","Checking storage …");let r;try{const{data:i}=await Z(t.id,t.attributes.scope==="system");if(r=i,t.attributes.config=r,_("files:node:updated",t),r.status!==a.Success)throw new Error(r?.statusMessage||s("files_external","There was an error with this external storage."));n.remove()}catch(i){i.response&&!r&&S(s("files_external","We were unable to check the external storage {basename}",{basename:t.basename})),n.innerHTML="";const f=r?b(r):!1,g=document.createElement("span");g.classList.add(`files-list__row-status--${f?"warning":"error"}`),f||(n.innerHTML=$,n.title=i.message),n.prepend(g)}return n},order:10},q={id:"open-in-files-external-storage",displayName:({nodes:e})=>(e?.[0]?.attributes?.config||{status:a.Indeterminate}).status!==a.Success?s("files_external","Examine this faulty external storage configuration"):s("files","Open in Files"),iconSvgInline:()=>"",enabled:({view:e})=>e.id==="extstoragemounts",async exec({nodes:e}){if(e[0]?.attributes?.config?.status!==a.Success){if(await T({name:s("files_external","External mount error"),text:s("files_external","There was an error with this external storage. Do you want to review this mount point config in the settings page?"),labelConfirm:s("files_external","Open settings"),labelReject:s("files_external","Ignore")})===!0){const t=u()?.isAdmin?"admin":"user";window.location.href=m(`/settings/${t}/externalstorages`)}return null}return window.OCP.Files.Router.goToRoute(null,{view:"files"},{dir:e[0].path}),null},order:-1e3,default:x.HIDDEN},W=V("files_external","allowUserMounting",!1),Y=C();Y.register(new E({id:"extstoragemounts",name:s("files_external","External storage"),caption:s("files_external","List of external storage."),emptyCaption:W?s("files_external","There is no external storage configured. You can configure them in your Personal settings."):s("files_external","There is no external storage configured and you don't have the permission to configure them."),emptyTitle:s("files_external","No external storage"),icon:P,order:30,columns:[new p({id:"storage-type",title:s("files_external","Storage type"),render(e){const t=e.attributes?.backend||s("files_external","Unknown"),n=document.createElement("span");return n.textContent=t,n}}),new p({id:"scope",title:s("files_external","Scope"),render(e){const t=document.createElement("span");let n=s("files_external","Personal");return e.attributes?.scope==="system"&&(n=s("files_external","System")),t.textContent=n,t}})],getContents:F})),c(U),c(j),c(q);
//# sourceMappingURL=files_external-init.mjs.map