/*! For license information please see src_helpers_files_js.js.LICENSE.txt */
"use strict";(self.webpackChunk_nextcloud_text=self.webpackChunk_nextcloud_text||[]).push([["src_helpers_files_js"],{79180:(e,n,o)=>{o.d(n,{registerFileActionFallback:()=>p});o(61338);var s=o(21616),i=o(63814),a=o(7694),d=o(98407),c=o(72150),r=(o(21777),o(85168),o(70715),o(41421));o(2365);const l="Edit with text app",p=()=>{const e=(0,a.G)(),n=document.querySelector("#preview table.files-filestable");if(!e||!n){const n=document.createElement("div");n.id="text-viewer-fallback",document.body.appendChild(n);const s=s=>OCA.Files.fileActions.register(s,l,OC.PERMISSION_UPDATE|OC.PERMISSION_READ,(0,i.d0)("core","actions/rename"),(t=>{const s=window.FileList.findFile(t);Promise.all([Promise.resolve().then(o.bind(o,85471)),Promise.all([o.e("vendors-node_modules_nextcloud_vue_dist_index_mjs"),o.e("files-modal")]).then(o.bind(o,59330))]).then((o=>{const i=window.FileList.getCurrentDirectory()+"/"+t,a=o[0].default;a.prototype.t=window.t,a.prototype.n=window.n,a.prototype.OCA=window.OCA;const d=o[1].default;new a({render:function(t){const n=this;return t(d,{props:{fileId:s?s.id:null,active:!0,shareToken:e,relativePath:i,mimeType:s.mimetype},on:{close:function(){n.$destroy()}}})}}).$mount(n)}))}),t("text","Edit"));for(let e=0;e<d.Yq.length;e++)s(d.Yq[e]),OCA.Files.fileActions.setDefault(d.Yq[e],l)}};let u=!1;let m=null;new s.Y9({id:"workspace",order:10,enabled:(e,t)=>"files"===t.id||"favorites"===t.id,async render(e,t,n){m&&(m.$destroy(),m=null);const s=!!t.attributes["rich-workspace-file"]||!!u,i=u?(0,r.dirname)(u.path):t.path,a=u?"":t.attributes["rich-workspace"];u=!1;const{default:d}=await Promise.all([o.e("mermaid"),o.e("vendors-node_modules_nextcloud_vue_dist_index_mjs"),o.e("vendors-node_modules_braintree_sanitize-url_dist_index_js-node_modules_quartzy_markdown-it-me-60d959"),o.e("vendors-node_modules_nextcloud_logger_dist_index_js"),o.e("src_extensions_index_js-src_components_Editor_EditorOutline_vue-data_image_svg_xml_3c_21--_20-ee52b2"),o.e("src_views_RichWorkspace_vue-node_modules_nextcloud_vue_dist_chunks_emoji-BY_D0V5K_mjs-node_mo-c8f763")]).then(o.bind(o,64677));Promise.resolve().then(o.bind(o,85471)).then((t=>{e.id="files-workspace-wrapper";const n=t.default;n.prototype.t=window.t,n.prototype.n=window.n,n.prototype.OCA=window.OCA;const o=n.extend(d);m=new o({propsData:{path:i,hasRichWorkspace:s,content:a},store:c.default}).$mount(e)}))},updated(e,t){if(u=!1,!m)return void console.warn("No vue instance found for FilesWorkspaceHeader");const n=!!e.attributes["rich-workspace-file"];m.path=e.path,m.hasRichWorkspace=n,m.content=e.attributes["rich-workspace"]}})},98407:(e,t,n)=>{n.d(t,{Yq:()=>s});const o=["text/plain","application/cmd","application/x-empty","application/x-msdos-program","application/javascript","application/json","application/x-perl","application/x-php","application/x-tex","application/xml","application/yaml","text/asciidoc","text/css","text/html","text/org","text/x-c","text/x-c++src","text/x-h","text/x-java-source","text/x-ldif","text/x-python","text/x-shellscript"];OC.appswebroots?.richdocuments||OC.appswebroots?.onlyoffice||o.push("text/csv");const s=["text/markdown",...o]},7694:(e,t,n)=>{n.d(t,{G:()=>o});const o=()=>document.getElementById("sharingToken")?document.getElementById("sharingToken").value:null},72150:(e,t,n)=>{n.d(t,{default:()=>f,M:()=>w});var o=n(85471),s=n(95353),i=n(59097),a=n(63814),d=n(70715);const c="SET_VIEW_WIDTH",r="SET_SHOW_AUTHOR_ANNOTATIONS",l="SET_HEADINGS",p="SET_ATTACHMENT_LIST";var u=n(17334),m=n.n(u);const h=()=>document.documentElement.clientWidth,_=e=>{let{commit:t}=e;const n=m()((()=>{t(`text/${c}`,h())}),100);window.addEventListener("resize",n)},x=(0,i.getBuilder)("text").persist().build();o.default.use(s.Ay);const w={state:{showAuthorAnnotations:"true"===x.getItem("showAuthorAnnotations"),viewWidth:h(),headings:Object.freeze([]),attachmentList:[]},getters:{imageAttachments:e=>e.attachmentList.filter((e=>e.isImage)),findAttachment:e=>t=>e.attachmentList.find((e=>e.name===t))},mutations:{[c](e,t){e.viewWidth=t},[r](e,t){e.showAuthorAnnotations=t,x.setItem("showAuthorAnnotations",""+t)},[l](e,t){if(e.headings.length!==t.length)return void(e.headings=Object.freeze(t));const n=e.headings,o=t.map(((e,t)=>{const o=n[t].level;return Object.freeze({...e,previous:o})}));e.headings=Object.freeze(o)},[p](e,t){e.attachmentList=t}},actions:{setShowAuthorAnnotations(e,t){let{commit:n}=e;n(r,t)},setHeadings(e,t){let{commit:n}=e;n(l,t)},async setAttachmentList(e,t){let{commit:n}=e,{documentId:o,session:s,shareToken:i}=t;const c=await d.Ay.post((0,a.Jv)("/apps/text/attachments"),{documentId:s?.documentId??o,sessionId:s?.id,sessionToken:s?.token,shareToken:i});n(p,c.data)}}},f=new s.il({plugins:[_],modules:{text:{namespaced:!0,...w}}})}}]);
//# sourceMappingURL=src_helpers_files_js.js.map?v=c7c2c5a6d38d7d6cab6c