"enable aexpr";

System.register(['active-expression-rewriting', 'reactive-jsx', 'src/components/widgets/lively-morph.js', 'systemjs-babel-build', 'utils'], function (_export, _context) {
  "use strict";

  var _setMember, _getAndCallMember, _setLocal, _getLocal, _getMember, _getGlobal, _traceMember, _children, _attributeExpression, _attributes, _element, _addSourceLocation, Morph, babelDefault, promisedEvent, through, generateUUID;

  return {
    setters: [function (_activeExpressionRewriting) {
      _setMember = _activeExpressionRewriting.setMember;
      _getAndCallMember = _activeExpressionRewriting.getAndCallMember;
      _setLocal = _activeExpressionRewriting.setLocal;
      _getLocal = _activeExpressionRewriting.getLocal;
      _getMember = _activeExpressionRewriting.getMember;
      _getGlobal = _activeExpressionRewriting.getGlobal;
      _traceMember = _activeExpressionRewriting.traceMember;
    }, function (_reactiveJsx) {
      _children = _reactiveJsx.children;
      _attributeExpression = _reactiveJsx.attributeExpression;
      _attributes = _reactiveJsx.attributes;
      _element = _reactiveJsx.element;
      _addSourceLocation = _reactiveJsx.addSourceLocation;
    }, function (_srcComponentsWidgetsLivelyMorphJs) {
      Morph = _srcComponentsWidgetsLivelyMorphJs.default;
    }, function (_systemjsBabelBuild) {
      babelDefault = _systemjsBabelBuild.default;
    }, function (_utils) {
      promisedEvent = _utils.promisedEvent;
      through = _utils.through;
      generateUUID = _utils.uuid;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._src_components_widgets_lively_code_mirror_widget_import_js = _recorder_._src_components_widgets_lively_code_mirror_widget_import_js || {};
      let _scope = {};
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'Morph', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Morph', Morph) : void 0, Morph;
        },

        set(thisIsVererySecretVariableName) {
          let _scope2 = {};
          Morph = (self.__expressionAnalysisMode__ ? _getLocal(_scope2, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'Morph', Morph) : void 0, Morph;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'babelDefault', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babelDefault', babelDefault) : void 0, babelDefault;
        },

        set(thisIsVererySecretVariableName) {
          let _scope3 = {};
          babelDefault = (self.__expressionAnalysisMode__ ? _getLocal(_scope3, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'babelDefault', babelDefault) : void 0, babelDefault;
          return true;
        },

        enumerable: true,
        configurable: true
      });

      const babel = _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babelDefault', babelDefault) : void 0, babelDefault), 'babel');
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'babel', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babel', babel) : void 0, babel;
        },

        set(thisIsVererySecretVariableName) {
          let _scope4 = {};
          babel = (self.__expressionAnalysisMode__ ? _getLocal(_scope4, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'babel', babel) : void 0, babel;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'generateUUID', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'generateUUID', generateUUID) : void 0, generateUUID;
        },

        set(thisIsVererySecretVariableName) {
          let _scope5 = {};
          generateUUID = (self.__expressionAnalysisMode__ ? _getLocal(_scope5, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'generateUUID', generateUUID) : void 0, generateUUID;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'through', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'through', through) : void 0, through;
        },

        set(thisIsVererySecretVariableName) {
          let _scope6 = {};
          through = (self.__expressionAnalysisMode__ ? _getLocal(_scope6, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'through', through) : void 0, through;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'promisedEvent', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'promisedEvent', promisedEvent) : void 0, promisedEvent;
        },

        set(thisIsVererySecretVariableName) {
          let _scope7 = {};
          promisedEvent = (self.__expressionAnalysisMode__ ? _getLocal(_scope7, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'promisedEvent', promisedEvent) : void 0, promisedEvent;
          return true;
        },

        enumerable: true,
        configurable: true
      });


      const filesPromise = new (self.__expressionAnalysisMode__ ? _getGlobal('Promise') : void 0, Promise)(resolve => {
        let _scope11 = {};

        return _getAndCallMember(_getAndCallMember(_getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively), 'files'), 'walkDir', [(self.__expressionAnalysisMode__ ? _getGlobal('lively4url') : void 0, lively4url)]), 'then', [files => {
          let _scope8 = {};
          return _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(Object, 'keys') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).keys(_getMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('SystemJS') : void 0, SystemJS), '@@loader-config'), 'map'))), 'concat', [_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(files, 'filter') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope8, 'files', files) : void 0, files).filter(file => {
            let _scope9 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(file, 'endsWith') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope9, 'file', file) : void 0, file).endsWith('.js');
          })), 'map', [file => {
            let _scope10 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(file, 'replace') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope10, 'file', file) : void 0, file).replace((self.__expressionAnalysisMode__ ? _getGlobal('lively4url') : void 0, lively4url), '');
          }])]);
        }]), 'then', [(self.__expressionAnalysisMode__ ? _getLocal(_scope11, 'resolve', resolve) : void 0, resolve)]);
      });

      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'filesPromise', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'filesPromise', filesPromise) : void 0, filesPromise;
        },

        set(thisIsVererySecretVariableName) {
          let _scope12 = {};
          filesPromise = (self.__expressionAnalysisMode__ ? _getLocal(_scope12, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'filesPromise', filesPromise) : void 0, filesPromise;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      class LivelyCodeMirrorWidgetImport extends Morph {

        static getAST(src) {
          let _scope13 = {},
              _scope14 = {};

          try {
            const filename = "tempfile.js";
            // get pure ast
            return _getMember((self.__expressionAnalysisMode__ ? _traceMember(babel, 'transform') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babel', babel) : void 0, babel).transform((self.__expressionAnalysisMode__ ? _getLocal(_scope13, 'src', src) : void 0, src), {
              babelrc: false,
              plugins: [], // no need for any syntax plugins (other than the SystemJS internal) as we only parse import statements
              presets: [],
              filename: filename,
              sourceFileName: filename,
              moduleIds: false,
              sourceMaps: false,
              // inputSourceMap: load.metadata.sourceMap,
              compact: false,
              comments: false,
              code: false,
              ast: true,
              resolveModuleSource: undefined
            })), 'ast');
          } catch (e) {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'warn');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).warn('could not get ast for import statement', (self.__expressionAnalysisMode__ ? _getLocal(_scope14, 'e', e) : void 0, e));
          }
        }

        static createWidgetContainer() {
          let _scope15 = {};

          var widget = _addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(document, 'createElement') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('document') : void 0, document).createElement("span")), {
            file: 'https://lively-kernel.org/lively4/lively4-stephelm/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 47,
              line: 47
            },
            start: {
              column: 17,
              line: 47
            }
          });
          if (self.__expressionAnalysisMode__) _traceMember(Object, 'assign');
          (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).assign(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope15, 'widget', widget) : void 0, widget), 'style'), {
            whiteSpace: "normal"
          });
          return self.__expressionAnalysisMode__ ? _getLocal(_scope15, 'widget', widget) : void 0, widget;
        }

        static async importWidgetForRange(cm, m) {
          let _scope16 = {};

          const ast = (self.__expressionAnalysisMode__ ? _traceMember(this, 'getAST') : void 0, this.getAST(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0, m), 0)));
          if (!(self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'ast', ast) : void 0, ast)) {
            return;
          }

          const from = _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0, cm), 'editor'), 'posFromIndex', [_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0, m), 'index')]);
          const to = _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0, cm), 'editor'), 'posFromIndex', [_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0, m), 'index') + _getMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0, m), 0), 'length')]);

          let marks = _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0, cm), 'editor'), 'findMarks', [(self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'from', from) : void 0, from), (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'to', to) : void 0, to)]);
          let existingMarker = (self.__expressionAnalysisMode__ ? _traceMember(marks, 'find') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'marks', marks) : void 0, marks).find(ea => {
            let _scope17 = {};
            return _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope17, 'ea', ea) : void 0, ea), 'importWidget');
          }));
          if (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'existingMarker', existingMarker) : void 0, existingMarker) {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'notify');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).notify("found import widget"
            // do we have to update it?
            );return;
          }

          var container = (self.__expressionAnalysisMode__ ? _traceMember(this, 'createWidgetContainer') : void 0, this.createWidgetContainer());
          // #TODO, we assume that it will keep the first widget, and further replacements do not work.... and get therefore thrown away
          var marker = _getAndCallMember(_getMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0, cm), 'editor'), 'doc'), 'markText', [(self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'from', from) : void 0, from), (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'to', to) : void 0, to), {
            replacedWith: container
          }]);
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'marker', marker) : void 0, marker), 'importWidget', (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'container', container) : void 0, container));
          // lively.warn('return after container replacement')
          // return;
          await _getAndCallMember(_addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(lively, 'create') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).create('lively-code-mirror-widget-import', (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'container', container) : void 0, container))), {
            file: 'https://lively-kernel.org/lively4/lively4-stephelm/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 70,
              line: 77
            },
            start: {
              column: 10,
              line: 77
            }
          }), 'then', [importWidget => {
            let _scope18 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(importWidget, 'initWidget') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope18, 'importWidget', importWidget) : void 0, importWidget).initWidget((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0, cm), (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0, m), (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'ast', ast) : void 0, ast), (self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'marker', marker) : void 0, marker));
          }]);
        }

        async initialize() {
          _setMember(this, 'windowTitle', "LivelyCodeMirrorWidgetImport");

          _getAndCallMember(_getMember(this, 'modulePath'), 'addEventListener', ["keydown", evt => {
            let _scope19 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'onModulePathKeyDown') : void 0, this.onModulePathKeyDown((self.__expressionAnalysisMode__ ? _getLocal(_scope19, 'evt', evt) : void 0, evt));
          }]);
        }

        get fileList() {
          return self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#fileList');
        }

        get modulePath() {
          return self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#modulePath');
        }

        prepareFileList() {
          if (self.__expressionAnalysisMode__) _traceMember(filesPromise, 'then');

          (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'filesPromise', filesPromise) : void 0, filesPromise).then(files => {
            let _scope20 = {};

            const fileList = _getMember(this, 'fileList');
            if (self.__expressionAnalysisMode__) _traceMember(files, 'forEach');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope20, 'files', files) : void 0, files).forEach(file => {
              let _scope21 = {};
              if (self.__expressionAnalysisMode__) _traceMember(fileList, 'appendChild');

              (self.__expressionAnalysisMode__ ? _getLocal(_scope20, 'fileList', fileList) : void 0, fileList).appendChild(_element('option', _attributes(_attributeExpression('value', (self.__expressionAnalysisMode__ ? _getLocal(_scope21, 'file', file) : void 0, file))), _children(), {
                file: 'https://lively-kernel.org/lively4/lively4-stephelm/src/components/widgets/lively-code-mirror-widget-import.js',
                end: {
                  column: 59,
                  line: 95
                },
                start: {
                  column: 29,
                  line: 95
                }
              }));
            });
          });
        }

        onFileChanged() {
          if (self.__expressionAnalysisMode__) _traceMember(lively, 'success');

          (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).success('file changed to', _getMember(_getMember(this, 'modulePath'), 'value'));
        }

        onModulePathKeyDown(evt) {
          let _scope22 = {};

          var input = _getMember(this, 'modulePath');
          var range = _getAndCallMember(_getMember(this, 'marker'), 'find', []);
          if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'evt', evt) : void 0, evt), 'keyCode') == 13) {// ENTER
            // #TODO how to replace // update text without replacing widgets
            // this.cm.editor.replaceRange(input.value, range.from, range.to) // @Stefan, your welcome! ;-)
            // this.wrapLinks() // don't wait and do what you can now
          }
          if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'evt', evt) : void 0, evt), 'keyCode') == 37) {
            // Left
            if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'input', input) : void 0, input), 'selectionStart') == 0) {
              _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'setSelection', [_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0, range), 'from'), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0, range), 'from')]);
              _getAndCallMember(_getMember(this, 'cm'), 'focus', []);
            }
          }

          if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'evt', evt) : void 0, evt), 'keyCode') == 39) {
            // Right
            if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'input', input) : void 0, input), 'selectionStart') == _getMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'input', input) : void 0, input), 'value'), 'length')) {
              _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'setSelection', [_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0, range), 'to'), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0, range), 'to')]);
              _getAndCallMember(_getMember(this, 'cm'), 'focus', []);
            }
          }
        }

        async initWidget(cm, m, ast, marker) {
          let _scope23 = {};

          _setMember(this, 'cm', (self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'cm', cm) : void 0, cm));
          _setMember(this, 'ast', (self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'ast', ast) : void 0, ast));
          _setMember(this, 'marker', (self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'marker', marker) : void 0, marker));

          // this.modulePath.onfocus= e => lively.notify('FOCUSSED')
          // this.modulePath.onblur = e =>{
          //   lively.notify('BLURRED')
          // } 

          if (self.__expressionAnalysisMode__) _traceMember(this, 'prepareFileList');
          this.prepareFileList();

          if (self.__expressionAnalysisMode__) _traceMember(CodeMirror, 'on');
          (self.__expressionAnalysisMode__ ? _getGlobal('CodeMirror') : void 0, CodeMirror).on((self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'marker', marker) : void 0, marker), "beforeCursorEnter", e => {
            let _scope25 = {};

            function posEq(a, b) {
              let _scope24 = {};
              return _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'a', a) : void 0, a), 'line') == _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'b', b) : void 0, b), 'line') && _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'a', a) : void 0, a), 'ch') == _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'b', b) : void 0, b), 'ch');
            }
            var direction = (self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'posEq', posEq) : void 0, posEq)(_getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'getCursor', []), _getMember(_getAndCallMember(_getMember(this, 'marker'), 'find', []), 'from')) ? 'left' : 'right';
            _setMember(_getMember(_getMember(this, 'cm'), 'editor'), 'widgetEnter', () => {
              return self.__expressionAnalysisMode__ ? _traceMember(this, 'onEnter') : void 0, this.onEnter((self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'direction', direction) : void 0, direction));
            });
          });

          await _getAndCallMember(_getAndCallMember(_addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(lively, 'create') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).create('lively-inspector', this)), {
            file: 'https://lively-kernel.org/lively4/lively4-stephelm/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 49,
              line: 145
            },
            start: {
              column: 10,
              line: 145
            }
          }), 'through', [inspector => {
            let _scope26 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(inspector, 'inspect') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope26, 'inspector', inspector) : void 0, inspector).inspect((self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'ast', ast) : void 0, ast));
          }]), 'through', [inspector => {
            let _scope27 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(inspector, 'hideWorkspace') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'inspector', inspector) : void 0, inspector).hideWorkspace();
          }]);
          _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'refresh', []);
        }

        onEnter(direction) {
          let _scope28 = {};

          // lively.success('ENTER FROM ' + direction)
          if (!_getAndCallMember(_getMember(this, 'marker'), 'find', [])) {
            _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'refresh', []);
          } else {
            if (self.__expressionAnalysisMode__) _traceMember(this, 'enter');

            // setTimeout(() => {
            this.enter((self.__expressionAnalysisMode__ ? _getLocal(_scope28, 'direction', direction) : void 0, direction));
            // }, 50);
          }
        }

        enter(direction) {
          let _scope29 = {};

          var module = _getMember(this, 'modulePath');
          // this.focus()
          if (self.__expressionAnalysisMode__) _traceMember(module, 'focus');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope29, 'module', module) : void 0, module).focus();
          (self.__expressionAnalysisMode__ ? _getGlobal('setTimeout') : void 0, setTimeout)(() => {
            if (self.__expressionAnalysisMode__) _traceMember(module, 'focus');

            (self.__expressionAnalysisMode__ ? _getLocal(_scope29, 'module', module) : void 0, module).focus(); // #Hack, code mirror itself (match-highlighter, etc will snatch the focus... ok, make thatt that the body has it
          }, 101);
          // const position = direction === 'left' ? 0 : module.value.length;
          // module.setSelectionRange(position, position);
        }
      }

      _export('default', LivelyCodeMirrorWidgetImport);

      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'LivelyCodeMirrorWidgetImport', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'LivelyCodeMirrorWidgetImport', LivelyCodeMirrorWidgetImport) : void 0, LivelyCodeMirrorWidgetImport;
        },

        set(thisIsVererySecretVariableName) {
          let _scope30 = {};
          _export('default', LivelyCodeMirrorWidgetImport = (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName)), true ? _setLocal(_scope, 'LivelyCodeMirrorWidgetImport', LivelyCodeMirrorWidgetImport) : void 0, LivelyCodeMirrorWidgetImport;
          return true;
        },

        enumerable: true,
        configurable: true
      });
    }
  };
});