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/plus/saasDevice/appDevicePlanning/model/constants.ts
var constants_exports = {};
__export(constants_exports, {
  DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
  DEVICE_SHORT_NUMBER_MAX_LENGTH: () => DEVICE_SHORT_NUMBER_MAX_LENGTH,
  DEVICE_SHORT_NUMBER_PATTERN: () => DEVICE_SHORT_NUMBER_PATTERN,
  formatToken: () => formatToken,
  normalizeDeviceShortNumberInput: () => normalizeDeviceShortNumberInput,
  normalizeDeviceShortNumberPayload: () => normalizeDeviceShortNumberPayload,
  normalizeText: () => normalizeText,
  sortWorkAreaList: () => sortWorkAreaList,
  validateDeviceShortNumber: () => validateDeviceShortNumber
});
module.exports = __toCommonJS(constants_exports);
var DEFAULT_PAGE_SIZE = 10;
var DEVICE_SHORT_NUMBER_MAX_LENGTH = 10;
var DEVICE_SHORT_NUMBER_PATTERN = /^[A-Z0-9]+$/;
var normalizeText = (text) => text.toLowerCase().trim();
var normalizeDeviceShortNumberInput = (value) => (value || "").toUpperCase();
var normalizeDeviceShortNumberPayload = (value) => normalizeDeviceShortNumberInput(value).trim();
var validateDeviceShortNumber = (messages) => (_rule, value) => {
  const shortNumber = normalizeDeviceShortNumberPayload(value);
  if (!shortNumber) {
    return Promise.reject(new Error(messages.required));
  }
  if (shortNumber === "0" || shortNumber === "00") {
    return Promise.reject(new Error(messages.reserved));
  }
  if (shortNumber.length > DEVICE_SHORT_NUMBER_MAX_LENGTH || !DEVICE_SHORT_NUMBER_PATTERN.test(shortNumber)) {
    return Promise.reject(new Error(messages.format));
  }
  return Promise.resolve();
};
var formatToken = (text, values) => Object.entries(values).reduce(
  (result, [key, value]) => result.replace(new RegExp(`\\{${key}\\}`, "g"), String(value)),
  text
);
var sortWorkAreaList = (list) => [...list].sort((a, b) => (a.sort || 0) - (b.sort || 0));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  DEFAULT_PAGE_SIZE,
  DEVICE_SHORT_NUMBER_MAX_LENGTH,
  DEVICE_SHORT_NUMBER_PATTERN,
  formatToken,
  normalizeDeviceShortNumberInput,
  normalizeDeviceShortNumberPayload,
  normalizeText,
  sortWorkAreaList,
  validateDeviceShortNumber
});
