import {
  Capabilities,
  contributes
} from "./chunk-WPW5VVAX.mjs";

// src/plugin-settings/store.ts
import { RootSettingsStore } from "@dxos/local-storage";
var store_default = ((context) => {
  const settingsStore = new RootSettingsStore();
  let previous = [];
  const registry = context.getCapability(Capabilities.AtomRegistry);
  const cancel = registry.subscribe(context.capabilities(Capabilities.Settings), (allSettings) => {
    const added = allSettings.filter((setting) => !previous.includes(setting));
    const removed = previous.filter((setting) => !allSettings.includes(setting));
    previous = allSettings;
    added.forEach((setting) => {
      settingsStore.createStore(setting);
    });
    removed.forEach((setting) => {
      settingsStore.removeStore(setting.prefix);
    });
  }, {
    immediate: true
  });
  return contributes(Capabilities.SettingsStore, settingsStore, () => cancel());
});
export {
  store_default as default
};
//# sourceMappingURL=store-CNPHOYTJ.mjs.map
