document.addEventListener('DOMContentLoaded', () => {
	const mount = document.querySelector('[data-foodord-admin-nav-mount="timed-products"]');
	if (!mount) {
		return;
	}

	const nav = mount.querySelector('.foodord-admin-nav');
	if (!nav) {
		return;
	}

	const mainWrap = document.querySelector('div.wrap');
	if (!mainWrap) {
		return;
	}

	const hr = mainWrap.querySelector('hr.wp-header-end');
	if (hr) {
		hr.insertAdjacentElement('afterend', nav);
		mount.remove();
		return;
	}

	const title = mainWrap.querySelector('h1.wp-heading-inline');
	if (title) {
		title.insertAdjacentElement('afterend', nav);
		mount.remove();
	}
});
