import { html, nothing } from "lit";
import { when } from "lit/directives/when.js";
import { renderItemPlaceholders } from "../atomic-result-placeholder/item-placeholders.js";
import { renderChildrenWrapper } from "./children-wrapper.js";
const renderCollectionGuard = ({ props })=>(children)=>{
        const { isLoadingMoreResults, moreResultsAvailable, numberOfChildren, density, imageSize, noResultText } = props;
        const hasChildren = numberOfChildren > 0;
        if (isLoadingMoreResults) {
            const placeholders = renderItemPlaceholders({
                props: {
                    numberOfPlaceholders: numberOfChildren,
                    density,
                    display: 'list',
                    imageSize
                }
            });
            return hasChildren ? renderChildrenWrapper()(placeholders) : html`<div part="children-root">${placeholders}</div>`;
        }
        if (!moreResultsAvailable && !hasChildren) return when(noResultText.trim().length > 0, ()=>html`<p part="no-result-root" class="no-result-root my-3">
          ${noResultText}
        </p>`);
        if (!hasChildren) return nothing;
        return children;
    };
export { renderCollectionGuard };
