async function add_marketplace_symbol_to_library({symbol, preview, group_id}) {
	const new_symbol_id = uuidv4()
	remap_entry_and_field_items({ entries: symbol.entries, fields: symbol.fields })

	const symbol_res = await supabase.from('library_symbols').insert({ id: new_symbol_id, name: symbol.name, code: symbol.code, index: 0, group: group_id, owner: get(page).data.user.id })
	if (symbol_res.error) {
		console.log('Failed to insert site', { symbol_res, symbol })
		throw new Error('Failed to insert site')
	}

	const fields_res = await supabase.from('fields').insert(symbol.fields.map(f => ({ ...f, library_symbol: new_symbol_id })))
	if (fields_res.error) {
		console.log('Failed to insert fields', { fields_res, fields: symbol.fields })
		throw new Error('Failed to insert fields')
	}

	const entries_res = await supabase.from('entries').insert(symbol.entries.map(f => ({ ...f, library_symbol: new_symbol_id })))
	if (entries_res.error) {
		console.log('Failed to insert entries', { entries_res, entries: symbol.entries })
		throw new Error('Failed to insert entries')
	}

	const storage_res = await supabase.storage.from('symbols').upload(`${new_symbol_id}/preview.html`, preview)
}
Adds a marketplace symbol to the user's library
@param {Object} options - The options object
@param {Object} options.symbol - The symbol object containing name, code, entries, and fields
@param {string} options.symbol.name - The name of the symbol
@param {import('$lib').Code} options.symbol.code - The code for the symbol
@param {Array<import('$lib').Entry>} options.symbol.entries - The entries data for the symbol
@param {Array<import('$lib').Field>} options.symbol.fields - The fields data for the symbol
@param {string} options.preview - The HTML preview content for the symbol
@param {string} options.group_id - The ID of the library group to add the symbol to
@returns {Promise<void>}