import{a as xt,c as ht,b as mt,r as l,d as bt,j as t,L as R}from"./jsx-runtime-CgWCn3gT.js";import{B as wt,g as kt,D as vt,E as Ct,F as yt,G as jt,H as Tt,J as Bt,S as d,K as j,M as It,N as T,O as Lt,P as X,Q as St,T as Rt,v as zt,U as Z,V as _t,W as tt,X as Et,Y as et,Z as Mt,_ as H,$ as ot,a0 as At,a1 as Pt,a2 as Ft,a3 as $t,a4 as Ht}from"./legacy-shell-D4JdMu14.js";import{l as i}from"./styled-components.browser.esm-CQ4IZagM.js";import{r as Dt}from"./modelCount-CKhxfxhQ.js";import{a as Nt}from"./seoDom-D06K2jw6.js";import{c as Vt}from"./index-ao6ir_VS.js";import{u as Ot,a as Ut,b as qt}from"./blogColumn-BobpY0f9.js";import{u as Gt}from"./useTranslation-CksCcIr-.js";import{A as Wt}from"./index-NPPpTHXJ.js";import"./i18nInstance-C_7vXBXC.js";import"./preload-helper-BXl3LOEh.js";import"./index-DKjRcP81.js";function Yt({localeSwitch:p,locale:z,post:x,last:g}){return!!(p&&g&&g.post===x&&g.locale!==z)}const D=i.div.withConfig({componentId:"sc-1c0xtl9-0"})([""," padding-block:16px 80px;color:#1a1a1a;"],qt),Jt=i.div.withConfig({componentId:"sc-1c0xtl9-1"})(["display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:20px;"]),Kt=i.nav.withConfig({componentId:"sc-1c0xtl9-2"})(["font-size:14px;color:#888;a{color:#888;cursor:pointer;&:hover{color:#2563eb;}}"]),Qt=i.h1.withConfig({componentId:"sc-1c0xtl9-3"})(["font-size:clamp(32px,3.4vw,44px);font-weight:700;line-height:1.15;letter-spacing:-0.02em;margin:0 0 16px;text-wrap:balance;@media (max-width:560px){font-size:28px;}"]),Xt=i.p.withConfig({componentId:"sc-1c0xtl9-4"})(["font-size:20px;line-height:1.55;color:#5b6070;margin:0 0 16px;@media (max-width:560px){font-size:17px;}"]),Zt=i.div.withConfig({componentId:"sc-1c0xtl9-5"})(["font-size:14px;color:#888;margin-bottom:28px;& > * + *::before{content:'·';margin:0 6px;}"]),te=i.img.withConfig({componentId:"sc-1c0xtl9-6"})(["width:100%;aspect-ratio:1.9 / 1;object-fit:cover;border-radius:16px;border:1px solid #f0f0f0;margin-bottom:36px;"]),ee=i.article.withConfig({componentId:"sc-1c0xtl9-7"})(["font-size:16px;line-height:1.75;color:#2a2a2a;overflow-wrap:break-word;> *:first-child{margin-top:0;}h2{font-size:24px;font-weight:650;color:#1a1a1a;margin:40px 0 14px;letter-spacing:-0.01em;}h3{font-size:19px;font-weight:600;color:#1a1a1a;margin:32px 0 10px;}p{margin:0 0 18px;}a{color:#2563eb;text-decoration:none;border-bottom:1px solid rgba(37,99,235,0.25);transition:border-color 0.15s ease-out;&:hover{border-bottom-color:#2563eb;}}strong{font-weight:600;color:#1a1a1a;}ul,ol{padding-left:24px;margin:0 0 18px;}li{margin:6px 0;list-style-type:inherit;}li::marker{color:#94a3b8;}blockquote{margin:24px 0;padding:8px 20px;border-left:3px solid #2563eb;background:rgba(37,99,235,0.04);border-radius:0 8px 8px 0;color:#444;p:last-child{margin-bottom:0;}}hr{border:none;border-top:1px solid #eee;margin:36px 0;}code{font-family:'SF Mono',SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;background:#f3f4f6;color:#334155;padding:2px 6px;border-radius:4px;overflow-wrap:anywhere;}&& pre{background:#ffffff !important;color:#1f2937;border:1px solid #e5e7eb;border-radius:10px;padding:18px 20px;overflow-x:auto;margin:0 0 22px !important;}&& pre code{background:transparent;color:#334155;padding:0;border-radius:0;font-size:13.5px;line-height:1.65;}.blog-table-scroll{max-width:100%;overflow-x:auto;margin:0 0 22px;}table{border-collapse:collapse;width:100%;margin:0 0 22px;font-size:15px;}.blog-table-scroll > table{margin:0;}th,td{border:1px solid #e5e7eb;padding:9px 14px;text-align:left;}th{background:#f9fafb;font-weight:600;color:#1a1a1a;}tr:nth-child(even) td{background:#fcfcfd;}img{max-width:100%;height:auto;border-radius:10px;}figure{margin:28px 0;}.kg-image-card img,.kg-gallery-image img{border:1px solid #f0f0f0;}figcaption{font-size:13px;color:#888;text-align:center;margin-top:10px;}.kg-embed-card{position:relative;iframe{width:100%;aspect-ratio:16 / 9;height:auto;border:none;border-radius:10px;}}.kg-video-card video{width:100%;border-radius:10px;}.kg-bookmark-card a{display:block;border:1px solid #e5e7eb;border-radius:10px;padding:14px 16px;color:#1a1a1a;border-bottom-width:1px;transition:border-color 0.2s ease-out,box-shadow 0.2s ease-out;&:hover{border-color:rgba(37,99,235,0.35);box-shadow:0 6px 20px rgba(37,99,235,0.08);}}.kg-callout-card{display:flex;gap:10px;border-radius:10px;padding:14px 16px;margin:24px 0;background:#f8fafc;}"]),oe=i.div.withConfig({componentId:"sc-1c0xtl9-8"})(["display:grid;grid-template-columns:minmax(0,1fr) 300px;align-items:start;gap:72px;@media (max-width:1024px){grid-template-columns:minmax(0,1fr);gap:0;}[id]{scroll-margin-top:88px;}"]),ne=i.div.withConfig({componentId:"sc-1c0xtl9-9"})(["min-width:0;"]),ae=i.aside.withConfig({componentId:"sc-1c0xtl9-10"})(["position:sticky;top:88px;display:flex;flex-direction:column;max-height:calc(100vh - 120px - 24px);@media (max-width:1024px){display:none;}&& .ant-anchor::before,&& .ant-anchor-ink{display:none !important;}&& .ant-anchor-link{padding:0;}&& .ant-anchor-link-title{display:block;padding:5px 10px;border-radius:8px;color:#626773;font-size:13.5px;line-height:1.45;white-space:normal;transition:background-color 0.15s ease,color 0.15s ease;}&& .ant-anchor-link .ant-anchor-link .ant-anchor-link-title{padding-left:24px;font-size:13px;}&& .ant-anchor-link-title:hover{background:rgba(17,17,17,0.05);color:#111111;}&& .ant-anchor-link-active > .ant-anchor-link-title{color:#111111;font-weight:600;}"]),ie=i.div.withConfig({componentId:"sc-1c0xtl9-11"})(["font-size:12.5px;font-weight:600;letter-spacing:0.04em;text-transform:uppercase;color:#999;padding:0 10px;margin-bottom:8px;"]),re=i.div.withConfig({componentId:"sc-1c0xtl9-12"})(["flex:1 1 auto;min-height:0;overflow-y:auto;scrollbar-width:thin;"]),le=i.div.withConfig({componentId:"sc-1c0xtl9-13"})(["flex:none;margin-top:16px;padding:20px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;&:first-child{margin-top:0;}.brand-logo{display:block;margin-bottom:14px;}"]),se=i.p.withConfig({componentId:"sc-1c0xtl9-14"})(["font-size:15px;font-weight:600;line-height:1.4;color:#1a1a1a;margin:0 0 16px;"]),N=i.button.withConfig({componentId:"sc-1c0xtl9-15"})(["display:flex;align-items:center;justify-content:center;gap:6px;width:100%;min-height:36px;padding:7px 12px;border:none;border-radius:8px;background:#2563eb;color:#fff;font:inherit;font-size:14px;font-weight:500;line-height:20px;text-decoration:none;cursor:pointer;transition:background-color 0.15s ease;&:hover{background:#1d4ed8;color:#fff;}&:active{background:#0049df;color:#fff;}&:focus-visible{outline:2px solid #2563eb;outline-offset:2px;}"]),ce=i.div.withConfig({componentId:"sc-1c0xtl9-16"})(["display:flex;align-items:center;justify-content:space-between;gap:24px;margin-top:48px;padding:24px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;.brand-logo{display:block;margin-bottom:10px;}@media (max-width:560px){flex-direction:column;align-items:stretch;gap:16px;}"]),de=i.p.withConfig({componentId:"sc-1c0xtl9-17"})(["margin:0;font-size:16px;font-weight:600;line-height:1.45;color:#1a1a1a;white-space:pre-line;text-wrap:pretty;"]),ge=i(N).withConfig({componentId:"sc-1c0xtl9-18"})(["width:auto;flex:none;padding:7px 16px;@media (max-width:560px){width:100%;}"]),pe=i.div.withConfig({componentId:"sc-1c0xtl9-19"})(["margin-top:56px;padding-top:28px;border-top:1px solid #f0f0f0;"]),fe=i.h2.withConfig({componentId:"sc-1c0xtl9-20"})(["font-size:18px;font-weight:650;margin:0 0 18px;"]),ue=i.div.withConfig({componentId:"sc-1c0xtl9-21"})(["display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:16px;"]),xe=i(R).withConfig({componentId:"sc-1c0xtl9-22"})(["display:block;background:#fff;border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;cursor:pointer;transition:box-shadow 0.2s ease-out,border-color 0.2s ease-out;&:hover{border-color:rgba(37,99,235,0.35);box-shadow:0 8px 24px rgba(37,99,235,0.1);}&:hover h3{color:#2563eb;}"]),he=i.div.withConfig({componentId:"sc-1c0xtl9-23"})(["aspect-ratio:16 / 9;background:linear-gradient(135deg,rgba(37,99,235,0.08),rgba(37,99,235,0.02));overflow:hidden;img{width:100%;height:100%;object-fit:cover;}"]),me=i.div.withConfig({componentId:"sc-1c0xtl9-24"})(["padding:12px 14px 14px;h3{font-size:14.5px;font-weight:600;line-height:1.4;color:#1a1a1a;margin:0 0 6px;transition:color 0.15s ease-out;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}time{font-size:12.5px;color:#888;}"]),be=i.div.withConfig({componentId:"sc-1c0xtl9-25"})(["text-align:center;padding:100px 0;color:#666;a{color:#2563eb;}"]),_e=(p={})=>{const{slug:z}=xt(),x=p.slug??z,{i18n:g}=Gt(),V=ht(),m=mt(),e=wt(m.pathname),k=kt(e),nt=p.modelCount>0?Dt(p.modelCount):0,at=vt(e,nt),v=p.ctaModel&&p.ctaModel.id?p.ctaModel:null,_=v?Ct(e,v.name):null,O=o=>e===d.defaultLanguage?o:`${o}?lang=${e}`,U=o=>{o.currentTarget.href=Ht(o.currentTarget.getAttribute("href"),window.location.search)},B=p.initialPost!=null,[it,q]=l.useState(null),[rt,E]=l.useState([]),[lt,I]=l.useState("loading"),n=B?p.initialPost:it,G=B?p.initialRelated??[]:rt,u=B?"ok":lt,b=bt()!=="POP"&&m.state?.blogLocaleSwitch?m.state:null,st=yt(),W=l.useRef(null),M=l.useRef(null),Y=l.useRef(""),J=l.useRef(null),A=l.useRef({key:"",depth:0}),K=Ot(),L=Ut(),ct=o=>{const a=W.current;if(!a)return;if(!o){a.scrollTop=0;return}const r=Array.from(a.querySelectorAll(".ant-anchor-link-title")).find(h=>h.getAttribute("href")===o);if(!r)return;const c=a.getBoundingClientRect(),s=r.getBoundingClientRect();s.top<c.top?a.scrollTop-=c.top-s.top:s.bottom>c.bottom&&(a.scrollTop+=s.bottom-c.bottom)},P=l.useMemo(()=>n&&n.html?jt(n.html):[],[n]),F=l.useMemo(()=>Tt(P),[P]),dt=l.useMemo(()=>F.flatMap(o=>[o,...o.children||[]]),[F]),gt=P.length>=3,pt=l.useMemo(()=>Bt(n&&n.html),[n]);l.useEffect(()=>{e!==d.defaultLanguage&&j(g.language)!==e&&Vt(e)},[e]),l.useEffect(()=>{const o=j(g.language);if(e===d.defaultLanguage&&o!==d.defaultLanguage){const a=m.pathname.slice(5);V(...It(T(o,a),m,{replace:!0}))}},[e,g.language,m.pathname,m.search,m.hash,V]),l.useEffect(()=>{if(e===d.defaultLanguage&&j(g.language)!==d.defaultLanguage||B)return;let o=!1;if(b||(I("loading"),q(null),E([])),!Lt(x)){I("notfound");return}const a=e===d.defaultLanguage?"/blog-data":`/blog-data/${e}`;return Promise.all([X(`${a}/posts/${x}.json`),X(`${a}/index.json`).catch(()=>null)]).then(([r,c])=>{if(!o)if(q(r),I("ok"),Nt(r,e),c){const s=(c.posts||[]).filter(f=>f.slug!==x),h=new Set((r.tags||[]).map(f=>f.slug)),C=s.filter(f=>(f.tags||[]).some($=>h.has($.slug))),y=s.filter(f=>!C.includes(f));E([...C,...y].slice(0,3))}else E([])}).catch(()=>!o&&I("notfound")),()=>{o=!0}},[x,e]),l.useEffect(()=>{!window.location.hash&&!b&&window.scrollTo(0,0)},[x,e]),l.useLayoutEffect(()=>{u==="ok"&&b&&St(b.scrollAnchor)},[x,e,u,n]),l.useEffect(()=>{if(u!=="ok"||!window.location.hash)return;const o=window.location.hash.slice(1);let a=document.getElementById(o);if(!a)try{a=document.getElementById(decodeURIComponent(o))}catch{}a&&a.scrollIntoView()},[u,x,e,n]),l.useEffect(()=>{if(!L&&e===d.defaultLanguage||u!=="ok"||!n||!n.slug)return;if(e===d.defaultLanguage&&j(g.language)!==d.defaultLanguage){M.current={post:n,locale:e};return}if(Yt({localeSwitch:b,locale:e,post:n,last:M.current}))return;M.current={post:n,locale:e};const o=`${n.slug}|${e}`;if(Y.current===o)return;Rt({slug:n.slug,locale:e,primaryTag:n.tags?.[0]?.slug||"",readingTime:n.reading_time||0,hasModelCta:!!v})&&(Y.current=o)},[L,u,n,e,b,v,g.language,K]),l.useEffect(()=>{if(!L&&e===d.defaultLanguage||u!=="ok"||!n||!n.slug)return;const o=J.current;if(!o||typeof window>"u"||e===d.defaultLanguage&&j(g.language)!==d.defaultLanguage)return;const a=`${n.slug}|${e}`;A.current.key!==a&&(A.current={key:a,depth:0});let r=0;const c=()=>{r=0;const h=o.getBoundingClientRect(),C=o.offsetHeight;if(!C)return;const y=window.innerHeight;let f;if(C<=y)f=h.bottom<=y?1:0;else{const w=h.top+window.scrollY,ut=w+C-y;f=(window.scrollY-w)/(ut-w)}const $=Math.max(0,Math.min(100,Math.floor(f*100))),Q=A.current;[25,50,75,100].forEach(w=>{$>=w&&Q.depth<w&&Ft({slug:n.slug,depth:w,locale:e})&&(Q.depth=w)})},s=()=>{r||(r=window.requestAnimationFrame(c))};return window.addEventListener("scroll",s,{passive:!0}),window.addEventListener("resize",s),b||c(),()=>{r&&window.cancelAnimationFrame(r),window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[L,u,n,e,b,g.language,K]);const ft=o=>{if(!n)return;const a=o.target,r=a&&a.closest?a.closest("a[href]"):null;if(!r)return;const c=r.getAttribute("href")||"";if(!c||c.startsWith("#")||/^(mailto|tel|javascript):/i.test(c))return;let s;try{s=new URL(r.href,window.location.href)}catch{return}if(s.protocol!=="http:"&&s.protocol!=="https:")return;const h=s.origin!==window.location.origin;$t({slug:n.slug,href:s.href,text:(r.textContent||"").replace(/\s+/g," ").trim(),domain:h?s.hostname:"",outbound:h,locale:e})};if(u==="loading")return t.jsx(D,{style:{textAlign:"center",padding:120},children:t.jsx(zt,{size:"large"})});if(u==="notfound")return t.jsx(D,{children:t.jsxs(be,{children:[t.jsx("p",{children:k.notFound}),t.jsx(R,{to:T(e),children:k.backToBlog})]})});const S=(n.tags||[])[0];return t.jsx(D,{children:t.jsxs(oe,{children:[t.jsxs(ne,{children:[t.jsx(Jt,{children:t.jsxs(Kt,{children:[t.jsx(R,{to:T(e),onClick:()=>Z({slug:n.slug,target:"blog",locale:e}),children:k.breadcrumbBlog}),S&&t.jsxs(t.Fragment,{children:[" › ",t.jsx(R,{to:T(e,`/tag/${S.slug}`),onClick:()=>Z({slug:n.slug,target:"tag",tag:S.slug,locale:e}),children:S.name})]})]})}),t.jsx(Qt,{children:n.title}),n.has_custom_excerpt&&n.excerpt&&t.jsx(Xt,{children:n.excerpt}),t.jsxs(Zt,{children:[n.author&&t.jsx("span",{children:_t(n.author,e)}),n.published_at&&t.jsx("time",{dateTime:n.published_at,children:tt(n.published_at,e)}),n.reading_time>0&&t.jsx("span",{children:Et(e,n.reading_time)})]}),n.feature_image&&t.jsx(te,{src:n.feature_image,alt:n.title,fetchPriority:"high"}),t.jsx(ee,{ref:J,"data-blog-article":!0,onClick:ft,dangerouslySetInnerHTML:{__html:pt}}),t.jsxs(ce,{children:[t.jsxs("div",{children:[t.jsx(et,{language:e}),t.jsx(de,{children:k.ctaSlogan})]}),t.jsxs(ge,{as:"a",href:O("/"),onClick:o=>{U(o),ot({cta:"home",placement:"post_end"})},children:[Mt(e),t.jsx(H,{size:16,"aria-hidden":"true"})]})]}),G.length>0&&t.jsxs(pe,{children:[t.jsx(fe,{children:k.moreFromBlog}),t.jsx(ue,{children:G.map((o,a)=>t.jsxs(xe,{to:T(e,`/${o.slug}`),onClick:()=>At({fromSlug:n.slug,targetSlug:o.slug,position:a+1,locale:e}),children:[t.jsx(he,{children:o.feature_image&&t.jsx("img",{src:o.feature_image,alt:o.title,loading:"lazy"})}),t.jsxs(me,{children:[t.jsx("h3",{children:o.title}),o.published_at&&t.jsx("time",{dateTime:o.published_at,children:tt(o.published_at,e)})]})]},o.slug))})]})]}),t.jsxs(ae,{children:[gt&&t.jsxs(t.Fragment,{children:[t.jsx(ie,{children:k.tocTitle}),t.jsx(re,{ref:W,children:t.jsx(Wt,{affix:!1,targetOffset:88,items:F,onChange:ct,onClick:(o,a)=>{const r=dt.findIndex(c=>c.href===a.href);Pt({slug:n.slug,section:typeof a.title=="string"?a.title:"",position:r>=0?r+1:0,locale:e})}})})]}),t.jsxs(le,{children:[t.jsx(et,{language:e}),t.jsx(se,{id:"blog-cta-headline",children:_?_.headline:at}),v?t.jsxs(N,{as:"a",href:O(`/model/${encodeURIComponent(v.id)}`),"aria-describedby":"blog-cta-headline",onClick:o=>{U(o),ot({cta:"model_page",placement:"sidebar",targetModel:v.id})},children:[_.button,t.jsx(H,{size:16,"aria-hidden":"true"})]}):t.jsxs(N,{type:"button",onClick:()=>st("/token",void 0,"blog_sidebar_cta"),children:[k.ctaButton,t.jsx(H,{size:16,"aria-hidden":"true"})]})]})]})]})})};export{_e as default};
