@canonry/canonry 4.175.0 → 4.176.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -15
- package/assets/assets/{AuditHistoryPanel-C_tGzDt2.js → AuditHistoryPanel-aEUCJheK.js} +1 -1
- package/assets/assets/{BacklinksPage-CgKG9gLz.js → BacklinksPage-BcWequGL.js} +1 -1
- package/assets/assets/{HistoryPage-W7VBtrf9.js → HistoryPage-D0BWQK0c.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-DMbdygLZ.js → MeasurementPropertyPage-D96eQnYJ.js} +1 -1
- package/assets/assets/ProjectPage-CoRkwGec.js +9 -0
- package/assets/assets/{RunRow-DI7R9Gc_.js → RunRow--3y-0dSr.js} +1 -1
- package/assets/assets/{RunsPage-Ct90Y0n5.js → RunsPage-7wdCl_J3.js} +1 -1
- package/assets/assets/{SettingsPage-CZOkHD5Q.js → SettingsPage-D37dV5-m.js} +1 -1
- package/assets/assets/{SiteHealthSection-DxMTxuhq.js → SiteHealthSection-B9WF97sJ.js} +3 -3
- package/assets/assets/{TrafficPage-LyHMCUIw.js → TrafficPage-Bn1yDSRr.js} +1 -1
- package/assets/assets/TrafficSourceDetailPage-CURlB_yO.js +1 -0
- package/assets/assets/{extract-error-message-CYrIZxuc.js → extract-error-message-DlPqK0mV.js} +1 -1
- package/assets/assets/{index-ahTB9rD2.js → index-CiQNKNMG.js} +2 -2
- package/assets/assets/{react-sigma_core.esm.min-DHkPbSvc.js → react-sigma_core.esm.min-Dc7_SFjo.js} +1 -1
- package/assets/index.html +1 -1
- package/package.json +13 -13
- package/assets/assets/ProjectPage-D_h2PyoN.js +0 -9
- package/assets/assets/TrafficSourceDetailPage-Fd6Pv5hY.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,C as Re,E as Ee,r as o,L as $e}from"./vendor-tanstack-Dock0eH1.js";import{c_ as W,c$ as i,I as P,T as Fe,i as ae,B as He,d as H,d0 as Pe}from"./index-ahTB9rD2.js";import{g as Ue,h as Oe,i as Me,t as _e,a as De}from"./extract-error-message-CYrIZxuc.js";import{e as Y,h as Be,C as re,a as ne,c as ze}from"./ChartPrimitives-BoYe2M-i.js";import{q as Ke,z as Ge,e as We,y as le,X as Ve}from"./vendor-lucide-nYKv-BB7.js";import{R as qe,B as Xe,a as Qe,X as Ye,Y as Ze,T as Je,f as V,g as q}from"./vendor-recharts-D8rt5lKn.js";import"./vendor-radix-4UOaVWza.js";import"./vendor-markdown-Bn7fRwrx.js";import"./vendor-yaml-GWJz5H2G.js";const et=[{value:"all",label:"All status"},{value:"2xx",label:"2xx success"},{value:"3xx",label:"3xx redirect"},{value:"4xx",label:"4xx client error"},{value:"5xx",label:"5xx server error"}],he=[{value:"all",label:"All claims"},{value:W.verified,label:"Verified"},{value:W.claimed_unverified,label:"Claimed unverified"},{value:W.unknown_ai_like,label:"Unknown AI-like"}];function tt(s){return s==="all"?null:Number.parseInt(s[0],10)}function fe(s){switch(s.kind){case i.crawler:case i["ai-user-fetch"]:return s.botId;case i["ai-referral"]:return s.product}}function pe(s){switch(s.kind){case i.crawler:case i["ai-user-fetch"]:return s.pathNormalized;case i["ai-referral"]:return s.landingPathNormalized}}function st(s){switch(s.kind){case i.crawler:case i["ai-user-fetch"]:return s.verificationStatus;case i["ai-referral"]:return null}}function at(s,a){if(a==="hour")return s;const r=new Date(s),n=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),h=String(r.getDate()).padStart(2,"0");return`${n}-${u}-${h}`}function rt(s,a,r){const n=a.pathQuery.trim().toLowerCase(),u=tt(a.statusClass);return s.filter(h=>!(a.selectedBucket&&at(h.tsHour,r)!==a.selectedBucket||a.identity&&fe(h)!==a.identity||a.operator&&h.operator!==a.operator||n&&!pe(h).toLowerCase().includes(n)||u!==null&&Math.floor(h.status/100)!==u||a.verification!=="all"&&st(h)!==a.verification))}function nt(s,a){if(!s||typeof s!="object")return null;const r=s.activeTooltipIndex;let n;if(typeof r=="number")n=r;else if(typeof r=="string"&&r!=="")n=Number(r);else return null;return!Number.isInteger(n)||n<0||n>=a.length?null:a[n]?.bucket??null}const U=[{value:60,label:"1h",granularity:"hour",fetchLimit:500},{value:360,label:"6h",granularity:"hour",fetchLimit:500},{value:1440,label:"24h",granularity:"hour",fetchLimit:500},{value:10080,label:"7d",granularity:"hour",fetchLimit:1e3},{value:720*60,label:"30d",granularity:"day",fetchLimit:2e3},{value:2160*60,label:"90d",granularity:"day",fetchLimit:5e3}],ie=U.find(s=>s.label==="24h")??U[2],L=50,oe=Y[0],ce=Y[2],de=Y[1],ue=Pe();function be(s){const a=new Date(s);return`${a.getMonth()+1}/${a.getDate()} ${String(a.getHours()).padStart(2,"0")}:00`}function lt(s){const a=new Date(`${s}T00:00:00`);return`${a.getMonth()+1}/${a.getDate()}`}function xe(s){if(!s)return"never";const a=Date.now()-new Date(s).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function me({canGoBack:s,className:a}){const r="inline-flex items-center gap-1";if(s){const n=()=>{window.history.back()};return e.jsxs("button",{type:"button",onClick:n,className:`${r} ${a??""}`,children:[e.jsx(le,{className:"size-3"})," Back"]})}return e.jsxs($e,{to:"/traffic",className:`${r} ${a??""}`,children:[e.jsx(le,{className:"size-3"})," All sources"]})}function Nt(){const s=Re({strict:!1}),a=s.projectName??"",r=Ee(),n=s.sourceId??"",[u,h]=o.useState(ie.value),[f,ye]=o.useState(()=>new Set(["crawler","ai-user-fetch","ai-referral"])),[c,I]=o.useState(null),[p,O]=o.useState(""),[b,M]=o.useState(""),[v,_]=o.useState(""),[N,D]=o.useState("all"),[S,B]=o.useState("all"),[je,z]=o.useState(1),[Z,J]=o.useState(null),[ee,te]=o.useState(null),x=o.useMemo(()=>U.find(t=>t.value===u)??ie,[u]),K=Ue(a||null,n||null),g=Oe(a||null,{kind:"all",sourceId:n||void 0,sinceMinutes:u,limit:x.fetchLimit,granularity:x.granularity}),A=Me(a||null,n||null),l=K.data,w=g.data?.events??[],y=g.data?.totals,R=g.data?.eventRows,E=o.useMemo(()=>w.filter(t=>{switch(t.kind){case i.crawler:return f.has("crawler");case i["ai-user-fetch"]:return f.has("ai-user-fetch");case i["ai-referral"]:return f.has("ai-referral")}}),[w,f]),ve=o.useMemo(()=>{const t=new Set;for(const d of w)t.add(fe(d));return p&&t.add(p),[...t].sort((d,m)=>d.localeCompare(m))},[w,p]),Ne=o.useMemo(()=>{const t=new Set;for(const d of w)t.add(d.operator);return b&&t.add(b),[...t].sort((d,m)=>d.localeCompare(m))},[w,b]),j=o.useMemo(()=>rt(E,{selectedBucket:c,identity:p,operator:b,pathQuery:v,statusClass:N,verification:S},x.granularity),[E,c,p,b,v,N,S,x.granularity]);o.useEffect(()=>{z(1)},[E,c,p,b,v,N,S]);const $=Math.max(1,Math.ceil(j.length/L)),F=Math.min(Math.max(1,je),$),T=(F-1)*L,Se=o.useMemo(()=>j.slice(T,T+L),[j,T]),we=j.length>L,Ce=j.length===0?0:T+1,ke=Math.min(T+L,j.length),se=o.useMemo(()=>c?ge(c,x.granularity):null,[c,x.granularity]),C=o.useMemo(()=>it(g.data?.series.points??[],x.granularity),[g.data?.series.points,x.granularity]),G=t=>{ye(d=>{const m=new Set(d);return m.has(t)?m.size>1&&m.delete(t):m.add(t),m})},Te=t=>{const d=nt(t,C);d&&I(m=>m===d?null:d)},Le=()=>{I(null),O(""),M(""),_(""),D("all"),B("all")},Ie=!!(c||p||b||v.trim()||N!=="all"||S!=="all"),Ae=async()=>{J(null),te(null);try{const t=await A.mutateAsync({sinceMinutes:60});te(`Pulled ${t.pulledEvents} entries · ${t.crawlerHits} crawler · ${t.aiUserFetchHits} AI user fetch · ${t.aiReferralHits} AI referral · ${t.unknownHits} unknown`)}catch(t){J(De(t))}};return!a||!n?e.jsx("div",{className:"page-container",children:e.jsx("p",{className:"text-sm text-muted",children:"Missing project name or source id in URL."})}):K.isLoading?e.jsx("div",{className:"page-container",children:e.jsx("p",{className:"text-sm text-muted",children:"Loading source…"})}):K.isError||!l?e.jsxs("div",{className:"page-container",children:[e.jsx("p",{className:"text-sm text-negative",children:"Could not load this source."}),e.jsx(me,{canGoBack:r,className:"mt-2 text-xs text-secondary hover:text-strong"})]}):e.jsxs("div",{className:"page-container space-y-8",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{className:"page-header-left",children:[e.jsx(me,{canGoBack:r,className:"text-xs text-muted hover:text-strong"}),e.jsx("h1",{className:"page-title mt-2",children:l.displayName}),e.jsxs("p",{className:"page-subtitle",children:[l.sourceType," source for ",a]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{tone:_e(l.status),children:l.status}),!ae()&&e.jsxs(He,{type:"button",variant:"outline",size:"sm",disabled:A.isPending,onClick:()=>{Ae()},children:[e.jsx(Ke,{className:`size-3.5 ${A.isPending?"animate-spin":""}`}),A.isPending?"Syncing…":"Sync now"]})]})]}),Z?e.jsx("div",{className:"rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-sm text-negative-200",children:Z}):null,ee?e.jsx("div",{className:"rounded-md border border-positive-800/50 bg-positive-950/30 px-3 py-2 text-sm text-positive-200",children:ee}):null,e.jsxs("section",{"aria-labelledby":"traffic-24h-heading",children:[e.jsx("h2",{id:"traffic-24h-heading",className:"mb-3 text-sm font-medium text-heading",children:"Last 24 hours"}),e.jsxs("div",{className:"grid grid-cols-1 divide-y divide-default border-y border-default sm:grid-cols-3 sm:divide-x sm:divide-y-0",children:[e.jsx(Q,{label:"Content crawls",value:l.totals24h.crawlerContentHits,tooltip:`Content and document paths only. Excludes sitemap ${l.totals24h.crawlerSegments.sitemap.toLocaleString("en-US")}, robots ${l.totals24h.crawlerSegments.robots.toLocaleString("en-US")}, assets ${l.totals24h.crawlerSegments.asset.toLocaleString("en-US")}, and ${l.totals24h.crawlerSegments.other.toLocaleString("en-US")} other requests such as feeds, API paths, or downloads. Total crawler hits: ${l.totals24h.crawlerHits.toLocaleString("en-US")}.`}),e.jsx(Q,{label:"AI user fetches",value:l.totals24h.aiUserFetchHits,tooltip:"ChatGPT-User/Perplexity-User fetches initiated by a real user in an AI surface."}),e.jsx(Q,{label:"AI referral sessions",value:l.totals24h.aiReferralHits,tooltip:"Browser click-throughs from AI surfaces, identified by Referer or UTM evidence."})]})]}),e.jsxs("section",{children:[e.jsx("p",{className:"eyebrow mb-4",children:"Latest sync run"}),l.latestRun?e.jsxs(H,{className:"p-4 text-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-1.5",children:[e.jsxs("span",{className:"text-heading",children:["Status: ",e.jsx("span",{className:"font-medium",children:l.latestRun.status})]}),e.jsxs("span",{className:"text-muted",children:["Started: ",xe(l.latestRun.startedAt)]}),l.latestRun.finishedAt?e.jsxs("span",{className:"text-muted",children:["Finished: ",xe(l.latestRun.finishedAt)]}):null]}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Run details"}),e.jsx("code",{className:"mt-2 block text-xs text-muted",children:l.latestRun.runId})]}),l.latestRun.error?e.jsx("p",{className:"mt-2 rounded border border-negative-900/40 bg-negative-950/30 px-3 py-2 text-xs text-negative",children:l.latestRun.error}):null]}):e.jsx(H,{className:"px-4 py-3 text-sm text-muted",children:ae()?"No traffic-sync runs recorded yet.":'No traffic-sync runs recorded yet. Hit "Sync now" above to create one.'})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted",children:"Events"}),e.jsx("h2",{className:"mt-1 text-base font-semibold text-primary",children:x.granularity==="day"?"Daily rollups":"Hourly rollups"}),y?e.jsxs("p",{className:"mt-1.5 text-xs text-muted",children:[y.crawlerContentHits.toLocaleString("en-US")," content crawls ·"," ",y.crawlerInfraHits.toLocaleString("en-US")," infra (sitemap/robots/assets) ·"," ",y.aiUserFetchHits.toLocaleString("en-US")," AI user fetches ·"," ",y.aiReferralHits.toLocaleString("en-US")," AI referral sessions · last ",x.label," · ",ue]}):null]}),e.jsx("div",{className:"inline-flex rounded-md border border-base p-0.5",role:"toolbar","aria-label":"Window",children:U.map(t=>e.jsx("button",{type:"button",className:`rounded px-2.5 py-1 text-xs ${u===t.value?"bg-bg-elevated text-heading":"text-secondary hover:text-strong"}`,"aria-pressed":u===t.value,onClick:()=>{h(t.value),I(null)},children:t.label},t.value))})]}),e.jsxs(H,{className:"p-4",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",role:"toolbar","aria-label":"Series",children:[e.jsx(X,{label:"Crawler",color:oe,count:y?.crawlerHits??0,active:f.has("crawler"),onToggle:()=>G("crawler")}),e.jsx(X,{label:"AI user fetches",color:ce,count:y?.aiUserFetchHits??0,active:f.has("ai-user-fetch"),onToggle:()=>G("ai-user-fetch")}),e.jsx(X,{label:"AI referral sessions",color:de,count:y?.aiReferralHits??0,active:f.has("ai-referral"),onToggle:()=>G("ai-referral")})]}),g.isError?e.jsxs("p",{className:"py-12 text-center text-xs text-negative-400",children:["Failed to load events: ",g.error instanceof Error?g.error.message:"Unknown error"]}):g.isLoading?e.jsx("p",{className:"py-12 text-center text-xs text-muted",children:"Loading events…"}):C.length===0?e.jsx("p",{className:"py-12 text-center text-xs text-muted",children:"No events in this window."}):e.jsx("div",{className:"h-72",children:e.jsx(qe,{children:e.jsxs(Xe,{data:C,margin:{top:4,right:4,bottom:0,left:0},onClick:Te,style:{cursor:"pointer"},children:[e.jsx(Qe,{stroke:Be,strokeDasharray:"3 3"}),e.jsx(Ye,{dataKey:"label",tick:ne,stroke:re,interval:"preserveStartEnd",minTickGap:x.granularity==="day"?24:32}),e.jsx(Ze,{tick:ne,stroke:re,allowDecimals:!1}),e.jsx(Je,{...ze}),f.has("crawler")?e.jsx(V,{dataKey:"crawler",name:"Crawler",fill:oe,stackId:"a",children:C.map(t=>e.jsx(q,{fillOpacity:c&&c!==t.bucket?.25:1},t.bucket))}):null,f.has("ai-user-fetch")?e.jsx(V,{dataKey:"aiUserFetch",name:"AI user fetch",fill:ce,stackId:"a",children:C.map(t=>e.jsx(q,{fillOpacity:c&&c!==t.bucket?.25:1},t.bucket))}):null,f.has("ai-referral")?e.jsx(V,{dataKey:"aiReferral",name:"AI referral",fill:de,stackId:"a",children:C.map(t=>e.jsx(q,{fillOpacity:c&&c!==t.bucket?.25:1},t.bucket))}):null]})})})]})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted",children:"Event rows"}),e.jsxs("p",{className:"mt-1 text-xs text-muted",children:["Showing ",e.jsx("span",{className:"tabular-nums text-neutral",children:j.length.toLocaleString("en-US")})," of"," ",e.jsx("span",{className:"tabular-nums text-muted",children:E.length.toLocaleString("en-US")})," ",R?.truncated?"loaded events":"events",R?.truncated?e.jsxs(e.Fragment,{children:[" ","· loaded ",e.jsx("span",{className:"tabular-nums text-neutral",children:R.returned.toLocaleString("en-US")})," of"," ",e.jsx("span",{className:"tabular-nums text-muted",children:R.total.toLocaleString("en-US")})," rows"]}):null," ","· ",ue]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center text-secondary",children:[e.jsxs("select",{"aria-label":"Filter by identity",value:p,onChange:t=>O(t.target.value),className:"rounded-md border border-base bg-bg px-2.5 py-1.5 text-xs text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[e.jsx("option",{value:"",children:"All identities"}),ve.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(P,{text:"The specific bot or AI product making the request (e.g., GPTBot, ChatGPT-User, Perplexity). One operator usually runs several identities."})]}),e.jsxs("span",{className:"inline-flex items-center text-secondary",children:[e.jsxs("select",{"aria-label":"Filter by operator",value:b,onChange:t=>M(t.target.value),className:"rounded-md border border-base bg-bg px-2.5 py-1.5 text-xs text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[e.jsx("option",{value:"",children:"All operators"}),Ne.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(P,{text:"The company that runs the bot or product (e.g., OpenAI, Anthropic, Perplexity). Filtering by operator includes every identity under that company."})]}),e.jsx("select",{"aria-label":"Filter by HTTP status class",value:N,onChange:t=>D(t.target.value),className:"rounded-md border border-base bg-bg px-2.5 py-1.5 text-xs text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:et.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsx("select",{"aria-label":"Filter by verification claim",value:S,onChange:t=>B(t.target.value),className:"rounded-md border border-base bg-bg px-2.5 py-1.5 text-xs text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:he.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsx("input",{type:"search","aria-label":"Filter by path",placeholder:"path contains…",value:v,onChange:t=>_(t.target.value),className:"w-44 rounded-md border border-base bg-bg px-2.5 py-1.5 text-xs text-strong placeholder:text-faint focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600"})]})]}),Ie?e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[se?e.jsx(k,{label:`Bucket: ${se}`,onClear:()=>I(null)}):null,p?e.jsx(k,{label:`Identity: ${p}`,onClear:()=>O("")}):null,b?e.jsx(k,{label:`Operator: ${b}`,onClear:()=>M("")}):null,v.trim()?e.jsx(k,{label:`Path: ${v.trim()}`,onClear:()=>_("")}):null,N!=="all"?e.jsx(k,{label:`Status: ${N}`,onClear:()=>D("all")}):null,S!=="all"?e.jsx(k,{label:`Claim: ${ot(S)}`,onClear:()=>B("all")}):null,e.jsx("button",{type:"button",onClick:Le,className:"text-xs text-muted underline-offset-4 hover:text-strong hover:underline",children:"Clear all"})]}):null,e.jsx(xt,{events:Se}),we?e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-xs text-secondary",children:[e.jsxs("p",{className:"tabular-nums",children:["Showing ",e.jsx("span",{className:"text-neutral",children:Ce.toLocaleString("en-US")}),"–",e.jsx("span",{className:"text-neutral",children:ke.toLocaleString("en-US")})," of"," ",e.jsx("span",{className:"text-neutral",children:j.length.toLocaleString("en-US")})," events"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>z(t=>Math.max(1,t-1)),disabled:F<=1,"aria-label":"Previous page",className:"inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong",children:[e.jsx(Ge,{className:"size-3.5"}),"Prev"]}),e.jsxs("span",{className:"tabular-nums",children:["Page ",e.jsx("span",{className:"text-strong",children:F})," of"," ",e.jsx("span",{className:"text-strong",children:$})]}),e.jsxs("button",{type:"button",onClick:()=>z(t=>Math.min($,t+1)),disabled:F>=$,"aria-label":"Next page",className:"inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong",children:["Next",e.jsx(We,{className:"size-3.5"})]})]})]}):null]}),e.jsxs("details",{className:"border-t border-default pt-4",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"How traffic is classified"}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm text-secondary",children:"Crawler requests, AI user fetches, and referrals are recorded separately. Filters expose the underlying evidence."})]})]})}function ge(s,a){return a==="day"?lt(s):be(s)}function it(s,a){return s.map(r=>({bucket:r.bucket,label:ge(r.bucket,a),crawler:r.crawlerHits,aiUserFetch:r.aiUserFetchHits,aiReferral:r.aiReferralHits}))}function ot(s){return he.find(a=>a.value===s)?.label??s}function k({label:s,onClear:a}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded border border-strong bg-surface-inset px-2.5 py-1 text-sm text-strong",children:[s,e.jsx("button",{type:"button",onClick:a,"aria-label":`Clear ${s}`,className:"rounded p-0.5 text-secondary hover:bg-mono-700/60 hover:text-heading",children:e.jsx(Ve,{className:"size-3"})})]})}function X({label:s,color:a,count:r,active:n,onToggle:u}){return e.jsxs("button",{type:"button",onClick:u,"aria-pressed":n,className:`inline-flex items-center gap-2 rounded border px-3 py-1.5 text-xs font-medium transition ${n?"border-strong bg-surface-inset text-heading":"border-base bg-transparent text-muted hover:text-neutral"}`,children:[e.jsx("span",{"aria-hidden":"true",className:`flex size-3 items-center justify-center rounded-sm border transition-opacity ${n?"border-transparent opacity-100":"border-strong opacity-60"}`,style:n?{backgroundColor:a}:void 0,children:n?"✓":""}),e.jsx("span",{children:s}),e.jsx("span",{className:`tabular-nums ${n?"text-secondary":"text-faint"}`,children:r.toLocaleString("en-US")})]})}function Q({label:s,value:a,tooltip:r}){return e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("p",{className:"flex items-center gap-1 text-sm text-secondary",children:[s,r?e.jsx(P,{text:r}):null]}),e.jsx("p",{className:"mt-1 text-2xl font-semibold tabular-nums text-heading",children:a.toLocaleString("en-US")})]})}function ct(s){switch(s){case i.crawler:return"Crawler";case i["ai-user-fetch"]:return"AI hit";case i["ai-referral"]:return"AI referral"}}function dt(s){switch(s.kind){case i.crawler:case i["ai-user-fetch"]:return s.botId;case i["ai-referral"]:return s.product}}function ut(s){switch(s.kind){case i.crawler:case i["ai-user-fetch"]:return`${s.verificationStatus} · HTTP ${s.status}`;case i["ai-referral"]:return`${s.evidenceType} · ${s.sourceDomain}`}}function xt({events:s}){return s.length===0?e.jsx(H,{className:"p-6 text-center text-sm text-muted",children:"No event rows match the current filters."}):e.jsx("div",{className:"rounded-xl border border-default bg-surface overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-bg-elevated/50 text-[10px] font-semibold uppercase tracking-wider text-muted",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left",children:"Hour"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Kind"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Identity"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Evidence / status"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Path"}),e.jsx("th",{className:"px-4 py-2 text-right",children:e.jsxs("span",{className:"inline-flex items-center",children:["Hits",e.jsx(P,{text:"Each row is one hour-bucket, not one request. Hits is the number of requests in that hour that shared the same identity, path, HTTP status, and verification claim."})]})})]})}),e.jsx("tbody",{className:"divide-y divide-mono-800/60",children:s.map((a,r)=>e.jsxs("tr",{className:"hover:bg-bg-elevated/40 transition-colors",children:[e.jsx("td",{className:"px-4 py-2 font-mono text-xs text-neutral",children:be(a.tsHour)}),e.jsx("td",{className:"px-4 py-2 text-neutral",children:ct(a.kind)}),e.jsxs("td",{className:"px-4 py-2 text-heading",children:[dt(a),e.jsx("span",{className:"ml-2 text-[11px] text-muted",children:a.operator})]}),e.jsx("td",{className:"px-4 py-2 text-neutral",children:ut(a)}),e.jsx("td",{className:"px-4 py-2 truncate font-mono text-xs text-neutral",children:pe(a)}),e.jsx("td",{className:"px-4 py-2 text-right tabular-nums text-heading",children:a.hits})]},`${a.kind}:${a.tsHour}:${r}`))})]})})}export{Q as TrafficKpi,Nt as TrafficSourceDetailPage};
|