@canonry/canonry 4.134.1 → 4.136.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.
Files changed (28) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +20 -3
  2. package/assets/assets/{AuditHistoryPanel-BW7LVMSZ.js → AuditHistoryPanel-DKaiIlcO.js} +1 -1
  3. package/assets/assets/{BacklinksPage-DU65axM1.js → BacklinksPage-Z2_ws8c2.js} +1 -1
  4. package/assets/assets/{ChartPrimitives-CUZJ7nUb.js → ChartPrimitives-CF_ocuvj.js} +1 -1
  5. package/assets/assets/{HistoryPage-BswdEXC5.js → HistoryPage-DDKO8_D8.js} +1 -1
  6. package/assets/assets/ProjectPage-hmNsqBov.js +8 -0
  7. package/assets/assets/{RunRow-CBxbfubI.js → RunRow-BhtCgyqA.js} +1 -1
  8. package/assets/assets/{RunsPage-BQxA05ua.js → RunsPage-B8Nw3wP-.js} +1 -1
  9. package/assets/assets/{SettingsPage-krEusjc9.js → SettingsPage-DsmQhytl.js} +1 -1
  10. package/assets/assets/{TrafficPage-DMhcA9lg.js → TrafficPage-COJs6eRH.js} +1 -1
  11. package/assets/assets/TrafficSourceDetailPage-BI6IwzMQ.js +1 -0
  12. package/assets/assets/{arrow-left-_1YaUPbl.js → arrow-left-C-lGPq-u.js} +1 -1
  13. package/assets/assets/{extract-error-message-D4XKG37U.js → extract-error-message-8h0hF1I1.js} +1 -1
  14. package/assets/assets/{index-JhX-wfQO.css → index-B4ksyQXo.css} +1 -1
  15. package/assets/assets/{index-V1C3c7nO.js → index-BoSfFv1t.js} +53 -53
  16. package/assets/assets/{trash-2-D3LWIGDJ.js → trash-2-CnOZwYKe.js} +1 -1
  17. package/assets/index.html +2 -2
  18. package/dist/{chunk-NWVPRV7A.js → chunk-3PFRVEWP.js} +99 -31
  19. package/dist/{chunk-BSU2MI3Y.js → chunk-PAR6P5H6.js} +1 -1
  20. package/dist/{chunk-CF5WTWXI.js → chunk-PXEEWJRV.js} +50 -20
  21. package/dist/{chunk-DVJGFY3J.js → chunk-TPVMHYHD.js} +45 -71
  22. package/dist/cli.js +18 -25
  23. package/dist/index.js +4 -4
  24. package/dist/{intelligence-service-NO4FJUYD.js → intelligence-service-BMEJ5GFZ.js} +2 -2
  25. package/dist/mcp.js +2 -2
  26. package/package.json +9 -9
  27. package/assets/assets/ProjectPage-CttTuKKo.js +0 -8
  28. package/assets/assets/TrafficSourceDetailPage-Dm0Gj0HS.js +0 -1
@@ -1 +0,0 @@
1
- import{j as e,B as Re,C as $e,r as c,L as Ee}from"./vendor-tanstack-Be8JdV5M.js";import{I as _,co as X,cp as i,T as He,i as ne,B as Fe,g as O,b as Me,cq as Pe,cr as Ue}from"./index-V1C3c7nO.js";import{g as Oe,h as _e,i as Be,t as De,R as ze,d as Ge}from"./extract-error-message-D4XKG37U.js";import{e as J,i as Ke,C as le,a as ie,c as We,h as Ve}from"./ChartPrimitives-CUZJ7nUb.js";import{R as Xe,B as qe,a as Qe,X as Ye,Y as Ze,T as Je,f as q,g as Q}from"./vendor-recharts-DSxTZhaH.js";import{A as ce}from"./arrow-left-_1YaUPbl.js";import"./vendor-radix-CQ77EO2y.js";import"./vendor-markdown-6dwjPOKK.js";function Y({value:s,label:a,delta:r,tone:l,description:u,tooltip:d,isNumeric:x=!0,progress:I,providerCoverage:o}){const w=2*Math.PI*48,h=Number.parseInt(s,10),L=typeof I=="number"&&Number.isFinite(I)?Math.min(Math.max(I,0),100)/100:x&&!Number.isNaN(h)?Math.min(h/100,1):.5,b=w*(1-L);return e.jsxs("div",{className:"score-gauge",children:[e.jsxs("div",{className:"gauge-ring-wrapper",children:[e.jsxs("svg",{className:"gauge-ring",viewBox:"0 0 120 120","aria-hidden":"true",children:[e.jsx("circle",{className:"gauge-bg",cx:"60",cy:"60",r:48,strokeWidth:6}),e.jsx("circle",{className:`gauge-fill gauge-fill-${l}`,cx:"60",cy:"60",r:48,strokeWidth:6,strokeDasharray:w,strokeDashoffset:b,transform:"rotate(-90 60 60)"})]}),e.jsx("div",{className:"gauge-center",children:e.jsx("span",{className:x?"gauge-value":"gauge-value-text",children:s.split(" / ")[0]})})]}),e.jsxs("p",{className:"gauge-label",children:[a,d&&e.jsx(_,{text:d})]}),e.jsx("p",{className:"gauge-delta",children:r}),o&&e.jsx("p",{className:"gauge-provider-coverage",children:o}),e.jsx("p",{className:"gauge-description",children:u})]})}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"}],pe=[{value:"all",label:"All claims"},{value:X.verified,label:"Verified"},{value:X.claimed_unverified,label:"Claimed unverified"},{value:X.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 ge(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),l=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),d=String(r.getDate()).padStart(2,"0");return`${l}-${u}-${d}`}function rt(s,a,r){const l=a.pathQuery.trim().toLowerCase(),u=tt(a.statusClass);return s.filter(d=>!(a.selectedBucket&&at(d.tsHour,r)!==a.selectedBucket||a.identity&&fe(d)!==a.identity||a.operator&&d.operator!==a.operator||l&&!ge(d).toLowerCase().includes(l)||u!==null&&Math.floor(d.status/100)!==u||a.verification!=="all"&&st(d)!==a.verification))}function nt(s,a){if(!s||typeof s!="object")return null;const r=s.activeTooltipIndex;let l;if(typeof r=="number")l=r;else if(typeof r=="string"&&r!=="")l=Number(r);else return null;return!Number.isInteger(l)||l<0||l>=a.length?null:a[l]?.bucket??null}const B=[{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}],oe=B.find(s=>s.label==="24h")??B[2],$=50,ue=J[0],de=J[2],xe=J[1],he=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 E(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 l=Math.floor(r/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}function me({canGoBack:s,className:a}){const r="inline-flex items-center gap-1";if(s){const l=()=>{window.history.back()};return e.jsxs("button",{type:"button",onClick:l,className:`${r} ${a??""}`,children:[e.jsx(ce,{className:"size-3"})," Back"]})}return e.jsxs(Ee,{to:"/traffic",className:`${r} ${a??""}`,children:[e.jsx(ce,{className:"size-3"})," All sources"]})}function vt(){const s=Re({strict:!1}),a=s.projectName??"",r=$e(),l=s.sourceId??"",[u,d]=c.useState(oe.value),[x,I]=c.useState(()=>new Set(["crawler","ai-user-fetch","ai-referral"])),[o,A]=c.useState(null),[p,w]=c.useState(""),[h,L]=c.useState(""),[b,D]=c.useState(""),[N,z]=c.useState("all"),[S,G]=c.useState("all"),[je,K]=c.useState(1),[ee,te]=c.useState(null),[se,ae]=c.useState(null),f=c.useMemo(()=>B.find(t=>t.value===u)??oe,[u]),W=Oe(a||null,l||null),y=_e(a||null,{kind:"all",sourceId:l||void 0,sinceMinutes:u,limit:f.fetchLimit,granularity:f.granularity}),H=Be(a||null,l||null),n=W.data,k=y.data?.events??[],j=y.data?.totals,F=y.data?.eventRows,M=c.useMemo(()=>k.filter(t=>{switch(t.kind){case i.crawler:return x.has("crawler");case i["ai-user-fetch"]:return x.has("ai-user-fetch");case i["ai-referral"]:return x.has("ai-referral")}}),[k,x]),ve=c.useMemo(()=>{const t=new Set;for(const m of k)t.add(fe(m));return p&&t.add(p),[...t].sort((m,g)=>m.localeCompare(g))},[k,p]),Ne=c.useMemo(()=>{const t=new Set;for(const m of k)t.add(m.operator);return h&&t.add(h),[...t].sort((m,g)=>m.localeCompare(g))},[k,h]),v=c.useMemo(()=>rt(M,{selectedBucket:o,identity:p,operator:h,pathQuery:b,statusClass:N,verification:S},f.granularity),[M,o,p,h,b,N,S,f.granularity]);c.useEffect(()=>{K(1)},[M,o,p,h,b,N,S]);const P=Math.max(1,Math.ceil(v.length/$)),U=Math.min(Math.max(1,je),P),R=(U-1)*$,Se=c.useMemo(()=>v.slice(R,R+$),[v,R]),we=v.length>$,ke=v.length===0?0:R+1,Ce=Math.min(R+$,v.length),re=c.useMemo(()=>o?ye(o,f.granularity):null,[o,f.granularity]),C=c.useMemo(()=>it(y.data?.series.points??[],f.granularity),[y.data?.series.points,f.granularity]),V=t=>{I(m=>{const g=new Set(m);return g.has(t)?g.size>1&&g.delete(t):g.add(t),g})},Te=t=>{const m=nt(t,C);m&&A(g=>g===m?null:m)},Ie=()=>{A(null),w(""),L(""),D(""),z("all"),G("all")},Ae=!!(o||p||h||b.trim()||N!=="all"||S!=="all"),Le=async()=>{te(null),ae(null);try{const t=await H.mutateAsync({sinceMinutes:60});ae(`Pulled ${t.pulledEvents} entries · ${t.crawlerHits} crawler · ${t.aiUserFetchHits} AI user fetch · ${t.aiReferralHits} AI referral · ${t.unknownHits} unknown`)}catch(t){te(Ge(t))}};return!a||!l?e.jsx("div",{className:"page-container",children:e.jsx("p",{className:"text-sm text-muted",children:"Missing project name or source id in URL."})}):W.isLoading?e.jsx("div",{className:"page-container",children:e.jsx("p",{className:"text-sm text-muted",children:"Loading source…"})}):W.isError||!n?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:n.displayName}),e.jsxs("p",{className:"page-subtitle",children:[n.sourceType," · project ",e.jsx("span",{className:"text-neutral",children:a})," ·",e.jsx("span",{className:"ml-1 font-mono text-secondary",children:n.id})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{tone:De(n.status),children:n.status}),!ne()&&e.jsxs(Fe,{type:"button",variant:"outline",size:"sm",disabled:H.isPending,onClick:()=>{Le()},children:[e.jsx(ze,{className:`size-3.5 ${H.isPending?"animate-spin":""}`}),H.isPending?"Syncing…":"Sync now"]})]})]}),ee?e.jsx("div",{className:"rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-xs text-negative-200",children:ee}):null,se?e.jsx("div",{className:"rounded-md border border-positive-800/50 bg-positive-950/30 px-3 py-2 text-xs text-positive-200",children:se}):null,e.jsxs("section",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(Y,{label:"24h content crawls",value:String(n.totals24h.crawlerContentHits),delta:n.lastSyncedAt?`last sync ${E(n.lastSyncedAt)}`:"never synced",tone:n.totals24h.crawlerContentHits>0?"positive":"neutral",description:`Pages crawled — ${n.totals24h.crawlerInfraHits.toLocaleString("en-US")} sitemap/robots/asset fetches excluded.`,tooltip:`Content-page crawls by GPTBot, OAI-SearchBot, PerplexityBot, Googlebot, etc. Infrastructure fetches (sitemap ${n.totals24h.crawlerSegments.sitemap.toLocaleString("en-US")}, robots ${n.totals24h.crawlerSegments.robots.toLocaleString("en-US")}, assets ${n.totals24h.crawlerSegments.asset.toLocaleString("en-US")}) are tracked separately so polling doesn't inflate this number. Total crawler hits: ${n.totals24h.crawlerHits.toLocaleString("en-US")}.`,isNumeric:!0,progress:Math.min(100,Math.round(n.totals24h.crawlerContentHits/1e3*100))}),e.jsx(Y,{label:"24h AI user fetches",value:String(n.totals24h.aiUserFetchHits),delta:n.lastSyncedAt?`last sync ${E(n.lastSyncedAt)}`:"never synced",tone:n.totals24h.aiUserFetchHits>0?"positive":"neutral",description:"ChatGPT-User, Perplexity-User — fetches initiated by a real user inside an AI surface (citation click, URL read).",isNumeric:!0,progress:Math.min(100,Math.round(n.totals24h.aiUserFetchHits/1e3*100))}),e.jsx(Y,{label:"24h AI referral sessions",value:String(n.totals24h.aiReferralHits),delta:n.lastSyncedAt?`last sync ${E(n.lastSyncedAt)}`:"never synced",tone:n.totals24h.aiReferralHits>0?"positive":"neutral",description:"Browser click-throughs from chatgpt.com, perplexity.ai, etc. (Referer / UTM evidence).",isNumeric:!0,progress:Math.min(100,Math.round(n.totals24h.aiReferralHits/1e3*100))})]}),e.jsxs("section",{children:[e.jsx("p",{className:"mb-4 text-[10px] font-semibold uppercase tracking-wider text-muted",children:"Latest sync run"}),n.latestRun?e.jsxs(O,{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:n.latestRun.status})]}),e.jsxs("span",{className:"text-muted",children:["Started: ",E(n.latestRun.startedAt)]}),n.latestRun.finishedAt?e.jsxs("span",{className:"text-muted",children:["Finished: ",E(n.latestRun.finishedAt)]}):null,e.jsx("span",{className:"font-mono text-[11px] text-faint",children:n.latestRun.runId})]}),n.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:n.latestRun.error}):null]}):e.jsx(O,{className:"px-4 py-3 text-sm text-muted",children:ne()?"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:f.granularity==="day"?"Daily rollups":"Hourly rollups"}),j?e.jsxs("p",{className:"mt-1.5 text-xs text-muted",children:[j.crawlerContentHits.toLocaleString("en-US")," content crawls ·"," ",j.crawlerInfraHits.toLocaleString("en-US")," infra (sitemap/robots/assets) ·"," ",j.aiUserFetchHits.toLocaleString("en-US")," AI user fetches ·"," ",j.aiReferralHits.toLocaleString("en-US")," AI referral sessions · last ",f.label," · ",he]}):null]}),e.jsx("div",{className:"filter-row mb-0",role:"toolbar","aria-label":"Window",children:B.map(t=>e.jsx("button",{type:"button",className:`filter-chip ${u===t.value?"filter-chip-active":""}`,"aria-pressed":u===t.value,onClick:()=>{d(t.value),A(null)},children:t.label},t.value))})]}),e.jsxs(O,{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(Z,{label:"Crawler",color:ue,count:j?.crawlerHits??0,active:x.has("crawler"),onToggle:()=>V("crawler")}),e.jsx(Z,{label:"AI user fetches",color:de,count:j?.aiUserFetchHits??0,active:x.has("ai-user-fetch"),onToggle:()=>V("ai-user-fetch")}),e.jsx(Z,{label:"AI referral sessions",color:xe,count:j?.aiReferralHits??0,active:x.has("ai-referral"),onToggle:()=>V("ai-referral")})]}),y.isError?e.jsxs("p",{className:"py-12 text-center text-xs text-negative-400",children:["Failed to load events: ",y.error instanceof Error?y.error.message:"Unknown error"]}):y.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(Xe,{children:e.jsxs(qe,{data:C,margin:{top:4,right:4,bottom:0,left:0},onClick:Te,style:{cursor:"pointer"},children:[e.jsx(Qe,{stroke:Ke,strokeDasharray:"3 3"}),e.jsx(Ye,{dataKey:"label",tick:ie,stroke:le,interval:"preserveStartEnd",minTickGap:f.granularity==="day"?24:32}),e.jsx(Ze,{tick:ie,stroke:le,allowDecimals:!1}),e.jsx(Je,{...We}),x.has("crawler")?e.jsx(q,{dataKey:"crawler",name:"Crawler",fill:ue,stackId:"a",children:C.map(t=>e.jsx(Q,{fillOpacity:o&&o!==t.bucket?.25:1},t.bucket))}):null,x.has("ai-user-fetch")?e.jsx(q,{dataKey:"aiUserFetch",name:"AI user fetch",fill:de,stackId:"a",children:C.map(t=>e.jsx(Q,{fillOpacity:o&&o!==t.bucket?.25:1},t.bucket))}):null,x.has("ai-referral")?e.jsx(q,{dataKey:"aiReferral",name:"AI referral",fill:xe,stackId:"a",children:C.map(t=>e.jsx(Q,{fillOpacity:o&&o!==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:v.length.toLocaleString("en-US")})," of"," ",e.jsx("span",{className:"tabular-nums text-muted",children:M.length.toLocaleString("en-US")})," ",F?.truncated?"loaded events":"events",F?.truncated?e.jsxs(e.Fragment,{children:[" ","· loaded ",e.jsx("span",{className:"tabular-nums text-neutral",children:F.returned.toLocaleString("en-US")})," of"," ",e.jsx("span",{className:"tabular-nums text-muted",children:F.total.toLocaleString("en-US")})," rows"]}):null," ","· ",he]})]}),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=>w(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(_,{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:h,onChange:t=>L(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(_,{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=>z(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=>G(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:pe.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:b,onChange:t=>D(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"})]})]}),Ae?e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[re?e.jsx(T,{label:`Bucket: ${re}`,onClear:()=>A(null)}):null,p?e.jsx(T,{label:`Identity: ${p}`,onClear:()=>w("")}):null,h?e.jsx(T,{label:`Operator: ${h}`,onClear:()=>L("")}):null,b.trim()?e.jsx(T,{label:`Path: ${b.trim()}`,onClear:()=>D("")}):null,N!=="all"?e.jsx(T,{label:`Status: ${N}`,onClear:()=>z("all")}):null,S!=="all"?e.jsx(T,{label:`Claim: ${ct(S)}`,onClear:()=>G("all")}):null,e.jsx("button",{type:"button",onClick:Ie,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:ke.toLocaleString("en-US")}),"–",e.jsx("span",{className:"text-neutral",children:Ce.toLocaleString("en-US")})," of"," ",e.jsx("span",{className:"text-neutral",children:v.length.toLocaleString("en-US")})," events"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>K(t=>Math.max(1,t-1)),disabled:U<=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(Ve,{className:"size-3.5"}),"Prev"]}),e.jsxs("span",{className:"tabular-nums",children:["Page ",e.jsx("span",{className:"text-strong",children:U})," of"," ",e.jsx("span",{className:"text-strong",children:P})]}),e.jsxs("button",{type:"button",onClick:()=>K(t=>Math.min(P,t+1)),disabled:U>=P,"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(Me,{className:"size-3.5"})]})]})]}):null]})]})}function ye(s,a){return a==="day"?lt(s):be(s)}function it(s,a){return s.map(r=>({bucket:r.bucket,label:ye(r.bucket,a),crawler:r.crawlerHits,aiUserFetch:r.aiUserFetchHits,aiReferral:r.aiReferralHits}))}function ct(s){return pe.find(a=>a.value===s)?.label??s}function T({label:s,onClear:a}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-strong bg-surface-inset px-2.5 py-1 text-[11px] text-strong",children:[s,e.jsx("button",{type:"button",onClick:a,"aria-label":`Clear ${s}`,className:"rounded-full p-0.5 text-secondary hover:bg-mono-700/60 hover:text-heading",children:e.jsx(Ue,{className:"size-3"})})]})}function Z({label:s,color:a,count:r,active:l,onToggle:u}){return e.jsxs("button",{type:"button",onClick:u,"aria-pressed":l,className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs font-medium transition ${l?"border-strong bg-surface-inset text-heading":"border-base bg-transparent text-muted hover:text-neutral"}`,children:[e.jsx("span",{"aria-hidden":"true",className:`size-2 rounded-full transition-opacity ${l?"opacity-100":"opacity-30"}`,style:{backgroundColor:a}}),e.jsx("span",{children:s}),e.jsx("span",{className:`tabular-nums ${l?"text-secondary":"text-faint"}`,children:r.toLocaleString("en-US")})]})}function ot(s){switch(s){case i.crawler:return"Crawler";case i["ai-user-fetch"]:return"AI hit";case i["ai-referral"]:return"AI referral"}}function ut(s){switch(s.kind){case i.crawler:case i["ai-user-fetch"]:return s.botId;case i["ai-referral"]:return s.product}}function dt(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(O,{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(_,{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:ot(a.kind)}),e.jsxs("td",{className:"px-4 py-2 text-heading",children:[ut(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:dt(a)}),e.jsx("td",{className:"px-4 py-2 truncate font-mono text-xs text-neutral",children:ge(a)}),e.jsx("td",{className:"px-4 py-2 text-right tabular-nums text-heading",children:a.hits})]},`${a.kind}:${a.tsHour}:${r}`))})]})})}export{vt as TrafficSourceDetailPage};