import{r as d,j as e,an as y,ao as A,b as T,ap as E,aq as x,w as $,ar as L,Z as w,as as B,at as S,au as k,av as R}from"./index-CEutDjyC.js";import{g as F,a as M,b as D,c as H,d as O,e as q}from"./selectors-CcL8BHpj.js";import{S as P}from"./SearchBar-UcKIFchE.js";import{B as V}from"./BreadcrumbNav-DLhE4n4M.js";import{S as W}from"./Skeleton-crFiQRtw.js";import{p as z}from"./plus_icon-lI4fCOmN.js";import{d as G}from"./close_icon-white--p3WzVVb.js";import{a as Q}from"./arrow_icon-right-black-BKV0y2Vb.js";import{E as U}from"./ErrorTooltip-DCtHEgon.js";import{s as r}from"./blogPage.module-BGz_ymqn.js";import{a as Z,c as J,e as K,p as X,s as Y,b as ee}from"./skills_icon-DNdLw3P0.js";import"./info_icon-OUEolHUr.js";const te="_container_lit42_1",ae="_card_lit42_8",se="_nav_lit42_18",ne="_navItem_lit42_25",oe="_navItemContent_lit42_41",ce="_active_lit42_51",re="_icon_lit42_55",le="_label_lit42_61",ie="_categoryChevron_lit42_66",de="_cardTags_lit42_72",ge="_tagsList_lit42_79",me="_tagItem_lit42_85",he="_tagSelected_lit42_99",ue="_tagActionIcon_lit42_104",pe="_expandButton_lit42_109",xe="_expandIcon_lit42_120",_e="_rotated_lit42_126",be="_categoryChevronRotated_lit42_136",ve="_cardCategoriesExpanded_lit42_166",t={container:te,card:ae,nav:se,navItem:ne,navItemContent:oe,active:ce,icon:re,label:le,categoryChevron:ie,cardTags:de,tagsList:ge,tagItem:me,tagSelected:he,tagActionIcon:ue,expandButton:pe,expandIcon:xe,rotated:_e,categoryChevronRotated:be,cardCategoriesExpanded:ve},Ce=({categories:l,activeCategory:g,onCategoryChange:n,tags:c,selectedTags:C,onTagToggle:m,isLoading:_=!1})=>{const[i,j]=d.useState(!1),[h,b]=d.useState(!1),u=6,I=i?c:c.slice(0,u),f=[110,85,130,90,120,100],v=_&&c.length===0,N=(a,o)=>{window.innerWidth<=900&&o===0&&b(!h),n(a)};return e.jsxs("aside",{className:t.container,children:[e.jsx("div",{className:`${t.card} ${h?t.cardCategoriesExpanded:""}`,children:e.jsx("nav",{className:t.nav,children:l.map((a,o)=>{const s=g===a.id,p=o===0;return e.jsxs("button",{type:"button",onClick:()=>N(a.id,o),className:`${t.navItem} ${s?t.active:""}`,children:[e.jsxs("div",{className:t.navItemContent,children:[a.icon&&e.jsx("img",{src:a.icon,alt:"",className:t.icon}),e.jsx("span",{className:`body-1 ${t.label}`,children:a.label})]}),p&&e.jsx("img",{src:Q,alt:"",className:`${t.categoryChevron} ${h?t.categoryChevronRotated:""}`})]},a.id)})})}),(c.length>0||v)&&e.jsxs("div",{className:t.cardTags,children:[e.jsx("div",{className:t.tagsList,children:v?e.jsx(e.Fragment,{children:f.map((a,o)=>e.jsx(W,{width:a,height:38,style:{borderRadius:"32px"}},o))}):e.jsx(e.Fragment,{children:I.map(a=>{const o=C.includes(a.id);return e.jsxs("button",{type:"button",onClick:()=>m(a.id),className:`body-3 ${t.tagItem} ${o?t.tagSelected:""}`,children:[a.label,e.jsx("img",{src:o?G:z,alt:o?"Удалить":"Добавить",className:t.tagActionIcon})]},a.id)})})}),!v&&c.length>u&&e.jsxs("button",{className:t.expandButton,onClick:()=>j(!i),children:[e.jsx("span",{className:`body-1 ${t.expandText}`,children:i?"Свернуть":"Развернуть"}),e.jsx("img",{src:y,alt:"",className:`${t.expandIcon} ${i?t.rotated:""}`})]})]})]})},je=[{id:"all",label:"Р’СЃРµ категории",icon:Z},{id:"career",label:"Карьера Рё работа",icon:J},{id:"training",label:"Обучение Рё траектории",icon:K},{id:"hiring",label:"Найм Рё команды",icon:X},{id:"research",label:"Рсследования",icon:Y},{id:"skills",label:"Навыки Рё развитие",icon:ee}],ke=()=>{const l=A(),g=T(),n=E("/blog/:id"),c=x(F),C=x(M),m=x(D),_=x(H),i=x(O),j=x(q),[h,b]=d.useState(c.search),u=$(h,400);d.useEffect(()=>{m.length===0&&l(L())},[l,m.length]),d.useEffect(()=>{b(c.search)},[c.search]);const I=d.useMemo(()=>{if(u.trim().length<2)return[];const s=u.toLowerCase();return m.filter(p=>p.title.toLowerCase().includes(s)).slice(0,6).map(p=>({label:p.title,value:p.title}))},[u,m]),f=s=>{l(S(s)),n&&g("/blog")},v=s=>{b(s.label),l(S(s.label)),n&&g("/blog")},N=s=>{l(R(s)),n&&g("/blog")},a=s=>{l(k(s)),n&&g("/blog")},o=d.useMemo(()=>{if(!n)return[];const s=[{label:"Р’СЃРµ статьи",href:"/blog"}];return i?[...s,{label:e.jsx(w,{size:"small"}),isCurrent:!0}]:_?[...s,{label:_.title,isCurrent:!0}]:s},[_,n,i]);return e.jsxs("div",{className:r.pageContainer,children:[!n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.pageHeader,children:[e.jsx("h1",{className:r.pageHeaderTitle,children:"Блог Рѕ карьере, работе Рё развитии"}),e.jsx("p",{className:`${r.pageHeaderText} body-1`,children:"Профессиональная среда размышления РІРѕРєСЂСѓРі карьеры Рё работы. Разборы, исследования, практики."})]}),e.jsx("div",{className:r.searchContainer,children:e.jsx(P,{placeholder:"РџРѕРёСЃРє РїРѕ статьям",type:"forward",filter:"none",value:h,suggestions:I,onInputValueChange:b,onSearch:f,onSuggestionSelect:v,allowClear:!0})})]}),n&&e.jsx("div",{children:e.jsx(V,{className:r.blogBreadcrumbNav,items:o,mobile:!0})}),e.jsxs("div",{className:`${r.layout} ${n?r.articleMode:""}`,children:[e.jsx("main",{className:r.mainCol,children:j&&!n?e.jsx("div",{children:e.jsx(U,{title:"Ошибка загрузки",message:"РќРµ удалось загрузить СЃРїРёСЃРѕРє статей. Попробуйте обновить страницу."})}):e.jsx(B,{})}),e.jsx("aside",{className:r.asideCol,children:e.jsx(Ce,{categories:je,activeCategory:c.category,onCategoryChange:N,tags:C,selectedTags:c.tags,onTagToggle:a,isLoading:i})})]})]})};export{ke as BlogPage};