"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9685,7252],{79685:(e,t,r)=>{r.r(t),r.d(t,{default:()=>k});var n,o=r(20034),a=r(44658),d=r(57174),i=r(26428),c=r(59686),s=r(34738),w=r(980),m=r(77952);!function(e){e.markdownPreview="markdownviewer:open",e.markdownEditor="markdownviewer:edit"}(n||(n={}));const p="Markdown Preview",l={activate:function(e,t,r,o,s,w){const m=r.load("jupyterlab"),{commands:k,docRegistry:u}=e;t.addFactory(c.markdownRendererFactory);const g=new a.WidgetTracker({namespace:"markdownviewer-widget"});let f={...i.MarkdownViewer.defaultConfig};function h(e){Object.keys(f).forEach((t=>{var r;e.setOption(t,null!==(r=f[t])&&void 0!==r?r:null)}))}if(s){const e=e=>{f=e.composite,g.forEach((e=>{h(e.content)}))};s.load(l.id).then((t=>{t.changed.connect((()=>{e(t)})),e(t)})).catch((e=>{console.error(e.message)}))}const y=new i.MarkdownViewerFactory({rendermime:t,name:p,label:m.__("Markdown Preview"),primaryFileType:u.getFileType("markdown"),fileTypes:["markdown"],defaultRendered:["markdown"]});return y.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{g.save(t)})),h(t.content),g.add(t)})),u.addWidgetFactory(y),o&&o.restore(g,{command:"docmanager:open",args:e=>({path:e.context.path,factory:p}),name:e=>e.context.path}),k.addCommand(n.markdownPreview,{label:m.__("Markdown Preview"),execute:e=>{const t=e.path;if("string"==typeof t)return k.execute("docmanager:open",{path:t,factory:p,options:e.options})}}),k.addCommand(n.markdownEditor,{execute:()=>{const e=g.currentWidget;if(!e)return;const t=e.context.path;return k.execute("docmanager:open",{path:t,factory:"Editor",options:{mode:"split-right"}})},isVisible:()=>{const e=g.currentWidget;return e&&".md"===d.PathExt.extname(e.context.path)||!1},label:m.__("Show Markdown Editor")}),w&&w.add(new i.MarkdownViewerTableOfContentsFactory(g,t.markdownParser)),g},id:"@jupyterlab/markdownviewer-extension:plugin",description:"Adds markdown file viewer and provides its tracker.",provides:i.IMarkdownViewerTracker,requires:[c.IRenderMimeRegistry,m.ITranslator],optional:[o.ILayoutRestorer,s.ISettingRegistry,w.ITableOfContentsRegistry],autoStart:!0},k=l}}]);