<script lang="ts">
	import type { WithGname } from '../internal/types';
	import type { ComponentAttributes } from '../types/google';

	import { searchEngine } from '../internal/action';
	import { buildParams } from '../internal/helpers';

	let {
		attributes,
		only = false
	}: {
		attributes: ComponentAttributes & WithGname;
		only?: boolean;
	} = $props();

	let { id, param } = $derived(buildParams('searchbox', only, attributes));
</script>

<div {id} use:searchEngine={param}></div>
