(function(){if(window.__civiusHomeServicesLoaded)return;window.__civiusHomeServicesLoaded=!0;const ne=3600,_=(m,E=document)=>E.querySelector(m),B=(m,E=document)=>Array.from(E.querySelectorAll(m));function oe(m){window.CiviusStoreActions?.renderFavoriteButton?.(m)}function re(m){window.CiviusStoreActions?.renderCartButton?.(m)}function ae(){const m=B("[data-services-track], .services-track");if(!m.length)return;const E=window.matchMedia?.("(min-width: 761px)"),Y=window.matchMedia?.("(prefers-reduced-motion: reduce)"),u=()=>E?.matches??window.innerWidth>760,X=()=>!!Y?.matches,ce=900,ue=820,S=(i,v)=>(i%v+v)%v,de=i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2;m.forEach(i=>{if(i.dataset.civiusAutoplayBound==="1")return;i.dataset.civiusAutoplayBound="1",i.dataset.civiusCoverflowBound="1",i.dataset.civiusCarouselScene="1";const v=i.closest(".services")||document,d=_("[data-services-mobile-dots]",v),F=B(".service-card, .home-service-card",i);let z=[i],T=0,r=0,a=0,L=0,H=0,U=0,V=!1,$=!1,G=!0,D=!1,N=null,I=!0,b=0,l=0,y=0,Q=0,j=0,g=null;const le=typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,me="a, button, input, select, textarea, [tabindex]",J="__civius-none__",f=()=>F,K=e=>{e.querySelectorAll('[data-civius-carousel-tabindex-stored="1"]').forEach(t=>{const s=t.dataset.civiusCarouselTabindexValue;s===J?t.removeAttribute("tabindex"):t.setAttribute("tabindex",s||""),delete t.dataset.civiusCarouselTabindexStored,delete t.dataset.civiusCarouselTabindexValue})},ve=(e,t)=>{const s=t?"true":"false";if(e.dataset.civiusCarouselInteractive!==s){if(e.dataset.civiusCarouselInteractive=s,e.setAttribute("aria-hidden",t?"false":"true"),e.style.pointerEvents=t?"":"none",le){e.toggleAttribute("inert",!t);return}if(t){K(e);return}e.querySelectorAll(me).forEach(n=>{if(n.dataset.civiusCarouselTabindexStored==="1")return;const c=n.getAttribute("tabindex");n.dataset.civiusCarouselTabindexStored="1",n.dataset.civiusCarouselTabindexValue=c===null?J:c,n.setAttribute("tabindex","-1")})}},fe=e=>{e.removeAttribute("inert"),e.removeAttribute("aria-hidden"),e.style.removeProperty("pointer-events"),K(e),delete e.dataset.civiusCarouselInteractive},he=()=>{const e=window.getComputedStyle(i);return Number.parseFloat(e.getPropertyValue("--home-services-gap")||e.columnGap||e.gap||"30")||30},pe=()=>{const e=window.innerWidth;return e<=760?{gap:16,rotate:15.2,zDepth:96,opacityDrop:.24}:e<=1040?{gap:30,rotate:12.4,zDepth:108,opacityDrop:.14}:{gap:30,rotate:15.8,zDepth:140,opacityDrop:.13}},Z=()=>{const e=u()&&z.some(t=>t?.matches?.(":hover"));return V||$||e||!G||document.hidden||document.documentElement.classList.contains("civius-scroll-active")},P=e=>{if(!u()){V=!1;return}V=!!e},Me=()=>{D=!1,a&&(window.clearTimeout(a),a=0),r&&(window.cancelAnimationFrame(r),r=0),L&&(window.cancelAnimationFrame(L),L=0),i.classList.remove("is-civius-coverflow-ready","is-civius-carousel-moving","is-civius-carousel-instant"),i.style.removeProperty("--home-services-window-width"),f().forEach(e=>{e.style.removeProperty("transform"),e.style.removeProperty("opacity"),e.style.removeProperty("z-index"),fe(e)})},M=()=>{if(!d)return;const e=f(),t=e.length;if(u()||t<2){d.hidden=!0,d.setAttribute("aria-hidden","true"),d.replaceChildren();return}d.hidden=!1,d.removeAttribute("aria-hidden"),d.children.length!==t&&d.replaceChildren(...e.map((n,c)=>{const o=document.createElement("button");return o.type="button",o.className="c-icon-button services-mobile-dot",o.dataset.servicesMobileDot=String(c),o.setAttribute("aria-label",`Показать услугу ${c+1}`),o}));const s=S(Math.round(r?y:l),t);Array.from(d.children).forEach((n,c)=>{const o=c===s;n.classList.toggle("is-active",o),n.setAttribute("aria-current",o?"true":"false")}),r||(b=s)},we=()=>{H||(H=window.requestAnimationFrame(()=>{H=0,M()}))},k=e=>{d&&Array.from(d.children).forEach((t,s)=>{const n=s===e;t.classList.toggle("is-active",n),t.setAttribute("aria-current",n?"true":"false")})},be=()=>{const t=F[0]?.offsetWidth||Math.min(376,Math.max(284,(window.innerWidth-60)/3)),s=pe();N={config:s,span:u()?t+Math.max(he(),s.gap)+10:t+10},I=!1},ee=()=>{if(!i.isConnected||!document.body)return 0;const e=document.createElement("span");e.textContent="Комплект документов для сайта",e.style.cssText=["position:absolute","left:-9999px","top:-9999px","visibility:hidden","white-space:nowrap","font:700 14px Onest, Arial, sans-serif"].join(";"),document.body.appendChild(e);const t=e.getBoundingClientRect().width;return e.remove(),t},ye=()=>{if(!document.fonts?.load)return;const e=ee();document.fonts.load("700 14px Onest","Комплект документов для сайта").then(()=>{if(!i.isConnected)return;const t=ee();Math.abs(t-e)<.75||(I=!0,h())}).catch(()=>{})},ge=()=>{F.forEach(e=>{e.querySelectorAll('[data-service-action="favorite"]').forEach(oe),e.querySelectorAll('[data-service-action="cart"]').forEach(re)})},h=()=>{const e=F,t=e.length;if(!t||!i.isConnected)return;(I||!N)&&be();const{config:s,span:n}=N;e.forEach((c,o)=>{let w=o-l;for(;w>t/2;)w-=t;for(;w<-t/2;)w+=t;const C=Math.abs(w),A=Math.max(-3,Math.min(3,w)),x=Math.abs(A),R=A*n,O=-Math.min(x,2.6)*s.zDepth,Ae=-A*s.rotate,xe=u()?Math.max(0,Math.min(1,(2.92-C)/.42)):1,Ee=C>3.05?0:Math.max(u()?.2:.18,1-x*s.opacityDrop)*xe;c.style.transform=`translate3d(calc(-50% + ${R.toFixed(2)}px), 0, ${O.toFixed(2)}px) rotateY(${Ae.toFixed(2)}deg)`,c.style.opacity=Ee.toFixed(3),c.style.zIndex=String(Math.round(1e3-x*100));const Le=x<(u()?.55:.72);ve(c,Le)}),!D&&!L&&(L=window.requestAnimationFrame(()=>{L=0,!(D||!i.isConnected)&&(i.classList.add("is-civius-carousel-instant"),i.classList.add("is-civius-coverflow-ready"),i.classList.remove("is-civius-coverflow-boot"),D=!0,window.requestAnimationFrame(()=>{i.classList.remove("is-civius-carousel-instant")}))}))},Ce=e=>{let t=S(e,f().length);for(;t-l>f().length/2;)t-=f().length;for(;t-l<-f().length/2;)t+=f().length;return t},te=(e,t=!1)=>{const n=f().length;if(n<2||!i.isConnected||!t&&Z())return;r&&window.cancelAnimationFrame(r),r=0,a&&(window.clearTimeout(a),a=0);const c=l,o=Ce(Number.isFinite(e)?e:b);y=o,u()||k(S(Math.round(o),n));const w=performance.now(),C=X()?0:u()?ce:ue;i.classList.add("is-civius-carousel-moving");const A=()=>{a=0,r=0,b=S(Math.round(o),n),l=o,y=o,h(),M(),window.requestAnimationFrame(()=>i.classList.remove("is-civius-carousel-moving"))};if(u()){l=o,h(),C?a=window.setTimeout(A,C):A();return}const x=R=>{const O=C?Math.min(1,(R-w)/C):1;if(l=c+(o-c)*de(O),h(),O<1){r=window.requestAnimationFrame(x);return}A()};r=window.requestAnimationFrame(x)},q=(e=1,t=!1)=>{te((Number.isFinite(y)?y:l)+e,t)},p=()=>{if(window.clearInterval(T),X())return;const e=f().length;if(u()){if(e<4)return}else if(e<2)return;T=window.setInterval(()=>{Z()||q(1,!1)},ne)},ie=()=>{window.clearInterval(T),T=0,a&&(window.clearTimeout(a),a=0,i.classList.remove("is-civius-carousel-moving"))};b=Math.min(2,Math.max(0,f().length-1)),l=b,y=b,i.scrollLeft=0,h(),ge(),M();const se=e=>!!e?.closest?.("a, button, input, textarea, select, label, [data-service-action], [data-service-icon-action], .civius-cart-stepper, .services-more");i.addEventListener("scroll",we,{passive:!0}),i.addEventListener("pointerdown",e=>{if(!u()){if(se(e.target)){g=null;return}g=e.pointerId,Q=e.clientX,j=e.clientY;try{i.setPointerCapture(e.pointerId)}catch{}}},{passive:!0}),i.addEventListener("pointerup",e=>{if(u()||g!==null&&e.pointerId!==g)return;if(se(e.target)){try{i.releasePointerCapture(e.pointerId)}catch{}g=null;return}const t=e.clientX-Q,s=e.clientY-j;try{i.releasePointerCapture(e.pointerId)}catch{}g=null,!(Math.abs(t)<34||Math.abs(t){try{i.releasePointerCapture(e.pointerId)}catch{}g=null},{passive:!0}),i.addEventListener("mouseenter",()=>P(!0),{passive:!0}),i.addEventListener("mouseleave",()=>P(!1),{passive:!0}),i.addEventListener("focusin",e=>{$=!0;const t=e.target.closest?.(".service-card, .home-service-card"),s=t?F.indexOf(t):-1;s<0||!r&&!a||(r&&(window.cancelAnimationFrame(r),r=0),a&&(window.clearTimeout(a),a=0),b=s,l=s,y=s,i.classList.remove("is-civius-carousel-moving"),h(),M())}),i.addEventListener("focusout",e=>{e.relatedTarget&&i.contains(e.relatedTarget)||window.requestAnimationFrame(()=>{i.contains(document.activeElement)||($=!1,h(),p())})}),z=[i,...B("[data-carousel-prev], [data-carousel-next], .services-more, [data-services-mobile-dots]",v)],z.slice(1).forEach(e=>{e.addEventListener("mouseenter",()=>P(!0),{passive:!0}),e.addEventListener("mouseleave",()=>P(!1),{passive:!0})}),d?.addEventListener("click",e=>{const t=e.target.closest("[data-services-mobile-dot]");if(!t)return;const s=Number(t.dataset.servicesMobileDot||"");Number.isFinite(s)&&(k(s),te(s,!0),p())}),_("[data-carousel-prev]",v)?.addEventListener("click",()=>{q(-1,!0),p()}),_("[data-carousel-next]",v)?.addEventListener("click",()=>{q(1,!0),p()}),E?.addEventListener?.("change",()=>{ie(),i.scrollLeft=0,I=!0,h(),M(),p()}),window.addEventListener("resize",()=>{I=!0,!U&&(U=window.requestAnimationFrame(()=>{U=0,h(),M()}))},{passive:!0}),Y?.addEventListener?.("change",()=>{ie(),h(),p()}),"IntersectionObserver"in window&&v!==document&&new IntersectionObserver(t=>{G=t.some(s=>s.isIntersecting)},{rootMargin:"240px 0px"}).observe(v),ye(),p()})}function W(){ae(),window.CiviusStoreActions?.refreshFavoriteUi?.(),window.CiviusStoreActions?.refreshCartUi?.()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",W,{once:!0}):W(),window.addEventListener("pageshow",()=>{window.CiviusStoreActions?.refreshFavoriteUi?.(),window.CiviusStoreActions?.refreshCartUi?.()}),window.addEventListener("storage",()=>{window.CiviusStoreActions?.refreshFavoriteUi?.(),window.CiviusStoreActions?.refreshCartUi?.()})})();