(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7543],{90375:function(e,t,n){"use strict";n.d(t,{p:function(){return S}});var i=n(57437),o=n(2265),r=n(80684),s=n(35563),l=n(75461),a=n(61994),c=n(13466),d=n(55843),u=n.n(d);let _=e=>{let{isMobile:t,onChangeSort:n,isIncreaseSort:o}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("p",{className:(0,a.Z)(u().sortTypeHead),children:[(0,i.jsx)("button",{style:{marginLeft:"0px",marginRight:t?"0px":"8px"},className:(0,a.Z)(u().sortTypeButton),onClick:n,children:(0,i.jsx)(r.IconFdsSortDescendingO,{className:(0,a.Z)(!o&&u().iconInverted)})}),"Сортировать"]})})},p=(0,o.memo)(e=>{let{isMobile:t,onChangeSort:n,isIncreaseSort:o,onChangeSortType:r,sortTypeItems:s,sortTypeValue:c,isNewSortRadios:d}=e;return(0,i.jsxs)(i.Fragment,{children:[!d&&t&&(0,i.jsx)(_,{onChangeSort:n,isMobile:t,isIncreaseSort:o}),(0,i.jsxs)("div",{className:(0,a.Z)(u().sortTypeContainer,d&&u().newSortRadioSortTypeContainer),onClick:e=>e.stopPropagation(),children:[d&&(0,i.jsx)(_,{onChangeSort:n,isMobile:t,isIncreaseSort:o}),s.map(e=>(0,i.jsx)("div",{"data-qa":"".concat(e.value,"_radio"),className:u().sortType,children:(0,i.jsx)(l.Y8,{onChange:()=>{r(e.value)},name:"".concat(e.value,"_radio"),label:e.label,checked:e.value===c,className:u().sortTypeRadio,value:e.value})},e.value))]})]})});p.displayName="SortRadios";var h=n(49689);let m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=null;return n=>{t&&clearInterval(t),t=setTimeout(n,e)}},v=e=>{let{length:t,isActive:n=!0,gap:i=12,rows:r=1}=e,[s,l]=(0,o.useState)(!1),a=(0,o.useRef)([]),c=(0,o.useRef)(null),d=(0,o.useRef)(null),u=(0,o.useRef)(()=>null),_=(0,o.useRef)(0),[p,h]=(0,o.useState)(t),v=(0,o.useRef)(m(700)),f=(0,o.useCallback)(()=>{l(!1),setTimeout(()=>{var e,n;let o=null!==(n=null===(e=d.current)||void 0===e?void 0:e.getBoundingClientRect().width)&&void 0!==n?n:0,s=1,c=0,u=0;for(let e=0;e<=a.current.length;e++){let t=a.current[e];if(!t)continue;let n=t.getBoundingClientRect().width+i;if(n>=o&&(n=o),(c+=n)>=o*s){if(s>=r){c-=n;break}c>o*s&&(c+=o*s-(c-n)),s++}u++}l(t>u),h(u),_.current=c})},[i,t,r]);return(0,o.useEffect)(()=>{if(window.removeEventListener("resize",u.current),n)return u.current=()=>v.current(f),u.current(),window.addEventListener("resize",u.current),()=>window.removeEventListener("resize",u.current)},[f,n]),(0,o.useEffect)(()=>{if(s){var e,t,n,o;let s=(null!==(n=null===(e=d.current)||void 0===e?void 0:e.getBoundingClientRect().width)&&void 0!==n?n:0)*r,l=(null!==(o=null===(t=c.current)||void 0===t?void 0:t.getBoundingClientRect().width)&&void 0!==o?o:0)+_.current-s;l>0&&h(e=>{let t=0;for(let n=e;n>=0;n--){let e=a.current[n],o=null==e?void 0:e.getBoundingClientRect().width;if(e&&o&&(t++,(l-=o+i)<=0))break}return e-t})}},[i,s,r]),{isOverflow:s,minLength:p,chipsRef:a,buttonRef:c,containerRef:d,handleCompute:f}};var f=n(74737),C=n.n(f);let S=(0,o.memo)(e=>{let{isClose:t,chips:n,onClickParams:d,isIncreaseSort:u,onChangeIncreaseSort:_,sortTypeItems:m,sortTypeValue:f,onChangeSortType:S,isFixed:g,portalId:x,onClickChip:R,className:T,isNewSortRadios:y}=e,j=(0,l.aF)("m"),{containerRef:w,isOverflow:F,minLength:L,handleCompute:N}=v({length:n.length,isActive:!j}),[k,b]=(0,o.useState)(!1),B=j?L:4,M=j?F:k,[E,I]=(0,o.useState)(!1),[Z,z]=(0,o.useState)(!1),[D,A]=(0,o.useState)(!1),H=n.length-B,q=(0,o.useMemo)(()=>[{id:"overflow",label:"".concat(E?"Скрыть":"Ещё"," ").concat(H)}],[E,H]),O=(0,o.useCallback)(()=>{if(j){z(e=>!e);return}I(e=>!e)},[j]),P=(0,o.useRef)(void 0);(0,o.useEffect)(()=>{let e=P.current;if(void 0===t)return;let n=j?Z:E;if(!n||e===t){P.current=t;return}(e!==t||n)&&(O(),P.current=t)},[O,t,j,Z,E]);let W=(0,o.useCallback)(()=>{z(!1),setTimeout(()=>null==d?void 0:d(),300)},[d]),Q=()=>A(e=>!e),K=(0,o.useCallback)(()=>null==_?void 0:_(!u),[u,_]);(0,o.useEffect)(()=>{j&&(b(!1),b(n.length>4))},[n.length,j]),(0,o.useEffect)(()=>{N()},[N,g]);let J=(0,i.jsx)("div",{className:(0,a.Z)(!j&&y&&C().sortTypeDesktop),children:(0,i.jsx)(p,{isMobile:j,isIncreaseSort:u,onChangeSort:K,onChangeSortType:S,sortTypeItems:m,sortTypeValue:f,isNewSortRadios:y,portalId:x})}),V=m.find(e=>e.value===f);return(0,i.jsxs)("div",{className:(0,a.Z)(C().filter,y&&C().newSortRadiosFilter,g&&C().stuck,T),children:[(0,i.jsx)(s.W2,{className:C().mainContainer,children:(0,i.jsxs)("div",{className:C().container,children:[(0,i.jsxs)("div",{className:(0,a.Z)(C().chipsContainer,!E&&C().chipsContainerClosed),ref:w,children:[(0,i.jsx)(l.cL,{size:"l",onChipClick:e=>null==R?void 0:R(e),className:C().chips,variant:"secondary",chips:n.slice(0,j||E||!M?n.length:B)}),!j&&F&&H>0&&(0,i.jsx)(l.cL,{size:"l",className:C().chips,variant:"secondary",chips:q,onChipClick:O})]}),(0,i.jsxs)("div",{className:C().actionsWrapper,children:[(0,i.jsxs)("button",{className:(0,a.Z)(C().action,C().actionButton),onClick:d,children:[(0,i.jsx)(r.IconFilter,{size:22,className:C().icon}),(0,i.jsx)("span",{className:C().actionText,children:"Все параметры"})]}),(0,i.jsxs)("div",{className:C().action,children:[(0,i.jsx)("button",{className:(0,a.Z)(C().icon,C().iconButton,!u&&C().iconInverted),onClick:j&&g?Q:K,children:(0,i.jsx)(r.IconFdsSortDescendingO,{size:22})}),(0,i.jsxs)(l.Lt,{opened:!j&&D,placement:"bottom-end",onToggle:Q,children:[(0,i.jsx)(l.WA,{children:(0,i.jsx)("span",{className:(0,a.Z)(C().actionText,C().actionButton),"data-qa":"".concat(f,"_order"),children:(null==V?void 0:V.shortLabel)||(null==V?void 0:V.label)||"Сортировка"})}),(0,i.jsx)(l.Nv,{children:J})]})]})]})]})}),(0,i.jsxs)(c.h,{id:x,children:[(0,i.jsx)(h.j,{footer:(0,i.jsx)(l.zx,{className:C().modalButton,onClick:W,label:"Изменить параметры"}),className:(0,a.Z)(C().modal,y&&C().newSortRadioModal),isOpen:Z,onClose:O,children:(0,i.jsx)("div",{className:C().chipsContainerModal,children:(0,i.jsx)(l.cL,{chips:n,className:C().chips,size:"l",variant:"secondary",onChipClick:W})})}),(0,i.jsx)(h.j,{className:(0,a.Z)(C().modal,y&&C().newSortRadioModal),isSmallPopup:y,onClose:Q,isOpen:!!(D&&j),footer:(0,i.jsx)(l.zx,{size:y?"s":"m",className:C().modalButton,label:"Применить",onClick:Q}),children:J})]})]})});S.displayName="ListFilter"},31893:function(e,t,n){"use strict";n.d(t,{S:function(){return s}});var i=n(2265),o=n(13382),r=n(38856);let s=e=>{let{initialRegion:t,initialTown:n}=e,s=(0,o.u)(),[{region:l,town:a},c]=(0,i.useState)({region:t,town:n});return(0,i.useEffect)(()=>{let e=r.A.getItem("user_region"),i=r.A.getItem("user_town"),o=t||e||null,l=n||i||null;c({region:o,town:l}),s.selectCity(o,l),document.addEventListener("onRegionChange",e=>{var t,n;c({region:null==e?void 0:null===(t=e.detail)||void 0===t?void 0:t.region,town:null==e?void 0:null===(n=e.detail)||void 0===n?void 0:n.town})})},[t,n]),{region:l,town:a,handleOpenCityModal:()=>{s.handleToggleModal(!0)}}}},39635:function(e,t,n){"use strict";n.d(t,{A:function(){return i}});let i=e=>(e||0===e)&&"number"==typeof e?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return+e.toFixed(t)}(e,2):null},75552:function(e,t,n){"use strict";n.d(t,{l:function(){return o}});var i=n(24269);let o=e=>{let{data:t,type:n}=e;if(!t)return[];switch(n){case i.$.mfo:return t.mfos;case i.$.insurance:return t.insurance_companies;default:return t.companies}}},84886:function(e,t,n){"use strict";function i(e,t){let n=Date.now();return function(){Date.now()>=n+t&&(e(),n=Date.now())}}n.d(t,{P:function(){return i}})},74737:function(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"}},55843:function(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"}}}]);