System.register(["reactive-jsx"], function (_export, _context) {
  "use strict";

  var _addSourceLocation;

  return {
    setters: [function (_reactiveJsx) {
      _addSourceLocation = _reactiveJsx.addSourceLocation;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._src_components_widgets_lively_code_mirror_code_augmentations_js = _recorder_._src_components_widgets_lively_code_mirror_code_augmentations_js || {};
      class CodeMirrorCodeAugmentations {

        constructor(astCapabilities, codeMirror) {
          this.astCapabilities = astCapabilities;
          this.codeMirror = codeMirror;
          this.updateColorPickers();
        }

        codeChanged() {
          this.updateColorPickers();
        }
        /*MD ## Color Picker MD*/

        updateColorPickers() {
          const colorLiterals = this.astCapabilities.getColorLiterals();
          if (!colorLiterals) {
            return;
          }
          var red = "#800080";
          const old = this.codeMirror.getAllMarks();
          old.forEach(marker => {
            if (marker.type === "bookmark") {
              marker.clear();
            }
          });
          colorLiterals.forEach(path => {
            const location = { line: path.node.loc.end.line - 1, ch: path.node.loc.end.column };
            var picker = _addSourceLocation(document.createElement("input"), {
              file: 'https://lively-kernel.org/lively4/lively4-function-completion/src/components/widgets/lively-code-mirror-code-augmentations.js',
              end: {
                column: 50,
                line: 28
              },
              start: {
                column: 19,
                line: 28
              }
            });
            picker.type = "color";
            picker.value = path.node.value;
            picker.height = "15";
            picker.width = "15";
            const bookmark = this.codeMirror.setBookmark(location, picker);
            picker.addEventListener('change', event => {
              const currentLocation = bookmark.find();
              this.astCapabilities.updateColor(currentLocation, event.target.value);
            });
          });
        }
      }

      _export("default", CodeMirrorCodeAugmentations);

      Object.defineProperty(_recorder_._src_components_widgets_lively_code_mirror_code_augmentations_js, "CodeMirrorCodeAugmentations", {
        get() {
          return CodeMirrorCodeAugmentations;
        },

        set(thisIsVererySecretVariableName) {
          _export("default", CodeMirrorCodeAugmentations = thisIsVererySecretVariableName);

          return true;
        },

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