"enable aexpr";

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

  var _aexpr, _getAndCallMember, _setLocal, _getLocal, _traceMember, _getMember, _getGlobal, _setMember, _addSourceLocation, uuid;

  return {
    setters: [function (_activeExpressionRewriting) {
      _aexpr = _activeExpressionRewriting.aexpr;
      _getAndCallMember = _activeExpressionRewriting.getAndCallMember;
      _setLocal = _activeExpressionRewriting.setLocal;
      _getLocal = _activeExpressionRewriting.getLocal;
      _traceMember = _activeExpressionRewriting.traceMember;
      _getMember = _activeExpressionRewriting.getMember;
      _getGlobal = _activeExpressionRewriting.getGlobal;
      _setMember = _activeExpressionRewriting.setMember;
    }, function (_reactiveJsx) {
      _addSourceLocation = _reactiveJsx.addSourceLocation;
    }, function (_utils) {
      uuid = _utils.uuid;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._src_components_halo_Connection_js = _recorder_._src_components_halo_Connection_js || {};
      let _scope = {
        isScope: true
      },
          _scope3 = {
        isScope: true
      };
      _setMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections", _getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections") || new (self.__expressionAnalysisMode__ ? _getGlobal("Set") : void 0, Set)(), {
        file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
        end: {
          column: 58,
          line: 3
        },
        start: {
          column: 0,
          line: 3
        },
        source: ''
      });

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

        set(thisIsVererySecretVariableName) {
          let _scope2 = {
            isScope: true
          };
          uuid = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope2, "thisIsVererySecretVariableName", thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, "uuid", uuid, {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 13,
              line: 5
            },
            start: {
              column: 9,
              line: 5
            },
            source: ''
          }) : void 0, uuid;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      class Connection {

        static nextId() {
          return (self.__expressionAnalysisMode__ ? _getLocal(_scope, "uuid", uuid) : void 0, uuid)();
          // this._currentId = this._currentId || 1
          // return this._currentId++
        }

        targetIsFunction() {
          try {
            return _getMember(_getMember(this, "target"), _getMember(this, "_targetProperty")) instanceof (self.__expressionAnalysisMode__ ? _getGlobal("Function") : void 0, Function);
          } catch (e) {
            return false;
          }
        }

        constructor(source, sourceProperty, target, targetProperty, isEvent) {
          let _scope4 = {
            isScope: true
          };

          _setMember(this, "id", (self.__expressionAnalysisMode__ ? _traceMember(Connection, "nextId") : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope3, "Connection", Connection) : void 0, Connection).nextId()), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 33,
              line: 25
            },
            start: {
              column: 4,
              line: 25
            },
            source: ''
          });
          _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections"), "add", [this]);

          _setMember(this, "target", (target === Object(target) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "target", target) : void 0 : target, target), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 24,
              line: 28
            },
            start: {
              column: 4,
              line: 28
            },
            source: ''
          });
          _setMember(this, "_targetProperty", (targetProperty === Object(targetProperty) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "targetProperty", targetProperty) : void 0 : targetProperty, targetProperty), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 41,
              line: 29
            },
            start: {
              column: 4,
              line: 29
            },
            source: ''
          });
          _setMember(this, "source", (source === Object(source) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "source", source) : void 0 : source, source), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 24,
              line: 30
            },
            start: {
              column: 4,
              line: 30
            },
            source: ''
          });
          _setMember(this, "_sourceProperty", (sourceProperty === Object(sourceProperty) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "sourceProperty", sourceProperty) : void 0 : sourceProperty, sourceProperty), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 41,
              line: 31
            },
            start: {
              column: 4,
              line: 31
            },
            source: ''
          });
          _setMember(this, "isEvent", (isEvent === Object(isEvent) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "isEvent", isEvent) : void 0 : isEvent, isEvent), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 26,
              line: 32
            },
            start: {
              column: 4,
              line: 32
            },
            source: ''
          });
          _setMember(this, "isActive", false, {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 25,
              line: 33
            },
            start: {
              column: 4,
              line: 33
            },
            source: ''
          });
          _setMember(this, "_eventListener", evt => {
            let _scope5 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(this, "connectionFunction") : void 0, this.connectionFunction((evt === Object(evt) ? self.__expressionAnalysisMode__ ? _getLocal(_scope5, "evt", evt) : void 0 : evt, evt));
          }, {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 61,
              line: 34
            },
            start: {
              column: 4,
              line: 34
            },
            source: ''
          });
          _setMember(this, "_targetProperty", (self.__expressionAnalysisMode__ ? _traceMember(this, "cleanProperty") : void 0, this.cleanProperty(_getMember(this, "_targetProperty"))), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 67,
              line: 35
            },
            start: {
              column: 4,
              line: 35
            },
            source: ''
          });

          if (isEvent === Object(isEvent) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "isEvent", isEvent) : void 0 : isEvent, isEvent) {
            if (self.__expressionAnalysisMode__ ? _traceMember(this, "targetIsFunction") : void 0, this.targetIsFunction()) {
              _setMember(this, "modifyingCode", `(target, event) => {
  target.${_getMember(this, "_targetProperty")}(event);
}`, {
                file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
                end: {
                  column: 2,
                  line: 43
                },
                start: {
                  column: 6,
                  line: 40
                },
                source: ''
              });
            } else {
              _setMember(this, "modifyingCode", `(target, event) => {
  target.${_getMember(this, "_targetProperty")} = event;
}`, {
                file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
                end: {
                  column: 2,
                  line: 47
                },
                start: {
                  column: 6,
                  line: 45
                },
                source: ''
              });
            }

            _setMember(this, "trackingCode", _getMember(this, "_sourceProperty"), {
              file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
              end: {
                column: 46,
                line: 50
              },
              start: {
                column: 6,
                line: 50
              },
              source: ''
            });
          } else {
            if (self.__expressionAnalysisMode__ ? _traceMember(this, "targetIsFunction") : void 0, this.targetIsFunction()) {
              _setMember(this, "modifyingCode", `(target, sourceValue) => {
  target.${_getMember(this, "_targetProperty")}(sourceValue);
}`, {
                file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
                end: {
                  column: 2,
                  line: 56
                },
                start: {
                  column: 8,
                  line: 53
                },
                source: ''
              });
            } else {
              _setMember(this, "modifyingCode", `(target, sourceValue) => {
  target.${_getMember(this, "_targetProperty")} = sourceValue;
}`, {
                file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
                end: {
                  column: 2,
                  line: 61
                },
                start: {
                  column: 8,
                  line: 58
                },
                source: ''
              });
            }

            _setMember(this, "_sourceProperty", (self.__expressionAnalysisMode__ ? _traceMember(this, "cleanProperty") : void 0, this.cleanProperty(_getMember(this, "_sourceProperty"))), {
              file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
              end: {
                column: 69,
                line: 67
              },
              start: {
                column: 6,
                line: 67
              },
              source: ''
            });
            _setMember(this, "trackingCode", `(source) => {
  return source.${_getMember(this, "_sourceProperty")};
}`, {
              file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
              end: {
                column: 2,
                line: 70
              },
              start: {
                column: 6,
                line: 68
              },
              source: ''
            });
          }
          if (self.__expressionAnalysisMode__) _traceMember(this, "makeSavingScript");
          this.makeSavingScript();

          _setMember(this, "__classFilePath__", "https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js", undefined);
        }

        get sourceProperty() {
          return _getMember(this, "_sourceProperty");
        }

        get targetProperty() {
          return _getMember(this, "_targetProperty");
        }

        cleanProperty(property) {
          let _scope6 = {
            isScope: true
          };

          return _getAndCallMember(_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(property, "split") : void 0, (property === Object(property) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "property", property) : void 0 : property, property).split(".")), "map", [each => {
            let _scope7 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(this, "camelCaseIfNeeded") : void 0, this.camelCaseIfNeeded((each === Object(each) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "each", each) : void 0 : each, each));
          }]), "join", ["."]);
        }

        camelCaseIfNeeded(propertyPart) {
          let _scope8 = {
            isScope: true
          };

          if (self.__expressionAnalysisMode__ ? _traceMember(propertyPart, "includes") : void 0, (propertyPart === Object(propertyPart) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, "propertyPart", propertyPart) : void 0 : propertyPart, propertyPart).includes('-')) {
            return self.__expressionAnalysisMode__ ? _traceMember(propertyPart, "camelCase") : void 0, (propertyPart === Object(propertyPart) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, "propertyPart", propertyPart) : void 0 : propertyPart, propertyPart).camelCase();
          } else {
            return propertyPart === Object(propertyPart) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, "propertyPart", propertyPart) : void 0 : propertyPart, propertyPart;
          }
        }

        makeSavingScript() {
          if (_getMember(this, "target")) {
            _setMember(this, "targetId", (self.__expressionAnalysisMode__ ? _traceMember(lively, "ensureID") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).ensureID(_getMember(this, "target"))), {
              file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
              end: {
                column: 50,
                line: 98
              },
              start: {
                column: 6,
                line: 98
              },
              source: ''
            });
          }
          if (_getMember(this, "source")) {
            _setMember(this, "sourceId", (self.__expressionAnalysisMode__ ? _traceMember(lively, "ensureID") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).ensureID(_getMember(this, "source"))), {
              file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
              end: {
                column: 50,
                line: 101
              },
              start: {
                column: 6,
                line: 101
              },
              source: ''
            });
          }
          if (_getMember(this, "target") && _getMember(this, "source")) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "saveSerializedConnectionIntoWidget");

            this.saveSerializedConnectionIntoWidget();
          }
        }

        saveSerializedConnectionIntoWidget() {
          let _scope11 = {
            isScope: true
          };

          if (!_getMember(this, "source")) {
            return;
          } // cannot save it...
          const serializedConnections = _getAndCallMember(_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(Array, "from") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("Array") : void 0, Array).from(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections"))), "filter", [connection => {
            let _scope9 = {
              isScope: true
            };
            return _getMember((connection === Object(connection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope9, "connection", connection) : void 0 : connection, connection), "source") === _getMember(this, "source");
          }]), "map", [connection => {
            let _scope10 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(connection, "serialize") : void 0, (connection === Object(connection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope10, "connection", connection) : void 0 : connection, connection).serialize();
          }]);
          _getAndCallMember(_getMember(this, "source"), "setJSONAttribute", ['data-connection', (serializedConnections === Object(serializedConnections) ? self.__expressionAnalysisMode__ ? _getLocal(_scope11, "serializedConnections", serializedConnections) : void 0 : serializedConnections, serializedConnections)]);
        }

        serialize() {
          return {
            sourceId: _getMember(this, "sourceId"),
            targetId: _getMember(this, "targetId"),
            sourceProperty: _getMember(this, "_sourceProperty"),
            targetProperty: _getMember(this, "_targetProperty"),
            trackingCode: _getMember(this, "trackingCode"),
            modifyingCode: _getMember(this, "modifyingCode"),
            label: _getMember(this, "label"),
            isEvent: _getMember(this, "isEvent")
          };
        }

        static deserialize(json) {
          let _scope12 = {
            isScope: true
          };
          if (self.__expressionAnalysisMode__) _traceMember(json, "forEach");

          (json === Object(json) ? self.__expressionAnalysisMode__ ? _getLocal(_scope12, "json", json) : void 0 : json, json).forEach(connectionData => {
            let _scope13 = {
              isScope: true
            };
            if (self.__expressionAnalysisMode__) _traceMember(this, "connectionFromExistingData");

            this.connectionFromExistingData((connectionData === Object(connectionData) ? self.__expressionAnalysisMode__ ? _getLocal(_scope13, "connectionData", connectionData) : void 0 : connectionData, connectionData));
          });
        }

        static deserializeFromObjectIfNeeded(object) {
          let _scope14 = {
            isScope: true
          };

          if (_getMember((object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope14, "object", object) : void 0 : object, object), "hasAttribute") && (self.__expressionAnalysisMode__ ? _traceMember(object, "hasAttribute") : void 0, (object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope14, "object", object) : void 0 : object, object).hasAttribute('data-connection'))) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "deserialize");

            this.deserialize((self.__expressionAnalysisMode__ ? _traceMember(object, "getJSONAttribute") : void 0, (object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope14, "object", object) : void 0 : object, object).getJSONAttribute('data-connection')));
          }
        }

        static connectionFromExistingData(config) {
          let _scope15 = {
            isScope: true
          };


          const target = (self.__expressionAnalysisMode__ ? _traceMember(lively, "elementByID") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).elementByID(_getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "targetId")));
          const source = (self.__expressionAnalysisMode__ ? _traceMember(lively, "elementByID") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).elementByID(_getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "sourceId")));
          const undeadConnection = new (self.__expressionAnalysisMode__ ? _getLocal(_scope3, "Connection", Connection) : void 0, Connection)((source === Object(source) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "source", source) : void 0 : source, source), _getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "targetProperty"), (target === Object(target) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "target", target) : void 0 : target, target), _getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "sourceProperty"), _getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "isEvent"));
          if (self.__expressionAnalysisMode__) _traceMember(undeadConnection, "setModifyingCode");
          (undeadConnection === Object(undeadConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "undeadConnection", undeadConnection) : void 0 : undeadConnection, undeadConnection).setModifyingCode(_getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "modifyingCode"));
          if (self.__expressionAnalysisMode__) _traceMember(undeadConnection, "setTrackingCode");
          (undeadConnection === Object(undeadConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "undeadConnection", undeadConnection) : void 0 : undeadConnection, undeadConnection).setTrackingCode(_getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "trackingCode"));
          if (self.__expressionAnalysisMode__) _traceMember(undeadConnection, "setLabel");
          (undeadConnection === Object(undeadConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "undeadConnection", undeadConnection) : void 0 : undeadConnection, undeadConnection).setLabel(_getMember((config === Object(config) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "config", config) : void 0 : config, config), "label"));
          if (self.__expressionAnalysisMode__) _traceMember(undeadConnection, "activate");
          (undeadConnection === Object(undeadConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, "undeadConnection", undeadConnection) : void 0 : undeadConnection, undeadConnection).activate();
        }

        activate() {

          if (_getMember(this, "isActive")) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "deactivate");

            this.deactivate();
          }

          if (_getMember(this, "isEvent")) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "activateEvent");

            this.activateEvent();
          } else {
            if (self.__expressionAnalysisMode__) _traceMember(this, "activateAexpr");

            this.activateAexpr();
          }
          _setMember(this, "isActive", true, {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 24,
              line: 167
            },
            start: {
              column: 4,
              line: 167
            },
            source: ''
          });
        }

        async activateEvent() {
          if (_getMember(this, "source")) {
            if (self.__expressionAnalysisMode__) _traceMember(lively, "addEventListener");

            (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).addEventListener('Connections', _getMember(this, "source"), _getMember(this, "trackingCode"), _getMember(this, "_eventListener"));
          }
        }

        async activateAexpr() {
          let _scope16 = {
            isScope: true
          };

          let myFunction = await _getAndCallMember(_getMember(this, "trackingCode"), "boundEval", []);
          _setMember(this, "ae", _aexpr(() => {
            return (myFunction === Object(myFunction) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, "myFunction", myFunction) : void 0 : myFunction, myFunction)(_getMember(this, "source"));
          }, {
            location: {
              file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
              end: {
                column: 19,
                line: 178
              },
              start: {
                column: 14,
                line: 178
              },
              source: ''
            },
            sourceCode: "() => myFunction(this.source)"
          }), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 50,
              line: 178
            },
            start: {
              column: 4,
              line: 178
            },
            source: ''
          });
          _getMember(this, "ae").onChange(svalue => {
            let _scope17 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(this, "connectionFunction") : void 0, this.connectionFunction((svalue === Object(svalue) ? self.__expressionAnalysisMode__ ? _getLocal(_scope17, "svalue", svalue) : void 0 : svalue, svalue));
          }, {
            sourceCode: "svalue => this.connectionFunction(svalue)"
          });
        }

        getTrackingCode() {
          return _getMember(this, "trackingCode");
        }

        setTrackingCode(string) {
          let _scope18 = {
            isScope: true
          };

          const isActive = _getMember(this, "isActive");
          if (isActive === Object(isActive) ? self.__expressionAnalysisMode__ ? _getLocal(_scope18, "isActive", isActive) : void 0 : isActive, isActive) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "deactivate");
            this.deactivate();
          }
          _setMember(this, "trackingCode", (string === Object(string) ? self.__expressionAnalysisMode__ ? _getLocal(_scope18, "string", string) : void 0 : string, string), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 30,
              line: 189
            },
            start: {
              column: 4,
              line: 189
            },
            source: ''
          });
          if (self.__expressionAnalysisMode__) _traceMember(this, "saveSerializedConnectionIntoWidget");
          this.saveSerializedConnectionIntoWidget();
          if (isActive === Object(isActive) ? self.__expressionAnalysisMode__ ? _getLocal(_scope18, "isActive", isActive) : void 0 : isActive, isActive) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "activate");
            this.activate();
          }
        }

        async connectionFunction(sourceValue) {
          let _scope19 = {
            isScope: true
          };

          let myFunction = await _getAndCallMember(_getMember(this, "modifyingCode"), "boundEval", []);
          (myFunction === Object(myFunction) ? self.__expressionAnalysisMode__ ? _getLocal(_scope19, "myFunction", myFunction) : void 0 : myFunction, myFunction)(_getMember(this, "target"), (sourceValue === Object(sourceValue) ? self.__expressionAnalysisMode__ ? _getLocal(_scope19, "sourceValue", sourceValue) : void 0 : sourceValue, sourceValue));
        }

        async drawConnectionLine() {
          let _scope20 = {
            isScope: true
          };
          if (self.__expressionAnalysisMode__) _traceMember(this, "removeConnectionLine");

          this.removeConnectionLine();
          var from = (self.__expressionAnalysisMode__ ? _traceMember(this, "getSource") : void 0, this.getSource());
          var to = (self.__expressionAnalysisMode__ ? _traceMember(this, "getTarget") : void 0, this.getTarget());
          if (!(from === Object(from) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "from", from) : void 0 : from, from) || !(to === Object(to) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "to", to) : void 0 : to, to)) {
            return;
          }var connector = _addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(document, "createElement") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("document") : void 0, document).createElement("lively-connector")), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 62,
              line: 205
            },
            start: {
              column: 20,
              line: 205
            }
          });
          if (self.__expressionAnalysisMode__) _traceMember(connector, "setAttribute");
          (connector === Object(connector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "connector", connector) : void 0 : connector, connector).setAttribute("data-lively4-donotpersist", true);
          await _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively), "components"), "openIn", [_getMember((self.__expressionAnalysisMode__ ? _getGlobal("document") : void 0, document), "body"), (connector === Object(connector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "connector", connector) : void 0 : connector, connector)]);
          _setMember(this, "connectionLine", (connector === Object(connector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "connector", connector) : void 0 : connector, connector), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 35,
              line: 208
            },
            start: {
              column: 4,
              line: 208
            },
            source: ''
          });

          if (self.__expressionAnalysisMode__) _traceMember(connector, "connectFrom");
          (connector === Object(connector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "connector", connector) : void 0 : connector, connector).connectFrom((from === Object(from) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "from", from) : void 0 : from, from));
          if (self.__expressionAnalysisMode__) _traceMember(connector, "connectTo");
          (connector === Object(connector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "connector", connector) : void 0 : connector, connector).connectTo((to === Object(to) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "to", to) : void 0 : to, to));
          return connector === Object(connector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, "connector", connector) : void 0 : connector, connector;
        }

        async removeConnectionLine() {
          if (_getMember(this, "connectionLine")) {
            _getAndCallMember(_getMember(this, "connectionLine"), "remove", []);
          }
        }

        setActive(shouldBeActive) {
          let _scope21 = {
            isScope: true
          };

          if (shouldBeActive === Object(shouldBeActive) ? self.__expressionAnalysisMode__ ? _getLocal(_scope21, "shouldBeActive", shouldBeActive) : void 0 : shouldBeActive, shouldBeActive) {
            if (self.__expressionAnalysisMode__) _traceMember(this, "activate");

            this.activate();
          } else {
            if (self.__expressionAnalysisMode__) _traceMember(this, "deactivate");

            this.deactivate();
          }
        }

        toggleDirection() {
          let _scope22 = {
            isScope: true
          };
          if (self.__expressionAnalysisMode__) _traceMember(this, "deactivate");

          this.deactivate();
          let oldTarget = _getMember(this, "target");
          _setMember(this, "target", _getMember(this, "source"), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 29,
              line: 231
            },
            start: {
              column: 4,
              line: 231
            },
            source: ''
          });
          _setMember(this, "source", (oldTarget === Object(oldTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, "oldTarget", oldTarget) : void 0 : oldTarget, oldTarget), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 27,
              line: 232
            },
            start: {
              column: 4,
              line: 232
            },
            source: ''
          });
          if (self.__expressionAnalysisMode__) _traceMember(this, "saveSerializedConnectionIntoWidget");
          this.saveSerializedConnectionIntoWidget();
          if (self.__expressionAnalysisMode__) _traceMember(this, "activate");
          this.activate();
        }

        copyAndActivate() {
          let _scope23 = {
            isScope: true
          };

          let newConnection = new (self.__expressionAnalysisMode__ ? _getLocal(_scope3, "Connection", Connection) : void 0, Connection)(_getMember(this, "source"), _getMember(this, "sourceProperty"), _getMember(this, "target"), _getMember(this, "_targetProperty"), _getMember(this, "isEvent"));
          if (self.__expressionAnalysisMode__) _traceMember(newConnection, "setModifyingCode");
          (newConnection === Object(newConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, "newConnection", newConnection) : void 0 : newConnection, newConnection).setModifyingCode(_getMember(this, "modifyingCode"));
          if (self.__expressionAnalysisMode__) _traceMember(newConnection, "activate");
          (newConnection === Object(newConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, "newConnection", newConnection) : void 0 : newConnection, newConnection).activate();
          return newConnection === Object(newConnection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, "newConnection", newConnection) : void 0 : newConnection, newConnection;
        }

        deactivate() {
          _getMember(this, "ae") && _getAndCallMember(_getMember(this, "ae"), "dispose", []);
          if (_getMember(this, "isEvent")) {
            if (self.__expressionAnalysisMode__) _traceMember(lively, "removeEventListener");

            (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).removeEventListener('Connections', _getMember(this, "source"), _getMember(this, "trackingCode"), _getMember(this, "_eventListener"));
          }
          _setMember(this, "isActive", false, {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 25,
              line: 252
            },
            start: {
              column: 4,
              line: 252
            },
            source: ''
          });
        }

        destroy() {
          if (self.__expressionAnalysisMode__) _traceMember(this, "deactivate");

          this.deactivate();
          _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections"), "delete", [this]);
        }

        getSource() {
          return _getMember(this, "source");
        }

        setSource(object) {
          let _scope24 = {
            isScope: true
          };

          _setMember(this, "source", (object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope24, "object", object) : void 0 : object, object), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 24,
              line: 265
            },
            start: {
              column: 4,
              line: 265
            },
            source: ''
          });
        }

        getSourceId() {
          return _getMember(this, "sourceId");
        }

        getTarget() {
          return _getMember(this, "target");
        }

        setTarget(object) {
          let _scope25 = {
            isScope: true
          };

          _setMember(this, "target", (object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope25, "object", object) : void 0 : object, object), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 24,
              line: 277
            },
            start: {
              column: 4,
              line: 277
            },
            source: ''
          });
        }

        getTargetId() {
          return _getMember(this, "targetId");
        }

        getAexpr() {
          return _getMember(this, "ae");
        }

        getSourceProperty() {
          return _getMember(this, "_sourceProperty");
        }

        setSourceProperty(newProperty) {
          let _scope26 = {
            isScope: true
          };

          _setMember(this, "_sourceProperty", (newProperty === Object(newProperty) ? self.__expressionAnalysisMode__ ? _getLocal(_scope26, "newProperty", newProperty) : void 0 : newProperty, newProperty), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 38,
              line: 293
            },
            start: {
              column: 4,
              line: 293
            },
            source: ''
          });
          if (self.__expressionAnalysisMode__) _traceMember(this, "saveSerializedConnectionIntoWidget");
          this.saveSerializedConnectionIntoWidget();
          if (self.__expressionAnalysisMode__) _traceMember(this, "activate");
          this.activate();
        }

        getModifyingCode() {
          return _getMember(this, "modifyingCode");
        }

        setModifyingCode(string) {
          let _scope27 = {
            isScope: true
          };

          _setMember(this, "modifyingCode", (string === Object(string) ? self.__expressionAnalysisMode__ ? _getLocal(_scope27, "string", string) : void 0 : string, string), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 31,
              line: 303
            },
            start: {
              column: 4,
              line: 303
            },
            source: ''
          });
          if (self.__expressionAnalysisMode__) _traceMember(this, "saveSerializedConnectionIntoWidget");
          this.saveSerializedConnectionIntoWidget();
        }

        static get allConnections() {
          return _getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections");
        }

        static allConnectionsFor(object) {
          let _scope28 = {
            isScope: true
          };

          let connections = [];
          if (_getMember((object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope28, "object", object) : void 0 : object, object), "hasAttribute") && (self.__expressionAnalysisMode__ ? _traceMember(object, "hasAttribute") : void 0, (object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope28, "object", object) : void 0 : object, object).hasAttribute('data-lively-id'))) {
            let _scope30 = {
              isScope: true
            };

            let objectId = (self.__expressionAnalysisMode__ ? _traceMember(object, "getAttribute") : void 0, (object === Object(object) ? self.__expressionAnalysisMode__ ? _getLocal(_scope28, "object", object) : void 0 : object, object).getAttribute('data-lively-id'));
            _getAndCallMember(_getMember(this, "allConnections"), "forEach", [connection => {
              let _scope29 = {
                isScope: true
              };

              if (_getMember((connection === Object(connection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope29, "connection", connection) : void 0 : connection, connection), "targetId") == (objectId === Object(objectId) ? self.__expressionAnalysisMode__ ? _getLocal(_scope30, "objectId", objectId) : void 0 : objectId, objectId) || _getMember((connection === Object(connection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope29, "connection", connection) : void 0 : connection, connection), "sourceId") == (objectId === Object(objectId) ? self.__expressionAnalysisMode__ ? _getLocal(_scope30, "objectId", objectId) : void 0 : objectId, objectId)) {
                if (self.__expressionAnalysisMode__) _traceMember(connections, "push");
                (connections === Object(connections) ? self.__expressionAnalysisMode__ ? _getLocal(_scope28, "connections", connections) : void 0 : connections, connections).push((connection === Object(connection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope29, "connection", connection) : void 0 : connection, connection));
              }
            }]);
          }
          return connections === Object(connections) ? self.__expressionAnalysisMode__ ? _getLocal(_scope28, "connections", connections) : void 0 : connections, connections;
        }

        getLabel() {
          return _getMember(this, "_sourceProperty") + "⇨" + _getMember(this, "_targetProperty");
        }

        getFullLabel() {
          try {
            return (self.__expressionAnalysisMode__ ? _traceMember(lively, "elementToCSSName") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).elementToCSSName((self.__expressionAnalysisMode__ ? _traceMember(this, "getSource") : void 0, this.getSource()))) + " " + _getMember(this, "_sourceProperty") + "⇨" + (self.__expressionAnalysisMode__ ? _traceMember(lively, "elementToCSSName") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("lively") : void 0, lively).elementToCSSName((self.__expressionAnalysisMode__ ? _traceMember(this, "getTarget") : void 0, this.getTarget()))) + " " + _getMember(this, "_targetProperty");
          } catch (e) {
            return self.__expressionAnalysisMode__ ? _traceMember(this, "getLabel") : void 0, this.getLabel();
          }
        }

        setLabel(string) {
          let _scope31 = {
            isScope: true
          };

          _setMember(this, "label", (string === Object(string) ? self.__expressionAnalysisMode__ ? _getLocal(_scope31, "string", string) : void 0 : string, string), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 23,
              line: 338
            },
            start: {
              column: 4,
              line: 338
            },
            source: ''
          }); // not used...
        }

      }

      _export("default", Connection);

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

        set(thisIsVererySecretVariableName) {
          let _scope32 = {
            isScope: true
          };
          _export("default", Connection = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope32, "thisIsVererySecretVariableName", thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName)), true ? _setLocal(_scope, "Connection", Connection, {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/halo/Connection.js',
            end: {
              column: 31,
              line: 8
            },
            start: {
              column: 21,
              line: 8
            },
            source: ''
          }) : void 0, Connection;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      _getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "allConnections"), "forEach", [connection => {
        let _scope33 = {
          isScope: true
        };
        return self.__expressionAnalysisMode__ ? _traceMember(connection, "migrateTo") : void 0, (connection === Object(connection) ? self.__expressionAnalysisMode__ ? _getLocal(_scope33, "connection", connection) : void 0 : connection, connection).migrateTo((self.__expressionAnalysisMode__ ? _getLocal(_scope, "Connection", Connection) : void 0, Connection));
      }]);
    }
  };
});