const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/PublicFilesEditor-Cf2M4lCo.chunk.mjs'),window.OC.filePath('text', '', 'js/index-6AQ8QgJK.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-DwlFXcXb.chunk.mjs'),window.OC.filePath('text', '', 'js/NcNoteCard-ChweF_5Q-5iiVgoP-.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-C9BcAUzb.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-DmVcM0-B.chunk.mjs'),window.OC.filePath('text', '', 'js/index-CCUE3e_p.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-CFe6qyTF.chunk.css'),window.OC.filePath('text', '', 'css/NcNoteCard-ChweF_5Q-BAYWJnqj.chunk.css'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-wd1ZAbRr.chunk.mjs'),window.OC.filePath('text', '', 'js/RichWorkspace-BWnVIhxB.chunk.mjs'),window.OC.filePath('text', '', 'js/index-Dl858C8_.chunk.mjs'),window.OC.filePath('text', '', 'js/Editor.singleton-BsNBhsn_.chunk.mjs'),window.OC.filePath('text', '', 'js/RichTextReader-C_O2mTsO.chunk.mjs'),window.OC.filePath('text', '', 'js/EditorOutline-DL171nAA.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-DVPLBGl3.chunk.mjs'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-ip_mRd2T-Df5K32Av.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-ip_mRd2T-Bebqso8K.chunk.css'),window.OC.filePath('text', '', 'js/MediaHandler.provider-HrSuJegm.chunk.mjs'),window.OC.filePath('text', '', 'css/EditorOutline-D42M_a6q.chunk.css'),window.OC.filePath('text', '', 'js/BaseReader-DGFMG8ex.chunk.mjs'),window.OC.filePath('text', '', 'css/BaseReader-DLKIg9lj.chunk.css'),window.OC.filePath('text', '', 'css/RichTextReader-CVEE-TJE.chunk.css'),window.OC.filePath('text', '', 'css/RichWorkspace-DF75DIQU.chunk.css')])))=>i.map(i=>d[i]);
import{_ as u,a as f,e as h}from"./index-6AQ8QgJK.chunk.mjs";import{t as l,c as v}from"./NcLoadingIcon-DmVcM0-B.chunk.mjs";import{g as F,s as R,a as g}from"./NcNoteCard-ChweF_5Q-5iiVgoP-.chunk.mjs";import{V as A}from"./vue.runtime.esm-C9BcAUzb.chunk.mjs";import{H as y,a as O,N as D}from"./index-Be8Hx1Gh.chunk.mjs";import{l as H}from"./index-Dl858C8_.chunk.mjs";import{h as C}from"./index-CCUE3e_p.chunk.mjs";import{b as m}from"./mime-DDg3sTIz.chunk.mjs";import{F as T,P as w}from"./dav-CQDyL7M_-Dl4xEXlI.chunk.mjs";import"./emoji-picker-DwlFXcXb.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>',_="Edit with text app",B=()=>{const e=F(),t=document.querySelector("#preview table.files-filestable");if(!e||!t){const i=document.createElement("div");i.id="text-viewer-fallback",document.body.appendChild(i);const s=r=>OCA.Files.fileActions.register(r,_,OC.PERMISSION_UPDATE|OC.PERMISSION_READ,C("core","actions/rename"),n=>{const c=window.FileList.findFile(n);Promise.all([u(()=>import("./vue.runtime.esm-C9BcAUzb.chunk.mjs").then(a=>a.z),[],import.meta.url),u(()=>import("./PublicFilesEditor-Cf2M4lCo.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)]).then(a=>{const b=window.FileList.getCurrentDirectory()+"/"+n,x=a[0].default,E=a[1].default;new x({render:I=>I(E,{props:{fileId:c?c.id:null,active:!0,shareToken:e,relativePath:b,mimeType:c.mimetype},on:{close:()=>{(void 0).$destroy()}}})}).$mount(i)})},l("text","Edit"));for(let r=0;r<m.length;r++)s(m[r]),OCA.Files.fileActions.setDefault(m[r],_)}},Z=()=>{const e=l("text","Readme")+"."+H("text","default_file_extension");O({id:"rich-workspace-init",displayName:l("text","Add folder description"),category:D.Other,enabled(t){return Number(t.attributes["rich-workspace-file"])?!1:(t.permissions&w.CREATE)!==0},iconSvgInline:V,async handler(t,i){if(i.map(a=>a.basename).includes(e)){R(l("text",'"{name}" already exist!',{name:e}));return}const s=t.encodedSource+"/"+encodeURIComponent(e),r=await v({method:"PUT",url:s,headers:{Overwrite:"F"}}),n=parseInt(r.headers["oc-fileid"]),c=new T({source:t.source+"/"+e,id:n,mtime:new Date,mime:"text/markdown",owner:f()?.uid||null,permissions:w.ALL,root:t?.root||"/files/"+f()?.uid});g(l("text",'Created "{name}"',{name:e})),t.attributes["rich-workspace-file"]=n,t.attributes["rich-workspace"]="",h("files:node:created",c),h("files:node:updated",t)}})};let p,o,d;const k=(e,t)=>["files","favorites","public-share"].includes(t.id),j=new y({id:"workspace",order:10,enabled:k,render:async(e,t)=>{d=t,p||(p=(await u(()=>import("./RichWorkspace-BWnVIhxB.chunk.mjs"),__vite__mapDeps([10,5,2,4,1,6,7,11,3,8,12,13,14,15,16,17,9,18,19,20,21,22,23]),import.meta.url)).default),o&&(o.$destroy(),console.debug("Destroying existing FilesHeaderRichWorkspaceInstance"));const i=!!d.attributes["rich-workspace-file"],s=d.attributes["rich-workspace"]||"",r=d.path||"";o=new A({extends:p,propsData:{content:s,hasRichWorkspace:i,path:r}}).$mount(e),window.FilesHeaderRichWorkspaceInstance=o},updated(e,t){if(d=e,!o){console.error("No vue instance found for FilesWorkspaceHeader");return}const i=!!e.attributes["rich-workspace-file"]&&k(e,t);o.hasRichWorkspace=i,o.content=e.attributes["rich-workspace"]||"",o.path=e.path||""}});export{_ as FILE_ACTION_IDENTIFIER,j as FilesWorkspaceHeader,Z as addMenuRichWorkspace,B as registerFileActionFallback};
//# sourceMappingURL=files-B0b_Rkwl.chunk.mjs.map
