"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4789],{72007:function(e,t,n){n.d(t,{H:function(){return d},N:function(){return N},a:function(){return k},b:function(){return h},c:function(){return u},d:function(){return p},h:function(){return x},i:function(){return _},s:function(){return m}});var o=n(57437),i=n(80684),l=n(61994),s=n(2265),r=n(10992),a=n(52074);let c=(0,a.g)("header","sc"),u=Object.freeze({header:`${c}`,fixed:`${c}__fixed`,hidden:`${c}__fixed--hidden`,transparent:`${c}--transparent`,navigationOpen:`${c}__navigation-open`,container:`${c}__container`,leftRow:`${c}__left-row`,logo:`${c}__logo`,menuItems:`${c}__menu-items`,menuItemActive:`${c}__menu-item-active`,tabletMenuButton:`${c}__tablet-menu-button`,buttonGroup:`${c}__button-group`,chips:`${c}__chips`,menuButton:`${c}__menu-button`,moreButtons:`${c}__more-buttons`,auth:`${c}__auth`,close:`${c}__close`,removed:`${c}__removed`,overlay:`${c}__overlay`,overlayOpening:`${c}__overlay--opening`,overlayClosing:`${c}__overlay--closing`}),d="cb-header",p=[{id:"FINPRODUCTS",label:"Финпродукты"},{id:"NAVIGATOR",label:"Журнал"},{id:"ABOUT",label:"О маркетплейсе"}],h=p.reduce((e,t)=>(e[t.id]=t.label,e),{}),m=(e,t,n)=>{if(typeof window>"u"||typeof document>"u")return;let o=document.getElementById("mainHomeBanner"),i=!1,l=0;window.addEventListener("scroll",function(){let s=window.scrollY||document.documentElement.scrollTop,r=window.innerWidth<768?55:80,a=s<((null==o?void 0:o.clientHeight)||0);if(n&&a||s<r){i=!1,e(!1),t(!0);return}i=s>l,e(s>l),i&&setTimeout(()=>t(!1),50);let c=i?"0px":"";document.documentElement.style.setProperty("--new-header-height-desktop",c),document.documentElement.style.setProperty("--new-header-height-mobile",c),l=s<=0?0:s})},v=()=>{let e=new URLSearchParams(window.location.search),t={};for(let[n,o]of Array.from(e.entries()))n.startsWith("utm_")&&(t[n]=o);return Object.keys(t).length>0?t:null},f=()=>document.cookie.split(";").some(e=>e.trim().startsWith("utm_params=")),g=(e,t)=>{let n=new Date;n.setTime(n.getTime()+864e5*t);let o=encodeURIComponent(JSON.stringify(e));document.cookie=`utm_params=${o};expires=${n.toUTCString()};path=/;SameSite=Lax`},w=()=>{if(f())return;let e=v();e&&g(e,90)},_=()=>{setTimeout(()=>{if(!(typeof document>"u"||!document.cookie))try{w()}catch(e){console.error("UTM tracking error:",e)}},0)},x=(e,t,n)=>(0,r.h)({eventCategory:d,eventActionType:e,eventActionText:t,eventLabel:n}),b=(0,a.g)("navigation-chips","sc"),j=Object.freeze({wrapper:`${b}__wrapper`,gray:`${b}__variantGray`,white:`${b}__variantWhite`,container:`${b}__container`,chip:`${b}__chip`,more:`${b}__chip--more`,active:`${b}__chip--active`,label:`${b}__label`,hidden:`${b}__hidden`}),C=(0,a.g)("navigation-content","sc"),k=Object.freeze({contentWrapper:`${C}__content-wrapper`,content:`${C}__content`,contentOpen:`${C}__content--open`,contentHeader:`${C}__content-header`,contentTitle:`${C}__content-title`,contentTitleUrl:`${C}__content-title--url`,contentTitleLink:`${C}__content-title--link`,contentTitleNew:`${C}__content-title--new`,new:`${C}__new`,vip:`${C}__vip`,arrowIcon:`${C}__arrow-icon`,links:`${C}__links`,linksColumns:`${C}__links--columns`,linksTitleless:`${C}__links--titleless`,removed:`${C}__removed`,hidden:`${C}__content--hidden`}),y=({chip:e,hidden:t,onClick:n,refCallback:s,activeChipId:a})=>{let c=!!n,u=()=>{if(c)return null==n?void 0:n(e.url);x(r.D.chip,e.title,`${e.title}_${e.url}`)},d=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:j.label,children:e.title}),e.arrow&&(0,o.jsx)(i.IconFdsArrowUpRightSmallO,{size:24})]}),p=(0,l.Z)(j.chip,{[j.hidden]:t,[k.new]:!!e.new,[k.vip]:!!e.vip,[j.active]:e.url===a});return c?(0,o.jsx)("button",{type:"button",className:p,onClick:u,ref:s,children:d}):(0,o.jsx)("a",{href:e.url,className:p,onClick:u,ref:s,children:d})},N=({items:e=[],maxNumberOfLines:t,variant:n,className:a,activeChipId:c,onClick:u})=>{let d=(0,s.useRef)(null),p=(0,s.useRef)(null),h=(0,s.useRef)({}),[m,v]=(0,s.useState)(!1),[f,g]=(0,s.useState)(e.length),[w,_]=(0,s.useState)(!1);(0,s.useMemo)(()=>{let t=h.current;e.forEach(e=>{e.url in t||(t[e.url]=null)}),Object.keys(t).forEach(n=>{e.find(e=>String(e.url)===String(n))||delete t[n]})},[e]);let b=(0,s.useCallback)(()=>{let n=d.current;if(!n)return;let o=e=>e?e.getBoundingClientRect().width:0,i=o(n),l=Math.max(Number(t)||0,0),s=()=>{g(e.length),_(!1)};if(m||0===l||i<=0){s();return}let r=(()=>{try{let e=getComputedStyle(n),t=parseFloat(e.columnGap||e.gap||"12");return Number.isNaN(t)?12:t}catch{return 12}})(),a=o(p.current),c=e.map(e=>o(h.current[e.url]));if(c.some(e=>0===e)){s();return}let u=1,v=0,f=0;for(let e of c){let t=u===l?a+r:0,n=0===v?e:v+r+e;if(n+t<=i-.5)v=n,f++;else{if(++u>l)break;v=e,f++}}_(f<e.length),g(f)},[m,e,t]);(0,s.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(b)});return t.observe(e),requestAnimationFrame(b),()=>{t.disconnect()}},[b]),(0,s.useEffect)(()=>{requestAnimationFrame(b)},[b]);let C=m||(t??0)<=0||!w;return(0,o.jsx)("div",{className:(0,l.Z)(a,j.wrapper,{[j.gray]:"gray"===n,[j.white]:"white"===n}),children:(0,o.jsxs)("div",{ref:d,className:j.container,children:[e.map((e,t)=>(0,o.jsx)(y,{chip:e,hidden:!C&&t>=f,activeChipId:c,onClick:u,refCallback:t=>{h.current[e.url]=t}},e.url)),!C&&w&&(0,o.jsxs)("button",{type:"button",ref:p,className:(0,l.Z)(j.chip,j.more),onClick:()=>{x(r.D.chip,"Еще"),v(!0)},children:[(0,o.jsx)(i.IconFdsDotsVerticalO,{size:20}),(0,o.jsx)("span",{className:j.label,children:"Еще"})]}),(C||!w)&&(0,o.jsxs)("button",{type:"button",ref:p,className:(0,l.Z)(j.chip,j.more,j.hidden),tabIndex:-1,"aria-hidden":"true",children:[(0,o.jsx)(i.IconFdsDotsVerticalO,{size:20}),(0,o.jsx)("span",{className:j.label,children:"Еще"})]})]})})}},20828:function(e,t,n){n.d(t,{D:function(){return A},P:function(){return B},U:function(){return M},u:function(){return b}});var o=n(57437),i=n(61994),l=n(2265),s=n(80684),r=n(52074),a=n(54887);let c=300,u=({opened:e})=>{let[t,n]=(0,l.useState)(!1),o=(0,l.useRef)(null),i=(0,l.useRef)(!1);return(0,l.useEffect)(()=>(e&&!i.current?(i.current=!0,n(!0)):!e&&i.current&&(o.current=setTimeout(()=>{i.current=!1,n(!1)},c)),()=>{o.current&&clearTimeout(o.current)}),[e]),{mounted:t}},d=(0,r.g)("click-outside","sc"),p=Object.freeze({overlay:`${d}__overlay`,open:`${d}--open`,close:`${d}--close`}),h=({onClose:e,onToucheMove:t,isOpen:n,delay:s=c})=>{let r=(0,l.useRef)(null),a=(0,l.useCallback)(()=>{e&&(r.current=setTimeout(()=>{e()},s))},[s,e]),u=(0,l.useCallback)(e=>{"Escape"===e.key&&a()},[a]);return(0,l.useEffect)(()=>(n&&window.addEventListener("keydown",u),()=>{r.current&&clearTimeout(r.current),window.removeEventListener("keydown",u)}),[n,u]),(0,o.jsx)("div",{className:(0,i.Z)(p.overlay,{[p.open]:n,[p.close]:!n}),onTouchStart:t,onClick:a})},m=(e,t)=>{e&&(t?e.setAttribute("data-portal",""):e.removeAttribute("data-portal"))},v=e=>{e.style.top||(window.prevScrollPosition=window.scrollY)},f=(e,t,n)=>{t.style.setProperty("overflow-y","scroll"),e.classList.toggle("scroll-disable-windows",!0),e.style.setProperty("width",`calc(100vw - ${n}px)`),e.style.setProperty("top",`-${window.prevScrollPosition}px`)},g=e=>{e.style.setProperty("overflow","hidden"),e.style.setProperty("height","100vw")},w=e=>{e.classList.toggle("scroll-disable-windows",!1),e.style.removeProperty("overflow"),e.style.removeProperty("height"),e.style.removeProperty("width"),e.style.removeProperty("top")},_=()=>{void 0!==window.prevScrollPosition&&(window.scrollTo(0,window.prevScrollPosition),window.prevScrollPosition=void 0)},x=()=>document.querySelectorAll("[data-portal]").length>1,b=e=>{let t=(0,l.useRef)(null),n=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(n.current===e)return;n.current=e;let o=t.current,i=document.body,l=document.documentElement,s=window.innerWidth-l.clientWidth,r=s>0;if(e&&r)v(i),f(i,l,s),m(o,!0);else if(e)g(i),m(o,!0);else{let e=!x();e&&w(i),e&&_(),m(o,!1)}return()=>{let e=!x();e&&w(i),e&&_()}},[e]),t},j=(0,r.g)("drawer-footer","sc"),C=Object.freeze({footer:`${j}__footer`,hasScroll:`${j}__footer--has-scroll`}),k=({footer:e,hasScroll:t,className:n})=>(0,o.jsx)("div",{className:(0,i.Z)(C.footer,{[C.hasScroll]:t},n),children:"function"==typeof e?e():e}),y=(0,r.g)("drawer-content","sc"),N=Object.freeze({container:`${y}__container`,open:`${y}--open`,close:`${y}--close`,header:`${y}__header`,rowHeader:`${y}__header--row`,title:`${y}__title`,center:`${y}__title--center`,left:`${y}__title--left`,right:`${y}__title--right`,controlContainer:`${y}__control-container`,content:`${y}__content`,footer:`${y}__footer`}),O=({onClose:e,onContentClick:t,children:n,title:r,rowTitle:a,titleAlign:c,isCloseable:u,footer:d,closeButton:p,isOpen:h,contentClassName:m,footerClassName:v,contentStyle:f,width:g})=>{let w=(0,l.useRef)(null),_=(0,l.useRef)(null),[x,b]=(0,l.useState)(!1);(0,l.useEffect)(()=>{var e;if(!_.current||!w.current)return;let t=(null==(e=null==_?void 0:_.current)?void 0:e.getBoundingClientRect().top)||0,n=null==w?void 0:w.current,o=()=>{let e=null==_?void 0:_.current;e&&b(()=>e.getBoundingClientRect().top!==t)};return n&&n.addEventListener("scroll",o,!1),()=>{null==n||n.removeEventListener("scroll",o,!1)}},[]);let j=f||g?{width:g,...f||{}}:void 0;return(0,o.jsxs)("div",{ref:w,style:j,className:(0,i.Z)(N.container,{[N.open]:h,[N.close]:!h},m),children:[r||u?(0,o.jsxs)("div",{className:(0,i.Z)(N.header,{[N.rowHeader]:a}),children:[u?p?"function"==typeof p?p():p:(0,o.jsx)("button",{type:"button",className:N.controlContainer,onClick:e,children:(0,o.jsx)(s.IconFdsCloseO,{size:24})}):null,r?(0,o.jsx)("h3",{className:(0,i.Z)(N.title,{[N[c]]:!0}),children:r}):null]}):null,(0,o.jsx)("div",{ref:_,className:N.content,onClick:t,children:n}),d&&(0,o.jsx)(k,{className:(0,i.Z)(N.footer,v),footer:d,hasScroll:x})]})},S=(0,r.g)("drawer-layout","sc"),T=Object.freeze({window:`${S}__window`}),I=({onClose:e,isOpen:t,children:n,withDisabledScroll:s,className:r,...a})=>{let c=(0,l.useCallback)(e=>e.stopPropagation(),[]);return b(t&&s),(0,o.jsxs)("div",{"data-portal":!0,className:(0,i.Z)(T.window,r),children:[(0,o.jsx)(h,{onClose:e,isOpen:t,delay:0}),(0,o.jsx)(O,{onContentClick:c,onClose:e,isOpen:t,...a,children:n})]})},A=({isOpen:e=!1,children:t,titleAlign:n="center",isCloseable:i=!0,withDisabledScroll:l=!0,...s})=>{let{mounted:r}=u({opened:e});return r?(0,o.jsx)(I,{titleAlign:n,isCloseable:i,isOpen:e,withDisabledScroll:l,...s,children:t}):null};A.displayName="Drawer";let $=(0,r.g)("mobile-modal-footer","sc"),L=Object.freeze({footer:`${$}__footer`,footerWithoutShadow:`${$}__footer--without-shadow`}),R=({footer:e,isSmallPopup:t=!1,footerClassName:n})=>(0,o.jsx)("div",{className:(0,i.Z)(L.footer,t&&L.footerWithoutShadow,n),children:"function"==typeof e?e():e}),P=(0,r.g)("mobile-popup","sc"),z=Object.freeze({mobilePopup:`${P}`,mobilePopupOpen:`${P}--open`,content:`${P}__content`,contentFull:`${P}__content--full`,contentTransition:`${P}__content--transition`,contentTransitionOpen:`${P}__content--transition-open`,contentLine:`${P}__content-line`,contentContainer:`${P}__content-container`,smallContentContainer:`${P}__content-container--small`,min:`${P}__content-container--min`,title:`${P}__title`,closeContainer:`${P}__close-container`,closeButton:`${P}__close-button`}),E=({children:e,footer:t,isOpen:n,isSmallPopup:r,onClose:a,hasCloseButton:c=!0,full:u,touchDistance:d=100,withDisabledScroll:p=!0,contentClassName:m,className:v,title:f,closeButton:g,footerClassName:w})=>{let[_,x]=(0,l.useState)(!1),[j,C]=(0,l.useState)(!1),[k,y]=(0,l.useState)(!0),[N,O]=(0,l.useState)("120%"),S=(0,l.useRef)(null),T=(0,l.useRef)(0),I=(0,l.useRef)(!1),A=e=>{var t,n,o;let i=null==(t=S.current)?void 0:t.offsetTop,l=null==(n=S.current)?void 0:n.offsetHeight;if(I.current=!0,y(!1),i&&l){let t=(null==(o=null==e?void 0:e.touches[0])?void 0:o.clientY)-i,n=0;t>=0&&t<=l+30&&(n=t),t>l+30&&(n=l+30),O(`${n}px`),T.current=n}},$=()=>{I.current&&(T.current>d&&a?null==a||a():O("0"),y(!0),I.current=!1),window.removeEventListener("touchmove",A),window.removeEventListener("touchend",$)};return(0,l.useEffect)(()=>{n&&setTimeout(()=>{x(!0),C(!0),O("0")},100),!n&&j&&(O("120%"),x(!1),C(!1))},[j,n]),b(n&&p),(0,o.jsxs)("div",{"data-portal":!0,className:(0,i.Z)(z.mobilePopup,j&&z.mobilePopupOpen,v),children:[(0,o.jsx)(h,{onClose:()=>{n&&(null==a||a())},onToucheMove:()=>{n&&(x(!1),window.addEventListener("touchmove",A),window.addEventListener("touchend",$))},isOpen:n,delay:0}),(0,o.jsxs)("div",{className:(0,i.Z)(z.content,u&&z.contentFull,k&&z.contentTransition,k&&_&&z.contentTransitionOpen),ref:S,style:{transform:`translateY(${N})`},children:[(0,o.jsx)("div",{className:z.contentLine}),(0,o.jsxs)("div",{className:(0,i.Z)(z.contentContainer,r&&z.smallContentContainer,{[z.min]:!f&&!c},m),children:[!!f&&(0,o.jsx)("div",{className:z.title,children:f}),c?(0,o.jsx)("div",{className:z.closeContainer,children:c?g?"function"==typeof g?g():g:(0,o.jsx)("button",{onClick:a,className:z.closeButton,children:(0,o.jsx)(s.IconFdsCloseO,{size:24})}):null}):null,e]}),t&&(0,o.jsx)(R,{footerClassName:w,isSmallPopup:r,footer:t})]})]})},M=({children:e,isSmallPopup:t=!1,isOpen:n=!1,...i})=>{let{mounted:l}=u({opened:n});return l?(0,o.jsx)(E,{isSmallPopup:t,isOpen:n,...i,children:e}):null};M.displayName="UiMobilePopup";let B=({children:e,id:t="portal-root"})=>{let[n,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=document.getElementById(t);if(e){o(e);return}let n=document.createElement("div");return n.id=t,document.body.appendChild(n),o(n),()=>{document.body.removeChild(n)}},[t]),n?(0,a.createPortal)(e,n):null}},52074:function(e,t,n){n.d(t,{g:function(){return o}});function o(e,t){return`finkit-widgets-${t}-${e}`}},10992:function(e,t,n){let o;n.d(t,{D:function(){return r},h:function(){return c}});var i=n(31620),l=n(30631);let s=(e,t)=>{if(typeof window>"u")return;let n=sessionStorage.getItem("pushedEvents"),o=n?JSON.parse(n):[];e.event||(e.event="data-event"),"string"==typeof e.eventAction&&(e.eventAction=e.eventAction.toLowerCase().replaceAll(" ","_")),"string"==typeof e.eventLabel&&(e.eventLabel=e.eventLabel.toLowerCase().replaceAll(" ","_")),e.eventLabel||(e.eventLabel="undefined");let i=o.find(n=>n.eventCategory===e.eventCategory&&n.eventAction===e.eventAction&&n.eventLabel===e.eventLabel&&("all"===t||"url"===t&&window.location.pathname===n.url));if(!t||!i){if(t){let t={...e};t.url=window.location.pathname,o.push(t),sessionStorage.setItem("pushedEvents",JSON.stringify(o))}(0,l.AB)(e)}};var r=((o=r||{}).icon="icon",o.chip="chip",o.accordion="accordion",o.button="button",o.checkbox="checkbox",o.radio="radio",o.select="select",o.toggle="toggle",o.tooltip="tooltip",o.link="link",o.banner="banner",o.tag="tag",o.date="date",o.field="field",o.offer="offer",o.tab="tab",o.submitButton="submitButton",o.popup="popup",o.block="block",o);let a={icon:"click_icon_",chip:"click_chip_",accordion:"show_acc_",button:"click_button_",checkbox:"click_check_",radio:"click_radio_",select:"click_sel_",toggle:"click_togg_",tooltip:"click_tip_",link:"click_link_",banner:"click_bnr_",tag:"click_tag_",date:"input_date_",field:"input_field_",offer:"click_offer_",tab:"click_tab_",submitButton:"form_button_",popup:"show_pop_up_",block:"click_block_"},c=({eventCategory:e,eventActionType:t,eventActionText:n="",eventLabel:o})=>{let l={event:"data-event",eventCategory:e,eventAction:a[t]+(0,i.t)(n)};void 0!==o&&(l.eventLabel=(0,i.t)("string"==typeof o?o:o.toString())),s(l)}},31620:function(e,t,n){n.d(t,{t:function(){return i}});let o={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"yo",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sch",ъ:"",ы:"y",ь:"",э:"e",ю:"yu",я:"ya"},i=e=>e.replace(/[а-яё]/gi,e=>{let t=e.toLowerCase();return t in o?o[t]:e}).replaceAll(/[ \u00A0]/g,"_")},44789:function(e,t,n){n.d(t,{CitySelectProvider:function(){return N},Header:function(){return eh},a:function(){return y}});var o=n(57437),i=n(2265),l=n(10992),s=n(80684),r=n(35563),a=n(75461),c=n(61994),u=n(77337),d=n(20828),p=n(52074),h=n(72007);let m=function(e){if(typeof window>"u"||!window.localStorage)return null;let t=window.localStorage.getItem(e);if(!t||"undefined"===t)return null;try{return JSON.parse(t)}catch(t){console.warn('Invalid object in localStorage for key "'.concat(e,'": ').concat(t))}return null},v=()=>{if(typeof window>"u")return[];if(Array.isArray(window.allRegions)&&window.allRegions.length>0)return window.allRegions;let e=m("all_regions")||[];return window.allRegions=e,e},f=e=>{let t={};return e.map(e=>{let{id:n,name:o,towns:i}=e;return i.forEach(e=>{e.parentId=n,t[e.name]=t[e.name]||{},t[e.name][e.id]=o}),i}).reduce((e,n)=>(n.forEach(e=>{Object.keys(t[e.name]).length>1&&(e.parentName=t[e.name][e.id])}),[...e,...n]),[])},g=async()=>{let e={regions:[]};try{e=await (await fetch("https://finuslugi.ru/money_data/Root.json?short=1")).json()}catch(e){console.warn(e)}let t=null!=e&&e.regions?e.regions:[];return t.length<1?[]:(window.allRegions=t,window.localStorage.setItem("all_regions",JSON.stringify(t)),window.localStorage.setItem("lastRegionsUpdateUnixTimestamp",JSON.stringify(Date.now())),t)},w=async e=>{let t=null;try{t=await (await fetch("".concat(e),{method:"GET"})).json()}catch(e){console.warn(e)}return t||null},_=(e,t,n)=>{(0,l.h)({eventCategory:C,eventActionType:e,eventActionText:t,eventLabel:n})},x=v(),b=f(x),j={regions:x,towns:b,region:null,town:null,startPopupVisible:!1,setStartPopupVisible:()=>null,popupVisible:!1,handleToggleModal:()=>null,selectCity:()=>null,handleButtonClick:()=>null,startRegion:null,startTown:null},C="finkit-widgets-sc-city-select",k=(0,i.createContext)(j);function y(){return(0,i.useContext)(k)}let N=e=>{let{children:t,showStartGeoPopup:n=!0,lastRegionsUpdateUnixTimestamp:s,dadataUrl:r="https://finuslugi.ru/backend/money/dadata"}=e,a=Number(m("lastRegionsUpdateUnixTimestamp")||0),c=Number(s||0)>a,[u,d]=(0,i.useState)(v()),[{startRegion:p,startTown:h},x]=(0,i.useState)({startRegion:j.startRegion,startTown:j.startTown}),[{region:b,town:C},y]=(0,i.useState)({region:j.region,town:j.town}),[N,O]=(0,i.useState)(j.startPopupVisible),[S,T]=(0,i.useState)(j.popupVisible),I=(0,i.useRef)(""),A=(0,i.useMemo)(()=>f(u),[u.length]),$=(0,i.useCallback)((e,t)=>{window.sessionStorage.setItem("start_popup_opened","1"),window.localStorage.setItem("auto_town",JSON.stringify(t)||""),window.localStorage.setItem("auto_region",JSON.stringify(e)||""),O(!0),x({startRegion:e,startTown:t})},[O,x]),L=(0,i.useCallback)((e,t)=>{window.sessionStorage.getItem("start_popup_opened")||$(e,t)},[$]),R=(0,i.useCallback)(()=>{if(I.current&&!b&&!C){var e,t;let n=null!==(e=A.find(e=>e.name===I.current))&&void 0!==e?e:null;return L(null!==(t=u.find(e=>e.id===(null==n?void 0:n.parentId)))&&void 0!==t?t:null,n)}L(b,C)},[b,C,A,u,L]),P=(0,i.useCallback)(e=>{T(e)},[T]),z=(0,i.useCallback)(e=>{e?_(l.D.icon,"location"):_(l.D.button,(null==C?void 0:C.name)||"Вся Россия"),!n||window.sessionStorage.getItem("start_popup_opened")?P(!0):R()},[n,C,P,R]),E=(0,i.useCallback)((e,t)=>{e||t?(window.localStorage.setItem("all_russia_selected","0"),window.localStorage.setItem("user_region",JSON.stringify(e)||""),window.localStorage.setItem("user_town",JSON.stringify(t)||"")):(window.localStorage.setItem("all_russia_selected","1"),window.localStorage.setItem("user_region",""),window.localStorage.setItem("user_town","")),y({region:e||null,town:t||null}),O(!1),P(!1);let n=new CustomEvent("onRegionChange",{detail:{region:e,town:t}});document.dispatchEvent(n)},[P]),M=()=>{y({region:m("user_region"),town:m("user_town")});let e=async e=>{let{coords:{latitude:t,longitude:n}}=e,o="".concat(r,"?lat=").concat(t,"&lon=").concat(n),i=await w(o);null!=i&&i.location&&(I.current=i.location.data.city)};if(!window.localStorage.getItem("dadata")&&navigator.geolocation&&n)try{navigator.geolocation.getCurrentPosition(e,()=>null)}catch(e){}};return(0,i.useEffect)(()=>{if((u.length<1||c)&&g().then(e=>d(e)),window.innerWidth<1024){let e=()=>{M(),window.removeEventListener("scroll",e)};window.addEventListener("scroll",e)}else setTimeout(()=>{M()},0)},[]),(0,o.jsx)(k.Provider,{value:{regions:u,towns:A,region:b,town:C,startPopupVisible:N,setStartPopupVisible:O,popupVisible:S,handleToggleModal:P,selectCity:E,handleButtonClick:z,startRegion:p,startTown:h},children:t})},O=()=>{let e=(0,i.useRef)(null),t=(0,i.useCallback)(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),n=(0,i.useCallback)((t,n)=>{e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{e.current=null,t()},n)},[]);return(0,i.useEffect)(()=>t,[t]),{start:n,clear:t,pending:!!e.current}},S=(0,p.g)("city-select-modal-body","sc"),T=Object.freeze({wrapper:"".concat(S,"__wrapper"),subtitle:"".concat(S,"__subtitle"),hintWrapper:"".concat(S,"__hint-wrapper"),hintText:"".concat(S,"__hint-text"),input:"".concat(S,"__input"),chips:"".concat(S,"__chips"),townsListWrapper:"".concat(S,"__towns-list-wrapper"),townsList:"".concat(S,"__towns-list"),townsGroup:"".concat(S,"__towns-group"),townsGroupLabel:"".concat(S,"__towns-group-label"),townsGroupList:"".concat(S,"__towns-group-list"),townsName:"".concat(S,"__towns-name"),regionName:"".concat(S,"__region-name")}),I=e=>{var t;let{groupedTowns:n,chips:r,query:c,setQuery:u,isDrawer:d}=e,p=y(),h=(0,i.useRef)(null),[m,v]=(0,i.useState)("10000px");(0,i.useEffect)(()=>{if(!d||!h.current)return;let e=e=>e.reduce((e,t)=>e+t,0),t=(n,o)=>{let i=n.map(e=>[...e]),l=i.map(e),s=l.reduce((e,t,n)=>t<l[e]?n:e,0);0===s&&i[0].push(i[1].shift()),2===s&&i[2].unshift(i[1].pop()),1===s&&l[0]>l[2]&&i[1].unshift(i[0].pop()),1===s&&l[0]<l[2]&&i[1].push(i[2].shift());let r=Math.max(...i.map(e));return r>=o?o:t(i,r)};new ResizeObserver(()=>{var e;if(!(null!=(e=h.current)&&e.children))return;let n=Array.from(h.current.children,e=>e.offsetHeight+32);if(0===n.length)return;let o=0;try{o=t([[],n,[]],1/0)}catch(e){o=0}o>0&&v("".concat(o,"px"))}).observe(h.current)},[]);let f=e=>{if(_(l.D.button,(null==e?void 0:e.name)||"Вся Россия"),!(null!=e&&e.id))return p.selectCity();let t=p.regions.find(t=>t.id===Number(e.parentId))||null;p.selectCity(t,e)};return(0,o.jsxs)("div",{className:T.wrapper,children:[(0,o.jsxs)("div",{className:T.subtitle,children:["Покажем предложения рядом с вами",(0,o.jsxs)("div",{className:T.hintWrapper,children:[(0,o.jsx)(s.IconFdsQuestionCircleO,{size:24}),(0,o.jsx)("div",{className:T.hintText,children:"Укажите свой город, чтобы увидеть предложения, доступные в вашем регионе"})]})]}),(0,o.jsx)(a.MA,{className:T.input,value:c,onChange:u,size:"s",placeholder:"Введите название города",icon:c?(0,o.jsx)(s.IconFdsCloseCircleO,{size:24,onClick:()=>u("")}):(0,o.jsx)(s.IconFdsSearchO,{size:24})}),(0,o.jsx)(a.cL,{className:T.chips,chips:r,value:(null==(t=p.town)?void 0:t.id)||0,onChipClick:e=>{f(p.towns.find(t=>t.id===e))}}),(0,o.jsx)("div",{className:T.townsListWrapper,children:(0,o.jsx)("div",{ref:h,className:T.townsList,style:{maxHeight:m},children:n.map(e=>(0,o.jsxs)("div",{className:T.townsGroup,children:[(0,o.jsx)("div",{className:T.townsGroupLabel,children:e.letter}),(0,o.jsx)("div",{className:T.townsGroupList,children:e.towns.map(e=>(0,o.jsxs)("button",{type:"button",onClick:()=>f(e),children:[(0,o.jsx)("div",{className:T.townsName,children:e.name}),(0,o.jsx)("div",{className:T.regionName,children:e.parentName})]},e.id))})]},e.letter))})})]})},A=[1095,1096,134,720,189,180],$=()=>{var e;let t=y(),n=(0,a._m)("l"),[s,r]=(0,i.useState)(""),c="Ваш выбор: ".concat((null==(e=t.town)?void 0:e.name)||"Вся Россия"),u=(0,i.useMemo)(()=>t.towns.filter(e=>-1!==String(e.name).toLocaleLowerCase().indexOf(s.toLocaleLowerCase())).sort((e,t)=>e.name.localeCompare(t.name)).reduce((e,t)=>{let n=e.pop();return n||(n={letter:t.name[0],towns:[]}),n.letter!==t.name[0]&&(e.push(n),n={letter:t.name[0],towns:[]}),n.towns.push(t),e.push(n),e},[]),[s,t.towns.length]),p=(0,i.useMemo)(()=>[{id:0,label:"Вся Россия"},...A.map(e=>{let n=t.towns.find(t=>t.id===e);return{id:null==n?void 0:n.id,label:null==n?void 0:n.name}}).filter(e=>(null==e?void 0:e.id)!==void 0)],[t.towns.length]),h=()=>{_(l.D.button,"close"),t.handleToggleModal(!1)};return(0,o.jsxs)(d.P,{children:[!n&&(0,o.jsx)(d.U,{title:c,isOpen:t.popupVisible,onClose:h,full:!0,children:(0,o.jsx)(I,{groupedTowns:u,chips:p,query:s,setQuery:r})}),n&&(0,o.jsx)(d.D,{title:c,isOpen:t.popupVisible,onClose:h,width:"856px",rowTitle:!0,titleAlign:"left",children:(0,o.jsx)(I,{groupedTowns:u,chips:p,query:s,setQuery:r,isDrawer:!0})})]})},L=e=>{let{label:t,onClick:n,eventActionText:i,eventLabel:s,...r}=e;return(0,o.jsx)(a.zx,{label:t,onClick:e=>{null==n||n(e),(0,l.h)({eventCategory:h.H,eventActionType:l.D.button,eventActionText:i||"",eventLabel:s||""})},...r})},R=(0,p.g)("header-popup","sc"),P=Object.freeze({popup:"".concat(R,"__popup"),popupHeader:"".concat(R,"__popup-header"),popupClose:"".concat(R,"__popup-close"),body:"".concat(R,"__body")}),z=e=>{let{isOpen:t,onClose:n,children:i,title:l}=e,r=(0,a._m)("l");return(0,o.jsxs)(d.P,{children:[!r&&(0,o.jsx)(d.U,{title:l,isOpen:t,onClose:n,children:i}),r&&t&&(0,o.jsxs)("div",{className:P.popup,children:[(0,o.jsxs)("div",{className:P.popupHeader,children:[l,(0,o.jsx)(L,{className:P.popupClose,iconLeft:(0,o.jsx)(s.IconFdsCloseO,{}),shape:"icon",appearance:"ghost",size:"xs",onClick:n,eventActionText:"IconFdsCloseO"})]}),(0,o.jsx)("div",{className:P.body,children:i})]})]})},E=(0,p.g)("start-choice-popup","sc"),M=Object.freeze({top:"".concat(E,"__top"),progress:"".concat(E,"__progress"),innerCircle:"".concat(E,"__inner-circle"),title:"".concat(E,"__title"),subtitle:"".concat(E,"__subtitle"),actions:"".concat(E,"__actions")}),B=()=>{var e,t;let n=y(),[s,r]=(0,i.useState)(10),[a,c]=(0,i.useState)(0),u=(0,i.useRef)(void 0),d=()=>{_(l.D.button,"close_choose_popup"),window.localStorage.setItem("auto_town",JSON.stringify(n.startTown)||""),window.localStorage.setItem("auto_region",JSON.stringify(n.startRegion)||""),n.setStartPopupVisible(!1)};return(0,i.useEffect)(()=>{n.startPopupVisible?(()=>{let e=Number((" "+s).slice(1)),t=1e3*e/100,n=0,o=0;u.current=setInterval(()=>{n++,o+=t,c(3.6*n);let i=e-Math.floor(o/1e3);i<s&&r(i),100===n&&(clearInterval(u.current),d())},t)})():(clearInterval(u.current),r(10),c(0))},[n.startPopupVisible]),(0,o.jsxs)(z,{isOpen:n.startPopupVisible,onClose:d,title:(0,o.jsx)("button",{type:"button",className:M.progress,style:{background:"conic-gradient(#ff0508 ".concat(a,"deg, #e3e7ec 0deg)")},onClick:d,children:(0,o.jsx)("div",{className:M.innerCircle,children:s})}),children:[(0,o.jsxs)("div",{className:M.top,children:[(0,o.jsxs)("div",{className:M.title,children:["Ваш город ",(null==(e=n.startTown)?void 0:e.name)||(null==(t=n.startRegion)?void 0:t.name)||"Вся Россия","?"]}),(0,o.jsx)("div",{className:M.subtitle,children:"Это поможет вам увидеть выгодные предложения в вашем городе"})]}),(0,o.jsxs)("div",{className:M.actions,children:[(0,o.jsx)(L,{size:"s",stretch:!0,eventActionText:"Да, все верно",onClick:()=>{_(l.D.button,"Да, все верно"),n.selectCity(n.startRegion,n.startTown)},children:"Да, все верно"}),(0,o.jsx)(L,{variant:"secondary",size:"s",stretch:!0,eventActionText:"Нет, изменить",onClick:()=>{_(l.D.button,"Нет, изменить"),n.setStartPopupVisible(!1),n.handleToggleModal(!0)},children:"Нет, изменить"})]})]})},F=(0,p.g)("city-select","sc"),D=Object.freeze({button:"".concat(F,"__button")}),W=e=>{var t;let{initialTown:n}=e,i=y(),l=(null==(t=i.town)?void 0:t.name)||n||"Вся Россия";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.zx,{className:D.button,variant:"purple",appearance:"ghost",size:"xs",onClick:()=>i.handleButtonClick(!1),iconLeft:(0,o.jsx)(s.IconFdsLocationO,{size:16}),label:l}),(0,o.jsx)($,{}),(0,o.jsx)(B,{})]})},U={"uat-mp.beta.moex.com":"//chat-marketplace.beta.moex.com","finuslugi.ru":"//chat.finuslugi.ru","dev-rc.beta.moex.com":"//dev-opbot.tech.finuslugi.ru"},Z=()=>{let{hostname:e}=window.location;return Object.prototype.hasOwnProperty.call(U,e)?U[e]:U["finuslugi.ru"]},H=(e,t)=>{let n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href="".concat(e,"/assets/css/").concat(t),document.head.appendChild(n);let o=document.createElement("script");o.src="".concat(e,"/get-bootstrap/").concat(t),o.defer=!0,document.body.appendChild(o)},V=()=>new MutationObserver(e=>{e.forEach(e=>{if("style"===e.attributeName){let e=document.querySelector(".webchat"),t=!!e&&"none"!==e.style.display;window.supportWidget&&window.supportWidget.craftTalk&&(window.supportWidget.craftTalk.isOpened=t)}})}),G=()=>{let[e,t]=(0,i.useState)(!1),[n,o]=(0,i.useState)(!1),l=(0,i.useRef)(!1),s=e=>{l.current=e,o(e)};return(0,i.useEffect)(()=>{if(typeof window>"u")return;let e=Z(),n="webchat_main";window.supportWidget={craftTalk:{isOpened:!1,setConfig:t=>{if(t.host&&(e=t.host),t.channel&&(n=t.channel),t.user){let e="function"==typeof t.user?t.user:()=>({...t.user});window.__WebchatUserCallback=e}},open:()=>new Promise(e=>{e()}),close:()=>null,toggle:()=>null}};let o=null;window.supportWidget&&window.supportWidget.craftTalk&&(window.supportWidget.craftTalk.open=()=>new Promise((i,r)=>{if(l.current){r(Error("chat is already opened"));return}o?(o.openWidget(),t(!1),i()):(s(!0),window.getWebChatCraftTalkExternalControl=e=>{var n;o=e;let l=document.querySelector(".webchat");l&&V().observe(l,{attributes:!0,attributeFilter:["style"]}),null!=(n=window.supportWidget)&&n.craftTalk&&(window.supportWidget.craftTalk.close=o.closeWidget),null==o||o.openWidget(),s(!1),t(!1),i()},H(e,n))}),window.supportWidget.craftTalk.toggle=()=>{var e,t,n,o;null!=(t=null==(e=window.supportWidget)?void 0:e.craftTalk)&&t.isOpened?window.supportWidget.craftTalk.close():null==(o=null==(n=window.supportWidget)?void 0:n.craftTalk)||o.open()})},[]),{isChatModalOpen:e,setIsChatModalOpen:t,isChatLoading:n}},J=(0,i.createContext)({isAuth:!1,isHeaderHidden:!1,isHeaderTransparent:!1,openedBlock:null,setOpenedBlock:()=>null,openedSection:null,setOpenedSection:()=>null,isNavigationOpen:!1,isNavigationMounted:!1,navMenuItemsRef:{current:null},navigationRef:{current:null},ignoreClicks:!1,setIgnoreClicks:()=>null,isChatModalOpen:!1,setIsChatModalOpen:()=>null,isChatLoading:!1});function q(){return(0,i.useContext)(J)}let Q=e=>{let[t,n]=(0,i.useState)(!1),[l,s]=(0,i.useState)(!1),[r,a]=(0,i.useState)(!!e.isMainBannerPage),{isChatModalOpen:c,setIsChatModalOpen:u,isChatLoading:p}=G(),[m,v]=(0,i.useState)(null),[f,g]=(0,i.useState)(null),[w,_]=(0,i.useState)(!1),[x,b]=(0,i.useState)(!1),[j,C]=(0,i.useState)(!1),k=(0,i.useRef)(null),y=(0,d.u)(w),N=(0,i.useRef)(null),O=(0,i.useRef)(null),S=(0,i.useCallback)(()=>{y.current&&y.current.scrollTo({top:0})},[y]),T=(0,i.useCallback)(e=>{g(e),S()},[S]),I=(0,i.useCallback)(e=>{N.current&&clearTimeout(N.current),e&&b(!0),e||(N.current=setTimeout(()=>{b(!1),T(null)},300))},[T]),A=(0,i.useCallback)((e,t,n)=>{if(t&&T(t),!n&&e===m||!e){I(!w),_(!w);return}v(e),I(!0),_(!0)},[m,T,w,I]),$=(0,i.useCallback)(()=>{O.current&&clearTimeout(O.current),C(!0),O.current=setTimeout(()=>{C(!1)},650)},[]);return(0,i.useEffect)(()=>{n(!!document.cookie.includes("auth.gtm_customer_id")),(0,h.s)(s,a,e.isMainBannerPage),(0,h.i)()},[]),(0,o.jsx)("div",{children:(0,o.jsx)(J.Provider,{value:{isAuth:t,isHeaderHidden:l,isHeaderTransparent:r,openedBlock:m,setOpenedBlock:A,openedSection:f,setOpenedSection:T,isNavigationOpen:w,isNavigationMounted:x,navMenuItemsRef:k,navigationRef:y,ignoreClicks:j,setIgnoreClicks:$,isChatModalOpen:c,setIsChatModalOpen:u,isChatLoading:p},children:e.children})})},Y=(0,p.g)("header-chat-modal-body","sc"),K=Object.freeze({wrapper:"".concat(Y,"__wrapper"),cardButton:"".concat(Y,"__card-button"),card:"".concat(Y,"__card"),cardTitle:"".concat(Y,"__card-title"),cardSubtitle:"".concat(Y,"__card-subtitle"),button:"".concat(Y,"__button")}),X=()=>{let e=q();return(0,o.jsxs)("div",{className:K.wrapper,children:[(0,o.jsx)(L,{className:K.cardButton,variant:"secondary",pending:e.isChatLoading,onClick:()=>{var e,t,n;return null==(n=null==(t=null==(e=null==window?void 0:window.supportWidget)?void 0:e.craftTalk)?void 0:t.open)?void 0:n.call(t)},eventActionText:"Напишите в чат",children:(0,o.jsxs)(r.Zb,{className:K.card,variant:"secondary",children:[(0,o.jsxs)("div",{className:K.cardTitle,children:[(0,o.jsx)("img",{src:"https://finuslugi.ru/icons/chaticons/new/chat_icon_hover.svg",alt:"chat"}),"Напишите в чат"]}),(0,o.jsxs)("p",{className:K.cardSubtitle,children:["Виртуальный ассистент доступен\xa024/7, ",(0,o.jsx)("br",{}),"операторы\xa0—\xa0с\xa06:00 до\xa023:59\xa0мск"]})]})}),(0,o.jsx)(L,{className:K.cardButton,variant:"secondary",as:"a",href:"https://finuslugi.ru/landing/fingpt",target:"_blank",eventActionText:"Спросите у FinGPT",children:(0,o.jsxs)(r.Zb,{className:K.card,variant:"secondary",children:[(0,o.jsxs)("div",{className:K.cardTitle,children:[(0,o.jsx)("img",{src:"https://finuslugi.ru/icons/chaticons/new/robot_icon_hover.svg",alt:"chat"}),"Спросите у FinGPT"]}),(0,o.jsx)("p",{className:K.cardSubtitle,children:"Ваш личный финансовый AI-ассистент"})]})})]})},ee=(0,p.g)("header-chat-modal","sc"),et=Object.freeze({wrapper:"".concat(ee,"__wrapper")}),en=()=>{let e=q();return(0,o.jsx)(d.P,{children:(0,o.jsx)(z,{isOpen:e.isChatModalOpen,onClose:()=>e.setIsChatModalOpen(!1),title:"Нужна помощь?",children:(0,o.jsx)("div",{className:et.wrapper,children:(0,o.jsx)(X,{})})})})},eo=e=>{let{onClick:t,eventActionType:n,eventActionText:i,eventLabel:s,...r}=e;return(0,o.jsx)(a.rU,{onClick:e=>{null==t||t(e),(0,l.h)({eventCategory:h.H,eventActionType:n||l.D.link,eventActionText:i||"",eventLabel:s||""})},...r})},ei=e=>{let{data:t,isMobile:n}=e,r=q();return(0,o.jsx)("div",{className:h.a.contentWrapper,children:t.map(e=>(0,o.jsx)(i.Fragment,{children:e.sections.map(e=>(0,o.jsxs)("div",{className:(0,c.Z)(h.a.content,{[h.a.hidden]:r.openedSection!==e.id,[h.a.contentOpen]:!!r.openedSection}),children:[(0,o.jsx)("div",{className:h.a.contentHeader,children:(0,o.jsx)("label",{children:e.title})}),e.content.map((t,i)=>{var r,a;return(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{children:(0,o.jsx)("a",{className:(0,c.Z)(h.a.contentTitle,{[h.a.removed]:!t.title,[h.a.contentTitleUrl]:!!t.url,[h.a.contentTitleLink]:!!e.isSeeAllLinkAvailable,[h.a.contentTitleNew]:!!t.new}),href:e.isSeeAllLinkAvailable?t.url:void 0,children:(0,o.jsxs)("span",{children:[e.isSeeAllLinkAvailable&&(0,o.jsx)("div",{className:h.a.arrowIcon,children:(0,o.jsx)(s.IconFdsArrowUpRightSmallO,{})}),t.title]})})}),!(null!=(r=t.links)&&r.length)&&(0,o.jsx)(h.N,{items:t.chips||[],maxNumberOfLines:e.content.length<=1?99:n?3:2}),!!(null!=(a=t.links)&&a.length)&&(0,o.jsx)("div",{className:(0,c.Z)(h.a.links,{[h.a.linksColumns]:!!t.columns,[h.a.linksTitleless]:!t.title}),children:t.links.map(e=>(0,o.jsxs)("a",{href:e.url,className:(0,c.Z)({[h.a.new]:!!e.new}),onClick:()=>(0,h.h)(l.D.link,e.title,"".concat(e.title,"_").concat(e.url)),children:[(0,o.jsx)("div",{className:h.a.arrowIcon,children:(0,o.jsx)(s.IconFdsArrowUpRightSmallO,{})}),(0,o.jsx)("span",{children:e.title})]},e.url))})]},"".concat(t.url,"_").concat(i))})]},e.id))},e.id))})},el=(0,p.g)("navigation-section-icon","sc"),es=Object.freeze({icon:"".concat(el)}),er=e=>{let{name:t,background:n}=e,l=(0,i.useMemo)(()=>t&&s[t]||null,[t]);return t&&l?(0,o.jsx)("div",{className:es.icon,style:{background:n},children:(0,o.jsx)(l,{})}):null},ea=(0,p.g)("navigation","sc"),ec=Object.freeze({navigation:"".concat(ea),navigationOpening:"".concat(ea,"--opening"),navigationClosing:"".concat(ea,"--closing"),wrapper:"".concat(ea,"__wrapper"),container:"".concat(ea,"__container"),containerOpen:"".concat(ea,"__container--open"),sections:"".concat(ea,"__sections"),sectionsOpen:"".concat(ea,"__sections--open"),citySelectButton:"".concat(ea,"__city-select-button"),sectionsTitle:"".concat(ea,"__sections-title"),sectionsWrapper:"".concat(ea,"__sections-wrapper"),section:"".concat(ea,"__section"),sectionArrow:"".concat(ea,"__section-arrow"),sectionExtra:"".concat(ea,"__section--extra"),sectionActive:"".concat(ea,"__section--active"),sectionTitle:"".concat(ea,"__section-title"),chatWrapper:"".concat(ea,"__chat-wrapper"),chatHeader:"".concat(ea,"__chat-header"),backButton:"".concat(ea,"__back-button"),useful:"".concat(ea,"__useful"),usefulOpen:"".concat(ea,"__useful--open"),usefulTitle:"".concat(ea,"__useful-title"),usefulGrid:"".concat(ea,"__useful-grid"),removed:"".concat(ea,"__removed")}),eu=e=>{var t;let{data:n}=e,u=q(),d=y(),p=(0,a.aF)("m"),[m,v]=(0,i.useState)(!0);(0,i.useEffect)(()=>{v(p)},[p]);let f=(0,i.useRef)(null),g=(0,i.useCallback)(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u.openedSection?u.setOpenedSection(null):u.isNavigationOpen?u.setOpenedBlock(null):void 0,50)},[u]),w=(0,i.useRef)(!1),_=(0,i.useRef)(null),x=(0,i.useCallback)(()=>{m&&(w.current=!0,_.current=window.onpopstate||null,window.onpopstate=function(){window.history.forward(),g()},window.history.pushState(null,"",window.location.href))},[g,m]),b=(0,i.useCallback)(()=>{w.current=!1,window.onpopstate=_.current,window.history.go(-1)},[]),j=(0,i.useRef)(null),C=(0,i.useCallback)(e=>{if(m||!u.navMenuItemsRef.current||!u.navigationRef.current)return;let t=e.target,n=!u.navMenuItemsRef.current.contains(t)&&!u.navigationRef.current.contains(t);if(n&&!j.current){u.setIgnoreClicks(),j.current=setTimeout(()=>u.setOpenedBlock(null),300);return}!n&&j.current&&(clearTimeout(j.current),j.current=null)},[m,u]),k=(0,i.useRef)(null),N=(0,i.useCallback)(e=>{typeof window>"u"||(e?(k.current=C,window.addEventListener("mousemove",k.current)):k.current&&window.removeEventListener("mousemove",k.current))},[C]);(0,i.useEffect)(()=>{N(u.isNavigationOpen),u.isNavigationOpen&&!w.current&&x(),!u.isNavigationOpen&&w.current&&b()},[u.isNavigationOpen]);let S=(e,t)=>()=>{(0,h.h)(l.D.button,t),u.setOpenedSection(e)},{start:T,clear:I}=O(),A=(e,t)=>()=>{m||T(S(e,t),200)},$=()=>{m||I()};return(0,o.jsx)("div",{ref:u.navigationRef,className:(0,c.Z)(ec.navigation,{[ec.removed]:!u.isNavigationMounted,[ec.navigationOpening]:u.isNavigationOpen,[ec.navigationClosing]:!u.isNavigationOpen}),children:(0,o.jsx)("div",{className:ec.wrapper,children:(0,o.jsxs)(r.W2,{className:(0,c.Z)(ec.container,{[ec.containerOpen]:!!u.openedSection}),children:[(0,o.jsxs)("div",{className:(0,c.Z)(ec.sections,{[ec.sectionsOpen]:!!u.openedSection}),children:[(0,o.jsx)(a.zx,{className:ec.citySelectButton,variant:"purple",appearance:"ghost",size:"xs",onClick:()=>d.handleButtonClick(!1),iconLeft:(0,o.jsx)(s.IconFdsLocationO,{size:24}),label:(null==(t=d.town)?void 0:t.name)||"Вся Россия"}),n.map(e=>(0,o.jsxs)("ul",{className:(0,c.Z)(ec.sectionsWrapper,{[ec.removed]:u.openedBlock!==e.id&&!m}),children:[(0,o.jsx)("div",{className:ec.sectionsTitle,children:h.b[e.id]}),e.sections.map(e=>(0,o.jsxs)("li",{className:(0,c.Z)(ec.section,{[ec.sectionExtra]:!!e.extra,[ec.sectionActive]:u.openedSection===e.id}),onClick:S(e.id,e.title),onMouseEnter:A(e.id,e.title),onMouseLeave:$,children:[(0,o.jsx)(er,{name:e.uikitIcon,background:e.uikitIconBg}),(0,o.jsx)("span",{className:ec.sectionTitle,children:e.title}),(0,o.jsx)("div",{className:ec.sectionArrow,children:(0,o.jsx)(s.IconFdsChevronRightSmallO,{size:24})})]},e.id))]},e.id)),(0,o.jsxs)("div",{className:ec.chatWrapper,children:[(0,o.jsx)("div",{className:ec.chatHeader,children:"Нужна помощь?"}),(0,o.jsx)(X,{})]})]}),(0,o.jsxs)("button",{type:"button",className:(0,c.Z)(ec.backButton,{[ec.removed]:!u.openedSection}),onClick:()=>{(0,h.h)(l.D.button,"Назад"),u.setOpenedSection(null)},children:[(0,o.jsx)(s.IconFdsChevronLeftO,{size:24}),(0,o.jsx)("span",{children:"Назад"})]}),(0,o.jsx)(ei,{data:n,isMobile:m}),(0,o.jsxs)("div",{className:(0,c.Z)(ec.useful,{[ec.usefulOpen]:!!u.openedSection}),children:[(0,o.jsx)("div",{className:ec.usefulTitle,children:"Полезное на Финуслугах"}),n.map(e=>(0,o.jsx)(i.Fragment,{children:e.sections.map(e=>(0,o.jsx)("div",{className:(0,c.Z)(ec.usefulGrid,{[ec.removed]:u.openedSection!==e.id}),children:e.useful.map((e,t)=>(0,o.jsxs)("a",{href:e.url,onClick:()=>(0,h.h)(l.D.link,e.title,"".concat(e.title,"_").concat(e.url)),children:[(0,o.jsx)("div",{children:(0,o.jsx)("img",{src:e.icon,srcSet:e.icon2?"".concat(e.icon,", ").concat(e.icon2," 2x"):void 0,alt:e.title,loading:"lazy"})}),(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:e.title}})]},"".concat(e.title,"_").concat(t)))},e.id))},e.id))]})]})})})},ed=(e,t,n)=>{var o,i,l;let s=(null==(o=null==e?void 0:e.NAVIGATOR)?void 0:o.findIndex(e=>{let{id:t}=e;return"news"===t}))||-1,r=(null==(l=null==(i=null==e?void 0:e.NAVIGATOR)?void 0:i[s])?void 0:l.content)||[];if(e&&Array.isArray(n)&&r.length){let o=n.map(e=>{let{title:n,url:o}=e;return{title:n,url:(0,u.xn)(t||"",o),new:0}});e.NAVIGATOR[s].content[0].links=o}return[{id:"FINPRODUCTS",sections:(null==e?void 0:e.FINPRODUCTS)||[]},{id:"NAVIGATOR",sections:(null==e?void 0:e.NAVIGATOR)||[]},{id:"ABOUT",sections:(null==e?void 0:e.ABOUT)||[]}]},ep=e=>{let{data:t,showcaseUrl:n="https://finuslugi.ru",minioUrl:d="https://assets.finuslugi.ru/mp-assets",lkUrl:p="https://lk.finuslugi.ru/registration",initialTown:m,isMainBannerPage:v,news:f}=e,g=q(),w=ed(t,n,f),_=(0,i.useMemo)(()=>w.reduce((e,t)=>(e[t.id]=t.sections[0].id,e),{}),[w]),x=g.isAuth?"Личный кабинет":"Войти",b=v&&g.isHeaderTransparent,j=(e,t,n,o)=>()=>{e!==g.openedBlock?(0,h.h)(l.D.toggle,t,"on"):(0,h.h)(l.D.button,"menu_close","on");let i=n?_[e]:"";g.setOpenedBlock(e,i,!!o)},{start:C,clear:k}=O(),y=(e,t,n,o)=>()=>{g.isNavigationOpen&&e===g.openedBlock||g.setIgnoreClicks(),C(j(e,t,n,o),200)},N=e=>()=>{g.ignoreClicks||e()},S=e=>g.openedBlock===e&&g.isNavigationOpen;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("header",{className:(0,c.Z)(h.c.header,{[h.c.transparent]:b}),children:(0,o.jsx)("div",{className:(0,c.Z)(h.c.fixed,{[h.c.hidden]:g.isHeaderHidden,[h.c.navigationOpen]:g.isNavigationOpen}),children:(0,o.jsxs)(r.W2,{className:h.c.container,children:[(0,o.jsxs)("div",{className:h.c.leftRow,children:[(0,o.jsx)(eo,{className:h.c.logo,href:n,eventActionType:l.D.icon,eventActionText:"finuslugi_logo",eventLabel:"finuslugi_logo_".concat(n),children:(0,o.jsxs)("picture",{children:[(0,o.jsx)("source",{srcSet:(0,u.xn)(d,"/widgets/header/logo/d.webp"),media:"(min-width: 768px)"}),(0,o.jsx)("img",{src:(0,u.xn)(d,"/widgets/header/logo/m.webp"),alt:"Финуслуги",loading:"eager"})]})}),(0,o.jsx)("nav",{ref:g.navMenuItemsRef,className:h.c.menuItems,children:(0,o.jsx)("ul",{children:h.d.map(e=>{let{id:t,label:n}=e;return(0,o.jsx)("li",{children:(0,o.jsx)(a.zx,{className:(0,c.Z)({[h.c.menuItemActive]:S(t)}),label:n,variant:"white",size:"xs",onClick:N(j(t,n,!0)),onMouseEnter:y(t,n,!0,!0),onMouseLeave:k})},t)})})}),(0,o.jsx)(L,{className:(0,c.Z)(h.c.tabletMenuButton,{[h.c.menuItemActive]:g.isNavigationOpen}),eventActionText:"Меню сайта",variant:"white",size:"xs",iconRight:(0,o.jsx)(s.IconFdsChevronDownO,{size:24}),onClick:j("FINPRODUCTS","Меню сайта"),children:"Меню сайта"})]}),(0,o.jsxs)("div",{className:h.c.buttonGroup,children:[(0,o.jsxs)("div",{className:h.c.chips,children:[(0,o.jsx)(L,{onClick:()=>g.setIsChatModalOpen(!g.isChatModalOpen),size:"xs",shape:"icon",appearance:"ghost",eventActionText:"IconFdsChatDotsCircleO",iconLeft:(0,o.jsx)(s.IconFdsChatDotsCircleO,{size:24})}),(0,o.jsx)(L,{as:"a",href:p,size:"xs",shape:"icon",appearance:"ghost",eventActionText:"profile",eventLabel:"profile_".concat(p),iconLeft:(0,o.jsx)(s.IconFdsUserO,{size:24})})]}),(0,o.jsx)(L,{className:h.c.menuButton,size:"xs",shape:b?"icon":"default",appearance:b?"ghost":"fill",label:"Меню",onClick:j("FINPRODUCTS","Меню"),eventActionText:"Меню",iconLeft:(0,o.jsx)(s.IconFdsMenuSkewedO,{size:24})}),(0,o.jsxs)("div",{className:h.c.moreButtons,children:[(0,o.jsx)(W,{initialTown:m}),(0,o.jsx)(en,{}),(0,o.jsx)(L,{onClick:()=>g.setIsChatModalOpen(!g.isChatModalOpen),size:"xs",shape:"icon",appearance:"ghost",eventActionText:"IconFdsChatDotsCircleO",iconLeft:(0,o.jsx)(s.IconFdsChatDotsCircleO,{size:24})}),(0,o.jsx)(L,{as:"a",href:p,size:"xs",eventActionText:x,eventLabel:"".concat(x,"_").concat(p),label:x})]})]}),(0,o.jsxs)(eo,{className:h.c.auth,href:p,eventActionText:x,eventLabel:"".concat(x,"_").concat(p),children:[(0,o.jsx)(L,{size:"xs",shape:"circle-icon",iconLeft:(0,o.jsx)(s.IconFdsUserO,{}),eventActionText:x,eventLabel:"".concat(x,"_").concat(p)}),(0,o.jsx)("p",{children:x})]}),(0,o.jsx)("div",{className:h.c.close,children:(0,o.jsx)(L,{className:h.c.close,size:"xs",variant:"secondary",shape:"circle-icon",iconLeft:(0,o.jsx)(s.IconFdsCloseO,{}),onClick:()=>g.setOpenedBlock(null),eventActionText:"IconFdsCloseO"})})]})})}),(0,o.jsx)("div",{className:(0,c.Z)(h.c.overlay,{[h.c.removed]:!g.isNavigationMounted,[h.c.overlayOpening]:g.isNavigationOpen,[h.c.overlayClosing]:!g.isNavigationOpen}),onClick:N(()=>g.setOpenedBlock(null))}),(0,o.jsx)(eu,{data:w,minioUrl:d})]})},eh=e=>(0,o.jsx)(Q,{isMainBannerPage:e.isMainBannerPage,children:(0,o.jsx)(ep,{...e})})}}]);