1import{R as L,r as x,j as e,i as C,U as T,L as f,S,Q as $,d as E}from"./index-CXOeVRoW.js";import{L as A}from"./LoadingSpinner-DbwDIzmW.js";const P=({content:i,containerId:t="tocContainer"})=>{const[h,g]=L.useState([]);x.useEffect(()=>{if(i){const n=setTimeout(()=>{const o=document.querySelector(".article-content");if(o){const s=o.querySelectorAll("h2, h3, h4");if(s.length>0){const r=[];s.forEach((a,d)=>{let l=a.id;if(!l||l===""){const m=a.textContent.trim();l=`heading-${d}-${m.toLowerCase().replace(/[^а-ÑÑa-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}`,a.setAttribute("id",l)}r.push({id:a.id,title:a.textContent.trim(),level:parseInt(a.tagName.substring(1))})}),g(r)}}},300);return()=>clearTimeout(n)}},[i]),x.useEffect(()=>{if(h.length>0){const n=setTimeout(()=>{const o=document.querySelector(".article-content");if(!o)return;const s=o.querySelectorAll("h2, h3, h4");s.forEach(a=>{const d=()=>{a.id&&(window.history.pushState(null,"",`#${a.id}`),a.classList.add("highlighted-heading"),setTimeout(()=>{a.classList.remove("highlighted-heading")},2e3))};a.addEventListener("click",d)});const r=document.getElementById(t);if(r){const a=r.offsetTop,d=r.offsetWidth;let l=null;const m=()=>{const j=window.scrollY,v=document.querySelector(".d-flex.align-items-center.mt-5.pt-4.border-top"),y=a-100;if(j>y){let c=!1;if(v){const w=r.getBoundingClientRect(),b=v.getBoundingClientRect();c=b.top<window.innerHeight&&w.bottom+50>=b.top}c?(r.classList.remove("kb-toc-fixed"),r.style.width=""):(r.classList.add("kb-toc-fixed"),r.style.width=`${d}px`)}else r.classList.remove("kb-toc-fixed"),r.style.width="";let u=null;for(let c=0;c<s.length;c++){const w=s[c],b=w.getBoundingClientRect();if(b.top<=150&&b.bottom>=0&&(u=w.id,b.top>=0))break}if(!u&&window.innerHeight+j>=document.body.offsetHeight-200&&s.length>0&&(u=s[s.length-1].id),!u&&l&&(u=l),u&&(l=u),document.querySelectorAll(".kb-toc li").forEach(c=>{c.classList.remove("toc-active")}),u){const c=document.querySelector(`.kb-toc li[data-target="${u}"]`);c&&c.classList.add("toc-active")}};window.addEventListener("scroll",m);const p=()=>{r.style.width="",m()};return window.addEventListener("resize",p),m(),()=>{window.removeEventListener("scroll",m),window.removeEventListener("resize",p)}}},500);return()=>clearTimeout(n)}},[h,t]);const N=(n,o)=>{n.preventDefault();const s=document.getElementById(o.id);if(s)window.scrollTo({top:s.offsetTop-100,behavior:"smooth"}),s.classList.add("highlighted-heading"),setTimeout(()=>{s.classList.remove("highlighted-heading")},2e3);else{const r=document.querySelectorAll(".article-content h2, .article-content h3, .article-content h4");for(const a of r)if(a.textContent.trim()===o.title){window.scrollTo({top:a.offsetTop-100,behavior:"smooth"}),a.classList.add("highlighted-heading"),setTimeout(()=>{a.classList.remove("highlighted-heading")},2e3);break}}};return h.length===0?null:e.jsx("div",{className:"card mb-4 border-0 shadow-sm kb-toc-container",id:t,children:e.jsxs("div",{className:"card-body",children:[e.jsxs("h5",{className:"card-title mb-3",children:[e.jsx("i",{className:"fas fa-list me-2"}),"СодеÑжание (",h.length,")"]}),e.jsx("ul",{className:"list-unstyled kb-toc",children:h.map((n,o)=>e.jsx("li",{className:`mb-2 toc-level-${n.level}`,"data-target":n.id,children:e.jsx("a",{href:`#${n.id}`,className:"text-decoration-none",onClick:s=>N(s,n),children:n.title})},o))})]})})},R=i=>{const t=i.caseData||{};return{id:i.id,slug:i.slug,title:i.title,description:i.excerpt,subtitle:t.subtitle||"",solution:t.solution||"",workplaces:t.workplaces||"",duration:t.duration||"",cost:t.cost||"",featured:t.featured||!1,category:Array.isArray(t.categories)?t.categories:[],results:Array.isArray(t.results)?t.results.map((h,g)=>({resid:g,resname:typeof h=="string"?h:h.resname||""})):[],metrics:t.metrics||[],content:i.content||"",keywords:i.keywords||"",relatedProjects:t.relatedProjects||[],testimonial:t.testimonial||null,projectDetails:t.projectDetails||{}}},q=()=>{const{slug:i}=C(),[t,h]=x.useState(null),[g,N]=x.useState(!0),[n,o]=x.useState(null),{user:s}=x.useContext(T),r=s&&(s.isServiceAdmin===!0||s.userRole==="ÐдминиÑÑÑаÑÐ¾Ñ Ð¡ÐÐ"||s.userRole==="ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ ÐºÐ¾Ð½ÑенÑа");x.useEffect(()=>{(async()=>{var l;try{N(!0);const m=await E.get(`/api/kb/articles/${i}`,{params:{spaceSlug:"main"}});(l=m.data)!=null&&l.article?h(R(m.data.article)):o("ÐÑÐ¾ÐµÐºÑ Ð½Ðµ найден")}catch(m){console.error("ÐÑибка пÑи загÑÑзке пÑоекÑа:",m),o("Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ Ð¿ÑоекÑ")}finally{N(!1)}})()},[i]);const a=d=>{if(!d)return"";const l=document.createElement("div");return l.innerHTML=d,l.querySelectorAll("style").forEach(p=>{let j=p.textContent;j=j.replace(/([^{}]+)\{/g,(v,y)=>y.trim().startsWith("@")?v:`${y.split(",").map(k=>{const c=k.trim();return c.includes(".article-content")?c:`.article-content ${c}`}).join(", ")} {`),p.textContent=j}),l.innerHTML};return g?e.jsx(A,{}):n||!t?e.jsxs("div",{className:"container my-5",children:[e.jsxs("div",{className:"alert alert-danger",children:[e.jsx("i",{className:"fas fa-exclamation-triangle me-2"}),n||"ÐÑÐ¾ÐµÐºÑ Ð½Ðµ найден"]}),e.jsxs(f,{to:"/projects",className:"btn btn-primary",children:[e.jsx("i",{className:"fas fa-arrow-left me-2"}),"ÐеÑнÑÑÑÑÑ Ðº ÑпиÑÐºÑ Ð¿ÑоекÑов"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{title:`${t.title} | SAB`||"ÐÑÐ¾ÐµÐºÑ | SAB",description:t.description||"",keywords:t.keywords||""}),e.jsxs("div",{className:"container my-5",children:[e.jsx("nav",{"aria-label":"breadcrumb",className:"mb-3",children:e.jsxs("ol",{className:"breadcrumb kb-breadcrumb",children:[e.jsx("li",{className:"breadcrumb-item",children:e.jsxs(f,{to:"/",children:[e.jsx("i",{className:"fas fa-home me-1"}),"ÐлавнаÑ"]})}),e.jsx("li",{className:"breadcrumb-item",children:e.jsxs(f,{to:"/projects",children:[e.jsx("i",{className:"fas fa-briefcase me-1"}),"ÐейÑÑ"]})}),t.category&&t.category.length>0&&e.jsx("li",{className:"breadcrumb-item",children:e.jsx(f,{to:`/projects?category=${t.category[0].catslug}`,children:t.category[0].catname})}),e.jsx("li",{className:"breadcrumb-item active",children:t.title})]})}),r&&e.jsx("div",{className:"mb-3",children:e.jsxs(f,{to:`/projects/${i}/edit`,className:"btn btn-outline-secondary btn-sm",title:"РедакÑиÑоваÑÑ HTML-конÑÐµÐ½Ñ ÐºÐµÐ¹Ñа",children:[e.jsx("i",{className:"fas fa-code me-1"})," РедакÑиÑоваÑÑ"]})}),e.jsx("div",{className:"row mb-4",children:e.jsxs("div",{className:"col-lg-12",children:[t.category&&t.category.length>0&&e.jsxs("div",{className:"badge bg-primary mb-3",children:[e.jsx("i",{className:`fas ${t.category[0].caticon||"fa-briefcase"} me-2`}),t.category[0].catname]}),e.jsx("h1",{className:"display-5 fw-bold mb-3 kb-page-title",children:t.title}),t.subtitle&&e.jsx("p",{className:"lead text-muted mb-4",children:t.subtitle}),e.jsxs("div",{className:"kb-article-meta d-flex flex-wrap align-items-center mb-4",children:[t.workplaces&&e.jsxs("div",{className:"me-4 mb-2",children:[e.jsx("i",{className:"fas fa-users"}),t.workplaces," ÑабоÑÐ¸Ñ Ð¼ÐµÑÑ"]}),t.duration&&e.jsxs("div",{className:"me-4 mb-2",children:[e.jsx("i",{className:"fas fa-clock"}),t.duration]}),t.cost&&e.jsxs("div",{className:"me-4 mb-2",children:[e.jsx("i",{className:"fas fa-ruble-sign"}),t.cost]})]})]})}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-lg-8",children:e.jsxs("div",{className:"article-content",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:a(t.content)}}),e.jsx("div",{className:"d-flex align-items-center mt-5 pt-4 border-top",children:e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("span",{className:"me-3",children:"ÐоделиÑÑÑÑ:"}),e.jsxs("div",{className:"d-flex",children:[e.jsx("a",{href:`https://vk.com/share.php?url=${window.location.href}`,target:"_blank",rel:"noopener noreferrer",className:"btn btn-sm btn-outline-primary me-2",children:e.jsx("i",{className:"fab fa-vk"})}),e.jsx("a",{href:`https://t.me/share/url?url=${window.location.href}&text=${encodeURIComponent(t.title)}`,target:"_blank",rel:"noopener noreferrer",className:"btn btn-sm btn-outline-primary me-2",children:e.jsx("i",{className:"fab fa-telegram"})})]})]})})]})}),e.jsxs("div",{className:"col-lg-4",children:[e.jsx("div",{className:"card mb-4 border-0 shadow-sm",children:e.jsxs("div",{className:"card-body",children:[e.jsx("h5",{className:"card-title mb-3",children:"ÐеÑали пÑоекÑа"}),t.solution&&e.jsxs("div",{className:"mb-3",children:[e.jsx("small",{className:"text-muted d-block",children:"РеÑение"}),e.jsx("strong",{children:t.solution})]}),t.workplaces&&e.jsxs("div",{className:"mb-3",children:[e.jsx("small",{className:"text-muted d-block",children:"РабоÑÐ¸Ñ Ð¼ÐµÑÑ"}),e.jsx("strong",{children:t.workplaces})]}),t.duration&&e.jsxs("div",{className:"mb-3",children:[e.jsx("small",{className:"text-muted d-block",children:"СÑок ÑеализаÑии"}),e.jsx("strong",{children:t.duration})]}),t.cost&&e.jsxs("div",{className:"mb-3",children:[e.jsx("small",{className:"text-muted d-block",children:"СÑоимоÑÑÑ"}),e.jsx("strong",{children:t.cost})]}),e.jsx("hr",{}),e.jsxs(f,{to:"/projects",className:"btn btn-outline-primary btn-sm w-100 mb-2",children:[e.jsx("i",{className:"fas fa-arrow-left me-2"}),"ÐÑе кейÑÑ"]}),e.jsxs(f,{to:"/contacts",className:"btn btn-primary btn-sm w-100",children:["ÐбÑÑдиÑÑ Ð¿ÑоекÑ",e.jsx("i",{className:"fas fa-arrow-right ms-2"})]})]})}),e.jsx(P,{content:t.content,containerId:"tocContainer"}),t.relatedProjects&&t.relatedProjects.length>0&&e.jsx("div",{className:"card border-0 shadow-sm",children:e.jsxs("div",{className:"card-body",children:[e.jsx("h5",{className:"card-title mb-3",children:"ÐÐ¾Ñ Ð¾Ð¶Ð¸Ðµ пÑоекÑÑ"}),e.jsx("div",{className:"list-group list-group-flush",children:t.relatedProjects.map((d,l)=>e.jsx(f,{to:`/projects/${d.slug}`,className:"list-group-item list-group-item-action border-0 px-0",children:e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("i",{className:`fas ${d.icon||"fa-briefcase"} text-primary me-2`}),e.jsx("small",{children:d.title})]})},l))})]})})]})]}),e.jsx($,{title:"ХоÑиÑе Ñакой же ÑезÑлÑÑаÑ?",description:"ÐаÑи ÑкÑпеÑÑÑ Ð³Ð¾ÑÐ¾Ð²Ñ Ð¿Ð¾Ð¼Ð¾ÑÑ Ð°Ð²ÑомаÑизиÑоваÑÑ Ð²Ð°Ñ Ð±Ð¸Ð·Ð½ÐµÑ Ð¸ добиÑÑÑÑ Ð²Ð¿ÐµÑаÑлÑÑÑÐ¸Ñ ÑезÑлÑÑаÑов.",buttonText:"ÐбÑÑдиÑÑ Ñвой пÑоекÑ",modalTitle:"ÐапÑÐ¾Ñ Ð½Ð° авÑомаÑизаÑиÑ"})]})]})};export{q as default}; 2//# sourceMappingURL=ProjectPage-Duf2mD-N.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.