import { ReflectUtils } from "@dooboostore/core/reflect/ReflectUtils";
const STATE_METADATA_KEY = Symbol("simple-web-component:state");
function state(arg1, arg2) {
  const decorator = (options, target, propertyKey) => {
    const constructor = target.constructor;
    if (!options.name) options.name = String(propertyKey);
    let list = ReflectUtils.getMetadata(STATE_METADATA_KEY, constructor);
    if (!list) {
      list = [];
      ReflectUtils.defineMetadata(STATE_METADATA_KEY, list, constructor);
    }
    list.push({ propertyKey, options });
  };
  if (arg2) {
    return decorator({}, arg1, arg2);
  }
  return (target, propertyKey) => {
    const options = typeof arg1 === "string" ? { name: arg1 } : arg1 || {};
    decorator(options, target, propertyKey);
  };
}
const getStateMetadataList = (target) => {
  const constructor = target instanceof Function ? target : target.constructor;
  return ReflectUtils.getMetadata(STATE_METADATA_KEY, constructor);
};
export {
  STATE_METADATA_KEY,
  getStateMetadataList,
  state
};
//# sourceMappingURL=state.js.map
