"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../_virtual/_rolldown/runtime.js');
const require_primordials_string = require('../primordials/string.js');
let src_external_picomatch = require("../external/picomatch");
src_external_picomatch = require_runtime.__toESM(src_external_picomatch);

//#region src/releases/github-assets.ts
/**
* @file Asset matching helpers for GitHub releases.
*/
/**
* Create a matcher function for a pattern using picomatch for glob patterns or
* simple prefix/suffix matching for object patterns.
*
* @example
*   ;```typescript
*   const isMatch = createAssetMatcher('tool-*-linux-x64')
*   isMatch('tool-v1.0-linux-x64') // true
*   isMatch('tool-v1.0-darwin-arm64') // false
*   ```
*
* @param pattern - Pattern to match (string glob, prefix/suffix object, or
*   RegExp)
*
* @returns Function that tests if a string matches the pattern
*/
function createAssetMatcher(pattern) {
	if (typeof pattern === "string") {
		const isMatch = (0, src_external_picomatch.default)(pattern);
		return (input) => isMatch(input);
	}
	if (pattern instanceof RegExp) return (input) => pattern.test(input);
	const { prefix, suffix } = pattern;
	return (input) => require_primordials_string.StringPrototypeStartsWith(input, prefix) && require_primordials_string.StringPrototypeEndsWith(input, suffix);
}

//#endregion
exports.createAssetMatcher = createAssetMatcher;