
/**
 * showLaunchView 展示首页
 * @param {Object} options 
 * @param {string} options.cover  顶部图片url，有则显示，没有不显示
 * @param {string} options.logo  logo url，有则显示，没有不显示
 * @param {boolean} options.loading  loading，有则显示，没有不显示
 * @param {string} options.guruLimited  guru limited 文案，默认"@ Guru network limited"
 */
function showLaunchView(options = {
	guruLimited: '@ Guru network limited'
}) {
	const view =  document.createElement('div')
	view.id = 'launch_view'

	if (options.cover) {
		const img = document.createElement('img')
		img.src = options.cover
		img.className = 'cover'
		view.appendChild(img)
	}

	if (options.logo) {
		const img = document.createElement('img')
		img.src = options.logo
		img.className = 'logo'
		view.appendChild(img)
	}

	if (options.loading) {
		const loading = document.createElement('div')
		loading.className = 'loading'
		view.appendChild(loading)
	}

	const text = document.createElement('p')
	text.className = 'guru_text'
	view.appendChild(text)

	document.body.append(view)
}

function hideLaunchView() {
	const view = document.querySelector('#launch_view')
	if (view) {
		view.style.display = 'none'
	}
	showFlutterView()
}

function showFlutterView() {
	document.querySelector("flutter-view").style.display = "block"
}

/**
 * 打开debug dialog
 * @param {string} message 展示内容
 */
function showDebugDialog(message) {
	const view = document.querySelector("#debug_dialog")
	if (view) view.style.display = "flex"
	const content = document.querySelector(".content")
	content.innerHTML = message
}

function closeDebugeDialog(e) {
	e.target.style.display = "none"
}