//#region src/plus/salesSdk/normalProductDetail/normalProductDetailHostController.ts
let pending = null;
const listeners = /* @__PURE__ */ new Set();
function subscribeNormalProductDetailHost(listener) {
	listeners.add(listener);
	return () => listeners.delete(listener);
}
function getNormalProductDetailHostPending() {
	return pending;
}
function requestOpenNormalProductDetail(payload) {
	if (pending) {
		pending.resolve(null);
		pending = null;
	}
	return new Promise((resolve) => {
		pending = {
			payload,
			resolve
		};
		listeners.forEach((l) => l());
	});
}
function completeNormalProductDetailHost(result) {
	if (pending) {
		pending.resolve(result);
		pending = null;
		listeners.forEach((l) => l());
	}
}
//#endregion
exports.completeNormalProductDetailHost = completeNormalProductDetailHost;
exports.getNormalProductDetailHostPending = getNormalProductDetailHostPending;
exports.requestOpenNormalProductDetail = requestOpenNormalProductDetail;
exports.subscribeNormalProductDetailHost = subscribeNormalProductDetailHost;
