"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsyncWrap = void 0;
const AsyncWrap = (unit, _, wrapper) => {
    const $unit = unit;
    $unit.$__ = $unit.$__ ?? [];
    for (const __ of ['$', ...(_ ?? [])]) {
        if (!$unit.$__.includes(__)) {
            $unit.$__.push(__);
            const AsyncWrapper = wrapper[__];
            if (!AsyncWrapper) {
                throw new Error('async wrapper is not registered');
            }
            const api = AsyncWrapper(unit);
            for (const method in api) {
                $unit[method] = api[method];
            }
        }
    }
    return $unit;
};
exports.AsyncWrap = AsyncWrap;
//# sourceMappingURL=AsyncWrap.js.map