(function attachUpdateUtils(root) {
  "use strict";

  function normalizeVersion(value) {
    return String(value || "")
      .split(".")
      .map(function toNumber(segment) {
        var parsed = Number.parseInt(segment, 10);
        return Number.isFinite(parsed) ? parsed : 0;
      });
  }

  function compareVersions(left, right) {
    var leftParts = normalizeVersion(left);
    var rightParts = normalizeVersion(right);
    var maxLength = Math.max(leftParts.length, rightParts.length);

    for (var index = 0; index < maxLength; index += 1) {
      var leftValue = leftParts[index] || 0;
      var rightValue = rightParts[index] || 0;

      if (leftValue > rightValue) {
        return 1;
      }

      if (leftValue < rightValue) {
        return -1;
      }
    }

    return 0;
  }

  function isRemoteVersionNewer(currentVersion, remoteVersion) {
    return compareVersions(remoteVersion, currentVersion) > 0;
  }

  var api = {
    compareVersions: compareVersions,
    isRemoteVersionNewer: isRemoteVersionNewer
  };

  root.SafeSceneUpdateUtils = api;

  if (typeof module !== "undefined" && module.exports) {
    module.exports = api;
  }
}(typeof globalThis !== "undefined" ? globalThis : this));
