(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,77120,e=>{"use strict";var t=e.i(43476),n=e.i(71645),l=e.i(2305),i=e.i(62965),s=e.i(22468),o=e.i(74080);let r=300,a=({opened:e})=>{let[t,l]=(0,n.useState)(!1),i=(0,n.useRef)(null),s=(0,n.useRef)(!1);return(0,n.useEffect)(()=>(e&&!s.current?(s.current=!0,l(!0)):!e&&s.current&&(i.current=setTimeout(()=>{s.current=!1,l(!1)},r)),()=>{i.current&&clearTimeout(i.current)}),[e]),{mounted:t}},c=(0,s.g)("click-outside","sc"),u=Object.freeze({overlay:`${c}__overlay`,open:`${c}--open`,close:`${c}--close`}),d=({onClose:e,onToucheMove:i,isOpen:s,delay:o=r})=>{let a=(0,n.useRef)(null),c=(0,n.useCallback)(()=>{e&&(a.current=setTimeout(()=>{e()},o))},[o,e]),d=(0,n.useCallback)(e=>{"Escape"===e.key&&c()},[c]);return(0,n.useEffect)(()=>(s&&window.addEventListener("keydown",d),()=>{a.current&&clearTimeout(a.current),window.removeEventListener("keydown",d)}),[s,d]),(0,t.jsx)("div",{className:(0,l.default)(u.overlay,{[u.open]:s,[u.close]:!s}),onTouchStart:i,onClick:c})},p=(e,t)=>{e&&(t?e.setAttribute("data-portal",""):e.removeAttribute("data-portal"))},m=e=>{e.classList.toggle("scroll-disable-windows",!1),e.style.removeProperty("overflow"),e.style.removeProperty("height"),e.style.removeProperty("width"),e.style.removeProperty("top")},h=()=>{void 0!==window.prevScrollPosition&&(window.scrollTo(0,window.prevScrollPosition),window.prevScrollPosition=void 0)},f=()=>document.querySelectorAll("[data-portal]").length>1,w=e=>{let t=(0,n.useRef)(null),l=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{if(l.current===e)return;l.current=e;let n=t.current,i=document.body,s=document.documentElement,o=window.innerWidth-s.clientWidth;if(e&&o>0)i.style.top||(window.prevScrollPosition=window.scrollY),s.style.setProperty("overflow-y","scroll"),i.classList.toggle("scroll-disable-windows",!0),i.style.setProperty("width",`calc(100vw - ${o}px)`),i.style.setProperty("top",`-${window.prevScrollPosition}px`),p(n,!0);else if(e)i.style.setProperty("overflow","hidden"),i.style.setProperty("height","100vh"),p(n,!0);else{let e=!f();e&&m(i),e&&h(),p(n,!1)}return()=>{let e=!f();e&&m(i),e&&h()}},[e]),t},g=(0,s.g)("drawer-footer","sc"),v=Object.freeze({footer:`${g}__footer`,hasScroll:`${g}__footer--has-scroll`}),x=({footer:e,hasScroll:n,className:i})=>(0,t.jsx)("div",{className:(0,l.default)(v.footer,{[v.hasScroll]:n},i),children:"function"==typeof e?e():e}),_=(0,s.g)("drawer-content","sc"),b=Object.freeze({container:`${_}__container`,open:`${_}--open`,close:`${_}--close`,header:`${_}__header`,rowHeader:`${_}__header--row`,title:`${_}__title`,center:`${_}__title--center`,left:`${_}__title--left`,right:`${_}__title--right`,controlContainer:`${_}__control-container`,content:`${_}__content`,footer:`${_}__footer`}),j=({onClose:e,onContentClick:s,children:o,title:r,rowTitle:a,titleAlign:c,isCloseable:u,footer:d,closeButton:p,isOpen:m,contentClassName:h,footerClassName:f,contentStyle:w,width:g})=>{let v=(0,n.useRef)(null),_=(0,n.useRef)(null),[j,C]=(0,n.useState)(!1);(0,n.useEffect)(()=>{var e;if(!_.current||!v.current)return;let t=(null==(e=null==_?void 0:_.current)?void 0:e.getBoundingClientRect().top)||0,n=null==v?void 0:v.current,l=()=>{let e=null==_?void 0:_.current;e&&C(()=>e.getBoundingClientRect().top!==t)};return n&&n.addEventListener("scroll",l,!1),()=>{null==n||n.removeEventListener("scroll",l,!1)}},[]);let y=w||g?{width:g,...w||{}}:void 0;return(0,t.jsxs)("div",{ref:v,style:y,className:(0,l.default)(b.container,{[b.open]:m,[b.close]:!m},h),children:[r||u?(0,t.jsxs)("div",{className:(0,l.default)(b.header,{[b.rowHeader]:a}),children:[u?p?"function"==typeof p?p():p:(0,t.jsx)("button",{type:"button",className:b.controlContainer,onClick:e,children:(0,t.jsx)(i.IconFdsCloseO,{size:24})}):null,r?(0,t.jsx)("h3",{className:(0,l.default)(b.title,{[b[c]]:!0}),children:r}):null]}):null,(0,t.jsx)("div",{ref:_,className:b.content,onClick:s,children:o}),d&&(0,t.jsx)(x,{className:(0,l.default)(b.footer,f),footer:d,hasScroll:j})]})},C=(0,s.g)("drawer-layout","sc"),y=Object.freeze({window:`${C}__window`}),N=({onClose:e,isOpen:i,children:s,withDisabledScroll:o,className:r,...a})=>{let c=(0,n.useCallback)(e=>e.stopPropagation(),[]);return w(i&&o),(0,t.jsxs)("div",{"data-portal":!0,className:(0,l.default)(y.window,r),children:[(0,t.jsx)(d,{onClose:e,isOpen:i,delay:0}),(0,t.jsx)(j,{onContentClick:c,onClose:e,isOpen:i,...a,children:s})]})},k=({isOpen:e=!1,children:n,titleAlign:l="center",isCloseable:i=!0,withDisabledScroll:s=!0,...o})=>{let{mounted:r}=a({opened:e});return r?(0,t.jsx)(N,{titleAlign:l,isCloseable:i,isOpen:e,withDisabledScroll:s,...o,children:n}):null};k.displayName="Drawer";let O=(0,s.g)("mobile-modal-footer","sc"),T=Object.freeze({footer:`${O}__footer`,footerWithoutShadow:`${O}__footer--without-shadow`}),$=({footer:e,isSmallPopup:n=!1,footerClassName:i})=>(0,t.jsx)("div",{className:(0,l.default)(T.footer,n&&T.footerWithoutShadow,i),children:"function"==typeof e?e():e}),S=(0,s.g)("mobile-popup","sc"),R=Object.freeze({mobilePopup:`${S}`,mobilePopupOpen:`${S}--open`,content:`${S}__content`,contentFull:`${S}__content--full`,contentTransition:`${S}__content--transition`,contentTransitionOpen:`${S}__content--transition-open`,contentLine:`${S}__content-line`,contentContainer:`${S}__content-container`,smallContentContainer:`${S}__content-container--small`,min:`${S}__content-container--min`,title:`${S}__title`,closeContainer:`${S}__close-container`,closeButton:`${S}__close-button`}),I=({children:e,footer:s,isOpen:o,isSmallPopup:r,onClose:a,hasCloseButton:c=!0,full:u,touchDistance:p=100,withDisabledScroll:m=!0,contentClassName:h,className:f,title:g,closeButton:v,footerClassName:x})=>{let[_,b]=(0,n.useState)(!1),[j,C]=(0,n.useState)(!1),[y,N]=(0,n.useState)(!0),[k,O]=(0,n.useState)("120%"),T=(0,n.useRef)(null),S=(0,n.useRef)(0),I=(0,n.useRef)(!1),A=e=>{var t,n,l;let i=null==(t=T.current)?void 0:t.offsetTop,s=null==(n=T.current)?void 0:n.offsetHeight;if(I.current=!0,N(!1),i&&s){let t=(null==(l=null==e?void 0:e.touches[0])?void 0:l.clientY)-i,n=0;t>=0&&t<=s+30&&(n=t),t>s+30&&(n=s+30),O(`${n}px`),S.current=n}},P=()=>{I.current&&(S.current>p&&a?null==a||a():O("0"),N(!0),I.current=!1),window.removeEventListener("touchmove",A),window.removeEventListener("touchend",P)};return(0,n.useEffect)(()=>{o&&setTimeout(()=>{b(!0),C(!0),O("0")},100),!o&&j&&(O("120%"),b(!1),C(!1))},[j,o]),w(o&&m),(0,t.jsxs)("div",{"data-portal":!0,className:(0,l.default)(R.mobilePopup,j&&R.mobilePopupOpen,f),children:[(0,t.jsx)(d,{onClose:()=>{o&&(null==a||a())},onToucheMove:()=>{o&&(b(!1),window.addEventListener("touchmove",A),window.addEventListener("touchend",P))},isOpen:o,delay:0}),(0,t.jsxs)("div",{className:(0,l.default)(R.content,u&&R.contentFull,y&&R.contentTransition,y&&_&&R.contentTransitionOpen),ref:T,style:{transform:`translateY(${k})`},children:[(0,t.jsx)("div",{className:R.contentLine}),(0,t.jsxs)("div",{className:(0,l.default)(R.contentContainer,r&&R.smallContentContainer,{[R.min]:!g&&!c},h),children:[!!g&&(0,t.jsx)("div",{className:R.title,children:g}),c?(0,t.jsx)("div",{className:R.closeContainer,children:c?v?"function"==typeof v?v():v:(0,t.jsx)("button",{onClick:a,className:R.closeButton,children:(0,t.jsx)(i.IconFdsCloseO,{size:24})}):null}):null,e]}),s&&(0,t.jsx)($,{footerClassName:x,isSmallPopup:r,footer:s})]})]})},A=({children:e,isSmallPopup:n=!1,isOpen:l=!1,...i})=>{let{mounted:s}=a({opened:l});return s?(0,t.jsx)(I,{isSmallPopup:n,isOpen:l,...i,children:e}):null};A.displayName="UiMobilePopup",e.s(["D",0,k,"P",0,({children:e,id:t="portal-root"})=>{let[l,i]=(0,n.useState)(null);return(0,n.useEffect)(()=>{let e=document.getElementById(t);if(e)return void i(e);let n=document.createElement("div");return n.id=t,document.body.appendChild(n),i(n),()=>{document.body.removeChild(n)}},[t]),l?(0,o.createPortal)(e,l):null},"U",0,A,"u",0,w])},24877,4529,e=>{"use strict";var t=e.i(43476),n=e.i(71645),l=e.i(62965);e.i(51966);var i=e.i(60491),s=e.i(64877);e.s(["Card",()=>s.h],4529);var s=s,o=e.i(12716),r=e.i(2305),a=e.i(85900),c=e.i(28133),u=e.i(77120),d=e.i(24359),p=e.i(22926);let m={userRegion:p.U,userTown:p.a,allRegions:"all_regions",lastRegionsUpdateUnixTimestamp:"lastRegionsUpdateUnixTimestamp",allRussiaSelected:"all_russia_selected"},h={userRegion:p.U,userTown:p.a,allRegions:"all_regions_new_api",lastRegionsUpdateUnixTimestamp:"lastRegionsUpdateUnixTimestamp_new_api",allRussiaSelected:"all_russia_selected"},f=(e=!1)=>e?h:m,w=(e,t=!1)=>{if(t){window.allRegionsNewApi=e;return}window.allRegions=e},g=(e,t,n=!1)=>{if(typeof document>"u")return;let l=f(n);if(!e&&!t){d.a.removeItem(l.userRegion),d.a.removeItem(l.userTown);return}d.a.setItem(l.userRegion,JSON.stringify(e)||"",{"max-age":31536e3}),d.a.setItem(l.userTown,JSON.stringify(t)||"",{"max-age":31536e3})},v=e=>{if(typeof document>"u")return null;let t=d.a.getItem(e)??void 0;if(!t||"undefined"===t)return null;try{return JSON.parse(decodeURIComponent(t))}catch{return null}},x=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 "${e}": ${t}`)}return null},_=(e=!1)=>{if(typeof window>"u")return[];let t=((e=!1)=>e?window.allRegionsNewApi:window.allRegions)(e);if(Array.isArray(t)&&t.length>0)return t;let n=x(f(e).allRegions)||[];return w(n,e),n},b=e=>e.some(e=>e.towns.some(e=>!!e.newId||!!e.fiasId)),j=e=>{let t={};return e.map(({id:e,name:n,towns:l})=>(l.forEach(l=>{l.parentId=e,t[l.name]=t[l.name]||{},t[l.name][l.id]=n}),l)).reduce((e,n)=>(n.forEach(e=>{Object.keys(t[e.name]).length>1&&(e.parentName=t[e.name][e.id])}),[...e,...n]),[])},C=(e,t)=>`${e.replace(/\/+$/,"")}${t}`,y=async e=>{try{return await (await fetch(e)).json()}catch(e){console.warn(e)}return null},N=(e,t=!1)=>{if(e.length<1)return;let n=f(t);w(e,t),window.localStorage.setItem(n.allRegions,JSON.stringify(e)),window.localStorage.setItem(n.lastRegionsUpdateUnixTimestamp,JSON.stringify(Date.now()))},k=(e,t,n)=>{let l=null,i=null;n&&e.some(e=>{let t=e.towns.find(e=>e.id===n.id)??null;return!!t&&(l=e,i=t,!0)});let s=t?e.find(e=>e.id===t.id)??null:null;return{region:l??s??t,town:i??n}},O=(e,t)=>!!(null!=e&&e.newId||null!=e&&e.fiasId||null!=t&&t.newId||null!=t&&t.fiasId),T=async()=>{let e=await y("https://finuslugi.ru/money_data/Root.json?short=1"),t=Array.isArray(null==e?void 0:e.regions)?e.regions:[];return N(t),t},$=async e=>{let t,n,[l,i]=await Promise.all([y(C(e,"/sc/api/v1/cities?all=true&isActive=true")),y(C(e,"/sc/api/v1/regions?all=true"))]);if(!Array.isArray(null==l?void 0:l.content)||!Array.isArray(null==i?void 0:i.content))return[];let s=l.content,o=(n=(t=i.content.filter(e=>e.isActive).map(e=>({id:e.geoRegionId,name:e.name,name_r:e.nameR,name_p:e.nameP,url:e.url,region_id:e.geoRegionId,enabled:+!!e.isActive,fiasId:e.fiasId,towns:[]}))).reduce((e,t)=>(e[t.id]=t,e),{}),s.forEach(e=>{let t=n[e.geoRegionId];t&&t.towns.push({id:e.legacyId,name:e.name,name_r:e.nameR,name_p:e.nameP,url:e.url,main:+!!e.isRegionalCenter,newId:e.id,fiasId:e.fiasId})}),t);return b(o)?(N(o,!0),o):[]},S=async({showcaseUrl:e="",useNewCitiesApi:t=!1}={})=>t?$(e):T(),R=async e=>{let t=null;try{t=await (await fetch(`${e}`,{method:"GET"})).json()}catch(e){console.warn(e)}return t||null},I=(e,t,n)=>{(0,c.h)({eventCategory:"finkit-widgets-sc-city-select",eventActionType:e,eventActionText:t,eventLabel:n})};var A=e.i(22468),P=e.i(96795),L=e.i(89121);let E=_(),B=j(E),U={regions:E,towns:B,region:null,town:null,startPopupVisible:!1,setStartPopupVisible:()=>null,popupVisible:!1,handleToggleModal:()=>null,selectCity:()=>null,handleButtonClick:()=>null,startRegion:null,startTown:null},M=(0,n.createContext)(U);function z(){return(0,n.useContext)(M)}let D=()=>{let e=(0,n.useRef)(null),t=(0,n.useCallback)(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),l=(0,n.useCallback)((t,n)=>{e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{e.current=null,t()},n)},[]);return(0,n.useEffect)(()=>t,[t]),{start:l,clear:t,pending:!!e.current}},F=(0,A.g)("city-select-modal-body","sc"),W=Object.freeze({wrapper:`${F}__wrapper`,subtitle:`${F}__subtitle`,hintWrapper:`${F}__hint-wrapper`,hintText:`${F}__hint-text`,input:`${F}__input`,chips:`${F}__chips`,townsListWrapper:`${F}__towns-list-wrapper`,townsList:`${F}__towns-list`,townsGroup:`${F}__towns-group`,townsGroupLabel:`${F}__towns-group-label`,townsGroupList:`${F}__towns-group-list`,townsName:`${F}__towns-name`,regionName:`${F}__region-name`}),V=({groupedTowns:e,chips:i,query:s,setQuery:r,isDrawer:a})=>{var u;let d=z(),p=(0,n.useRef)(null),[m,h]=(0,n.useState)("10000px");(0,n.useEffect)(()=>{if(!a||!p.current)return;let e=e=>e.reduce((e,t)=>e+t,0),t=(n,l)=>{let i=n.map(e=>[...e]),s=i.map(e),o=s.reduce((e,t,n)=>t<s[e]?n:e,0);0===o&&i[0].push(i[1].shift()),2===o&&i[2].unshift(i[1].pop()),1===o&&s[0]>s[2]&&i[1].unshift(i[0].pop()),1===o&&s[0]<s[2]&&i[1].push(i[2].shift());let r=Math.max(...i.map(e));return r>=l?l:t(i,r)};new ResizeObserver(()=>{var e;if(!(null!=(e=p.current)&&e.children))return;let n=Array.from(p.current.children,e=>e.offsetHeight+32);if(0===n.length)return;let l=0;try{l=t([[],n,[]],1/0)}catch{l=0}l>0&&h(`${l}px`)}).observe(p.current)},[]);let f=e=>{if(I(c.D.button,(null==e?void 0:e.name)||"Вся Россия"),!(null!=e&&e.id))return d.selectCity();let t=d.regions.find(t=>t.id===Number(e.parentId))||null;d.selectCity(t,e)};return(0,t.jsxs)("div",{className:W.wrapper,children:[(0,t.jsxs)("div",{className:W.subtitle,children:["Покажем предложения рядом с вами",(0,t.jsxs)("div",{className:W.hintWrapper,children:[(0,t.jsx)(l.IconFdsQuestionCircleO,{size:24}),(0,t.jsx)("div",{className:W.hintText,children:"Укажите свой город, чтобы увидеть предложения, доступные в вашем регионе"})]})]}),(0,t.jsx)(o.InputBase,{className:W.input,value:s,onChange:r,size:"s",placeholder:"Введите название города",icon:s?(0,t.jsx)(l.IconFdsCloseCircleO,{size:24,onClick:()=>r("")}):(0,t.jsx)(l.IconFdsSearchO,{size:24})}),(0,t.jsx)(o.Chips,{className:W.chips,chips:i,value:(null==(u=d.town)?void 0:u.id)||0,onChipClick:e=>{f(d.towns.find(t=>t.id===e))}}),(0,t.jsx)("div",{className:W.townsListWrapper,children:(0,t.jsx)("div",{ref:p,className:W.townsList,style:{maxHeight:m},children:e.map(e=>(0,t.jsxs)("div",{className:W.townsGroup,children:[(0,t.jsx)("div",{className:W.townsGroupLabel,children:e.letter}),(0,t.jsx)("div",{className:W.townsGroupList,children:e.towns.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>f(e),children:[(0,t.jsx)("div",{className:W.townsName,children:e.name}),(0,t.jsx)("div",{className:W.regionName,children:e.parentName})]},e.id))})]},e.letter))})})]})},H=[1095,1096,134,720,189,180],G=()=>{var e;let l=z(),i=(0,o.useBreakpointUp)("l"),[s,r]=(0,n.useState)(""),a=`Ваш выбор: ${(null==(e=l.town)?void 0:e.name)||"Вся Россия"}`,d=(0,n.useMemo)(()=>l.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,l.towns.length]),p=(0,n.useMemo)(()=>[{id:0,label:"Вся Россия"},...H.map(e=>{let t=l.towns.find(t=>t.id===e);return{id:null==t?void 0:t.id,label:null==t?void 0:t.name}}).filter(e=>(null==e?void 0:e.id)!==void 0)],[l.towns.length]),m=()=>{I(c.D.button,"close"),l.handleToggleModal(!1)};return(0,t.jsxs)(u.P,{children:[!i&&(0,t.jsx)(u.U,{title:a,isOpen:l.popupVisible,onClose:m,full:!0,children:(0,t.jsx)(V,{groupedTowns:d,chips:p,query:s,setQuery:r})}),i&&(0,t.jsx)(u.D,{title:a,isOpen:l.popupVisible,onClose:m,width:"856px",rowTitle:!0,titleAlign:"left",children:(0,t.jsx)(V,{groupedTowns:d,chips:p,query:s,setQuery:r,isDrawer:!0})})]})},J={"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"},q=(0,n.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},headerRef:{current:null}});function Q(){return(0,n.useContext)(q)}let Y=e=>{let[l,i]=(0,n.useState)(!1),[s,o]=(0,n.useState)(!1),[r,a]=(0,n.useState)(!!e.isMainBannerPage),{isChatModalOpen:c,setIsChatModalOpen:d,isChatLoading:p}=(()=>{let[e,t]=(0,n.useState)(!1),[l,i]=(0,n.useState)(!1),s=(0,n.useRef)(!1),o=e=>{s.current=e,i(e)};return(0,n.useEffect)(()=>{if(typeof window>"u")return;let e=(()=>{let{hostname:e}=window.location;return Object.prototype.hasOwnProperty.call(J,e)?J[e]:J["finuslugi.ru"]})(),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 l=null;window.supportWidget&&window.supportWidget.craftTalk&&(window.supportWidget.craftTalk.open=()=>new Promise((i,r)=>{var a,c;let u,d;s.current?r(Error("chat is already opened")):l?(l.openWidget(),t(!1),i()):(o(!0),window.getWebChatCraftTalkExternalControl=e=>{var n;l=e;let s=document.querySelector(".webchat");s&&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)}})}).observe(s,{attributes:!0,attributeFilter:["style"]}),null!=(n=window.supportWidget)&&n.craftTalk&&(window.supportWidget.craftTalk.close=l.closeWidget),null==l||l.openWidget(),o(!1),t(!1),i()},a=e,c=n,(u=document.createElement("link")).rel="stylesheet",u.type="text/css",u.href=`${a}/assets/css/${c}`,document.head.appendChild(u),(d=document.createElement("script")).src=`${a}/get-bootstrap/${c}`,d.defer=!0,document.body.appendChild(d))}),window.supportWidget.craftTalk.toggle=()=>{var e,t,n,l;null!=(t=null==(e=window.supportWidget)?void 0:e.craftTalk)&&t.isOpened?window.supportWidget.craftTalk.close():null==(l=null==(n=window.supportWidget)?void 0:n.craftTalk)||l.open()})},[]),{isChatModalOpen:e,setIsChatModalOpen:t,isChatLoading:l}})(),[m,h]=(0,n.useState)(null),[f,w]=(0,n.useState)(null),[g,v]=(0,n.useState)(!1),[x,_]=(0,n.useState)(!1),[b,j]=(0,n.useState)(!1),C=(0,n.useRef)(null),y=(0,u.u)(g),N=(0,n.useRef)(null),k=(0,n.useRef)(null),O=(0,n.useRef)(null),T=(0,n.useRef)(null),$=(0,n.useCallback)(()=>{y.current&&y.current.scrollTo({top:0})},[y]),S=(0,n.useCallback)(e=>{w(e),$()},[$]),R=(0,n.useCallback)(e=>{N.current&&clearTimeout(N.current),e&&_(!0),e||(N.current=setTimeout(()=>{_(!1),S(null)},300))},[S]),I=(0,n.useCallback)((e,t,n)=>{if(t&&S(t),!n&&e===m||!e){R(!g),v(!g);return}h(e),R(!0),v(!0)},[m,S,g,R]),A=(0,n.useCallback)(()=>{k.current&&clearTimeout(k.current),j(!0),k.current=setTimeout(()=>{j(!1)},650)},[]);return(0,n.useEffect)(()=>{i(!!document.cookie.includes("auth.gtm_customer_id"));let t=(0,P.s)(o,a,e.isMainBannerPage);return(0,P.i)(),t},[]),(0,t.jsx)("header",{children:(0,t.jsx)(q.Provider,{value:{isAuth:l,isHeaderHidden:s,isHeaderTransparent:r,openedBlock:m,setOpenedBlock:I,openedSection:f,setOpenedSection:S,isNavigationOpen:g,isNavigationMounted:x,navMenuItemsRef:C,navigationRef:y,ignoreClicks:b,setIgnoreClicks:A,isChatModalOpen:c,setIsChatModalOpen:d,isChatLoading:p,fixedContainerRef:O,headerRef:T},children:e.children})})},K=({label:e,onClick:n,eventActionText:l,eventLabel:i,...s})=>(0,t.jsx)(o.Button,{label:e,onClick:e=>{null==n||n(e),(0,c.h)({eventCategory:p.H,eventActionType:c.D.button,eventActionText:l||"",eventLabel:i||""})},...s}),X=(0,A.g)("header-popup","sc"),Z=Object.freeze({popup:`${X}__popup`,popupHeader:`${X}__popup-header`,popupClose:`${X}__popup-close`,body:`${X}__body`}),ee=({isOpen:e,onClose:n,children:i,title:s})=>{let r=(0,o.useBreakpointUp)("l");return(0,t.jsxs)(u.P,{children:[!r&&(0,t.jsx)(u.U,{title:s,isOpen:e,onClose:n,children:i}),r&&e&&(0,t.jsxs)("div",{className:Z.popup,children:[(0,t.jsxs)("div",{className:Z.popupHeader,children:[s,(0,t.jsx)(K,{className:Z.popupClose,iconLeft:(0,t.jsx)(l.IconFdsCloseO,{}),shape:"icon",appearance:"ghost",size:"xs",onClick:n,eventActionText:"IconFdsCloseO"})]}),(0,t.jsx)("div",{className:Z.body,children:i})]})]})},et=(0,A.g)("start-choice-popup","sc"),en=Object.freeze({top:`${et}__top`,progress:`${et}__progress`,innerCircle:`${et}__inner-circle`,title:`${et}__title`,subtitle:`${et}__subtitle`,actions:`${et}__actions`}),el=()=>{var e,l;let i=z(),[s,o]=(0,n.useState)(10),[r,a]=(0,n.useState)(0),u=(0,n.useRef)(void 0),d=()=>{I(c.D.button,"close_choose_popup"),window.localStorage.setItem("auto_town",JSON.stringify(i.startTown)||""),window.localStorage.setItem("auto_region",JSON.stringify(i.startRegion)||""),i.setStartPopupVisible(!1)};return(0,n.useEffect)(()=>{let e,t,n,l;i.startPopupVisible?(t=1e3*(e=Number((" "+s).slice(1)))/100,n=0,l=0,u.current=setInterval(()=>{n++,l+=t,a(3.6*n);let i=e-Math.floor(l/1e3);i<s&&o(i),100===n&&(clearInterval(u.current),d())},t)):(clearInterval(u.current),o(10),a(0))},[i.startPopupVisible]),(0,t.jsxs)(ee,{isOpen:i.startPopupVisible,onClose:d,title:(0,t.jsx)("button",{type:"button",className:en.progress,style:{background:`conic-gradient(#ff0508 ${r}deg, #e3e7ec 0deg)`},onClick:d,children:(0,t.jsx)("div",{className:en.innerCircle,children:s})}),children:[(0,t.jsxs)("div",{className:en.top,children:[(0,t.jsxs)("div",{className:en.title,children:["Ваш город ",(null==(e=i.startTown)?void 0:e.name)||(null==(l=i.startRegion)?void 0:l.name)||"Вся Россия","?"]}),(0,t.jsx)("div",{className:en.subtitle,children:"Это поможет вам увидеть выгодные предложения в вашем городе"})]}),(0,t.jsxs)("div",{className:en.actions,children:[(0,t.jsx)(K,{size:"s",stretch:!0,eventActionText:"Да, все верно",onClick:()=>{I(c.D.button,"Да, все верно"),i.selectCity(i.startRegion,i.startTown)},children:"Да, все верно"}),(0,t.jsx)(K,{variant:"secondary",size:"s",stretch:!0,eventActionText:"Нет, изменить",onClick:()=>{I(c.D.button,"Нет, изменить"),i.setStartPopupVisible(!1),i.handleToggleModal(!0)},children:"Нет, изменить"})]})]})},ei=(0,A.g)("city-select","sc"),es=Object.freeze({button:`${ei}__button`,minimal:`${ei}__minimal`,full:`${ei}__full`}),eo=({initialTown:e})=>{var i;let s=z(),a=(null==(i=s.town)?void 0:i.name)||e||"Вся Россия",{setIsChatModalOpen:c,isChatModalOpen:u}=Q(),{startPopupVisible:d,setStartPopupVisible:p,popupVisible:m}=s,h=(0,n.useRef)();(0,n.useEffect)(()=>{m&&(h.current="popup")},[m]),(0,n.useEffect)(()=>{u&&(h.current="chat")},[u]),(0,n.useEffect)(()=>{d&&(h.current="startPopup")},[d]),(0,n.useEffect)(()=>{h.current&&("chat"===h.current&&d?p(!1):["startPopup","popup"].includes(h.current)&&u&&c(!1))},[m,u,d,p,c]);let f={appearance:"ghost",size:"xs",onClick:()=>s.handleButtonClick(!1),iconLeft:(0,t.jsx)(l.IconFdsLocationO,{size:24})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Button,{...f,className:(0,r.default)(es.button,es.full),label:a}),(0,t.jsx)(o.Button,{...f,className:(0,r.default)(es.button,es.minimal),shape:"icon"}),(0,t.jsx)(G,{}),(0,t.jsx)(el,{})]})},er=({onClick:e,eventActionType:n,eventActionText:l,eventLabel:i,...s})=>(0,t.jsx)(o.Link,{onClick:t=>{null==e||e(t),(0,c.h)({eventCategory:p.H,eventActionType:n||c.D.link,eventActionText:l||"",eventLabel:i||""})},...s}),ea=(0,A.g)("header-mobile-app-banner","sc"),ec=Object.freeze({wrapper:`${ea}__wrapper`,container:`${ea}__container`,closeButton:`${ea}__close-button`,innerWrapper:`${ea}__inner-wrapper`,imageWrapper:`${ea}__image-wrapper`,image:`${ea}__image`,title:`${ea}__title`,description:`${ea}__description`,callToAction:`${ea}__call-to-action`,scanQr:`${ea}__scan-qr`}),eu=Object.freeze({mobile:56,desktop:68}),ed="headerBannerShownAt",ep=({minioUrl:e,className:s,mobileAppUrl:u})=>{let{fixedContainerRef:d,headerRef:m}=Q(),[h,f]=(0,n.useState)(!1),[w,g]=(0,n.useState)(!1),[v,x]=(0,n.useState)(!1),_=(0,n.useCallback)((e="desktop")=>{let t=d.current;t&&(t.style.transform="translateY(0)",document.documentElement.style.setProperty("--fixed-header-height",`${eu[e]+p.F[e]}px`),document.documentElement.style.setProperty("--new-header-height-desktop",`${eu.desktop+p.F.desktop}px`),document.documentElement.style.setProperty("--new-header-height-mobile",`${eu.mobile+p.F.mobile}px`),document.documentElement.style.setProperty("--static-new-header-height-mobile",`${eu.mobile+p.F.mobile}px`),document.documentElement.style.setProperty("--static-new-header-height-desktop",`${eu.desktop+p.F.desktop}px`),document.documentElement.style.setProperty("--header-height",`${eu[e]+108}px`))},[]),b=(0,n.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,n.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{w&&f(!1),x(!1)};return e.addEventListener("transitionend",t),()=>{e.removeEventListener("transitionend",t)}},[w]),(0,n.useEffect)(()=>{let e;(!(e=(()=>{let e=localStorage.getItem(ed);if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t})())||Math.floor((e.getTime()-new Date().getTime())/864e5)>5)&&f(!0)},[]),(0,n.useEffect)(()=>{let e=window.innerWidth<768;h&&(_(e?"mobile":"desktop"),window.matchMedia("(prefers-reduced-motion: reduce)").matches?f(!0):x(!0));let t=()=>{if(!h)return null;_(window.innerWidth<768?"mobile":"desktop")};return window.addEventListener("resize",t),()=>{b(),window.removeEventListener("resize",t)}},[h,_,b]),h?(0,t.jsx)("div",{id:"headerNotice",role:"region","aria-label":"Мобильное приложение","data-opening":v,className:(0,r.default)(ec.wrapper,s),children:(0,t.jsx)(i.Container,{children:(0,t.jsxs)("div",{className:ec.container,children:[(0,t.jsxs)("div",{className:ec.innerWrapper,children:[(0,t.jsxs)("picture",{className:ec.imageWrapper,children:[(0,t.jsx)("source",{srcSet:(0,a.joinURL)(e,"/widgets/header/qr-mobile-app.svg"),media:"(min-width: 768px)"}),(0,t.jsx)("img",{className:ec.image,src:(0,a.joinURL)(e,"/logo/finuslugi/default-regular.svg")})]}),(0,t.jsxs)("div",{className:ec.scanQr,children:[(0,t.jsx)("div",{className:ec.title,children:"Скачайте приложение Финуслуги"}),(0,t.jsx)("div",{className:ec.description,children:"Сканируйте QR-код"})]}),(0,t.jsxs)("div",{className:ec.callToAction,children:[(0,t.jsxs)("div",{children:["Приложение",(0,t.jsx)("br",{}),"Финуслуги"]}),(0,t.jsx)(o.Button,{onClick:()=>{(0,P.h)(c.D.button,"skachat_mob_prilozheniye_fu"),window.open(u,"_blank","noreferrer")},variant:"white",size:"xs",children:"Скачать"})]})]}),(0,t.jsx)("div",{"aria-label":"Закрыть",role:"button",className:ec.closeButton,onClick:()=>{localStorage.setItem(ed,new Date().toISOString()),b(),window.matchMedia("(prefers-reduced-motion: reduce)").matches?f(!1):g(!0)},children:(0,t.jsx)(l.IconFdsCloseO,{size:"100%"})})]})})}):null},em=(0,A.g)("header-chat-modal-body","sc"),eh=Object.freeze({wrapper:`${em}__wrapper`,cardButton:`${em}__card-button`,card:`${em}__card`,cardTitle:`${em}__card-title`,cardSubtitle:`${em}__card-subtitle`,button:`${em}__button`}),ef=()=>{let e=Q();return(0,t.jsxs)("div",{className:eh.wrapper,children:[(0,t.jsx)(K,{className:eh.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,t.jsxs)(s.h,{className:eh.card,variant:"secondary",children:[(0,t.jsxs)("div",{className:eh.cardTitle,children:[(0,t.jsx)("img",{src:"https://finuslugi.ru/icons/chaticons/new/chat_icon_hover.svg",alt:"chat",width:24,height:24,loading:"lazy"}),"Напишите в чат"]}),(0,t.jsxs)("p",{className:eh.cardSubtitle,children:["Виртуальный ассистент доступен 24/7, ",(0,t.jsx)("br",{}),"операторы — с 6:00 до 23:59 мск"]})]})}),!1]})},ew=({data:e,isMobile:i})=>{let s=Q();return(0,t.jsx)("div",{className:L.s.contentWrapper,children:e.map(e=>(0,t.jsx)(n.Fragment,{children:e.sections.map(e=>{var n;return(0,t.jsxs)("div",{className:(0,r.default)(L.s.content,{[L.s.hidden]:s.openedSection!==e.id,[L.s.contentOpen]:!!s.openedSection}),children:[(0,t.jsx)("div",{className:L.s.contentHeader,children:(0,t.jsx)("label",{children:e.title})}),null==(n=e.content)?void 0:n.map((n,s)=>{var o,a;return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("a",{className:(0,r.default)(L.s.contentTitle,{[L.s.removed]:!n.title,[L.s.contentTitleUrl]:!!n.url,[L.s.contentTitleLink]:!!e.isSeeAllLinkAvailable,[L.s.contentTitleNew]:!!n.new}),href:e.isSeeAllLinkAvailable?n.url:void 0,children:(0,t.jsxs)("span",{children:[e.isSeeAllLinkAvailable&&(0,t.jsx)("div",{className:L.s.arrowIcon,children:(0,t.jsx)(l.IconFdsArrowUpRightSmallO,{})}),n.title]})})}),!(null!=(o=n.links)&&o.length)&&(0,t.jsx)(L.N,{items:n.chips||[],maxNumberOfLines:e.content.length<=1?99:i?3:2}),!!(null!=(a=n.links)&&a.length)&&(0,t.jsx)("div",{className:(0,r.default)(L.s.links,{[L.s.linksColumns]:!!n.columns,[L.s.linksTitleless]:!n.title}),children:n.links.map(e=>(0,t.jsxs)("a",{href:e.url,onClick:()=>(0,P.h)(c.D.link,e.title,`${e.title}_${e.url}`),children:[(0,t.jsx)("div",{className:L.s.arrowIcon,children:(0,t.jsx)(l.IconFdsArrowUpRightSmallO,{})}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{children:e.title}),!!e.new&&(0,t.jsx)("span",{className:(0,r.default)({[L.s.newInline]:!!e.new})})]})]},e.url))})]},`${n.url}_${s}`)})]},e.id)})},e.id))})},eg=(0,A.g)("navigation-section-icon","sc"),ev=Object.freeze({icon:`${eg}`}),ex=({name:e,background:i})=>{let s=(0,n.useMemo)(()=>e&&l[e]||null,[e]);return e&&s?(0,t.jsx)("div",{className:ev.icon,style:{background:i},children:(0,t.jsx)(s,{})}):null},e_=(0,A.g)("navigation","sc"),eb=Object.freeze({navigation:`${e_}`,navigationOpening:`${e_}--opening`,navigationClosing:`${e_}--closing`,wrapper:`${e_}__wrapper`,container:`${e_}__container`,containerOpen:`${e_}__container--open`,sections:`${e_}__sections`,sectionsOpen:`${e_}__sections--open`,citySelectButton:`${e_}__city-select-button`,sectionsTitle:`${e_}__sections-title`,sectionsWrapper:`${e_}__sections-wrapper`,section:`${e_}__section`,sectionArrow:`${e_}__section-arrow`,sectionExtra:`${e_}__section--extra`,sectionActive:`${e_}__section--active`,sectionTitle:`${e_}__section-title`,chatWrapper:`${e_}__chat-wrapper`,chatHeader:`${e_}__chat-header`,backButton:`${e_}__back-button`,useful:`${e_}__useful`,usefulOpen:`${e_}__useful--open`,usefulTitle:`${e_}__useful-title`,usefulGrid:`${e_}__useful-grid`,removed:`${e_}__removed`}),ej=({data:e})=>{var s;let a=Q(),u=z(),d=(0,o.useBreakpointDown)("m"),[m,h]=(0,n.useState)(!0);(0,n.useEffect)(()=>{h(d)},[d]);let f=(0,n.useRef)(null),w=(0,n.useCallback)(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>a.openedSection?a.setOpenedSection(null):a.isNavigationOpen?a.setOpenedBlock(null):void 0,50)},[a]),g=(0,n.useRef)(!1),v=(0,n.useRef)(null),x=(0,n.useCallback)(()=>{m&&(g.current=!0,v.current=window.onpopstate||null,window.onpopstate=function(){window.history.forward(),w()},window.history.pushState(null,"",window.location.href))},[w,m]),_=(0,n.useCallback)(()=>{g.current=!1,window.onpopstate=v.current,window.history.go(-1)},[]),b=(0,n.useRef)(null),j=(0,n.useCallback)(e=>{if(m||!a.navMenuItemsRef.current||!a.navigationRef.current)return;let t=e.target,n=!a.navMenuItemsRef.current.contains(t)&&!a.navigationRef.current.contains(t);if(n&&!b.current){a.setIgnoreClicks(),b.current=setTimeout(()=>a.setOpenedBlock(null),300);return}!n&&b.current&&(clearTimeout(b.current),b.current=null)},[m,a]),C=(0,n.useRef)(null),y=(0,n.useCallback)(e=>{typeof window>"u"||(e?(C.current=j,window.addEventListener("mousemove",C.current)):C.current&&window.removeEventListener("mousemove",C.current))},[j]);(0,n.useEffect)(()=>{y(a.isNavigationOpen),a.isNavigationOpen&&!g.current&&x(),!a.isNavigationOpen&&g.current&&_()},[a.isNavigationOpen]);let N=(e,t)=>()=>{(0,P.h)(c.D.button,t),a.setOpenedSection(e)},{start:k,clear:O}=D(),T=()=>{m||O()};return(0,t.jsx)("div",{ref:a.navigationRef,className:(0,r.default)(eb.navigation,{[eb.removed]:!a.isNavigationMounted,[eb.navigationOpening]:a.isNavigationOpen,[eb.navigationClosing]:!a.isNavigationOpen}),children:(0,t.jsx)("div",{className:eb.wrapper,children:(0,t.jsxs)(i.Container,{className:(0,r.default)(eb.container,{[eb.containerOpen]:!!a.openedSection}),children:[(0,t.jsxs)("div",{className:(0,r.default)(eb.sections,{[eb.sectionsOpen]:!!a.openedSection}),children:[(0,t.jsx)(o.Button,{className:eb.citySelectButton,variant:"purple",appearance:"ghost",size:"xs",onClick:()=>u.handleButtonClick(!1),iconLeft:(0,t.jsx)(l.IconFdsLocationO,{size:24}),label:(null==(s=u.town)?void 0:s.name)||"Вся Россия"}),e.map(e=>(0,t.jsxs)("ul",{className:(0,r.default)(eb.sectionsWrapper,{[eb.removed]:a.openedBlock!==e.id&&!m}),children:[(0,t.jsx)("div",{className:eb.sectionsTitle,children:p.b[e.id]}),e.sections.map(e=>{let n,i;return(0,t.jsxs)("li",{className:(0,r.default)(eb.section,{[eb.sectionExtra]:!!e.extra,[eb.sectionActive]:a.openedSection===e.id}),onClick:N(e.id,e.title),onMouseEnter:(n=e.id,i=e.title,()=>{m||k(N(n,i),150)}),onMouseLeave:T,children:[(0,t.jsx)(ex,{name:e.uikitIcon,background:e.uikitIconBg}),(0,t.jsx)("span",{className:eb.sectionTitle,children:e.title}),(0,t.jsx)("div",{className:eb.sectionArrow,children:(0,t.jsx)(l.IconFdsChevronRightSmallO,{size:24})})]},e.id)})]},e.id)),(0,t.jsxs)("div",{className:eb.chatWrapper,children:[(0,t.jsx)("div",{className:eb.chatHeader,children:"Нужна помощь?"}),(0,t.jsx)(ef,{})]})]}),(0,t.jsxs)("button",{type:"button",className:(0,r.default)(eb.backButton,{[eb.removed]:!a.openedSection}),onClick:()=>{(0,P.h)(c.D.button,"Назад"),a.setOpenedSection(null)},children:[(0,t.jsx)(l.IconFdsChevronLeftO,{size:24}),(0,t.jsx)("span",{children:"Назад"})]}),(0,t.jsx)(ew,{data:e,isMobile:m}),(0,t.jsxs)("div",{className:(0,r.default)(eb.useful,{[eb.usefulOpen]:!!a.openedSection}),children:[(0,t.jsx)("div",{className:eb.usefulTitle,children:"Полезное на Финуслугах"}),e.map(e=>(0,t.jsx)(n.Fragment,{children:e.sections.map(e=>{var n;return(0,t.jsx)("div",{className:(0,r.default)(eb.usefulGrid,{[eb.removed]:a.openedSection!==e.id}),children:null==(n=e.useful)?void 0:n.map((e,n)=>(0,t.jsxs)("a",{href:e.url,onClick:()=>(0,P.h)(c.D.link,e.title,`${e.title}_${e.url}`),children:[(0,t.jsx)("div",{children:(0,t.jsx)("img",{src:e.icon,srcSet:e.icon2?`${e.icon}, ${e.icon2} 2x`:void 0,alt:e.title,loading:"lazy"})}),(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:e.title}})]},`${e.title}_${n}`))},e.id)})},e.id))]})]})})})},eC=({data:e,showcaseUrl:s="https://finuslugi.ru",minioUrl:u="https://assets.finuslugi.ru/mp-assets",lkUrl:d="https://lk.finuslugi.ru/registration",initialTown:m,isMainBannerPage:h,enableAppHeaderBanner:f=!1,news:w,className:g})=>{let v=Q(),x=(0,n.useMemo)(()=>((e,t,n)=>{var l,i,s,o,r,c,u;let d=(null==(i=null==(l=null==e?void 0:e.NAVIGATOR)?void 0:l.findIndex)?void 0:i.call(l,({id:e})=>"news"===e))||-1,p=(null==(o=null==(s=null==e?void 0:e.NAVIGATOR)?void 0:s[d])?void 0:o.content)||[];if(null!=(u=null==(c=null==(r=null==e?void 0:e.NAVIGATOR)?void 0:r[d])?void 0:c.content)&&u[0]&&Array.isArray(n)&&p.length){let l=n.map(({title:e,url:n})=>({title:e,url:(0,a.joinURL)(t||"",n),new:0}));e.NAVIGATOR[d].content[0].links=l}return[{id:"FINPRODUCTS",sections:Array.isArray(null==e?void 0:e.FINPRODUCTS)?null==e?void 0:e.FINPRODUCTS:[]},{id:"NAVIGATOR",sections:Array.isArray(null==e?void 0:e.NAVIGATOR)?null==e?void 0:e.NAVIGATOR:[]},{id:"ABOUT",sections:Array.isArray(null==e?void 0:e.ABOUT)?null==e?void 0:e.ABOUT:[]}]})(e,s,w),[e,s,w]),_=null==e?void 0:e.config,b=(0,n.useMemo)(()=>x.reduce((e,t)=>{var n;return e[t.id]=null==(n=t.sections[0])?void 0:n.id,e},{}),[x]),j=v.isAuth?"Личный кабинет":"Войти",C=h&&v.isHeaderTransparent,y=(e,t,n,l)=>()=>{e!==v.openedBlock?(0,P.h)(c.D.toggle,t,"on"):(0,P.h)(c.D.button,"menu_close","on");let i=n?b[e]:"";v.setOpenedBlock(e,i,!!l)},{start:N,clear:k}=D(),O=e=>()=>{v.ignoreClicks||e()};return e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:v.headerRef,className:(0,r.default)(p.s.header,g,{[p.s.transparent]:C}),children:(0,t.jsxs)("div",{ref:v.fixedContainerRef,className:(0,r.default)(p.s.fixed,{[p.s.hidden]:v.isHeaderHidden,[p.s.navigationOpen]:v.isNavigationOpen}),children:[!!(null!=_&&_.appBannerUrl)&&f&&(0,t.jsx)(ep,{mobileAppUrl:_.appBannerUrl,minioUrl:u}),(0,t.jsxs)(i.Container,{className:p.s.container,children:[(0,t.jsxs)("div",{className:p.s.leftRow,children:[(0,t.jsx)(er,{className:p.s.logo,href:s,eventActionType:c.D.icon,eventActionText:"finuslugi_logo",eventLabel:`finuslugi_logo_${s}`,children:(0,t.jsxs)("picture",{children:[(0,t.jsx)("source",{srcSet:(0,a.joinURL)(u,"/widgets/header/logo/d.webp"),media:"(min-width: 768px)"}),(0,t.jsx)("img",{src:(0,a.joinURL)(u,"/widgets/header/logo/m.webp"),alt:"Финуслуги",loading:"eager"})]})}),(0,t.jsx)("nav",{ref:v.navMenuItemsRef,className:p.s.menuItems,children:(0,t.jsx)("ul",{children:p.c.map(({id:e,label:n})=>(0,t.jsx)("li",{children:(0,t.jsx)(o.Button,{className:(0,r.default)({[p.s.menuItemActive]:v.openedBlock===e&&v.isNavigationOpen}),label:n,variant:"white",size:"xs",onClick:O(y(e,n,!0)),onMouseEnter:()=>{v.isNavigationOpen&&e===v.openedBlock||v.setIgnoreClicks(),N(y(e,n,!0,!0),200)},onMouseLeave:k})},e))})}),(0,t.jsx)(K,{className:(0,r.default)(p.s.tabletMenuButton,{[p.s.menuItemActive]:v.isNavigationOpen}),eventActionText:"Меню сайта",variant:"white",size:"xs",iconRight:(0,t.jsx)(l.IconFdsChevronDownO,{size:24}),onClick:y("FINPRODUCTS","Меню сайта"),children:"Меню сайта"})]}),(0,t.jsxs)("div",{className:(0,r.default)(p.s.buttonGroup,{[p.s.whiteIcons]:(null==_?void 0:_.iconColorOnMobileMainBanner)==="white"}),children:[(0,t.jsxs)("div",{className:p.s.chips,children:[(0,t.jsx)(K,{as:"a",href:d,size:"xs",shape:"icon",appearance:"ghost",eventActionText:"profile",eventLabel:`profile_${d}`,iconLeft:(0,t.jsx)(l.IconFdsUserO,{size:20})}),(0,t.jsx)(K,{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,t.jsx)(l.IconFdsChatDotsCircleO,{size:24})})]}),(0,t.jsx)(K,{className:p.s.menuButton,size:"xs",shape:C?"icon":"default",appearance:C?"ghost":"fill",label:"Меню",onClick:y("FINPRODUCTS","Меню"),eventActionText:"Меню",iconLeft:(0,t.jsx)(l.IconFdsMenuSkewedO,{size:24})}),(0,t.jsxs)("div",{className:p.s.moreButtons,children:[(0,t.jsx)(eo,{initialTown:m}),(0,t.jsx)(K,{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",appearance:"ghost",eventActionText:"IconFdsChatDotsSquareAddO",iconLeft:(0,t.jsx)(l.IconFdsChatDotsSquareAddO,{size:24}),children:"Онлайн чат"}),(0,t.jsx)(K,{as:"a",href:d,size:"xs",eventActionText:j,eventLabel:`${j}_${d}`,label:j})]})]}),(0,t.jsxs)(er,{className:p.s.auth,href:d,eventActionText:j,eventLabel:`${j}_${d}`,children:[(0,t.jsx)(K,{size:"xs",shape:"circle-icon",iconLeft:(0,t.jsx)(l.IconFdsUserO,{}),eventActionText:j,eventLabel:`${j}_${d}`}),(0,t.jsx)("p",{children:j})]}),(0,t.jsx)("div",{className:p.s.close,children:(0,t.jsx)(K,{className:p.s.close,size:"xs",variant:"secondary",shape:"circle-icon",iconLeft:(0,t.jsx)(l.IconFdsCloseO,{}),onClick:()=>v.setOpenedBlock(null),eventActionText:"IconFdsCloseO"})})]})]})}),(0,t.jsx)("div",{className:(0,r.default)(p.s.overlay,{[p.s.removed]:!v.isNavigationMounted,[p.s.overlayOpening]:v.isNavigationOpen,[p.s.overlayClosing]:!v.isNavigationOpen}),onClick:O(()=>v.setOpenedBlock(null))}),(0,t.jsx)(ej,{data:x,minioUrl:u})]}):null};e.s(["C",0,({children:e,initialRegion:l,initialTown:i,showStartGeoPopup:s=!0,lastRegionsUpdateUnixTimestamp:o,dadataUrl:r="https://finuslugi.ru/backend/money/dadata",showcaseUrl:a="",useNewCitiesApi:u=!1})=>{let d=f(u),p=Number(x(d.lastRegionsUpdateUnixTimestamp)||0),m=Number(o||0)>p,[h,w]=(0,n.useState)(_(u)),C=(0,n.useRef)(h),[{startRegion:y,startTown:N},T]=(0,n.useState)({startRegion:U.startRegion,startTown:U.startTown}),$=l??U.region,A=i??U.town,[{region:P,town:L},E]=(0,n.useState)({region:$,town:A}),[B,z]=(0,n.useState)(U.startPopupVisible),[D,F]=(0,n.useState)(U.popupVisible),W=(0,n.useRef)(""),V=(0,n.useRef)(!1),H=(0,n.useMemo)(()=>j(h),[h]);(0,n.useEffect)(()=>{C.current=h},[h]);let G=(0,n.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)||""),z(!0),T({startRegion:e,startTown:t})},[z,T]),J=(0,n.useCallback)((e,t)=>{window.sessionStorage.getItem("start_popup_opened")||G(e,t)},[G]),q=(0,n.useCallback)(()=>{if(W.current&&!P&&!L){let e=H.find(e=>e.name===W.current)??null;return J(h.find(t=>t.id===(null==e?void 0:e.parentId))??null,e)}J(P,L)},[P,L,H,h,J]),Q=(0,n.useCallback)(e=>{F(e)},[F]),Y=(0,n.useCallback)((e,t)=>{if(!e&&!t){window.localStorage.setItem(d.allRussiaSelected,"1"),window.localStorage.setItem(d.userRegion,""),window.localStorage.setItem(d.userTown,""),g(null,null,u);return}window.localStorage.setItem(d.allRussiaSelected,"0"),window.localStorage.setItem(d.userRegion,JSON.stringify(e)||""),window.localStorage.setItem(d.userTown,JSON.stringify(t)||""),g(e||null,t||null,u)},[d,u]),K=(0,n.useCallback)(e=>{e?I(c.D.icon,"location"):I(c.D.button,(null==L?void 0:L.name)||"Вся Россия"),!s||window.sessionStorage.getItem("start_popup_opened")?Q(!0):q()},[s,L,Q,q]),X=(0,n.useCallback)((e,t)=>{Y(e,t),E({region:e||null,town:t||null}),z(!1),Q(!1);let n=new CustomEvent("onRegionChange",{detail:{region:e,town:t}});document.dispatchEvent(n)},[Q,Y]),Z=()=>{let e=v(d.userRegion)??x(d.userRegion),t=v(d.userTown)??x(d.userTown),n=k(C.current,e,t),l=u&&(!!e||!!t)&&!(null!=e&&e.newId)&&!(null!=e&&e.fiasId)&&!(null!=t&&t.newId)&&!(null!=t&&t.fiasId);l&&(V.current=!0),l&&O(n.region,n.town)&&(Y(n.region,n.town),V.current=!1),E(n);let i=async({coords:{latitude:e,longitude:t}})=>{let n=`${r}?lat=${e}&lon=${t}`,l=await R(n);null!=l&&l.location&&(W.current=l.location.data.city)};if(!window.localStorage.getItem("dadata")&&navigator.geolocation&&s)try{navigator.geolocation.getCurrentPosition(i,()=>null)}catch{}};return(0,n.useEffect)(()=>{(!((e,t=!1)=>!(e.length<1)&&(!t||b(e)))(h,u)||m)&&S({showcaseUrl:a,useNewCitiesApi:u}).then(e=>{e.length<1||w(e)})},[]),(0,n.useEffect)(()=>{if(!u)return;let e=k(h,P,L);V.current&&O(e.region,e.town)&&(Y(e.region,e.town),V.current=!1),E(e)},[h,P,Y,L,u]),(0,n.useEffect)(()=>{if(window.innerWidth<1024){let e=()=>{Z(),window.removeEventListener("scroll",e)};window.addEventListener("scroll",e)}else setTimeout(()=>{Z()},0)},[]),(0,t.jsx)(M.Provider,{value:{regions:h,towns:H,region:P,town:L,startPopupVisible:B,setStartPopupVisible:z,popupVisible:D,handleToggleModal:Q,selectCity:X,handleButtonClick:K,startRegion:y,startTown:N},children:e})},"H",0,e=>(0,t.jsx)(Y,{isMainBannerPage:e.isMainBannerPage,children:(0,t.jsx)(eC,{...e})}),"u",0,z],24877)}]);