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

  var __SystemJSRewritingHack, maybeUnpackString, guid, abstract, compareKeyLocations, keyLocationsAreEqual, stringInsert, stringRemove, normalizePath, deepCopy;
  return {
    setters: [],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js = _recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js || {};
      _export("maybeUnpackString", maybeUnpackString = value => {
        if (!value) {
          return value;
        }
        if (typeof value === "string") {
          return value;
        } else if (typeof value.value === "string") {
          return value.value;
        }
        return null;
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "maybeUnpackString", {
        get() {
          return maybeUnpackString;
        },
        set(thisIsVererySecretVariableName) {
          _export("maybeUnpackString", maybeUnpackString = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("guid", guid = () => {
        // from https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
        function s4() {
          return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
        }
        return s4() + '_' + s4() + '_' + s4();
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "guid", {
        get() {
          return guid;
        },
        set(thisIsVererySecretVariableName) {
          _export("guid", guid = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("abstract", abstract = () => {
        throw Error("This function is abstract");
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "abstract", {
        get() {
          return abstract;
        },
        set(thisIsVererySecretVariableName) {
          _export("abstract", abstract = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("compareKeyLocations", compareKeyLocations = (a, b) => {
        return a[0] - b[0] ? a[0] - b[0] : a[1] - b[1] ? a[1] - b[1] : a[2] - b[2] ? a[2] - b[2] : a[3] - b[3] ? a[3] - b[3] : 0;
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "compareKeyLocations", {
        get() {
          return compareKeyLocations;
        },
        set(thisIsVererySecretVariableName) {
          _export("compareKeyLocations", compareKeyLocations = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("keyLocationsAreEqual", keyLocationsAreEqual = (a, b) => {
        return compareKeyLocations(a, b) === 0;
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "keyLocationsAreEqual", {
        get() {
          return keyLocationsAreEqual;
        },
        set(thisIsVererySecretVariableName) {
          _export("keyLocationsAreEqual", keyLocationsAreEqual = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("stringInsert", stringInsert = (baseString, insertString, index) => {
        return baseString.slice(0, index) + insertString + baseString.slice(index);
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "stringInsert", {
        get() {
          return stringInsert;
        },
        set(thisIsVererySecretVariableName) {
          _export("stringInsert", stringInsert = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("stringRemove", stringRemove = (baseString, startIndex, endIndex) => {
        return baseString.slice(0, startIndex) + baseString.slice(endIndex);
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "stringRemove", {
        get() {
          return stringRemove;
        },
        set(thisIsVererySecretVariableName) {
          _export("stringRemove", stringRemove = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("normalizePath", normalizePath = path => path.split("/").reduce((acc, part) => {
        if (part === "..") {
          acc.pop();
        } else if (part !== ".") {
          acc.push(part);
        }
        return acc;
      }, []).join("/"));
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "normalizePath", {
        get() {
          return normalizePath;
        },
        set(thisIsVererySecretVariableName) {
          _export("normalizePath", normalizePath = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("deepCopy", deepCopy = obj => {
        try {
          if (obj instanceof HTMLElement) {
            /*probe:*/return (/*{}*/obj.cloneNode(true)
            );
          } else if (obj && obj.clone) {
            // (A) #TODO this is not a deep copy... 
            return obj.clone(); // why not....        
          } else {
            // (C) only this is a deep copy, but besides very simple objects... this will break... 
            // and this will really consume a lot of data if you probe a very big object
            /*probe:*/
            return (/*{}*/JSON.parse(JSON.stringify(obj))
            );
          }
        } catch (e) {
          // (B) this is not a deep copy either
          console.warn("Could not deeply clone object", obj);
          /*probe:*/
          return (/*{}*/Object.assign({}, obj)
          );
        }
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_babylonian_programming_editor_utils_utils_js, "deepCopy", {
        get() {
          return deepCopy;
        },
        set(thisIsVererySecretVariableName) {
          _export("deepCopy", deepCopy = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
    }
  };
});