1import{a as q}from"./chunk-WPDFP26D.js";import{a as Q}from"./chunk-QNNLPUIH.js";import{a as V,b as J,c as j,d as K}from"./chunk-6VYT5XRU.js";import{a as F}from"./chunk-DZP6YI3Q.js";import{a as $}from"./chunk-SGHHZEQI.js";import"./chunk-DACMO4W6.js";import"./chunk-S3XOGNHC.js";import"./chunk-SBYEVDVP.js";import"./chunk-ADLJEL26.js";import{c as I}from"./chunk-KFP6QHA4.js";import"./chunk-NFZDJHD2.js";import{a as X}from"./chunk-F7URULDV.js";import"./chunk-B5P6FSWY.js";import{d as D,g as O,h as W}from"./chunk-Z3M6BQAQ.js";import{ba as B}from"./chunk-VD6WWV4D.js";import{b as z}from"./chunk-K25LCNNK.js";import{a as k,c as H}from"./chunk-53L27IS6.js";import"./chunk-ZLTBJ7EM.js";import{Aa as R,Ab as c,Ad as P,Bc as x,Cb as m,Cc as L,Hb as p,Ib as l,Jb as o,Jc as _,Ka as M,Kb as g,Kc as T,Pb as h,Ta as r,Tb as S,Wb as b,Yb as s,ba as u,cd as U,eb as v,ha as N,ia as f,lc as d,ma as A,mc as w,nc as E,od as G,ta as C}from"./chunk-2L2WWPFT.js";import"./chunk-IK4C7FLP.js";function Z(n,t){n&1&&g(0,"loading-page");}function ee(n,t){if(n&1&&(l(0,"span"),d(1,"\xB7"),o(),l(2,"span"),d(3),o()),n&2){let e=s(2);r(3),w(e.publishedFullDate());}}function te(n,t){if(n&1&&(l(0,"div",12),g(1,"img",14),o()),n&2){let e=s();r(),p("ngSrc",e.attributes.image)("alt",e.attributes.title);}}function ne(n,t){if(n&1&&(g(0,"div",13),x(1,"safeHtml")),n&2){let e=s();p("innerHTML",L(1,1,e.attributes.body),M);}}function ie(n,t){if(n&1){let e=h();l(0,"article",4)(1,"div",6)(2,"button",7),b("click",function(){N(e);let a=s();return f(a.goBack());}),g(3,"fa-icon",8),o(),l(4,"div",9)(5,"span",10),d(6),o(),c(7,ee,4,1),o()(),l(8,"header")(9,"h1",11),d(10),o()(),c(11,te,2,2,"div",12),c(12,ne,2,3,"div",13),o();}if(n&2){let e=s();r(3),p("icon",e.faArrowLeft)("fixedWidth",!0),r(3),E(" ",e.metaLabel()," "),r(),m(e.publishedFullDate()?7:-1),r(3),E(" ",t.attributes.title," "),r(),m(e.hasImage()?11:-1),r(),m(e.hasContent()?12:-1);}}function oe(n,t){if(n&1){let e=h();l(0,"div",5)(1,"div",15)(2,"ui-empty")(3,"ui-empty-header")(4,"ui-empty-title"),S(5,0),o(),l(6,"ui-empty-description"),d(7),o()(),l(8,"ui-empty-content",16)(9,"div",17)(10,"button",18),b("click",function(){N(e);let a=s();return f(a.retry());}),S(11,1),o(),l(12,"a",19),S(13,2),o()()()()()();}if(n&2){let e=s();r(7),E(" ",e.emptyMessage()," "),r(5),p("routerLink",e.allArticlesLink);}}var Y=class n{constructor(){this.newsApiService=u(q);this.seoService=u($);this.route=u(D);this.router=u(O);this.location=u(U);this.document=u(A);this.routeParamMap=I(this.route.paramMap,{initialValue:this.route.snapshot.paramMap});this.requestedArticle=_(()=>{let t=this.routeParamMap(),e=(t.get("slug")??"").trim(),i=(t.get("category")??"").trim()||null;return e===""?null:{slug:e,categorySlug:i,key:`${i??""}|${e}`};});this.lastAppliedArticleKey="";this.error=C(null);this.item=C(null);this.articleResource=P(()=>{let t=this.requestedArticle();if(t)return this.newsApiService.createNewsItemResourceRequest(t.slug,t.categorySlug);},{debugName:"NewsSlugComponent.article"});this.isLoadingPage=_(()=>this.articleResource.isLoading()&&this.requestedArticle()!==null&&this.item()===null&&this.error()===null);this.hasImage=_(()=>!!this.item()?.attributes?.image);this.hasContent=_(()=>!!this.item()?.attributes?.body);this.category=_(()=>this.item()?.attributes.category??null);this.metaLabel=_(()=>this.category()?.name??"News");this.publishedFullDate=_(()=>{let t=this.item()?.attributes?.created_at;return typeof t=="number"&&Number.isFinite(t)?new Intl.DateTimeFormat(this.document.documentElement.lang||"ru-RU",{day:"numeric",month:"long",year:"numeric"}).format(new Date(t)):this.item()?.attributes?.created_at_human??"";});this.emptyMessage=_(()=>this.error()??"Failed to load article.");this.allArticlesLink=["/blog"];this.faArrowLeft=B;R(()=>{this.applyArticleResource();});}goBack(){let t=this.document.defaultView?.history.length??0,e=this.document.referrer??"",i=this.document.location?.origin??"",a=i!==""&&e.startsWith(i);if(t>1||a){this.location.back();return;}this.router.navigate(this.allArticlesLink);}retry(){this.requestedArticle()&&(this.error.set(null),this.item.set(null),this.articleResource.reload());}applyArticleResource(){let t=this.requestedArticle();if(!t){this.lastAppliedArticleKey="",this.item.set(null),this.error.set("Article not found.");return;}this.lastAppliedArticleKey!==t.key&&(this.lastAppliedArticleKey=t.key,this.item.set(null),this.error.set(null));let e=this.articleResource.status();if(e==="idle"||e==="loading"||e==="reloading")return;if(e==="error"){console.error("Error loading article:",this.articleResource.error()),this.item.set(null),this.error.set("Failed to load article.");return;}let i=this.articleResource.value();if(!i?.news){this.item.set(null),this.error.set("Article not found.");return;}T(()=>{this.item.set(i.news),this.error.set(null),this.seoService.updateSeoTags({title:i.news.attributes.title});});}static{this.ɵfac=function(e){return new(e||n)();};}static{this.ɵcmp=v({type:n,selectors:[["app-news-slug"]],decls:4,vars:1,consts:()=>{let t;t="Back";let e;e="Article not found";let i;i="Try again";let a;return a="All articles",[e,i,a,[1,"container","mx-auto","py-5","sm:py-6","lg:py-8"],[1,"mx-auto","max-w-4xl","space-y-5"],[1,"mx-auto","max-w-2xl"],[1,"flex","items-center","gap-4","text-sm","text-muted-foreground"],["type","button","aria-label",t,1,"inline-flex","
1size-10","items-center","justify-center","rounded-2xl","border","border-border/70","bg-muted/30","text-foreground","transition-colors","hover:bg-accent","hover:text-accent-foreground",3,"click"],[1,"block","text-base","leading-none","text-foreground","opacity-100",3,"icon","fixedWidth"],[1,"flex","min-w-0","flex-wrap","items-center","gap-2"],[1,"text-muted-foreground"],[1,"text-2xl","font-medium","leading-[1.18]","tracking-tight","text-foreground","md:text-4xl"],[1,"relative","h-[300px]","overflow-hidden","rounded-3xl","bg-muted/20","md:h-[420px]"],[1,"formatting__text",3,"innerHTML"],["fill","","sizes","(min-width: 1024px) 56vw, 100vw","loading","lazy",1,"absolute","inset-0","size-full","object-cover",3,"ngSrc","alt"],[1,"rounded-[2rem]","border","border-border","bg-card","p-8","md:p-10"],[1,"pt-3"],[1,"flex","justify-center","gap-2"],["uiButton","","type","button","variant","outline",1,"rounded-xl",3,"click"],["uiButton","","variant","default",1,"rounded-xl",3,"routerLink"]];},template:function(e,i){if(e&1&&(l(0,"div",3),c(1,Z,1,0,"loading-page")(2,ie,13,7,"article",4)(3,oe,14,2,"div",5),o()),e&2){let a;r(),m(i.isLoadingPage()?1:(a=i.item())?2:3,a);}},dependencies:[W,H,k,G,z,F,V,J,j,K,Q,X],styles:[`:host{display:block} 2`],encapsulation:2});}};export{Y as NewsSlugComponent};/**i18n:e8297896982e5553d46dfb1a66aae4dfd7c33dd3229f67da2820ba9853ade856*/
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.