//#region src/plus/salesSdk/addProductFlow/multiDayHostController.ts
let pending = null;
const listeners = /* @__PURE__ */ new Set();
function subscribeMultiDayHost(listener) {
	listeners.add(listener);
	return () => listeners.delete(listener);
}
function getMultiDayHostPending() {
	return pending;
}
function requestOpenMultiDaySelect(payload) {
	if (pending) {
		pending.resolve(null);
		pending = null;
	}
	return new Promise((resolve) => {
		pending = {
			payload,
			resolve
		};
		listeners.forEach((l) => l());
	});
}
function completeMultiDayHost(result) {
	if (pending) {
		pending.resolve(result);
		pending = null;
		listeners.forEach((l) => l());
	}
}
//#endregion
exports.completeMultiDayHost = completeMultiDayHost;
exports.getMultiDayHostPending = getMultiDayHostPending;
exports.requestOpenMultiDaySelect = requestOpenMultiDaySelect;
exports.subscribeMultiDayHost = subscribeMultiDayHost;
