System.register(["./constants.js"], function (_export, _context) {
  "use strict";

  var GENERATED_IMPORT_IDENTIFIER, __SystemJSRewritingHack;
  //     let customTemplates = {};
  //     customTemplates[SET_MEMBER] = template(`
  //   (function(obj, prop, operator, val) {
  //     return obj[prop] = val;
  //   });
  // `);
  //
  //     customTemplates[GET_MEMBER] = template(`
  //   (function(obj, prop) {
  //     return obj[prop];
  //   });
  // `);
  //
  //     customTemplates[GET_AND_CALL_MEMBER] = template(`
  //   (function(obj, prop, args) {
  //     return obj[prop](...args)
  //   });
  // `);
  //
  //     customTemplates[AEXPR_IDENTIFIER_NAME] = template(`
  //   (function(expr) {
  //     return { onChange(cb) {}};
  //   });
  // `);
  function addCustomTemplate(file, name) {
    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
    let declar = file.declarations[name];
    if (declar) return declar;
    let identifier = file.declarations[name] = file.addImport("active-expression-rewriting", name, name);
    identifier[GENERATED_IMPORT_IDENTIFIER] = true;
    return identifier;

    // let ref = customTemplates[name];
    // console.log(file.addImport("active-expression-rewriting", "aexpr"));
    // let uid = file.declarations[name] = file.scope.generateUidIdentifier(name);
    //
    // ref = ref().expression;
    // ref[GENERATED_FUNCTION] = true;
    //
    // if (t.isFunctionExpression(ref) && !ref.id) {
    //     ref.body._compact = true;
    //     ref._generated = true;
    //     ref.id = uid;
    //     ref.type = "FunctionDeclaration";
    //     file.path.unshiftContainer("body", ref);
    // } else {
    //     ref._compact = true;
    //     file.scope.push({
    //         id: uid,
    //         init: ref,
    //         unique: true
    //     });
    // }
    //
    // return uid;
  }

  function isVariable(path) {
    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
    if (path.parentPath.isImportNamespaceSpecifier() && path.parentKey === 'local') {
      globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
      return false;
    } // import * as foo from 'utils';
    if (path.parentPath.isLabeledStatement() && path.parentKey === 'label') {
      globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
      return false;
    } // always: { ... }
    if (path.parentPath.isBreakStatement() && path.parentKey === 'label') {
      globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
      return false;
    } // break: foo;
    if (path.parentPath.isMemberExpression() && path.parentKey === 'property') {
      globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
      return false;
    } // super.foo

    return true;
  }
  function getParentWithScope(path) {
    globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
    return path.findParent(par => par.scope.hasOwnBinding(path.node.name));
  }
  _export({
    addCustomTemplate: addCustomTemplate,
    isVariable: isVariable,
    getParentWithScope: getParentWithScope
  });
  return {
    setters: [function (_constantsJs) {
      GENERATED_IMPORT_IDENTIFIER = _constantsJs.GENERATED_IMPORT_IDENTIFIER;
    }],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._src_client_reactive_babel_plugin_active_expression_rewriting_utils_js = _recorder_._src_client_reactive_babel_plugin_active_expression_rewriting_utils_js || {};
      Object.defineProperty(_recorder_._src_client_reactive_babel_plugin_active_expression_rewriting_utils_js, "getParentWithScope", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          return getParentWithScope;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          _export("getParentWithScope", getParentWithScope = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_client_reactive_babel_plugin_active_expression_rewriting_utils_js, "isVariable", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          return isVariable;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          _export("isVariable", isVariable = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_client_reactive_babel_plugin_active_expression_rewriting_utils_js, "addCustomTemplate", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          return addCustomTemplate;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          _export("addCustomTemplate", addCustomTemplate = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_client_reactive_babel_plugin_active_expression_rewriting_utils_js, "GENERATED_IMPORT_IDENTIFIER", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          return GENERATED_IMPORT_IDENTIFIER;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/client/reactive/babel-plugin-active-expression-rewriting/utils.js"]++;
          GENERATED_IMPORT_IDENTIFIER = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
    }
  };
});