"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index.cjs38.js"),e=require("react"),m=require("./index.cjs40.js"),t=require("./index.cjs64.js"),S=require("./index.cjs65.js"),A=require("./index.cjs9.js"),x=e.forwardRef(({liked:c,defaultLiked:j=!1,count:n,onLike:o,onClick:u,className:h,testId:B,disabled:i,...E},k)=>{const r=c!==void 0,[y,R]=e.useState(j),[b,p]=e.useState(!1),[g,f]=e.useState(!1),a=r?c:y,q=e.useCallback(l=>{if(i)return;const d=!a;r||R(d),o==null||o(d),u==null||u(l),d&&(p(!0),n!==void 0&&f(!0))},[i,a,r,o,u,n]),v=e.useCallback(()=>{p(!1)},[]),N=e.useCallback(l=>{l.stopPropagation(),f(!1)},[]);return s.jsxRuntimeExports.jsxs("button",{ref:k,type:"button","data-atme-ui":!0,className:m(t.default.likeButton,a&&t.default["likeButton--liked"],b&&t.default["likeButton--pop"],i&&t.default["likeButton--disabled"],h),"aria-pressed":a,"aria-label":a?"Убрать лайк":"Поставить лайк",disabled:i,"data-testid":B,onClick:q,onAnimationEnd:v,...E,children:[s.jsxRuntimeExports.jsx("span",{className:t.default.heartWrap,children:s.jsxRuntimeExports.jsx(S.HeartIcon,{filled:a,className:t.default.heart,decorative:!0})}),n!==void 0&&s.jsxRuntimeExports.jsx("span",{className:m(t.default.countWrap,g&&t.default["countWrap--bump"]),onAnimationEnd:N,children:s.jsxRuntimeExports.jsx(A.Typography,{variant:"caption",className:t.default.count,as:"span",children:n})})]})});x.displayName="LikeButton";exports.LikeButton=x;
//# sourceMappingURL=index.cjs21.js.map
