huqi 5 лет назад
Родитель
Сommit
a381355672
25 измененных файлов с 2637 добавлено и 306 удалено
  1. 6 5
      o2web/source/o2_core/o2.js
  2. 340 196
      o2web/source/o2_core/o2/widget/JavascriptEditor.js
  3. 12 4
      o2web/source/o2_core/o2/widget/MWFRaphael.js
  4. 5 3
      o2web/source/o2_core/o2/widget/ScriptArea.js
  5. 12 7
      o2web/source/o2_core/o2/widget/ace.js
  6. 3 7
      o2web/source/o2_core/o2/widget/codemirror.js
  7. 15 16
      o2web/source/o2_core/o2/widget/monaco.js
  8. 1809 31
      o2web/source/o2_lib/vs/loader.js
  9. 9 0
      o2web/source/x_component_cms_ScriptDesigner/$Main/default/toolbars.html
  10. 55 9
      o2web/source/x_component_cms_ScriptDesigner/Main.js
  11. 22 0
      o2web/source/x_component_cms_ScriptDesigner/Script.js
  12. 20 0
      o2web/source/x_component_portal_ScriptDesigner/$Main/default/toolbars.html
  13. 51 5
      o2web/source/x_component_portal_ScriptDesigner/Main.js
  14. 17 1
      o2web/source/x_component_portal_ScriptDesigner/Script.js
  15. 9 0
      o2web/source/x_component_process_ScriptDesigner/$Main/default/toolbars.html
  16. 51 5
      o2web/source/x_component_process_ScriptDesigner/Main.js
  17. 17 0
      o2web/source/x_component_process_ScriptDesigner/Script.js
  18. 4 1
      o2web/source/x_component_query_StatementDesigner/Statement.js
  19. 9 0
      o2web/source/x_component_service_AgentDesigner/$Main/default/toolbars.html
  20. 18 1
      o2web/source/x_component_service_AgentDesigner/Agent.js
  21. 53 7
      o2web/source/x_component_service_AgentDesigner/Main.js
  22. 10 0
      o2web/source/x_component_service_InvokeDesigner/$Main/default/toolbars.html
  23. 17 1
      o2web/source/x_component_service_InvokeDesigner/Invoke.js
  24. 54 7
      o2web/source/x_component_service_InvokeDesigner/Main.js
  25. 19 0
      o2web/source/x_desktop/js/initalServiceScriptSubstitute.js

+ 6 - 5
o2web/source/o2_core/o2.js

@@ -147,6 +147,7 @@
         var MSXML = function(){ return new ActiveXObject('Microsoft.XMLHTTP'); };
         var MSXML = function(){ return new ActiveXObject('Microsoft.XMLHTTP'); };
         return _attempt(XMLHTTP, MSXML2, MSXML);
         return _attempt(XMLHTTP, MSXML2, MSXML);
     })();
     })();
+    this.o2.request = _request;
 
 
     var _returnBase = function(number, base) {
     var _returnBase = function(number, base) {
         return (number).toString(base).toUpperCase();
         return (number).toString(base).toUpperCase();
@@ -290,13 +291,13 @@
             _removeListener(xhr, 'load', _checkCssLoaded);
             _removeListener(xhr, 'load', _checkCssLoaded);
             _removeListener(xhr, 'error', _checkCssErrorLoaded);
             _removeListener(xhr, 'error', _checkCssErrorLoaded);
 
 
-            if (err) {failure(xhr); return}
+            if (err) {if (failure) failure(xhr); return}
             var status = xhr.status;
             var status = xhr.status;
             status = (status == 1223) ? 204 : status;
             status = (status == 1223) ? 204 : status;
             if ((status >= 200 && status < 300))
             if ((status >= 200 && status < 300))
-                success(xhr);
+                if (success) success(xhr);
             else if ((status >= 300 && status < 400))
             else if ((status >= 300 && status < 400))
-                failure(xhr);
+                if (failure) failure(xhr);
             else
             else
                 failure(xhr);
                 failure(xhr);
             if (completed) completed(xhr);
             if (completed) completed(xhr);
@@ -308,7 +309,7 @@
         _addListener(xhr, "readystatechange", _checkCssLoaded);
         _addListener(xhr, "readystatechange", _checkCssLoaded);
         xhr.send();
         xhr.send();
     };
     };
-
+    this.o2.xhr_get = _xhr_get;
     var _loadSequence = function(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun){
     var _loadSequence = function(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun){
         loadSingle(ms[n], function(module){
         loadSingle(ms[n], function(module){
             if (module) thisLoaded.push(module);
             if (module) thisLoaded.push(module);
@@ -343,7 +344,7 @@
         "mootools": ["/o2_lib/mootools/mootools-1.6.0_all.js"],
         "mootools": ["/o2_lib/mootools/mootools-1.6.0_all.js"],
         "ckeditor": ["/o2_lib/htmleditor/ckeditor4114/ckeditor.js"],
         "ckeditor": ["/o2_lib/htmleditor/ckeditor4114/ckeditor.js"],
         "ckeditor5": ["/o2_lib/htmleditor/ckeditor5-12-1-0/ckeditor.js"],
         "ckeditor5": ["/o2_lib/htmleditor/ckeditor5-12-1-0/ckeditor.js"],
-        "raphael": ["/o2_lib/raphael/raphael.js"],
+        "raphael": ["/o2_lib/raphael/raphael_230.js"],
         "d3": ["/o2_lib/d3/d3.min.js"],
         "d3": ["/o2_lib/d3/d3.min.js"],
         "ace": ["/o2_lib/ace/src-min-noconflict/ace.js","/o2_lib/ace/src-min-noconflict/ext-language_tools.js"],
         "ace": ["/o2_lib/ace/src-min-noconflict/ace.js","/o2_lib/ace/src-min-noconflict/ext-language_tools.js"],
         "monaco": ["/o2_lib/vs/loader.js"],
         "monaco": ["/o2_lib/vs/loader.js"],

+ 340 - 196
o2web/source/o2_core/o2/widget/JavascriptEditor.js

@@ -1,7 +1,5 @@
 o2.widget = o2.widget || {};
 o2.widget = o2.widget || {};
 o2.require("o2.widget.codemirror", null, false);
 o2.require("o2.widget.codemirror", null, false);
-o2.require("o2.widget.ace", null, false);
-o2.require("o2.widget.monaco", null, false);
 o2.require("o2.xDesktop.UserData", null, false);
 o2.require("o2.xDesktop.UserData", null, false);
 o2.widget.JavascriptEditor = new Class({
 o2.widget.JavascriptEditor = new Class({
 	Implements: [Options, Events],
 	Implements: [Options, Events],
@@ -14,12 +12,12 @@ o2.widget.JavascriptEditor = new Class({
 			value: "",
 			value: "",
 			mode: "javascript",
 			mode: "javascript",
 			"lineNumbers": true
 			"lineNumbers": true
-		}
+		},
+		"runtime": "web"
 	},
 	},
 	initialize: function(node, options){
 	initialize: function(node, options){
 		this.setOptions(options);
 		this.setOptions(options);
 		this.unbindEvents = [];
 		this.unbindEvents = [];
-		this.editorClass = o2.widget[this.options.type];
 		this.node = $(node);
 		this.node = $(node);
 	},
 	},
     getDefaultEditorData: function(){
     getDefaultEditorData: function(){
@@ -56,6 +54,7 @@ o2.widget.JavascriptEditor = new Class({
     },
     },
     load: function(callback){
     load: function(callback){
         this.getEditorTheme(function(json){
         this.getEditorTheme(function(json){
+            this.options.type = o2.editorData.javascriptEditor.editor || "monaco";
             if (this.options.type.toLowerCase()=="ace"){
             if (this.options.type.toLowerCase()=="ace"){
                 this.loadAce(callback);
                 this.loadAce(callback);
             }
             }
@@ -73,6 +72,18 @@ o2.widget.JavascriptEditor = new Class({
         }.bind(this));
         }.bind(this));
     },
     },
 
 
+    loadMonacoEditor: function(callback){
+        if (!window.monaco){
+            o2.load("monaco", {"sequence": true}, function(){
+                require.config({ paths: { "vs": "/o2_lib/vs" }});
+                require(["vs/editor/editor.main"], function() {
+                    if (callback) callback();
+                });
+            }.bind(this));
+        }else{
+            if (callback) callback();
+        }
+    },
     loadMonaco: function(callback){
     loadMonaco: function(callback){
         if (o2.editorData.javascriptEditor){
         if (o2.editorData.javascriptEditor){
             this.theme = o2.editorData.javascriptEditor.monaco_theme;
             this.theme = o2.editorData.javascriptEditor.monaco_theme;
@@ -86,104 +97,49 @@ o2.widget.JavascriptEditor = new Class({
         if (!this.theme) this.theme = "vs";
         if (!this.theme) this.theme = "vs";
         if( !this.fontSize )this.fontSize = "12px";
         if( !this.fontSize )this.fontSize = "12px";
 
 
-        this.editorClass.load(function(){
-            this.editor = monaco.editor.create(this.node, {
-                value: this.options.option.value,
-                language: this.options.option.mode,
-                theme: this.theme,
-                fontSize: this.fontSize,
-                lineNumbersMinChars: 3,
-                lineNumbers: (this.options.option.lineNumbers) ? "on" : "off",
-                mouseWheelZoom: true,
-                automaticLayout: true
-            });
-            this.focus();
-
-            o2.require("o2.xScript.Macro", function() {
-                var json = null;
-                o2.getJSON("/o2_core/o2/widget/$JavascriptEditor/environment.json", function (data) {
-                    json = data;
-                }, false);
-                this.Macro = new o2.Macro.FormContext(json);
-
-                //registerReferenceProvider
-                //monaco.languages.registerReferenceProvider('javascript', {
-                monaco.languages.registerCompletionItemProvider('javascript', {
-                    "triggerCharacters": ["."],
-                    provideCompletionItems: function (model, position, context, token) {
-                        debugger;
-                        var textUntilPosition = model.getValueInRange({
-                            startLineNumber: position.lineNumber,
-                            startColumn: 1,
-                            endLineNumber: position.lineNumber,
-                            endColumn: position.column
-                        });
-                        var textPrefix = textUntilPosition.substr(0, textUntilPosition.lastIndexOf("."));
-                        code = "try {return "+textPrefix+";}catch(e){return null;}";
-                        //code = "try {return this;}catch(e){return null;}";
-                        var o = this.Macro.exec(code);
-
-                        var word = model.getWordUntilPosition(position);
-                        var range = {
-                            startLineNumber: position.lineNumber,
-                            endLineNumber: position.lineNumber,
-                            startColumn: word.startColumn,
-                            endColumn: word.endColumn
-                        };
-
-                        if (o) {
-                            var arr = [];
-                            Object.keys(o).each(function (key) {
-                                var type = typeOf(o[key]);
-                                if (type === "function") {
-                                    var count = o[key].length;
-                                    var v = key + "(";
-                                    for (var i = 1; i <= count; i++) v += (i == count) ? "par" + i : "par" + i + ", ";
-                                    v += ")";
-                                    arr.push({
-                                        label: key,
-                                        kind: monaco.languages.CompletionItemKind.Function,
-                                        //documentation: "Fast, unopinionated, minimalist web framework",
-                                        insertText: v,
-                                        range: range,
-                                        detail: type
-                                    });
-                                } else {
-                                    arr.push({
-                                        label: key,
-                                        kind: monaco.languages.CompletionItemKind.Interface,
-                                        //documentation: "Fast, unopinionated, minimalist web framework",
-                                        insertText: key,
-                                        range: range,
-                                        detail: type
-                                    });
-                                }
-                            });
-                        }
-                        return {suggestions: arr}
-                    }.bind(this)
+
+        o2.require("o2.widget.monaco", function () {
+            this.editorClass = o2.widget.monaco;
+
+            this.editorClass.load(function(){
+
+                this.editor = monaco.editor.create(this.node, {
+                    value: this.options.option.value,
+                    language: this.options.option.mode,
+                    theme: this.theme,
+                    fontSize: this.fontSize,
+                    lineNumbersMinChars: 3,
+                    lineNumbers: this.options.option.lineNumbers ? "on" : "off",
+                    mouseWheelZoom: true,
+                    automaticLayout: true
                 });
                 });
+                this.focus();
 
 
-            });
+                this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S, function(e){
+                    this.fireEvent("save");
+                }.bind(this));
 
 
-            this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S, function(e){
-                this.fireEvent("save");
-            }.bind(this));
+                this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_I, function(e){
+                    this.format();
+                }.bind(this));
+                this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_F, function(e){
+                    this.format();
+                }.bind(this));
 
 
-            this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_I, function(e){
-                this.format();
-            }.bind(this));
-            this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_F, function(e){
-                this.format();
-            }.bind(this));
+                if( this.fontSize ){
+                    this.editor.updateOptions( {"fontSize": this.fontSize} );
+                }
 
 
-            if( this.fontSize ){
-                this.editor.updateOptions( {"fontSize": this.fontSize} );
-            }
+                o2.widget.JavascriptEditor.getCompletionEnvironment(this.options.runtime, function(){
+                    this.monacoModel = this.editor.getModel();
+                    this.monacoModel.o2Editor = this;
+                    this.registerCompletion();
+                }.bind(this));
 
 
-            this.fireEvent("postLoad");
-            if (callback) callback();
+                this.fireEvent("postLoad");
+                if (callback) callback();
 
 
+            }.bind(this));
         }.bind(this));
         }.bind(this));
     },
     },
 
 
@@ -200,110 +156,201 @@ o2.widget.JavascriptEditor = new Class({
         if (!this.theme) this.theme = "tomorrow";
         if (!this.theme) this.theme = "tomorrow";
         if( !this.fontSize )this.fontSize = "12px";
         if( !this.fontSize )this.fontSize = "12px";
 
 
-        this.editorClass.load(function(){
-            var exports = ace.require("ace/ext/language_tools");
-            this.editor = ace.edit(this.node);
-            this.editor.session.setMode("ace/mode/"+this.options.option.mode);
-            this.editor.setTheme("ace/theme/"+this.theme);
-            this.editor.setOptions({
-                enableBasicAutocompletion: true,
-                enableSnippets: true,
-                enableLiveAutocompletion: true,
-                lineNumbers: this.options.option.lineNumbers
-            });
-            if (this.options.option.value) this.editor.setValue(this.options.option.value);
+        o2.require("o2.widget.ace", function(){
+            this.editorClass = o2.widget.ace;
+
+            this.editorClass.load(function(){
+                this.editor = ace.edit(this.node);
+                this.editor.session.setMode("ace/mode/"+this.options.option.mode);
+                this.editor.setTheme("ace/theme/"+this.theme);
+                this.editor.setOptions({
+                    enableBasicAutocompletion: true,
+                    enableSnippets: true,
+                    enableLiveAutocompletion: true,
+                    showLineNumbers: this.options.option.lineNumbers
+                });
+                if (this.options.option.value) this.editor.setValue(this.options.option.value);
+                this.editor.o2Editor = this;
+
+                this.focus();
+
+                this.editor.commands.addCommand({
+                    name: 'save',
+                    bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},
+                    exec: function(editor) {
+                        this.fireEvent("save");
+                    }.bind(this),
+                    readOnly: false
+                });
 
 
-            this.focus();
+                this.editor.commands.addCommand({
+                    name: 'format',
+                    bindKey: {win: 'Ctrl-Alt-i|Ctrl-Alt-f',  mac: 'Command-i|Command-f'},
+                    exec: function(editor, e, e1) {
+                        this.format();
+                    }.bind(this),
+                    readOnly: false
+                });
 
 
-            //this.editor.focus();
-            //this.editor.navigateFileStart();
-            //添加自动完成列表
-            o2.require("o2.xScript.Macro", function(){
-                var json = null;
-                o2.getJSON("/o2_core/o2/widget/$JavascriptEditor/environment.json", function(data){ json = data; }, false);
-                this.Macro = new o2.Macro.FormContext(json);
-                exports.addCompleter({
-                    identifierRegexps: [
-                        /[a-zA-Z_0-9\$\-\u00A2-\uFFFF\.]/
-                    ],
-                    getCompletions: function(editor, session, pos, prefix, callback){
-                        var x = prefix.substr(0, prefix.lastIndexOf("."));
-                        code = "try {return "+x+";}catch(e){return null;}";
-                        var o = this.Macro.exec(code);
-
-                        if (o){
-                            var arr1 = [];
-                            var arr2 = [];
-                            Object.keys(o).each(function(key){
-                                var type = typeOf(o[key]);
-                                if (type==="function") {
-                                    var count = o[key].length;
-                                    var v = x+"."+key+"(";
-                                    for (var i=1; i<=count; i++) v+= (i==count) ? "par"+i :  "par"+i+", ";
-                                    v+=");";
-                                    arr1.push({
-                                        caption: key,
-                                        value: v,
-                                        score: 3,
-                                        meta: type
-                                    });
-                                }else{
-                                    arr2.push({
-                                        caption: key,
-                                        value: x+"."+key,
-                                        score: 3,
-                                        meta: type
-                                    });
-                                }
-                            });
-                            callback(null, arr1.concat(arr2));
-                        }
+                this.editor.commands.addCommand({
+                    name: "showKeyboardShortcuts",
+                    bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
+                    exec: function(editor) {
+                        ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
+                            module.init(editor);
+                            editor.showKeyboardShortcuts()
+                        })
                     }.bind(this)
                     }.bind(this)
                 });
                 });
-            }.bind(this));
 
 
-            this.editor.commands.addCommand({
-                name: 'save',
-                bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},
-                exec: function(editor) {
-                    this.fireEvent("save");
-                }.bind(this),
-                readOnly: false
-            });
+                this.node.addEvent("keydown", function(e){
+                    e.stopPropagation();
+                });
 
 
-            this.editor.commands.addCommand({
-                name: 'format',
-                bindKey: {win: 'Ctrl-Alt-i|Ctrl-Alt-f',  mac: 'Command-i|Command-f'},
-                exec: function(editor, e, e1) {
-                    this.format();
-                }.bind(this),
-                readOnly: false
-            });
+                if( this.fontSize ){
+                    this.setFontSize( this.fontSize );
+                }
+
+                o2.widget.JavascriptEditor.getCompletionEnvironment(this.options.runtime, function(){
+                    this.registerCompletion();
+                }.bind(this));
+
+                this.fireEvent("postLoad");
+                if (callback) callback();
+            }.bind(this));
+        }.bind(this));
+    },
+    registerCompletion: function(){
+        debugger;
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.registerCompletionAce(); break;
+                case "monaco": this.registerCompletionMonaco(); break;
+            }
+        }
+    },
 
 
-            this.editor.commands.addCommand({
-                name: "showKeyboardShortcuts",
-                bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
-                exec: function(editor) {
-                    ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
-                        module.init(editor);
-                        editor.showKeyboardShortcuts()
-                    })
+    getCompletionObject: function(textPrefix, runtime){
+        var macro = o2.widget.JavascriptEditor.runtimeEnvironment[runtime];
+        var o = null;
+        if (macro){
+            code = "try {return "+textPrefix+";}catch(e){return null;}";
+            o = macro.exec(code);
+        }
+        return o;
+    },
+    registerCompletionMonaco: function(){
+        if (!o2.widget.monaco.registeredCompletion){
+            monaco.languages.registerCompletionItemProvider('javascript', {
+                "triggerCharacters": ["."],
+                provideCompletionItems: function (model, position, context, token) {
+                    var textUntilPosition = model.getValueInRange({ startLineNumber: position.lineNumber, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column });
+                    var textPrefix = textUntilPosition.substr(0, textUntilPosition.lastIndexOf("."));
+                    var o = this.getCompletionObject(textPrefix, model.o2Editor.options.runtime);
+
+                    var word = model.getWordUntilPosition(position);
+                    var range = { startLineNumber: position.lineNumber, endLineNumber: position.lineNumber, startColumn: word.startColumn, endColumn: word.endColumn };
+
+                    if (o) {
+                        var arr = [];
+                        Object.keys(o).each(function (key) {
+                            var type = typeOf(o[key]);
+                            if (type === "function") {
+                                var count = o[key].length;
+                                var v = key + "(";
+                                for (var i = 1; i <= count; i++) v += (i == count) ? "par" + i : "par" + i + ", ";
+                                v += ")";
+                                arr.push({ label: key, kind: monaco.languages.CompletionItemKind.Function, insertText: v, range: range, detail: type });
+                            } else {
+                                arr.push({ label: key, kind: monaco.languages.CompletionItemKind.Interface, insertText: key, range: range, detail: type });
+                            }
+                        });
+                    }
+                    return {suggestions: arr}
                 }.bind(this)
                 }.bind(this)
             });
             });
-
-            this.node.addEvent("keydown", function(e){
-                e.stopPropagation();
+            o2.widget.monaco.registeredCompletion = true;
+        }
+    },
+    registerCompletionAce: function(){
+        if (!o2.widget.ace.registeredCompletion){
+            //添加自动完成列表
+            var exports = ace.require("ace/ext/language_tools");
+            exports.addCompleter({
+                identifierRegexps: [
+                    /[a-zA-Z_0-9\$\-\u00A2-\uFFFF\.]/
+                ],
+                getCompletions: function(editor, session, pos, prefix, callback){
+                    var x = prefix.substr(0, prefix.lastIndexOf("."));
+                    var o = this.getCompletionObject(x, editor.o2Editor.options.runtime);
+
+                    if (o){
+                        var arr = [];
+                        Object.keys(o).each(function(key){
+                            var type = typeOf(o[key]);
+                            if (type==="function") {
+                                var count = o[key].length;
+                                var v = x+"."+key+"(";
+                                for (var i=1; i<=count; i++) v+= (i==count) ? "par"+i :  "par"+i+", ";
+                                v+=");";
+                                arr.push({ caption: key, value: v, score: 3, meta: type });
+                            }else{
+                                arr.push({ caption: key, value: x+"."+key, score: 3, meta: type });
+                            }
+                        });
+                        callback(null, arr);
+                    }
+                }.bind(this)
             });
             });
-
-            if( this.fontSize ){
-                this.editor.setFontSize( this.fontSize );
+            o2.widget.ace.registeredCompletion = true;
+        }
+    },
+    changeEditor: function(type){
+	    debugger;
+        if (this.editor){
+            var value = this.getValue();
+            this.destroyEditor();
+            this.options.type = type;
+            this.load(function(){
+                this.setValue(value);
+            }.bind(this));
+        }else{
+            this.options.type = o2.editorData.javascriptEditor.editor;
+            if (this.options.type.toLowerCase()=="ace"){
+                this.loadAce(callback);
             }
             }
-
-            this.fireEvent("postLoad");
-            if (callback) callback();
-        }.bind(this));
+            if (this.options.type.toLowerCase()=="monaco"){
+                this.loadMonaco(callback);
+            }
+            if (this.options.type.toLowerCase()=="codeMirror"){
+                this.loadCodeMirror(callback);
+            }
+        }
+    },
+    destroyEditor: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.destroy(); this.node.empty(); break;
+                case "monaco": this.editor.dispose(); break;
+            }
+        }
+    },
+    setTheme: function(theme){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setTheme( "ace/theme/"+theme); break;
+                case "monaco": monaco.editor.setTheme(theme); break;
+            }
+        }
+    },
+    setFontSize: function(fontSize){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setFontSize( fontSize ); break;
+                case "monaco": this.editor.updateOptions({"fontSize": fontSize}); break;
+            }
+        }
     },
     },
-
     setValue: function(v){
     setValue: function(v){
         if (this.editor) this.editor.setValue(v);
         if (this.editor) this.editor.setValue(v);
     },
     },
@@ -411,7 +458,33 @@ o2.widget.JavascriptEditor = new Class({
         }
         }
         this.editor.gotoLine(p.row+1, p.column+1, true);
         this.editor.gotoLine(p.row+1, p.column+1, true);
     },
     },
-
+    showLineNumbers: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setOption("showLineNumbers", true); break;
+                case "codeMirror":  this.editor.setOption("lineNumbers", true); break;
+                case "monaco": this.editor.updateOptions({"lineNumbers": "on"});
+            }
+        }
+    },
+    hideLineNumbers: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setOption("showLineNumbers", false); break;
+                case "codeMirror":  this.editor.setOption("lineNumbers", false); break;
+                case "monaco": this.editor.updateOptions({"lineNumbers": "off"});
+            }
+        }
+    },
+    max: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "codeMirror": this.editor.setSize("100%", "100%"); break;
+                case "ace": this.editor.resize(); break;
+                case "monaco": this.editor.layout(); break;
+            }
+        }
+    },
 
 
 	loadCodeMirror: function(callback){
 	loadCodeMirror: function(callback){
 		if (this.fireEvent("queryLoad")){
 		if (this.fireEvent("queryLoad")){
@@ -428,12 +501,6 @@ o2.widget.JavascriptEditor = new Class({
 			}.bind(this));
 			}.bind(this));
 		}
 		}
 	},
 	},
-    showLineNumbers: function(){
-        if (this.options.type.toLowerCase()=="codeMirror") this.editor.setOption("lineNumbers", true);
-    },
-    max: function(){
-        if (this.options.type.toLowerCase()=="codeMirror") this.editor.setSize("100%", "100%");
-    },
 
 
     getCursorPixelPosition: function(){
     getCursorPixelPosition: function(){
         var session = this.editor.getSession();
         var session = this.editor.getSession();
@@ -465,6 +532,83 @@ o2.widget.JavascriptEditor = new Class({
         }
         }
         return buf.reverse().join("");
         return buf.reverse().join("");
     }
     }
+});
+
+o2.widget.JavascriptEditor.runtimeEnvironment = {};
+o2.widget.JavascriptEditor.getCompletionEnvironment = function(runtime, callback) {
+    if (!o2.widget.JavascriptEditor.runtimeEnvironment[runtime]) {
+        o2.require("o2.xScript.Macro", function() {
+            switch (runtime) {
+                case "service":
+                    o2.widget.JavascriptEditor.getServiceCompletionEnvironment(runtime,callback);
+                    break;
+                case "server":
+                    o2.widget.JavascriptEditor.getServerCompletionEnvironment(runtime,callback);
+                    break;
+                default:
+                    o2.widget.JavascriptEditor.getDefaultCompletionEnvironment(runtime,callback);
+            }
+        });
+    } else {
+        if (callback) callback();
+    }
+};
+
+o2.widget.JavascriptEditor.getServiceCompletionEnvironment = function(runtime, callback) {
+    var serviceScriptText = null;
+    var serviceScriptSubstitute = null;
+    var check = function () {
+        if (o2.typeOf(serviceScriptText) !== "null" && o2.typeOf(serviceScriptSubstitute) !== "null") {
+            var code = "o2.Macro.swapSpace.tmpMacroCompletionFunction = function (){\n" + serviceScriptSubstitute + "\n" + serviceScriptText + "\nreturn bind;" + "\n};";
+            Browser.exec(code);
+            var ev = o2.Macro.swapSpace.tmpMacroCompletionFunction();
+            o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = {
+                "environment": ev,
+                exec: function(code){
+                    return o2.Macro.exec(code, this.environment);
+                }
+            }
+            if (callback) callback();
+        }
+    }
 
 
-
-});
+    o2.xhr_get("../x_desktop/js/initialServiceScriptText.js", function (xhr) {
+        serviceScriptText = xhr.responseText;
+        check();
+    }, function () {
+        serviceScriptText = "";
+        check();
+    });
+    o2.xhr_get("../x_desktop/js/initalServiceScriptSubstitute.js", function (xhr) {
+        serviceScriptSubstitute = xhr.responseText;
+        check();
+    }, function () {
+        serviceScriptSubstitute = "";
+        check();
+    });
+};
+
+o2.widget.JavascriptEditor.getServerCompletionEnvironment = function(runtime, callback) {
+    o2.xhr_get("../x_desktop/js/initialScriptText.js", function (xhr) {
+        var code = "o2.Macro.swapSpace.tmpMacroCompletionFunction = function (){\n" + xhr.responseText + "\nreturn bind;" + "\n};";
+        Browser.exec(code);
+        var ev = o2.Macro.swapSpace.tmpMacroCompletionFunction();
+        o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = {
+            "environment": ev,
+            exec: function(code){
+                return o2.Macro.exec(code, this.environment);
+            }
+        }
+        if (callback) callback();
+    }.bind(this), false);
+
+};
+
+o2.widget.JavascriptEditor.getDefaultCompletionEnvironment = function(runtime, callback){
+    var json = null;
+    o2.getJSON("../o2_core/o2/widget/$JavascriptEditor/environment.json", function (data) {
+        json = data;
+        o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = new o2.Macro.FormContext(json);
+        if (callback) callback();
+    });
+}

+ 12 - 4
o2web/source/o2_core/o2/widget/MWFRaphael.js

@@ -4,10 +4,18 @@ o2.widget.MWFRaphael = MWFRaphael = {
         if (window.Raphael){
         if (window.Raphael){
             if (callback) callback();
             if (callback) callback();
         }else{
         }else{
-            COMMON.AjaxModule.load("raphael", function(){
-                this.expandRaphael();
-                if (callback) callback();
-            }.bind(this), true, true);
+			if(!window.Raphael && typeof require === 'function' && define.amd){
+				require(["../o2_lib/raphael/raphael.js"], function(r){
+					window.Raphael = r;
+					this.expandRaphael();
+					if (callback) callback();
+				}.bind(this));
+			}else{
+				COMMON.AjaxModule.load("raphael", function(){
+					this.expandRaphael();
+					if (callback) callback();
+				}.bind(this), true, true);
+			}
         }
         }
 	},
 	},
 	expandRaphael: function(){
 	expandRaphael: function(){

+ 5 - 3
o2web/source/o2_core/o2/widget/ScriptArea.js

@@ -68,6 +68,7 @@ o2.widget.ScriptArea = new Class({
         }
         }
     },
     },
     maxSize: function(){
     maxSize: function(){
+        debugger;
         var obj = this.options.maxObj;
         var obj = this.options.maxObj;
         var coordinates = obj.getCoordinates(obj.getOffsetParent());
         var coordinates = obj.getCoordinates(obj.getOffsetParent());
 
 
@@ -80,8 +81,8 @@ o2.widget.ScriptArea = new Class({
             "position": "absolute",
             "position": "absolute",
             // "top": coordinates.top,
             // "top": coordinates.top,
             // "left": coordinates.left,
             // "left": coordinates.left,
-            "top": "0px",
-            "left": "0px",
+            "top": coordinates.top+"px",
+            "left": coordinates.left+"px",
             "width": coordinates.width,
             "width": coordinates.width,
             "height": coordinates.height-2,
             "height": coordinates.height-2,
             "z-index": 20001
             "z-index": 20001
@@ -97,7 +98,8 @@ o2.widget.ScriptArea = new Class({
     returnSize: function(){
     returnSize: function(){
         var size = this.container.retrieve("size");
         var size = this.container.retrieve("size");
 
 
-        this.editor.setOption("lineNumbers", false);
+        //this.editor.setOption("lineNumbers", false);
+        this.jsEditor.hideLineNumbers();
         this.container.inject(this.node);
         this.container.inject(this.node);
         this.container.setStyles({
         this.container.setStyles({
             "position": "static",
             "position": "static",

+ 12 - 7
o2web/source/o2_core/o2/widget/ace.js

@@ -2,15 +2,20 @@ o2.widget = o2.widget || {};
 o2.widget.ace = {
 o2.widget.ace = {
     //"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
     //"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
     //"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
     //"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
+    "callbackList": [],
     "load": function(callback){
     "load": function(callback){
         if (!window.ace){
         if (!window.ace){
-            var jsLoaded = false;
-            var cssLoaded = false;
-            o2.load("ace", {"sequence": true}, function(){
-                //COMMON.AjaxModule.loadDom("ace-tools", function(){
-                    if (callback) callback();
-                //}.bind(this))
-            }.bind(this));
+            this.callbackList.push(callback);
+            if (!this.isLoadding) {
+                this.isLoadding = true;
+                o2.load("ace", {"sequence": true}, function(){
+                    this.isLoadding = false;
+                    while (this.callbackList.length){
+                        this.callbackList.shift()();
+                    }
+                }.bind(this));
+            }
+
         }else{
         }else{
             if (callback) callback();
             if (callback) callback();
         }
         }

+ 3 - 7
o2web/source/o2_core/o2/widget/codemirror.js

@@ -11,8 +11,8 @@ o2.widget.codemirror = {
 		"php": COMMON.contentPath+"/res/framework/codemirror/mode/php/php.js"
 		"php": COMMON.contentPath+"/res/framework/codemirror/mode/php/php.js"
 	},
 	},
 	"addon": {
 	"addon": {
-		
-		
+
+
 	},
 	},
 	"load": function(callback){
 	"load": function(callback){
 		var jsLoaded = false;
 		var jsLoaded = false;
@@ -42,9 +42,5 @@ o2.widget.codemirror = {
 			if (callback) callback();
 			if (callback) callback();
 		}
 		}
 	}
 	}
-	
-};
-
-
-
 
 
+};

+ 15 - 16
o2web/source/o2_core/o2/widget/monaco.js

@@ -1,23 +1,22 @@
 o2.widget = o2.widget || {};
 o2.widget = o2.widget || {};
 o2.widget.monaco = {
 o2.widget.monaco = {
-    //"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
-    //"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
+    "callbackList": [],
     "load": function(callback){
     "load": function(callback){
         if (!window.monaco){
         if (!window.monaco){
-            o2.load("monaco", {"sequence": true}, function(){
-                require.config({ paths: { "vs": "/o2_lib/vs" }});
-                require(["vs/editor/editor.main"], function() {
-                    if (callback) callback();
-                    // var editor = monaco.editor.create(document.getElementById('container'), {
-                    //     value: [
-                    //         'function x() {',
-                    //         '\tconsole.log("Hello world!");',
-                    //         '}'
-                    //     ].join('\n'),
-                    //     language: 'javascript'
-                    // });
-                });
-            }.bind(this));
+            this.callbackList.push(callback);
+            if (!this.isLoadding){
+                this.isLoadding = true;
+                o2.load("monaco", {"sequence": true}, function(){
+                    require.config({ paths: { "vs": "/o2_lib/vs" }});
+                    require(["vs/editor/editor.main"], function() {
+                        this.isLoadding = false;
+                        while (this.callbackList.length){
+                            this.callbackList.shift()();
+                        }
+                        //if (callback) callback();
+                    }.bind(this));
+                }.bind(this));
+            }
         }else{
         }else{
             if (callback) callback();
             if (callback) callback();
         }
         }

+ 1809 - 31
o2web/source/o2_lib/vs/loader.js

@@ -4,34 +4,1812 @@
  * Released under the MIT license
  * Released under the MIT license
  * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt
  * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt
  *-----------------------------------------------------------*/
  *-----------------------------------------------------------*/
-"use strict";var define,AMDLoader,_amdLoaderGlobal=this,_commonjsGlobal="object"==typeof global?global:{};!function(e){e.global=_amdLoaderGlobal;var t=function(){function t(){this._detected=!1,this._isWindows=!1,this._isNode=!1,this._isElectronRenderer=!1,this._isWebWorker=!1}return Object.defineProperty(t.prototype,"isWindows",{get:function(){return this._detect(),this._isWindows},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isNode",{get:function(){return this._detect(),this._isNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isElectronRenderer",{get:function(){return this._detect(),this._isElectronRenderer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isWebWorker",{get:function(){return this._detect(),this._isWebWorker},enumerable:!0,configurable:!0}),t.prototype._detect=function(){this._detected||(this._detected=!0,this._isWindows=t._isWindows(),this._isNode="undefined"!=typeof module&&!!module.exports,
-this._isElectronRenderer="undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.electron&&"renderer"===process.type,this._isWebWorker="function"==typeof e.global.importScripts)},t._isWindows=function(){return!!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Windows")>=0)||"undefined"!=typeof process&&"win32"===process.platform},t}();e.Environment=t}(AMDLoader||(AMDLoader={})),function(e){var t=function(e,t,r){this.type=e,this.detail=t,this.timestamp=r};e.LoaderEvent=t;var r=function(){function r(e){this._events=[new t(1,"",e)]}return r.prototype.record=function(r,n){this._events.push(new t(r,n,e.Utilities.getHighPerformanceTimestamp()))},r.prototype.getEvents=function(){return this._events},r}();e.LoaderEventRecorder=r;var n=function(){function e(){}return e.prototype.record=function(e,t){},e.prototype.getEvents=function(){return[]},e.INSTANCE=new e,e}();e.NullLoaderEventRecorder=n}(AMDLoader||(AMDLoader={})),function(e){var t=function(){
-function t(){}return t.fileUriToFilePath=function(e,t){if(t=decodeURI(t).replace(/%23/g,"#"),e){if(/^file:\/\/\//.test(t))return t.substr(8);if(/^file:\/\//.test(t))return t.substr(5)}else if(/^file:\/\//.test(t))return t.substr(7);return t},t.startsWith=function(e,t){return e.length>=t.length&&e.substr(0,t.length)===t},t.endsWith=function(e,t){return e.length>=t.length&&e.substr(e.length-t.length)===t},t.containsQueryString=function(e){return/^[^\#]*\?/gi.test(e)},t.isAbsolutePath=function(e){return/^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(e)},t.forEachProperty=function(e,t){if(e){var r=void 0;for(r in e)e.hasOwnProperty(r)&&t(r,e[r])}},t.isEmpty=function(e){var r=!0;return t.forEachProperty(e,(function(){r=!1})),r},t.recursiveClone=function(e){if(!e||"object"!=typeof e)return e;var r=Array.isArray(e)?[]:{};return t.forEachProperty(e,(function(e,n){r[e]=n&&"object"==typeof n?t.recursiveClone(n):n})),r},t.generateAnonymousModule=function(){return"===anonymous"+t.NEXT_ANONYMOUS_ID+++"==="},
-t.isAnonymousModule=function(e){return t.startsWith(e,"===anonymous")},t.getHighPerformanceTimestamp=function(){return this.PERFORMANCE_NOW_PROBED||(this.PERFORMANCE_NOW_PROBED=!0,this.HAS_PERFORMANCE_NOW=e.global.performance&&"function"==typeof e.global.performance.now),this.HAS_PERFORMANCE_NOW?e.global.performance.now():Date.now()},t.NEXT_ANONYMOUS_ID=1,t.PERFORMANCE_NOW_PROBED=!1,t.HAS_PERFORMANCE_NOW=!1,t}();e.Utilities=t}(AMDLoader||(AMDLoader={})),function(e){function t(e){if(e instanceof Error)return e;var t=new Error(e.message||String(e)||"Unknown Error");return e.stack&&(t.stack=e.stack),t}e.ensureError=t;var r=function(){function r(){}return r.validateConfigurationOptions=function(r){if("string"!=typeof(r=r||{}).baseUrl&&(r.baseUrl=""),"boolean"!=typeof r.isBuild&&(r.isBuild=!1),"object"!=typeof r.paths&&(r.paths={}),"object"!=typeof r.config&&(r.config={}),void 0===r.catchError&&(r.catchError=!1),void 0===r.recordStats&&(r.recordStats=!1),"string"!=typeof r.urlArgs&&(r.urlArgs=""),
-"function"!=typeof r.onError&&(r.onError=function(e){return"loading"===e.phase?(console.error('Loading "'+e.moduleId+'" failed'),console.error(e),console.error("Here are the modules that depend on it:"),void console.error(e.neededBy)):"factory"===e.phase?(console.error('The factory method of "'+e.moduleId+'" has thrown an exception'),void console.error(e)):void 0}),Array.isArray(r.ignoreDuplicateModules)||(r.ignoreDuplicateModules=[]),r.baseUrl.length>0&&(e.Utilities.endsWith(r.baseUrl,"/")||(r.baseUrl+="/")),"string"!=typeof r.cspNonce&&(r.cspNonce=""),Array.isArray(r.nodeModules)||(r.nodeModules=[]),r.nodeCachedData&&"object"==typeof r.nodeCachedData&&("string"!=typeof r.nodeCachedData.seed&&(r.nodeCachedData.seed="seed"),("number"!=typeof r.nodeCachedData.writeDelay||r.nodeCachedData.writeDelay<0)&&(r.nodeCachedData.writeDelay=7e3),!r.nodeCachedData.path||"string"!=typeof r.nodeCachedData.path)){var n=t(new Error("INVALID cached data configuration, 'path' MUST be set"));n.phase="configuration",
-r.onError(n),r.nodeCachedData=void 0}return r},r.mergeConfigurationOptions=function(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var o=e.Utilities.recursiveClone(n||{});return e.Utilities.forEachProperty(t,(function(t,r){"ignoreDuplicateModules"===t&&void 0!==o.ignoreDuplicateModules?o.ignoreDuplicateModules=o.ignoreDuplicateModules.concat(r):"paths"===t&&void 0!==o.paths?e.Utilities.forEachProperty(r,(function(e,t){return o.paths[e]=t})):"config"===t&&void 0!==o.config?e.Utilities.forEachProperty(r,(function(e,t){return o.config[e]=t})):o[t]=e.Utilities.recursiveClone(r)})),r.validateConfigurationOptions(o)},r}();e.ConfigurationOptionsUtil=r;var n=function(){function t(e,t){if(this._env=e,this.options=r.mergeConfigurationOptions(t),this._createIgnoreDuplicateModulesMap(),this._createNodeModulesMap(),this._createSortedPathsRules(),""===this.options.baseUrl){if(this.options.nodeRequire&&this.options.nodeRequire.main&&this.options.nodeRequire.main.filename&&this._env.isNode){
-var n=this.options.nodeRequire.main.filename,o=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\"));this.options.baseUrl=n.substring(0,o+1)}if(this.options.nodeMain&&this._env.isNode){n=this.options.nodeMain,o=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\"));this.options.baseUrl=n.substring(0,o+1)}}}return t.prototype._createIgnoreDuplicateModulesMap=function(){this.ignoreDuplicateModulesMap={};for(var e=0;e<this.options.ignoreDuplicateModules.length;e++)this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[e]]=!0},t.prototype._createNodeModulesMap=function(){this.nodeModulesMap=Object.create(null);for(var e=0,t=this.options.nodeModules;e<t.length;e++){var r=t[e];this.nodeModulesMap[r]=!0}},t.prototype._createSortedPathsRules=function(){var t=this;this.sortedPathsRules=[],e.Utilities.forEachProperty(this.options.paths,(function(e,r){Array.isArray(r)?t.sortedPathsRules.push({from:e,to:r}):t.sortedPathsRules.push({from:e,to:[r]})})),this.sortedPathsRules.sort((function(e,t){
-return t.from.length-e.from.length}))},t.prototype.cloneAndMerge=function(e){return new t(this._env,r.mergeConfigurationOptions(e,this.options))},t.prototype.getOptionsLiteral=function(){return this.options},t.prototype._applyPaths=function(t){for(var r,n=0,o=this.sortedPathsRules.length;n<o;n++)if(r=this.sortedPathsRules[n],e.Utilities.startsWith(t,r.from)){for(var i=[],s=0,d=r.to.length;s<d;s++)i.push(r.to[s]+t.substr(r.from.length));return i}return[t]},t.prototype._addUrlArgsToUrl=function(t){return e.Utilities.containsQueryString(t)?t+"&"+this.options.urlArgs:t+"?"+this.options.urlArgs},t.prototype._addUrlArgsIfNecessaryToUrl=function(e){return this.options.urlArgs?this._addUrlArgsToUrl(e):e},t.prototype._addUrlArgsIfNecessaryToUrls=function(e){if(this.options.urlArgs)for(var t=0,r=e.length;t<r;t++)e[t]=this._addUrlArgsToUrl(e[t]);return e},t.prototype.moduleIdToPaths=function(t){if(!0===this.nodeModulesMap[t])return this.isBuild()?["empty:"]:["node|"+t];var r,n=t
-;if(e.Utilities.endsWith(n,".js")||e.Utilities.isAbsolutePath(n))e.Utilities.endsWith(n,".js")||e.Utilities.containsQueryString(n)||(n+=".js"),r=[n];else for(var o=0,i=(r=this._applyPaths(n)).length;o<i;o++)this.isBuild()&&"empty:"===r[o]||(e.Utilities.isAbsolutePath(r[o])||(r[o]=this.options.baseUrl+r[o]),e.Utilities.endsWith(r[o],".js")||e.Utilities.containsQueryString(r[o])||(r[o]=r[o]+".js"));return this._addUrlArgsIfNecessaryToUrls(r)},t.prototype.requireToUrl=function(t){var r=t;return e.Utilities.isAbsolutePath(r)||(r=this._applyPaths(r)[0],e.Utilities.isAbsolutePath(r)||(r=this.options.baseUrl+r)),this._addUrlArgsIfNecessaryToUrl(r)},t.prototype.isBuild=function(){return this.options.isBuild},t.prototype.isDuplicateMessageIgnoredFor=function(e){return this.ignoreDuplicateModulesMap.hasOwnProperty(e)},t.prototype.getConfigForModule=function(e){if(this.options.config)return this.options.config[e]},t.prototype.shouldCatchError=function(){return this.options.catchError},
-t.prototype.shouldRecordStats=function(){return this.options.recordStats},t.prototype.onError=function(e){this.options.onError(e)},t}();e.Configuration=n}(AMDLoader||(AMDLoader={})),function(e){var t=function(){function e(e){this._env=e,this._scriptLoader=null,this._callbackMap={}}return e.prototype.load=function(e,t,i,s){var d=this;this._scriptLoader||(this._scriptLoader=this._env.isWebWorker?new n:this._env.isNode?new o(this._env):new r);var a={callback:i,errorback:s};this._callbackMap.hasOwnProperty(t)?this._callbackMap[t].push(a):(this._callbackMap[t]=[a],this._scriptLoader.load(e,t,(function(){return d.triggerCallback(t)}),(function(e){return d.triggerErrorback(t,e)})))},e.prototype.triggerCallback=function(e){var t=this._callbackMap[e];delete this._callbackMap[e];for(var r=0;r<t.length;r++)t[r].callback()},e.prototype.triggerErrorback=function(e,t){var r=this._callbackMap[e];delete this._callbackMap[e];for(var n=0;n<r.length;n++)r[n].errorback(t)},e}(),r=function(){function e(){}
-return e.prototype.attachListeners=function(e,t,r){var n=function(){e.removeEventListener("load",o),e.removeEventListener("error",i)},o=function(e){n(),t()},i=function(e){n(),r(e)};e.addEventListener("load",o),e.addEventListener("error",i)},e.prototype.load=function(e,t,r,n){var o=document.createElement("script");o.setAttribute("async","async"),o.setAttribute("type","text/javascript"),this.attachListeners(o,r,n),o.setAttribute("src",t);var i=e.getConfig().getOptionsLiteral().cspNonce;i&&o.setAttribute("nonce",i),document.getElementsByTagName("head")[0].appendChild(o)},e}(),n=function(){function e(){}return e.prototype.load=function(e,t,r,n){try{importScripts(t),r()}catch(e){n(e)}},e}(),o=function(){function t(e){this._env=e,this._didInitialize=!1,this._didPatchNodeRequire=!1}return t.prototype._init=function(e){this._didInitialize||(this._didInitialize=!0,this._fs=e("fs"),this._vm=e("vm"),this._path=e("path"),this._crypto=e("crypto"))},t.prototype._initNodeRequire=function(e,t){
-var r=t.getConfig().getOptionsLiteral().nodeCachedData;if(r&&!this._didPatchNodeRequire){this._didPatchNodeRequire=!0;var n=this,o=e("module");o.prototype._compile=function(e,i){var s,d=o.wrap(e.replace(/^#!.*/,"")),a=t.getRecorder(),u=n._getCachedDataPath(r,i),l={filename:i};try{var c=n._fs.readFileSync(u);s=c.slice(0,16),l.cachedData=c.slice(16),a.record(60,u)}catch(e){a.record(61,u)}var h=new n._vm.Script(d,l),f=h.runInThisContext(l),p=n._path.dirname(i),_=function(e){var t=e.constructor,r=function(t){try{return e.require(t)}finally{}};return r.resolve=function(r){return t._resolveFilename(r,e)},r.main=process.mainModule,r.extensions=t._extensions,r.cache=t._cache,r}(this),g=[this.exports,_,this,i,p,process,_commonjsGlobal,Buffer],v=f.apply(this.exports,g);return n._handleCachedData(h,d,u,!l.cachedData,t),n._verifyCachedData(h,d,u,s,t),v}}},t.prototype.load=function(r,n,o,i){var s=this,d=r.getConfig().getOptionsLiteral(),a=d.nodeRequire||e.global.nodeRequire,u=d.nodeInstrumenter||function(e){return e}
-;this._init(a),this._initNodeRequire(a,r);var l=r.getRecorder();if(/^node\|/.test(n)){var c=n.split("|"),h=null;try{h=a(c[1])}catch(e){return void i(e)}r.enqueueDefineAnonymousModule([],(function(){return h})),o()}else{n=e.Utilities.fileUriToFilePath(this._env.isWindows,n);var f=this._path.normalize(n),p=this._getElectronRendererScriptPathOrUri(f),_=Boolean(d.nodeCachedData),g=_?this._getCachedDataPath(d.nodeCachedData,n):void 0;this._readSourceAndCachedData(f,g,l,(function(e,n,d,a){if(e)i(e);else{var l;l=n.charCodeAt(0)===t._BOM?t._PREFIX+n.substring(1)+t._SUFFIX:t._PREFIX+n+t._SUFFIX,l=u(l,f);var c={filename:p,cachedData:d},h=s._createAndEvalScript(r,l,c,o,i);s._handleCachedData(h,l,g,_&&!d,r),s._verifyCachedData(h,l,g,a,r)}}))}},t.prototype._createAndEvalScript=function(t,r,n,o,i){var s=t.getRecorder();s.record(31,n.filename);var d=new this._vm.Script(r,n),a=d.runInThisContext(n),u=t.getGlobalAMDDefineFunc(),l=!1,c=function(){return l=!0,u.apply(null,arguments)};return c.amd=u.amd,
-a.call(e.global,t.getGlobalAMDRequireFunc(),c,n.filename,this._path.dirname(n.filename)),s.record(32,n.filename),l?o():i(new Error("Didn't receive define call in "+n.filename+"!")),d},t.prototype._getElectronRendererScriptPathOrUri=function(e){if(!this._env.isElectronRenderer)return e;var t=e.match(/^([a-z])\:(.*)/i);return t?"file:///"+(t[1].toUpperCase()+":"+t[2]).replace(/\\/g,"/"):"file://"+e},t.prototype._getCachedDataPath=function(e,t){var r=this._crypto.createHash("md5").update(t,"utf8").update(e.seed,"utf8").digest("hex"),n=this._path.basename(t).replace(/\.js$/,"");return this._path.join(e.path,n+"-"+r+".code")},t.prototype._handleCachedData=function(e,t,r,n,o){var i=this;e.cachedDataRejected?this._fs.unlink(r,(function(n){o.getRecorder().record(62,r),i._createAndWriteCachedData(e,t,r,o),n&&o.getConfig().onError(n)})):n&&this._createAndWriteCachedData(e,t,r,o)},t.prototype._createAndWriteCachedData=function(e,t,r,n){
-var o=this,i=Math.ceil(n.getConfig().getOptionsLiteral().nodeCachedData.writeDelay*(1+Math.random())),s=-1,d=0,a=void 0,u=function(){setTimeout((function(){a||(a=o._crypto.createHash("md5").update(t,"utf8").digest());var i=e.createCachedData();0===i.length||i.length===s||d>=5||(s=i.length,o._fs.writeFile(r,Buffer.concat([a,i]),(function(e){e&&n.getConfig().onError(e),n.getRecorder().record(63,r),u()})))}),i*Math.pow(4,d++))};u()},t.prototype._readSourceAndCachedData=function(e,t,r,n){if(t){var o=void 0,i=void 0,s=void 0,d=2,a=function(e){e?n(e):0==--d&&n(void 0,o,i,s)};this._fs.readFile(e,{encoding:"utf8"},(function(e,t){o=t,a(e)})),this._fs.readFile(t,(function(e,n){!e&&n&&n.length>0?(s=n.slice(0,16),i=n.slice(16),r.record(60,t)):r.record(61,t),a()}))}else this._fs.readFile(e,{encoding:"utf8"},n)},t.prototype._verifyCachedData=function(e,t,r,n,o){var i=this;n&&(e.cachedDataRejected||setTimeout((function(){var e=i._crypto.createHash("md5").update(t,"utf8").digest()
-;n.equals(e)||(o.getConfig().onError(new Error("FAILED TO VERIFY CACHED DATA, deleting stale '"+r+"' now, but a RESTART IS REQUIRED")),i._fs.unlink(r,(function(e){return o.getConfig().onError(e)})))}),Math.ceil(5e3*(1+Math.random()))))},t._BOM=65279,t._PREFIX="(function (require, define, __filename, __dirname) { ",t._SUFFIX="\n});",t}();e.createScriptLoader=function(e){return new t(e)}}(AMDLoader||(AMDLoader={})),function(e){var t=function(){function t(e){var t=e.lastIndexOf("/");this.fromModulePath=-1!==t?e.substr(0,t+1):""}return t._normalizeModuleId=function(e){var t,r=e;for(t=/\/\.\//;t.test(r);)r=r.replace(t,"/");for(r=r.replace(/^\.\//g,""),t=/\/(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//;t.test(r);)r=r.replace(t,"/");return r=r.replace(/^(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//,"")},t.prototype.resolveModule=function(r){var n=r
-;return e.Utilities.isAbsolutePath(n)||(e.Utilities.startsWith(n,"./")||e.Utilities.startsWith(n,"../"))&&(n=t._normalizeModuleId(this.fromModulePath+n)),n},t.ROOT=new t(""),t}();e.ModuleIdResolver=t;var r=function(){function t(e,t,r,n,o,i){this.id=e,this.strId=t,this.dependencies=r,this._callback=n,this._errorback=o,this.moduleIdResolver=i,this.exports={},this.error=null,this.exportsPassedIn=!1,this.unresolvedDependenciesCount=this.dependencies.length,this._isComplete=!1}return t._safeInvokeFunction=function(t,r){try{return{returnedValue:t.apply(e.global,r),producedError:null}}catch(e){return{returnedValue:null,producedError:e}}},t._invokeFactory=function(t,r,n,o){return t.isBuild()&&!e.Utilities.isAnonymousModule(r)?{returnedValue:null,producedError:null}:t.shouldCatchError()?this._safeInvokeFunction(n,o):{returnedValue:n.apply(e.global,o),producedError:null}},t.prototype.complete=function(r,n,o){this._isComplete=!0;var i=null;if(this._callback)if("function"==typeof this._callback){r.record(21,this.strId)
-;var s=t._invokeFactory(n,this.strId,this._callback,o);i=s.producedError,r.record(22,this.strId),i||void 0===s.returnedValue||this.exportsPassedIn&&!e.Utilities.isEmpty(this.exports)||(this.exports=s.returnedValue)}else this.exports=this._callback;if(i){var d=e.ensureError(i);d.phase="factory",d.moduleId=this.strId,this.error=d,n.onError(d)}this.dependencies=null,this._callback=null,this._errorback=null,this.moduleIdResolver=null},t.prototype.onDependencyError=function(e){return this._isComplete=!0,this.error=e,!!this._errorback&&(this._errorback(e),!0)},t.prototype.isComplete=function(){return this._isComplete},t}();e.Module=r;var n=function(){function e(){this._nextId=0,this._strModuleIdToIntModuleId=new Map,this._intModuleIdToStrModuleId=[],this.getModuleId("exports"),this.getModuleId("module"),this.getModuleId("require")}return e.prototype.getMaxModuleId=function(){return this._nextId},e.prototype.getModuleId=function(e){var t=this._strModuleIdToIntModuleId.get(e);return void 0===t&&(t=this._nextId++,
-this._strModuleIdToIntModuleId.set(e,t),this._intModuleIdToStrModuleId[t]=e),t},e.prototype.getStrModuleId=function(e){return this._intModuleIdToStrModuleId[e]},e}(),o=function(){function e(e){this.id=e}return e.EXPORTS=new e(0),e.MODULE=new e(1),e.REQUIRE=new e(2),e}();e.RegularDependency=o;var i=function(e,t,r){this.id=e,this.pluginId=t,this.pluginParam=r};e.PluginDependency=i;var s=function(){function s(t,r,o,i,s){void 0===s&&(s=0),this._env=t,this._scriptLoader=r,this._loaderAvailableTimestamp=s,this._defineFunc=o,this._requireFunc=i,this._moduleIdProvider=new n,this._config=new e.Configuration(this._env),this._modules2=[],this._knownModules2=[],this._inverseDependencies2=[],this._inversePluginDependencies2=new Map,this._currentAnnonymousDefineCall=null,this._recorder=null,this._buildInfoPath=[],this._buildInfoDefineStack=[],this._buildInfoDependencies=[]}return s.prototype.reset=function(){return new s(this._env,this._scriptLoader,this._defineFunc,this._requireFunc,this._loaderAvailableTimestamp)},
-s.prototype.getGlobalAMDDefineFunc=function(){return this._defineFunc},s.prototype.getGlobalAMDRequireFunc=function(){return this._requireFunc},s._findRelevantLocationInStack=function(e,t){for(var r=function(e){return e.replace(/\\/g,"/")},n=r(e),o=t.split(/\n/),i=0;i<o.length;i++){var s=o[i].match(/(.*):(\d+):(\d+)\)?$/);if(s){var d=s[1],a=s[2],u=s[3],l=Math.max(d.lastIndexOf(" ")+1,d.lastIndexOf("(")+1);if((d=r(d=d.substr(l)))===n){var c={line:parseInt(a,10),col:parseInt(u,10)};return 1===c.line&&(c.col-="(function (require, define, __filename, __dirname) { ".length),c}}}throw new Error("Could not correlate define call site for needle "+e)},s.prototype.getBuildInfo=function(){if(!this._config.isBuild())return null;for(var e=[],t=0,r=0,n=this._modules2.length;r<n;r++){var o=this._modules2[r];if(o){var i=this._buildInfoPath[o.id]||null,d=this._buildInfoDefineStack[o.id]||null,a=this._buildInfoDependencies[o.id];e[t++]={id:o.strId,path:i,defineLocation:i&&d?s._findRelevantLocationInStack(i,d):null,
-dependencies:a,shim:null,exports:o.exports}}}return e},s.prototype.getRecorder=function(){return this._recorder||(this._config.shouldRecordStats()?this._recorder=new e.LoaderEventRecorder(this._loaderAvailableTimestamp):this._recorder=e.NullLoaderEventRecorder.INSTANCE),this._recorder},s.prototype.getLoaderEvents=function(){return this.getRecorder().getEvents()},s.prototype.enqueueDefineAnonymousModule=function(e,t){if(null!==this._currentAnnonymousDefineCall)throw new Error("Can only have one anonymous define call per script file");var r=null;this._config.isBuild()&&(r=new Error("StackLocation").stack||null),this._currentAnnonymousDefineCall={stack:r,dependencies:e,callback:t}},s.prototype.defineModule=function(e,n,o,i,s,d){var a=this;void 0===d&&(d=new t(e));var u=this._moduleIdProvider.getModuleId(e);if(this._modules2[u])this._config.isDuplicateMessageIgnoredFor(e)||console.warn("Duplicate definition of module '"+e+"'");else{var l=new r(u,e,this._normalizeDependencies(n,d),o,i,d);this._modules2[u]=l,
-this._config.isBuild()&&(this._buildInfoDefineStack[u]=s,this._buildInfoDependencies[u]=(l.dependencies||[]).map((function(e){return a._moduleIdProvider.getStrModuleId(e.id)}))),this._resolve(l)}},s.prototype._normalizeDependency=function(e,t){if("exports"===e)return o.EXPORTS;if("module"===e)return o.MODULE;if("require"===e)return o.REQUIRE;var r=e.indexOf("!");if(r>=0){var n=t.resolveModule(e.substr(0,r)),s=t.resolveModule(e.substr(r+1)),d=this._moduleIdProvider.getModuleId(n+"!"+s),a=this._moduleIdProvider.getModuleId(n);return new i(d,a,s)}return new o(this._moduleIdProvider.getModuleId(t.resolveModule(e)))},s.prototype._normalizeDependencies=function(e,t){for(var r=[],n=0,o=0,i=e.length;o<i;o++)r[n++]=this._normalizeDependency(e[o],t);return r},s.prototype._relativeRequire=function(t,r,n,o){if("string"==typeof r)return this.synchronousRequire(r,t);this.defineModule(e.Utilities.generateAnonymousModule(),r,n,o,null,t)},s.prototype.synchronousRequire=function(e,r){void 0===r&&(r=new t(e))
-;var n=this._normalizeDependency(e,r),o=this._modules2[n.id];if(!o)throw new Error("Check dependency list! Synchronous require cannot resolve module '"+e+"'. This is the first mention of this module!");if(!o.isComplete())throw new Error("Check dependency list! Synchronous require cannot resolve module '"+e+"'. This module has not been resolved completely yet.");if(o.error)throw o.error;return o.exports},s.prototype.configure=function(t,r){var n=this._config.shouldRecordStats();this._config=r?new e.Configuration(this._env,t):this._config.cloneAndMerge(t),this._config.shouldRecordStats()&&!n&&(this._recorder=null)},s.prototype.getConfig=function(){return this._config},s.prototype._onLoad=function(e){if(null!==this._currentAnnonymousDefineCall){var t=this._currentAnnonymousDefineCall;this._currentAnnonymousDefineCall=null,this.defineModule(this._moduleIdProvider.getStrModuleId(e),t.dependencies,t.callback,null,t.stack)}},s.prototype._createLoadError=function(t,r){
-var n=this,o=this._moduleIdProvider.getStrModuleId(t),i=(this._inverseDependencies2[t]||[]).map((function(e){return n._moduleIdProvider.getStrModuleId(e)})),s=e.ensureError(r);return s.phase="loading",s.moduleId=o,s.neededBy=i,s},s.prototype._onLoadError=function(e,t){var n=this._createLoadError(e,t);this._modules2[e]||(this._modules2[e]=new r(e,this._moduleIdProvider.getStrModuleId(e),[],(function(){}),(function(){}),null));for(var o=[],i=0,s=this._moduleIdProvider.getMaxModuleId();i<s;i++)o[i]=!1;var d=!1,a=[];for(a.push(e),o[e]=!0;a.length>0;){var u=a.shift(),l=this._modules2[u];l&&(d=l.onDependencyError(n)||d);var c=this._inverseDependencies2[u];if(c)for(i=0,s=c.length;i<s;i++){var h=c[i];o[h]||(a.push(h),o[h]=!0)}}d||this._config.onError(n)},s.prototype._hasDependencyPath=function(e,t){var r=this._modules2[e];if(!r)return!1;for(var n=[],o=0,i=this._moduleIdProvider.getMaxModuleId();o<i;o++)n[o]=!1;var s=[];for(s.push(r),n[e]=!0;s.length>0;){var d=s.shift().dependencies;if(d)for(o=0,i=d.length;o<i;o++){
-var a=d[o];if(a.id===t)return!0;var u=this._modules2[a.id];u&&!n[a.id]&&(n[a.id]=!0,s.push(u))}}return!1},s.prototype._findCyclePath=function(e,t,r){if(e===t||50===r)return[e];var n=this._modules2[e];if(!n)return null;var o=n.dependencies;if(o)for(var i=0,s=o.length;i<s;i++){var d=this._findCyclePath(o[i].id,t,r+1);if(null!==d)return d.push(e),d}return null},s.prototype._createRequire=function(t){var r=this,n=function(e,n,o){return r._relativeRequire(t,e,n,o)};return n.toUrl=function(e){return r._config.requireToUrl(t.resolveModule(e))},n.getStats=function(){return r.getLoaderEvents()},n.__$__nodeRequire=e.global.nodeRequire,n},s.prototype._loadModule=function(e){var t=this;if(!this._modules2[e]&&!this._knownModules2[e]){this._knownModules2[e]=!0;var r=this._moduleIdProvider.getStrModuleId(e),n=this._config.moduleIdToPaths(r);this._env.isNode&&(-1===r.indexOf("/")||/^@[^\/]+\/[^\/]+$/.test(r))&&n.push("node|"+r);var o=-1,i=function(r){if(++o>=n.length)t._onLoadError(e,r);else{var s=n[o],d=t.getRecorder()
-;if(t._config.isBuild()&&"empty:"===s)return t._buildInfoPath[e]=s,t.defineModule(t._moduleIdProvider.getStrModuleId(e),[],null,null,null),void t._onLoad(e);d.record(10,s),t._scriptLoader.load(t,s,(function(){t._config.isBuild()&&(t._buildInfoPath[e]=s),d.record(11,s),t._onLoad(e)}),(function(e){d.record(12,s),i(e)}))}};i(null)}},s.prototype._loadPluginDependency=function(e,r){var n=this;if(!this._modules2[r.id]&&!this._knownModules2[r.id]){this._knownModules2[r.id]=!0;var o=function(e){n.defineModule(n._moduleIdProvider.getStrModuleId(r.id),[],e,null,null)};o.error=function(e){n._config.onError(n._createLoadError(r.id,e))},e.load(r.pluginParam,this._createRequire(t.ROOT),o,this._config.getOptionsLiteral())}},s.prototype._resolve=function(e){var t=this,r=e.dependencies;if(r)for(var n=0,s=r.length;n<s;n++){var d=r[n];if(d!==o.EXPORTS)if(d!==o.MODULE)if(d!==o.REQUIRE){var a=this._modules2[d.id];if(a&&a.isComplete()){if(a.error)return void e.onDependencyError(a.error);e.unresolvedDependenciesCount--
-}else if(this._hasDependencyPath(d.id,e.id)){console.warn("There is a dependency cycle between '"+this._moduleIdProvider.getStrModuleId(d.id)+"' and '"+this._moduleIdProvider.getStrModuleId(e.id)+"'. The cyclic path follows:");var u=this._findCyclePath(d.id,e.id,0)||[];u.reverse(),u.push(d.id),console.warn(u.map((function(e){return t._moduleIdProvider.getStrModuleId(e)})).join(" => \n")),e.unresolvedDependenciesCount--}else if(this._inverseDependencies2[d.id]=this._inverseDependencies2[d.id]||[],this._inverseDependencies2[d.id].push(e.id),d instanceof i){var l=this._modules2[d.pluginId];if(l&&l.isComplete()){this._loadPluginDependency(l.exports,d);continue}var c=this._inversePluginDependencies2.get(d.pluginId);c||(c=[],this._inversePluginDependencies2.set(d.pluginId,c)),c.push(d),this._loadModule(d.pluginId)}else this._loadModule(d.id)}else e.unresolvedDependenciesCount--;else e.unresolvedDependenciesCount--;else e.exportsPassedIn=!0,e.unresolvedDependenciesCount--}
-0===e.unresolvedDependenciesCount&&this._onModuleComplete(e)},s.prototype._onModuleComplete=function(e){var t=this,r=this.getRecorder();if(!e.isComplete()){var n=e.dependencies,i=[];if(n)for(var s=0,d=n.length;s<d;s++){var a=n[s];if(a!==o.EXPORTS)if(a!==o.MODULE)if(a!==o.REQUIRE){var u=this._modules2[a.id];i[s]=u?u.exports:null}else i[s]=this._createRequire(e.moduleIdResolver);else i[s]={id:e.strId,config:function(){return t._config.getConfigForModule(e.strId)}};else i[s]=e.exports}e.complete(r,this._config,i);var l=this._inverseDependencies2[e.id];if(this._inverseDependencies2[e.id]=null,l)for(s=0,d=l.length;s<d;s++){var c=l[s],h=this._modules2[c];h.unresolvedDependenciesCount--,0===h.unresolvedDependenciesCount&&this._onModuleComplete(h)}var f=this._inversePluginDependencies2.get(e.id);if(f){this._inversePluginDependencies2.delete(e.id);for(s=0,d=f.length;s<d;s++)this._loadPluginDependency(e.exports,f[s])}}},s}();e.ModuleManager=s}(AMDLoader||(AMDLoader={})),function(e){
-var t=new e.Environment,r=null,n=function(e,t,n){"string"!=typeof e&&(n=t,t=e,e=null),"object"==typeof t&&Array.isArray(t)||(n=t,t=null),t||(t=["require","exports","module"]),e?r.defineModule(e,t,n,null,null):r.enqueueDefineAnonymousModule(t,n)};n.amd={jQuery:!0};var o=function(e,t){void 0===t&&(t=!1),r.configure(e,t)},i=function(){if(1===arguments.length){if(arguments[0]instanceof Object&&!Array.isArray(arguments[0]))return void o(arguments[0]);if("string"==typeof arguments[0])return r.synchronousRequire(arguments[0])}if(2!==arguments.length&&3!==arguments.length||!Array.isArray(arguments[0]))throw new Error("Unrecognized require call");r.defineModule(e.Utilities.generateAnonymousModule(),arguments[0],arguments[1],arguments[2],null)};function s(){if(void 0!==e.global.require||"undefined"!=typeof require){var o=e.global.require||require;if("function"==typeof o&&"function"==typeof o.resolve){var s=function(e){r.getRecorder().record(33,e);try{return o(e)}finally{r.getRecorder().record(34,e)}}
-;e.global.nodeRequire=s,i.nodeRequire=s,i.__$__nodeRequire=s}}t.isNode&&!t.isElectronRenderer?(module.exports=i,require=i):(t.isElectronRenderer||(e.global.define=n),e.global.require=i)}i.config=o,i.getConfig=function(){return r.getConfig().getOptionsLiteral()},i.reset=function(){r=r.reset()},i.getBuildInfo=function(){return r.getBuildInfo()},i.getStats=function(){return r.getLoaderEvents()},i.define=function(){return n.apply(null,arguments)},e.init=s,"function"==typeof e.global.define&&e.global.define.amd||(r=new e.ModuleManager(t,e.createScriptLoader(t),n,i,e.Utilities.getHighPerformanceTimestamp()),void 0!==e.global.require&&"function"!=typeof e.global.require&&i.config(e.global.require),(define=function(){return n.apply(null,arguments)}).amd=n.amd,"undefined"==typeof doNotInitLoader&&s())}(AMDLoader||(AMDLoader={}));
-//# sourceMappingURL=../../min-maps/vs/loader.js.map
+
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+'use strict';
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *--------------------------------------------------------------------------------------------*/
+var _amdLoaderGlobal = this;
+var _commonjsGlobal = typeof global === 'object' ? global : {};
+var AMDLoader;
+(function (AMDLoader) {
+    AMDLoader.global = _amdLoaderGlobal;
+    var Environment = /** @class */ (function () {
+        function Environment() {
+            this._detected = false;
+            this._isWindows = false;
+            this._isNode = false;
+            this._isElectronRenderer = false;
+            this._isWebWorker = false;
+        }
+        Object.defineProperty(Environment.prototype, "isWindows", {
+            get: function () {
+                this._detect();
+                return this._isWindows;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Environment.prototype, "isNode", {
+            get: function () {
+                this._detect();
+                return this._isNode;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Environment.prototype, "isElectronRenderer", {
+            get: function () {
+                this._detect();
+                return this._isElectronRenderer;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Environment.prototype, "isWebWorker", {
+            get: function () {
+                this._detect();
+                return this._isWebWorker;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Environment.prototype._detect = function () {
+            if (this._detected) {
+                return;
+            }
+            this._detected = true;
+            this._isWindows = Environment._isWindows();
+            this._isNode = (typeof module !== 'undefined' && !!module.exports);
+            this._isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer');
+            this._isWebWorker = (typeof AMDLoader.global.importScripts === 'function');
+        };
+        Environment._isWindows = function () {
+            if (typeof navigator !== 'undefined') {
+                if (navigator.userAgent && navigator.userAgent.indexOf('Windows') >= 0) {
+                    return true;
+                }
+            }
+            if (typeof process !== 'undefined') {
+                return (process.platform === 'win32');
+            }
+            return false;
+        };
+        return Environment;
+    }());
+    AMDLoader.Environment = Environment;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    var LoaderEvent = /** @class */ (function () {
+        function LoaderEvent(type, detail, timestamp) {
+            this.type = type;
+            this.detail = detail;
+            this.timestamp = timestamp;
+        }
+        return LoaderEvent;
+    }());
+    AMDLoader.LoaderEvent = LoaderEvent;
+    var LoaderEventRecorder = /** @class */ (function () {
+        function LoaderEventRecorder(loaderAvailableTimestamp) {
+            this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)];
+        }
+        LoaderEventRecorder.prototype.record = function (type, detail) {
+            this._events.push(new LoaderEvent(type, detail, AMDLoader.Utilities.getHighPerformanceTimestamp()));
+        };
+        LoaderEventRecorder.prototype.getEvents = function () {
+            return this._events;
+        };
+        return LoaderEventRecorder;
+    }());
+    AMDLoader.LoaderEventRecorder = LoaderEventRecorder;
+    var NullLoaderEventRecorder = /** @class */ (function () {
+        function NullLoaderEventRecorder() {
+        }
+        NullLoaderEventRecorder.prototype.record = function (type, detail) {
+            // Nothing to do
+        };
+        NullLoaderEventRecorder.prototype.getEvents = function () {
+            return [];
+        };
+        NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
+        return NullLoaderEventRecorder;
+    }());
+    AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    var Utilities = /** @class */ (function () {
+        function Utilities() {
+        }
+        /**
+         * This method does not take care of / vs \
+         */
+        Utilities.fileUriToFilePath = function (isWindows, uri) {
+            uri = decodeURI(uri).replace(/%23/g, '#');
+            if (isWindows) {
+                if (/^file:\/\/\//.test(uri)) {
+                    // This is a URI without a hostname => return only the path segment
+                    return uri.substr(8);
+                }
+                if (/^file:\/\//.test(uri)) {
+                    return uri.substr(5);
+                }
+            }
+            else {
+                if (/^file:\/\//.test(uri)) {
+                    return uri.substr(7);
+                }
+            }
+            // Not sure...
+            return uri;
+        };
+        Utilities.startsWith = function (haystack, needle) {
+            return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;
+        };
+        Utilities.endsWith = function (haystack, needle) {
+            return haystack.length >= needle.length && haystack.substr(haystack.length - needle.length) === needle;
+        };
+        // only check for "?" before "#" to ensure that there is a real Query-String
+        Utilities.containsQueryString = function (url) {
+            return /^[^\#]*\?/gi.test(url);
+        };
+        /**
+         * Does `url` start with http:// or https:// or file:// or / ?
+         */
+        Utilities.isAbsolutePath = function (url) {
+            return /^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(url);
+        };
+        Utilities.forEachProperty = function (obj, callback) {
+            if (obj) {
+                var key = void 0;
+                for (key in obj) {
+                    if (obj.hasOwnProperty(key)) {
+                        callback(key, obj[key]);
+                    }
+                }
+            }
+        };
+        Utilities.isEmpty = function (obj) {
+            var isEmpty = true;
+            Utilities.forEachProperty(obj, function () {
+                isEmpty = false;
+            });
+            return isEmpty;
+        };
+        Utilities.recursiveClone = function (obj) {
+            if (!obj || typeof obj !== 'object') {
+                return obj;
+            }
+            var result = Array.isArray(obj) ? [] : {};
+            Utilities.forEachProperty(obj, function (key, value) {
+                if (value && typeof value === 'object') {
+                    result[key] = Utilities.recursiveClone(value);
+                }
+                else {
+                    result[key] = value;
+                }
+            });
+            return result;
+        };
+        Utilities.generateAnonymousModule = function () {
+            return '===anonymous' + (Utilities.NEXT_ANONYMOUS_ID++) + '===';
+        };
+        Utilities.isAnonymousModule = function (id) {
+            return Utilities.startsWith(id, '===anonymous');
+        };
+        Utilities.getHighPerformanceTimestamp = function () {
+            if (!this.PERFORMANCE_NOW_PROBED) {
+                this.PERFORMANCE_NOW_PROBED = true;
+                this.HAS_PERFORMANCE_NOW = (AMDLoader.global.performance && typeof AMDLoader.global.performance.now === 'function');
+            }
+            return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now());
+        };
+        Utilities.NEXT_ANONYMOUS_ID = 1;
+        Utilities.PERFORMANCE_NOW_PROBED = false;
+        Utilities.HAS_PERFORMANCE_NOW = false;
+        return Utilities;
+    }());
+    AMDLoader.Utilities = Utilities;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    function ensureError(err) {
+        if (err instanceof Error) {
+            return err;
+        }
+        var result = new Error(err.message || String(err) || 'Unknown Error');
+        if (err.stack) {
+            result.stack = err.stack;
+        }
+        return result;
+    }
+    AMDLoader.ensureError = ensureError;
+    ;
+    var ConfigurationOptionsUtil = /** @class */ (function () {
+        function ConfigurationOptionsUtil() {
+        }
+        /**
+         * Ensure configuration options make sense
+         */
+        ConfigurationOptionsUtil.validateConfigurationOptions = function (options) {
+            function defaultOnError(err) {
+                if (err.phase === 'loading') {
+                    console.error('Loading "' + err.moduleId + '" failed');
+                    console.error(err);
+                    console.error('Here are the modules that depend on it:');
+                    console.error(err.neededBy);
+                    return;
+                }
+                if (err.phase === 'factory') {
+                    console.error('The factory method of "' + err.moduleId + '" has thrown an exception');
+                    console.error(err);
+                    return;
+                }
+            }
+            options = options || {};
+            if (typeof options.baseUrl !== 'string') {
+                options.baseUrl = '';
+            }
+            if (typeof options.isBuild !== 'boolean') {
+                options.isBuild = false;
+            }
+            if (typeof options.paths !== 'object') {
+                options.paths = {};
+            }
+            if (typeof options.config !== 'object') {
+                options.config = {};
+            }
+            if (typeof options.catchError === 'undefined') {
+                options.catchError = false;
+            }
+            if (typeof options.recordStats === 'undefined') {
+                options.recordStats = false;
+            }
+            if (typeof options.urlArgs !== 'string') {
+                options.urlArgs = '';
+            }
+            if (typeof options.onError !== 'function') {
+                options.onError = defaultOnError;
+            }
+            if (!Array.isArray(options.ignoreDuplicateModules)) {
+                options.ignoreDuplicateModules = [];
+            }
+            if (options.baseUrl.length > 0) {
+                if (!AMDLoader.Utilities.endsWith(options.baseUrl, '/')) {
+                    options.baseUrl += '/';
+                }
+            }
+            if (typeof options.cspNonce !== 'string') {
+                options.cspNonce = '';
+            }
+            if (!Array.isArray(options.nodeModules)) {
+                options.nodeModules = [];
+            }
+            if (options.nodeCachedData && typeof options.nodeCachedData === 'object') {
+                if (typeof options.nodeCachedData.seed !== 'string') {
+                    options.nodeCachedData.seed = 'seed';
+                }
+                if (typeof options.nodeCachedData.writeDelay !== 'number' || options.nodeCachedData.writeDelay < 0) {
+                    options.nodeCachedData.writeDelay = 1000 * 7;
+                }
+                if (!options.nodeCachedData.path || typeof options.nodeCachedData.path !== 'string') {
+                    var err = ensureError(new Error('INVALID cached data configuration, \'path\' MUST be set'));
+                    err.phase = 'configuration';
+                    options.onError(err);
+                    options.nodeCachedData = undefined;
+                }
+            }
+            return options;
+        };
+        ConfigurationOptionsUtil.mergeConfigurationOptions = function (overwrite, base) {
+            if (overwrite === void 0) { overwrite = null; }
+            if (base === void 0) { base = null; }
+            var result = AMDLoader.Utilities.recursiveClone(base || {});
+            // Merge known properties and overwrite the unknown ones
+            AMDLoader.Utilities.forEachProperty(overwrite, function (key, value) {
+                if (key === 'ignoreDuplicateModules' && typeof result.ignoreDuplicateModules !== 'undefined') {
+                    result.ignoreDuplicateModules = result.ignoreDuplicateModules.concat(value);
+                }
+                else if (key === 'paths' && typeof result.paths !== 'undefined') {
+                    AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.paths[key2] = value2; });
+                }
+                else if (key === 'config' && typeof result.config !== 'undefined') {
+                    AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.config[key2] = value2; });
+                }
+                else {
+                    result[key] = AMDLoader.Utilities.recursiveClone(value);
+                }
+            });
+            return ConfigurationOptionsUtil.validateConfigurationOptions(result);
+        };
+        return ConfigurationOptionsUtil;
+    }());
+    AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;
+    var Configuration = /** @class */ (function () {
+        function Configuration(env, options) {
+            this._env = env;
+            this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options);
+            this._createIgnoreDuplicateModulesMap();
+            this._createNodeModulesMap();
+            this._createSortedPathsRules();
+            if (this.options.baseUrl === '') {
+                if (this.options.nodeRequire && this.options.nodeRequire.main && this.options.nodeRequire.main.filename && this._env.isNode) {
+                    var nodeMain = this.options.nodeRequire.main.filename;
+                    var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\'));
+                    this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1);
+                }
+                if (this.options.nodeMain && this._env.isNode) {
+                    var nodeMain = this.options.nodeMain;
+                    var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\'));
+                    this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1);
+                }
+            }
+        }
+        Configuration.prototype._createIgnoreDuplicateModulesMap = function () {
+            // Build a map out of the ignoreDuplicateModules array
+            this.ignoreDuplicateModulesMap = {};
+            for (var i = 0; i < this.options.ignoreDuplicateModules.length; i++) {
+                this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[i]] = true;
+            }
+        };
+        Configuration.prototype._createNodeModulesMap = function () {
+            // Build a map out of nodeModules array
+            this.nodeModulesMap = Object.create(null);
+            for (var _i = 0, _a = this.options.nodeModules; _i < _a.length; _i++) {
+                var nodeModule = _a[_i];
+                this.nodeModulesMap[nodeModule] = true;
+            }
+        };
+        Configuration.prototype._createSortedPathsRules = function () {
+            var _this = this;
+            // Create an array our of the paths rules, sorted descending by length to
+            // result in a more specific -> less specific order
+            this.sortedPathsRules = [];
+            AMDLoader.Utilities.forEachProperty(this.options.paths, function (from, to) {
+                if (!Array.isArray(to)) {
+                    _this.sortedPathsRules.push({
+                        from: from,
+                        to: [to]
+                    });
+                }
+                else {
+                    _this.sortedPathsRules.push({
+                        from: from,
+                        to: to
+                    });
+                }
+            });
+            this.sortedPathsRules.sort(function (a, b) {
+                return b.from.length - a.from.length;
+            });
+        };
+        /**
+         * Clone current configuration and overwrite options selectively.
+         * @param options The selective options to overwrite with.
+         * @result A new configuration
+         */
+        Configuration.prototype.cloneAndMerge = function (options) {
+            return new Configuration(this._env, ConfigurationOptionsUtil.mergeConfigurationOptions(options, this.options));
+        };
+        /**
+         * Get current options bag. Useful for passing it forward to plugins.
+         */
+        Configuration.prototype.getOptionsLiteral = function () {
+            return this.options;
+        };
+        Configuration.prototype._applyPaths = function (moduleId) {
+            var pathRule;
+            for (var i = 0, len = this.sortedPathsRules.length; i < len; i++) {
+                pathRule = this.sortedPathsRules[i];
+                if (AMDLoader.Utilities.startsWith(moduleId, pathRule.from)) {
+                    var result = [];
+                    for (var j = 0, lenJ = pathRule.to.length; j < lenJ; j++) {
+                        result.push(pathRule.to[j] + moduleId.substr(pathRule.from.length));
+                    }
+                    return result;
+                }
+            }
+            return [moduleId];
+        };
+        Configuration.prototype._addUrlArgsToUrl = function (url) {
+            if (AMDLoader.Utilities.containsQueryString(url)) {
+                return url + '&' + this.options.urlArgs;
+            }
+            else {
+                return url + '?' + this.options.urlArgs;
+            }
+        };
+        Configuration.prototype._addUrlArgsIfNecessaryToUrl = function (url) {
+            if (this.options.urlArgs) {
+                return this._addUrlArgsToUrl(url);
+            }
+            return url;
+        };
+        Configuration.prototype._addUrlArgsIfNecessaryToUrls = function (urls) {
+            if (this.options.urlArgs) {
+                for (var i = 0, len = urls.length; i < len; i++) {
+                    urls[i] = this._addUrlArgsToUrl(urls[i]);
+                }
+            }
+            return urls;
+        };
+        /**
+         * Transform a module id to a location. Appends .js to module ids
+         */
+        Configuration.prototype.moduleIdToPaths = function (moduleId) {
+            if (this.nodeModulesMap[moduleId] === true) {
+                // This is a node module...
+                if (this.isBuild()) {
+                    // ...and we are at build time, drop it
+                    return ['empty:'];
+                }
+                else {
+                    // ...and at runtime we create a `shortcut`-path
+                    return ['node|' + moduleId];
+                }
+            }
+            var result = moduleId;
+            var results;
+            if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.isAbsolutePath(result)) {
+                results = this._applyPaths(result);
+                for (var i = 0, len = results.length; i < len; i++) {
+                    if (this.isBuild() && results[i] === 'empty:') {
+                        continue;
+                    }
+                    if (!AMDLoader.Utilities.isAbsolutePath(results[i])) {
+                        results[i] = this.options.baseUrl + results[i];
+                    }
+                    if (!AMDLoader.Utilities.endsWith(results[i], '.js') && !AMDLoader.Utilities.containsQueryString(results[i])) {
+                        results[i] = results[i] + '.js';
+                    }
+                }
+            }
+            else {
+                if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.containsQueryString(result)) {
+                    result = result + '.js';
+                }
+                results = [result];
+            }
+            return this._addUrlArgsIfNecessaryToUrls(results);
+        };
+        /**
+         * Transform a module id or url to a location.
+         */
+        Configuration.prototype.requireToUrl = function (url) {
+            var result = url;
+            if (!AMDLoader.Utilities.isAbsolutePath(result)) {
+                result = this._applyPaths(result)[0];
+                if (!AMDLoader.Utilities.isAbsolutePath(result)) {
+                    result = this.options.baseUrl + result;
+                }
+            }
+            return this._addUrlArgsIfNecessaryToUrl(result);
+        };
+        /**
+         * Flag to indicate if current execution is as part of a build.
+         */
+        Configuration.prototype.isBuild = function () {
+            return this.options.isBuild;
+        };
+        /**
+         * Test if module `moduleId` is expected to be defined multiple times
+         */
+        Configuration.prototype.isDuplicateMessageIgnoredFor = function (moduleId) {
+            return this.ignoreDuplicateModulesMap.hasOwnProperty(moduleId);
+        };
+        /**
+         * Get the configuration settings for the provided module id
+         */
+        Configuration.prototype.getConfigForModule = function (moduleId) {
+            if (this.options.config) {
+                return this.options.config[moduleId];
+            }
+        };
+        /**
+         * Should errors be caught when executing module factories?
+         */
+        Configuration.prototype.shouldCatchError = function () {
+            return this.options.catchError;
+        };
+        /**
+         * Should statistics be recorded?
+         */
+        Configuration.prototype.shouldRecordStats = function () {
+            return this.options.recordStats;
+        };
+        /**
+         * Forward an error to the error handler.
+         */
+        Configuration.prototype.onError = function (err) {
+            this.options.onError(err);
+        };
+        return Configuration;
+    }());
+    AMDLoader.Configuration = Configuration;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    /**
+     * Load `scriptSrc` only once (avoid multiple <script> tags)
+     */
+    var OnlyOnceScriptLoader = /** @class */ (function () {
+        function OnlyOnceScriptLoader(env) {
+            this._env = env;
+            this._scriptLoader = null;
+            this._callbackMap = {};
+        }
+        OnlyOnceScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            var _this = this;
+            if (!this._scriptLoader) {
+                this._scriptLoader = (this._env.isWebWorker
+                    ? new WorkerScriptLoader()
+                    : this._env.isNode
+                        ? new NodeScriptLoader(this._env)
+                        : new BrowserScriptLoader());
+            }
+            var scriptCallbacks = {
+                callback: callback,
+                errorback: errorback
+            };
+            if (this._callbackMap.hasOwnProperty(scriptSrc)) {
+                this._callbackMap[scriptSrc].push(scriptCallbacks);
+                return;
+            }
+            this._callbackMap[scriptSrc] = [scriptCallbacks];
+            this._scriptLoader.load(moduleManager, scriptSrc, function () { return _this.triggerCallback(scriptSrc); }, function (err) { return _this.triggerErrorback(scriptSrc, err); });
+        };
+        OnlyOnceScriptLoader.prototype.triggerCallback = function (scriptSrc) {
+            var scriptCallbacks = this._callbackMap[scriptSrc];
+            delete this._callbackMap[scriptSrc];
+            for (var i = 0; i < scriptCallbacks.length; i++) {
+                scriptCallbacks[i].callback();
+            }
+        };
+        OnlyOnceScriptLoader.prototype.triggerErrorback = function (scriptSrc, err) {
+            var scriptCallbacks = this._callbackMap[scriptSrc];
+            delete this._callbackMap[scriptSrc];
+            for (var i = 0; i < scriptCallbacks.length; i++) {
+                scriptCallbacks[i].errorback(err);
+            }
+        };
+        return OnlyOnceScriptLoader;
+    }());
+    var BrowserScriptLoader = /** @class */ (function () {
+        function BrowserScriptLoader() {
+        }
+        /**
+         * Attach load / error listeners to a script element and remove them when either one has fired.
+         * Implemented for browssers supporting HTML5 standard 'load' and 'error' events.
+         */
+        BrowserScriptLoader.prototype.attachListeners = function (script, callback, errorback) {
+            var unbind = function () {
+                script.removeEventListener('load', loadEventListener);
+                script.removeEventListener('error', errorEventListener);
+            };
+            var loadEventListener = function (e) {
+                unbind();
+                callback();
+            };
+            var errorEventListener = function (e) {
+                unbind();
+                errorback(e);
+            };
+            script.addEventListener('load', loadEventListener);
+            script.addEventListener('error', errorEventListener);
+        };
+        BrowserScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            var script = document.createElement('script');
+            script.setAttribute('async', 'async');
+            script.setAttribute('type', 'text/javascript');
+            this.attachListeners(script, callback, errorback);
+            script.setAttribute('src', scriptSrc);
+            // Propagate CSP nonce to dynamically created script tag.
+            var cspNonce = moduleManager.getConfig().getOptionsLiteral().cspNonce;
+            if (cspNonce) {
+                script.setAttribute('nonce', cspNonce);
+            }
+            document.getElementsByTagName('head')[0].appendChild(script);
+        };
+        return BrowserScriptLoader;
+    }());
+    var WorkerScriptLoader = /** @class */ (function () {
+        function WorkerScriptLoader() {
+        }
+        WorkerScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            try {
+                importScripts(scriptSrc);
+                callback();
+            }
+            catch (e) {
+                errorback(e);
+            }
+        };
+        return WorkerScriptLoader;
+    }());
+    var NodeScriptLoader = /** @class */ (function () {
+        function NodeScriptLoader(env) {
+            this._env = env;
+            this._didInitialize = false;
+            this._didPatchNodeRequire = false;
+        }
+        NodeScriptLoader.prototype._init = function (nodeRequire) {
+            if (this._didInitialize) {
+                return;
+            }
+            this._didInitialize = true;
+            // capture node modules
+            this._fs = nodeRequire('fs');
+            this._vm = nodeRequire('vm');
+            this._path = nodeRequire('path');
+            this._crypto = nodeRequire('crypto');
+        };
+        // patch require-function of nodejs such that we can manually create a script
+        // from cached data. this is done by overriding the `Module._compile` function
+        NodeScriptLoader.prototype._initNodeRequire = function (nodeRequire, moduleManager) {
+            // It is important to check for `nodeCachedData` first and then set `_didPatchNodeRequire`.
+            // That's because `nodeCachedData` is set _after_ calling this for the first time...
+            var nodeCachedData = moduleManager.getConfig().getOptionsLiteral().nodeCachedData;
+            if (!nodeCachedData) {
+                return;
+            }
+            if (this._didPatchNodeRequire) {
+                return;
+            }
+            this._didPatchNodeRequire = true;
+            var that = this;
+            var Module = nodeRequire('module');
+            function makeRequireFunction(mod) {
+                var Module = mod.constructor;
+                var require = function require(path) {
+                    try {
+                        return mod.require(path);
+                    }
+                    finally {
+                        // nothing
+                    }
+                };
+                require.resolve = function resolve(request) {
+                    return Module._resolveFilename(request, mod);
+                };
+                require.main = process.mainModule;
+                require.extensions = Module._extensions;
+                require.cache = Module._cache;
+                return require;
+            }
+            Module.prototype._compile = function (content, filename) {
+                // remove shebang and create wrapper function
+                var scriptSource = Module.wrap(content.replace(/^#!.*/, ''));
+                // create script
+                var recorder = moduleManager.getRecorder();
+                var cachedDataPath = that._getCachedDataPath(nodeCachedData, filename);
+                var options = { filename: filename };
+                var hashData;
+                try {
+                    var data = that._fs.readFileSync(cachedDataPath);
+                    hashData = data.slice(0, 16);
+                    options.cachedData = data.slice(16);
+                    recorder.record(60 /* CachedDataFound */, cachedDataPath);
+                }
+                catch (_e) {
+                    recorder.record(61 /* CachedDataMissed */, cachedDataPath);
+                }
+                var script = new that._vm.Script(scriptSource, options);
+                var compileWrapper = script.runInThisContext(options);
+                // run script
+                var dirname = that._path.dirname(filename);
+                var require = makeRequireFunction(this);
+                var args = [this.exports, require, this, filename, dirname, process, _commonjsGlobal, Buffer];
+                var result = compileWrapper.apply(this.exports, args);
+                // cached data aftermath
+                that._handleCachedData(script, scriptSource, cachedDataPath, !options.cachedData, moduleManager);
+                that._verifyCachedData(script, scriptSource, cachedDataPath, hashData, moduleManager);
+                return result;
+            };
+        };
+        NodeScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            var _this = this;
+            var opts = moduleManager.getConfig().getOptionsLiteral();
+            var nodeRequire = (opts.nodeRequire || AMDLoader.global.nodeRequire);
+            var nodeInstrumenter = (opts.nodeInstrumenter || function (c) { return c; });
+            this._init(nodeRequire);
+            this._initNodeRequire(nodeRequire, moduleManager);
+            var recorder = moduleManager.getRecorder();
+            if (/^node\|/.test(scriptSrc)) {
+                var pieces = scriptSrc.split('|');
+                var moduleExports_1 = null;
+                try {
+                    moduleExports_1 = nodeRequire(pieces[1]);
+                }
+                catch (err) {
+                    errorback(err);
+                    return;
+                }
+                moduleManager.enqueueDefineAnonymousModule([], function () { return moduleExports_1; });
+                callback();
+            }
+            else {
+                scriptSrc = AMDLoader.Utilities.fileUriToFilePath(this._env.isWindows, scriptSrc);
+                var normalizedScriptSrc_1 = this._path.normalize(scriptSrc);
+                var vmScriptPathOrUri_1 = this._getElectronRendererScriptPathOrUri(normalizedScriptSrc_1);
+                var wantsCachedData_1 = Boolean(opts.nodeCachedData);
+                var cachedDataPath_1 = wantsCachedData_1 ? this._getCachedDataPath(opts.nodeCachedData, scriptSrc) : undefined;
+                this._readSourceAndCachedData(normalizedScriptSrc_1, cachedDataPath_1, recorder, function (err, data, cachedData, hashData) {
+                    if (err) {
+                        errorback(err);
+                        return;
+                    }
+                    var scriptSource;
+                    if (data.charCodeAt(0) === NodeScriptLoader._BOM) {
+                        scriptSource = NodeScriptLoader._PREFIX + data.substring(1) + NodeScriptLoader._SUFFIX;
+                    }
+                    else {
+                        scriptSource = NodeScriptLoader._PREFIX + data + NodeScriptLoader._SUFFIX;
+                    }
+                    scriptSource = nodeInstrumenter(scriptSource, normalizedScriptSrc_1);
+                    var scriptOpts = { filename: vmScriptPathOrUri_1, cachedData: cachedData };
+                    var script = _this._createAndEvalScript(moduleManager, scriptSource, scriptOpts, callback, errorback);
+                    _this._handleCachedData(script, scriptSource, cachedDataPath_1, wantsCachedData_1 && !cachedData, moduleManager);
+                    _this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData, moduleManager);
+                });
+            }
+        };
+        NodeScriptLoader.prototype._createAndEvalScript = function (moduleManager, contents, options, callback, errorback) {
+            var recorder = moduleManager.getRecorder();
+            recorder.record(31 /* NodeBeginEvaluatingScript */, options.filename);
+            var script = new this._vm.Script(contents, options);
+            var ret = script.runInThisContext(options);
+            var globalDefineFunc = moduleManager.getGlobalAMDDefineFunc();
+            var receivedDefineCall = false;
+            var localDefineFunc = function () {
+                receivedDefineCall = true;
+                return globalDefineFunc.apply(null, arguments);
+            };
+            localDefineFunc.amd = globalDefineFunc.amd;
+            ret.call(AMDLoader.global, moduleManager.getGlobalAMDRequireFunc(), localDefineFunc, options.filename, this._path.dirname(options.filename));
+            recorder.record(32 /* NodeEndEvaluatingScript */, options.filename);
+            if (receivedDefineCall) {
+                callback();
+            }
+            else {
+                errorback(new Error("Didn't receive define call in " + options.filename + "!"));
+            }
+            return script;
+        };
+        NodeScriptLoader.prototype._getElectronRendererScriptPathOrUri = function (path) {
+            if (!this._env.isElectronRenderer) {
+                return path;
+            }
+            var driveLetterMatch = path.match(/^([a-z])\:(.*)/i);
+            if (driveLetterMatch) {
+                // windows
+                return "file:///" + (driveLetterMatch[1].toUpperCase() + ':' + driveLetterMatch[2]).replace(/\\/g, '/');
+            }
+            else {
+                // nix
+                return "file://" + path;
+            }
+        };
+        NodeScriptLoader.prototype._getCachedDataPath = function (config, filename) {
+            var hash = this._crypto.createHash('md5').update(filename, 'utf8').update(config.seed, 'utf8').digest('hex');
+            var basename = this._path.basename(filename).replace(/\.js$/, '');
+            return this._path.join(config.path, basename + "-" + hash + ".code");
+        };
+        NodeScriptLoader.prototype._handleCachedData = function (script, scriptSource, cachedDataPath, createCachedData, moduleManager) {
+            var _this = this;
+            if (script.cachedDataRejected) {
+                // cached data got rejected -> delete and re-create
+                this._fs.unlink(cachedDataPath, function (err) {
+                    moduleManager.getRecorder().record(62 /* CachedDataRejected */, cachedDataPath);
+                    _this._createAndWriteCachedData(script, scriptSource, cachedDataPath, moduleManager);
+                    if (err) {
+                        moduleManager.getConfig().onError(err);
+                    }
+                });
+            }
+            else if (createCachedData) {
+                // no cached data, but wanted
+                this._createAndWriteCachedData(script, scriptSource, cachedDataPath, moduleManager);
+            }
+        };
+        // Cached data format: | SOURCE_HASH | V8_CACHED_DATA |
+        // -SOURCE_HASH is the md5 hash of the JS source (always 16 bytes)
+        // -V8_CACHED_DATA is what v8 produces
+        NodeScriptLoader.prototype._createAndWriteCachedData = function (script, scriptSource, cachedDataPath, moduleManager) {
+            var _this = this;
+            var timeout = Math.ceil(moduleManager.getConfig().getOptionsLiteral().nodeCachedData.writeDelay * (1 + Math.random()));
+            var lastSize = -1;
+            var iteration = 0;
+            var hashData = undefined;
+            var createLoop = function () {
+                setTimeout(function () {
+                    if (!hashData) {
+                        hashData = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();
+                    }
+                    var cachedData = script.createCachedData();
+                    if (cachedData.length === 0 || cachedData.length === lastSize || iteration >= 5) {
+                        return;
+                    }
+                    lastSize = cachedData.length;
+                    _this._fs.writeFile(cachedDataPath, Buffer.concat([hashData, cachedData]), function (err) {
+                        if (err) {
+                            moduleManager.getConfig().onError(err);
+                        }
+                        moduleManager.getRecorder().record(63 /* CachedDataCreated */, cachedDataPath);
+                        createLoop();
+                    });
+                }, timeout * (Math.pow(4, iteration++)));
+            };
+            // with some delay (`timeout`) create cached data
+            // and repeat that (with backoff delay) until the
+            // data seems to be not changing anymore
+            createLoop();
+        };
+        NodeScriptLoader.prototype._readSourceAndCachedData = function (sourcePath, cachedDataPath, recorder, callback) {
+            if (!cachedDataPath) {
+                // no cached data case
+                this._fs.readFile(sourcePath, { encoding: 'utf8' }, callback);
+            }
+            else {
+                // cached data case: read both files in parallel
+                var source_1 = undefined;
+                var cachedData_1 = undefined;
+                var hashData_1 = undefined;
+                var steps_1 = 2;
+                var step_1 = function (err) {
+                    if (err) {
+                        callback(err);
+                    }
+                    else if (--steps_1 === 0) {
+                        callback(undefined, source_1, cachedData_1, hashData_1);
+                    }
+                };
+                this._fs.readFile(sourcePath, { encoding: 'utf8' }, function (err, data) {
+                    source_1 = data;
+                    step_1(err);
+                });
+                this._fs.readFile(cachedDataPath, function (err, data) {
+                    if (!err && data && data.length > 0) {
+                        hashData_1 = data.slice(0, 16);
+                        cachedData_1 = data.slice(16);
+                        recorder.record(60 /* CachedDataFound */, cachedDataPath);
+                    }
+                    else {
+                        recorder.record(61 /* CachedDataMissed */, cachedDataPath);
+                    }
+                    step_1(); // ignored: cached data is optional
+                });
+            }
+        };
+        NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData, moduleManager) {
+            var _this = this;
+            if (!hashData) {
+                // nothing to do
+                return;
+            }
+            if (script.cachedDataRejected) {
+                // invalid anyways
+                return;
+            }
+            setTimeout(function () {
+                // check source hash - the contract is that file paths change when file content
+                // change (e.g use the commit or version id as cache path). this check is
+                // for violations of this contract.
+                var hashDataNow = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();
+                if (!hashData.equals(hashDataNow)) {
+                    moduleManager.getConfig().onError(new Error("FAILED TO VERIFY CACHED DATA, deleting stale '" + cachedDataPath + "' now, but a RESTART IS REQUIRED"));
+                    _this._fs.unlink(cachedDataPath, function (err) { return moduleManager.getConfig().onError(err); });
+                }
+            }, Math.ceil(5000 * (1 + Math.random())));
+        };
+        NodeScriptLoader._BOM = 0xFEFF;
+        NodeScriptLoader._PREFIX = '(function (require, define, __filename, __dirname) { ';
+        NodeScriptLoader._SUFFIX = '\n});';
+        return NodeScriptLoader;
+    }());
+    function createScriptLoader(env) {
+        return new OnlyOnceScriptLoader(env);
+    }
+    AMDLoader.createScriptLoader = createScriptLoader;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    // ------------------------------------------------------------------------
+    // ModuleIdResolver
+    var ModuleIdResolver = /** @class */ (function () {
+        function ModuleIdResolver(fromModuleId) {
+            var lastSlash = fromModuleId.lastIndexOf('/');
+            if (lastSlash !== -1) {
+                this.fromModulePath = fromModuleId.substr(0, lastSlash + 1);
+            }
+            else {
+                this.fromModulePath = '';
+            }
+        }
+        /**
+         * Normalize 'a/../name' to 'name', etc.
+         */
+        ModuleIdResolver._normalizeModuleId = function (moduleId) {
+            var r = moduleId, pattern;
+            // replace /./ => /
+            pattern = /\/\.\//;
+            while (pattern.test(r)) {
+                r = r.replace(pattern, '/');
+            }
+            // replace ^./ => nothing
+            r = r.replace(/^\.\//g, '');
+            // replace /aa/../ => / (BUT IGNORE /../../)
+            pattern = /\/(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//;
+            while (pattern.test(r)) {
+                r = r.replace(pattern, '/');
+            }
+            // replace ^aa/../ => nothing (BUT IGNORE ../../)
+            r = r.replace(/^(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//, '');
+            return r;
+        };
+        /**
+         * Resolve relative module ids
+         */
+        ModuleIdResolver.prototype.resolveModule = function (moduleId) {
+            var result = moduleId;
+            if (!AMDLoader.Utilities.isAbsolutePath(result)) {
+                if (AMDLoader.Utilities.startsWith(result, './') || AMDLoader.Utilities.startsWith(result, '../')) {
+                    result = ModuleIdResolver._normalizeModuleId(this.fromModulePath + result);
+                }
+            }
+            return result;
+        };
+        ModuleIdResolver.ROOT = new ModuleIdResolver('');
+        return ModuleIdResolver;
+    }());
+    AMDLoader.ModuleIdResolver = ModuleIdResolver;
+    // ------------------------------------------------------------------------
+    // Module
+    var Module = /** @class */ (function () {
+        function Module(id, strId, dependencies, callback, errorback, moduleIdResolver) {
+            this.id = id;
+            this.strId = strId;
+            this.dependencies = dependencies;
+            this._callback = callback;
+            this._errorback = errorback;
+            this.moduleIdResolver = moduleIdResolver;
+            this.exports = {};
+            this.error = null;
+            this.exportsPassedIn = false;
+            this.unresolvedDependenciesCount = this.dependencies.length;
+            this._isComplete = false;
+        }
+        Module._safeInvokeFunction = function (callback, args) {
+            try {
+                return {
+                    returnedValue: callback.apply(AMDLoader.global, args),
+                    producedError: null
+                };
+            }
+            catch (e) {
+                return {
+                    returnedValue: null,
+                    producedError: e
+                };
+            }
+        };
+        Module._invokeFactory = function (config, strModuleId, callback, dependenciesValues) {
+            if (config.isBuild() && !AMDLoader.Utilities.isAnonymousModule(strModuleId)) {
+                return {
+                    returnedValue: null,
+                    producedError: null
+                };
+            }
+            if (config.shouldCatchError()) {
+                return this._safeInvokeFunction(callback, dependenciesValues);
+            }
+            return {
+                returnedValue: callback.apply(AMDLoader.global, dependenciesValues),
+                producedError: null
+            };
+        };
+        Module.prototype.complete = function (recorder, config, dependenciesValues) {
+            this._isComplete = true;
+            var producedError = null;
+            if (this._callback) {
+                if (typeof this._callback === 'function') {
+                    recorder.record(21 /* BeginInvokeFactory */, this.strId);
+                    var r = Module._invokeFactory(config, this.strId, this._callback, dependenciesValues);
+                    producedError = r.producedError;
+                    recorder.record(22 /* EndInvokeFactory */, this.strId);
+                    if (!producedError && typeof r.returnedValue !== 'undefined' && (!this.exportsPassedIn || AMDLoader.Utilities.isEmpty(this.exports))) {
+                        this.exports = r.returnedValue;
+                    }
+                }
+                else {
+                    this.exports = this._callback;
+                }
+            }
+            if (producedError) {
+                var err = AMDLoader.ensureError(producedError);
+                err.phase = 'factory';
+                err.moduleId = this.strId;
+                this.error = err;
+                config.onError(err);
+            }
+            this.dependencies = null;
+            this._callback = null;
+            this._errorback = null;
+            this.moduleIdResolver = null;
+        };
+        /**
+         * One of the direct dependencies or a transitive dependency has failed to load.
+         */
+        Module.prototype.onDependencyError = function (err) {
+            this._isComplete = true;
+            this.error = err;
+            if (this._errorback) {
+                this._errorback(err);
+                return true;
+            }
+            return false;
+        };
+        /**
+         * Is the current module complete?
+         */
+        Module.prototype.isComplete = function () {
+            return this._isComplete;
+        };
+        return Module;
+    }());
+    AMDLoader.Module = Module;
+    var ModuleIdProvider = /** @class */ (function () {
+        function ModuleIdProvider() {
+            this._nextId = 0;
+            this._strModuleIdToIntModuleId = new Map();
+            this._intModuleIdToStrModuleId = [];
+            // Ensure values 0, 1, 2 are assigned accordingly with ModuleId
+            this.getModuleId('exports');
+            this.getModuleId('module');
+            this.getModuleId('require');
+        }
+        ModuleIdProvider.prototype.getMaxModuleId = function () {
+            return this._nextId;
+        };
+        ModuleIdProvider.prototype.getModuleId = function (strModuleId) {
+            var id = this._strModuleIdToIntModuleId.get(strModuleId);
+            if (typeof id === 'undefined') {
+                id = this._nextId++;
+                this._strModuleIdToIntModuleId.set(strModuleId, id);
+                this._intModuleIdToStrModuleId[id] = strModuleId;
+            }
+            return id;
+        };
+        ModuleIdProvider.prototype.getStrModuleId = function (moduleId) {
+            return this._intModuleIdToStrModuleId[moduleId];
+        };
+        return ModuleIdProvider;
+    }());
+    var RegularDependency = /** @class */ (function () {
+        function RegularDependency(id) {
+            this.id = id;
+        }
+        RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
+        RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
+        RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
+        return RegularDependency;
+    }());
+    AMDLoader.RegularDependency = RegularDependency;
+    var PluginDependency = /** @class */ (function () {
+        function PluginDependency(id, pluginId, pluginParam) {
+            this.id = id;
+            this.pluginId = pluginId;
+            this.pluginParam = pluginParam;
+        }
+        return PluginDependency;
+    }());
+    AMDLoader.PluginDependency = PluginDependency;
+    var ModuleManager = /** @class */ (function () {
+        function ModuleManager(env, scriptLoader, defineFunc, requireFunc, loaderAvailableTimestamp) {
+            if (loaderAvailableTimestamp === void 0) { loaderAvailableTimestamp = 0; }
+            this._env = env;
+            this._scriptLoader = scriptLoader;
+            this._loaderAvailableTimestamp = loaderAvailableTimestamp;
+            this._defineFunc = defineFunc;
+            this._requireFunc = requireFunc;
+            this._moduleIdProvider = new ModuleIdProvider();
+            this._config = new AMDLoader.Configuration(this._env);
+            this._modules2 = [];
+            this._knownModules2 = [];
+            this._inverseDependencies2 = [];
+            this._inversePluginDependencies2 = new Map();
+            this._currentAnnonymousDefineCall = null;
+            this._recorder = null;
+            this._buildInfoPath = [];
+            this._buildInfoDefineStack = [];
+            this._buildInfoDependencies = [];
+        }
+        ModuleManager.prototype.reset = function () {
+            return new ModuleManager(this._env, this._scriptLoader, this._defineFunc, this._requireFunc, this._loaderAvailableTimestamp);
+        };
+        ModuleManager.prototype.getGlobalAMDDefineFunc = function () {
+            return this._defineFunc;
+        };
+        ModuleManager.prototype.getGlobalAMDRequireFunc = function () {
+            return this._requireFunc;
+        };
+        ModuleManager._findRelevantLocationInStack = function (needle, stack) {
+            var normalize = function (str) { return str.replace(/\\/g, '/'); };
+            var normalizedPath = normalize(needle);
+            var stackPieces = stack.split(/\n/);
+            for (var i = 0; i < stackPieces.length; i++) {
+                var m = stackPieces[i].match(/(.*):(\d+):(\d+)\)?$/);
+                if (m) {
+                    var stackPath = m[1];
+                    var stackLine = m[2];
+                    var stackColumn = m[3];
+                    var trimPathOffset = Math.max(stackPath.lastIndexOf(' ') + 1, stackPath.lastIndexOf('(') + 1);
+                    stackPath = stackPath.substr(trimPathOffset);
+                    stackPath = normalize(stackPath);
+                    if (stackPath === normalizedPath) {
+                        var r = {
+                            line: parseInt(stackLine, 10),
+                            col: parseInt(stackColumn, 10)
+                        };
+                        if (r.line === 1) {
+                            r.col -= '(function (require, define, __filename, __dirname) { '.length;
+                        }
+                        return r;
+                    }
+                }
+            }
+            throw new Error('Could not correlate define call site for needle ' + needle);
+        };
+        ModuleManager.prototype.getBuildInfo = function () {
+            if (!this._config.isBuild()) {
+                return null;
+            }
+            var result = [], resultLen = 0;
+            for (var i = 0, len = this._modules2.length; i < len; i++) {
+                var m = this._modules2[i];
+                if (!m) {
+                    continue;
+                }
+                var location_1 = this._buildInfoPath[m.id] || null;
+                var defineStack = this._buildInfoDefineStack[m.id] || null;
+                var dependencies = this._buildInfoDependencies[m.id];
+                result[resultLen++] = {
+                    id: m.strId,
+                    path: location_1,
+                    defineLocation: (location_1 && defineStack ? ModuleManager._findRelevantLocationInStack(location_1, defineStack) : null),
+                    dependencies: dependencies,
+                    shim: null,
+                    exports: m.exports
+                };
+            }
+            return result;
+        };
+        ModuleManager.prototype.getRecorder = function () {
+            if (!this._recorder) {
+                if (this._config.shouldRecordStats()) {
+                    this._recorder = new AMDLoader.LoaderEventRecorder(this._loaderAvailableTimestamp);
+                }
+                else {
+                    this._recorder = AMDLoader.NullLoaderEventRecorder.INSTANCE;
+                }
+            }
+            return this._recorder;
+        };
+        ModuleManager.prototype.getLoaderEvents = function () {
+            return this.getRecorder().getEvents();
+        };
+        /**
+         * Defines an anonymous module (without an id). Its name will be resolved as we receive a callback from the scriptLoader.
+         * @param dependecies @see defineModule
+         * @param callback @see defineModule
+         */
+        ModuleManager.prototype.enqueueDefineAnonymousModule = function (dependencies, callback) {
+            if (this._currentAnnonymousDefineCall !== null) {
+                throw new Error('Can only have one anonymous define call per script file');
+            }
+            var stack = null;
+            if (this._config.isBuild()) {
+                stack = new Error('StackLocation').stack || null;
+            }
+            this._currentAnnonymousDefineCall = {
+                stack: stack,
+                dependencies: dependencies,
+                callback: callback
+            };
+        };
+        /**
+         * Creates a module and stores it in _modules. The manager will immediately begin resolving its dependencies.
+         * @param strModuleId An unique and absolute id of the module. This must not collide with another module's id
+         * @param dependencies An array with the dependencies of the module. Special keys are: "require", "exports" and "module"
+         * @param callback if callback is a function, it will be called with the resolved dependencies. if callback is an object, it will be considered as the exports of the module.
+         */
+        ModuleManager.prototype.defineModule = function (strModuleId, dependencies, callback, errorback, stack, moduleIdResolver) {
+            var _this = this;
+            if (moduleIdResolver === void 0) { moduleIdResolver = new ModuleIdResolver(strModuleId); }
+            var moduleId = this._moduleIdProvider.getModuleId(strModuleId);
+            if (this._modules2[moduleId]) {
+                if (!this._config.isDuplicateMessageIgnoredFor(strModuleId)) {
+                    console.warn('Duplicate definition of module \'' + strModuleId + '\'');
+                }
+                // Super important! Completely ignore duplicate module definition
+                return;
+            }
+            var m = new Module(moduleId, strModuleId, this._normalizeDependencies(dependencies, moduleIdResolver), callback, errorback, moduleIdResolver);
+            this._modules2[moduleId] = m;
+            if (this._config.isBuild()) {
+                this._buildInfoDefineStack[moduleId] = stack;
+                this._buildInfoDependencies[moduleId] = (m.dependencies || []).map(function (dep) { return _this._moduleIdProvider.getStrModuleId(dep.id); });
+            }
+            // Resolving of dependencies is immediate (not in a timeout). If there's a need to support a packer that concatenates in an
+            // unordered manner, in order to finish processing the file, execute the following method in a timeout
+            this._resolve(m);
+        };
+        ModuleManager.prototype._normalizeDependency = function (dependency, moduleIdResolver) {
+            if (dependency === 'exports') {
+                return RegularDependency.EXPORTS;
+            }
+            if (dependency === 'module') {
+                return RegularDependency.MODULE;
+            }
+            if (dependency === 'require') {
+                return RegularDependency.REQUIRE;
+            }
+            // Normalize dependency and then request it from the manager
+            var bangIndex = dependency.indexOf('!');
+            if (bangIndex >= 0) {
+                var strPluginId = moduleIdResolver.resolveModule(dependency.substr(0, bangIndex));
+                var pluginParam = moduleIdResolver.resolveModule(dependency.substr(bangIndex + 1));
+                var dependencyId = this._moduleIdProvider.getModuleId(strPluginId + '!' + pluginParam);
+                var pluginId = this._moduleIdProvider.getModuleId(strPluginId);
+                return new PluginDependency(dependencyId, pluginId, pluginParam);
+            }
+            return new RegularDependency(this._moduleIdProvider.getModuleId(moduleIdResolver.resolveModule(dependency)));
+        };
+        ModuleManager.prototype._normalizeDependencies = function (dependencies, moduleIdResolver) {
+            var result = [], resultLen = 0;
+            for (var i = 0, len = dependencies.length; i < len; i++) {
+                result[resultLen++] = this._normalizeDependency(dependencies[i], moduleIdResolver);
+            }
+            return result;
+        };
+        ModuleManager.prototype._relativeRequire = function (moduleIdResolver, dependencies, callback, errorback) {
+            if (typeof dependencies === 'string') {
+                return this.synchronousRequire(dependencies, moduleIdResolver);
+            }
+            this.defineModule(AMDLoader.Utilities.generateAnonymousModule(), dependencies, callback, errorback, null, moduleIdResolver);
+        };
+        /**
+         * Require synchronously a module by its absolute id. If the module is not loaded, an exception will be thrown.
+         * @param id The unique and absolute id of the required module
+         * @return The exports of module 'id'
+         */
+        ModuleManager.prototype.synchronousRequire = function (_strModuleId, moduleIdResolver) {
+            if (moduleIdResolver === void 0) { moduleIdResolver = new ModuleIdResolver(_strModuleId); }
+            var dependency = this._normalizeDependency(_strModuleId, moduleIdResolver);
+            var m = this._modules2[dependency.id];
+            if (!m) {
+                throw new Error('Check dependency list! Synchronous require cannot resolve module \'' + _strModuleId + '\'. This is the first mention of this module!');
+            }
+            if (!m.isComplete()) {
+                throw new Error('Check dependency list! Synchronous require cannot resolve module \'' + _strModuleId + '\'. This module has not been resolved completely yet.');
+            }
+            if (m.error) {
+                throw m.error;
+            }
+            return m.exports;
+        };
+        ModuleManager.prototype.configure = function (params, shouldOverwrite) {
+            var oldShouldRecordStats = this._config.shouldRecordStats();
+            if (shouldOverwrite) {
+                this._config = new AMDLoader.Configuration(this._env, params);
+            }
+            else {
+                this._config = this._config.cloneAndMerge(params);
+            }
+            if (this._config.shouldRecordStats() && !oldShouldRecordStats) {
+                this._recorder = null;
+            }
+        };
+        ModuleManager.prototype.getConfig = function () {
+            return this._config;
+        };
+        /**
+         * Callback from the scriptLoader when a module has been loaded.
+         * This means its code is available and has been executed.
+         */
+        ModuleManager.prototype._onLoad = function (moduleId) {
+            if (this._currentAnnonymousDefineCall !== null) {
+                var defineCall = this._currentAnnonymousDefineCall;
+                this._currentAnnonymousDefineCall = null;
+                // Hit an anonymous define call
+                this.defineModule(this._moduleIdProvider.getStrModuleId(moduleId), defineCall.dependencies, defineCall.callback, null, defineCall.stack);
+            }
+        };
+        ModuleManager.prototype._createLoadError = function (moduleId, _err) {
+            var _this = this;
+            var strModuleId = this._moduleIdProvider.getStrModuleId(moduleId);
+            var neededBy = (this._inverseDependencies2[moduleId] || []).map(function (intModuleId) { return _this._moduleIdProvider.getStrModuleId(intModuleId); });
+            var err = AMDLoader.ensureError(_err);
+            err.phase = 'loading';
+            err.moduleId = strModuleId;
+            err.neededBy = neededBy;
+            return err;
+        };
+        /**
+         * Callback from the scriptLoader when a module hasn't been loaded.
+         * This means that the script was not found (e.g. 404) or there was an error in the script.
+         */
+        ModuleManager.prototype._onLoadError = function (moduleId, err) {
+            var error = this._createLoadError(moduleId, err);
+            if (!this._modules2[moduleId]) {
+                this._modules2[moduleId] = new Module(moduleId, this._moduleIdProvider.getStrModuleId(moduleId), [], function () { }, function () { }, null);
+            }
+            // Find any 'local' error handlers, walk the entire chain of inverse dependencies if necessary.
+            var seenModuleId = [];
+            for (var i = 0, len = this._moduleIdProvider.getMaxModuleId(); i < len; i++) {
+                seenModuleId[i] = false;
+            }
+            var someoneNotified = false;
+            var queue = [];
+            queue.push(moduleId);
+            seenModuleId[moduleId] = true;
+            while (queue.length > 0) {
+                var queueElement = queue.shift();
+                var m = this._modules2[queueElement];
+                if (m) {
+                    someoneNotified = m.onDependencyError(error) || someoneNotified;
+                }
+                var inverseDeps = this._inverseDependencies2[queueElement];
+                if (inverseDeps) {
+                    for (var i = 0, len = inverseDeps.length; i < len; i++) {
+                        var inverseDep = inverseDeps[i];
+                        if (!seenModuleId[inverseDep]) {
+                            queue.push(inverseDep);
+                            seenModuleId[inverseDep] = true;
+                        }
+                    }
+                }
+            }
+            if (!someoneNotified) {
+                this._config.onError(error);
+            }
+        };
+        /**
+         * Walks (recursively) the dependencies of 'from' in search of 'to'.
+         * Returns true if there is such a path or false otherwise.
+         * @param from Module id to start at
+         * @param to Module id to look for
+         */
+        ModuleManager.prototype._hasDependencyPath = function (fromId, toId) {
+            var from = this._modules2[fromId];
+            if (!from) {
+                return false;
+            }
+            var inQueue = [];
+            for (var i = 0, len = this._moduleIdProvider.getMaxModuleId(); i < len; i++) {
+                inQueue[i] = false;
+            }
+            var queue = [];
+            // Insert 'from' in queue
+            queue.push(from);
+            inQueue[fromId] = true;
+            while (queue.length > 0) {
+                // Pop first inserted element of queue
+                var element = queue.shift();
+                var dependencies = element.dependencies;
+                if (dependencies) {
+                    // Walk the element's dependencies
+                    for (var i = 0, len = dependencies.length; i < len; i++) {
+                        var dependency = dependencies[i];
+                        if (dependency.id === toId) {
+                            // There is a path to 'to'
+                            return true;
+                        }
+                        var dependencyModule = this._modules2[dependency.id];
+                        if (dependencyModule && !inQueue[dependency.id]) {
+                            // Insert 'dependency' in queue
+                            inQueue[dependency.id] = true;
+                            queue.push(dependencyModule);
+                        }
+                    }
+                }
+            }
+            // There is no path to 'to'
+            return false;
+        };
+        /**
+         * Walks (recursively) the dependencies of 'from' in search of 'to'.
+         * Returns cycle as array.
+         * @param from Module id to start at
+         * @param to Module id to look for
+         */
+        ModuleManager.prototype._findCyclePath = function (fromId, toId, depth) {
+            if (fromId === toId || depth === 50) {
+                return [fromId];
+            }
+            var from = this._modules2[fromId];
+            if (!from) {
+                return null;
+            }
+            // Walk the element's dependencies
+            var dependencies = from.dependencies;
+            if (dependencies) {
+                for (var i = 0, len = dependencies.length; i < len; i++) {
+                    var path = this._findCyclePath(dependencies[i].id, toId, depth + 1);
+                    if (path !== null) {
+                        path.push(fromId);
+                        return path;
+                    }
+                }
+            }
+            return null;
+        };
+        /**
+         * Create the local 'require' that is passed into modules
+         */
+        ModuleManager.prototype._createRequire = function (moduleIdResolver) {
+            var _this = this;
+            var result = (function (dependencies, callback, errorback) {
+                return _this._relativeRequire(moduleIdResolver, dependencies, callback, errorback);
+            });
+            result.toUrl = function (id) {
+                return _this._config.requireToUrl(moduleIdResolver.resolveModule(id));
+            };
+            result.getStats = function () {
+                return _this.getLoaderEvents();
+            };
+            result.__$__nodeRequire = AMDLoader.global.nodeRequire;
+            return result;
+        };
+        ModuleManager.prototype._loadModule = function (moduleId) {
+            var _this = this;
+            if (this._modules2[moduleId] || this._knownModules2[moduleId]) {
+                // known module
+                return;
+            }
+            this._knownModules2[moduleId] = true;
+            var strModuleId = this._moduleIdProvider.getStrModuleId(moduleId);
+            var paths = this._config.moduleIdToPaths(strModuleId);
+            var scopedPackageRegex = /^@[^\/]+\/[^\/]+$/; // matches @scope/package-name
+            if (this._env.isNode && (strModuleId.indexOf('/') === -1 || scopedPackageRegex.test(strModuleId))) {
+                paths.push('node|' + strModuleId);
+            }
+            var lastPathIndex = -1;
+            var loadNextPath = function (err) {
+                lastPathIndex++;
+                if (lastPathIndex >= paths.length) {
+                    // No more paths to try
+                    _this._onLoadError(moduleId, err);
+                }
+                else {
+                    var currentPath_1 = paths[lastPathIndex];
+                    var recorder_1 = _this.getRecorder();
+                    if (_this._config.isBuild() && currentPath_1 === 'empty:') {
+                        _this._buildInfoPath[moduleId] = currentPath_1;
+                        _this.defineModule(_this._moduleIdProvider.getStrModuleId(moduleId), [], null, null, null);
+                        _this._onLoad(moduleId);
+                        return;
+                    }
+                    recorder_1.record(10 /* BeginLoadingScript */, currentPath_1);
+                    _this._scriptLoader.load(_this, currentPath_1, function () {
+                        if (_this._config.isBuild()) {
+                            _this._buildInfoPath[moduleId] = currentPath_1;
+                        }
+                        recorder_1.record(11 /* EndLoadingScriptOK */, currentPath_1);
+                        _this._onLoad(moduleId);
+                    }, function (err) {
+                        recorder_1.record(12 /* EndLoadingScriptError */, currentPath_1);
+                        loadNextPath(err);
+                    });
+                }
+            };
+            loadNextPath(null);
+        };
+        /**
+         * Resolve a plugin dependency with the plugin loaded & complete
+         * @param module The module that has this dependency
+         * @param pluginDependency The semi-normalized dependency that appears in the module. e.g. 'vs/css!./mycssfile'. Only the plugin part (before !) is normalized
+         * @param plugin The plugin (what the plugin exports)
+         */
+        ModuleManager.prototype._loadPluginDependency = function (plugin, pluginDependency) {
+            var _this = this;
+            if (this._modules2[pluginDependency.id] || this._knownModules2[pluginDependency.id]) {
+                // known module
+                return;
+            }
+            this._knownModules2[pluginDependency.id] = true;
+            // Delegate the loading of the resource to the plugin
+            var load = (function (value) {
+                _this.defineModule(_this._moduleIdProvider.getStrModuleId(pluginDependency.id), [], value, null, null);
+            });
+            load.error = function (err) {
+                _this._config.onError(_this._createLoadError(pluginDependency.id, err));
+            };
+            plugin.load(pluginDependency.pluginParam, this._createRequire(ModuleIdResolver.ROOT), load, this._config.getOptionsLiteral());
+        };
+        /**
+         * Examine the dependencies of module 'module' and resolve them as needed.
+         */
+        ModuleManager.prototype._resolve = function (module) {
+            var _this = this;
+            var dependencies = module.dependencies;
+            if (dependencies) {
+                for (var i = 0, len = dependencies.length; i < len; i++) {
+                    var dependency = dependencies[i];
+                    if (dependency === RegularDependency.EXPORTS) {
+                        module.exportsPassedIn = true;
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    if (dependency === RegularDependency.MODULE) {
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    if (dependency === RegularDependency.REQUIRE) {
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    var dependencyModule = this._modules2[dependency.id];
+                    if (dependencyModule && dependencyModule.isComplete()) {
+                        if (dependencyModule.error) {
+                            module.onDependencyError(dependencyModule.error);
+                            return;
+                        }
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    if (this._hasDependencyPath(dependency.id, module.id)) {
+                        console.warn('There is a dependency cycle between \'' + this._moduleIdProvider.getStrModuleId(dependency.id) + '\' and \'' + this._moduleIdProvider.getStrModuleId(module.id) + '\'. The cyclic path follows:');
+                        var cyclePath = this._findCyclePath(dependency.id, module.id, 0) || [];
+                        cyclePath.reverse();
+                        cyclePath.push(dependency.id);
+                        console.warn(cyclePath.map(function (id) { return _this._moduleIdProvider.getStrModuleId(id); }).join(' => \n'));
+                        // Break the cycle
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    // record inverse dependency
+                    this._inverseDependencies2[dependency.id] = this._inverseDependencies2[dependency.id] || [];
+                    this._inverseDependencies2[dependency.id].push(module.id);
+                    if (dependency instanceof PluginDependency) {
+                        var plugin = this._modules2[dependency.pluginId];
+                        if (plugin && plugin.isComplete()) {
+                            this._loadPluginDependency(plugin.exports, dependency);
+                            continue;
+                        }
+                        // Record dependency for when the plugin gets loaded
+                        var inversePluginDeps = this._inversePluginDependencies2.get(dependency.pluginId);
+                        if (!inversePluginDeps) {
+                            inversePluginDeps = [];
+                            this._inversePluginDependencies2.set(dependency.pluginId, inversePluginDeps);
+                        }
+                        inversePluginDeps.push(dependency);
+                        this._loadModule(dependency.pluginId);
+                        continue;
+                    }
+                    this._loadModule(dependency.id);
+                }
+            }
+            if (module.unresolvedDependenciesCount === 0) {
+                this._onModuleComplete(module);
+            }
+        };
+        ModuleManager.prototype._onModuleComplete = function (module) {
+            var _this = this;
+            var recorder = this.getRecorder();
+            if (module.isComplete()) {
+                // already done
+                return;
+            }
+            var dependencies = module.dependencies;
+            var dependenciesValues = [];
+            if (dependencies) {
+                for (var i = 0, len = dependencies.length; i < len; i++) {
+                    var dependency = dependencies[i];
+                    if (dependency === RegularDependency.EXPORTS) {
+                        dependenciesValues[i] = module.exports;
+                        continue;
+                    }
+                    if (dependency === RegularDependency.MODULE) {
+                        dependenciesValues[i] = {
+                            id: module.strId,
+                            config: function () {
+                                return _this._config.getConfigForModule(module.strId);
+                            }
+                        };
+                        continue;
+                    }
+                    if (dependency === RegularDependency.REQUIRE) {
+                        dependenciesValues[i] = this._createRequire(module.moduleIdResolver);
+                        continue;
+                    }
+                    var dependencyModule = this._modules2[dependency.id];
+                    if (dependencyModule) {
+                        dependenciesValues[i] = dependencyModule.exports;
+                        continue;
+                    }
+                    dependenciesValues[i] = null;
+                }
+            }
+            module.complete(recorder, this._config, dependenciesValues);
+            // Fetch and clear inverse dependencies
+            var inverseDeps = this._inverseDependencies2[module.id];
+            this._inverseDependencies2[module.id] = null;
+            if (inverseDeps) {
+                // Resolve one inverse dependency at a time, always
+                // on the lookout for a completed module.
+                for (var i = 0, len = inverseDeps.length; i < len; i++) {
+                    var inverseDependencyId = inverseDeps[i];
+                    var inverseDependency = this._modules2[inverseDependencyId];
+                    inverseDependency.unresolvedDependenciesCount--;
+                    if (inverseDependency.unresolvedDependenciesCount === 0) {
+                        this._onModuleComplete(inverseDependency);
+                    }
+                }
+            }
+            var inversePluginDeps = this._inversePluginDependencies2.get(module.id);
+            if (inversePluginDeps) {
+                // This module is used as a plugin at least once
+                // Fetch and clear these inverse plugin dependencies
+                this._inversePluginDependencies2.delete(module.id);
+                // Resolve plugin dependencies one at a time
+                for (var i = 0, len = inversePluginDeps.length; i < len; i++) {
+                    this._loadPluginDependency(module.exports, inversePluginDeps[i]);
+                }
+            }
+        };
+        return ModuleManager;
+    }());
+    AMDLoader.ModuleManager = ModuleManager;
+})(AMDLoader || (AMDLoader = {}));
+var define;
+var AMDLoader;
+(function (AMDLoader) {
+    var env = new AMDLoader.Environment();
+    var moduleManager = null;
+    var DefineFunc = function (id, dependencies, callback) {
+        if (typeof id !== 'string') {
+            callback = dependencies;
+            dependencies = id;
+            id = null;
+        }
+        if (typeof dependencies !== 'object' || !Array.isArray(dependencies)) {
+            callback = dependencies;
+            dependencies = null;
+        }
+        if (!dependencies) {
+            dependencies = ['require', 'exports', 'module'];
+        }
+        if (id) {
+            moduleManager.defineModule(id, dependencies, callback, null, null);
+        }
+        else {
+            moduleManager.enqueueDefineAnonymousModule(dependencies, callback);
+        }
+    };
+    DefineFunc.amd = {
+        jQuery: true
+    };
+    var _requireFunc_config = function (params, shouldOverwrite) {
+        if (shouldOverwrite === void 0) { shouldOverwrite = false; }
+        moduleManager.configure(params, shouldOverwrite);
+    };
+    var RequireFunc = function () {
+        if (arguments.length === 1) {
+            if ((arguments[0] instanceof Object) && !Array.isArray(arguments[0])) {
+                _requireFunc_config(arguments[0]);
+                return;
+            }
+            if (typeof arguments[0] === 'string') {
+                return moduleManager.synchronousRequire(arguments[0]);
+            }
+        }
+        if (arguments.length === 2 || arguments.length === 3) {
+            if (Array.isArray(arguments[0])) {
+                moduleManager.defineModule(AMDLoader.Utilities.generateAnonymousModule(), arguments[0], arguments[1], arguments[2], null);
+                return;
+            }
+        }
+        throw new Error('Unrecognized require call');
+    };
+    RequireFunc.config = _requireFunc_config;
+    RequireFunc.getConfig = function () {
+        return moduleManager.getConfig().getOptionsLiteral();
+    };
+    RequireFunc.reset = function () {
+        moduleManager = moduleManager.reset();
+    };
+    RequireFunc.getBuildInfo = function () {
+        return moduleManager.getBuildInfo();
+    };
+    RequireFunc.getStats = function () {
+        return moduleManager.getLoaderEvents();
+    };
+    RequireFunc.define = function () {
+        return DefineFunc.apply(null, arguments);
+    };
+    function init() {
+        if (typeof AMDLoader.global.require !== 'undefined' || typeof require !== 'undefined') {
+            var _nodeRequire_1 = (AMDLoader.global.require || require);
+            if (typeof _nodeRequire_1 === 'function' && typeof _nodeRequire_1.resolve === 'function') {
+                // re-expose node's require function
+                var nodeRequire = function (what) {
+                    moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);
+                    try {
+                        return _nodeRequire_1(what);
+                    }
+                    finally {
+                        moduleManager.getRecorder().record(34 /* NodeEndNativeRequire */, what);
+                    }
+                };
+                AMDLoader.global.nodeRequire = nodeRequire;
+                RequireFunc.nodeRequire = nodeRequire;
+                RequireFunc.__$__nodeRequire = nodeRequire;
+            }
+        }
+        if (env.isNode && !env.isElectronRenderer) {
+            module.exports = RequireFunc;
+            require = RequireFunc;
+        }
+        else {
+            if (!env.isElectronRenderer) {
+                AMDLoader.global.define = DefineFunc;
+            }
+            AMDLoader.global.require = RequireFunc;
+        }
+    }
+    AMDLoader.init = init;
+    if (typeof AMDLoader.global.define !== 'function' || !AMDLoader.global.define.amd) {
+        moduleManager = new AMDLoader.ModuleManager(env, AMDLoader.createScriptLoader(env), DefineFunc, RequireFunc, AMDLoader.Utilities.getHighPerformanceTimestamp());
+        // The global variable require can configure the loader
+        if (typeof AMDLoader.global.require !== 'undefined' && typeof AMDLoader.global.require !== 'function') {
+            RequireFunc.config(AMDLoader.global.require);
+        }
+        // This define is for the local closure defined in node in the case that the loader is concatenated
+        define = function () {
+            return DefineFunc.apply(null, arguments);
+        };
+        define.amd = DefineFunc.amd;
+        if (typeof doNotInitLoader === 'undefined') {
+            init();
+        }
+    }
+})(AMDLoader || (AMDLoader = {}));
+
+//# sourceMappingURL=loader.js.map

+ 9 - 0
o2web/source/x_component_cms_ScriptDesigner/$Main/default/toolbars.html

@@ -63,6 +63,15 @@
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="xcode">xcode</option>
         <option value="xcode">xcode</option>
     </select></div>
     </select></div>
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
 
 
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
 
 
 </div>
 </div>

+ 55 - 9
o2web/source/x_component_cms_ScriptDesigner/Main.js

@@ -366,17 +366,57 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.scriptTab.pages.each(function(page){
+            var editor = page.script.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.script.editor.editor;
+            var editor = page.script.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -384,6 +424,7 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -397,26 +438,31 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
     changeEditorStyle: function(node){
     changeEditorStyle: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
-        var editorData = null;
+        //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
-            if (!editorData) editorData = page.script.editor.editorData;
-            var editor = page.script.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            //if (!editorData) editorData = page.script.editor.editorData;
+            var editor = page.script.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
-
+        //if (!editorData) editorData = MWF.editorData;
+        //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
 
 
-        editorData.javascriptEditor.theme = value;
-
-        MWF.UD.putData("editor", editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 22 - 0
o2web/source/x_component_cms_ScriptDesigner/Script.js

@@ -159,6 +159,28 @@ MWF.xApplication.cms.ScriptDesigner.Script = new Class({
                     }
                     }
                 }
                 }
             }
             }
+
+            if(this.designer.editorSelectNode) {
+                var options = this.designer.editorSelectNode.options;
+                for (var i = 0; i < options.length; i++) {
+                    var option = options[i];
+                    if (option.value == this.editor.options.type) {
+                        option.set("selected", true);
+                        break;
+                    }
+                }
+            }
+
+            if (this.designer.styleSelectNode && this.designer.monacoStyleSelectNode){
+                if (this.editor.options.type=="ace"){
+                    this.designer.monacoStyleSelectNode.hide();
+                    this.designer.styleSelectNode.show();
+                }else{
+                    this.designer.monacoStyleSelectNode.show();
+                    this.designer.styleSelectNode.hide();
+                }
+            }
+
         }.bind(this));
         }.bind(this));
 
 
         if (this.options.showTab) this.page.showTabIm();
         if (this.options.showTab) this.page.showTabIm();

+ 20 - 0
o2web/source/x_component_portal_ScriptDesigner/$Main/default/toolbars.html

@@ -25,6 +25,15 @@
         <option value="16px">16px</option>
         <option value="16px">16px</option>
         <option value="17px">17px</option>
         <option value="17px">17px</option>
         <option value="18px">18px</option>
         <option value="18px">18px</option>
+        <option value="20px">20px</option>
+        <option value="22px">22px</option>
+        <option value="24px">24px</option>
+        <option value="26px">26px</option>
+        <option value="28px">28px</option>
+        <option value="30px">30px</option>
+        <option value="32px">32px</option>
+        <option value="34px">34px</option>
+        <option value="36px">36px</option>
     </select></div>
     </select></div>
 
 
     <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="theme">
     <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="theme">
@@ -63,6 +72,17 @@
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="xcode">xcode</option>
         <option value="xcode">xcode</option>
     </select></div>
     </select></div>
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
+
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
+
 
 
 
 
 </div>
 </div>

+ 51 - 5
o2web/source/x_component_portal_ScriptDesigner/Main.js

@@ -358,17 +358,57 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.scriptTab.pages.each(function(page){
+            var editor = page.script.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.script.editor.editor;
+            var editor = page.script.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -376,6 +416,7 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -392,23 +433,28 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.script.editor.editorData;
             //if (!editorData) editorData = page.script.editor.editorData;
-            var editor = page.script.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            var editor = page.script.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
         //editorData.javascriptEditor.theme = value;
         //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
-        MWF.editorData.javascriptEditor.theme = value;
 
 
-        MWF.UD.putData("editor", MWF.editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 17 - 1
o2web/source/x_component_portal_ScriptDesigner/Script.js

@@ -141,7 +141,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
                 }
                 }
             }
             }
 
 
-            var options = this.designer.fontsizeSelectNode.options;
+            options = this.designer.fontsizeSelectNode.options;
             for (var i=0; i<options.length; i++){
             for (var i=0; i<options.length; i++){
                 var option = options[i];
                 var option = options[i];
                 if (option.value==this.editor.fontSize){
                 if (option.value==this.editor.fontSize){
@@ -149,6 +149,22 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
                     break;
                     break;
                 }
                 }
             }
             }
+            options = this.designer.editorSelectNode.options;
+            for (var i=0; i<options.length; i++){
+                var option = options[i];
+                if (option.value==this.editor.options.type){
+                    option.set("selected", true);
+                    break;
+                }
+            }
+
+            if (this.editor.options.type=="ace"){
+                this.designer.monacoStyleSelectNode.hide();
+                this.designer.styleSelectNode.show();
+            }else{
+                this.designer.monacoStyleSelectNode.show();
+                this.designer.styleSelectNode.hide();
+            }
         }.bind(this));
         }.bind(this));
 
 
         if (this.options.showTab) this.page.showTabIm();
         if (this.options.showTab) this.page.showTabIm();

+ 9 - 0
o2web/source/x_component_process_ScriptDesigner/$Main/default/toolbars.html

@@ -63,6 +63,15 @@
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="xcode">xcode</option>
         <option value="xcode">xcode</option>
     </select></div>
     </select></div>
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
 
 
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
 
 
 </div>
 </div>

+ 51 - 5
o2web/source/x_component_process_ScriptDesigner/Main.js

@@ -370,17 +370,57 @@ MWF.xApplication.process.ScriptDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.scriptTab.pages.each(function(page){
+            var editor = page.script.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.script.editor.editor;
+            var editor = page.script.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -388,6 +428,7 @@ MWF.xApplication.process.ScriptDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -404,23 +445,28 @@ MWF.xApplication.process.ScriptDesigner.Main = new Class({
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.script.editor.editorData;
             //if (!editorData) editorData = page.script.editor.editorData;
-            var editor = page.script.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            var editor = page.script.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
         //editorData.javascriptEditor.theme = value;
         //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
-        MWF.editorData.javascriptEditor.theme = value;
 
 
-        MWF.UD.putData("editor", MWF.editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 17 - 0
o2web/source/x_component_process_ScriptDesigner/Script.js

@@ -159,6 +159,23 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
                     break;
                     break;
                 }
                 }
             }
             }
+
+            options = this.designer.editorSelectNode.options;
+            for (var i=0; i<options.length; i++){
+                var option = options[i];
+                if (option.value==this.editor.options.type){
+                    option.set("selected", true);
+                    break;
+                }
+            }
+
+            if (this.editor.options.type=="ace"){
+                this.designer.monacoStyleSelectNode.hide();
+                this.designer.styleSelectNode.show();
+            }else{
+                this.designer.monacoStyleSelectNode.show();
+                this.designer.styleSelectNode.hide();
+            }
         }.bind(this));
         }.bind(this));
     },
     },
 
 

+ 4 - 1
o2web/source/x_component_query_StatementDesigner/Statement.js

@@ -6,6 +6,7 @@ MWF.APPDSMD = MWF.xApplication.query.StatementDesigner;
 MWF.xDesktop.requireApp("query.StatementDesigner", "lp."+MWF.language, null, false);
 MWF.xDesktop.requireApp("query.StatementDesigner", "lp."+MWF.language, null, false);
 //MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false);
 //MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false);
 MWF.xDesktop.requireApp("query.TableDesigner", "Property", null, false);
 MWF.xDesktop.requireApp("query.TableDesigner", "Property", null, false);
+o2.require("o2.widget.JavascriptEditor", null, false);
 
 
 MWF.xApplication.query.StatementDesigner.Statement = new Class({
 MWF.xApplication.query.StatementDesigner.Statement = new Class({
     Extends: MWF.widget.Common,
     Extends: MWF.widget.Common,
@@ -156,10 +157,11 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
     },
     },
     loadStatementScriptEditor: function(){
     loadStatementScriptEditor: function(){
         if (! this.scriptEditor){
         if (! this.scriptEditor){
+            debugger;
             o2.require("o2.widget.ScriptArea", function(){
             o2.require("o2.widget.ScriptArea", function(){
                 this.scriptEditor = new o2.widget.ScriptArea(this.scriptArea, {
                 this.scriptEditor = new o2.widget.ScriptArea(this.scriptArea, {
                     "isbind": false,
                     "isbind": false,
-                    "maxObj": this.designer.content,
+                    "maxObj": this.designer.designNode,
                     "title": this.designer.lp.scriptTitle,
                     "title": this.designer.lp.scriptTitle,
                     "onChange": function(){
                     "onChange": function(){
                         this.json.scriptText = this.scriptEditor.toJson().code;
                         this.json.scriptText = this.scriptEditor.toJson().code;
@@ -209,6 +211,7 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
                     this.json.data = this.editor.editor.getValue();
                     this.json.data = this.editor.editor.getValue();
 
 
                     this.editor.addEditorEvent("change", function(){
                     this.editor.addEditorEvent("change", function(){
+                        debugger;
                         this.data.data = this.editor.getValue();
                         this.data.data = this.editor.getValue();
                         this.checkJpqlType();
                         this.checkJpqlType();
                     }.bind(this));
                     }.bind(this));

+ 9 - 0
o2web/source/x_component_service_AgentDesigner/$Main/default/toolbars.html

@@ -64,5 +64,14 @@
         <option value="xcode">xcode</option>
         <option value="xcode">xcode</option>
     </select></div>
     </select></div>
 
 
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
 
 
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
 </div>
 </div>

+ 18 - 1
o2web/source/x_component_service_AgentDesigner/Agent.js

@@ -96,7 +96,7 @@ MWF.xApplication.service.AgentDesigner.Agent = new Class({
 
 
 
 
 
 
-        this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
+        this.editor = new MWF.widget.JavascriptEditor(this.areaNode, {"runtime": "service"});
         this.editor.load(function(){
         this.editor.load(function(){
             if (this.data.text){
             if (this.data.text){
                 this.editor.editor.setValue(this.data.text);
                 this.editor.editor.setValue(this.data.text);
@@ -165,6 +165,23 @@ MWF.xApplication.service.AgentDesigner.Agent = new Class({
                     break;
                     break;
                 }
                 }
             }
             }
+
+            options = this.designer.editorSelectNode.options;
+            for (var i=0; i<options.length; i++){
+                var option = options[i];
+                if (option.value==this.editor.options.type){
+                    option.set("selected", true);
+                    break;
+                }
+            }
+
+            if (this.editor.options.type=="ace"){
+                this.designer.monacoStyleSelectNode.hide();
+                this.designer.styleSelectNode.show();
+            }else{
+                this.designer.monacoStyleSelectNode.show();
+                this.designer.styleSelectNode.hide();
+            }
         }.bind(this));
         }.bind(this));
 
 
         if (this.options.showTab) this.page.showTabIm();
         if (this.options.showTab) this.page.showTabIm();

+ 53 - 7
o2web/source/x_component_service_AgentDesigner/Main.js

@@ -350,17 +350,57 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.agentTab.pages.each(function(page){
+            var editor = page.agent.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.agentTab.pages.each(function(page){
         this.agentTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.agent.editor.editor;
+            var editor = page.agent.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -368,6 +408,7 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -383,24 +424,29 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.agentTab.pages.each(function(page){
         this.agentTab.pages.each(function(page){
-            //if (!editorData) editorData = page.agent.editor.editorData;
-            var editor = page.agent.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            //if (!editorData) editorData = page.script.editor.editorData;
+            var editor = page.agent.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
-        //editorData.javaagentEditor.theme = value;
+        //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
-        MWF.editorData.javascriptEditor.theme = value;
 
 
-        MWF.UD.putData("editor", MWF.editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 10 - 0
o2web/source/x_component_service_InvokeDesigner/$Main/default/toolbars.html

@@ -62,4 +62,14 @@
     <option value="xcode">xcode</option>
     <option value="xcode">xcode</option>
     </select></div>
     </select></div>
 
 
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
+
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
 </div>
 </div>

+ 17 - 1
o2web/source/x_component_service_InvokeDesigner/Invoke.js

@@ -95,7 +95,7 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
 
 
 
 
 
 
-        this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
+        this.editor = new MWF.widget.JavascriptEditor(this.areaNode, {"runtime": "service"});
         this.editor.load(function(){
         this.editor.load(function(){
             if (this.data.text){
             if (this.data.text){
                 this.editor.editor.setValue(this.data.text);
                 this.editor.editor.setValue(this.data.text);
@@ -172,6 +172,22 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
                     break;
                     break;
                 }
                 }
             }
             }
+            options = this.designer.editorSelectNode.options;
+            for (var i=0; i<options.length; i++){
+                var option = options[i];
+                if (option.value==this.editor.options.type){
+                    option.set("selected", true);
+                    break;
+                }
+            }
+
+            if (this.editor.options.type=="ace"){
+                this.designer.monacoStyleSelectNode.hide();
+                this.designer.styleSelectNode.show();
+            }else{
+                this.designer.monacoStyleSelectNode.show();
+                this.designer.styleSelectNode.hide();
+            }
         }.bind(this));
         }.bind(this));
 
 
         if (this.options.showTab) this.page.showTabIm();
         if (this.options.showTab) this.page.showTabIm();

+ 54 - 7
o2web/source/x_component_service_InvokeDesigner/Main.js

@@ -350,17 +350,58 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.invokeTab.pages.each(function(page){
+            var editor = page.invoke.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.invokeTab.pages.each(function(page){
         this.invokeTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.invoke.editor.editor;
+            var editor = page.invoke.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -368,6 +409,7 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -383,24 +425,29 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.invokeTab.pages.each(function(page){
         this.invokeTab.pages.each(function(page){
-            //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.invoke.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            //if (!editorData) editorData = page.script.editor.editorData;
+            var editor = page.invoke.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
-        //editorData.javainvokeEditor.theme = value;
+        //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
-        MWF.editorData.javascriptEditor.theme = value;
 
 
-        MWF.UD.putData("editor", MWF.editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 19 - 0
o2web/source/x_desktop/js/initalServiceScriptSubstitute.js

@@ -0,0 +1,19 @@
+var resources = {
+        "getEntityManagerContainer": function(){ return {}; },
+        "getContext": function(){ return {}; },
+        "getApplications": function(){ return {}; },
+        "getOrganization": function(){
+                return {
+                        group: function(){ return {}; },
+                        identity: function(){ return {}; },
+                        person: function(){ return {}; },
+                        personAttribute: function(){ return {}; },
+                        role: function(){ return {}; },
+                        unit: function(){ return {}; },
+                        unitAttribute: function(){ return {}; },
+                        unitDuty: function(){ return {}; }
+                };
+        },
+        "getWebservicesClient": function(){ return {}; }
+};
+var effectivePerson = this.effectivePerson = {};