function get_ancestors(item, all_items) {
	const parent = all_items.find((e) => e.id === item.parent)
	return parent ? [parent, ...get_ancestors(parent, all_items)] : []
}
Gets all ancestor items for a given item by recursively traversing parent relationships

@param {Object} item - The item to find ancestors for
@param {Array} all_items - Array of all possible items to search through
@param {string} item.parent - ID of the item's parent
@param {string} item.id - ID of the item
@returns {Array} Array of ancestor items, ordered from immediate parent to most distant ancestor