import { makeProviderMark as n, localStorageProp as o, computedOf as m, Use as u, attr as i } from "@tempots/dom";
import { useAppearance as f } from "@tempots/ui";
const d = {
  mark: n("Theme"),
  // Create function returns the value and cleanup
  create: ({
    defaultAppearance: a = "system",
    appearancePreferenceKey: r = "bui-appearance"
  } = {}) => {
    const p = f(), e = o({
      key: r,
      defaultValue: a
    }), c = () => {
      p.dispose(), e.dispose();
    };
    return {
      value: {
        appearance: m(
          p,
          e
        )((s, t) => t === "system" ? s : t),
        appearancePreference: e,
        setAppearancePreference: (s) => {
          e.set(s);
        }
      },
      dispose: c
    };
  }
}, y = () => u(
  d,
  ({ appearance: a }) => i.class(a.map((r) => `b-${r}`))
);
export {
  d as T,
  y as a
};
