import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import dayjs from "dayjs";
import "lodash";
//#region src/components/ticketBooking/sync.ts
/**
* 格式化同步前的数据
*/
const formatSyncData = (store) => {
	return JSON.stringify({ modalState: {
		client: store.modalState.client,
		date: store.modalState.date,
		pet: store.modalState.pet,
		notes: store.modalState.notes,
		contacts_info: store.modalState.contacts_info,
		service: { value: store.modalState.service.value }
	} });
};
/**
* 将传递的数据和现有store进行合并
*/
const mergeSyncData = (store, data) => {
	let _data = typeof data === "string" ? JSON.parse(data) : data;
	return _objectSpread2(_objectSpread2({}, store), {}, { modalState: _objectSpread2(_objectSpread2({}, store.modalState), {}, {
		client: _data.modalState.client,
		date: _objectSpread2(_objectSpread2({}, store.modalState.date), {}, { value: dayjs(_data.modalState.date.value) }),
		pet: _data.modalState.pet,
		notes: _data.modalState.notes,
		contacts_info: _data.modalState.contacts_info,
		service: _objectSpread2(_objectSpread2({}, store.modalState.service), {}, { value: _data.modalState.service.value.map((item) => {
			return _objectSpread2(_objectSpread2({}, item), {}, { _extend: _objectSpread2(_objectSpread2({}, item._extend), {}, {
				start_date: dayjs(item._extend.start_date),
				startDate: dayjs(item._extend.startDate),
				endDate: dayjs(item._extend.endDate)
			}) });
		}) })
	}) });
};
//#endregion
export { formatSyncData, mergeSyncData };
