import{V as e}from"./vue.runtime.esm-BrouV0Mr.chunk.mjs";import{c as d}from"./index-jVSJWteM.chunk.mjs";import{a6 as a}from"./RichText-ChzG3aAL.chunk.mjs";import{a as s}from"./public-C42pM6E9.chunk.mjs";import{P as i}from"./PlainTextReader-d9FDKDLq.chunk.mjs";import n from"./MarkdownContentEditor-BbMr4_uF.chunk.mjs";import{t as r,g as m,n as l}from"./_plugin-vue2_normalizer-Dv5JCS6y.chunk.mjs";import{g as u}from"./token-DsHNcSTq.chunk.mjs";import{g as c}from"./Editor.singleton-C1BgIBlo.chunk.mjs";import"./modulepreload-polyfill-DCUwxYMh.chunk.mjs";import"./emoji-picker-Coav-X6q.chunk.mjs";import"./index-BlLlZtv2.chunk.mjs";import"./MediaHandler.provider-i78Kd03y.chunk.mjs";import"./logger-YW53u4Eu.chunk.mjs";import"./index-DtTpkYe5.chunk.mjs";import"./_plugin-vue2_normalizer-CQ6iBklL-CXuhKXxu.chunk.mjs";import"./index-CJ7wDv5l.chunk.mjs";import"./BaseReader-udqi3-fi.chunk.mjs";import"./Wrapper-DWZNOljO.chunk.mjs";import"./index-Dn5gYZF5.chunk.mjs";e.prototype.t=r,e.prototype.n=m;const p={name:"ViewerComponent",components:{NcButton:e.extend(s),PencilIcon:e.extend(a),PlainTextReader:e.extend(i),MarkdownContentEditor:e.extend(n),Editor:c},provide(){return{isEmbedded:this.isEmbedded}},props:{filename:{type:String,default:null},fileid:{type:Number,default:null},active:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!0},shareToken:{type:String,default:()=>u()},mime:{type:String,default:null},showOutlineOutside:{type:Boolean,default:!1},permissions:{type:String,default:""},source:{type:String,default:void 0},isEmbedded:{type:Boolean,default:!1}},data(){return{content:"",hasToggledInteractiveEmbedding:!1}},computed:{useSourceView(){return this.source&&(this.fileVersion||!this.fileid||this.isEmbedded)&&!this.hasToggledInteractiveEmbedding},readerComponent(){return this.mime==="text/markdown"?n:i}},watch:{source(){this.loadFileContent()}},mounted(){this.loadFileContent()},methods:{t:r,async loadFileContent(){if(this.useSourceView){const t=await d.get(this.source);this.content=t.data,this.contentLoaded=!0}this.$emit("update:loaded",!0)},toggleEdit(){this.hasToggledInteractiveEmbedding=!0}}};var f=function(){var t=this,o=t._self._c;return t.useSourceView?o("div",{staticClass:"text-editor source-viewer",attrs:{id:"editor-container","data-text-el":"editor-container"}},[o(t.readerComponent,{tag:"Component",attrs:{content:t.content,"file-id":t.fileid,"read-only":!0,"show-menu-bar":!1}}),t.isEmbedded?o("NcButton",{staticClass:"toggle-interactive",on:{click:t.toggleEdit},scopedSlots:t._u([{key:"icon",fn:function(){return[o("PencilIcon")]},proxy:!0}],null,!1,411976917)},[t._v(" "+t._s(t.t("text","Edit"))+" ")]):t._e()],1):o("Editor",{class:{"text-editor--embedding":t.isEmbedded},attrs:{"file-id":t.fileid,"relative-path":t.filename,active:t.active||t.isEmbedded,autofocus:t.autofocus,"share-token":t.shareToken,mime:t.mime,"show-outline-outside":t.showOutlineOutside}})},h=[],g=l(p,f,h,!1,null,"368f5325");const R=g.exports;export{R as default};
