import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import Modal from "./index.js";
//#region src/components/workSpaceList/components/Modal/antdConfirmPromise.ts
const _excluded = ["type"], _excluded2 = ["type"];
/**
* 获取确定或者取消 true false 的promise
* @param type confirm
* @param otherProps
*/
function antdConfirmPromiseShell(_ref) {
	let { type = "confirm" } = _ref, otherProps = _objectWithoutProperties(_ref, _excluded);
	return new Promise((resolve, reject) => {
		Modal[type](_objectSpread2({
			onOk() {
				resolve(true);
			},
			onCancel() {
				resolve(false);
			}
		}, otherProps));
	});
}
/**
* 同步阻塞式确认弹窗
* @param type
* @param otherProps
*/
function antdConfirmPromise(_x) {
	return _antdConfirmPromise.apply(this, arguments);
}
function _antdConfirmPromise() {
	_antdConfirmPromise = _asyncToGenerator(function* (_ref2) {
		let { type = "confirm" } = _ref2, otherProps = _objectWithoutProperties(_ref2, _excluded2);
		const result = yield antdConfirmPromiseShell(_objectSpread2({ type }, otherProps));
		return new Promise((resolve) => {
			if (result) resolve();
		});
	});
	return _antdConfirmPromise.apply(this, arguments);
}
//#endregion
export { antdConfirmPromise };
