"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_sorts__internal = require('./_internal.js');

//#region src/sorts/natural.ts
/**
* @file Locale-aware + numeric-aware comparison via `Intl.Collator`, plus the
*   `naturalSorter` helper that wires the fast-sort engine to the natural
*   comparator. Collator instances are lazy-created and cached because `new
*   Intl.Collator()` is 10-14ms in Node — too expensive to call
*   per-comparison.
*/
let _localeCompare;
let _naturalCompare;
let _naturalSorter;
/**
* Compare two strings using locale-aware comparison.
*
* @example
*   ;```typescript
*   localeCompare('a', 'b') // -1
*   localeCompare('b', 'a') // 1
*   localeCompare('a', 'a') // 0
*   ```
*/
/*@__NO_SIDE_EFFECTS__*/
function localeCompare(x, y) {
	if (_localeCompare === void 0) _localeCompare = new Intl.Collator().compare;
	return _localeCompare(x, y);
}
/**
* Compare two strings using natural sorting (numeric-aware, case-insensitive).
*
* @example
*   ;```typescript
*   naturalCompare('file2', 'file10') // negative (file2 before file10)
*   naturalCompare('img10', 'img2') // positive (img10 after img2)
*   ```
*/
/*@__NO_SIDE_EFFECTS__*/
function naturalCompare(x, y) {
	if (_naturalCompare === void 0) _naturalCompare = new Intl.Collator(void 0, {
		numeric: true,
		sensitivity: "base"
	}).compare;
	return _naturalCompare(x, y);
}
/**
* Sort an array using natural comparison.
*
* @example
*   ;```typescript
*   naturalSorter(['file10', 'file2', 'file1']).asc()
*   // ['file1', 'file2', 'file10']
*   ```
*/
/*@__NO_SIDE_EFFECTS__*/
function naturalSorter(arrayToSort) {
	if (_naturalSorter === void 0) _naturalSorter = (/* @__PURE__ */ require_sorts__internal.getFastSort()).createNewSortInstance({ comparer: naturalCompare });
	return _naturalSorter(arrayToSort);
}

//#endregion
exports.localeCompare = localeCompare;
exports.naturalCompare = naturalCompare;
exports.naturalSorter = naturalSorter;