"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4789],{51626:function(e,t,n){n.d(t,{F:function(){return m},H:function(){return d},N:function(){return O},a:function(){return k},b:function(){return h},c:function(){return u},d:function(){return p},h:function(){return b},i:function(){return x},s:function(){return f}});var o=n(57437),i=n(80684),l=n(61994),r=n(2265),s=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=Object.freeze({mobile:56,desktop:80}),f=(e,t,n)=>{if(typeof window>"u"||typeof document>"u")return;let o=document.getElementById("mainHomeBanner"),i=!1,l=0,r=0,s=()=>window.innerWidth<768,a=s(),c=()=>window.scrollY||document.documentElement.scrollTop,u=()=>{let e=document.querySelector(":root");e&&(r=parseFloat(window.getComputedStyle(e).getPropertyValue("--fixed-header-height")),l=c())},d=()=>{let e=s();e!==a&&(a=e,r=0)},p=function(){let s=c(),a=document.getElementById("headerMobileBanner"),d=null==a?void 0:a.getAttribute("data-opening");if("true"===d)return;r||u();let p=s<r,h=s<((null==o?void 0:o.clientHeight)||0);if(n&&h||p){i=!1,e(!1),t(!0);return}e(i=s>l),i&&setTimeout(()=>t(!1),50);let m=i?"0px":"false"===d?`${r}px`:"";document.documentElement.style.setProperty("--new-header-height-desktop",m),document.documentElement.style.setProperty("--new-header-height-mobile",m),l=s<=0?0:s};return window.addEventListener("scroll",p),window.addEventListener("resize",d),()=>{window.removeEventListener("scroll",p),window.removeEventListener("resize",d)}},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},g=()=>document.cookie.split(";").some(e=>e.trim().startsWith("utm_params=")),w=(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`},_=()=>{if(g())return;let e=v();e&&w(e,90)},x=()=>{setTimeout(()=>{if(!(typeof document>"u"||!document.cookie))try{_()}catch(e){console.error("UTM tracking error:",e)}},0)},b=(e,t,n)=>(0,s.h)({eventCategory:d,eventActionType:e,eventActionText:t,eventLabel:n}),j=(0,a.g)("navigation-chips","sc"),y=Object.freeze({wrapper:`${j}__wrapper`,gray:`${j}__variantGray`,white:`${j}__variantWhite`,container:`${j}__container`,chip:`${j}__chip`,more:`${j}__chip--more`,active:`${j}__chip--active`,label:`${j}__label`,hidden:`${j}__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`}),N=({chip:e,hidden:t,onClick:n,refCallback:r,activeChipId:a})=>{let c=!!n,u=()=>{if(c)return null==n?void 0:n(e.url);b(s.D.chip,e.title,`${e.title}_${e.url}`)},d=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:y.label,children:e.title}),e.arrow&&(0,o.jsx)(i.IconFdsArrowUpRightSmallO,{size:24})]}),p=(0,l.Z)(y.chip,{[y.hidden]:t,[k.new]:!!e.new,[k.vip]:!!e.vip,[y.active]:e.url===a});return c?(0,o.jsx)("button",{type:"button",className:p,onClick:u,ref:r,children:d}):(0,o.jsx)("a",{href:e.url,className:p,onClick:u,ref:r,children:d})},O=({items:e=[],maxNumberOfLines:t,variant:n,className:a,activeChipId:c,onClick:u})=>{let d=(0,r.useRef)(null),p=(0,r.useRef)(null),h=(0,r.useRef)({}),[m,f]=(0,r.useState)(!1),[v,g]=(0,r.useState)(e.length),[w,_]=(0,r.useState)(!1);(0,r.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 x=(0,r.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),r=()=>{g(e.length),_(!1)};if(m||0===l||i<=0){r();return}let s=(()=>{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)){r();return}let u=1,f=0,v=0;for(let e of c){let t=u===l?a+s:0,n=0===f?e:f+s+e;if(n+t<=i-.5)f=n,v++;else{if(++u>l)break;f=e,v++}}_(v<e.length),g(v)},[m,e,t]);(0,r.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(x)});return t.observe(e),requestAnimationFrame(x),()=>{t.disconnect()}},[x]),(0,r.useEffect)(()=>{requestAnimationFrame(x)},[x]);let j=m||(t??0)<=0||!w;return(0,o.jsx)("div",{className:(0,l.Z)(a,y.wrapper,{[y.gray]:"gray"===n,[y.white]:"white"===n}),children:(0,o.jsxs)("div",{ref:d,className:y.container,children:[e.map((e,t)=>(0,o.jsx)(N,{chip:e,hidden:!j&&t>=v,activeChipId:c,onClick:u,refCallback:t=>{h.current[e.url]=t}},e.url)),!j&&w&&(0,o.jsxs)("button",{type:"button",ref:p,className:(0,l.Z)(y.chip,y.more),onClick:()=>{b(s.D.chip,"Еще"),f(!0)},children:[(0,o.jsx)(i.IconFdsDotsVerticalO,{size:20}),(0,o.jsx)("span",{className:y.label,children:"Еще"})]}),(j||!w)&&(0,o.jsxs)("button",{type:"button",ref:p,className:(0,l.Z)(y.chip,y.more,y.hidden),tabIndex:-1,"aria-hidden":"true",children:[(0,o.jsx)(i.IconFdsDotsVerticalO,{size:20}),(0,o.jsx)("span",{className:y.label,children:"Еще"})]})]})})}},20828:function(e,t,n){n.d(t,{D:function(){return A},P:function(){return M},U:function(){return B},u:function(){return b}});var o=n(57437),i=n(61994),l=n(2265),r=n(80684),s=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,s.g)("click-outside","sc"),p=Object.freeze({overlay:`${d}__overlay`,open:`${d}--open`,close:`${d}--close`}),h=({onClose:e,onToucheMove:t,isOpen:n,delay:r=c})=>{let s=(0,l.useRef)(null),a=(0,l.useCallback)(()=>{e&&(s.current=setTimeout(()=>{e()},r))},[r,e]),u=(0,l.useCallback)(e=>{"Escape"===e.key&&a()},[a]);return(0,l.useEffect)(()=>(n&&window.addEventListener("keydown",u),()=>{s.current&&clearTimeout(s.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"))},f=e=>{e.style.top||(window.prevScrollPosition=window.scrollY)},v=(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,r=window.innerWidth-l.clientWidth,s=r>0;if(e&&s)f(i),v(i,l,r),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,s.g)("drawer-footer","sc"),y=Object.freeze({footer:`${j}__footer`,hasScroll:`${j}__footer--has-scroll`}),C=({footer:e,hasScroll:t,className:n})=>(0,o.jsx)("div",{className:(0,i.Z)(y.footer,{[y.hasScroll]:t},n),children:"function"==typeof e?e():e}),k=(0,s.g)("drawer-content","sc"),N=Object.freeze({container:`${k}__container`,open:`${k}--open`,close:`${k}--close`,header:`${k}__header`,rowHeader:`${k}__header--row`,title:`${k}__title`,center:`${k}__title--center`,left:`${k}__title--left`,right:`${k}__title--right`,controlContainer:`${k}__control-container`,content:`${k}__content`,footer:`${k}__footer`}),O=({onClose:e,onContentClick:t,children:n,title:s,rowTitle:a,titleAlign:c,isCloseable:u,footer:d,closeButton:p,isOpen:h,contentClassName:m,footerClassName:f,contentStyle:v,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=v||g?{width:g,...v||{}}: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:[s||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)(r.IconFdsCloseO,{size:24})}):null,s?(0,o.jsx)("h3",{className:(0,i.Z)(N.title,{[N[c]]:!0}),children:s}):null]}):null,(0,o.jsx)("div",{ref:_,className:N.content,onClick:t,children:n}),d&&(0,o.jsx)(C,{className:(0,i.Z)(N.footer,f),footer:d,hasScroll:x})]})},S=(0,s.g)("drawer-layout","sc"),T=Object.freeze({window:`${S}__window`}),I=({onClose:e,isOpen:t,children:n,withDisabledScroll:r,className:s,...a})=>{let c=(0,l.useCallback)(e=>e.stopPropagation(),[]);return b(t&&r),(0,o.jsxs)("div",{"data-portal":!0,className:(0,i.Z)(T.window,s),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,...r})=>{let{mounted:s}=u({opened:e});return s?(0,o.jsx)(I,{titleAlign:n,isCloseable:i,isOpen:e,withDisabledScroll:l,...r,children:t}):null};A.displayName="Drawer";let L=(0,s.g)("mobile-modal-footer","sc"),$=Object.freeze({footer:`${L}__footer`,footerWithoutShadow:`${L}__footer--without-shadow`}),R=({footer:e,isSmallPopup:t=!1,footerClassName:n})=>(0,o.jsx)("div",{className:(0,i.Z)($.footer,t&&$.footerWithoutShadow,n),children:"function"==typeof e?e():e}),E=(0,s.g)("mobile-popup","sc"),P=Object.freeze({mobilePopup:`${E}`,mobilePopupOpen:`${E}--open`,content:`${E}__content`,contentFull:`${E}__content--full`,contentTransition:`${E}__content--transition`,contentTransitionOpen:`${E}__content--transition-open`,contentLine:`${E}__content-line`,contentContainer:`${E}__content-container`,smallContentContainer:`${E}__content-container--small`,min:`${E}__content-container--min`,title:`${E}__title`,closeContainer:`${E}__close-container`,closeButton:`${E}__close-button`}),z=({children:e,footer:t,isOpen:n,isSmallPopup:s,onClose:a,hasCloseButton:c=!0,full:u,touchDistance:d=100,withDisabledScroll:p=!0,contentClassName:m,className:f,title:v,closeButton:g,footerClassName:w})=>{let[_,x]=(0,l.useState)(!1),[j,y]=(0,l.useState)(!1),[C,k]=(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,k(!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}},L=()=>{I.current&&(T.current>d&&a?null==a||a():O("0"),k(!0),I.current=!1),window.removeEventListener("touchmove",A),window.removeEventListener("touchend",L)};return(0,l.useEffect)(()=>{n&&setTimeout(()=>{x(!0),y(!0),O("0")},100),!n&&j&&(O("120%"),x(!1),y(!1))},[j,n]),b(n&&p),(0,o.jsxs)("div",{"data-portal":!0,className:(0,i.Z)(P.mobilePopup,j&&P.mobilePopupOpen,f),children:[(0,o.jsx)(h,{onClose:()=>{n&&(null==a||a())},onToucheMove:()=>{n&&(x(!1),window.addEventListener("touchmove",A),window.addEventListener("touchend",L))},isOpen:n,delay:0}),(0,o.jsxs)("div",{className:(0,i.Z)(P.content,u&&P.contentFull,C&&P.contentTransition,C&&_&&P.contentTransitionOpen),ref:S,style:{transform:`translateY(${N})`},children:[(0,o.jsx)("div",{className:P.contentLine}),(0,o.jsxs)("div",{className:(0,i.Z)(P.contentContainer,s&&P.smallContentContainer,{[P.min]:!v&&!c},m),children:[!!v&&(0,o.jsx)("div",{className:P.title,children:v}),c?(0,o.jsx)("div",{className:P.closeContainer,children:c?g?"function"==typeof g?g():g:(0,o.jsx)("button",{onClick:a,className:P.closeButton,children:(0,o.jsx)(r.IconFdsCloseO,{size:24})}):null}):null,e]}),t&&(0,o.jsx)(R,{footerClassName:w,isSmallPopup:s,footer:t})]})]})},B=({children:e,isSmallPopup:t=!1,isOpen:n=!1,...i})=>{let{mounted:l}=u({opened:n});return l?(0,o.jsx)(z,{isSmallPopup:t,isOpen:n,...i,children:e}):null};B.displayName="UiMobilePopup";let M=({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 s},h:function(){return c}});var i=n(31620),l=n(30631);let r=(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 s=((o=s||{}).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())),r(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 ew},a:function(){return k}});var o=n(57437),i=n(2265),l=n(10992),r=n(80684),s=n(35563),a=n(75461),c=n(61994),u=n(77337),d=n(20828),p=n(52074),h=n(51626);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},f=()=>{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},v=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:y,eventActionType:e,eventActionText:t,eventLabel:n})},x=f(),b=v(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},y="finkit-widgets-sc-city-select",C=(0,i.createContext)(j);function k(){return(0,i.useContext)(C)}let N=e=>{let{children:t,showStartGeoPopup:n=!0,lastRegionsUpdateUnixTimestamp:r,dadataUrl:s="https://finuslugi.ru/backend/money/dadata"}=e,a=Number(m("lastRegionsUpdateUnixTimestamp")||0),c=Number(r||0)>a,[u,d]=(0,i.useState)(f()),[{startRegion:p,startTown:h},x]=(0,i.useState)({startRegion:j.startRegion,startTown:j.startTown}),[{region:b,town:y},k]=(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)(()=>v(u),[u.length]),L=(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]),$=(0,i.useCallback)((e,t)=>{window.sessionStorage.getItem("start_popup_opened")||L(e,t)},[L]),R=(0,i.useCallback)(()=>{if(I.current&&!b&&!y){var e,t;let n=null!==(e=A.find(e=>e.name===I.current))&&void 0!==e?e:null;return $(null!==(t=u.find(e=>e.id===(null==n?void 0:n.parentId)))&&void 0!==t?t:null,n)}$(b,y)},[b,y,A,u,$]),E=(0,i.useCallback)(e=>{T(e)},[T]),P=(0,i.useCallback)(e=>{e?_(l.D.icon,"location"):_(l.D.button,(null==y?void 0:y.name)||"Вся Россия"),!n||window.sessionStorage.getItem("start_popup_opened")?E(!0):R()},[n,y,E,R]),z=(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","")),k({region:e||null,town:t||null}),O(!1),E(!1);let n=new CustomEvent("onRegionChange",{detail:{region:e,town:t}});document.dispatchEvent(n)},[E]),B=()=>{k({region:m("user_region"),town:m("user_town")});let e=async e=>{let{coords:{latitude:t,longitude:n}}=e,o="".concat(s,"?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=()=>{B(),window.removeEventListener("scroll",e)};window.addEventListener("scroll",e)}else setTimeout(()=>{B()},0)},[]),(0,o.jsx)(C.Provider,{value:{regions:u,towns:A,region:b,town:y,startPopupVisible:N,setStartPopupVisible:O,popupVisible:S,handleToggleModal:E,selectCity:z,handleButtonClick:P,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:s,query:c,setQuery:u,isDrawer:d}=e,p=k(),h=(0,i.useRef)(null),[m,f]=(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),r=l.reduce((e,t,n)=>t<l[e]?n:e,0);0===r&&i[0].push(i[1].shift()),2===r&&i[2].unshift(i[1].pop()),1===r&&l[0]>l[2]&&i[1].unshift(i[0].pop()),1===r&&l[0]<l[2]&&i[1].push(i[2].shift());let s=Math.max(...i.map(e));return s>=o?o:t(i,s)};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&&f("".concat(o,"px"))}).observe(h.current)},[]);let v=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)(r.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)(r.IconFdsCloseCircleO,{size:24,onClick:()=>u("")}):(0,o.jsx)(r.IconFdsSearchO,{size:24})}),(0,o.jsx)(a.cL,{className:T.chips,chips:s,value:(null==(t=p.town)?void 0:t.id)||0,onChipClick:e=>{v(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:()=>v(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],L=()=>{var e;let t=k(),n=(0,a._m)("l"),[r,s]=(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(r.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},[]),[r,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:r,setQuery:s})}),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:r,setQuery:s,isDrawer:!0})})]})},$={"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"},R=()=>{let{hostname:e}=window.location;return Object.prototype.hasOwnProperty.call($,e)?$[e]:$["finuslugi.ru"]},E=(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)},P=()=>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)}})}),z=()=>{let[e,t]=(0,i.useState)(!1),[n,o]=(0,i.useState)(!1),l=(0,i.useRef)(!1),r=e=>{l.current=e,o(e)};return(0,i.useEffect)(()=>{if(typeof window>"u")return;let e=R(),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,s)=>{if(l.current){s(Error("chat is already opened"));return}o?(o.openWidget(),t(!1),i()):(r(!0),window.getWebChatCraftTalkExternalControl=e=>{var n;o=e;let l=document.querySelector(".webchat");l&&P().observe(l,{attributes:!0,attributeFilter:["style"]}),null!=(n=window.supportWidget)&&n.craftTalk&&(window.supportWidget.craftTalk.close=o.closeWidget),null==o||o.openWidget(),r(!1),t(!1),i()},E(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}},B=(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,fixedContainerRef:{current:null}});function M(){return(0,i.useContext)(B)}let F=e=>{let[t,n]=(0,i.useState)(!1),[l,r]=(0,i.useState)(!1),[s,a]=(0,i.useState)(!!e.isMainBannerPage),{isChatModalOpen:c,setIsChatModalOpen:u,isChatLoading:p}=z(),[m,f]=(0,i.useState)(null),[v,g]=(0,i.useState)(null),[w,_]=(0,i.useState)(!1),[x,b]=(0,i.useState)(!1),[j,y]=(0,i.useState)(!1),C=(0,i.useRef)(null),k=(0,d.u)(w),N=(0,i.useRef)(null),O=(0,i.useRef)(null),S=(0,i.useRef)(null),T=(0,i.useCallback)(()=>{k.current&&k.current.scrollTo({top:0})},[k]),I=(0,i.useCallback)(e=>{g(e),T()},[T]),A=(0,i.useCallback)(e=>{N.current&&clearTimeout(N.current),e&&b(!0),e||(N.current=setTimeout(()=>{b(!1),I(null)},300))},[I]),L=(0,i.useCallback)((e,t,n)=>{if(t&&I(t),!n&&e===m||!e){A(!w),_(!w);return}f(e),A(!0),_(!0)},[m,I,w,A]),$=(0,i.useCallback)(()=>{O.current&&clearTimeout(O.current),y(!0),O.current=setTimeout(()=>{y(!1)},650)},[]);return(0,i.useEffect)(()=>{n(!!document.cookie.includes("auth.gtm_customer_id"));let t=(0,h.s)(r,a,e.isMainBannerPage);return(0,h.i)(),t},[]),(0,o.jsx)("div",{children:(0,o.jsx)(B.Provider,{value:{isAuth:t,isHeaderHidden:l,isHeaderTransparent:s,openedBlock:m,setOpenedBlock:L,openedSection:v,setOpenedSection:I,isNavigationOpen:w,isNavigationMounted:x,navMenuItemsRef:C,navigationRef:k,ignoreClicks:j,setIgnoreClicks:$,isChatModalOpen:c,setIsChatModalOpen:u,isChatLoading:p,fixedContainerRef:S},children:e.children})})},W=e=>{let{label:t,onClick:n,eventActionText:i,eventLabel:r,...s}=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:r||""})},...s})},D=(0,p.g)("header-popup","sc"),U=Object.freeze({popup:"".concat(D,"__popup"),popupHeader:"".concat(D,"__popup-header"),popupClose:"".concat(D,"__popup-close"),body:"".concat(D,"__body")}),Z=e=>{let{isOpen:t,onClose:n,children:i,title:l}=e,s=(0,a._m)("l");return(0,o.jsxs)(d.P,{children:[!s&&(0,o.jsx)(d.U,{title:l,isOpen:t,onClose:n,children:i}),s&&t&&(0,o.jsxs)("div",{className:U.popup,children:[(0,o.jsxs)("div",{className:U.popupHeader,children:[l,(0,o.jsx)(W,{className:U.popupClose,iconLeft:(0,o.jsx)(r.IconFdsCloseO,{}),shape:"icon",appearance:"ghost",size:"xs",onClick:n,eventActionText:"IconFdsCloseO"})]}),(0,o.jsx)("div",{className:U.body,children:i})]})]})},H=(0,p.g)("start-choice-popup","sc"),V=Object.freeze({top:"".concat(H,"__top"),progress:"".concat(H,"__progress"),innerCircle:"".concat(H,"__inner-circle"),title:"".concat(H,"__title"),subtitle:"".concat(H,"__subtitle"),actions:"".concat(H,"__actions")}),G=()=>{var e,t;let n=k(),[r,s]=(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((" "+r).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<r&&s(i),100===n&&(clearInterval(u.current),d())},t)})():(clearInterval(u.current),s(10),c(0))},[n.startPopupVisible]),(0,o.jsxs)(Z,{isOpen:n.startPopupVisible,onClose:d,title:(0,o.jsx)("button",{type:"button",className:V.progress,style:{background:"conic-gradient(#ff0508 ".concat(a,"deg, #e3e7ec 0deg)")},onClick:d,children:(0,o.jsx)("div",{className:V.innerCircle,children:r})}),children:[(0,o.jsxs)("div",{className:V.top,children:[(0,o.jsxs)("div",{className:V.title,children:["Ваш город ",(null==(e=n.startTown)?void 0:e.name)||(null==(t=n.startRegion)?void 0:t.name)||"Вся Россия","?"]}),(0,o.jsx)("div",{className:V.subtitle,children:"Это поможет вам увидеть выгодные предложения в вашем городе"})]}),(0,o.jsxs)("div",{className:V.actions,children:[(0,o.jsx)(W,{size:"s",stretch:!0,eventActionText:"Да, все верно",onClick:()=>{_(l.D.button,"Да, все верно"),n.selectCity(n.startRegion,n.startTown)},children:"Да, все верно"}),(0,o.jsx)(W,{variant:"secondary",size:"s",stretch:!0,eventActionText:"Нет, изменить",onClick:()=>{_(l.D.button,"Нет, изменить"),n.setStartPopupVisible(!1),n.handleToggleModal(!0)},children:"Нет, изменить"})]})]})},q=(0,p.g)("city-select","sc"),J=Object.freeze({button:"".concat(q,"__button")}),Q=e=>{var t;let{initialTown:n}=e,l=k(),s=(null==(t=l.town)?void 0:t.name)||n||"Вся Россия",{setIsChatModalOpen:c,isChatModalOpen:u}=M(),{startPopupVisible:d,setStartPopupVisible:p,popupVisible:h}=l,m=(0,i.useRef)();return(0,i.useEffect)(()=>{h&&(m.current="popup")},[h]),(0,i.useEffect)(()=>{u&&(m.current="chat")},[u]),(0,i.useEffect)(()=>{d&&(m.current="startPopup")},[d]),(0,i.useEffect)(()=>{m.current&&("chat"===m.current&&d?p(!1):["startPopup","popup"].includes(m.current)&&u&&c(!1))},[h,u,d,p,c]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.zx,{className:J.button,variant:"purple",appearance:"ghost",size:"xs",onClick:()=>l.handleButtonClick(!1),iconLeft:(0,o.jsx)(r.IconFdsLocationO,{size:16}),label:s}),(0,o.jsx)(L,{}),(0,o.jsx)(G,{})]})},Y=e=>{let{onClick:t,eventActionType:n,eventActionText:i,eventLabel:r,...s}=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:r||""})},...s})},K=(0,p.g)("header-mobile-app-banner","sc"),X=Object.freeze({wrapper:"".concat(K,"__wrapper"),container:"".concat(K,"__container"),closeButton:"".concat(K,"__close-button"),innerWrapper:"".concat(K,"__inner-wrapper"),imageWrapper:"".concat(K,"__image-wrapper"),image:"".concat(K,"__image"),title:"".concat(K,"__title"),description:"".concat(K,"__description"),callToAction:"".concat(K,"__call-to-action"),scanQr:"".concat(K,"__scan-qr")}),ee=Object.freeze({mobile:56,desktop:68}),et="headerBannerShownAt",en=()=>{let e=localStorage.getItem(et);if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t},eo=()=>{localStorage.setItem(et,new Date().toISOString())},ei=()=>{let e=en();return!e||Math.floor((e.getTime()-new Date().getTime())/864e5)>5},el=e=>{let{minioUrl:t,className:n,mobileAppUrl:l}=e,{fixedContainerRef:d}=M(),[p,m]=(0,i.useState)(!1),[f,v]=(0,i.useState)(!1),[g,w]=(0,i.useState)(!1),_=(0,i.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"desktop",t=d.current;t&&(t.style.transform="translateY(0)",document.documentElement.style.setProperty("--fixed-header-height","".concat(ee[e]+h.F[e],"px")),document.documentElement.style.setProperty("--new-header-height-desktop","".concat(ee.desktop+h.F.desktop,"px")),document.documentElement.style.setProperty("--new-header-height-mobile","".concat(ee.mobile+h.F.mobile,"px")),document.documentElement.style.setProperty("--static-new-header-height-mobile","".concat(ee.mobile+h.F.mobile,"px")),document.documentElement.style.setProperty("--static-new-header-height-desktop","".concat(ee.desktop+h.F.desktop,"px")),document.documentElement.style.setProperty("--header-height","".concat(ee[e]+108,"px")))},[]),x=(0,i.useCallback)(()=>{let e=d.current;e&&(document.documentElement.style.removeProperty("--fixed-header-height"),document.documentElement.style.removeProperty("--new-header-height-desktop"),document.documentElement.style.removeProperty("--new-header-height-mobile"),document.documentElement.style.removeProperty("--static-new-header-height-mobile"),document.documentElement.style.removeProperty("--static-new-header-height-desktop"),document.documentElement.style.removeProperty("--header-height"),e.style.transform="")},[]);return(0,i.useEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{f&&m(!1),w(!1)};return e.addEventListener("transitionend",t),()=>{e.removeEventListener("transitionend",t)}},[f]),(0,i.useEffect)(()=>{ei()&&m(!0)},[]),(0,i.useEffect)(()=>{let e=window.innerWidth<768;p&&(_(e?"mobile":"desktop"),w(!0));let t=()=>{if(!p)return null;_(window.innerWidth<768?"mobile":"desktop")};return window.addEventListener("resize",t),()=>{x(),window.removeEventListener("resize",t)}},[p,_,x]),p?(0,o.jsx)("div",{id:"headerMobileBanner",role:"region","aria-label":"Мобильное приложение","data-opening":g,className:(0,c.Z)(X.wrapper,n),children:(0,o.jsx)(s.W2,{children:(0,o.jsxs)("div",{className:X.container,children:[(0,o.jsxs)("div",{className:X.innerWrapper,children:[(0,o.jsxs)("picture",{className:X.imageWrapper,children:[(0,o.jsx)("source",{srcSet:(0,u.xn)(t,"/widgets/header/qr-mobile-app.svg"),media:"(min-width: 768px)"}),(0,o.jsx)("img",{className:X.image,src:(0,u.xn)(t,"/logo/finuslugi/default-regular.svg")})]}),(0,o.jsxs)("div",{className:X.scanQr,children:[(0,o.jsx)("div",{className:X.title,children:"Скачайте приложение Финуслуги"}),(0,o.jsx)("div",{className:X.description,children:"Сканируйте QR-код"})]}),(0,o.jsxs)("div",{className:X.callToAction,children:[(0,o.jsxs)("div",{children:["Приложение",(0,o.jsx)("br",{}),"Финуслуги"]}),(0,o.jsx)(a.zx,{onClick:()=>{window.open(l,"_blank","noreferrer")},variant:"white",size:"xs",children:"Скачать"})]})]}),(0,o.jsx)("div",{"aria-label":"Закрыть",role:"button",className:X.closeButton,onClick:()=>{eo(),x(),window.matchMedia("(prefers-reduced-motion: reduce)").matches?m(!1):v(!0)},children:(0,o.jsx)(r.IconFdsCloseO,{size:"100%"})})]})})}):null},er=(0,p.g)("header-chat-modal-body","sc"),es=Object.freeze({wrapper:"".concat(er,"__wrapper"),cardButton:"".concat(er,"__card-button"),card:"".concat(er,"__card"),cardTitle:"".concat(er,"__card-title"),cardSubtitle:"".concat(er,"__card-subtitle"),button:"".concat(er,"__button")}),ea=()=>{let e=M();return(0,o.jsxs)("div",{className:es.wrapper,children:[(0,o.jsx)(W,{className:es.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)(s.Zb,{className:es.card,variant:"secondary",children:[(0,o.jsxs)("div",{className:es.cardTitle,children:[(0,o.jsx)("img",{src:"https://finuslugi.ru/icons/chaticons/new/chat_icon_hover.svg",alt:"chat"}),"Напишите в чат"]}),(0,o.jsxs)("p",{className:es.cardSubtitle,children:["Виртуальный ассистент доступен\xa024/7, ",(0,o.jsx)("br",{}),"операторы\xa0—\xa0с\xa06:00 до\xa023:59\xa0мск"]})]})}),(0,o.jsx)(W,{className:es.cardButton,variant:"secondary",as:"a",href:"https://finuslugi.ru/landing/fingpt",target:"_blank",eventActionText:"Спросите у FinGPT",children:(0,o.jsxs)(s.Zb,{className:es.card,variant:"secondary",children:[(0,o.jsxs)("div",{className:es.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:es.cardSubtitle,children:"Ваш личный финансовый AI-ассистент"})]})})]})},ec=e=>{let{data:t,isMobile:n}=e,s=M();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]:s.openedSection!==e.id,[h.a.contentOpen]:!!s.openedSection}),children:[(0,o.jsx)("div",{className:h.a.contentHeader,children:(0,o.jsx)("label",{children:e.title})}),e.content.map((t,i)=>{var s,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)(r.IconFdsArrowUpRightSmallO,{})}),t.title]})})}),!(null!=(s=t.links)&&s.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)(r.IconFdsArrowUpRightSmallO,{})}),(0,o.jsx)("span",{children:e.title})]},e.url))})]},"".concat(t.url,"_").concat(i))})]},e.id))},e.id))})},eu=(0,p.g)("navigation-section-icon","sc"),ed=Object.freeze({icon:"".concat(eu)}),ep=e=>{let{name:t,background:n}=e,l=(0,i.useMemo)(()=>t&&r[t]||null,[t]);return t&&l?(0,o.jsx)("div",{className:ed.icon,style:{background:n},children:(0,o.jsx)(l,{})}):null},eh=(0,p.g)("navigation","sc"),em=Object.freeze({navigation:"".concat(eh),navigationOpening:"".concat(eh,"--opening"),navigationClosing:"".concat(eh,"--closing"),wrapper:"".concat(eh,"__wrapper"),container:"".concat(eh,"__container"),containerOpen:"".concat(eh,"__container--open"),sections:"".concat(eh,"__sections"),sectionsOpen:"".concat(eh,"__sections--open"),citySelectButton:"".concat(eh,"__city-select-button"),sectionsTitle:"".concat(eh,"__sections-title"),sectionsWrapper:"".concat(eh,"__sections-wrapper"),section:"".concat(eh,"__section"),sectionArrow:"".concat(eh,"__section-arrow"),sectionExtra:"".concat(eh,"__section--extra"),sectionActive:"".concat(eh,"__section--active"),sectionTitle:"".concat(eh,"__section-title"),chatWrapper:"".concat(eh,"__chat-wrapper"),chatHeader:"".concat(eh,"__chat-header"),backButton:"".concat(eh,"__back-button"),useful:"".concat(eh,"__useful"),usefulOpen:"".concat(eh,"__useful--open"),usefulTitle:"".concat(eh,"__useful-title"),usefulGrid:"".concat(eh,"__useful-grid"),removed:"".concat(eh,"__removed")}),ef=e=>{var t;let{data:n}=e,u=M(),d=k(),p=(0,a.aF)("m"),[m,f]=(0,i.useState)(!0);(0,i.useEffect)(()=>{f(p)},[p]);let v=(0,i.useRef)(null),g=(0,i.useCallback)(()=>{v.current&&clearTimeout(v.current),v.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),y=(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]),C=(0,i.useRef)(null),N=(0,i.useCallback)(e=>{typeof window>"u"||(e?(C.current=y,window.addEventListener("mousemove",C.current)):C.current&&window.removeEventListener("mousemove",C.current))},[y]);(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),150)},L=()=>{m||I()};return(0,o.jsx)("div",{ref:u.navigationRef,className:(0,c.Z)(em.navigation,{[em.removed]:!u.isNavigationMounted,[em.navigationOpening]:u.isNavigationOpen,[em.navigationClosing]:!u.isNavigationOpen}),children:(0,o.jsx)("div",{className:em.wrapper,children:(0,o.jsxs)(s.W2,{className:(0,c.Z)(em.container,{[em.containerOpen]:!!u.openedSection}),children:[(0,o.jsxs)("div",{className:(0,c.Z)(em.sections,{[em.sectionsOpen]:!!u.openedSection}),children:[(0,o.jsx)(a.zx,{className:em.citySelectButton,variant:"purple",appearance:"ghost",size:"xs",onClick:()=>d.handleButtonClick(!1),iconLeft:(0,o.jsx)(r.IconFdsLocationO,{size:24}),label:(null==(t=d.town)?void 0:t.name)||"Вся Россия"}),n.map(e=>(0,o.jsxs)("ul",{className:(0,c.Z)(em.sectionsWrapper,{[em.removed]:u.openedBlock!==e.id&&!m}),children:[(0,o.jsx)("div",{className:em.sectionsTitle,children:h.b[e.id]}),e.sections.map(e=>(0,o.jsxs)("li",{className:(0,c.Z)(em.section,{[em.sectionExtra]:!!e.extra,[em.sectionActive]:u.openedSection===e.id}),onClick:S(e.id,e.title),onMouseEnter:A(e.id,e.title),onMouseLeave:L,children:[(0,o.jsx)(ep,{name:e.uikitIcon,background:e.uikitIconBg}),(0,o.jsx)("span",{className:em.sectionTitle,children:e.title}),(0,o.jsx)("div",{className:em.sectionArrow,children:(0,o.jsx)(r.IconFdsChevronRightSmallO,{size:24})})]},e.id))]},e.id)),(0,o.jsxs)("div",{className:em.chatWrapper,children:[(0,o.jsx)("div",{className:em.chatHeader,children:"Нужна помощь?"}),(0,o.jsx)(ea,{})]})]}),(0,o.jsxs)("button",{type:"button",className:(0,c.Z)(em.backButton,{[em.removed]:!u.openedSection}),onClick:()=>{(0,h.h)(l.D.button,"Назад"),u.setOpenedSection(null)},children:[(0,o.jsx)(r.IconFdsChevronLeftO,{size:24}),(0,o.jsx)("span",{children:"Назад"})]}),(0,o.jsx)(ec,{data:n,isMobile:m}),(0,o.jsxs)("div",{className:(0,c.Z)(em.useful,{[em.usefulOpen]:!!u.openedSection}),children:[(0,o.jsx)("div",{className:em.usefulTitle,children:"Полезное на Финуслугах"}),n.map(e=>(0,o.jsx)(i.Fragment,{children:e.sections.map(e=>(0,o.jsx)("div",{className:(0,c.Z)(em.usefulGrid,{[em.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))]})]})})})},ev=(e,t,n)=>{var o,i,l;let r=(null==(o=null==e?void 0:e.NAVIGATOR)?void 0:o.findIndex(e=>{let{id:t}=e;return"news"===t}))||-1,s=(null==(l=null==(i=null==e?void 0:e.NAVIGATOR)?void 0:i[r])?void 0:l.content)||[];if(e&&Array.isArray(n)&&s.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[r].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)||[]}]},eg=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:f,enableAppHeaderBanner:v=!1,news:g}=e,w=M(),_=ev(t,n,g),x=t.config,b=(0,i.useMemo)(()=>_.reduce((e,t)=>(e[t.id]=t.sections[0].id,e),{}),[_]),j=w.isAuth?"Личный кабинет":"Войти",y=f&&w.isHeaderTransparent,C=(e,t,n,o)=>()=>{e!==w.openedBlock?(0,h.h)(l.D.toggle,t,"on"):(0,h.h)(l.D.button,"menu_close","on");let i=n?b[e]:"";w.setOpenedBlock(e,i,!!o)},{start:k,clear:N}=O(),S=(e,t,n,o)=>()=>{w.isNavigationOpen&&e===w.openedBlock||w.setIgnoreClicks(),k(C(e,t,n,o),200)},T=e=>()=>{w.ignoreClicks||e()},I=e=>w.openedBlock===e&&w.isNavigationOpen;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("header",{className:(0,c.Z)(h.c.header,{[h.c.transparent]:y}),children:(0,o.jsxs)("div",{ref:w.fixedContainerRef,className:(0,c.Z)(h.c.fixed,{[h.c.hidden]:w.isHeaderHidden,[h.c.navigationOpen]:w.isNavigationOpen}),children:[!!(null!=x&&x.appBannerUrl)&&v&&(0,o.jsx)(el,{mobileAppUrl:x.appBannerUrl,minioUrl:d}),(0,o.jsxs)(s.W2,{className:h.c.container,children:[(0,o.jsxs)("div",{className:h.c.leftRow,children:[(0,o.jsx)(Y,{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:w.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]:I(t)}),label:n,variant:"white",size:"xs",onClick:T(C(t,n,!0)),onMouseEnter:S(t,n,!0,!0),onMouseLeave:N})},t)})})}),(0,o.jsx)(W,{className:(0,c.Z)(h.c.tabletMenuButton,{[h.c.menuItemActive]:w.isNavigationOpen}),eventActionText:"Меню сайта",variant:"white",size:"xs",iconRight:(0,o.jsx)(r.IconFdsChevronDownO,{size:24}),onClick:C("FINPRODUCTS","Меню сайта"),children:"Меню сайта"})]}),(0,o.jsxs)("div",{className:h.c.buttonGroup,children:[(0,o.jsxs)("div",{className:h.c.chips,children:[(0,o.jsx)(W,{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)},size:"xs",shape:"icon",appearance:"ghost",eventActionText:"IconFdsChatDotsCircleO",iconLeft:(0,o.jsx)(r.IconFdsChatDotsCircleO,{size:24})}),(0,o.jsx)(W,{as:"a",href:p,size:"xs",shape:"icon",appearance:"ghost",eventActionText:"profile",eventLabel:"profile_".concat(p),iconLeft:(0,o.jsx)(r.IconFdsUserO,{size:24})})]}),(0,o.jsx)(W,{className:h.c.menuButton,size:"xs",shape:y?"icon":"default",appearance:y?"ghost":"fill",label:"Меню",onClick:C("FINPRODUCTS","Меню"),eventActionText:"Меню",iconLeft:(0,o.jsx)(r.IconFdsMenuSkewedO,{size:24})}),(0,o.jsxs)("div",{className:h.c.moreButtons,children:[(0,o.jsx)(Q,{initialTown:m}),(0,o.jsx)(W,{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)},size:"xs",shape:"icon",appearance:"ghost",eventActionText:"IconFdsChatDotsCircleO",iconLeft:(0,o.jsx)(r.IconFdsChatDotsCircleO,{size:24})}),(0,o.jsx)(W,{as:"a",href:p,size:"xs",eventActionText:j,eventLabel:"".concat(j,"_").concat(p),label:j})]})]}),(0,o.jsxs)(Y,{className:h.c.auth,href:p,eventActionText:j,eventLabel:"".concat(j,"_").concat(p),children:[(0,o.jsx)(W,{size:"xs",shape:"circle-icon",iconLeft:(0,o.jsx)(r.IconFdsUserO,{}),eventActionText:j,eventLabel:"".concat(j,"_").concat(p)}),(0,o.jsx)("p",{children:j})]}),(0,o.jsx)("div",{className:h.c.close,children:(0,o.jsx)(W,{className:h.c.close,size:"xs",variant:"secondary",shape:"circle-icon",iconLeft:(0,o.jsx)(r.IconFdsCloseO,{}),onClick:()=>w.setOpenedBlock(null),eventActionText:"IconFdsCloseO"})})]})]})}),(0,o.jsx)("div",{className:(0,c.Z)(h.c.overlay,{[h.c.removed]:!w.isNavigationMounted,[h.c.overlayOpening]:w.isNavigationOpen,[h.c.overlayClosing]:!w.isNavigationOpen}),onClick:T(()=>w.setOpenedBlock(null))}),(0,o.jsx)(ef,{data:_,minioUrl:d})]})},ew=e=>(0,o.jsx)(F,{isMainBannerPage:e.isMainBannerPage,children:(0,o.jsx)(eg,{...e})})}}]);