"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__, {
    renderChoices: ()=>renderChoices
});
const external_lit_namespaceObject = require("lit");
const external_radio_button_cjs_namespaceObject = require("../radio-button.cjs");
const renderChoices = ({ props })=>{
    const { label, groupName, pageSize, choices, lang, scrollToTopEvent, setItemSize, focusOnFirstResultAfterNextSearch, focusOnNextNewResult } = props;
    const focusOnProperResultDependingOnChoice = (choice)=>{
        if (choice < pageSize) focusOnFirstResultAfterNextSearch()?.then(()=>scrollToTopEvent());
        else if (choice > pageSize) focusOnNextNewResult();
    };
    return (0, external_lit_namespaceObject.html)`
    <div
      part="buttons"
      role="radiogroup"
      aria-label=${label}
      class="flex flex-wrap gap-2"
    >
      ${choices.map((choice)=>{
        const isSelected = pageSize === choice;
        const parts = [
            'button'
        ];
        if (isSelected) parts.push('active-button');
        const text = choice.toLocaleString(lang);
        return (0, external_radio_button_cjs_namespaceObject.renderRadioButton)({
            props: {
                key: 'choice',
                groupName,
                style: 'outline-neutral',
                checked: isSelected,
                ariaLabel: text,
                onChecked: ()=>{
                    focusOnProperResultDependingOnChoice(choice);
                    setItemSize(choice);
                },
                class: 'btn-page focus-visible:bg-neutral-light',
                part: parts.join(' '),
                text,
                selectWhenFocused: false
            }
        });
    })}
    </div>
  `;
};
exports.renderChoices = __webpack_exports__.renderChoices;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "renderChoices"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
