"use client";
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { createContext } from "react";

//#region src/components/client/Radio/RadioGroupStore.tsx
/**
* A store for a single RadioGroup. This store is used to manage the state of all Radios within a group.
*/
var RadioGroupStore = class RadioGroupStore {
	name;
	value;
	activeCount = 0;
	#changeListeners = /* @__PURE__ */ new Set();
	constructor(name) {
		this.name = name;
	}
	onChange(cb) {
		this.#changeListeners.add(cb);
		return () => {
			this.#changeListeners.delete(cb);
		};
	}
	setValue(value) {
		this.value = value;
		this.#changeListeners.forEach((cb) => cb(value));
	}
	static findOrCreate(radioGroupStores, name) {
		let store = radioGroupStores.get(name);
		if (!store) {
			store = new RadioGroupStore(name);
			radioGroupStores.set(name, store);
		}
		return store;
	}
};
const RadioGroupContext = createContext(/* @__PURE__ */ new Map());

//#endregion
export { RadioGroupContext, RadioGroupStore };