"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("clsx"),r=require("@prom-ui/core/useId"),n=require("@prom-ui/core/useIsMounted"),a=require("@prom-ui/icons/StarFill");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=o(e),c=i(t);function l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,u=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){l=!0,a=f}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw a}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var y="_8RSGF",p="FF3m3",b="_1Zpyt",m="_25gdX",v="DscdS",g=["value","name","onChange","onHover","size","disabled"],j=[1,2,3,4,5],O=function(e){var t=e.value,i=e.name,o=e.onChange,d=e.onHover,O=e.size,S=void 0===O?18:O,h=e.disabled,_=f(e,g),E=n.useIsMounted(),q=r.useId(),w=s(u.useState(t),2),I=w[0],P=w[1],k=s(u.useState(!0),2),x=k[0],A=k[1],F=i||q;u.useEffect((function(){E&&"function"==typeof o&&o(I)}),[I]),u.useEffect((function(){t!==I&&P(t)}),[t]);return u.createElement("div",{className:c.default(y,l({},v,x)),style:{fontSize:S},onMouseLeave:function(){"function"==typeof d&&d(void 0)},"data-qaid":_["data-qaid"]||"rating_select","data-testid":_["data-testid"]||"rating_select"},j.map((function(e){var t="".concat(F,"-").concat(e);return u.createElement("input",{key:e,id:t,className:m,type:"radio",name:F,value:e,checked:I===e,onChange:function(){return function(e){A(!1),P(e)}(e)},disabled:h,"data-qaid":"rating_select_input_".concat(e),"data-testid":"rating_select_input_".concat(e)})})),j.map((function(e){var t="".concat(F,"-").concat(e);return u.createElement("label",{key:e,className:p,htmlFor:t,onClick:function(t){return function(e,t){A(!1),h||I!==e||(null==t||t.preventDefault(),P(void 0))}(e,t)},onMouseEnter:function(){return function(e){x||A(!0),"function"==typeof d&&d(e)}(e)},"data-qaid":"rating_select_label_".concat(e),"data-testid":"rating_select_label_".concat(e)},u.createElement(a.SvgStarFill,{className:b,focusable:!1,"aria-hidden":!0}))})))};O.displayName="RatingSelect",exports.RatingSelect=O,require("./style.production.css");
