var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/virtual-keyboard/Time/utils.tsx
var utils_exports = {};
__export(utils_exports, {
  fn: () => fn,
  formatStringToTime: () => formatStringToTime
});
module.exports = __toCommonJS(utils_exports);
var getStringAtPosition = (str, pos) => {
  if (pos < 0 || pos >= str.length) {
    return void 0;
  }
  return str.charAt(pos);
};
var getNum1 = (arr, str) => {
  let num1 = getStringAtPosition(str, 0);
  if (Number(num1) < 3) {
    arr[0] = num1;
    return arr;
  }
  arr[0] = "0";
  arr[1] = num1;
  return arr;
};
var getNum2 = (arr, num2) => {
  let num1 = arr[0];
  if (arr.length < 2) {
    if (Number(num1) < 2) {
      arr[1] = num2;
      return arr;
    } else {
      if (Number(num1) === 2) {
        if (Number(num2) < 4) {
          arr[1] = num2;
          return arr;
        } else {
          if (Number(num2) <= 5) {
            arr[1] = "0";
            arr[2] = num2;
            return arr;
          }
          arr[1] = "0";
          arr[2] = "0";
          arr[3] = num2;
          return arr;
        }
      }
    }
  }
  if (Number(num2) < 6) {
    arr[2] = num2;
    return arr;
  } else {
    arr[2] = "0";
    arr[3] = num2;
    return arr;
  }
};
var getNum3 = (arr, num3) => {
  if (arr.length === 2) {
    if (Number(num3) < 6) {
      arr[2] = num3;
      return arr;
    } else {
      arr[2] = "0";
      arr[3] = num3;
      return arr;
    }
  }
  arr[3] = num3;
  return arr;
};
var getNum4 = (arr, num4) => {
  arr[3] = num4;
  return arr;
};
var formatArray = (arr) => {
  let _arr = [...arr];
  while (_arr.length < 4) {
    _arr.push("0");
  }
  _arr.splice(2, "0", ":");
  return _arr;
};
var formatRes = (arr) => {
  let valueArray = [...arr];
  let previewValueArray = formatArray(arr);
  let previewValueArrayDom = null;
  if (valueArray.length > 2) {
    valueArray.splice(2, "0", ":");
  }
  previewValueArrayDom = previewValueArray.map((d, i) => {
    if (valueArray[i]) {
      return /* @__PURE__ */ React.createElement("span", null, d);
    } else {
      return /* @__PURE__ */ React.createElement("span", { style: { color: "#98A2B3" } }, d);
    }
  });
  return {
    valueArray,
    valueString: arr.join(""),
    previewValueArray: formatArray(arr),
    previewValueArrayDom,
    previewValueString: formatArray(arr).join(""),
    disabled: []
  };
};
var formatStringToTime = (value) => {
  let arr = [];
  let str = value.replace(":", "");
  if (str.length >= 5) {
    str = "";
  }
  let num2 = getStringAtPosition(str, 1);
  let num3 = getStringAtPosition(str, 2);
  let num4 = getStringAtPosition(str, 3);
  if (!str.length) {
    return formatRes(arr);
  }
  arr = getNum1(arr, str);
  if (num2 !== void 0) {
    arr = getNum2(arr, num2);
    if (arr.length === 4) {
      return formatRes(arr);
    }
  }
  if (num3 !== void 0) {
    arr = getNum3(arr, num3);
    if (arr.length === 4) {
      return formatRes(arr);
    }
  }
  if (num4 !== void 0) {
    arr = getNum4(arr, num4);
    return formatRes(arr);
  }
  return formatRes(arr);
};
var fn = () => {
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  fn,
  formatStringToTime
});
