const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/PublicFilesEditor-h0dDbaG7.chunk.mjs'),window.OC.filePath('text', '', 'js/modulepreload-polyfill-BbX-W30F.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-DlAAdvrL.chunk.mjs'),window.OC.filePath('text', '', 'js/public-BQSk-kMe.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-DNqaLvLX.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-Bs0OvbBQ.chunk.css'),window.OC.filePath('text', '', 'js/vue.runtime.esm-CF8vEa-4.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DfiDB3im.chunk.mjs'),window.OC.filePath('text', '', 'css/public-DvAuxGX_.chunk.css'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-wd1ZAbRr.chunk.mjs'),window.OC.filePath('text', '', 'js/RichWorkspace-CpodeN4C.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DyuGUWxl.chunk.mjs'),window.OC.filePath('text', '', 'js/Editor.singleton-deI7v-iV.chunk.mjs'),window.OC.filePath('text', '', 'js/RichTextReader-aVTjXhiQ.chunk.mjs'),window.OC.filePath('text', '', 'js/BaseReader-CGNR7F-l.chunk.mjs'),window.OC.filePath('text', '', 'js/RichText-r6JcIr8s.chunk.mjs'),window.OC.filePath('text', '', 'js/index-D85sbSYG.chunk.mjs'),window.OC.filePath('text', '', 'js/MediaHandler.provider-iCiOLi3t.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-DvmA7f2u.chunk.mjs'),window.OC.filePath('text', '', 'js/index-mgFfDjoT.chunk.mjs'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-VeztTzpz-Di1Oh6HC.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-VeztTzpz-CdJ-sA3l.chunk.css'),window.OC.filePath('text', '', 'css/RichText-Bva5Bgj1.chunk.css'),window.OC.filePath('text', '', 'css/BaseReader-CsLFhfbT.chunk.css'),window.OC.filePath('text', '', 'css/RichTextReader-CC5npbIA.chunk.css'),window.OC.filePath('text', '', 'css/RichWorkspace-CuRYsAfp.chunk.css')])))=>i.map(i=>d[i]);
import{_ as f,g as h,e as O}from"./modulepreload-polyfill-BbX-W30F.chunk.mjs";import{s as E,a as F,p as g}from"./public-BQSk-kMe.chunk.mjs";import{H as v,b as I,N as b,P as _,F as k}from"./index-usWvSWAY.chunk.mjs";import{l as A}from"./index-DfiDB3im.chunk.mjs";import{h as R,c as N}from"./index-DyuGUWxl.chunk.mjs";import{g as P}from"./token-DsHNcSTq.chunk.mjs";import{o as u}from"./mime-D0Qvdd6a.chunk.mjs";import{s as T}from"./index-D85sbSYG.chunk.mjs";import"./emoji-picker-DlAAdvrL.chunk.mjs";import"./NcLoadingIcon-DNqaLvLX.chunk.mjs";import"./vue.runtime.esm-CF8vEa-4.chunk.mjs";import"./index-mgFfDjoT.chunk.mjs";const V='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-text" viewBox="0 0 24 24"><path d="M21,6V8H3V6H21M3,18H12V16H3V18M3,13H21V11H3V13Z" /></svg>',w="Edit with text app",z=()=>{const i={attach(e){const o=e.fileList;o.id!=="files"&&o.id!=="files.public"||e.addMenuEntry({id:"file",displayName:t("text","New text file"),templateName:t("text","New text file")+"."+A("text","default_file_extension"),iconClass:"icon-filetype-text",fileType:"file",actionLabel:t("text","Create new text file"),actionHandler(a){o.createFile(a).then(function(n,l){const s=new OCA.Files.FileInfoModel(l);typeof OCA.Viewer<"u"?OCA.Files.fileActions.triggerAction("view",s,o):typeof OCA.Viewer>"u"&&OCA.Files.fileActions.triggerAction(w,s,o)})}})}};OC.Plugins.register("OCA.Files.NewFileMenu",i)},G=()=>{const i=P(),e=document.querySelector("#preview table.files-filestable");if(!i||!e){const o=document.createElement("div");o.id="text-viewer-fallback",document.body.appendChild(o);const a=n=>OCA.Files.fileActions.register(n,w,OC.PERMISSION_UPDATE|OC.PERMISSION_READ,R("core","actions/rename"),l=>{const s=window.FileList.findFile(l);Promise.all([f(()=>import("./vue.runtime.esm-CF8vEa-4.chunk.mjs").then(r=>r.v),[],import.meta.url),f(()=>import("./PublicFilesEditor-h0dDbaG7.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)]).then(r=>{const c=window.FileList.getCurrentDirectory()+"/"+l,m=r[0].default;m.prototype.t=window.t,m.prototype.n=window.n,m.prototype.OCA=window.OCA;const x=r[1].default;new m({render:function(y){const C=this;return y(x,{props:{fileId:s?s.id:null,active:!0,shareToken:i,relativePath:c,mimeType:s.mimetype},on:{close:function(){C.$destroy()}}})}}).$mount(o)})},t("text","Edit"));for(let n=0;n<u.length;n++)a(u[n]),OCA.Files.fileActions.setDefault(u[n],w)}};let p=!1;const J=()=>{const i=t("text","Readme")+"."+A("text","default_file_extension");I({id:"rich-workspace-init",displayName:t("text","Add folder description"),category:b.Other,enabled(e){return Number(e.attributes["rich-workspace-file"])?!1:(e.permissions&_.CREATE)!==0},iconSvgInline:V,async handler(e,o){const a=o.map(c=>c.basename);if(a.includes(i)){E(t("text",'"{name}" already exist!',{name:i}));return}const n=e.encodedSource+"/"+encodeURIComponent(i),l=await N({method:"PUT",url:n,headers:{Overwrite:"F"}}),s=parseInt(l.headers["oc-fileid"]),r=new k({source:e.source+"/"+i,id:s,mtime:new Date,mime:"text/markdown",owner:h()?.uid||null,permissions:_.ALL,root:e?.root||"/files/"+h()?.uid});F(t("text",'Created "{name}"',{name:i})),a.length===0&&(p=r),O("files:node:created",r)}})};let d=null;const K=new v({id:"workspace",order:10,enabled(i,e){return e.id==="files"||e.id==="favorites"},async render(i,e,o){d&&(d.$destroy(),d=null);const a=!!e.attributes["rich-workspace-file"]||!!p,n=p?g.dirname(p.path):e.path,l=p?"":e.attributes["rich-workspace"];p=!1;const{default:s}=await f(async()=>{const{default:r}=await import("./RichWorkspace-CpodeN4C.chunk.mjs");return{default:r}},__vite__mapDeps([10,11,6,1,2,12,13,14,15,3,4,5,7,8,16,17,18,19,9,20,21,22,23,24,25]),import.meta.url);f(()=>import("./vue.runtime.esm-CF8vEa-4.chunk.mjs").then(r=>r.v),[],import.meta.url).then(r=>{i.id="files-workspace-wrapper";const c=r.default;c.prototype.t=window.t,c.prototype.n=window.n,c.prototype.OCA=window.OCA;const m=c.extend(s);d=new m({propsData:{path:n,hasRichWorkspace:a,content:l},store:T}).$mount(i)})},updated(i,e){if(p=!1,!d){console.warn("No vue instance found for FilesWorkspaceHeader");return}const o=!!i.attributes["rich-workspace-file"];d.path=i.path,d.hasRichWorkspace=o,d.content=i.attributes["rich-workspace"]}});export{w as FILE_ACTION_IDENTIFIER,K as FilesWorkspaceHeader,J as addMenuRichWorkspace,G as registerFileActionFallback,z as registerFileCreate};
//# sourceMappingURL=files-h8XLPAP5.chunk.mjs.map
