window.yasrTrueFalseStringConvertion=function(e){return null!=e&&""!==e||(e=!1),"true"!==e&&"1"!==e||(e=!0),"false"!==e&&"0"!==e||(e=!1),e},window.yasrValidJson=function(e){try{const t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch(e){console.error("Not a valid Json Element"),console.log(e)}return!1},window.yasrSetRaterValue=function(e,t,r=!1,i=.1,a=!0,n=!1,o=!1){let s;s=r||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:s,step:i,readOnly:a,rating:n,rateCallback:o})},window.raterJs=function(e){let t=!0;if(void 0===e.element||null===e.element)return void console.info("missing rating element");if(null!==e.element&&e.element.classList.contains("yasr-star-rating"))return;if(void 0!==e.showToolTip&&(t=!!e.showToolTip),void 0!==e.step&&(e.step<=0||e.step>1))throw new Error("step must be a number between 0 and 1");let r,i,a=5,n=e.starSize||16,o=e.step||1,s=e.onHover,l=e.onLeave,u=yasrTrueFalseStringConvertion(yasrWindowVar.isRtl),d=e.element;d.classList.add("yasr-star-rating");let c=document.createElement("div");c.classList.add("yasr-star-value"),c.style.backgroundSize=n+"px",d.appendChild(c),d.style.width=n*a+"px",d.style.height=n+"px",d.style.backgroundSize=n+"px";let f,v,y,m=e.rateCallback,g=!!e.readOnly,p=!1,b=e.isBusyText;if(f=void 0!==e.disableText?e.disableText:"{rating}/{maxRating}",g||(d.style.cursor="pointer"),y=void 0!==e.ratingText?e.ratingText:"{rating}/{maxRating}",e.rating)E(e.rating);else{var w=d.dataset.rating;w&&E(+w)}function h(e){if(!0===g||!0===p)return;let i;if(!0===u){let t=this.getBoundingClientRect(),r=e.pageX-t.left,a=d.offsetWidth;i=(a-r)/(a/100)}else i=e.offsetX/d.offsetWidth*100;if(i<101){if(1===o)v=Math.ceil(i/100*a);else{let e=i/100*a;for(let t=0;;t+=o)if(t>=e){v=t;break}}if(v>5&&(v=5),d.querySelector(".yasr-star-value").style.width=v/a*100+"%",t){let e=y.replace("{rating}",v);e=e.replace("{maxRating}",a),d.setAttribute("data-title",e)}"function"==typeof s&&s(v,r)}}function x(e){void 0!==r?(d.querySelector(".yasr-star-value").style.width=r/a*100+"%",d.setAttribute("data-rating",r)):(d.querySelector(".yasr-star-value").style.width="0%",d.removeAttribute("data-rating")),"function"==typeof l&&l(v,r)}function S(e){!0!==g&&!0!==p&&(void 0===m&&!1===typeof m||(p=!0,i=v,void 0===b?d.removeAttribute("data-title"):d.setAttribute("data-title",b),m.call(this,i,(function(){!1===g&&d.removeAttribute("data-title"),p=!1}))))}function T(){if(g=!0,t&&f){let e=f.replace("{rating}",r);e=e.replace("{maxRating}",a),d.setAttribute("data-title",e)}else d.removeAttribute("data-title")}function E(e){if(-1===e&&(e=void 0),"number"!=typeof e&&void 0!==e)throw new Error("Value must be a number or undefined.");e<0&&(e=0),e>5&&(e=5),r=e,d.querySelector(".yasr-star-value").style.width=e/a*100+"%",d.setAttribute("data-rating",e)}void 0===r&&(d.querySelector(".yasr-star-value").style.width="0px"),g&&T(),d.addEventListener("mousemove",h),d.addEventListener("mouseleave",x);let A={setRating:E,getRating:function(){return r},disable:T,enable:function(){g=!1,d.removeAttribute("data-title")},dispose:function(){d.removeEventListener("mousemove",h),d.removeEventListener("mouseleave",x),d.removeEventListener("click",S)}};return d.addEventListener("click",S.bind(A)),A};