PageSourceSearch

https://avala.ai/_next/static/chunks/app/%5Blocale%5D/(marketing)/news/%5Bslug%5D/page-71ef99a25c9073e3.js

js avala.ai collected 2026-10-05 11:49:54 UTC 56,417 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8419],{9795:(e,t,r)=>{"use strict";function a(){if("u"<typeof document)return null;let e=document.cookie.split(";").reduce((e,t)=>{let[r,a]=t.trim().split("=");return r&&a&&(e[r]=decodeURIComponent(a)),e},{}).utm_params;return e?function(e){try{let t=JSON.parse(e);if("object"==typeof t&&null!==t)return t}catch{}return null}(e):null}r.d(t,{K:()=>a}),r(12115)},24793:(e,t,r)=>{Promise.resolve().then(r.bind(r,33855))},25736:(e,t,r)=>{"use strict";r.d(t,{W:()=>a});let a="https://avala.ai".replace(/\/+$/,"")},33855:(e,t,r)=>{"use strict";r.d(t,{NewsArticleLayout:()=>eP});var a=r(95155),s=r(22893),l=r(73321),i=r(12115),n=r(97233),o=r(80723),d=r(22368),c=r(72140),m=r(84980),u=r(21628),x=r(15411),g=r(66804),h=r(96182),p=r(54679),f=r(78922),b=r(89239),y=r(34481),w=r(69303),j=r(92289),v=r(94514),N=r(9969),k=r(4365),C=r(84347),S=r(10522),A=r(25736);function K({slug:e,title:t,onShare:r}){let{t:s,language:l}=(0,C.B)(),[o,d]=(0,i.useState)(!1),c=(0,S.UC)(A.W,l,`/news/${e}`),m=encodeURIComponent(c),u=encodeURIComponent(t),x=()=>{r?.()},g=async()=>{await navigator.clipboard.writeText(c),d(!0),setTimeout(()=>d(!1),2e3),x()},h=[{name:"X",label:s("news.article.share.x"),href:`https://x.com/intent/post?url=${m}&text=${u}`,icon:k.NLt,isBrand:!0},{name:"LinkedIn",label:s("news.article.share.linkedin"),href:`https://www.linkedin.com/sharing/share-offsite/?url=${m}`,icon:k.B_4,isBrand:!0},{name:"Facebook",label:s("news.article.share.facebook"),href:`https://www.facebook.com/sharer/sharer.php?u=${m}`,icon:k.Kjv,isBrand:!0},{name:"Email",label:s("news.article.share.email"),href:`mailto:?subject=${u}&body=${m}`,icon:j.A,isBrand:!1}];return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:s("news.article.share.label")}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[h.map(e=>{let t;return(0,a.jsx)("a",{href:e.href,target:"Email"===e.name?void 0:"_blank",rel:"Email"===e.name?void 0:"noopener noreferrer",onClick:x,className:"inline-flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":e.label,children:e.isBrand?(0,a.jsx)(N.g,{icon:e.icon,className:"h-4 w-4","aria-hidden":"true"}):(t=e.icon,(0,a.jsx)(t,{className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}))},e.name)}),(0,a.jsx)("button",{type:"button",onClick:g,className:"inline-flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":s(o?"news.article.share.copied":"news.article.share.copyLink"),children:o?(0,a.jsx)(v.A,{className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}):(0,a.jsx)(n.A,{className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"})})]})]})}var T=r(6296),$=r(6430),I=r(9199),F=r(34152),B=r(20232),L=r(20986),O=r(997),E=r(27413),R=r(66669),M=r(7915),D=r(53810),P=r(40980);function U(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function _({views:e,shares:t,className:r,variant:s="default"}){let{t:l}=(0,C.B)(),i="number"==typeof e?e:0,n="number"==typeof t?t:0,o="compact"===s;return(0,a.jsxs)("div",{className:(0,P.cn)("flex items-center gap-3",r),children:["number"==typeof e&&(0,a.jsxs)("div",{className:(0,P.cn)("flex items-center gap-1.5 text-muted-foreground/80",o?"text-xs":"text-sm"),title:l("news.stats.viewsLabel").replace("{count}",String(i)),children:[(0,a.jsx)(M.A,{className:(0,P.cn)(o?"h-3 w-3":"h-4 w-4"),"aria-hidden":!0}),(0,a.jsx)("span",{children:U(i)})]}),n>0&&(0,a.jsxs)("div",{className:(0,P.cn)("flex items-center gap-1.5 text-muted-foreground/80",o?"text-xs":"text-sm"),title:l("news.stats.sharesLabel").replace("{count}",String(n)),children:[(0,a.jsx)(D.A,{className:(0,P.cn)(o?"h-3 w-3":"h-4 w-4"),"aria-hidden":!0}),(0,a.jsx)("span",{children:U(n)})]})]})}var V=r(86901),z=r(33210),Y=r(66088),X=r(49235),W=r(7728);let J="avala_draft_versions_seen";function H(){let e=function(e){if("u"<typeof document)return null;let t=document.cookie.match(RegExp(`(^| )${e}=([^;]+)`));return t?decodeURIComponent(t[2]):null}(J);if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function G({versions:e,currentVersionId:t,onVersionChange:r,slug:s}){let{t:l}=(0,C.B)(),[n,o]=(0,i.useState)(!1),[d,c]=(0,i.useState)(!1),[m,u]=(0,i.useState)(!1),x=e.find(e=>e.id===t),g=e[0];return((0,i.useEffect)(()=>{var e,t;let r,a=H()[s];g&&a&&a!==g.id&&c(!0),g&&(e=g.id,(r=H())[s]=e,t=JSON.stringify(r),"u">typeof document&&(document.cookie=`${J}=${encodeURIComponent(t)}; path=/; max-age=2592000; SameSite=Lax`))},[s,g]),e.length<=1)?null:(0,a.jsxs)(a.Fragment,{children:[d&&!m&&(0,a.jsxs)("div",{style:{position:"fixed",top:"calc(var(--header-height) + 1rem)",left:"50%",transform:"translateX(-50%)",zIndex:40,background:"rgba(255, 92, 0, 0.95)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"4px",padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)"},children:[(0,a.jsx)(V.A,{className:"h-4 w-4 text-white"}),(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--primary-foreground)",fontWeight:500},children:l("news.draft.newVersionAvailable")}),(0,a.jsx)("button",{onClick:()=>{u(!0),c(!1)},style:{background:"var(--overlay-white-20)",border:"none",borderRadius:"4px",padding:"0.25rem",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":l("news.draft.dismissBanner"),children:(0,a.jsx)(z.A,{className:"h-3.5 w-3.5 text-white"})})]}),(0,a.jsxs)("div",{style:{position:"relative"},children:[(0,a.jsxs)("button",{onClick:()=>o(!n),style:{display:"flex",alignItems:"center",gap:"0.5rem",background:"var(--overlay-white-5)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"1px solid var(--overlay-white-10)",borderRadius:"4px",padding:"0.5rem 0.75rem",cursor:"pointer",fontSize:"0.75rem",color:"var(--muted-foreground)",transition:"all 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.background="var(--overlay-white-10)",e.currentTarget.style.borderColor="var(--overlay-white-15)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--overlay-white-5)",e.currentTarget.style.borderColor="var(--overlay-white-10)"},children:[(0,a.jsx)("span",{style:{textTransform:"uppercase",letterSpacing:"0.1em",fontSize:"0.625rem"},children:l("news.draft.version")}),(0,a.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:x?.label}),(0,a.jsx)(Y.A,{className:(0,W.cn)("h-3.5 w-3.5 transition-transform duration-200",n&&"rotate-180")}
1)]}),n&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{style:{position:"fixed",inset:0,zIndex:30},onClick:()=>o(!1)}),(0,a.jsxs)("div",{style:{position:"absolute",top:"calc(100% + 0.5rem)",left:0,zIndex:40,minWidth:"280px",background:"var(--popover)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"4px",overflow:"hidden",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.4)"},children:[(0,a.jsx)("div",{style:{padding:"0.75rem 1rem",borderBottom:"1px solid rgba(255, 255, 255, 0.05)"},children:(0,a.jsx)("span",{style:{fontSize:"0.625rem",color:"var(--muted-foreground)",textTransform:"uppercase",letterSpacing:"0.15em"},children:l("news.draft.selectVersion")})}),(0,a.jsx)("div",{style:{maxHeight:"300px",overflowY:"auto"},children:e.map((e,s)=>{let i,n=e.id===t;return(0,a.jsxs)("button",{onClick:()=>{r(e.id),o(!1)},style:{display:"flex",flexDirection:"column",gap:"0.25rem",width:"100%",padding:"0.75rem 1rem",background:n?"rgba(255, 92, 0, 0.08)":"transparent",border:"none",borderBottom:"1px solid var(--overlay-white-5)",cursor:"pointer",textAlign:"left",transition:"background 0.15s ease"},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--overlay-white-5)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="transparent")},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:n?"#ff5c00":"var(--foreground)",fontWeight:n?500:400},children:e.label}),0===s&&(0,a.jsx)("span",{style:{fontSize:"0.5625rem",color:"#88fb75",textTransform:"uppercase",letterSpacing:"0.1em",padding:"0.125rem 0.375rem",background:"rgba(136, 251, 117, 0.1)",borderRadius:"2px"},children:l("news.draft.latest")})]}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",fontSize:"0.6875rem",color:"var(--muted-foreground)"},children:[(0,a.jsx)("span",{children:(i=e.date,new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(i)))}),e.gitHash&&(0,a.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,a.jsx)(X.A,{className:"h-3 w-3"}),(0,a.jsx)("code",{style:{fontFamily:"monospace"},children:e.gitHash.slice(0,7)})]})]})]},e.id)})})]})]})]})]})}var Z=r(17243),q=r(52530),Q=r(42869),ee=r(57420),et=r(24642),er=r(6962),ea=r(48368),es=r(22164),el=r(82621),ei=r(50538),en=r(67635),eo=r(91958);let ed={twitter:{default:280,min:50,max:280,unit:"chars"},linkedin:{default:150,min:50,max:300,unit:"words"},general:{default:100,min:30,max:200,unit:"words"}},ec=[{id:"engaging",nameKey:"socialCopy.style.engaging",descKey:"socialCopy.style.engaging.desc"},{id:"concise",nameKey:"socialCopy.style.concise",descKey:"socialCopy.style.concise.desc"},{id:"professional",nameKey:"socialCopy.style.professional",descKey:"socialCopy.style.professional.desc"},{id:"thought-leadership",nameKey:"socialCopy.style.thoughtLeadership",descKey:"socialCopy.style.thoughtLeadership.desc"},{id:"announcement",nameKey:"socialCopy.style.announcement",descKey:"socialCopy.style.announcement.desc"},{id:"technical",nameKey:"socialCopy.style.technical",descKey:"socialCopy.style.technical.desc"}];function em({article:e,platform:t,onContentChange:r}){let{t:s}=(0,C.B)(),l=t||"linkedin",[n,o]=(0,i.useState)("engaging"),[d,c]=(0,i.useState)("");(0,i.useEffect)(()=>{r?.(d)},[d,r]);let[m,u]=(0,i.useState)(!1),[x,g]=(0,i.useState)(!1),[h,p]=(0,i.useState)(!1),[f,b]=(0,i.useState)([]),[y,w]=(0,i.useState)(!1),[j,N]=(0,i.useState)(!1),[k,S]=(0,i.useState)(!1),A=(0,i.useRef)(!1),K=(0,i.useRef)(null),$=ed[l],[F,B]=(0,i.useState)($.default);(0,i.useEffect)(()=>{B(ed[l].default)},[l]),(0,i.useEffect)(()=>{!async function(){try{let t=await fetch(`/api/social-copy?slug=${e.slug}&platform=${l}&active=false`);if(t.ok){let e=await t.json();b(e.drafts||[]);let r=K.current!==l;if(!A.current||r){let t=(e.drafts||[]).find(e=>e.is_active);t?(c(t.content),o(t.style),N(!1)):r&&(c(""),N(!1)),A.current=!0,K.current=l}}}catch{}}()},[e.slug,l]);let L=(0,i.useCallback)(async(t,r)=>{if(t.trim()){g(!0);try{let a=await fetch("/api/social-copy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e.slug,style:r,platform:l,content:t.trim(),setActive:!0,returnDrafts:!0})});if(a.ok){N(!1);let e=await a.json();e.drafts&&b(e.drafts)}}catch(e){console.error("Failed to auto-save draft:",e)}finally{g(!1)}}},[e.slug,l]),O=(0,i.useCallback)(async()=>{u(!0),c(""),N(!0);try{let t=await fetch("/api/social-copy/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e.slug,style:n,platform:l,maxLimit:F,limitUnit:$.unit})});if(!t.ok)throw Error("GENERATION_FAILED");let r=t.body?.getReader();if(!r)throw Error("NO_RESPONSE_BODY");let a=new TextDecoder,s=[];for(;;){let{done:e,value:t}=await r.read();if(e)break;let l=a.decode(t,{stream:!0});s.push(l),c(s.join(""))}let i=s.join("");i.trim()&&await L(i,n)}catch(e){console.error("Failed to generate copy:",e),c(s("socialCopy.error.generation"))}finally{u(!1)}},[e.slug,n,l,F,$.unit,s,L]),E=(0,i.useCallback)(e=>{c(e.content),o(e.style),N(!1),w(!1)},[]),R=(0,i.useCallback)(()=>{navigator.clipboard.writeText(d),p(!0),setTimeout(()=>p(!1),2e3)},[d]),M=(0,i.useCallback)(e=>{c(e.target.value),N(!0)},[]),D=d.length,U=d.trim()?d.trim().split(/\s+/).length:0,_="chars"===$.unit?D>F:U>F;return(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsxs)("div",{className:"border-b border-border/60 p-4",children:[(0,a.jsx)("label",{className:"marketing-label mb-2 block text-muted-foreground",children:s("socialCopy.styleLabel")}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>S(!k),className:"flex w-full items-center justify-between rounded-lg border border-border/60 bg-card/70 px-3 py-2 text-left text-xs font-medium transition-all hover:border-border",children:[(0,a.jsx)("span",{children:s(ec.find(e=>e.id===n)?.nameKey||"")}),(0,a.jsx)(Y.A,{className:(0,P.cn)("h-4 w-4 text-muted-foreground transition-transform",k&&"rotate-180")}
1)]}),k&&(0,a.jsx)("div",{className:"absolute left-0 right-0 top-full z-10 mt-1 rounded-lg border border-border/60 bg-card shadow-lg",children:ec.map(e=>(0,a.jsxs)("button",{onClick:()=>{o(e.id),S(!1)},className:(0,P.cn)("flex w-full flex-col items-start px-3 py-2 text-left transition-colors first:rounded-t-lg last:rounded-b-lg hover:bg-primary/5",n===e.id&&"bg-primary/10"),children:[(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:s(e.nameKey)}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:s(e.descKey)})]},e.id))})]})]}),(0,a.jsxs)("div",{className:"border-b border-border/60 p-4",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,a.jsx)("label",{className:"marketing-label text-muted-foreground",children:s("socialCopy.wordLimit.label")}),F!==$.default&&(0,a.jsxs)("button",{onClick:()=>B($.default),className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground",title:s("socialCopy.wordLimit.reset"),children:[(0,a.jsx)(I.A,{className:"h-3 w-3"}),s("socialCopy.wordLimit.reset")]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("input",{type:"range",min:$.min,max:$.max,value:F,onChange:e=>B(Number(e.target.value)),className:"h-1.5 flex-1 cursor-pointer appearance-none rounded-full bg-border/60 accent-primary [&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-primary"}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("input",{type:"number",min:$.min,max:$.max,value:F,onChange:e=>{let t=Number(e.target.value);t>=$.min&&t<=$.max&&B(t)},className:"w-14 rounded border border-border/60 bg-card/70 px-2 py-1 text-center text-xs font-medium text-foreground focus:outline-none focus:ring-1 focus:ring-primary"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"chars"===$.unit?s("socialCopy.wordLimit.chars"):s("socialCopy.wordLimit.words")})]})]}),(0,a.jsxs)("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:[s("socialCopy.wordLimit.default"),": ",$.default," ","chars"===$.unit?s("socialCopy.wordLimit.chars"):s("socialCopy.wordLimit.words")]})]}),(0,a.jsx)("div",{className:"border-b border-border/60 p-4",children:(0,a.jsx)("button",{onClick:O,disabled:m,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2.5 text-sm font-medium text-primary-foreground transition-all hover:bg-primary/90 disabled:opacity-50",children:m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.A,{className:"h-4 w-4 animate-spin"}),s("socialCopy.generating")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.A,{className:"h-4 w-4"}),s("socialCopy.generate")]})})}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden p-4",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,a.jsx)("label",{className:"marketing-label text-muted-foreground",children:s("socialCopy.contentLabel")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[f.length>0&&(0,a.jsxs)("button",{onClick:()=>w(!y),className:(0,P.cn)("flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium transition-colors",y?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,a.jsx)(ei.A,{className:"h-3 w-3"}),s("socialCopy.history")," (",f.length,")"]}),(0,a.jsxs)("span",{className:(0,P.cn)("text-[10px]",_?"text-red-500":"text-muted-foreground"),children:["chars"===$.unit?D:U,"/",F," ","chars"===$.unit?s("socialCopy.wordLimit.chars"):s("socialCopy.wordLimit.words")]})]})]}),y&&f.length>0?(0,a.jsx)("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto",children:f.map(e=>(0,a.jsxs)("button",{onClick:()=>E(e),className:(0,P.cn)("rounded-lg border p-3 text-left transition-all hover:border-primary/50",e.is_active?"border-primary bg-primary/5":"border-border/60 bg-card/50"),children:[(0,a.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("span",{className:"rounded bg-foreground
1/10 px-1.5 py-0.5 text-[9px] font-medium text-foreground/70",children:["v",e.version]}),(0,a.jsx)("span",{className:"rounded bg-blue-500/15 px-1.5 py-0.5 text-[9px] font-medium text-blue-600 dark:text-blue-400",children:s(`socialCopy.style.${"thought-leadership"===e.style?"thoughtLeadership":e.style}`)}),(0,a.jsx)("span",{className:"rounded bg-purple-500/15 px-1.5 py-0.5 text-[9px] font-medium text-purple-600 dark:text-purple-400",children:s(`socialCopy.platform.${e.platform}`)}),e.is_active&&(0,a.jsx)("span",{className:"rounded-full bg-primary/20 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:s("socialCopy.active")})]}),(0,a.jsx)("p",{className:"line-clamp-3 text-xs text-foreground/80",children:e.content}),(0,a.jsx)("div",{className:"mt-1.5 text-[9px] text-muted-foreground",children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]},e.id))}):(0,a.jsx)("textarea",{value:d,onChange:M,placeholder:s("socialCopy.placeholder"),className:(0,P.cn)("flex-1 resize-none rounded-lg border bg-card/50 p-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary",_?"border-red-500/50":"border-border/60")})]}),(0,a.jsxs)("div",{className:"flex gap-2 border-t border-border/60 p-4",children:[(0,a.jsx)("button",{onClick:R,disabled:!d,className:"flex flex-1 items-center justify-center gap-2 rounded-lg border border-border/60 bg-card/70 px-3 py-2 text-xs font-medium text-foreground transition-all hover:bg-card disabled:opacity-50",children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.A,{className:"h-3.5 w-3.5 text-green-500"}),s("socialCopy.copied")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(en.A,{className:"h-3.5 w-3.5"}),s("socialCopy.copy")]})}),d&&(0,a.jsxs)("button",{onClick:O,disabled:m,className:"flex flex-1 items-center justify-center gap-2 rounded-lg border border-border/60 bg-card/70 px-3 py-2 text-xs font-medium text-foreground transition-all hover:bg-card disabled:opacity-50",title:s("socialCopy.regenerate"),children:[(0,a.jsx)(eo.A,{className:(0,P.cn)("h-3.5 w-3.5",m&&"animate-spin")}),s("socialCopy.regenerate")]}),x&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,a.jsx)(T.A,{className:"h-3.5 w-3.5 animate-spin"}),s("socialCopy.autoSaving")]})]})]})}let eu={linkedin:"linkedin",twitter:"twitter",instagram:"general","instagram-story":"general",facebook:"general"},ex={linkedin:"linkedin",twitter:"twitter",instagram:"instagram","instagram-story":"instagram",facebook:"facebook"},eg="#FF5C00",eh="#88FB75",ep="#A422E1",ef="#6FC1E0",eb="#101010",ey="#FFFFFF",ew={linkedin:{nameKey:"mediaKit.platform.linkedin",width:1200,height:627},instagram:{nameKey:"mediaKit.platform.instagram",width:1080,height:1080},"instagram-story":{nameKey:"mediaKit.platform.instagramStory",width:1080,height:1920},twitter:{nameKey:"mediaKit.platform.twitter",width:1600,height:900},facebook:{nameKey:"mediaKit.platform.facebook",width:1200,height:630}},ej={black:{nameKey:"mediaKit.theme.black",background:eb,textColor:ey,accentColor:eg,badgeBackgroun
1d:eg,badgeText:ey,overlayOpacity:.7,logoVariant:"white"},grey:{nameKey:"mediaKit.theme.grey",background:"#9B9B9B",textColor:ey,accentColor:eg,badgeBackground:eg,badgeText:ey,overlayOpacity:.5,logoVariant:"white",textColorNoImage:eb,logoVariantNoImage:"black"},white:{nameKey:"mediaKit.theme.white",background:ey,textColor:eb,accentColor:eg,badgeBackground:eg,badgeText:ey,overlayOpacity:.3,overlayColor:"white",imageBlur:12,logoVariant:"black",gradientOverlay:{topColor:"#FFFFFF",topOpacity:.5,bottomColor:"#FFFFFF",bottomOpacity:1}},orange:{nameKey:"mediaKit.theme.orange",background:eg,textColor:ey,accentColor:eb,badgeBackground:eb,badgeText:ey,overlayOpacity:.5,logoVariant:"white",gradientOverlay:{topColor:"#FF5C00",topOpacity:.5,bottomColor:"#993700",bottomOpacity:1},glassBadge:{opacity:.64,blur:8}},green:{nameKey:"mediaKit.theme.green",background:"#1E5715",textColor:ey,accentColor:eh,badgeBackground:eh,badgeText:eb,overlayOpacity:.65,logoVariant:"white"},purple:{nameKey:"mediaKit.theme.purple",background:"#411854",textColor:ey,accentColor:ep,badgeBackgroun
1d:ep,badgeText:ey,overlayOpacity:.65,logoVariant:"white"},blue:{nameKey:"mediaKit.theme.blue",background:ef,textColor:ey,accentColor:ef,badgeBackground:ef,badgeText:eb,overlayOpacity:.65,logoVariant:"white",textColorNoImage:eb,logoVariantNoImage:"black",badgeBackgroundNoImage:ey,badgeTextNoImage:eb}},ev="Lexend Deca",eN=[{weight:"400",path:"/fonts/lexend/LexendDeca-Regular.ttf"},{weight:"500",path:"/fonts/lexend/LexendDeca-Medium.ttf"},{weight:"600",path:"/fonts/lexend/LexendDeca-SemiBold.ttf"}];function ek({article:e}){return(0,a.jsx)(i.Suspense,{fallback:null,children:(0,a.jsx)(eC,{article:e})})}function eC({article:e}){let{t}=(0,C.B)(),r=(0,l.useRouter)(),s=(0,l.usePathname)(),o=(0,l.useSearchParams)(),d=(0,i.useRef)(null),c=(0,i.useRef)(null),[m,u]=(0,i.useState)(null),[x,g]=(0,i.useState)(""),[h,p]=(0,i.useState)(""),[f,b]=(0,i.useState)(""),[y,w]=(0,i.useState)(!0),[j,N]=(0,i.useState)(null),[k,S]=(0,i.useState)({white:null,black:null}),[K,T]=(0,i.useState)(!1),[$,I]=(0,i.useState)({x:0,y:0}),[F,B]=(0,i.useState)(!1),[L,O]=(0,i.useState)({width:0,height:0}),[E,R]=(0,i.useState)(!0),M=(0,i.useRef)(null),D=(0,i.useCallback)(e=>(0,el.R)(t,e),[t]),U="1"===o.get("mediakit"),_=o.get("platform"),V=o.get("theme"),X=null!==_&&_ in ew?_:"linkedin",W=null!==V&&V in ej?V:"black",J="0"!==o.get("showImage"),H="0"!==o.get("showCategory"),G="0"!==o.get("showAuthor"),ei="0"!==o.get("showDate"),en=o.get("imageX"),eo=o.get("imageY"),ed=ew[X],ec=ej[W],eg=(0,i.useCallback)((e,t,a)=>{let l=new URLSearchParams(o.toString());l.set(e,t),a&&a.forEach(e=>l.delete(e)),r.replace(`${s}?${l.toString()}`,{scroll:!1})},[o,r,s]),eh=(0,i.useCallback)((e,t)=>{let a=new URLSearchParams(o.toString());a.set(e,t?"0":"1"),r.replace(`${s}?${a.toString()}`,{scroll:!1})},[o,r,s]),ep=(0,i.useCallback)(()=>{r.replace(s,{scroll:!1})},[r,s]),ef=ex[X],eb="social",ey=(0,i.useMemo)(()=>{let t=new URLSearchParams;return t.set("utm_source",ef),t.set("utm_medium",eb),h.trim()&&t.set("utm_campaign",h.trim()),f.trim()&&t.set("utm_content",f.trim()),`${A.W}/news/${e.slug}?${t.toString()}`},[e.slug,ef,h,f]),ek=(0,i.useCallback)(async(e,t)=>{try{await navigator.clipboard.writeText(e),u(t),setTimeout(()=>u(null),2e3)}catch{let r=document.createElement("textarea");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),u(t),setTimeout(()=>u(null),2e3)}},[]),eA=(0,i.useCallback)(()=>{ek(window.location.href,"config")},[ek]),eK=(0,i.useCallback)(()=>{let e,t;if(!c.current)return;let r=c.current,a=r.clientWidth-48,s=r.clientHeight-48,l=ed.width/ed.height;a/s>l?e=(t=s)*l:t=(e=a)/l,O({width:Math.floor(e),height:Math.floor(t)})},[ed]),eT=(0,i.useCallback)(()=>{let e,t;if(!j)return{minX:0,maxX:0,minY:0,maxY:0};let{width:r,height:a}=ed,s=j.width/j.height;s>r/a?(t=a,e=a*s):(e=r,t=r/s);let l=Math.max(0,(e-r)/2),i=Math.max(0,(t-a)/2);return{minX:-l,maxX:l,minY:-i,maxY:i}},[j,ed]),e$=(0,i.useCallback)(e=>{if(!J||!j)return;let t="touches"in e?e.touches[0].clientX:e.clientX,r="touches"in e?e.touches[0].clientY:e.clientY;B(!0),M.current={x:t,y:r,offsetX:$.x,offsetY:$.y}},[J,j,$]),eI=(0,i.useCallback)(e=>{if(!F||!M.current)return;let t="touches"in e?e.touches[0].clientX:e.clientX,r="touches"in e?e.touches[0].clientY:e.clientY,a=eT(),s=d.current;if(!s)return;let l=s.clientWidth,i=ed.width/l,n=(t-M.current.x)*i,o=(r-M.current.y)*i;I({x:Math.max(a.minX,Math.min(a.maxX,M.current.offsetX+n)),y:Math.max(a.minY,Math.min(a.maxY,M.current.offsetY+o))})},[F,eT,ed.width]),eF=(0,i.useCallback)(()=>{B(!1),M.current=null,I(e=>{let t=new URLSearchParams(o.toString()),a=Math.round(e.x),l=Math.round(e.y);return 0===a&&0===l?(t.delete("imageX"),t.delete("imageY")):(t.set("imageX",a.toString()),t.set("imageY",l.toString())),r.replace(`${s}?${t.toString()}`,{scroll:!1}),e})},[o,r,s]),eB=(0,i.useCallback)((e,t,r,a,s)=>{let l=a;for(;l>s;){e.font=`500 ${l}px "${ev}", system-ui, sans-serif`;let a=t.split(" "),s=[],i="";for(let t of a){let a=i?`${i} ${t}`:t;e.measureText(a).width>r&&i?(s.push(i),i=t):i=a}i&&s.push(i);let n=s.every(t=>e.measureText(t).width<=r),o=s.length,d=l>60?4:l>40?5:6;if(n&&o<=d)return{fontSize:l,lines:s};l-=2}e.font=`500 ${s}px "${ev}", system-ui, sans-serif`;let i=t.split(" "),n=[],o="";for(let t of i){let a=o?`${o} ${t}`:t;e.measureText(a).width>r&&o?(n.push(o),o=t):o=a}return o&&n.push(o),{fontSize:s,lines:n}},[]),eL=(0,i.useCallback)(()=>{let t=d.current;if(!t)return;let r=t.getContext("2d");if(!r)return;let{width:a,height:s}=ed;if(t.width=a,t.height=s,r.fillStyle=ec.background,r.fillRect(0,0,a,s),J&&j){let e,t,l,i,n=j.width/j.height;if(n>a/s?(t=s,l=(a-(e=s*n))/2,i=0):(e=a,l=0,i=(s-(t=a/n))/2),ec.imageBlur&&(r.filter=`blur(${ec.imageBlur}px)`),r.drawImage(j,l+$.x,i+$.y,e,t),r.filter="none",!ec.gradientOverlay){let e="white"===ec.overlayColor?"255, 255, 255":"0, 0, 0";if(r.fillStyle=`rgba(${e}, ${ec.overlayOpacity})`,r.fillRect(0,0,a,s),"white"!==ec.overlayColor){let t=r.createLinearGradient(0,.3*s,0,s);t.addColorStop(0,`rgba(${e}, 0)`),t.addColorStop(.5,`rgba(${e}, ${.5*ec.overlayOpacity})`),t.addColorStop(1,`rgba(${e}, ${.9*ec.overlayOpacity})`),r.fillStyle=t,r.fillRect(0,0,a,s)}}}if(ec.gradientOverlay){let{topColor:e,topOpacity:t,bottomColor:l,bottomOpacity:i}=ec.gradientOverlay,n=r.createLinearGradient(0,0,0,s);n.addColorStop(0,`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`),n.addColorStop(1,`${l}${Math.round(255*i).toString(16).padStart(2,"0")}`),r.fillStyle=n,r.fillRect(0,0,a,s)}let l=Math.min(a/1200,s/627),i=60*l,n=Math.round(32*l),o=Math.round(32*l),c=i;if(H){let t=D(e.category).toUpperCase();r.font=`600 ${n}px "${ev}", system-ui, sans-serif`;let a=r.measureText(t),s=16*l,o=n+2*s,d=a.width+2.5*s,m=J&&j,u=!m&&ec.badgeBackgroun
1dNoImage?ec.badgeBackgroundNoImage:ec.badgeBackground,x=!m&&ec.badgeTextNoImage?ec.badgeTextNoImage:ec.badgeText;m&&ec.glassBadge?r.fillStyle=`rgba(0, 0, 0, ${ec.glassBadge.opacity})`:r.fillStyle=u,r.beginPath(),r.roundRect(i,i,d,o,0),r.fill(),r.fillStyle=x,r.textBaseline="middle",r.fillText(t,i+1.25*s,i+o/2),c=i+o+8*l}let m=J&&j,u=!m&&ec.textColorNoImage?ec.textColorNoImage:ec.textColor,x=!m&&ec.logoVariantNoImage?ec.logoVariantNoImage:ec.logoVariant,g=D(e.title),h=a/s,{fontSize:p,lines:f}=eB(r,g,a-2*i,h<.7?Math.round(100*l):h<1?Math.round(90*l):Math.round(84*l),Math.round(36*l)),b="instagram"===X||"instagram-story"===X;r.font=`500 ${p}px "${ev}", system-ui, sans-serif`,r.fillStyle=u,r.textBaseline="top",r.textAlign=b?"center":"left";let y=1.15*p,w=f.length*y,v=(s-w-(G||ei?1.4*o+20*l:0))/2;H&&v<c&&(v=c);let N=b?a/2:i;if(f.forEach((e,t)=>{r.fillText(e,N,v+t*y)}),G||ei){r.font=`400 ${o}px "${ev}", system-ui, sans-serif`,r.fillStyle=u,r.globalAlpha=.85;let t=[];if(G&&t.push(e.author),ei){let r=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(e.published));t.push(r)}let s=t.join("  •  "),n=v+w+20*l,d=b?a/2:i;r.fillText(s,d,n),r.globalAlpha=1}r.textAlign="left";let C=100*l,S="white"===x?k.white:k.black;S&&r.drawImage(S,a-i-C,i,C,C);let A=Math.round(28*l);r.font=`500 ${A}px "${ev}", system-ui, sans-serif`,r.fillStyle=u,r.globalAlpha=.7,r.textBaseline="bottom",b?(r.textAlign="center",r.fillText("avala.ai",a/2,s-i)):(r.textAlign="right",r.fillText("avala.ai",a-i,s-i)),r.textAlign="left",r.globalAlpha=1},[X,ed,ec,j,k,J,H,G,ei,e,D,$,eB]);(0,i.useEffect)(()=>{if(!U||!e.heroImage)return;let t=document.createElement("img");t.crossOrigin="anonymous",t.onload=()=>N(t),t.src=e.heroImage},[U,e.heroImage]),(0,i.useEffect)(()=>{let e=en?parseFloat(en):0,t=eo?parseFloat(eo):0;I({x:isNaN(e)?0:e,y:isNaN(t)?0:t})},[X,en,eo]),(0,i.useEffect)(()=>{if(!U)return;let e=e=>{let t=document.createElement("img");t.crossOrigin="anonymous",t.onload=()=>{S(r=>({...r,[e]:t}))},t.src="white"===e?"https://siuhyr0peaacfwst.public.blob.vercel-storage.com/avala-marketing-site/marks/logomarkWhite.svg":"https://siuhyr0peaacfwst.public.blob.vercel-storage.com/avala-marketing-site/marks/logomarkBlack.svg"};e("white"),e("black")},[U]),(0,i.useEffect)(()=>{U&&(async()=>{let e=eN.map(async({weight:e,path:t})=>{let r=new FontFace(ev,`url(${t})`,{weight:e,style:"normal"});await r.load(),document.fonts.add(r)});await Promise.all(e),T(!0)})()},[U]),(0,i.useEffect)(()=>{if(!U)return;eK();let e=()=>eK();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[U,eK]),(0,i.useEffect)(()=>{U&&eL()},[U,eL]);let eO=(0,i.useCallback)(()=>{let t=d.current;t&&t.toBlob(t=>{if(!t)return;let r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download=`${e.slug}-${X}.webp`,a.click(),URL.revokeObjectURL(r)},"image/webp",.92)},[e.slug,X]);return U?(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/80 backdrop-blur-xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-border/60 bg-card/50 px-4 py-3 backdrop-blur-sm md:px-6",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-foreground",children:t("mediaKit.title")}),(0,a.jsx)("button",{onClick:ep,className:"rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-card hover:text-foreground","aria-label":t("mediaKit.close"),children:(0,a.jsx)(z.A,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,a.jsx)("div",{className:"hidden w-80 shrink-0 border-r border-border/60 bg-card/50 backdrop-blur-sm lg:block xl:w-96",children:(0,a.jsx)(em,{article:e,platform:eu[X],onContentChange:g})}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden lg:flex-row",children:[(0,a.jsxs)("div",{ref:c,className:"relative flex flex-1 items-center justify-center overflow-hidden p-6",children:[(0,a.jsx)("div",{className:(0,P.cn)("relative overflow-hidden shadow-2xl shadow-black/20 transition-shadow",J&&j&&"cursor-grab",F&&"cursor-grabbing"),style:{width:L.width||"auto",height:L.height||"auto"},onMouseDown:e$,onMouseMove:eI,onMouseUp:eF,onMouseLeave:eF,onTouchStart:e$,onTouchMove:eI,onTouchEnd:eF,children:(0,a.jsx)("canvas",{ref:d,className:"pointer-events-none",style:{width:L.width||"auto",height:L.height||"auto"}})}),(0,a.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 roun
1ded-full border border-border/60 bg-card/80 px-3 py-1 text-xs text-muted-foreground backdrop-blur-sm",children:[ed.width," \xd7 ",ed.height]})]}),(0,a.jsxs)("div",{className:"border-t border-border/60 bg-card/50 backdrop-blur-sm lg:w-72 lg:border-l lg:border-t-0",children:[(0,a.jsxs)("button",{onClick:()=>R(!E),className:"flex w-full items-center justify-between px-4 py-3 lg:hidden",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:t("mediaKit.settingsLabel")}),(0,a.jsx)(Y.A,{className:(0,P.cn)("h-4 w-4 text-muted-foreground transition-transform",E&&"rotate-180")})]}),(0,a.jsxs)("div",{className:(0,P.cn)("overflow-y-auto p-4 lg:block",E?"block":"hidden"),children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("label",{className:"marketing-label mb-2 block text-muted-foreground",children:t("mediaKit.platformLabel")}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.keys(ew).map(e=>(0,a.jsx)("button",{onClick:()=>eg("platform",e,["imageX","imageY"]),className:(0,P.cn)("rounded-lg border px-3 py-2 text-xs font-medium transition-all",X===e?"border-primary bg-primary/10 text-foreground":"border-border/60 bg-card/70 text-muted-foreground hover:border-border hover:text-foreground"),children:t(ew[e].nameKey)},e))})]}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("label",{className:"marketing-label mb-2 block text-muted-foreground",children:t("mediaKit.themeLabel")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.keys(ej).map(e=>(0,a.jsx)("button",{onClick:()=>eg("theme",e),className:(0,P.cn)("h-9 w-9 rounded-lg border-2 transition-all",W===e?"border-primary scale-110":"border-transparent hover:scale-105"),style:{backgroundColor:ej[e].background},title:t(ej[e].nameKey)},e))})]}),e.heroImage&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("label",{className:"marketing-label mb-2 block text-muted-foreground",children:t("mediaKit.backgroundLabel")}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("button",{onClick:()=>{J||eh("showImage",J)},className:(0,P.cn)("flex items-center justify-center gap-2 rounded-lg border px-3 py-2 text-xs font-medium transition-all",J?"border-primary bg-primary/10 text-foreground":"border-border/60 bg-card/70 text-muted-foreground hover:border-border hover:text-foreground"),children:[(0,a.jsx)(Z.A,{className:"h-3.5 w-3.5"}),t("mediaKit.withImage")]}),(0,a.jsx)("button",{onClick:()=>{J&&eh("showImage",J)},className:(0,P.cn)("flex items-center justify-center gap-2 rounded-lg border px-3 py-2 text-xs font-medium transition-all",J?"border-border/60 bg-card/70 text-muted-foreground hover:border-border hover:text-foreground":"border-primary bg-primary/10 text-foreground"),children:t("mediaKit.solidColor")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"marketing-label mb-2 block text-muted-foreground",children:t("mediaKit.contentLabel")}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(eS,{active:H,onClick:()=>eh("showCategory",H),icon:q.A,label:t("mediaKit.showCategory")}),(0,a.jsx)(eS,{active:G,onClick:()=>eh("showAuthor",G),icon:Q.A,label:t("mediaKit.showAuthor")}),(0,a.jsx)(eS,{active:ei,onClick:()=>eh("showDate",ei),icon:ee.A,label:t("mediaKit.showDate")})]})]})]})]})]})]}),(0,a.jsxs)("div",{className:"shrink-0 border-t border-border/60 bg-card/50 backdrop-blur-sm",children:[(0,a.jsxs)("button",{onClick:()=>w(!y),className:"flex w-full items-center justify-between px-4 py-3 md:px-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(et.A,{className:"h-4 w-4 text-primary"}),(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:t("mediaKit.export.title")})]}),(0,a.jsx)(Y.A,{className:(0,P.cn)("h-4 w-4 text-muted-foreground transition-transform",y&&"rotate-180")})]}),y&&(0,a.jsxs)("div",{className:"border-t border-border/40 px-4 py-4 md:px-6",children:[(0,a.jsxs)("div",{className:"mb-4 grid gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-[10px] font-medium text-muted-foreground",children:t("mediaKit.utmBuilder.campaign")}),(0,a.jsx)("input",{type:"text",value:h,onChange:e=>p(e.target.value),placeholder:t("mediaKit.utmBuilder.campaignPlaceholder"),className:"w-full rounded-lg border border-border/60 bg-card/50 px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-[10px] font-medium text-muted-foreground",children:t("mediaKit.utmBuilder.content")}),(0,a.jsx)("input",{type:"text",value:f,onChange:e=>b(e.target.value),placeholder:t("mediaKit.utmBuilder.contentPlaceholder"),className:"w-full rounded-lg border border-border/60 bg-card/50 px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]})]}),(0,a.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("span",{className:"rounded bg-foreground
1/10 px-2 py-1 text-[10px] font-medium text-foreground/70",children:[t("mediaKit.utmBuilder.source"),": ",ef]}),(0,a.jsxs)("span",{className:"rounded bg-foreground/10 px-2 py-1 text-[10px] font-medium text-foreground/70",children:[t("mediaKit.utmBuilder.medium"),": ",eb]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsxs)("button",{onClick:eO,className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2.5 text-xs font-medium text-primary-foreground transition-all hover:bg-primary/90",children:[(0,a.jsx)(er.A,{className:"h-4 w-4"}),t("mediaKit.export.downloadImage")]}),(0,a.jsx)("button",{onClick:()=>ek(ey,"utm"),className:"flex items-center gap-2 rounded-lg border border-border/60 bg-card/70 px-4 py-2.5 text-xs font-medium text-foreground transition-all hover:bg-card",children:"utm"===m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.A,{className:"h-4 w-4 text-green-500"}),t("mediaKit.copied")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{className:"h-4 w-4"}),t("mediaKit.export.copyUtmLink")]})}),(0,a.jsx)("button",{onClick:()=>ek(x,"social"),disabled:!x,className:"flex items-center gap-2 rounded-lg border border-border/60 bg-card/70 px-4 py-2.5 text-xs font-medium text-foreground transition-all hover:bg-card disabled:cursor-not-allowed disabled:opacity-50",children:"social"===m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.A,{className:"h-4 w-4 text-green-500"}),t("mediaKit.copied")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ea.A,{className:"h-4 w-4"}),t("mediaKit.export.copySocialCopy")]})}),(0,a.jsx)("button",{onClick:eA,className:"flex items-center gap-2 rounded-lg border border-border/60 bg-card/70 px-4 py-2.5 text-xs font-medium text-muted-foreground transition-all hover:bg-card hover:text-foreground",title:t("mediaKit.copyUrl"),children:"config"===m?(0,a.jsx)(v.A,{className:"h-4 w-4 text-green-500"}):(0,a.jsx)(es.A,{className:"h-4 w-4"})})]})]})]})]}):null}function eS({active:e,onClick:t,icon:r,label:s}){return(0,a.jsxs)("button",{onClick:t,className:(0,P.cn)("flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left text-xs transition-all",e?"border-primary/30 bg-primary/5 text-foreground":"border-border/60 text-muted-foreground hover:border-border hover:text-foreground"),children:[(0,a.jsx)(r,{className:"h-3.5 w-3.5 shrink-0"}),(0,a.jsx)("span",{className:"flex-1",children:s}),(0,a.jsx)("div",{className:(0,P.cn)("h-4 w-7 rounded-full transition-colors",e?"bg-primary":"bg-border"),children:(0,a.jsx)("div",{className:(0,P.cn)("h-4 w-4 rounded-full bg-card shadow transition-transform",e?"translate-x-3":"translate-x-0")})})]})}var eA=r(84286),eK=r(80642),eT=r(7686),e$=r(12651),eI=r(9795);let eF="avala-newsletter-popup-dismissed",eB="avala-newsletter-subscribed";function eL({className:e}){let{t}=(0,C.B)(),r=(0,i.useRef)(null),[s,l]=(0,i.useState)(!1),[n,o]=(0,i.useState)(!1),[{isSubscribed:d,isDismissed:c},m]=(0,i.useState)(()=>{if("true"===localStorage.getItem(eB))return{isSubscribed:!0,isDismissed:!0};let e=localStorage.getItem(eF);if(!e)return{isSubscribed:!1,isDismissed:!1};let t=new Date(e);return{isSubscribed:!1,isDismissed:(new Date().getTime()-t.getTime())/864e5<14}}),[u,x]=(0,i.useState)(""),[g,h]=(0,i.useState)("idle"),p=(0,i.useCallback)(()=>{l(!1),m(e=>({...e,isDismissed:!0})),localStorage.setItem(eF,new Date().toISOString())},[]);async function f(e){if(e.preventDefault(),u.trim()){h("loading");try{let e=(0,eI.K)()??void 0;(await fetch("/api/newsletter/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:u.trim(),utm:e})})).ok?(h("success"),x(""),localStorage.setItem(eB,"true"),m({isSubscribed:!0,isDismissed:!0}),setTimeout(()=>{p()},3e3)):h("error")}catch{h("error")}}}(0,i.useEffect)(()=>{if(d||c)return;let e=()=>{window.scrollY/(document.documentElement.scrollHeight-window.innerHeight)>.3&&l(!0)};return window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[c,d]),(0,i.useEffect)(()=>{if(!r.current)return;let e=new IntersectionObserver(([e])=>{o(e.isIntersecting)},{threshold:.3});return e.observe(r.current),()=>e.disconnect()},[]);let b=(0,a.jsx)("div",{className:"mx-auto max-w-[600px]",children:(0,a.jsxs)("div",{className:"relative overflow-hidden rounded-2xl border border-border bg-background/80 p-6 md:p-8 shadow-hero backdrop-blur-2xl",children:[!c&&!d&&(0,a.jsx)("button",{onClick:p,className:"absolute right-4 top-4 roun
1ded-full p-1.5 text-foreground/40 transition-colors hover:bg-foreground/10 hover:text-foreground/70 focus:outline-none","aria-label":t("newsletterPopup.dismiss"),children:(0,a.jsx)(z.A,{className:"h-5 w-5"})}),(0,a.jsx)("div",{className:"relative space-y-6",children:d?(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-primary/10",children:(0,a.jsx)(eT.A,{className:"h-5 w-5 text-muted-foreground"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-medium text-foreground",children:t("newsletter.subscriberTitle")}),(0,a.jsx)("p",{className:"text-sm text-foreground/70",children:t("newsletter.subscriberDescription")})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-2 pr-8",children:[(0,a.jsx)("h3",{className:"text-2xl font-medium text-foreground",children:t("newsletterPopup.title")}),(0,a.jsx)("p",{className:"max-w-prose text-sm leading-relaxed text-foreground/70",children:t("newsletterPopup.description")})]}),"success"===g?(0,a.jsxs)(eA.P.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"flex items-center gap-3 rounded-xl border border-green-500/30 bg-green-500/10 px-4 py-3",children:[(0,a.jsx)(e$.A,{className:"h-5 w-5 shrink-0 text-green-500"}),(0,a.jsx)("p",{className:"text-sm font-medium text-green-400",children:t("newsletter.success")})]}):(0,a.jsxs)("form",{onSubmit:f,className:"flex gap-2",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(j.A,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-foreground/40"}),(0,a.jsx)("input",{type:"email",value:u,onChange:e=>{x(e.target.value),"error"===g&&h("idle")},placeholder:t("newsletter.placeholder"),required:!0,disabled:"loading"===g,className:"h-10 w-full rounded-xl border border-border bg-background/20 pl-10 pr-4 text-sm text-foreground outline-none transition placeholder:text-foreground/40 focus:border-primary disabled:opacity-50"})]}),(0,a.jsx)("button",{type:"submit",disabled:"loading"===g,className:"inline-flex h-10 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-xl bg-primary px-5 text-button-label text-white transition-colors hover:bg-primary/90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:pointer-events-none disabled:opacity-50",children:"loading"===g?(0,a.jsx)(T.A,{className:"h-4 w-4 animate-spin"}):t("newsletter.subscribe")})]}),"error"===g&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:t("newsletter.error")}),(0,a.jsx)("p",{className:"text-sm text-foreground/40",children:t("newsletterPopup.privacyNote")})]})})]})});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eK.N,{children:s&&!c&&!n&&(0,a.jsx)(eA.P.div,{initial:{y:"100%",opacity:0}
1,animate:{y:0,opacity:1},exit:{y:"100%",opacity:0},transition:{type:"spring",damping:25,stiffness:300},className:(0,P.cn)("fixed bottom-0 inset-x-0 z-50 p-4 md:p-6",e),children:b})}),(0,a.jsx)("div",{ref:r,className:(0,P.cn)("p-4 md:p-6",e),children:(n||d)&&b})]})}var eO=r(93478);let eE="article-views-tracked";function eR(){try{let e=sessionStorage.getItem(eE);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}var eM=r(30476);function eD({level:e,children:t,className:r,t:s}){let[l,o]=(0,i.useState)(!1),d=(function e(t){return"string"==typeof t?t:Array.isArray(t)?t.map(e).join(""):i.isValidElement(t)?e(t.props.children):""})(t).toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,""),c=(0,i.useCallback)(()=>{let e=`${window.location.origin}${window.location.pathname}?section=${encodeURIComponent(d)}`;navigator.clipboard.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})},[d]);return(0,a.jsxs)(2===e?"h2":"h3",{id:d,className:`${r} group relative scroll-mt-24`,children:[(0,a.jsx)("span",{onClick:c,className:"cursor-pointer",title:s(l?"news.article.section.linkCopied":"news.article.section.copyLink"),role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&c()},children:t}),(0,a.jsx)(n.A,{className:`ml-2 inline h-4 w-4 opacity-0 transition-opacity group-hover:opacity-100 ${l?"text-primary":"text-muted-foreground"}`})]})}function eP({article:e,relatedArticles:t}){let{t:r,language:n}=(0,C.B)(),j=(0,l.useSearchParams)(),v=(0,l.useRouter)(),N=(0,l.usePathname)(),[k,S]=(0,i.useState)(n);(0,i.useEffect)(()=>{S(n)},[n]);let A="en"!==k?e.translations?.[k]:void 0,T=A?k:"en",{views:$,shares:I,trackShare:F}=((0,i.useMemo)(()=>["en",...Object.keys(e.translations??{})],[e.translations]),function({slug:e,trackView:t=!1,initialViews:r=0,initialShares:a=0}){let[s,l]=(0,i.useState)({views:r,shares:a}),[n,o]=(0,i.useState)(!0),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>{let s=!1;return async function(){let i=!1;try{let n=await fetch(`/api/article-stats?slug=${encodeURIComponent(e)}`,{cache:"no-store"});if(n.ok&&!s){let s=await n.json(),o=s.views??0,c=s.shares??0,m=eR();0===o&&m.has(e)&&function(e){try{let t=eR();t.delete(e),sessionStorage.setItem(eE,JSON.stringify([...t]))}catch{}}(e);let u=eR();i=t&&!d.current&&!u.has(e),l({views:Math.max(o,r),shares:Math.max(c,a)})}}catch{let r=eR();i=t&&!d.current&&!r.has(e)}finally{s||o(!1)}if(i&&!s){d.current=!0;try{let t=document.referrer||void 0,r=(0,eI.K)()??void 0,a=await fetch("/api/article-stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,action:"view",referrer:t,utm:r})});if(a.ok&&!s){let t=await a.json();l(e=>({...e,views:t.views??e.views}));try{let t=eR();t.add(e),sessionStorage.setItem(eE,JSON.stringify([...t]))}catch{}}}catch{}}}(),()=>{s=!0}},[e,t,r,a]);let c=(0,i.useCallback)(async()=>{try{let t=await fetch("/api/article-stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,action:"share"})});if(t.ok){let e=await t.json();l(t=>({...t,shares:e.shares??t.shares}))}}catch{}},[e]);return{views:s.views,shares:s.shares,isLoading:n,trackShare:c}}({slug:e.slug,trackView:!0,initialViews:e.views,initialShares:e.shares})),B=(0,i.useMemo)(()=>{let t=[];if(e.draft&&e.draftVersions?.length){let r=e.draftVersions.length+1;t.push({id:`v${r}`,label:`Draft v${r}`,date:new Date().toISOString().split("T")[0],content:e.content}),t.push(...e.draftVersions)}return t},[e.draft,e.draftVersions,e.content]),L=(0,i.useCallback)(()=>{let e=j.get("version");return e&&B.some(t=>t.id===e)?e:B.length>0?B[0].id:""},[j,B]),[O,E]=(0,i.useState)(L),R=(0,i.useCallback)(e=>{E(e);let t=new URLSearchParams(j.toString());t.set("version",e);let r=`${N}?${t.toString()}`;v.replace(r,{scroll:!1})},[N,v,j]);(0,i.useEffect)(()=>{let e=j.get("version");e&&B.some(t=>t.id===e)?E(e):!e&&B.length>0&&E(B[0].id)},[j,B]);let M=(0,i.useMemo)(()=>{if(A)return A.content;if(!B.length)return e.content;let t=B.find(e=>e.id===O);return t?.content??e.content},[A,B,O,e.content]),D=(0,i.useMemo)(()=>({h2:({children:e,...t})=>(0,a.jsx)(eD,{level:2,className:"text-headline-md font-medium tracking-tight text-foreground",t:r,...t,children:e}),h3:({children:e,...t})=>(0,a.jsx)(eD,{level:3,className:"text-title-lg font-medium tracking-tight text-foreground",t:r,...t,children:e}
1),p:e=>(0,a.jsx)("p",{...e,className:"text-base leading-relaxed text-muted-foreground"}),ul:e=>(0,a.jsx)("ul",{...e,className:"text-base leading-relaxed text-muted-foreground"}),ol:e=>(0,a.jsx)("ol",{...e,className:"list-decimal list-inside space-y-2 text-base leading-relaxed text-muted-foreground"}),li:e=>(0,a.jsx)("li",{...e,className:"text-base leading-relaxed text-muted-foreground"}),a:({className:e,...t})=>{let r=e?.startsWith("article-");return(0,a.jsx)(f.A,{...t,className:r?e:"text-foreground underline underline-offset-4 hover:text-foreground/80",target:"_blank",rel:"noreferrer noopener"})},strong:e=>(0,a.jsx)("strong",{...e,className:"font-medium text-foreground"}),em:e=>(0,a.jsx)("em",{...e,className:"italic text-foreground"}),iframe:e=>(0,a.jsx)("iframe",{...e,className:"aspect-video w-full rounded-sm",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),[r]);(0,i.useEffect)(()=>{let e=j.get("section");if(e){let t=setTimeout(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",block:"start"})},100);return()=>clearTimeout(t)}},[j,M]);let P=e=>(0,el.R)(r,e),U=P(A?.title??e.title),V=P(A?.summary??e.summary),z=e.heroImage,Y=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(e.published)),X=t?.map(e=>({...e,resolvedTitle:P(e.title),resolvedSummary:P(e.summary),resolvedCategory:P(e.category)})),W=(e.tags??[]).map(e=>P(e)).join(", ");return(0,a.jsxs)("div",{className:e.draft?"flex flex-col pb-20":"flex flex-col",children:[(0,a.jsx)(w.w,{innerClassName:"pt-12 pb-10 md:pt-20 lg:pt-24 lg:pb-16",children:(0,a.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col gap-7",children:[(0,a.jsx)("div",{children:(0,a.jsxs)(s.A,{href:"/news",className:"sales-focus-visible group inline-flex items-center gap-2 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground motion-reduce:transition-none",children:[(0,a.jsx)(o.A,{className:"h-4 w-4 text-primary","aria-hidden":!0}),(0,a.jsx)("span",{children:r("news.article.backToNews")})]})}),(0,a.jsxs)("div",{lang:T,className:"marketing-label flex flex-wrap items-center gap-2 text-muted-foreground",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-2 text-foreground",children:[(0,a.jsx)(eO._,{category:e.category,className:"h-3 w-3 text-primary"}),P(e.category)]}),e.tags?.map(e=>(0,a.jsx)("span",{className:"inline-flex items-center border-l border-border pl-3",children:P(e)},e))]}),(0,a.jsxs)("header",{lang:T,className:"max-w-5xl space-y-6",children:[(0,a.jsx)(y.wi,{children:U}),(0,a.jsx)("p",{className:"max-w-3xl text-base leading-relaxed text-muted-foreground md:text-lg",children:V})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-border pt-6",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm text-muted-foreground",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.A,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0}),(0,a.jsx)("span",{children:r("news.meta.byAuthor").replace("{author}",e.author)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0}),(0,a.jsx)("span",{children:e.draft?r("news.meta.toBePublishedOn").replace("{date}",Y):r("news.meta.publishedOn").replace("{date}",Y)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.A,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0}),(0,a.jsx)("span",{children:r("news.meta.readTime").replace("{minutes}",String(e.readingMinutes))})]}),(0,a.jsx)(_,{views:$,shares:I,variant:"compact"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[e.draft&&B.length>1&&(0,a.jsx)(G,{versions:B,currentVersionId:O,onVersionChange:R,slug:e.slug}),!e.draft&&(0,a.jsx)(K,{slug:e.slug,title:U,onShare:F})]})]}),!1,(0,a.jsx)("div",{className:"overflow-hidden rounded-sm border border-border/60 bg-background",children:(0,a.jsx)("div",{className:"relative aspect-[16/9] w-full",children:(0,a.jsx)(eM.C,{article:{slug:e.slug,heroImage:z}
1,alt:U,className:"object-cover",sizes:"(min-width: 1280px) 1152px, 100vw",priority:!0})})})]})}),(0,a.jsx)(w.w,{className:"border-b border-border/60",innerClassName:"pb-12 pt-0 lg:pb-16 lg:pt-0",children:(0,a.jsx)("div",{className:"mx-auto w-full max-w-3xl space-y-10",children:(0,a.jsxs)("article",{className:"flex w-full flex-col gap-10",children:[e.highlights?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("p",{className:"marketing-eyebrow text-foreground",children:r("news.article.highlights")}),(0,a.jsx)("ul",{lang:T,className:"space-y-2 text-base leading-relaxed text-muted-foreground",children:e.highlights.map(e=>(0,a.jsxs)("li",{className:"flex gap-3",children:[(0,a.jsx)("span",{className:"mt-2 h-[6px] w-[6px] rounded-full bg-primary"}),(0,a.jsx)("span",{children:P(e)})]},e))})]}):null,(0,a.jsx)("div",{lang:T,className:"article-content space-y-10",children:(0,a.jsx)(g.oz,{components:D,remarkPlugins:[p.A],rehypePlugins:[h.A],children:M})}),(0,a.jsx)(eL,{})]})})}),X?.length?(0,a.jsx)(w.w,{innerClassName:"pb-16 lg:pb-24",children:(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-8",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"marketing-eyebrow text-muted-foreground",children:r("blog.hero.title")}),(0,a.jsx)(y.D4,{children:r("news.article.related.title")}),(0,a.jsx)("p",{className:"text-base leading-relaxed text-muted-foreground",children:W?r("news.article.related.subtitle").replace("{topics}",W):r("news.article.related.subtitleFallback")})]}),(0,a.jsx)(b.$,{asChild:!0,size:"m",variant:"outline",children:(0,a.jsxs)(s.A,{href:"/news",className:"sales-focus-visible",children:[(0,a.jsx)("span",{children:r("news.article.related.viewAll")}),(0,a.jsx)(u.A,{className:"h-4 w-4","aria-hidden":!0})]})})]}),(0,a.jsx)("div",{className:"grid gap-8 md:grid-cols-2 lg:grid-cols-3",children:X.map(e=>(0,a.jsxs)(s.A,{href:`/news/${e.slug}`,className:"sales-focus-visible group flex flex-col",children:[(0,a.jsx)("div",{className:"relative aspect-video w-full overflow-hidden rounded-sm",children:(0,a.jsx)(eM.C,{article:e,alt:e.resolvedTitle,className:"object-cover transition-transform duration-500 group-hover:scale-105 motion-reduce:transform-none motion-reduce:transition-none"})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground",children:[(0,a.jsx)(eO._,{category:e.category,className:"h-3 w-3 text-primary"}),e.resolvedCategory]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,el.P)(e.published)})]}),(0,a.jsx)("h3",{className:"text-title-lg font-medium leading-snug text-foreground",children:e.resolvedTitle})]})]},e.slug))})]})}):null,!e.draft&&(0,a.jsx)(ek,{article:e}),e.draft&&(0,a.jsx)("div",{className:"fixed bottom-0 left-0 right-0 z-50 border-t border-destructive bg-destructive backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"mx-auto flex max-w-3xl items-center justify-center gap-3 px-6 py-3",children:[(0,a.jsx)(x.A,{className:"h-4 w-4 shrink-0 text-destructive-foreground","aria-hidden":!0}),(0,a.jsxs)("p",{className:"text-sm font-medium text-destructive-foreground",children:[r("news.article.draftBanner.title"),(0,a.jsx)("span",{className:"ml-1 font-normal text-destructive-foreground",children:r("news.article.draftBanner.description")})]})]})})]})}},78922:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(95155),s=r(12115),l=r(72737),i=r(10522);let n=(0,s.forwardRef)(function({href:e,...t},r){let{language:s}=(0,l.ok)(),n="string"==typeof e?(0,i.Td)(s,e):e;return(0,a.jsx)("a",{ref:r,href:n,...t})})}},e=>{e.O(0,[5802,6603,9384,8074,4679,4286,9316,5755,7728,357,8441,2805,7358],()=>e(e.s=24793)),_N_E=e.O()}]);

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.