@canonry/canonry 7.87.2 → 7.89.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 (153) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +31 -5
  2. package/assets/assets/{AgentSetupPage-_ZP3F_zA.js → AgentSetupPage-BU1supL8.js} +6 -6
  3. package/assets/assets/AuditHistoryPanel-D7or_J3j.js +1 -0
  4. package/assets/assets/{BacklinksPage-CsvVgXTZ.js → BacklinksPage-SOls3ew4.js} +1 -1
  5. package/assets/assets/{ChartPrimitives-4D5wgAn5.js → ChartPrimitives-Cs2iavxU.js} +1 -1
  6. package/assets/assets/{Hint-CfeZmZig.js → Hint-uoVNfr0U.js} +1 -1
  7. package/assets/assets/{HistoryPage-BCxpCul0.js → HistoryPage-LNKtQ6a8.js} +1 -1
  8. package/assets/assets/{InfoTooltip-DrBIPuSU.js → InfoTooltip-CNLlIWeP.js} +1 -1
  9. package/assets/assets/MeasurementPropertyPage-CTZzlHWE.js +4 -0
  10. package/assets/assets/ProjectPage-D79zuY-M.js +11 -0
  11. package/assets/assets/{RunsPage-CfQ_kqlu.js → RunsPage-B8zUD2gr.js} +1 -1
  12. package/assets/assets/{SettingsPage-PIgRvqJc.js → SettingsPage-BOQgT_7N.js} +1 -1
  13. package/assets/assets/SiteHealthSection-G3_MShnD.js +2 -0
  14. package/assets/assets/{ToneBadge-BgTLSTKp.js → ToneBadge-DawS8vMp.js} +6 -6
  15. package/assets/assets/TrafficPage-DJUqxtrQ.js +40 -0
  16. package/assets/assets/TrafficSourceDetailPage-OVY_L73m.js +1 -0
  17. package/assets/assets/{account-context-CVjb3ZSn.js → account-context-DoI9S9qY.js} +1 -1
  18. package/assets/assets/agent-trust-copy-CZpfPr4M.js +1 -0
  19. package/assets/assets/{card-BnVez9nG.js → card-ClURYmZN.js} +1 -1
  20. package/assets/assets/{format-helpers-DVXZD864.js → format-helpers-CscAFAMJ.js} +2 -2
  21. package/assets/assets/{index-BOUrrC9J.css → index-Bhpq6fUo.css} +1 -1
  22. package/assets/assets/index-y0Wx0ZWq.js +60 -0
  23. package/assets/assets/{query-client-CVc7wMKJ.js → query-client-Dm_GqsTu.js} +1 -1
  24. package/assets/assets/react-query-BwhgbuS1.js +1 -0
  25. package/assets/assets/{react-sigma_core.esm.min-CVfGIEIE.js → react-sigma_core.esm.min-6J0MSvMJ.js} +1 -1
  26. package/assets/assets/server-traffic-C-_D6pdo.js +1 -0
  27. package/assets/assets/{service-BGqeyqhZ.js → service-C7qDx_qB.js} +1 -1
  28. package/assets/assets/{vendor-lucide-CoTHJwai.js → vendor-lucide-Bo69m9KC.js} +1 -1
  29. package/assets/assets/{vendor-markdown-cQgSk2i0.js → vendor-markdown-BiRP51B0.js} +1 -1
  30. package/assets/assets/{vendor-radix-wS8sWIWE.js → vendor-radix-PQeN8gOe.js} +1 -1
  31. package/assets/assets/{vendor-recharts-AnNqECZW.js → vendor-recharts-CY6tH-r6.js} +1 -1
  32. package/assets/assets/{vendor-tanstack-q5SvZtcv.js → vendor-tanstack-tBjrfzKu.js} +1 -1
  33. package/assets/index.html +15 -15
  34. package/dist/{ads-ZUZWSIBV.js → ads-XEW2LBKV.js} +3 -3
  35. package/dist/{agent-YDS3WY7B.js → agent-VYADMMPT.js} +7 -7
  36. package/dist/{agent-ask-7VUPXTXL.js → agent-ask-4G57GM3S.js} +3 -3
  37. package/dist/{agent-conversations-WPEBK3BS.js → agent-conversations-MRKRCXQI.js} +3 -3
  38. package/dist/{agent-journeys-H5CCYLNB.js → agent-journeys-WEUEYRMK.js} +3 -3
  39. package/dist/{agent-memory-CNPKPIWD.js → agent-memory-YLAOXQQ6.js} +3 -3
  40. package/dist/{agent-providers-U7FLJO5I.js → agent-providers-AWKQRJDZ.js} +3 -3
  41. package/dist/{agent-transcript-VY3BQNPU.js → agent-transcript-HXYFVCUD.js} +3 -3
  42. package/dist/{analytics-PYUNO7C2.js → analytics-5G5G5OJU.js} +3 -3
  43. package/dist/{apply-YNBEYC2G.js → apply-FCKZG7A2.js} +3 -3
  44. package/dist/{backfill-6AYHWEQX.js → backfill-3CTZHCJS.js} +10 -10
  45. package/dist/{backlinks-LVHZ2MQ7.js → backlinks-Q53JT63C.js} +3 -3
  46. package/dist/bing-FOY2UVIM.js +785 -0
  47. package/dist/{bootstrap-27NOBWTP.js → bootstrap-FXIT7LDW.js} +10 -10
  48. package/dist/{cdp-HCYY4SXR.js → cdp-WWQW3LIZ.js} +7 -7
  49. package/dist/{chunk-INH773FB.js → chunk-2BZJ4W27.js} +3 -3
  50. package/dist/{chunk-3KK6FWDF.js → chunk-3H5VURTU.js} +1 -1
  51. package/dist/{chunk-IK7QEKKD.js → chunk-3IC7PRTW.js} +1 -1
  52. package/dist/{chunk-BVJA3TV2.js → chunk-4INNOSWU.js} +5 -5
  53. package/dist/{chunk-4LNZTL7M.js → chunk-5GQ2AGWS.js} +3 -3
  54. package/dist/{chunk-3FHBPJ5R.js → chunk-7522CQ2E.js} +4 -4
  55. package/dist/{chunk-2FJB3CSS.js → chunk-A6DKZ4KQ.js} +1 -1
  56. package/dist/{chunk-JAYUWQAV.js → chunk-DPKA5CWK.js} +1 -1
  57. package/dist/{chunk-MNLAIB67.js → chunk-DX46HM7S.js} +1 -1
  58. package/dist/{chunk-ZJVQ72VC.js → chunk-EWR25OVQ.js} +2 -2
  59. package/dist/{chunk-TFB2S6TQ.js → chunk-GDEYX6E3.js} +4 -4
  60. package/dist/{chunk-T2MGGW6Y.js → chunk-GSNKBXGN.js} +6 -6
  61. package/dist/{chunk-AI75KS7G.js → chunk-HSOZSLIZ.js} +2574 -1585
  62. package/dist/{chunk-IVGVPPQT.js → chunk-IK3PYAQU.js} +1088 -646
  63. package/dist/{chunk-GDU6IMGB.js → chunk-J7V7TYX7.js} +2 -2
  64. package/dist/{chunk-GXTCDNX7.js → chunk-JLBJEQPV.js} +1 -1
  65. package/dist/{chunk-ZCNKGBIV.js → chunk-KAGMYJYG.js} +5 -5
  66. package/dist/{chunk-2AXFKYJU.js → chunk-MNLQY5WG.js} +2 -2
  67. package/dist/{chunk-FAMCDCVK.js → chunk-MXGME7NG.js} +1 -1
  68. package/dist/{chunk-6F5ULQDY.js → chunk-RE24YYIY.js} +4 -4
  69. package/dist/{chunk-ICS2WJ7H.js → chunk-S7D2ELTC.js} +3 -3
  70. package/dist/{chunk-TEQF4ZJA.js → chunk-TCANF22P.js} +162 -2
  71. package/dist/{chunk-BJHHD7VE.js → chunk-UIULMWJX.js} +2 -2
  72. package/dist/{chunk-TN53B5AB.js → chunk-VBM6T5ZP.js} +218 -3
  73. package/dist/{chunk-POMLL2OZ.js → chunk-VL4AZGUA.js} +1 -1
  74. package/dist/{chunk-CBWGUGME.js → chunk-WE6FSG7J.js} +18 -2
  75. package/dist/{chunk-LYTBHEID.js → chunk-WHN4RF2Y.js} +534 -342
  76. package/dist/{chunk-DOPUEXMC.js → chunk-WPTCWNA6.js} +2 -2
  77. package/dist/{chunk-IE4D47JE.js → chunk-X6XFWQCE.js} +7 -7
  78. package/dist/{chunk-IBGZ6D6R.js → chunk-Y35D3ZCH.js} +2 -2
  79. package/dist/{chunk-F643WELJ.js → chunk-YKLYWVLL.js} +341 -5
  80. package/dist/{chunk-GBWCEOZR.js → chunk-YW2IQEWS.js} +1 -1
  81. package/dist/{chunk-AYYZ4HKJ.js → chunk-ZEWOPHTA.js} +230 -1
  82. package/dist/{chunk-4FWDITQG.js → chunk-ZX4TZNP4.js} +1 -1
  83. package/dist/{chunk-JDTKG7KJ.js → chunk-ZYEWB5BK.js} +3 -3
  84. package/dist/{citations-3EZTHA65.js → citations-ZZ6ODCGZ.js} +3 -3
  85. package/dist/{cli-catalog-CBTM3JKP.js → cli-catalog-HEX47BKL.js} +3 -3
  86. package/dist/{cli-commands-H7BFVUGC.js → cli-commands-6OLN355M.js} +7 -7
  87. package/dist/cli.js +13 -13
  88. package/dist/{competitor-VH4TXJLT.js → competitor-6MRHORU2.js} +3 -3
  89. package/dist/{content-TSMNHXJZ.js → content-S2UOGTLN.js} +3 -3
  90. package/dist/{dashboard-KT2ACPI5.js → dashboard-J4H3FVKH.js} +6 -6
  91. package/dist/{demo-LWSLULEZ.js → demo-7PJJQMLO.js} +1 -1
  92. package/dist/{demo-server-UENMDVMG.js → demo-server-55I5LNNS.js} +12 -12
  93. package/dist/{discover-XTJXTKCI.js → discover-O4NFDHGP.js} +3 -3
  94. package/dist/{discover-eval-IVQI5YEW.js → discover-eval-PE2MW42B.js} +3 -3
  95. package/dist/{doctor-SJ4SHSQO.js → doctor-GT4MMJQJ.js} +3 -3
  96. package/dist/{evidence-C6T556YH.js → evidence-Z344KVJX.js} +3 -3
  97. package/dist/{export-cmd-JQZ5ZRSI.js → export-cmd-Z6WWLI6H.js} +3 -3
  98. package/dist/{ga-W2WHVRHN.js → ga-SXIGAF5F.js} +3 -3
  99. package/dist/{gbp-3AZIV5WF.js → gbp-CSLWSEKF.js} +3 -3
  100. package/dist/{google-3CKWPZT7.js → google-EAQJ46AR.js} +4 -4
  101. package/dist/{google-marketing-PJBGQYYW.js → google-marketing-NVKB4NLG.js} +1 -1
  102. package/dist/{health-cmd-4JTQMCXM.js → health-cmd-6IYRMZS3.js} +3 -3
  103. package/dist/{history-TXUJFEO2.js → history-KLZI7IKJ.js} +3 -3
  104. package/dist/index.d.ts +1891 -399
  105. package/dist/index.js +25 -25
  106. package/dist/{init-TF3OPCEC.js → init-LFLCM6KJ.js} +12 -12
  107. package/dist/{insights-XZQO4B45.js → insights-C7NN64E2.js} +3 -3
  108. package/dist/intelligence-service-ENI35JFR.js +16 -0
  109. package/dist/{journeys-VFIV5JYV.js → journeys-C34YDOM6.js} +3 -3
  110. package/dist/{keys-PV23G4LW.js → keys-4RDLFHXO.js} +3 -3
  111. package/dist/{keyword-D76KBIV5.js → keyword-BZEJEYAG.js} +3 -3
  112. package/dist/{logs-DYDZ6IEJ.js → logs-5FPZRSZM.js} +3 -3
  113. package/dist/{mcp-GAR5LDQD.js → mcp-574UA5Y3.js} +4 -4
  114. package/dist/mcp.js +9 -9
  115. package/dist/{measurement-plan-K24EOGMI.js → measurement-plan-2H4KHD2Y.js} +5 -5
  116. package/dist/{notify-XQHMPDQQ.js → notify-TFXL4CSH.js} +3 -3
  117. package/dist/{organic-evidence-UHHE7AO4.js → organic-evidence-R55KSYFN.js} +3 -3
  118. package/dist/{overview-AUZ3XRS5.js → overview-NJTCLHAB.js} +4 -4
  119. package/dist/{project-FUCPU2BD.js → project-PV36DZDG.js} +3 -3
  120. package/dist/{query-HRMSXDKL.js → query-5SVITJ4K.js} +3 -3
  121. package/dist/{research-R23XLZJ3.js → research-JSET5FNY.js} +3 -3
  122. package/dist/{results-export-N6IV3KG4.js → results-export-5EFMXTPG.js} +3 -3
  123. package/dist/{run-CJLG5EXH.js → run-NOSOG3YH.js} +4 -4
  124. package/dist/{schedule-IPDCQ2I5.js → schedule-I3ACQC2C.js} +3 -3
  125. package/dist/{search-ZU4AKJ76.js → search-EE53K7J5.js} +3 -3
  126. package/dist/{serve-LLIUILD2.js → serve-SDU77HVC.js} +26 -26
  127. package/dist/{session-2NQKSF2N.js → session-FYZCUPVX.js} +13 -13
  128. package/dist/{settings-4FS5NRKP.js → settings-CEI7EKPO.js} +3 -3
  129. package/dist/{skills-GSFHACGN.js → skills-TRTFFZU3.js} +2 -2
  130. package/dist/{snapshot-4NUVPDK3.js → snapshot-2RXVTDTZ.js} +3 -3
  131. package/dist/{src-JQYZ2TP6.js → src-DYJHW2HG.js} +16 -2
  132. package/dist/{status-ASBLMFP2.js → status-2VHBSIRY.js} +4 -4
  133. package/dist/{technical-aeo-QXHRBGYY.js → technical-aeo-3OMGT4ZT.js} +3 -3
  134. package/dist/{telemetry-J2I577I3.js → telemetry-5F4EHGR2.js} +4 -4
  135. package/dist/{tools-UPJRW4DN.js → tools-C3IIMXBJ.js} +11 -11
  136. package/dist/{traffic-GWBZKYR5.js → traffic-S3VUYBG6.js} +5 -5
  137. package/dist/{trends-YOLCJBNM.js → trends-RQ4B2QWA.js} +3 -3
  138. package/dist/{users-LPSCZV3M.js → users-T6OOG5YB.js} +3 -3
  139. package/dist/{visibility-stats-JJQTZSSK.js → visibility-stats-2O24MQCV.js} +3 -3
  140. package/dist/{wordpress-4IKDT5KT.js → wordpress-SDENOBFI.js} +3 -3
  141. package/package.json +1 -1
  142. package/assets/assets/AuditHistoryPanel-9B0XpYsN.js +0 -1
  143. package/assets/assets/MeasurementPropertyPage-BObvWjVx.js +0 -4
  144. package/assets/assets/ProjectPage-y378tOaT.js +0 -11
  145. package/assets/assets/SiteHealthSection-DuUE1cB0.js +0 -2
  146. package/assets/assets/TrafficPage-B_YunwjH.js +0 -40
  147. package/assets/assets/TrafficSourceDetailPage-C51W87fU.js +0 -1
  148. package/assets/assets/agent-trust-copy-BlpC8jo5.js +0 -1
  149. package/assets/assets/extract-error-message-Dqirbrl0.js +0 -1
  150. package/assets/assets/index-CsvEqhK4.js +0 -60
  151. package/assets/assets/react-query-CSlTSOjz.js +0 -1
  152. package/dist/bing-A2MUG6AV.js +0 -418
  153. package/dist/intelligence-service-LEH5UVIC.js +0 -16
@@ -0,0 +1,40 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,G as n,R as r,U as i,V as a,Z as o,at as s,ct as c,et as l,f as u,o as d,ot as f}from"./vendor-lucide-Bo69m9KC.js";import{r as p}from"./vendor-markdown-BiRP51B0.js";import{b as m,d as h,u as g,x as _}from"./vendor-tanstack-tBjrfzKu.js";import{mt as v,pn as ee,r as y,t as te,wt as b}from"./ToneBadge-DawS8vMp.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as re}from"./query-client-Dm_GqsTu.js";import{fn as x,sn as S}from"./react-query-BwhgbuS1.js";import{t as C}from"./InfoTooltip-CNLlIWeP.js";import{t as w}from"./card-ClURYmZN.js";import{T as ie,dt as T,ft as E,lt as ae,mn as D,pt as O,ut as oe}from"./index-y0Wx0ZWq.js";import{d as k,i as A,n as se,r as ce,s as le,t as ue}from"./server-traffic-C-_D6pdo.js";var j=e(c(),1),M=p();function de({open:e,onOpenChange:t,projectName:n}){let[r,i]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&i(`pick`)},[e]);let a=()=>{t(!1),i(`pick`)};return(0,M.jsx)(ae,{open:e,onOpenChange:e=>{e?t(!0):a()},children:(0,M.jsx)(oe,{children:r===`pick`?(0,M.jsx)(pe,{onPick:i}):r===`cloudflare`?(0,M.jsx)(Q,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`wordpress`?(0,M.jsx)(L,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`vercel`?(0,M.jsx)(z,{projectName:n,onBack:()=>i(`pick`),onClose:a}):(0,M.jsx)(R,{projectName:n,onBack:()=>i(`pick`),onClose:a})})})}var fe=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:u},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:r},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:d},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:n}];function pe({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{children:`Connect a traffic source`}),(0,M.jsx)(T,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:fe.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-copy-13 text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(E,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-button-14 text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(f,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(O,{children:e}),(0,M.jsx)(T,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(k(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${k(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(X,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14-strong text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`text-label-13-mono`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(y,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=A(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(C,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:me(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Z,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=se(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(C,{text:K(`service-account private key`)})]}),guide:ge(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-copy-14-mono text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-label-14 text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=ce(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(C,{text:K(`access token`)})]}),guide:he(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-label-14-strong text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function me(e,t){let n=D(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
2
+
3
+ Follow the WordPress section of the Canonry docs: ${H}#connecting-a-wordpress-source
4
+
5
+ 1. Ask me for the site URL and a WordPress admin username.
6
+ 2. Walk me through installing the Canonry Traffic Logger plugin: download ${G}, then upload and activate it under Plugins → Add New → Upload Plugin. If you have shell or WP-CLI access to the site, you may install it yourself after I approve.
7
+ 3. Have me create an Application Password under Users → Profile → Application Passwords.
8
+ 4. Ask whether the site uses a page cache or CDN. If it does, tell me exactly which AI user agents to exclude from it, using the list in the docs.
9
+ 5. Give me the exact command to connect: cnry traffic connect wordpress ${n} --url <site-url> --username <user> --app-password '<app-password>'
10
+ 6. After it connects, run cnry traffic sources ${n} --format json and cnry doctor --project ${n} --check 'traffic.source.*' --format json, and tell me in plain words whether events are arriving.
11
+
12
+ ${q}`}}function he(e){let t=D(e);return{docsUrl:`${H}#connecting-a-vercel-source`,steps:[{title:`Create a Vercel access token`,detail:`Give it access to the team that owns the project. Tokens can expire, so pick a long lifetime.`,link:{label:`Open Vercel tokens`,href:`https://vercel.com/account/tokens`}},{title:`Find the project ID and team ID`,detail:`Both are in the project’s Settings → General, or in .vercel/project.json (projectId and orgId) after vercel link.`}],agentRequest:`Help me connect my Vercel project to the Canonry project "${e}" for server-side traffic.
13
+
14
+ Follow the Vercel section of the Canonry docs: ${H}#connecting-a-vercel-source
15
+
16
+ 1. Find the Vercel project ID and team ID. If this repo is linked, read projectId and orgId from .vercel/project.json. Otherwise ask me.
17
+ 2. Have me create an access token at https://vercel.com/account/tokens, scoped to that team, and save it to a file only I can read.
18
+ 3. Connect with: cnry traffic connect vercel ${t} --project-id <prj_...> --team-id <team_...> --token-file <path>
19
+ 4. Confirm the source with cnry traffic sources ${t} --format json and cnry doctor --project ${t} --check 'traffic.source.*' --format json. Vercel keeps about 14 days of request logs, so tell me before starting any history backfill.
20
+
21
+ ${q}`}}function ge(e,t){let n=D(e),r=t.trim(),i=`https://console.cloud.google.com/iam-admin/serviceaccounts${r?`?project=${encodeURIComponent(r)}`:``}`;return{docsUrl:`${H}#connecting-a-cloud-run-source`,steps:[{title:`Create a service account in the Google Cloud project`,detail:`Grant it the Logs Viewer role (roles/logging.viewer). Nothing broader is needed.`,link:{label:`Open service accounts`,href:i}},{title:`Create a JSON key for it`,detail:`Keys → Add key → Create new key → JSON. Upload the file below.`}],agentRequest:`Help me connect my Cloud Run service to the Canonry project "${e}" for server-side traffic.
22
+
23
+ Follow the Cloud Run section of the Canonry docs: ${H}#connecting-a-cloud-run-source
24
+
25
+ 1. Ask me for the Google Cloud project ID and, if there is more than one, the Cloud Run service name and region.
26
+ 2. If gcloud is installed and signed in, propose the exact commands to create a service account with only roles/logging.viewer and download a JSON key, and run them after I approve. Otherwise walk me through it in the Cloud Console.
27
+ 3. Connect with: cnry traffic connect cloud-run ${n} --gcp-project <project-id> --service-account-key <path/to/key.json> (add --service and --location to narrow it).
28
+ 4. Confirm with cnry doctor --project ${n} --check 'traffic.source.*' --format json and tell me in plain words whether logs are readable.
29
+
30
+ ${q}`}}function _e(e){let t=D(e);return{docsUrl:U,steps:[{title:`Check your request volume first`,detail:`The Worker runs on every request to your zone. A busy site can pass the Workers free allowance of 100,000 requests a day.`,link:{label:`How to size it`,href:`${U}#before-you-start-size-the-request-volume`}},{title:`Find your zone ID and account ID`,detail:`Both are on the zone’s Overview page in the Cloudflare dashboard, under API.`,link:{label:`Open Cloudflare`,href:`https://dash.cloudflare.com/`}},{title:`Run the connect command where Canonry runs`,detail:`cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id>`}],agentRequest:`Help me connect my Cloudflare zone to the Canonry project "${e}" for server-side traffic.
31
+
32
+ Follow the Canonry Cloudflare guide: ${U}
33
+
34
+ 1. Before anything else, estimate the zone's daily request volume with me, as the guide's "size the request volume" section shows, and tell me whether it fits the Workers plan I am on.
35
+ 2. Ask me for the zone ID and account ID, and whether I want direct push or Queue pull. Recommend one and say why.
36
+ 3. Run cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id> (plus the flags for the mode I chose). It writes the Worker and its config without deploying. Show me what it wrote.
37
+ 4. Deploy only after I approve, and attach the route with Fail open exactly as the guide says.
38
+ 5. Smoke-check with cnry traffic events ${t} --source <source-id> --format json and tell me whether events are arriving.
39
+
40
+ ${q}`}}function Y({request:e,docsUrl:t}){let[n,r]=(0,j.useState)(!1),s=async()=>{try{await navigator.clipboard.writeText(e),r(!0),window.setTimeout(()=>r(!1),1800)}catch{re({tone:`negative`,title:`Could not copy the setup request`,detail:`Follow the steps below, or open the setup guide instead.`})}};return(0,M.jsxs)(`section`,{"aria-labelledby":`traffic-agent-heading`,className:`material-base px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,M.jsx)(l,{className:`size-4 text-positive`,"aria-hidden":`true`}),(0,M.jsx)(`h3`,{id:`traffic-agent-heading`,className:`flex-1 text-heading-14 text-heading`,children:`Have your agent set this up`}),(0,M.jsxs)(y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{s()},children:[n?(0,M.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}):(0,M.jsx)(i,{className:`size-3.5`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{"aria-live":`polite`,children:n?`Copied`:`Copy setup request`})]})]}),(0,M.jsxs)(`p`,{className:`mt-1.5 text-copy-13 text-secondary`,children:[`Paste it into Claude Code, Codex, or any agent with a terminal. It follows the`,` `,(0,M.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`text-link underline-offset-4 hover:underline`,children:[`setup guide`,(0,M.jsx)(a,{className:`ml-0.5 inline size-3`,"aria-hidden":`true`})]}),` `,`and never asks you to paste secrets into the chat.`]})]})}function X({steps:e,heading:t=`Or do it yourself`}){return(0,M.jsxs)(`section`,{"aria-labelledby":`traffic-steps-heading`,children:[(0,M.jsx)(`h3`,{id:`traffic-steps-heading`,className:`text-heading-14 text-heading`,children:t}),(0,M.jsx)(`ol`,{className:`mt-3 flex flex-col gap-3`,children:e.map((e,t)=>(0,M.jsxs)(`li`,{className:`flex gap-3`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 shrink-0 items-center justify-center rounded-full border border-default bg-surface-subtle text-label-12-strong tabular-nums text-secondary`,children:t+1}),(0,M.jsxs)(`div`,{className:`min-w-0 pt-0.5`,children:[(0,M.jsx)(`p`,{className:`text-copy-14 text-heading`,children:e.title}),e.detail?(0,M.jsx)(`p`,{className:`mt-0.5 text-copy-13 text-secondary ${e.detail.startsWith(`cnry `)?`break-all font-mono`:``}`,children:e.detail}):null,e.link?(0,M.jsxs)(`a`,{href:e.link.href,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-label-13-strong text-link underline-offset-4 hover:underline`,children:[e.link.label,(0,M.jsx)(a,{className:`size-3`,"aria-hidden":`true`})]}):null]})]},e.title))})]})}function Z({children:e}){return(0,M.jsxs)(`details`,{className:`group`,children:[(0,M.jsxs)(`summary`,{className:`cursor-pointer list-none text-label-14-strong text-secondary hover:text-heading`,children:[(0,M.jsx)(`span`,{className:`group-open:hidden`,children:`Show more options`}),(0,M.jsx)(`span`,{className:`hidden group-open:inline`,children:`Hide more options`})]}),(0,M.jsx)(`div`,{className:`mt-4 flex flex-col gap-5`,children:e})]})}function Q({projectName:e,onBack:t,onClose:n}){let r=_e(e);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:`Connect a Cloudflare zone`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`A small Worker on your zone reports AI crawler visits. It is set up from the terminal.`,(0,M.jsx)(C,{text:`Setting it up deploys a Worker to your Cloudflare account, so it runs from the Canonry CLI on the machine where Canonry runs, never from the browser.`})]}),onBack:t}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:r.agentRequest,docsUrl:r.docsUrl}),(0,M.jsx)(X,{steps:r.steps})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:`Close`}),(0,M.jsx)(y,{type:`button`,size:`sm`,asChild:!0,children:(0,M.jsxs)(`a`,{href:r.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Open the setup guide`,(0,M.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})]})})]})]})]})}function ve(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function $(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function ye(){let[e,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),a=m(x({client:v})).data??[],o=(0,j.useMemo)(()=>e||(a[0]?.name??``),[e,a]),s=le(o||null),c=s.data?.sources??[];return(0,M.jsxs)(`div`,{className:`page-container`,children:[(0,M.jsxs)(`div`,{className:`page-header`,children:[(0,M.jsxs)(`div`,{className:`page-header-left`,children:[(0,M.jsx)(`h1`,{className:`page-title`,children:`Traffic sources`}),(0,M.jsx)(`p`,{className:`page-subtitle`,children:`AI crawler hits and referral sessions from your server logs.`})]}),!b()&&(0,M.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:(0,M.jsxs)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(!0),disabled:!o,children:[(0,M.jsx)(t,{className:`size-3.5`}),`Connect a source`]})})]}),(0,M.jsxs)(`section`,{children:[a.length>1&&(0,M.jsxs)(`label`,{className:`mb-4 flex w-fit items-center gap-2 text-label-14-strong text-secondary`,htmlFor:`traffic-project`,children:[`Project`,(0,M.jsx)(`select`,{id:`traffic-project`,className:`h-8 min-w-44 rounded-md border border-base bg-bg px-2 text-label-14 text-heading outline-none transition focus:border-mono-500 focus:ring-1 focus:ring-mono-500`,value:o,onChange:e=>n(e.target.value),children:a.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.displayName??e.name},e.id))})]}),o?s.isLoading?(0,M.jsx)(w,{className:`p-6 text-center text-label-14 text-muted`,children:`Loading sources…`}):c.length===0?(0,M.jsxs)(w,{className:`p-8 text-center`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14 text-neutral`,children:[`No traffic sources connected for `,o,`.`]}),!b()&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Connect a source to start collecting traffic.`}),(0,M.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center justify-center gap-2`,children:(0,M.jsxs)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(!0),children:[(0,M.jsx)(t,{className:`size-3.5`}),`Connect a source`]})})]})]}):(0,M.jsx)(be,{projectName:o,sources:c}):(0,M.jsx)(w,{className:`p-6 text-center text-label-14 text-muted`,children:`No projects yet.`})]}),!b()&&(0,M.jsx)(de,{open:r,onOpenChange:i,projectName:o})]})}function be({projectName:e,sources:t}){let n=h(),r=_({queries:t.map(t=>({...S({client:v,path:{name:e,id:t.id}}),staleTime:3e4}))}),i=t.map((e,t)=>({source:e,detail:r[t]?.data,isLoading:r[t]?.isLoading??!1}));return(0,M.jsx)(`div`,{className:`material-base overflow-hidden`,children:(0,M.jsxs)(`table`,{className:`w-full text-label-14`,children:[(0,M.jsx)(`thead`,{className:`bg-bg-elevated/50 text-label-12-strong normal-case text-muted`,children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Source`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Status`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Last sync`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Content crawls`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Infra crawls`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`AI fetches`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`AI referrals`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`})]})}),(0,M.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:i.map(({source:t,detail:r,isLoading:i})=>(0,M.jsxs)(`tr`,{className:`cursor-pointer transition-colors hover:bg-bg-elevated/40 focus-within:bg-bg-elevated/40`,onClick:r=>{ie(r)&&n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id}})},children:[(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(g,{to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id},className:`text-label-14-strong text-heading hover:underline`,children:t.displayName})}),(0,M.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,M.jsx)(te,{tone:ue(t.status),children:t.status}),t.lastError?(0,M.jsx)(`p`,{className:`mt-1 max-w-[18rem] truncate text-copy-14 text-negative-400`,title:t.lastError,children:t.lastError}):null]}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-neutral`,children:ve(t.lastSyncedAt)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,title:r?`${r.totals24h.crawlerHits.toLocaleString(`en-US`)} total crawler hits`:void 0,children:i?`—`:$(r?.totals24h.crawlerContentHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-muted`,children:i?`—`:$(r?.totals24h.crawlerInfraHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,children:i?`—`:$(r?.totals24h.aiUserFetchHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,children:i?`—`:$(r?.totals24h.aiReferralLandedHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsxs)(g,{to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id},className:`inline-flex items-center gap-1 text-label-14 text-secondary hover:text-heading`,children:[`View`,(0,M.jsx)(s,{className:`size-3.5`})]})})]},t.id))})]})})}export{ye as TrafficPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{J as t,Y as n,b as r,ct as i,n as a,ot as o}from"./vendor-lucide-Bo69m9KC.js";import{r as s}from"./vendor-markdown-BiRP51B0.js";import{p as ee,t as te,u as ne}from"./vendor-tanstack-tBjrfzKu.js";import{a as c,c as re,d as l,f as ie,i as ae,m as oe,n as se,r as ce}from"./vendor-recharts-CY6tH-r6.js";import{Sr as u,r as le,t as ue,wr as d,wt as de}from"./ToneBadge-DawS8vMp.js";import{f as fe}from"./format-helpers-CscAFAMJ.js";import{a as f,n as pe,r as me,s as he,t as ge}from"./ChartPrimitives-Cs2iavxU.js";import{t as p}from"./InfoTooltip-CNLlIWeP.js";import{t as m}from"./card-ClURYmZN.js";import{a as _e,d as ve,l as ye,o as be,t as xe}from"./server-traffic-C-_D6pdo.js";import{r as Se}from"./agent-trust-copy-CZpfPr4M.js";var h=e(i(),1),Ce=[{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`}],we=[{value:`all`,label:`All claims`},{value:d.verified,label:`Verified`},{value:d.claimed_unverified,label:`Claimed unverified`},{value:d.unknown_ai_like,label:`Unknown AI-like`}];function g(e){return e===`all`?null:Number.parseInt(e[0],10)}function Te(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.botId;case u[`ai-referral`]:return e.product}}function _(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.pathNormalized;case u[`ai-referral`]:return e.landingPathNormalized}}function v(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.verificationStatus;case u[`ai-referral`]:return null}}function y(e,t){if(t===`hour`)return e;let n=new Date(e);return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`}function Ee(e,t,n){let r=t.pathQuery.trim().toLowerCase(),i=g(t.statusClass);return e.filter(e=>!(t.selectedBucket&&y(e.tsHour,n)!==t.selectedBucket||t.identity&&Te(e)!==t.identity||t.operator&&e.operator!==t.operator||r&&!_(e).toLowerCase().includes(r)||i!==null&&Math.floor(e.status/100)!==i||t.verification!==`all`&&v(e)!==t.verification))}function De(e,t){if(!e||typeof e!=`object`)return null;let n=e.activeTooltipIndex,r;if(typeof n==`number`)r=n;else if(typeof n==`string`&&n!==``)r=Number(n);else return null;return!Number.isInteger(r)||r<0||r>=t.length?null:t[r]?.bucket??null}var b=s(),x=[{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:43200,label:`30d`,granularity:`day`,fetchLimit:2e3},{value:129600,label:`90d`,granularity:`day`,fetchLimit:5e3}],Oe=x.find(e=>e.label===`24h`)??x[2],S=50,C=f[0],w=f[2],T=f[1],ke=fe();function E(e){let t=new Date(e);return`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:00`}function D(e){let t=new Date(`${e}T00:00:00`);return`${t.getMonth()+1}/${t.getDate()}`}function Ae(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function O(e){return e.size===1?[...e][0]:`all`}function je({canGoBack:e,className:t}){let n=`inline-flex items-center gap-1`;return e?(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{window.history.back()},className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` Back`]}):(0,b.jsxs)(ne,{to:`/traffic`,className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` All sources`]})}function k(){let e=ee({strict:!1}),i=e.projectName??``,a=te(),o=e.sourceId??``,[s,ne]=(0,h.useState)(Oe.value),[d,fe]=(0,h.useState)(()=>new Set([`crawler`,`ai-user-fetch`,`ai-referral`])),[f,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(``),[y,E]=(0,h.useState)(``),[D,k]=(0,h.useState)(``),[N,P]=(0,h.useState)(`all`),[F,I]=(0,h.useState)(`all`),[Ie,L]=(0,h.useState)(1),[Le,Re]=(0,h.useState)(null),[ze,Be]=(0,h.useState)(null),R=(0,h.useMemo)(()=>x.find(e=>e.value===s)??Oe,[s]),Ve=(0,h.useMemo)(()=>O(d),[d]),z=be(i||null,o||null),B=_e(i||null,{kind:Ve,sourceId:o||void 0,sinceMinutes:s,limit:R.fetchLimit,granularity:R.granularity}),V=ye(i||null,o||null),H=z.data,U=B.data?.events??[],W=B.data?.totals,G=B.data?.eventRows,K=(0,h.useMemo)(()=>U.filter(e=>{switch(e.kind){case u.crawler:return d.has(`crawler`);case u[`ai-user-fetch`]:return d.has(`ai-user-fetch`);case u[`ai-referral`]:return d.has(`ai-referral`)}}),[U,d]),He=(0,h.useMemo)(()=>{let e=new Set;for(let t of U)e.add(Te(t));return _&&e.add(_),[...e].sort((e,t)=>e.localeCompare(t))},[U,_]),Ue=(0,h.useMemo)(()=>{let e=new Set;for(let t of U)e.add(t.operator);return y&&e.add(y),[...e].sort((e,t)=>e.localeCompare(t))},[U,y]),q=(0,h.useMemo)(()=>Ee(K,{selectedBucket:f,identity:_,operator:y,pathQuery:D,statusClass:N,verification:F},R.granularity),[K,f,_,y,D,N,F,R.granularity]);(0,h.useEffect)(()=>{L(1)},[K,f,_,y,D,N,F]);let J=Math.max(1,Math.ceil(q.length/S)),Y=Math.min(Math.max(1,Ie),J),X=(Y-1)*S,We=(0,h.useMemo)(()=>q.slice(X,X+S),[q,X]),Ge=q.length>S,Ke=q.length===0?0:X+1,qe=Math.min(X+S,q.length),Z=(0,h.useMemo)(()=>f?Me(f,R.granularity):null,[f,R.granularity]),Q=(0,h.useMemo)(()=>Ne(B.data?.series.points??[],R.granularity),[B.data?.series.points,R.granularity]),$=e=>{fe(t=>{let n=new Set(t);return n.has(e)?n.size>1&&n.delete(e):n.add(e),n})},Je=e=>{let t=De(e,Q);t&&g(e=>e===t?null:t)},Ye=()=>{g(null),v(``),E(``),k(``),P(`all`),I(`all`)},Xe=!!(f||_||y||D.trim()||N!==`all`||F!==`all`),Ze=async()=>{Re(null),Be(null);try{let e=await V.mutateAsync({sinceMinutes:60});Be(`Pulled ${e.pulledEvents} entries · ${e.crawlerHits} crawler · ${e.aiUserFetchHits} AI user fetch · ${e.aiUserFetchLikelyFakeHits} likely fake agent · ${e.aiReferralHits} AI referral · ${e.unknownHits} unknown`)}catch(e){Re(ve(e))}};return!i||!o?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Missing project name or source id in URL.`})}):z.isLoading?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Loading source…`})}):z.isError||!H?(0,b.jsxs)(`div`,{className:`page-container`,children:[(0,b.jsx)(`p`,{className:`text-copy-14 text-negative`,children:`Could not load this source.`}),(0,b.jsx)(je,{canGoBack:a,className:`mt-2 text-label-12 text-secondary hover:text-strong`})]}):(0,b.jsxs)(`div`,{className:`page-container space-y-8`,children:[(0,b.jsxs)(`div`,{className:`page-header`,children:[(0,b.jsxs)(`div`,{className:`page-header-left`,children:[(0,b.jsx)(je,{canGoBack:a,className:`text-label-12 text-muted hover:text-strong`}),(0,b.jsx)(`h1`,{className:`page-title mt-2`,children:H.displayName}),(0,b.jsxs)(`p`,{className:`page-subtitle`,children:[H.sourceType,` source for `,i]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(ue,{tone:xe(H.status),children:H.status}),!de()&&(0,b.jsxs)(le,{type:`button`,variant:`outline`,size:`sm`,disabled:V.isPending,onClick:()=>void Ze(),children:[(0,b.jsx)(r,{className:`size-3.5 ${V.isPending?`animate-spin`:``}`}),V.isPending?`Syncing…`:`Sync now`]})]})]}),Le?(0,b.jsx)(`div`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-label-14 text-negative-200`,children:Le}):null,ze?(0,b.jsx)(`div`,{className:`rounded-md border border-positive-800/50 bg-positive-950/30 px-3 py-2 text-label-14 text-positive-200`,children:ze}):null,(0,b.jsxs)(`section`,{"aria-labelledby":`traffic-24h-heading`,children:[(0,b.jsx)(`h2`,{id:`traffic-24h-heading`,className:`mb-3 text-heading-14 text-heading`,children:`Last 24 hours`}),(0,b.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:[(0,b.jsx)(M,{label:`Content crawls`,value:H.totals24h.crawlerContentHits,tooltip:`Content and document paths only. Excludes sitemap ${H.totals24h.crawlerSegments.sitemap.toLocaleString(`en-US`)}, robots ${H.totals24h.crawlerSegments.robots.toLocaleString(`en-US`)}, assets ${H.totals24h.crawlerSegments.asset.toLocaleString(`en-US`)}, and ${H.totals24h.crawlerSegments.other.toLocaleString(`en-US`)} other requests such as feeds, API paths, or downloads. Total crawler hits: ${H.totals24h.crawlerHits.toLocaleString(`en-US`)}.`}),(0,b.jsx)(M,{label:`AI user fetches`,value:H.totals24h.aiUserFetchHits,tooltip:`Requests from AI assistants fetching a page for a person (ChatGPT-User, Claude-User, Perplexity-User and others). ${Se(H.totals24h.aiUserFetchLikelyFakeHits)}`}),(0,b.jsx)(M,{label:`AI referral sessions`,value:H.totals24h.aiReferralLandedHits,tooltip:`Browser click-throughs from AI surfaces, identified by Referer or UTM evidence. Excludes ${H.totals24h.aiReferralRedirectedHits.toLocaleString(`en-US`)} request(s) answered with a redirect: a hop is not an arrival. Total including hops: ${H.totals24h.aiReferralHits.toLocaleString(`en-US`)}.`})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`p`,{className:`eyebrow mb-4`,children:`Latest sync run`}),H.latestRun?(0,b.jsxs)(m,{className:`p-4 text-label-14`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1.5`,children:[(0,b.jsxs)(`span`,{className:`text-heading`,children:[`Status: `,(0,b.jsx)(`span`,{className:`text-label-14-strong`,children:H.latestRun.status})]}),(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Started: `,Ae(H.latestRun.startedAt)]}),H.latestRun.finishedAt?(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Finished: `,Ae(H.latestRun.finishedAt)]}):null]}),(0,b.jsxs)(`details`,{className:`mt-3`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`Run details`}),(0,b.jsx)(`code`,{className:`mt-2 block text-label-12 text-muted`,children:H.latestRun.runId})]}),H.latestRun.error?(0,b.jsx)(`p`,{className:`mt-2 rounded border border-negative-900/40 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative`,children:H.latestRun.error}):null]}):(0,b.jsx)(m,{className:`px-4 py-3 text-label-14 text-muted`,children:de()?`No traffic-sync runs recorded yet.`:`No traffic-sync runs recorded yet. Hit "Sync now" above to create one.`})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Events`}),(0,b.jsx)(`h2`,{className:`mt-1 text-heading-16 text-primary`,children:R.granularity===`day`?`Daily rollups`:`Hourly rollups`}),W?(0,b.jsxs)(`p`,{className:`mt-1.5 text-copy-13 text-muted`,children:[W.crawlerContentHits.toLocaleString(`en-US`),` content crawls ·`,` `,W.crawlerInfraHits.toLocaleString(`en-US`),` infra (sitemap/robots/assets) ·`,` `,W.aiUserFetchHits.toLocaleString(`en-US`),` AI user fetches ·`,` `,W.aiReferralLandedHits.toLocaleString(`en-US`),` AI referral sessions · last `,R.label,` · `,ke]}):null]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-md border border-base p-0.5`,role:`toolbar`,"aria-label":`Window`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,className:`rounded px-2.5 py-1 text-button-14 ${s===e.value?`bg-bg-elevated text-heading`:`text-secondary hover:text-strong`}`,"aria-pressed":s===e.value,onClick:()=>{ne(e.value),g(null)},children:e.label},e.value))})]}),(0,b.jsxs)(m,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,role:`toolbar`,"aria-label":`Series`,children:[(0,b.jsx)(j,{label:`Crawler`,color:C,count:W?.crawlerHits??0,active:d.has(`crawler`),onToggle:()=>$(`crawler`)}),(0,b.jsx)(j,{label:`AI user fetches`,color:w,count:W?.aiUserFetchHits??0,active:d.has(`ai-user-fetch`),onToggle:()=>$(`ai-user-fetch`)}),(0,b.jsx)(j,{label:`AI referral sessions`,color:T,count:W?.aiReferralLandedHits??0,active:d.has(`ai-referral`),onToggle:()=>$(`ai-referral`)})]}),B.isError?(0,b.jsxs)(`p`,{className:`py-12 text-center text-copy-13 text-negative-400`,children:[`Failed to load events: `,B.error instanceof Error?B.error.message:`Unknown error`]}):B.isLoading?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`Loading events…`}):Q.length===0?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`No events in this window.`}):(0,b.jsx)(`div`,{className:`h-72`,children:(0,b.jsx)(oe,{children:(0,b.jsxs)(se,{data:Q,margin:{top:4,right:4,bottom:0,left:0},onClick:Je,style:{cursor:`pointer`},children:[(0,b.jsx)(re,{stroke:me,strokeDasharray:`3 3`}),(0,b.jsx)(ae,{dataKey:`label`,tick:pe,stroke:ge,interval:`preserveStartEnd`,minTickGap:R.granularity===`day`?24:32}),(0,b.jsx)(ce,{tick:pe,stroke:ge,allowDecimals:!1}),(0,b.jsx)(ie,{...he}),d.has(`crawler`)?(0,b.jsx)(c,{dataKey:`crawler`,name:`Crawler`,fill:C,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,d.has(`ai-user-fetch`)?(0,b.jsx)(c,{dataKey:`aiUserFetch`,name:`AI user fetch`,fill:w,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,d.has(`ai-referral`)?(0,b.jsx)(c,{dataKey:`aiReferral`,name:`AI referral`,fill:T,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null]})})})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Event rows`}),(0,b.jsxs)(`p`,{className:`mt-1 text-copy-13 text-muted`,children:[`Showing `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:q.length.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:K.length.toLocaleString(`en-US`)}),` `,G?.truncated?`loaded events`:`events`,G?.truncated?(0,b.jsxs)(b.Fragment,{children:[` `,`· loaded `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:G.returned.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:G.total.toLocaleString(`en-US`)}),` rows`]}):null,` `,`· `,ke]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by identity`,value:_,onChange:e=>v(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All identities`}),He.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The specific bot or AI product making the request (e.g., GPTBot, ChatGPT-User, Perplexity). One operator usually runs several identities.`})]}),(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by operator`,value:y,onChange:e=>E(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All operators`}),Ue.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.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.`})]}),(0,b.jsx)(`select`,{"aria-label":`Filter by HTTP status class`,value:N,onChange:e=>P(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:Ce.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`select`,{"aria-label":`Filter by verification claim`,value:F,onChange:e=>I(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:we.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`input`,{type:`search`,"aria-label":`Filter by path`,placeholder:`path contains…`,value:D,onChange:e=>k(e.target.value),className:`w-44 rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong placeholder:text-faint focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`})]})]}),Xe?(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[Z?(0,b.jsx)(A,{label:`Bucket: ${Z}`,onClear:()=>g(null)}):null,_?(0,b.jsx)(A,{label:`Identity: ${_}`,onClear:()=>v(``)}):null,y?(0,b.jsx)(A,{label:`Operator: ${y}`,onClear:()=>E(``)}):null,D.trim()?(0,b.jsx)(A,{label:`Path: ${D.trim()}`,onClear:()=>k(``)}):null,N===`all`?null:(0,b.jsx)(A,{label:`Status: ${N}`,onClear:()=>P(`all`)}),F===`all`?null:(0,b.jsx)(A,{label:`Claim: ${Pe(F)}`,onClear:()=>I(`all`)}),(0,b.jsx)(`button`,{type:`button`,onClick:Ye,className:`text-button-14 text-muted underline-offset-4 hover:text-strong hover:underline`,children:`Clear all`})]}):null,(0,b.jsx)(Fe,{events:We,truncated:G?.truncated??!1}),Ge?(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-label-12 text-secondary`,children:[(0,b.jsxs)(`p`,{className:`tabular-nums`,children:[`Showing `,(0,b.jsx)(`span`,{className:`text-neutral`,children:Ke.toLocaleString(`en-US`)}),`–`,(0,b.jsx)(`span`,{className:`text-neutral`,children:qe.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`text-neutral`,children:q.length.toLocaleString(`en-US`)}),` events`]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>Math.max(1,e-1)),disabled:Y<=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:[(0,b.jsx)(n,{className:`size-3.5`}),`Prev`]}),(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`Page `,(0,b.jsx)(`span`,{className:`text-strong`,children:Y}),` of`,` `,(0,b.jsx)(`span`,{className:`text-strong`,children:J})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>Math.min(J,e+1)),disabled:Y>=J,"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`,(0,b.jsx)(t,{className:`size-3.5`})]})]})]}):null]}),(0,b.jsxs)(`details`,{className:`border-t border-default pt-4`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`How traffic is classified`}),(0,b.jsx)(`p`,{className:`mt-2 max-w-3xl text-copy-14 text-secondary`,children:`Crawler requests, AI user fetches, and referrals are recorded separately. Filters expose the underlying evidence.`})]})]})}function Me(e,t){return t===`day`?D(e):E(e)}function Ne(e,t){return e.map(e=>({bucket:e.bucket,label:Me(e.bucket,t),crawler:e.crawlerHits,aiUserFetch:e.aiUserFetchHits,aiReferral:e.aiReferralLandedHits}))}function Pe(e){return we.find(t=>t.value===e)?.label??e}function A({label:e,onClear:t}){return(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded border border-strong bg-surface-inset px-2.5 py-1 text-label-14 text-strong`,children:[e,(0,b.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Clear ${e}`,className:`rounded p-0.5 text-secondary hover:bg-mono-700/60 hover:text-heading`,children:(0,b.jsx)(a,{className:`size-3`})})]})}function j({label:e,color:t,count:n,active:r,onToggle:i}){return(0,b.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":r,className:`inline-flex items-center gap-2 rounded border px-3 py-1.5 text-button-14 transition ${r?`border-strong bg-surface-inset text-heading`:`border-base bg-transparent text-muted hover:text-neutral`}`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-3 items-center justify-center rounded-sm border transition-opacity ${r?`border-transparent opacity-100`:`border-strong opacity-60`}`,style:r?{backgroundColor:t}:void 0,children:r?`✓`:``}),(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`span`,{className:`tabular-nums ${r?`text-secondary`:`text-faint`}`,children:n.toLocaleString(`en-US`)})]})}function M({label:e,value:t,tooltip:n}){return(0,b.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-copy-14 text-secondary`,children:[e,n?(0,b.jsx)(p,{text:n}):null]}),(0,b.jsx)(`p`,{className:`mt-1 text-copy-24-strong tabular-nums text-heading`,children:t.toLocaleString(`en-US`)})]})}function N(e){switch(e){case u.crawler:return`Crawler`;case u[`ai-user-fetch`]:return`AI hit`;case u[`ai-referral`]:return`AI referral`}}function P(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return e.botId;case u[`ai-referral`]:return e.product}}function F(e){switch(e.kind){case u.crawler:case u[`ai-user-fetch`]:return`${e.verificationStatus} · HTTP ${e.status}`;case u[`ai-referral`]:return`${e.evidenceType} · ${e.sourceDomain}`}}function Fe({events:e,truncated:t=!1}){return e.length===0?(0,b.jsx)(m,{className:`p-6 text-center text-label-14 text-muted`,children:t?`No matches in the rows loaded so far. More rows exist beyond the load limit, so narrow the time window to search them.`:`No event rows match the current filters.`}):(0,b.jsx)(`div`,{className:`material-base overflow-hidden`,children:(0,b.jsxs)(`table`,{className:`w-full text-label-14`,children:[(0,b.jsx)(`thead`,{className:`bg-bg-elevated/50 text-label-12-strong normal-case text-muted`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Hour`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Kind`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Identity`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Evidence / status`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Path`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-right`,children:(0,b.jsxs)(`span`,{className:`inline-flex items-center`,children:[`Hits`,(0,b.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.`})]})})]})}),(0,b.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:e.map((e,t)=>(0,b.jsxs)(`tr`,{className:`hover:bg-bg-elevated/40 transition-colors`,children:[(0,b.jsx)(`td`,{className:`px-4 py-2 text-label-12-mono text-neutral`,children:E(e.tsHour)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:N(e.kind)}),(0,b.jsxs)(`td`,{className:`px-4 py-2 text-heading`,children:[P(e),(0,b.jsx)(`span`,{className:`ml-2 text-label-12 text-muted`,children:e.operator})]}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:F(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 truncate text-label-12-mono text-neutral`,children:_(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-heading`,children:e.hits})]},`${e.kind}:${e.tsHour}:${t}`))})]})})}export{Fe as EventsTable,M as TrafficKpi,k as TrafficSourceDetailPage,O as trafficFetchKind};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{st as t}from"./vendor-lucide-CoTHJwai.js";import{r as n}from"./vendor-markdown-cQgSk2i0.js";import"./ToneBadge-BgTLSTKp.js";var r=e(t(),1),i=n(),a={account:null,canWrite:!0,isAdmin:!0},o={account:null,canWrite:!1,isAdmin:!1};function s(e){let t=e.scopes.includes(`*`);return{account:null,canWrite:!e.readOnly&&t,isAdmin:e.projectId===null&&e.scopes.includes(`*`)}}var c=(0,r.createContext)(a);function l({account:e,apiKey:t,apiKeyPending:n=!1,children:r}){let l=n?o:t?s(t):e?{account:e,canWrite:e.role===`admin`,isAdmin:e.role===`admin`}:a;return(0,i.jsx)(c.Provider,{value:l,children:r})}function u(){return(0,r.useContext)(c)}var d=`View only — your account cannot change this.`;export{d as n,u as r,l as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ct as t}from"./vendor-lucide-Bo69m9KC.js";import{r as n}from"./vendor-markdown-BiRP51B0.js";import"./ToneBadge-DawS8vMp.js";var r=e(t(),1),i=n(),a={account:null,canWrite:!0,isAdmin:!0},o={account:null,canWrite:!1,isAdmin:!1};function s(e){let t=e.scopes.includes(`*`);return{account:null,canWrite:!e.readOnly&&t,isAdmin:e.projectId===null&&e.scopes.includes(`*`)}}var c=(0,r.createContext)(a);function l({account:e,apiKey:t,apiKeyPending:n=!1,children:r}){let l=n?o:t?s(t):e?{account:e,canWrite:e.role===`admin`,isAdmin:e.role===`admin`}:a;return(0,i.jsx)(c.Provider,{value:l,children:r})}function u(){return(0,r.useContext)(c)}var d=`View only — your account cannot change this.`;export{d as n,u as r,l as t};
@@ -0,0 +1 @@
1
+ import{br as e,xr as t}from"./ToneBadge-DawS8vMp.js";var n={[e.verified]:`Verified`,[e.likely_real]:`Likely real`,[e.unknown]:`Unknown`};function r(e,n){switch(e){case t[`ip-in-published-list`]:return`IP on ${n}'s published list`;case t[`ip-outside-published-list`]:return`IP not on ${n}'s published list`;case t[`no-ip`]:return`Source gives no IP to check`;case t[`no-published-list`]:return`${n} publishes no IP list`;case t[`documented-user-agent`]:return`User agent matches ${n}'s published one`;case t[`unusual-user-agent`]:return`User agent differs from ${n}'s published one`;case t[`scanner-path`]:return`Asked for a secret or admin file`;case t[`scanner-burst`]:return`Same IP asked for secret files`}}var i=`Bots posing as an AI assistant, such as scanners looking for secret files.`;function a(e){return e===0?`No fake agent requests in this period.`:`Excludes ${e.toLocaleString(`en-US`)} fake ${e===1?`request`:`requests`} from bots posing as an AI assistant.`}export{r as i,n,a as r,i as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{st as t}from"./vendor-lucide-CoTHJwai.js";import{r as n}from"./vendor-markdown-cQgSk2i0.js";import{i as r}from"./ToneBadge-BgTLSTKp.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`material-base`,e),...t}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`flex flex-col gap-1.5 p-5`,e),...t}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`h3`,{ref:n,className:r(`text-heading-16 text-primary`,e),...t}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`p`,{ref:n,className:r(`text-copy-14 text-secondary`,e),...t}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`p-5 pt-0`,e),...t}));u.displayName=`CardContent`;export{c as a,s as i,u as n,l as r,o as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ct as t}from"./vendor-lucide-Bo69m9KC.js";import{r as n}from"./vendor-markdown-BiRP51B0.js";import{i as r}from"./ToneBadge-DawS8vMp.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`material-base`,e),...t}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`flex flex-col gap-1.5 p-5`,e),...t}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`h3`,{ref:n,className:r(`text-heading-16 text-primary`,e),...t}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`p`,{ref:n,className:r(`text-copy-14 text-secondary`,e),...t}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...t},n)=>(0,a.jsx)(`div`,{ref:n,className:r(`p-5 pt-0`,e),...t}));u.displayName=`CardContent`;export{c as a,s as i,u as n,l as r,o as t};
@@ -1,3 +1,3 @@
1
- import{Gi as e,ki as t}from"./ToneBadge-BgTLSTKp.js";var n={ambiguous:`Property identity unverified`},r=`No answer could be tied to one property`;function i(e){return e.denominator===null||e.denominator===void 0||e.unattributed===void 0||e.unattributed<=0?null:`${e.unattributed} of ${e.denominator+e.unattributed} answers could not be tied to one property`}function a(e){if(e.denominator===null||e.denominator===void 0||e.unchecked===void 0||e.unchecked<=0)return null;let t=e.denominator+e.unchecked;return`${e.unchecked} of ${t} ${t===1?`answer`:`answers`} had sources that could not be checked`}var o=function(e){return e.Clicks=`clicks`,e.Impressions=`impressions`,e.CTR=`ctr`,e.Position=`position`,e}({}),s={clicks:`Clicks`,impressions:`Impressions`,ctr:`CTR`,position:`Position`},c={clicks:`Clicks`,impressions:`Impr`,ctr:`CTR`,position:`Pos`},l=t;function u(e){return e.endsWith(`%`)?{figure:e.slice(0,-1),sign:`%`}:{figure:e,sign:``}}function d(e,t){return t===`cited`?a(e):i(e)}function f(e,t){let n=d(e,t),r=t===`cited`?e.unchecked:e.unattributed;if(n===null||r===void 0)return null;let i=`${r} ${t===`cited`?`unchecked`:`unattributed`}`;return{label:i,text:`${i}. ${n}, so this rate leaves ${r===1?`it`:`them`} out.`}}function p(t,n){let r=e(t);switch(n){case`cited`:return`${r} cited (any page)`;case`emerging`:return`${r} newly cited (any page)`;case`lost`:return`${r} citation lost (any page)`;case`not-cited`:return`${r} not cited (any page)`;case`pending`:return`Pending`}}function m(e){let t=[];if(e.message&&t.push(e.message),e.providers)for(let[n,r]of Object.entries(e.providers)){let e=`[${n}] ${r.message}`;r.raw===void 0?t.push(e):t.push(`${e}\n\n${JSON.stringify(r.raw,null,2)}`)}return t.length>0?t.join(`
1
+ import{Ai as e,Ki as t}from"./ToneBadge-DawS8vMp.js";var n={ambiguous:`Property identity unverified`},r=`No answer could be tied to one property`;function i(e){return e.denominator===null||e.denominator===void 0||e.unattributed===void 0||e.unattributed<=0?null:`${e.unattributed} of ${e.denominator+e.unattributed} answers could not be tied to one property`}function a(e){if(e.denominator===null||e.denominator===void 0||e.unchecked===void 0||e.unchecked<=0)return null;let t=e.denominator+e.unchecked;return`${e.unchecked} of ${t} ${t===1?`answer`:`answers`} had sources that could not be checked`}var o=function(e){return e.Clicks=`clicks`,e.Impressions=`impressions`,e.CTR=`ctr`,e.Position=`position`,e}({}),s={clicks:`Clicks`,impressions:`Impressions`,ctr:`CTR`,position:`Position`},c=e;function l(e){return e.endsWith(`%`)?{figure:e.slice(0,-1),sign:`%`}:{figure:e,sign:``}}function u(e,t){return t===`cited`?a(e):i(e)}function d(e,t){let n=u(e,t),r=t===`cited`?e.unchecked:e.unattributed;if(n===null||r===void 0)return null;let i=`${r} ${t===`cited`?`unchecked`:`unattributed`}`;return{label:i,text:`${i}. ${n}, so this rate leaves ${r===1?`it`:`them`} out.`}}function f(e,n){let r=t(e);switch(n){case`cited`:return`${r} cited (any page)`;case`emerging`:return`${r} newly cited (any page)`;case`lost`:return`${r} citation lost (any page)`;case`not-cited`:return`${r} not cited (any page)`;case`pending`:return`Pending`}}function p(e){let t=[];if(e.message&&t.push(e.message),e.providers)for(let[n,r]of Object.entries(e.providers)){let e=`[${n}] ${r.message}`;r.raw===void 0?t.push(e):t.push(`${e}\n\n${JSON.stringify(r.raw,null,2)}`)}return t.length>0?t.join(`
2
2
 
3
- `):`Run failed.`}function h(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function g(e,t,n=new Date){let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=r.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`});return t&&new Date(t).toDateString()===r.toDateString()?i:`${_(e,n)}, ${i}`}function _(e,t=new Date){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.getFullYear()===t.getFullYear()?v(e):n.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function v(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function y(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function b(e){return e===null?`Unknown`:e?`Pass`:`Fail`}function x(e){return e===0?`12:00 AM`:e<12?`${e}:00 AM`:e===12?`12:00 PM`:`${e-12}:00 PM`}function S(e,t){return e===`twice-daily`?`twice-daily`:e.startsWith(`weekly@`)?`${e}@${t}`:`daily@${t}`}function C(e,t){if(!e)return{freq:`custom`,hour:6,customCron:t};if(e===`twice-daily`)return{freq:`twice-daily`,hour:6,customCron:``};let n=e.match(/^daily(?:@(\d+))?$/);if(n)return{freq:`daily`,hour:n[1]?parseInt(n[1]):6,customCron:``};let r=e.match(/^(weekly@(?:mon|tue|wed|thu|fri|sat|sun))(?:@(\d+))?$/);return r?{freq:r[1],hour:r[2]?parseInt(r[2]):6,customCron:``}:{freq:`custom`,hour:6,customCron:t}}function w(e,t,n){let r=n===`UTC`?`UTC`:n.split(`/`).pop()?.replace(/_/g,` `)??n;if(!e)return`Custom: ${t} · ${r}`;if(e===`twice-daily`)return`Twice a day (6am & 6pm) · ${r}`;let i=e.match(/^daily(?:@(\d+))?$/);if(i)return`Every day at ${x(i[1]?parseInt(i[1]):6)} · ${r}`;let a=e.match(/^weekly@(mon|tue|wed|thu|fri|sat|sun)(?:@(\d+))?$/);if(a){let e={mon:`Monday`,tue:`Tuesday`,wed:`Wednesday`,thu:`Thursday`,fri:`Friday`,sat:`Saturday`,sun:`Sunday`},t=a[2]?parseInt(a[2]):6;return`Every ${e[a[1]]} at ${x(t)} · ${r}`}return`${e} · ${r}`}function T(e,t){return t&&t!==e?`${e} · ${t}`:e}function E(){let e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=new Intl.DateTimeFormat(`en-US`,{timeZoneName:`short`}).formatToParts().find(e=>e.type===`timeZoneName`)?.value;return T(e,t)}export{u as _,f as a,r as b,x as c,g as d,y as f,p as g,w as h,S as i,v as l,C as m,c as n,b as o,E as p,o as r,m as s,s as t,_ as u,l as v,n as x,h as y};
3
+ `):`Run failed.`}function m(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function h(e,t,n=new Date){let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=r.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`});return t&&new Date(t).toDateString()===r.toDateString()?i:`${g(e,n)}, ${i}`}function g(e,t=new Date){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.getFullYear()===t.getFullYear()?_(e):n.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function _(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function v(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function y(e){return e===null?`Unknown`:e?`Pass`:`Fail`}function b(e){return e===0?`12:00 AM`:e<12?`${e}:00 AM`:e===12?`12:00 PM`:`${e-12}:00 PM`}function x(e,t){return e===`twice-daily`?`twice-daily`:e.startsWith(`weekly@`)?`${e}@${t}`:`daily@${t}`}function S(e,t){if(!e)return{freq:`custom`,hour:6,customCron:t};if(e===`twice-daily`)return{freq:`twice-daily`,hour:6,customCron:``};let n=e.match(/^daily(?:@(\d+))?$/);if(n)return{freq:`daily`,hour:n[1]?parseInt(n[1]):6,customCron:``};let r=e.match(/^(weekly@(?:mon|tue|wed|thu|fri|sat|sun))(?:@(\d+))?$/);return r?{freq:r[1],hour:r[2]?parseInt(r[2]):6,customCron:``}:{freq:`custom`,hour:6,customCron:t}}function C(e,t,n){let r=n===`UTC`?`UTC`:n.split(`/`).pop()?.replace(/_/g,` `)??n;if(!e)return`Custom: ${t} · ${r}`;if(e===`twice-daily`)return`Twice a day (6am & 6pm) · ${r}`;let i=e.match(/^daily(?:@(\d+))?$/);if(i)return`Every day at ${b(i[1]?parseInt(i[1]):6)} · ${r}`;let a=e.match(/^weekly@(mon|tue|wed|thu|fri|sat|sun)(?:@(\d+))?$/);if(a){let e={mon:`Monday`,tue:`Tuesday`,wed:`Wednesday`,thu:`Thursday`,fri:`Friday`,sat:`Saturday`,sun:`Sunday`},t=a[2]?parseInt(a[2]):6;return`Every ${e[a[1]]} at ${b(t)} · ${r}`}return`${e} · ${r}`}function w(e,t){return t&&t!==e?`${e} · ${t}`:e}function T(){let e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=new Intl.DateTimeFormat(`en-US`,{timeZoneName:`short`}).formatToParts().find(e=>e.type===`timeZoneName`)?.value;return w(e,t)}export{c as _,y as a,n as b,_ as c,v as d,T as f,l as g,f as h,d as i,g as l,C as m,o as n,p as o,S as p,x as r,b as s,s as t,h as u,m as v,r as y};