1import{g as x,u as b,r as n,h as y,s as v,S as w,i as k,p as _,j as e,f as L,C as S,L as C}from"./index-D2fOo6cO.js";import{P as E}from"./pencil-C3R_QmUH.js";const M=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],P=x("external-link",M);const A=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],K=x("eye-off",A);function O(){const{t,i18n:m}=b(),[i,u]=n.useState({}),[l,p]=n.useState(""),[h,c]=n.useState(!0),[o,f]=n.useState(y(m.language));n.useEffect(()=>{let s=!0;return c(!0),(async()=>{const{data:r}=await v.from("page_seo").select("route_key, locale, title, description, keywords, og_image_url, noindex, updated_at").eq("locale",o);if(!s)return;const a={};for(const d of r??[])a[d.route_key]=d;
1u(a),c(!1)})(),()=>{s=!1}},[o]);const g=n.useMemo(()=>w.filter(s=>!!s.routeKey).map(s=>{const r=s.routeKey,a=i[r],d=k(s,o),j=a?a.noindex:!!s.defaultNoindex,N=_(r,o);return{routeKey:r,path:N,label:s.labelKey?t(s.labelKey):s.path,title:a?.title||d.title,description:a?.description||d.description,noindex:j,customized:!!a&&(!!a.title||!!a.description||!!a.keywords||!!a.og_image_url||a.noindex!==!!s.defaultNoindex)}}),[i,t,o]).filter(s=>{if(!l)return!0;const r=l.toLowerCase();return s.path.toLowerCase().includes(r)||s.title.toLowerCase().includes(r)||s.label.toLowerCase().includes(r)});return e.jsxs("div",{className:"container mx-auto py-10 px-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl md:text-3xl font-bold text-foreground",children:t("admin.seo.title")}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("admin.seo.subtitle")})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t("admin.seo.localeLabel")}),e.jsx("div",{className:"flex rounded-md border border-border overflow-hidden",children:L.map(s=>e.jsxs("button",{onClick:()=>f(s.code),className:`px-3 py-1 text-xs font-medium transition-colors ${o===s.code?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-tag"}`,children:[e.jsx("span",{"aria-hidden":!0,className:"mr-1",children:s.flag}),s.shortLabel]},s.code))})]}),e.jsx("input",{value:l,onChange:s=>p(s.target.value),placeholder:t("admin.seo.searchPlaceholder"),className:"text-sm px-3 py-1.5 rounded-md border border-border bg-background focus:outline-none focus:border-primary"})]})]}),e.jsx("div",{className:"mt-6 bg-card border border-border rounded-lg overflow-hidden",children:h?e.jsx("p",{className:"p-6 text-sm text-muted-foreground text-center",children:"â¦"}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-tag/40 text-xs uppercase text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3",children:t("admin.seo.columns.page")}),e.jsx("th",{className:"text-left px-4 py-3",children:t("admin.seo.columns.title")}),e.jsx("th",{className:"text-left px-4 py-3",children:t("admin.seo.columns.status")}),e.jsx("th",{className:"text-right px-4 py-3",children:t("admin.seo.columns.actions")})]})}),e.jsx("tbody",{children:g.map(s=>e.jsxs("tr",{className:"border-t border-border align-top",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:s.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.path})]}),e.jsxs("td",{className:"px-4 py-3 max-w-xl",children:[e.jsx("div",{className:"text-foreground line-clamp-1",children:s.title}),e.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:s.description})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[s.noindex?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-amber-100 text-amber-800 w-fit",children:[e.jsx(K,{className:"w-3 h-3"})," ",t("admin.seo.status.hidden")]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-100 text-green-800 w-fit",children:[e.jsx(S,{className:"w-3 h-3"})," ",t("admin.seo.status.indexed")]}),s.customized&&e.jsx("span",{className:"text-xs text-muted-foreground",children:t("admin.seo.status.customized")})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("a",{href:s.path,target:"_blank",rel:"noreferrer",className:"p-1.5 hover:bg-tag rounded",title:t("admin.seo.actions.open"),children:e.jsx(P,{className:"w-4 h-4"})}),e.jsx(C,{to:"/admin/seo/$path",params:{path:s.routeKey},search:{lang:o},className:"p-1.5 hover:bg-tag rounded",title:t("admin.seo.actions.edit"),children:e.jsx(E,{className:"w-4 h-4"})})]})})]},s.path))})]})})]})}export{O as component};
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.