"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../tslib.es6-C4EgNkz1.js"),t=require("react"),d=require("classnames"),k=require("../range-DOsPN0h5.js"),q=require("../random-id-DlJj_RWH.js"),C=require("../icons/ebay-icon-star-dynamic/index.js"),D=k.range(1,5),s=r=>{let a=parseInt(r,0)||0;return a>5&&(a=0),a},I=r=>{var{value:a=0,a11yText:i,className:m,a11yStarText:l=[],disabled:c,onChange:g=()=>{},onFocus:y=()=>{},onKeyDown:_=()=>{},name:b}=r,v=h.__rest(r,["value","a11yText","className","a11yStarText","disabled","onChange","onFocus","onKeyDown","name"]);const S=q.useRandomId(),f=b||`star-rating-${S}`,[u,o]=t.useState(s(a));t.useEffect(()=>{o(s(a))},[a]);const p=e=>n=>{c||(o(s(e)),_(n,{value:e}))},E=e=>n=>{c||(o(s(e)),g(n,{value:e}))},N=e=>n=>{c||(o(s(e)),y(n,{value:e}))};return t.createElement("div",Object.assign({role:i&&"radiogroup","aria-label":i,className:d("star-rating-select",m)},v),D.map(e=>t.createElement("span",{className:"star-rating-select__radio",key:e},t.createElement("input",{"aria-label":l?.[e-1],className:d("star-rating-select__control",{"star-rating-select__control--filled":e<=u}),type:"radio",name:f,value:e,disabled:c,defaultChecked:u===e,onClick:E(e),onFocus:N(e),onKeyDown:p(e)}),t.createElement("span",{className:"star-rating-select__radio-icon"},t.createElement(C.EbayIconStarDynamic,{className:"star-rating__icon"})))))};exports.EbayStarRatingSelect=I;
