"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    renderCategoryFacetSearchValue: ()=>renderCategoryFacetSearchValue
});
require("../../atomic-icon/atomic-icon.cjs");
const external_lit_namespaceObject = require("lit");
const external_button_cjs_namespaceObject = require("../../button.cjs");
const facet_value_label_highlight_cjs_namespaceObject = require("../facet-value-label-highlight/facet-value-label-highlight.cjs");
const hierarchical_path_cjs_namespaceObject = require("../../../../directives/hierarchical-path.cjs");
const field_utils_cjs_namespaceObject = require("../../../../utils/field-utils.cjs");
const external_all_categories_localized_label_cjs_namespaceObject = require("./all-categories-localized-label.cjs");
const SEPARATOR = '/';
const PATH_MAX_LENGTH = 3;
const renderCategoryFacetSearchValue = ({ props })=>{
    const count = props.value.count.toLocaleString(props.i18n.language);
    const inLabel = props.i18n.t('in');
    const allCategories = (0, external_all_categories_localized_label_cjs_namespaceObject.getAllCategoriesLocalizedLabel)({
        facetId: props.facetId,
        field: props.field,
        i18n: props.i18n
    });
    const localizedPath = props.value.path.length ? props.value.path.map((value)=>(0, field_utils_cjs_namespaceObject.getFieldValueCaption)(props.field, value, props.i18n)) : [
        allCategories
    ];
    const ariaLabel = props.i18n.t('under', {
        child: props.i18n.t('facet-value', {
            count: props.value.count,
            formattedCount: count,
            value: props.value.displayValue
        }),
        parent: localizedPath.join(', ')
    });
    return (0, external_lit_namespaceObject.html)`<li data-key=${props.value.displayValue}>
    ${(0, external_button_cjs_namespaceObject.renderButton)({
        props: {
            style: 'text-neutral',
            part: 'search-result',
            onClick: ()=>props.onClick(),
            class: 'group flex w-full flex-col truncate px-2 py-2.5 focus-visible:outline-none',
            ariaLabel
        }
    })((0, external_lit_namespaceObject.html)`
      <div class="flex w-full">
        ${(0, facet_value_label_highlight_cjs_namespaceObject.renderFacetValueLabelHighlight)({
        props: {
            displayValue: props.value.displayValue,
            isSelected: false,
            searchQuery: props.searchQuery
        }
    })}
        <span part="value-count" class="value-count">
          ${props.i18n.t('between-parentheses', {
        text: count
    })}
        </span>
      </div>
      <div
        part="search-result-path"
        class="text-neutral-dark group-focus:text-primary group-hover:text-primary mt-1 flex w-full"
      >
        <span class="mr-0.5">${inLabel}</span>
        ${(0, hierarchical_path_cjs_namespaceObject.hierarchicalPath)({
        path: localizedPath,
        separator: SEPARATOR,
        maxLength: PATH_MAX_LENGTH,
        emptyPathContent: (0, external_lit_namespaceObject.html)`<span class="truncate">
            ${inLabel} ${allCategories}
          </span>`,
        separatorClass: 'mx-0.5',
        itemClass: 'max-w-max flex-1 truncate',
        ellipsisClass: ''
    })}
      </div>
    `)}
  </li>`;
};
exports.renderCategoryFacetSearchValue = __webpack_exports__.renderCategoryFacetSearchValue;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "renderCategoryFacetSearchValue"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
