(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4940],{7479:e=>{e.exports={sortTypeContainer:"SortRadios_sortTypeContainer__rw38k",newSortRadioSortTypeContainer:"SortRadios_newSortRadioSortTypeContainer__gAisM",divider:"SortRadios_divider__lEkM5",sortType:"SortRadios_sortType__Qj4aq",sortTypeRadio:"SortRadios_sortTypeRadio__xtm9_",sortTypeTooltip:"SortRadios_sortTypeTooltip__Mroph",sortTypeTrigger:"SortRadios_sortTypeTrigger__rCqZy",sortTypeHead:"SortRadios_sortTypeHead__1jHka",newSortRadioSortTypeHead:"SortRadios_newSortRadioSortTypeHead___pSLe",sortTypeButton:"SortRadios_sortTypeButton__O_Kyq",newSortRadioSortTypeButton:"SortRadios_newSortRadioSortTypeButton__7MmTc"}},33154:(e,t,i)=>{"use strict";i.d(t,{X:()=>s});let s=e=>(e||0===e)&&"number"==typeof e?function(e,t=2){return+e.toFixed(t)}(e,2):null},42003:(e,t,i)=>{"use strict";i.d(t,{x:()=>y});var s=i(95155),o=i(12115),r=i(84685),n=i(24691),a=i(25032),l=i(66216),c=i(37940),d=i(17807),_=i(29722),u=i(27757),p=i(89584),h=i(7479),m=i.n(h);let C=({isMobile:e,onChangeSort:t,isIncreaseSort:i})=>(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("p",{className:(0,_.A)(m().sortTypeHead),children:[(0,s.jsx)("button",{style:{marginLeft:"0px",marginRight:e?"0px":"8px"},className:(0,_.A)(m().sortTypeButton),onClick:t,children:(0,s.jsx)(r.yZ$,{className:(0,_.A)(!i&&m().iconInverted)})}),"Сортировать"]})}),S=(0,o.memo)(({isMobile:e,onChangeSort:t,isIncreaseSort:i,onChangeSortType:o,sortTypeItems:r,sortTypeValue:n,isNewSortRadios:a})=>(0,s.jsxs)(s.Fragment,{children:[!a&&e&&(0,s.jsx)(C,{onChangeSort:t,isMobile:e,isIncreaseSort:i}),(0,s.jsxs)("div",{className:(0,_.A)(m().sortTypeContainer,a&&m().newSortRadioSortTypeContainer),onClick:e=>e.stopPropagation(),children:[a&&(0,s.jsx)(C,{onChangeSort:t,isMobile:e,isIncreaseSort:i}),r.map(e=>(0,s.jsx)("div",{"data-qa":`${e.value}_radio`,className:m().sortType,children:(0,s.jsx)(p.s,{onChange:()=>{o(e.value)},name:`${e.value}_radio`,label:e.label,checked:e.value===n,className:m().sortTypeRadio,value:e.value})},e.value))]})]}));S.displayName="SortRadios";var x=i(72435);let R=12;var f=i(60863),T=i.n(f);let y=(0,o.memo)(({isClose:e,chips:t,onClickParams:i,isIncreaseSort:p,onChangeIncreaseSort:h,sortTypeItems:m,sortTypeValue:C,onChangeSortType:f,isFixed:y,portalId:j,onClickChip:v,className:g,isNewSortRadios:N})=>{let L=(0,d.nu)("m"),{containerRef:w,isOverflow:F,minLength:k,handleCompute:b}=(({length:e,isActive:t=!0,gap:i=R,rows:s=1})=>{let[r,n]=(0,o.useState)(!1),a=(0,o.useRef)([]),l=(0,o.useRef)(null),c=(0,o.useRef)(null),d=(0,o.useRef)(()=>null),_=(0,o.useRef)(0),[u,p]=(0,o.useState)(e),h=(0,o.useRef)(((e=300)=>{let t=null;return i=>{t&&clearInterval(t),t=setTimeout(i,e)}})(700)),m=(0,o.useCallback)(()=>{n(!1),setTimeout(()=>{let t=c.current?.getBoundingClientRect().width??0,o=1,r=0,l=0;for(let e=0;e<=a.current.length;e++){let n=a.current[e];if(!n)continue;let c=n.getBoundingClientRect().width+i;if(c>=t&&(c=t),(r+=c)>=t*o){if(o>=s){r-=c;break}r>t*o&&(r+=t*o-(r-c)),o++}l++}n(e>l),p(l),_.current=r})},[i,e,s]);return(0,o.useEffect)(()=>{if(window.removeEventListener("resize",d.current),t)return d.current=()=>h.current(m),d.current(),window.addEventListener("resize",d.current),()=>window.removeEventListener("resize",d.current)},[m,t]),(0,o.useEffect)(()=>{if(r){let e=(c.current?.getBoundingClientRect().width??0)*s,t=(l.current?.getBoundingClientRect().width??0)+_.current-e;t>0&&p(e=>{let s=0;for(let o=e;o>=0;o--){let e=a.current[o],r=e?.getBoundingClientRect().width;if(e&&r&&(s++,(t-=r+i)<=0))break}return e-s})}},[i,r,s]),{isOverflow:r,minLength:u,chipsRef:a,buttonRef:l,containerRef:c,handleCompute:m}})({length:t.length,isActive:!L}),[B,M]=(0,o.useState)(!1),A=L?k:4,E=L?F:B,[z,I]=(0,o.useState)(!1),[$,H]=(0,o.useState)(!1),[q,P]=(0,o.useState)(!1),Q=t.length-A,Z=(0,o.useMemo)(()=>[{id:"overflow",label:`${z?"Скрыть":"Ещё"} ${Q}`}],[z,Q]),D=(0,o.useCallback)(()=>{L?H(e=>!e):I(e=>!e)},[L]),J=(0,o.useRef)(void 0);(0,o.useEffect)(()=>{let t=J.current;if(void 0===e)return;let i=L?$:z;if(!i||t===e){J.current=e;return}(t!==e||i)&&(D(),J.current=e)},[D,e,L,$,z]);let K=(0,o.useCallback)(()=>{H(!1),setTimeout(()=>i?.(),300)},[i]),W=()=>P(e=>!e),O=(0,o.useCallback)(()=>h?.(!p),[p,h]);(0,o.useEffect)(()=>{L&&(M(!1),M(t.length>4))},[t.length,L]),(0,o.useEffect)(()=>{b()},[b,y]);let V=(0,s.jsx)("div",{className:(0,_.A)(!L&&N&&T().sortTypeDesktop),children:(0,s.jsx)(S,{isMobile:L,isIncreaseSort:p,onChangeSort:O,onChangeSortType:f,sortTypeItems:m,sortTypeValue:C,isNewSortRadios:N,portalId:j})}),U=m.find(e=>e.value===C);return(0,s.jsxs)("div",{className:(0,_.A)(T().filter,N&&T().newSortRadiosFilter,y&&T().stuck,g),children:[(0,s.jsx)(l.m,{className:T().mainContainer,children:(0,s.jsxs)("div",{className:T().container,children:[(0,s.jsxs)("div",{className:(0,_.A)(T().chipsContainer,!z&&T().chipsContainerClosed),ref:w,children:[(0,s.jsx)(a.C,{size:"l",onChipClick:e=>v?.(e),className:T().chips,variant:"secondary",chips:t.slice(0,L||z||!E?t.length:A)}),!L&&F&&Q>0&&(0,s.jsx)(a.C,{size:"l",className:T().chips,variant:"secondary",chips:Z,onChipClick:D})]}),(0,s.jsxs)("div",{className:T().actionsWrapper,children:[(0,s.jsxs)("button",{className:(0,_.A)(T().action,T().actionButton),onClick:i,children:[(0,s.jsx)(r.uJ7,{size:22,className:T().icon}),(0,s.jsx)("span",{className:T().actionText,children:"Все параметры"})]}),(0,s.jsxs)("div",{className:T().action,children:[(0,s.jsx)("button",{className:(0,_.A)(T().icon,T().iconButton,!p&&T().iconInverted),onClick:L&&y?W:O,children:(0,s.jsx)(r.yZ$,{size:22})}),(0,s.jsxs)(c.ms,{opened:!L&&q,placement:"bottom-end",onToggle:W,children:[(0,s.jsx)(c.uu,{children:(0,s.jsx)("span",{className:(0,_.A)(T().actionText,T().actionButton),"data-qa":`${C}_order`,children:U?.shortLabel||U?.label||"Сортировка"})}),(0,s.jsx)(c.pm,{children:V})]})]})]})]})}),(0,s.jsxs)(u.Z,{id:j,children:[(0,s.jsx)(x.L,{footer:(0,s.jsx)(n.$,{className:T().modalButton,onClick:K,label:"Изменить параметры"}),className:(0,_.A)(T().modal,N&&T().newSortRadioModal),isOpen:$,onClose:D,children:(0,s.jsx)("div",{className:T().chipsContainerModal,children:(0,s.jsx)(a.C,{chips:t,className:T().chips,size:"l",variant:"secondary",onChipClick:K})})}),(0,s.jsx)(x.L,{className:(0,_.A)(T().modal,N&&T().newSortRadioModal),isSmallPopup:N,onClose:W,isOpen:!!(q&&L),footer:(0,s.jsx)(n.$,{size:N?"s":"m",className:T().modalButton,label:"Применить",onClick:W}),children:V})]})]})});y.displayName="ListFilter"},60863:e=>{e.exports={filter:"ListFilter_filter__E5PHL",newSortRadiosFilter:"ListFilter_newSortRadiosFilter__2dflS",sortTypeDesktop:"ListFilter_sortTypeDesktop__Yef7U",container:"ListFilter_container__Molcd",modal:"ListFilter_modal__0Q3R9",newSortRadioModal:"ListFilter_newSortRadioModal__5K1jd",modalButton:"ListFilter_modalButton__0Q3M3",chipsContainerModal:"ListFilter_chipsContainerModal__h_MAJ",chipsContainer:"ListFilter_chipsContainer__jKEfP",chips:"ListFilter_chips__bWY2z",chipsContainerClosed:"ListFilter_chipsContainerClosed__RmbSt",actionsWrapper:"ListFilter_actionsWrapper__87DPh",action:"ListFilter_action__AVlfa",actionText:"ListFilter_actionText__6vJqS",iconButton:"ListFilter_iconButton__nt1oX",actionButton:"ListFilter_actionButton__hRj9y",icon:"ListFilter_icon__G3naU",iconInverted:"ListFilter_iconInverted__zfVvQ",stuck:"ListFilter_stuck__CJKpN",mainContainer:"ListFilter_mainContainer__13FFs",chip:"ListFilter_chip__QBtZg"}}}]);