/**
 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */

export function markAsPublic( item ) {
	if ( !item ) {
		return;
	}

	// Already marked as public or marked as internal.
	if ( item.isPublicTree || item.internal ) {
		return;
	}

	item.isPublicTree = true;

	markReferencesAsPublic( item );
}

export function markReferencesAsPublic( item ) {
	if ( !item || !item.references ) {
		return;
	}

	for ( const reference of item.references ) {
		markAsPublic( reference );
	}
}
