"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_promises_options = require('../promises/options.js');
const require_promises_retry = require('../promises/retry.js');
let src_external_streaming_iterables = require("../external/streaming-iterables");

//#region src/streams/transform.ts
/**
* @file Streaming transform helper — `transform()` wraps
*   `streaming-iterables.transform` with the project's `pRetry` per-item retry
*   policy.
*/
/**
* Transform an iterable with a function.
*
* @example
*   ;```typescript
*   const lines = ['hello', 'world']
*   for await (const upper of transform(lines, async line => {
*     return line.toUpperCase()
*   })) {
*     console.log(upper) // 'HELLO', 'WORLD'
*   }
*   ```
*/
/*@__NO_SIDE_EFFECTS__*/
function transform(iterable, func, options) {
	const opts = /* @__PURE__ */ require_promises_options.normalizeIterationOptions(options);
	return (0, src_external_streaming_iterables.transform)(opts.concurrency, async (item) => {
		return await /* @__PURE__ */ require_promises_retry.pRetry((...args) => func(args[0]), {
			...opts.retries,
			args: [item]
		});
	}, iterable);
}

//#endregion
exports.transform = transform;