const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/RichWorkspace-Cl-fK0Y8.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-Bdu4Z_fo.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-CbNPNm8f.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-hi3Hwbeu.chunk.mjs'),window.OC.filePath('text', '', 'js/index-xQwnxqUU.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DxwFe63_.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-KhuNWNbx.chunk.css'),window.OC.filePath('text', '', 'js/index-D3wiQe9-.chunk.mjs'),window.OC.filePath('text', '', 'js/Wrapper-obocs1sV.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-DrmDPXkr.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DtbbSwig.chunk.mjs'),window.OC.filePath('text', '', 'js/preload-helper-BorfeO-5.chunk.mjs'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-D4IV4zWy-Bb19W4wJ.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-D4IV4zWy-CFjpafPM.chunk.css'),window.OC.filePath('text', '', 'js/NcNoteCard-CwNXZ4vV-CPnkYq5v.chunk.mjs'),window.OC.filePath('text', '', 'css/NcNoteCard-CwNXZ4vV-Cyx11ynf.chunk.css'),window.OC.filePath('text', '', 'js/MediaHandler.provider-BUbYNN83.chunk.mjs'),window.OC.filePath('text', '', 'css/Wrapper-CNQWYaBa.chunk.css'),window.OC.filePath('text', '', 'js/Editor-Cr_YdjKk.chunk.mjs'),window.OC.filePath('text', '', 'js/dav-BTwUt5Rb.chunk.mjs'),window.OC.filePath('text', '', 'js/MenuBar-BBhgnV0-.chunk.mjs'),window.OC.filePath('text', '', 'css/MenuBar-B9oARRUR.chunk.css'),window.OC.filePath('text', '', 'css/Editor-CNbK6O9y.chunk.css'),window.OC.filePath('text', '', 'js/RichTextReader-BxcwtBrb.chunk.mjs'),window.OC.filePath('text', '', 'js/BaseReader-DF7IocT4.chunk.mjs'),window.OC.filePath('text', '', 'css/BaseReader-DVgiDsJn.chunk.css'),window.OC.filePath('text', '', 'css/RichTextReader-Dh2MlJRZ.chunk.css'),window.OC.filePath('text', '', 'css/RichWorkspace-CoB00d8c.chunk.css')])))=>i.map(i=>d[i]);
import{s as i,l as y,F as b,P as p,r as f}from"./dav-BTwUt5Rb.chunk.mjs";import{t as a,c as x}from"./NcLoadingIcon-Bdu4Z_fo.chunk.mjs";import{l as m}from"./index-D3wiQe9-.chunk.mjs";import{_ as I}from"./preload-helper-BorfeO-5.chunk.mjs";import{g as u,e as h}from"./index-xQwnxqUU.chunk.mjs";import{V as k}from"./vue.runtime.esm-CbNPNm8f.chunk.mjs";import{s as H,a as _}from"./NcNoteCard-CwNXZ4vV-CPnkYq5v.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./index-DtbbSwig.chunk.mjs";import"./emoji-picker-hi3Hwbeu.chunk.mjs";var R=class extends EventTarget{dispatchTypedEvent(t,e){return super.dispatchEvent(e)}};class F extends R{}function N(){return i.registry??=new F,i.registry}function V(t){if(C(t),i.fileListHeaders??=new Map,i.fileListHeaders.has(t.id)){y.error(`Header ${t.id} already registered`,{header:t});return}i.fileListHeaders.set(t.id,t),N().dispatchTypedEvent("register:listHeader",new CustomEvent("register:listHeader",{detail:t}))}function C(t){if(!t.id||!t.render||!t.updated)throw new Error("Invalid header: id, render and updated are required");if(typeof t.id!="string")throw new Error("Invalid id property");if(t.enabled!==void 0&&typeof t.enabled!="function")throw new Error("Invalid enabled property");if(t.render&&typeof t.render!="function")throw new Error("Invalid render property");if(t.updated&&typeof t.updated!="function")throw new Error("Invalid updated property")}const g=Object.freeze({UploadFromDevice:0,CreateNew:1,Other:2});class D{_entries=[];registerEntry(e){this.validateEntry(e),e.category=e.category??g.CreateNew,this._entries.push(e)}unregisterEntry(e){const r=typeof e=="string"?this.getEntryIndex(e):this.getEntryIndex(e.id);if(r===-1){y.warn("Entry not found, nothing removed",{entry:e,entries:this.getEntries()});return}this._entries.splice(r,1)}getEntries(e){return e?this._entries.filter(r=>typeof r.enabled=="function"?r.enabled(e):!0):this._entries}getEntryIndex(e){return this._entries.findIndex(r=>r.id===e)}validateEntry(e){if(!e.id||!e.displayName||!e.iconSvgInline||!e.handler)throw new Error("Invalid entry");if(typeof e.id!="string"||typeof e.displayName!="string")throw new Error("Invalid id or displayName property");if(e.iconSvgInline&&typeof e.iconSvgInline!="string")throw new Error("Invalid icon provided");if(e.enabled!==void 0&&typeof e.enabled!="function")throw new Error("Invalid enabled property");if(typeof e.handler!="function")throw new Error("Invalid handler property");if("order"in e&&typeof e.order!="number")throw new Error("Invalid order property");if(this.getEntryIndex(e.id)!==-1)throw new Error("Duplicate entry")}}function T(){return i.newFileMenu??=new D,i.newFileMenu}function A(t){return T().registerEntry(t)}const L='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-text" viewBox="0 0 24 24"><path d="M21,6V8H3V6H21M3,18H12V16H3V18M3,13H21V11H3V13Z" /></svg>',M=()=>{const t=a("text","Readme")+"."+m("text","default_file_extension");A({id:"rich-workspace-init",displayName:a("text","Add folder description"),category:g.Other,enabled(e){return!window?.OCA?.Text?.RichWorkspaceEnabled||Number(e.attributes["rich-workspace-file-flat"])?!1:(e.permissions&p.READ)!==0&&(e.permissions&p.CREATE)!==0},iconSvgInline:L,async handler(e,r){if(r.map(E=>E.basename).includes(t)){H(a("text",'"{name}" already exist!',{name:t}));return}const s=e.encodedSource+"/"+encodeURIComponent(t),d=await x({method:"PUT",url:s,headers:{Overwrite:"F"}}),l=parseInt(d.headers["oc-fileid"]),v=new b({source:e.source+"/"+t,id:l,mtime:new Date,mime:"text/markdown",owner:u()?.uid||null,permissions:p.ALL,root:e?.root||"/files/"+u()?.uid});_(a("text",'Created "{name}"',{name:t})),e.attributes["rich-workspace-file-flat"]=l,e.attributes["rich-workspace-flat"]="",h("files:node:created",v),h("files:node:updated",e)}})};let c,n,o;const w=(t,e)=>["files","favorites","public-share","personal"].includes(e.id),O={id:"workspace",order:10,enabled:w,render:async(t,e)=>{o=e,c||(c=(await I(()=>import("./RichWorkspace-Cl-fK0Y8.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,24,25,26,27]),import.meta.url)).default),n&&(n.$destroy(),console.debug("Destroying existing FilesHeaderRichWorkspaceInstance"));const r=!!o.attributes["rich-workspace-file-flat"],s=o.attributes["rich-workspace-flat"]||"",d=o.path||"";n=new k({extends:c,propsData:{content:s,hasRichWorkspace:r,path:d}}).$mount(t),window.FilesHeaderRichWorkspaceInstance=n},updated(t,e){if(o=t,!n){console.error("No vue instance found for FilesWorkspaceHeader");return}const r=!!t.attributes["rich-workspace-file-flat"]&&w(t,e);n.hasRichWorkspace=r,n.content=t.attributes["rich-workspace-flat"]||"",n.path=t.path||""}},W=m("text","workspace_available");f("nc:rich-workspace-flat",{nc:"http://nextcloud.org/ns"}),f("nc:rich-workspace-file-flat",{nc:"http://nextcloud.org/ns"}),W&&(M(),V(O));
//# sourceMappingURL=text-init.mjs.map
