import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import useEngineContext from "../../../../hooks/useEngineContext.js";
import { SalesSdkProvider } from "../../context/SalesSdkProvider.js";
import { createCompositeOpenProductDetailHost } from "../../hosts/createCompositeOpenProductDetailHost.js";
import { createOpenBookingEditHost } from "../../hosts/createOpenBookingEditHost.js";
import { createOpenMultiDaySelectHost } from "../../hosts/createOpenMultiDaySelectHost.js";
import { createOpenHolderSelectHost } from "../../hosts/createOpenHolderSelectHost.js";
import { DemoHostRuntimeBridge } from "./DemoHostRuntimeBridge.js";
import React, { useMemo, useRef } from "react";
//#region src/plus/salesSdk/demo/components/SalesSdkDemoTabShell.tsx
const _excluded = ["children", "uiHosts"];
/**
* Demo 专用：在 create/edit Tab 外包一层 Provider，并注入 legacy Info2 商品弹窗 Host。
*
* - `openProductDetail` → 普通商品 SkuDetailModal + 预约商品 `pisell1.handleOpenProductModal`
* - `openBookingEdit` → SalesSdk `BookingEditServiceDrawer`（Info2 editService 无 miniRedux 版）
* - 运行时 customerId / date 通过 ref + DemoHostRuntimeBridge 同步
*/
const SalesSdkDemoTabShell = (_ref) => {
	var _context$appHelper;
	let { children, uiHosts: _ignoredUiHosts } = _ref, providerProps = _objectWithoutProperties(_ref, _excluded);
	const context = useEngineContext();
	const action = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.action;
	const runtimeRef = useRef({
		date: void 0,
		customerId: void 0
	});
	const uiHosts = useMemo(() => _objectSpread2(_objectSpread2({}, action ? { openProductDetail: createCompositeOpenProductDetailHost({
		action,
		getRuntime: () => runtimeRef.current
	}) } : {}), {}, {
		openBookingEdit: createOpenBookingEditHost(),
		openMultiDaySelect: createOpenMultiDaySelectHost(),
		openHolderSelect: createOpenHolderSelectHost()
	}), [action]);
	return /* @__PURE__ */ React.createElement(SalesSdkProvider, _objectSpread2(_objectSpread2({}, providerProps), {}, { uiHosts }), /* @__PURE__ */ React.createElement(DemoHostRuntimeBridge, { runtimeRef }), children);
};
//#endregion
export { SalesSdkDemoTabShell };
