'enable aexpr';

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

  var _aexpr, _getAndCallMember, _setMember, _setLocal, _getLocal, _getMember, _getGlobal, _traceMember, _attributeStringLiteral, _attributeExpression, _childElement, _childText, _childSpread, _childExpression, _children, _attributes, _element, Morph, Graph, Triple, _, TAG_URL, select, trackInstance, baseViewForClass, debounce;

  return {
    setters: [function (_activeExpressionRewriting) {
      _aexpr = _activeExpressionRewriting.aexpr;
      _getAndCallMember = _activeExpressionRewriting.getAndCallMember;
      _setMember = _activeExpressionRewriting.setMember;
      _setLocal = _activeExpressionRewriting.setLocal;
      _getLocal = _activeExpressionRewriting.getLocal;
      _getMember = _activeExpressionRewriting.getMember;
      _getGlobal = _activeExpressionRewriting.getGlobal;
      _traceMember = _activeExpressionRewriting.traceMember;
    }, function (_reactiveJsx) {
      _attributeStringLiteral = _reactiveJsx.attributeStringLiteral;
      _attributeExpression = _reactiveJsx.attributeExpression;
      _childElement = _reactiveJsx.childElement;
      _childText = _reactiveJsx.childText;
      _childSpread = _reactiveJsx.childSpread;
      _childExpression = _reactiveJsx.childExpression;
      _children = _reactiveJsx.children;
      _attributes = _reactiveJsx.attributes;
      _element = _reactiveJsx.element;
    }, function (_srcComponentsWidgetsLivelyMorphJs) {
      Morph = _srcComponentsWidgetsLivelyMorphJs.default;
    }, function (_srcClientTriplesTriplesJs) {
      Graph = _srcClientTriplesTriplesJs.Graph;
      Triple = _srcClientTriplesTriplesJs.Triple;
      _ = _srcClientTriplesTriplesJs._;
      TAG_URL = _srcClientTriplesTriplesJs.TAG_URL;
    }, function (_activeGroup) {
      select = _activeGroup.default;
      trackInstance = _activeGroup.trackInstance;
      baseViewForClass = _activeGroup.baseViewForClass;
    }, function (_utils) {
      debounce = _utils.debounce;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._templates_knot_view_js = _recorder_._templates_knot_view_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_), '_templates_knot_view_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_), '_templates_knot_view_js'), 'TAG_URL', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'TAG_URL', TAG_URL) : void 0, TAG_URL;
        },

        set(thisIsVererySecretVariableName) {
          let _scope3 = {};
          TAG_URL = (self.__expressionAnalysisMode__ ? _getLocal(_scope3, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'TAG_URL', TAG_URL) : void 0, TAG_URL;
          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_), '_templates_knot_view_js'), '_', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, '_', _) : void 0, _;
        },

        set(thisIsVererySecretVariableName) {
          let _scope4 = {};
          _ = (self.__expressionAnalysisMode__ ? _getLocal(_scope4, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, '_', _) : void 0, _;
          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_), '_templates_knot_view_js'), 'Triple', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Triple', Triple) : void 0, Triple;
        },

        set(thisIsVererySecretVariableName) {
          let _scope5 = {};
          Triple = (self.__expressionAnalysisMode__ ? _getLocal(_scope5, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'Triple', Triple) : void 0, Triple;
          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_), '_templates_knot_view_js'), 'Graph', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph;
        },

        set(thisIsVererySecretVariableName) {
          let _scope6 = {};
          Graph = (self.__expressionAnalysisMode__ ? _getLocal(_scope6, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'Graph', Graph) : void 0, Graph;
          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_), '_templates_knot_view_js'), 'baseViewForClass', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'baseViewForClass', baseViewForClass) : void 0, baseViewForClass;
        },

        set(thisIsVererySecretVariableName) {
          let _scope7 = {};
          baseViewForClass = (self.__expressionAnalysisMode__ ? _getLocal(_scope7, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'baseViewForClass', baseViewForClass) : void 0, baseViewForClass;
          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_), '_templates_knot_view_js'), 'trackInstance', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'trackInstance', trackInstance) : void 0, trackInstance;
        },

        set(thisIsVererySecretVariableName) {
          let _scope8 = {};
          trackInstance = (self.__expressionAnalysisMode__ ? _getLocal(_scope8, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'trackInstance', trackInstance) : void 0, trackInstance;
          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_), '_templates_knot_view_js'), 'select', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'select', select) : void 0, select;
        },

        set(thisIsVererySecretVariableName) {
          let _scope9 = {};
          select = (self.__expressionAnalysisMode__ ? _getLocal(_scope9, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'select', select) : void 0, select;
          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_), '_templates_knot_view_js'), 'debounce', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'debounce', debounce) : void 0, debounce;
        },

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

        enumerable: true,
        configurable: true
      });
      class KnotView extends Morph {
        get urlString() {
          return _getMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get("#path-to-load")), 'value');
        }
        get tagURLString() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'TAG_URL', TAG_URL) : void 0, TAG_URL;
        }

        async initialize() {
          let _scope11 = {};

          _setMember(this, 'windowTitle', "Knot View");

          var pathToLoad = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get("#path-to-load"));
          if (self.__expressionAnalysisMode__) _traceMember(pathToLoad, 'addEventListener');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope11, 'pathToLoad', pathToLoad) : void 0, pathToLoad).addEventListener('keyup', event => {
            let _scope12 = {};

            if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope12, 'event', event) : void 0, event), 'keyCode') == 13) {
              if (self.__expressionAnalysisMode__) _traceMember(this, 'onPathEntered');
              // ENTER
              this.onPathEntered(_getMember(this, 'urlString'));
            }
          });

          let editorComp = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#content-editor'));
          // editorComp.editor.setOptions({maxLines:Infinity});

          let urlToLoad = (self.__expressionAnalysisMode__ ? _traceMember(this, 'getAttribute') : void 0, this.getAttribute('data-knot-url'));
          if ((self.__expressionAnalysisMode__ ? _getLocal(_scope11, 'urlToLoad', urlToLoad) : void 0, urlToLoad) && (self.__expressionAnalysisMode__ ? _getLocal(_scope11, 'urlToLoad', urlToLoad) : void 0, urlToLoad) !== "") {
            if (self.__expressionAnalysisMode__) _traceMember(this, 'loadKnotForURL');

            this.loadKnotForURL((self.__expressionAnalysisMode__ ? _getLocal(_scope11, 'urlToLoad', urlToLoad) : void 0, urlToLoad));
          }

          if (self.__expressionAnalysisMode__) _traceMember(this, 'initAExprs');
          this.initAExprs();
        }

        knotLabel(knot, altText = "no knot label available") {
          let _scope13 = {};

          return (self.__expressionAnalysisMode__ ? _getLocal(_scope13, 'knot', knot) : void 0, knot) && _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope13, 'knot', knot) : void 0, knot), 'label') instanceof (self.__expressionAnalysisMode__ ? _getGlobal('Function') : void 0, Function) && (self.__expressionAnalysisMode__ ? _traceMember(knot, 'label') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope13, 'knot', knot) : void 0, knot).label()) || (self.__expressionAnalysisMode__ ? _getLocal(_scope13, 'altText', altText) : void 0, altText);
        }

        async initAExprs() {
          let _scope14 = {};
          if (self.__expressionAnalysisMode__) _traceMember(lively, 'success');

          (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).success('setup aexprs');

          let graph = await (self.__expressionAnalysisMode__ ? _traceMember(Graph, 'getInstance') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).getInstance());
          let tag = await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'requestKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope14, 'graph', graph) : void 0, graph).requestKnot(new (self.__expressionAnalysisMode__ ? _getGlobal('URL') : void 0, URL)((self.__expressionAnalysisMode__ ? _getLocal(_scope, 'TAG_URL', TAG_URL) : void 0, TAG_URL))));

          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#label-container')), 'appendChild', [_element('h1', _attributes(), _children(_childExpression(_aexpr(() => {
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'knotLabel') : void 0, this.knotLabel(_getMember(this, 'knot'));
          }, {
            location: {
              file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
              end: {
                column: 29,
                line: 48
              },
              start: {
                column: 24,
                line: 48
              },
              source: ''
            }
          }))), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 68,
              line: 48
            },
            start: {
              column: 19,
              line: 48
            }
          })]);

          const triples = (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'select', select) : void 0, select)((self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Triple', Triple) : void 0, Triple));

          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#r-po-table')), 'appendChild', [_element('tbody', _attributes(), _children(_childSpread(_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(triples, 'filter') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope14, 'triples', triples) : void 0, triples).filter(t => {
            let _scope15 = {};
            return _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope15, 't', t) : void 0, t), 'subject') === _getMember(this, 'knot');
          })), 'map', [t => {
            let _scope16 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableRowFor') : void 0, this.buildTableRowFor((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 't', t) : void 0, t), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 't', t) : void 0, t), 'predicate'), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope16, 't', t) : void 0, t), 'object'));
          }]))), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 17,
              line: 56
            },
            start: {
              column: 40,
              line: 52
            }
          })]);

          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#r-so-table')), 'appendChild', [_element('tbody', _attributes(), _children(_childSpread(_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(triples, 'filter') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope14, 'triples', triples) : void 0, triples).filter(t => {
            let _scope17 = {};
            return _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope17, 't', t) : void 0, t), 'predicate') === _getMember(this, 'knot');
          })), 'map', [t => {
            let _scope18 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableRowFor') : void 0, this.buildTableRowFor((self.__expressionAnalysisMode__ ? _getLocal(_scope18, 't', t) : void 0, t), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope18, 't', t) : void 0, t), 'subject'), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope18, 't', t) : void 0, t), 'object'));
          }]))), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 17,
              line: 62
            },
            start: {
              column: 40,
              line: 58
            }
          })]);

          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#r-sp-table')), 'appendChild', [_element('tbody', _attributes(), _children(_childSpread(_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(triples, 'filter') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope14, 'triples', triples) : void 0, triples).filter(t => {
            let _scope19 = {};
            return _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope19, 't', t) : void 0, t), 'object') === _getMember(this, 'knot');
          })), 'map', [t => {
            let _scope20 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableRowFor') : void 0, this.buildTableRowFor((self.__expressionAnalysisMode__ ? _getLocal(_scope20, 't', t) : void 0, t), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope20, 't', t) : void 0, t), 'subject'), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope20, 't', t) : void 0, t), 'predicate'));
          }]))), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 17,
              line: 68
            },
            start: {
              column: 40,
              line: 64
            }
          })]);
        }

        buildMetadata(knot) {
          let _scope21 = {};

          const metadataTable = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get("#metadata-table"));
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope21, 'metadataTable', metadataTable) : void 0, metadataTable), 'innerHTML', "");

          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(Object, 'entries') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).entries((self.__expressionAnalysisMode__ ? _traceMember(knot, 'getMetadata') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope21, 'knot', knot) : void 0, knot).getMetadata()))), 'forEach', [entry => {
            let _scope22 = {};

            const key = _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'entry', entry) : void 0, entry), 0);
            const value = _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'entry', entry) : void 0, entry), 1);
            // for (const [key, value] of Object.entries(knot.getMetadata())) {
            if (self.__expressionAnalysisMode__) _traceMember(metadataTable, 'appendChild');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope21, 'metadataTable', metadataTable) : void 0, metadataTable).appendChild(_element('tr', _attributes(), _children((self.__expressionAnalysisMode__ ? _getGlobal('_childText') : void 0, _childText)('\n        '), (self.__expressionAnalysisMode__ ? _getGlobal('_childElement') : void 0, _childElement)(_element('td', _attributes(), _children(_childExpression((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'key', key) : void 0, key))), {
              file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
              end: {
                column: 22,
                line: 80
              },
              start: {
                column: 8,
                line: 80
              }
            })), _childText('\n        '), _childElement(_element('td', _attributes(), _children(_childExpression((self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'value', value) : void 0, value))), {
              file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
              end: {
                column: 24,
                line: 81
              },
              start: {
                column: 8,
                line: 81
              }
            })), _childText('\n      ')), {
              file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
              end: {
                column: 11,
                line: 82
              },
              start: {
                column: 32,
                line: 79
              }
            }));
            // }
          }]);
        }

        buildNavigatableLinkFor(knot) {
          let _scope23 = {};

          return _element('a', _attributes(_attributeExpression('click', e => {
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'loadKnotForURL') : void 0, this.loadKnotForURL(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'knot', knot) : void 0, knot), 'fileName'));
          })), _children(_childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(knot, 'label') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'knot', knot) : void 0, knot).label())), _childText('\n    ')), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 8,
              line: 90
            },
            start: {
              column: 11,
              line: 88
            }
          });
        }
        buildRefFor(knot) {
          let _scope24 = {};

          return self.__expressionAnalysisMode__ ? _traceMember(this, 'buildNavigatableLinkFor') : void 0, this.buildNavigatableLinkFor((self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'knot', knot) : void 0, knot));
        }
        buildTableDataFor(knot) {
          let _scope25 = {};

          return _element('td', _attributes(), _children(_childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildRefFor') : void 0, this.buildRefFor((self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'knot', knot) : void 0, knot)))), _childText('\n      '), _childElement(_element('i', _attributes(_attributeStringLiteral('class', 'fa fa-search'), _attributeExpression('click', e => {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'openInspector');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).openInspector((self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'knot', knot) : void 0, knot), (self.__expressionAnalysisMode__ ? _getGlobal('undefined') : void 0, undefined), (self.__expressionAnalysisMode__ ? _traceMember(knot, 'label') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'knot', knot) : void 0, knot).label()));
          })), _children(), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 13,
              line: 100
            },
            start: {
              column: 6,
              line: 98
            }
          })), _childText('\n    ')), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 9,
              line: 101
            },
            start: {
              column: 11,
              line: 96
            }
          });
        }
        buildTableRowFor(triple, knot1, knot2) {
          let _scope26 = {};

          return _element('tr', _attributes(), _children(_childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableDataFor') : void 0, this.buildTableDataFor((self.__expressionAnalysisMode__ ? _getLocal(_scope26, 'knot1', knot1) : void 0, knot1)))), _childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableDataFor') : void 0, this.buildTableDataFor((self.__expressionAnalysisMode__ ? _getLocal(_scope26, 'knot2', knot2) : void 0, knot2)))), _childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableDataFor') : void 0, this.buildTableDataFor((self.__expressionAnalysisMode__ ? _getLocal(_scope26, 'triple', triple) : void 0, triple)))), _childText('\n    ')), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 9,
              line: 108
            },
            start: {
              column: 11,
              line: 104
            }
          });
        }
        async replaceTableBodyFor(selector, s, p, o, propForFirstCell, propForSecondCell) {
          let _scope27 = {};

          let graph = await (self.__expressionAnalysisMode__ ? _traceMember(Graph, 'getInstance') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).getInstance());
          let poTableBody = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get((self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'selector', selector) : void 0, selector) + ' tbody'));
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'poTableBody', poTableBody) : void 0, poTableBody), 'innerHTML', "");
          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(graph, 'query') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'graph', graph) : void 0, graph).query((self.__expressionAnalysisMode__ ? _getLocal(_scope27, 's', s) : void 0, s), (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'p', p) : void 0, p), (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'o', o) : void 0, o))), 'forEach', [triple => {
            let _scope28 = {};
            if (self.__expressionAnalysisMode__) _traceMember(poTableBody, 'appendChild');

            (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'poTableBody', poTableBody) : void 0, poTableBody).appendChild((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTableRowFor') : void 0, this.buildTableRowFor((self.__expressionAnalysisMode__ ? _getLocal(_scope28, 'triple', triple) : void 0, triple), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope28, 'triple', triple) : void 0, triple), (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'propForFirstCell', propForFirstCell) : void 0, propForFirstCell)), _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope28, 'triple', triple) : void 0, triple), (self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'propForSecondCell', propForSecondCell) : void 0, propForSecondCell)))));
          }]);
        }

        async loadKnotForURL(url) {
          let _scope29 = {};

          return self.__expressionAnalysisMode__ ? _traceMember(this, 'loadKnot') : void 0, this.loadKnot((self.__expressionAnalysisMode__ ? _getLocal(_scope29, 'url', url) : void 0, url));
        }
        async loadKnot(url) {
          let _scope30 = {};

          let graph = await (self.__expressionAnalysisMode__ ? _traceMember(Graph, 'getInstance') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).getInstance());
          let knot = await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'requestKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'graph', graph) : void 0, graph).requestKnot(new (self.__expressionAnalysisMode__ ? _getGlobal('URL') : void 0, URL)((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'url', url) : void 0, url))));
          _setMember(this, 'knot', (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'knot', knot) : void 0, knot));

          _setMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get("#path-to-load")), 'value', _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'knot', knot) : void 0, knot), 'url'));

          let deleteKnot = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#delete-button'));
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'deleteKnot', deleteKnot) : void 0, deleteKnot), 'onclick', event => {
            let _scope31 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'deleteKnot') : void 0, this.deleteKnot((self.__expressionAnalysisMode__ ? _getLocal(_scope31, 'event', event) : void 0, event));
          });

          // URLs
          let urlList = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get("#url-list"));
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'urlList', urlList) : void 0, urlList), 'innerHTML', "");
          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(graph, 'getUrlsByKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'graph', graph) : void 0, graph).getUrlsByKnot((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'knot', knot) : void 0, knot))), 'forEach', [url => {
            let _scope33 = {};

            function isExternalLink(url) {
              let _scope32 = {};

              try {
                return self.__expressionAnalysisMode__ ? _traceMember(Graph, 'isExternalURL') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).isExternalURL(new (self.__expressionAnalysisMode__ ? _getGlobal('URL') : void 0, URL)((self.__expressionAnalysisMode__ ? _getLocal(_scope32, 'url', url) : void 0, url)));
              } catch (e) {
                return false;
              }
            }

            async function followURL(e) {
              let _scope35 = {};

              if ((self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'isExternalLink', isExternalLink) : void 0, isExternalLink)((self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'url', url) : void 0, url))) {
                if (self.__expressionAnalysisMode__) _traceMember(window, 'open');

                (self.__expressionAnalysisMode__ ? _getGlobal('window') : void 0, window).open((self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'url', url) : void 0, url));
              } else {
                let _scope34 = {};

                const container = await (self.__expressionAnalysisMode__ ? _traceMember(lively, 'openBrowser') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).openBrowser((self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'url', url) : void 0, url), false));
                if (self.__expressionAnalysisMode__) _traceMember(container, 'focus');
                (self.__expressionAnalysisMode__ ? _getLocal(_scope34, 'container', container) : void 0, container).focus();
              }
              if (self.__expressionAnalysisMode__) _traceMember(e, 'preventDefault');
              (self.__expressionAnalysisMode__ ? _getLocal(_scope35, 'e', e) : void 0, e).preventDefault();
              if (self.__expressionAnalysisMode__) _traceMember(e, 'stopPropagation');
              (self.__expressionAnalysisMode__ ? _getLocal(_scope35, 'e', e) : void 0, e).stopPropagation();
              return true;
            }

            if (self.__expressionAnalysisMode__) _traceMember(urlList, 'appendChild');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'urlList', urlList) : void 0, urlList).appendChild(_element('li', _attributes(_attributeExpression('click', (self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'followURL', followURL) : void 0, followURL))), _children(_childText('\n        '), _childExpression((self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'isExternalLink', isExternalLink) : void 0, isExternalLink)((self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'url', url) : void 0, url)) ? (self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'url', url) : void 0, url) + '<i class="fa fa-external-link"></i>' : (self.__expressionAnalysisMode__ ? _getLocal(_scope33, 'url', url) : void 0, url)), _childText('\n      ')), {
              file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
              end: {
                column: 11,
                line: 167
              },
              start: {
                column: 26,
                line: 162
              }
            }));
          }]);

          // Tags
          let tag = await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'requestKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'graph', graph) : void 0, graph).requestKnot(new (self.__expressionAnalysisMode__ ? _getGlobal('URL') : void 0, URL)((self.__expressionAnalysisMode__ ? _getLocal(_scope, 'TAG_URL', TAG_URL) : void 0, TAG_URL))));
          let tagContainer = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#tag-container'));
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'tagContainer', tagContainer) : void 0, tagContainer), 'innerHTML', "");
          _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(graph, 'query') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'graph', graph) : void 0, graph).query((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'knot', knot) : void 0, knot), (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'tag', tag) : void 0, tag), (self.__expressionAnalysisMode__ ? _getLocal(_scope, '_', _) : void 0, _))), 'forEach', [triple => {
            let _scope36 = {};

            let tagElement = (self.__expressionAnalysisMode__ ? _traceMember(this, 'buildTagWidget') : void 0, this.buildTagWidget(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope36, 'triple', triple) : void 0, triple), 'object'), (self.__expressionAnalysisMode__ ? _getLocal(_scope36, 'triple', triple) : void 0, triple)));
            if (self.__expressionAnalysisMode__) _traceMember(tagContainer, 'appendChild');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'tagContainer', tagContainer) : void 0, tagContainer).appendChild((self.__expressionAnalysisMode__ ? _getLocal(_scope36, 'tagElement', tagElement) : void 0, tagElement));
          }]);
          _setMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#add-tag')), 'onclick', event => {
            let _scope37 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'addTag') : void 0, this.addTag((self.__expressionAnalysisMode__ ? _getLocal(_scope37, 'event', event) : void 0, event));
          });

          // spo tables
          // this.replaceTableBodyFor('#po-table', knot, _, _, 'predicate', 'object');
          // this.replaceTableBodyFor('#so-table', _, knot, _, 'subject', 'object');
          // this.replaceTableBodyFor('#sp-table', _, _, knot, 'subject', 'predicate');

          // add button behavior
          _setMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#r-add-triple-as-subject')), 'onclick', evt => {
            let _scope38 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'addTripleWithKnotAsSubject') : void 0, this.addTripleWithKnotAsSubject((self.__expressionAnalysisMode__ ? _getLocal(_scope38, 'evt', evt) : void 0, evt));
          });
          _setMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#r-add-triple-as-predicate')), 'onclick', evt => {
            let _scope39 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'addTripleWithKnotAsPredicate') : void 0, this.addTripleWithKnotAsPredicate((self.__expressionAnalysisMode__ ? _getLocal(_scope39, 'evt', evt) : void 0, evt));
          });
          _setMember((self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#r-add-triple-as-object')), 'onclick', evt => {
            let _scope40 = {};
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'addTripleWithKnotAsObject') : void 0, this.addTripleWithKnotAsObject((self.__expressionAnalysisMode__ ? _getLocal(_scope40, 'evt', evt) : void 0, evt));
          });

          // metadata
          //this.buildMetadata(knot);

          // content
          if (self.__expressionAnalysisMode__) _traceMember(this, 'buildContentFor');
          this.buildContentFor((self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'knot', knot) : void 0, knot));
        }

        buildTagWidget(tag, triple) {
          let _scope41 = {};

          return _element('div', _attributes(), _children(_childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildNavigatableLinkFor') : void 0, this.buildNavigatableLinkFor((self.__expressionAnalysisMode__ ? _getLocal(_scope41, 'tag', tag) : void 0, tag)))), _childText('\n      '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildDeleteTagElement') : void 0, this.buildDeleteTagElement((self.__expressionAnalysisMode__ ? _getLocal(_scope41, 'triple', triple) : void 0, triple)))), _childText('\n    ')), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 10,
              line: 202
            },
            start: {
              column: 11,
              line: 199
            }
          });
        }
        buildDeleteTagElement(triple) {
          let _scope42 = {};

          return _element('i', _attributes(_attributeStringLiteral('class', 'fa fa-trash'), _attributeExpression('click', e => {
            if (self.__expressionAnalysisMode__) _traceMember(this, 'deleteTagTriple');

            this.deleteTagTriple((self.__expressionAnalysisMode__ ? _getLocal(_scope42, 'triple', triple) : void 0, triple));
          })), _children(), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 11,
              line: 207
            },
            start: {
              column: 11,
              line: 205
            }
          });
        }
        async deleteTagTriple(triple) {
          let _scope43 = {};

          const graph = await (self.__expressionAnalysisMode__ ? _traceMember(Graph, 'getInstance') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).getInstance());
          const knot = await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'requestKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope43, 'graph', graph) : void 0, graph).requestKnot(new (self.__expressionAnalysisMode__ ? _getGlobal('URL') : void 0, URL)(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope43, 'triple', triple) : void 0, triple), 'fileName'))));

          if (await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'deleteKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope43, 'graph', graph) : void 0, graph).deleteKnot((self.__expressionAnalysisMode__ ? _getLocal(_scope43, 'knot', knot) : void 0, knot)))) {
            if (self.__expressionAnalysisMode__) _traceMember(this, 'refresh');

            this.refresh();
          } else {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'notify');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).notify(`did not delete tag ${_getMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope43, 'triple', triple) : void 0, triple), 'object'), 'fileName')}`);
          }
        }

        refresh() {
          if (self.__expressionAnalysisMode__) _traceMember(this, 'loadKnot');

          this.loadKnot(_getMember(this, 'urlString'));
        }
        async deleteKnot() {
          let _scope44 = {};

          const graph = await (self.__expressionAnalysisMode__ ? _traceMember(Graph, 'getInstance') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).getInstance());
          const knot = await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'requestKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope44, 'graph', graph) : void 0, graph).requestKnot(new (self.__expressionAnalysisMode__ ? _getGlobal('URL') : void 0, URL)(_getMember(this, 'urlString'))));

          if (await (self.__expressionAnalysisMode__ ? _traceMember(graph, 'deleteKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope44, 'graph', graph) : void 0, graph).deleteKnot((self.__expressionAnalysisMode__ ? _getLocal(_scope44, 'knot', knot) : void 0, knot)))) {
            let _scope45 = {};

            const elementToRemove = _getMember(_getMember(this, 'parentElement'), 'isWindow') ? _getMember(this, 'parentElement') : this;
            if (self.__expressionAnalysisMode__) _traceMember(elementToRemove, 'remove');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope45, 'elementToRemove', elementToRemove) : void 0, elementToRemove).remove();
          } else {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'notify');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).notify(`did not delete knot ${_getMember(this, 'urlString')}`);
          }
        }

        async createAddTriple() {
          let _scope46 = {};

          const addTriple = await (self.__expressionAnalysisMode__ ? _traceMember(lively, 'openComponentInWindow') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).openComponentInWindow("add-triple"));
          _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope46, 'addTriple', addTriple) : void 0, addTriple), 'afterSubmit', () => {
            _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope46, 'addTriple', addTriple) : void 0, addTriple), 'parentElement'), 'remove', []);
            if (self.__expressionAnalysisMode__) _traceMember(this, 'refresh');
            this.refresh();
          });
          return self.__expressionAnalysisMode__ ? _getLocal(_scope46, 'addTriple', addTriple) : void 0, addTriple;
        }
        async addTag(event) {
          let _scope47 = {};

          const addTriple = await (self.__expressionAnalysisMode__ ? _traceMember(this, 'createAddTriple') : void 0, this.createAddTriple());

          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'setField');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope47, 'addTriple', addTriple) : void 0, addTriple).setField('subject', _getMember(this, 'urlString'));
          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'setField');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope47, 'addTriple', addTriple) : void 0, addTriple).setField('predicate', _getMember(this, 'tagURLString'));
          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'focus');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope47, 'addTriple', addTriple) : void 0, addTriple).focus('object');
        }

        async addTripleWithKnotAsSubject() {
          let _scope48 = {};

          const addTriple = await (self.__expressionAnalysisMode__ ? _traceMember(this, 'createAddTriple') : void 0, this.createAddTriple());

          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'setField');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope48, 'addTriple', addTriple) : void 0, addTriple).setField('subject', _getMember(this, 'urlString'));
          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'focus');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope48, 'addTriple', addTriple) : void 0, addTriple).focus('predicate');
        }

        async addTripleWithKnotAsPredicate() {
          let _scope49 = {};

          const addTriple = await (self.__expressionAnalysisMode__ ? _traceMember(this, 'createAddTriple') : void 0, this.createAddTriple());

          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'setField');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope49, 'addTriple', addTriple) : void 0, addTriple).setField('predicate', _getMember(this, 'urlString'));
          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'focus');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope49, 'addTriple', addTriple) : void 0, addTriple).focus('subject');
        }

        async addTripleWithKnotAsObject() {
          let _scope50 = {};

          const addTriple = await (self.__expressionAnalysisMode__ ? _traceMember(this, 'createAddTriple') : void 0, this.createAddTriple());

          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'setField');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope50, 'addTriple', addTriple) : void 0, addTriple).setField('object', _getMember(this, 'urlString'));
          if (self.__expressionAnalysisMode__) _traceMember(addTriple, 'focus');
          (self.__expressionAnalysisMode__ ? _getLocal(_scope50, 'addTriple', addTriple) : void 0, addTriple).focus('subject');
        }

        buildListItemFor(knot, role) {
          let _scope51 = {};

          return _element('li', _attributes(), _children(_childExpression((self.__expressionAnalysisMode__ ? _getLocal(_scope51, 'role', role) : void 0, role)), _childText(': '), _childExpression((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildRefFor') : void 0, this.buildRefFor((self.__expressionAnalysisMode__ ? _getLocal(_scope51, 'knot', knot) : void 0, knot))))), {
            file: 'https://lively-kernel.org/lively4/lively4-function-completion/templates/knot-view.js',
            end: {
              column: 52,
              line: 273
            },
            start: {
              column: 11,
              line: 273
            }
          });
        }
        async buildContentFor(knot) {
          let _scope52 = {};

          let editorComp = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#content-editor'));
          if (self.__expressionAnalysisMode__) _traceMember(lively, 'removeEventListener');
          (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).removeEventListener('knot-view-editor', (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp), 'change');
          let spoList = (self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#spo-list'));
          if (self.__expressionAnalysisMode__ ? _traceMember(knot, 'isTriple') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot).isTriple()) {
            if (self.__expressionAnalysisMode__) _traceMember(this, 'hide');

            this.hide((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp));
            if (self.__expressionAnalysisMode__) _traceMember(this, 'show');
            this.show((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'spoList', spoList) : void 0, spoList));
            _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'spoList', spoList) : void 0, spoList), 'innerHTML', '');
            if (self.__expressionAnalysisMode__) _traceMember(spoList, 'appendChild');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'spoList', spoList) : void 0, spoList).appendChild((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildListItemFor') : void 0, this.buildListItemFor(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot), 'subject'), 'Subject')));
            if (self.__expressionAnalysisMode__) _traceMember(spoList, 'appendChild');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'spoList', spoList) : void 0, spoList).appendChild((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildListItemFor') : void 0, this.buildListItemFor(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot), 'predicate'), 'Predicate')));
            if (self.__expressionAnalysisMode__) _traceMember(spoList, 'appendChild');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'spoList', spoList) : void 0, spoList).appendChild((self.__expressionAnalysisMode__ ? _traceMember(this, 'buildListItemFor') : void 0, this.buildListItemFor(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot), 'object'), 'Object')));
          } else {
            let _scope53 = {};
            if (self.__expressionAnalysisMode__) _traceMember(this, 'show');

            this.show((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp));
            if (self.__expressionAnalysisMode__) _traceMember(this, 'hide');
            this.hide((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'spoList', spoList) : void 0, spoList));
            if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp), 'value') !== _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot), 'content')) {
              _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp), 'value', _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot), 'content'));
            }
            if (self.__expressionAnalysisMode__) _traceMember(editorComp, 'enableAutocompletion');
            (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp).enableAutocompletion();

            let graph = await (self.__expressionAnalysisMode__ ? _traceMember(Graph, 'getInstance') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Graph', Graph) : void 0, Graph).getInstance());
            let urls = (self.__expressionAnalysisMode__ ? _traceMember(graph, 'getUrlsByKnot') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope53, 'graph', graph) : void 0, graph).getUrlsByKnot((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot)));
            if (_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope53, 'urls', urls) : void 0, urls), 'length') >= 1) {
              if (self.__expressionAnalysisMode__) _traceMember(editorComp, 'changeModeForFile');

              (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp).changeModeForFile(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope53, 'urls', urls) : void 0, urls), 0));
            } else {
              if (self.__expressionAnalysisMode__) _traceMember(lively, 'error');

              (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).error('no url found for ' + (self.__expressionAnalysisMode__ ? _traceMember(knot, 'label') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot).label()));
            }
            const saveKnot = async text => {
              let _scope54 = {};

              await (self.__expressionAnalysisMode__ ? _traceMember(knot, 'save') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'knot', knot) : void 0, knot).save((self.__expressionAnalysisMode__ ? _getLocal(_scope54, 'text', text) : void 0, text)));
              if (self.__expressionAnalysisMode__) _traceMember(lively, 'notify');
              (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).notify('saved knot'
              // this.refresh();
              );
            };
            _setMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp), 'doSave', (self.__expressionAnalysisMode__ ? _getLocal(_scope53, 'saveKnot', saveKnot) : void 0, saveKnot));
            const debouncedSave = _getAndCallMember(() => {
              return (self.__expressionAnalysisMode__ ? _getLocal(_scope53, 'saveKnot', saveKnot) : void 0, saveKnot)(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp), 'value'));
            }, 'debounce', [2000]);
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'addEventListener');
            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).addEventListener('knot-view-editor', (self.__expressionAnalysisMode__ ? _getLocal(_scope52, 'editorComp', editorComp) : void 0, editorComp), 'change', (self.__expressionAnalysisMode__ ? _getLocal(_scope53, 'debouncedSave', debouncedSave) : void 0, debouncedSave));
          }
        }

        hide(element) {
          let _scope55 = {};
          _setMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope55, 'element', element) : void 0, element), 'style'), 'display', "none");
        }
        show(element) {
          let _scope56 = {};
          _setMember(_getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope56, 'element', element) : void 0, element), 'style'), 'display', "block");
        }

        onPathEntered(path) {
          let _scope57 = {};
          if (self.__expressionAnalysisMode__) _traceMember(this, 'loadKnotForURL');

          this.loadKnotForURL((self.__expressionAnalysisMode__ ? _getLocal(_scope57, 'path', path) : void 0, path));
        }

        livelyPrepareSave() {
          if (self.__expressionAnalysisMode__) _traceMember(this, 'setAttribute');

          this.setAttribute("data-knot-url", _getMember(this, 'urlString'));
        }
      }

      _export('default', KnotView);

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

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

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