'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var isClass = require('node-is-class'); var once = require('@zodash/once'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var isClass__default = /*#__PURE__*/_interopDefaultLegacy(isClass); const dependencies = /* @__PURE__ */ new Map(); function provide(token, mock) { dependencies.set(token, mock); } function provideClass(token, ctor) { dependencies.set(token, once.once(() => new ctor())); } function clear() { dependencies.clear(); } function inject() { const { 0: token, 1: factory, length } = arguments; if (!dependencies.has(token)) { if (typeof factory === "function") { return factory(); } if (isClass__default["default"](token)) { dependencies.set(token, once.once(() => new token())); } else if (length === 1) { throw new Error(`Cannot resolve ${token} dependency`); } else if (Object(factory) !== factory) { dependencies.set(token, () => factory); } } return dependencies.get(token)?.(); } const injector = { provideClass, provide, clear }; exports.inject = inject; exports.injector = injector;