"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
exports._util = void 0;
(function(_util) {
  _util.serviceIds = /* @__PURE__ */ new Map();
  _util.DI_TARGET = "$di$target";
  _util.DI_DEPENDENCIES = "$di$dependencies";
  function getServiceDependencies(ctor) {
    return ctor[_util.DI_DEPENDENCIES] || [];
  }
  _util.getServiceDependencies = getServiceDependencies;
})(exports._util || (exports._util = {}));
const IInstantiationService = createDecorator("instantiationService");
function storeServiceDependency(id, target, index) {
  if (target[exports._util.DI_TARGET] === target) {
    target[exports._util.DI_DEPENDENCIES].push({ id, index });
  } else {
    target[exports._util.DI_DEPENDENCIES] = [{ id, index }];
    target[exports._util.DI_TARGET] = target;
  }
}
function createDecorator(serviceId) {
  if (exports._util.serviceIds.has(serviceId)) {
    return exports._util.serviceIds.get(serviceId);
  }
  const id = function(target, key, index) {
    if (arguments.length !== 3) {
      throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
    }
    storeServiceDependency(id, target, index);
  };
  id.toString = () => serviceId;
  exports._util.serviceIds.set(serviceId, id);
  return id;
}
exports.IInstantiationService = IInstantiationService;
exports.createDecorator = createDecorator;
