1import O from"./cY8IuC2K.js";import{_ as W,i as G,a0 as K,x as Q,b as o,v as X,C,y as Y,z as Z,B as ee,k as te,D as ae,a as v,o as re,d as se,e as g,t as A,f as T,R as ne,n as ie,l as oe,j as le}from"./DfXQ21zx.js";import ue from"./DXktjrN_.js";import{u as ce}from"./71HjjFjP.js";import{a as de,d as pe}from"./D05z8tzQ.js";import{g as me,a as fe,u as ve}from"./Cj5CGfeQ.js";const he={class:"title global-title"},ye={class:"date"},ge={style:{display:"flex","justify-content":"flex-start",width:"100%"}},we={__name:"CrdmoNewsDetail",props:{id:{type:String,default:""},locale:{type:String,default:""},isAdaptiveRoute:{type:Boolean,default:!0},backText:{type:String,default:"è¿å"}},setup(w){const s=G(),h=K(),x=Q(),c=o(()=>typeof window<"u"?window.location.origin:x.origin),$=o(()=>`${c.value}${s.path}`.replace(/\/$/,"")),S=w,b=ce();o(()=>(b==null?void 0:b.value)||S.id);const N=o(()=>s.query.preview),l=o(()=>s.query.t),d=o(()=>s.params.id),p=o(()=>(l==null?void 0:l.value)!==void 0?s.query.locale:S.locale);o(()=>s.path.split("/").filter(Boolean)[1]||"crdmo-event");const y=X({}),z=()=>{const e=["home"],t=s.path.split("/").filter(Boolean);for(let n=0;n<t.length-1;n++){const r=t[n];r==="zh-hk"||r==="zh-cn"||r==="en"||e.push(r)}return[...new Set(e)]},D=async()=>{try{const e=z(),t=await Promise.all(e.map(async r=>{try{const{data:i}=await $fetch("/api/ymkd/v1/page-info",{query:{code:r,locale:p.value}});return{code:r,title:(i==null?void 0:i.title)||""}}catch(i){return console.warn(`Failed to fetch title for code: ${r}`,i),{code:r,title:""}}})),n={};for(const r of t)n[r.code]=r.title;y.value=n}catch(e){console.error("Failed to fetch breadcrumb titles",e),y.value={}}},R=()=>{var i;const e=[],t=s.path.split("/").filter(Boolean),n=y.value.home||"Home";e.push({"@type":"ListItem",position:1,name:n,item:`${c.value}/`});let r=2;for(let u=0;u<t.length-1;u++){const f=t[u];if(f==="zh-hk"||f==="zh-cn"||f==="en")continue;let H="/"+t.slice(0,u+1).join("/"),M=y.value[f]||f;e.push({"@type":"ListItem",position:r++,name:M,item:`${c.value}${H}`})}return(i=a.value)!=null&&i.title&&e.push({"@type":"ListItem",position:r,name:a.value.title,item:`${c.value}${s.path}`}),e},q=e=>e==null?!1:/^\d+$/.test(String(e));let _=!1;const P=async()=>{var n,r;if(_||l.value!==void 0)return;const e=d.value;if(!q(e))return;const t=((n=a.value)==null?void 0:n.slug)||((r=a.value)==null?void 0:r.documentId);t&&(_=!0,await h.replace({...s,params:{...s.params,id:t}}
1))},J=e=>{if(e==null)return!1;const t=String(e);return!!(/^[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{12}$/i.test(t)||/^[a-z0-9]{20,}$/i.test(t))};let m=!1;C(d,()=>{_=!1,m=!1});const U=async()=>{if(m||l.value!==void 0||!a.value)return;const e=d.value;if(J(e)&&a.value.slug)m=!0,await h.replace({...s,params:{...s.params,id:a.value.slug}});else if(q(e)){const t=a.value.slug||a.value.documentId;t&&e!==String(t)&&(m=!0,await h.replace({...s,params:{...s.params,id:t}}))}else{const t=a.value.slug||a.value.documentId;t&&e!==t&&(m=!0,await h.replace({...s,params:{...s.params,id:t}}))}},{reportPvUv:V}=ve(),B=Y("global-seo-page-data",()=>({title:"",description:"",seoDescription:"",createdAt:"",updatedAt:"",publishedAt:"",canonical:"",faqJson:"",type:"NewsArticle"})),E=async()=>{const e=le(),t=d.value,n=s.query.strapi_preview==="true";return t?(await $fetch("/api/ymkd/v1/getCrdmoNewsById",{query:{id:t,previewUid:N.value,t:l.value,type:s.query.type,strapi_preview:s.query.strapi_preview,locale:p.value||e.public.VITE_DEFAULT_LOCALE},headers:n?{"x-preview-token":String(s.query.preview_token||"")}:void 0})).data??{}:{}},j=async()=>{await D();const e=await E();return e!=null&&e.title&&(B.value={title:e.metaTitle||e.title||"",description:e.metaDescription||e.descriptions||e.keywords||"",seoDescription:e.metaDescription||e.descriptions||"",createdAt:e.createdAt||"",updatedAt:e.updatedAt||"",publishedAt:e.publishedAt||"",canonical:$.value||"",faqJson:e.faqJson||"",type:"NewsArticle"}),e},{data:a,pending:I,error:k}=Z(`crdmo-news-detail-${d.value||"pending"}-${p.value}`,j,{server:!0,watch:[d,N,p]});C(()=>[I.value,a.value],async([e,t])=>{!e&&!k.value&&t&&(await U(),t!=null&&t.documentId&&V({mark:"crdmoNews",id:t.documentId,locale:p.value,t:l.value,normalizeRouteId:P,getVisitorId:me,getIp:fe}))},{immediate:!0}),ee(()=>{!I.value&&!k.value&&a.value&&(B.value={title:a.value.metaTitle||a.value.title||"",description:a.value.metaDescription||a.value.descriptions||a.value.keywords||"",seoDescription:a.value.metaDescription||a.value.descriptions||"",createdAt:a.value.createdAt||"",updatedAt:a.value.updatedAt||"",publishedAt:a.value.publishedAt||"",canonical:$.value||"",faqJson:a.value.faqJson||"",type:"NewsArticle"})});const L=o(()=>{if(I.value||k.value||!a.value)return null;const e=R();return e.length===0?null:{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e}});o(()=>{const e=s.path;return e==="/zh-hk"||e.startsWith("/zh-hk/")?`${c.value}/zh-hk`:c.value});const{locale:F}=te();return o(()=>de(F.value)),ae(()=>{var t,n,r,i,u;const e=[];return L.value&&e.push({key:"breadcrumb-jsonld",type:"application/ld+json",innerHTML:JSON.stringify(L.value)}),{title:((t=a.value)==null?void 0:t.metaTitle)??((n=a.value)==null?void 0:n.title),meta:[{name:"keywords",content:((r=a.value)==null?void 0:r.keywords)??""},{name:"description",content:((i=a.value)==null?void 0:i.metaDescription)??((u=a.value)==null?void 0:u.descriptions)}],script:e}}),(e,t)=>{const n=O;return v(a)?(re(),se("div",{key:0,class:ie(["news-detail common-content",{"is-adaptive-route":w.isAdaptiveRoute}])},[g("h1",he,A(v(a).title),1),g("p",ye,A(v(pe)(v(a).date)),1),T(ue,{content:v(a).content},null,8,["content"]),g("div",ge,[g("span",{class:"back",onClick:t[0]||(t[0]=r=>e.$router.go(-1))},[T(n,{class:"icon",color:"#0089bf"}),ne(" "+A(w.backText),1)])])],2)):oe("",!0)}}},Ne=W(we,[["__scopeId","data-v-e2ad6d9a"]]);export{Ne as default};
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.