"use strict";(self.webpackChunk_elyra_scala_editor_extension=self.webpackChunk_elyra_scala_editor_extension||[]).push([[509],{8058:(e,a,t)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ScalaEditor=void 0;const o=t(4196),c=t(792);class n extends o.ScriptEditor{constructor(e){super(e)}getLanguage(){return"scala"}getIcon(){return c.scalaIcon}}a.ScalaEditor=n},8509:(e,a,t)=>{Object.defineProperty(a,"__esModule",{value:!0});const o=t(4196),c=t(792),n=t(5607),r=t(9246),s=t(8745),d=t(7931),i=t(6176),l=t(8213),m=t(9723),p=t(2912),u=t(8058),g="Scala Editor",y="scala",h="elyra-scala-editor-extension",f="script-editor:create-new-scala-editor",w="docmanager:open",x={id:h,autoStart:!0,requires:[s.IEditorServices,i.IEditorTracker,r.ICommandPalette,p.ISettingRegistry,d.IFileBrowserFactory],optional:[n.ILayoutRestorer,m.IMainMenu,l.ILauncher],activate:(e,a,t,n,s,d,i,l,m)=>{console.log("Elyra - scala-editor extension is activated!");const p=new o.ScriptEditorWidgetFactory({editorServices:a,factoryOptions:{name:g,fileTypes:[y],defaultFor:[y]},instanceCreator:e=>new u.ScalaEditor(e)});e.docRegistry.addFileType({name:y,displayName:"Scala File",extensions:[".scala"],pattern:".*\\.scala$",mimeTypes:["text/x-scala"],icon:c.scalaIcon});const{restored:x}=e,E=new r.WidgetTracker({namespace:h});let S={};i&&i.restore(E,{command:w,args:e=>({path:e.context.path,factory:g}),name:e=>e.context.path});const I=a=>{S=Object.assign({},a.get("editorConfig").composite),e.commands.notifyCommandChanged()},_=()=>{E.forEach((e=>{v(e)}))},v=e=>{t.has(e)||t.add(e);const a=e.content.editor,o=S||{};Object.keys(o).forEach((e=>{const t=o[e];void 0!==t&&a.setOption(e,t)}))};Promise.all([s.load("@jupyterlab/fileeditor-extension:plugin"),x]).then((([e])=>{I(e),_(),e.changed.connect((()=>{I(e),_()}))})).catch((e=>{console.error(e.message),_()})),e.docRegistry.addWidgetFactory(p),p.widgetCreated.connect(((e,a)=>{E.add(a),a.context.pathChanged.connect((()=>{E.save(a)})),v(a)})),E.widgetAdded.connect(((e,a)=>{v(a)})),m&&m.add({command:f,category:"Elyra",rank:4}),l&&l.fileMenu.newMenu.addGroup([{command:f,args:{isMenu:!0}}],92),e.commands.addCommand(f,{label:e=>e.isPalette?"New Scala Editor":"Scala Editor",caption:"Create a new Scala Editor",icon:e=>e.isPalette?void 0:c.scalaIcon,execute:a=>{const t=d.createFileBrowser("myFileBrowser");return o=a.cwd?String(a.cwd):t.model.path,e.commands.execute("docmanager:new-untitled",{path:o,type:"file",ext:".scala"}).then((a=>e.commands.execute(w,{path:a.path,factory:g})));var o}}),n.addItem({command:f,args:{isPalette:!0},category:"Elyra"})}};a.default=x}}]);