@canonry/canonry 7.128.1 → 7.129.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 (144) hide show
  1. package/assets/assets/{AccessControls-QW1RtXqK.js → AccessControls-B1v2FZPP.js} +1 -1
  2. package/assets/assets/{AgentSetupPage-BFXD__2X.js → AgentSetupPage-DAu_QuMy.js} +1 -1
  3. package/assets/assets/{AuditHistoryPanel-Cn9Tnnxo.js → AuditHistoryPanel-D_zRZDy7.js} +1 -1
  4. package/assets/assets/{BacklinksPage-Bv12EM38.js → BacklinksPage-DMZKWIfa.js} +1 -1
  5. package/assets/assets/{ChartPrimitives-DIAAi1Eq.js → ChartPrimitives-0854i4GX.js} +1 -1
  6. package/assets/assets/{HistoryPage-Bfn3nVjo.js → HistoryPage-Ci2llyKV.js} +1 -1
  7. package/assets/assets/{MeasurementPropertyPage-BuVvdugZ.js → MeasurementPropertyPage-Bml0yUnY.js} +1 -1
  8. package/assets/assets/{ProjectPage-er2nBpgg.js → ProjectPage-DQgRsgAv.js} +3 -3
  9. package/assets/assets/{RunsPage-wtzz8XIJ.js → RunsPage-BihA-xXz.js} +1 -1
  10. package/assets/assets/{ServerTrafficSection-oViiKz3j.js → ServerTrafficSection-B4FdP2Yn.js} +3 -3
  11. package/assets/assets/{SettingsPage-CVL6mVTM.js → SettingsPage-DuheQKDg.js} +1 -1
  12. package/assets/assets/{ToneBadge-DSr49xyr.js → ToneBadge-CvjNM6Ls.js} +1 -1
  13. package/assets/assets/{TrafficPage-drK_F4xY.js → TrafficPage-DiG_i3h4.js} +1 -1
  14. package/assets/assets/{TrafficSourceDetailPage-BdvprrAg.js → TrafficSourceDetailPage-BRlxEdMd.js} +1 -1
  15. package/assets/assets/{account-context-CRwUczVQ.js → account-context-DBJg_gVV.js} +1 -1
  16. package/assets/assets/{agent-trust-copy-DduiTpc0.js → agent-trust-copy-DELKG03R.js} +1 -1
  17. package/assets/assets/{card-DtN_FyC4.js → card-WjxG7OUP.js} +1 -1
  18. package/assets/assets/{index-Bh4Hdh7M.js → index-DxQlUSXe.js} +3 -3
  19. package/assets/assets/{preload-helper-CqQPtzI4.js → preload-helper-CkO9IcjS.js} +1 -1
  20. package/assets/assets/{query-client-DTIKbVqE.js → query-client-BuEx84KK.js} +1 -1
  21. package/assets/assets/{react-query-Bt-PaSFW.js → react-query-DF9z4xIx.js} +1 -1
  22. package/assets/assets/{react-sigma_core.esm.min-DLmrzL1s.js → react-sigma_core.esm.min-C1O8GFwj.js} +1 -1
  23. package/assets/assets/{server-traffic-BApvbZVl.js → server-traffic-s9vqPEWz.js} +1 -1
  24. package/assets/assets/{service--wSlHsiA.js → service-ZGP6b4iE.js} +1 -1
  25. package/assets/index.html +9 -9
  26. package/dist/activity-JOXDL3UF.js +13 -0
  27. package/dist/{ads-MMIVXXYK.js → ads-XOHE65YV.js} +4 -4
  28. package/dist/{agent-3N6J7AP5.js → agent-R2KM6VDZ.js} +8 -8
  29. package/dist/{agent-ask-V5NBRKWB.js → agent-ask-LK6L5U2G.js} +4 -4
  30. package/dist/{agent-conversations-6ZKNOOGK.js → agent-conversations-SPQZA674.js} +4 -4
  31. package/dist/{agent-journeys-R3TB7RS6.js → agent-journeys-J4PRNH37.js} +4 -4
  32. package/dist/{agent-memory-VKNEXDCF.js → agent-memory-HXK5R5H2.js} +4 -4
  33. package/dist/{agent-providers-HV3LM656.js → agent-providers-YXCFLOAD.js} +4 -4
  34. package/dist/{agent-transcript-5B7ZSNQO.js → agent-transcript-XLBIKNTI.js} +4 -4
  35. package/dist/{analytics-NRYYKO3D.js → analytics-CT6X5AIK.js} +4 -4
  36. package/dist/{answerability-BMPIAEV4.js → answerability-PRGBTPYO.js} +4 -4
  37. package/dist/{apply-52VDVYIV.js → apply-6AQBJSLU.js} +4 -4
  38. package/dist/{backfill-QIXONSLO.js → backfill-UMVXMH2Z.js} +11 -11
  39. package/dist/{backlinks-B4IMH5VN.js → backlinks-YAQL5BCW.js} +4 -4
  40. package/dist/{bing-G56ZWW4V.js → bing-A3BZHGVS.js} +4 -4
  41. package/dist/{bootstrap-74GDJENX.js → bootstrap-3GXCVZR6.js} +11 -11
  42. package/dist/{cdp-LVPKD5WH.js → cdp-NTHQS2VZ.js} +8 -8
  43. package/dist/{chunk-YDVXZWWF.js → chunk-2DTDECRE.js} +5 -5
  44. package/dist/{chunk-DOXBK2KF.js → chunk-2QHWROIF.js} +1 -1
  45. package/dist/{chunk-HOR6MC5A.js → chunk-3HQ5GREG.js} +372 -372
  46. package/dist/{chunk-G7HRY36G.js → chunk-3HW7EDLQ.js} +2 -2
  47. package/dist/{chunk-I4ITDPK7.js → chunk-5QRZYOHL.js} +1 -1
  48. package/dist/{chunk-KIJCFPN4.js → chunk-66ESBZBC.js} +1 -1
  49. package/dist/{chunk-KZKPWHJA.js → chunk-6HWV3PVJ.js} +5 -5
  50. package/dist/{chunk-UXCNYSAB.js → chunk-6S3Z37H7.js} +2 -2
  51. package/dist/{chunk-FQFL223H.js → chunk-6TEMKMWL.js} +2 -2
  52. package/dist/{chunk-PGKT42YN.js → chunk-AFKCRFVL.js} +1 -1
  53. package/dist/{chunk-34CPCOQI.js → chunk-APM25SLF.js} +3 -3
  54. package/dist/{chunk-SXLHTMXA.js → chunk-BW3SUS45.js} +2 -2
  55. package/dist/{chunk-7G6PCF4H.js → chunk-CT6J54HN.js} +6 -6
  56. package/dist/{chunk-6RE7O724.js → chunk-EF6I66NL.js} +2 -2
  57. package/dist/{chunk-A4NXXWFC.js → chunk-EGTMTGBD.js} +4 -4
  58. package/dist/{chunk-BHWR4PBF.js → chunk-GBYV3WM5.js} +3 -3
  59. package/dist/{chunk-3TCXYRME.js → chunk-GUU3LZQ2.js} +3 -3
  60. package/dist/{chunk-2GA43I45.js → chunk-H7UFYW34.js} +3 -3
  61. package/dist/{chunk-2JW5OBUF.js → chunk-HD73OWIQ.js} +5 -5
  62. package/dist/{chunk-STNPEES2.js → chunk-HEWCB5LK.js} +22 -22
  63. package/dist/{chunk-5LBYOWQZ.js → chunk-JJQ5USIP.js} +5 -5
  64. package/dist/{chunk-RG5E54VU.js → chunk-JZDOF24J.js} +1 -1
  65. package/dist/{chunk-XTIOFTFS.js → chunk-KL6LUFZG.js} +1 -1
  66. package/dist/{chunk-AT2LRVEB.js → chunk-MWZQPB26.js} +2 -2
  67. package/dist/{chunk-ETTKN2R4.js → chunk-MYDVOMA2.js} +10 -0
  68. package/dist/{chunk-O6RKXY2P.js → chunk-NJPBDYVK.js} +1 -1
  69. package/dist/{chunk-YW4K74WM.js → chunk-OFW3JZLL.js} +9 -6
  70. package/dist/{chunk-XMPXMQ5X.js → chunk-OWT4PYRT.js} +1 -1
  71. package/dist/{chunk-4PFBSPFE.js → chunk-PQL52QOQ.js} +4 -4
  72. package/dist/{chunk-PM23BRHO.js → chunk-RHVX66CW.js} +1 -1
  73. package/dist/{chunk-AVLWYL4G.js → chunk-RXBK4GQX.js} +4 -4
  74. package/dist/{chunk-4MEWPJ7A.js → chunk-SQ7ZF5MT.js} +8 -8
  75. package/dist/{chunk-V42NDP4R.js → chunk-T5H4KNSZ.js} +4 -4
  76. package/dist/{chunk-F56XOHE2.js → chunk-T7EDIDHA.js} +2 -2
  77. package/dist/{chunk-ZXX7DMBJ.js → chunk-V5B2CFBF.js} +1 -1
  78. package/dist/{chunk-WCWWHK7P.js → chunk-WPYUTGW5.js} +4 -4
  79. package/dist/{chunk-EOZLVWOC.js → chunk-YMWRR3HT.js} +4 -4
  80. package/dist/{chunk-5JQHOPNE.js → chunk-YYMXQVGL.js} +2 -2
  81. package/dist/{citations-CF7AU3KY.js → citations-GNB2QFVP.js} +5 -5
  82. package/dist/{cli-catalog-U6WE3BU7.js → cli-catalog-U6DBN4VK.js} +4 -4
  83. package/dist/cli-commands-LQS3WOKR.js +18 -0
  84. package/dist/cli.js +14 -14
  85. package/dist/{competitor-Q7L6HJ5O.js → competitor-I7Z6SSQP.js} +4 -4
  86. package/dist/{content-5KLBWKCB.js → content-QIBZSUA6.js} +4 -4
  87. package/dist/{dashboard-KQ3INTH3.js → dashboard-7FYN233W.js} +7 -7
  88. package/dist/{demo-5YEH32AM.js → demo-P2V5SBGO.js} +3 -3
  89. package/dist/{demo-server-25MUI3QS.js → demo-server-YYKW42LA.js} +13 -13
  90. package/dist/{discover-ENDRNDS6.js → discover-RBTF62HF.js} +5 -5
  91. package/dist/{discover-eval-7LJXSHUM.js → discover-eval-NMDHNYFT.js} +4 -4
  92. package/dist/{doctor-3N7TEK5G.js → doctor-4CJAVMAD.js} +4 -4
  93. package/dist/{evidence-MAIUNVWP.js → evidence-7Q4ET24V.js} +4 -4
  94. package/dist/{export-cmd-6FJNHZVJ.js → export-cmd-CKK77OJI.js} +4 -4
  95. package/dist/{ga-HWFGPMTN.js → ga-EZOQAH3P.js} +4 -4
  96. package/dist/{gbp-KIPU2NE6.js → gbp-UL6TC2FY.js} +4 -4
  97. package/dist/{google-PKYUSFRS.js → google-7BM3AREH.js} +5 -5
  98. package/dist/{google-marketing-NHQ6VSOK.js → google-marketing-DM6R3K7R.js} +2 -2
  99. package/dist/{health-cmd-OGYIMIFA.js → health-cmd-TDD7FB7Z.js} +5 -5
  100. package/dist/{history-5NJOUK2A.js → history-V5CQNF4Z.js} +4 -4
  101. package/dist/index.d.ts +76 -76
  102. package/dist/index.js +26 -26
  103. package/dist/{init-3JXUT7VJ.js → init-KLKQCQ54.js} +13 -13
  104. package/dist/{insights-CWTPGOPF.js → insights-FRBCFTVP.js} +4 -4
  105. package/dist/intelligence-service-APERYL5N.js +15 -0
  106. package/dist/{journeys-VP7LL2DS.js → journeys-J76FXGLW.js} +4 -4
  107. package/dist/{keys-VBZG6BWU.js → keys-LZVHDNZH.js} +4 -4
  108. package/dist/{keyword-M7Y4V5MJ.js → keyword-FMDPSY7C.js} +4 -4
  109. package/dist/{logs-NTFQR3S6.js → logs-LU33LBEQ.js} +4 -4
  110. package/dist/{mcp-DUN57Q6H.js → mcp-M63QTZK5.js} +5 -5
  111. package/dist/mcp.js +10 -10
  112. package/dist/{measurement-plan-SGJ7EDVC.js → measurement-plan-C6W7PUMR.js} +6 -6
  113. package/dist/{notify-4NOHQ6G4.js → notify-Q54WJSST.js} +4 -4
  114. package/dist/{organic-evidence-5NWLGCGE.js → organic-evidence-EGM6MHVP.js} +4 -4
  115. package/dist/{overview-EQ3BTXHC.js → overview-EWSJQE2E.js} +7 -7
  116. package/dist/{project-J43SI3ZT.js → project-K7U4L5TA.js} +4 -4
  117. package/dist/{project-setup-5WA4RAN3.js → project-setup-H6JIED5C.js} +4 -4
  118. package/dist/{query-NMWKGTJ3.js → query-NNFM2KSB.js} +4 -4
  119. package/dist/{research-UU2JB4JH.js → research-KHDVC2MP.js} +4 -4
  120. package/dist/{results-export-RQMNBKXT.js → results-export-2HTJWA2Y.js} +4 -4
  121. package/dist/{run-JTIH3ET5.js → run-VWAT66RX.js} +6 -6
  122. package/dist/{schedule-YVKS4ILU.js → schedule-6C26Y5DP.js} +4 -4
  123. package/dist/{search-XCX3SAOT.js → search-DY4JELQM.js} +4 -4
  124. package/dist/{serve-GOZOQL67.js → serve-W6CTWEDL.js} +27 -27
  125. package/dist/{session-H6N6B6RR.js → session-IX6YUFT4.js} +14 -14
  126. package/dist/{settings-2GDLWIBA.js → settings-IPTMUYPV.js} +4 -4
  127. package/dist/{sitemaps-22O75HMK.js → sitemaps-JHAE7447.js} +4 -4
  128. package/dist/{skills-NSUS2XV2.js → skills-C5KQTJZX.js} +3 -3
  129. package/dist/{snapshot-UCITZQFF.js → snapshot-KZDIFYFO.js} +4 -4
  130. package/dist/{src-OAVTTKVK.js → src-JWSI26BC.js} +2 -2
  131. package/dist/{status-KJZSA6KP.js → status-7TFB73LG.js} +6 -6
  132. package/dist/{support-PWLEDLQT.js → support-ZZ2GJP4Z.js} +2 -2
  133. package/dist/{technical-aeo-P3R7RR52.js → technical-aeo-R6GR6JJB.js} +4 -4
  134. package/dist/{telemetry-LA72RJFS.js → telemetry-YTUYOO3M.js} +5 -5
  135. package/dist/{tools-Q6ITEQ4V.js → tools-6N3Q7TRE.js} +12 -12
  136. package/dist/{traffic-CRLJJFKS.js → traffic-5IN455SY.js} +6 -6
  137. package/dist/{trends-A7ST3WIY.js → trends-MULZJCGC.js} +4 -4
  138. package/dist/{users-4H7IS7WC.js → users-4R5WLGZA.js} +4 -4
  139. package/dist/{visibility-stats-F2RUTMYR.js → visibility-stats-GFDD6IYA.js} +5 -5
  140. package/dist/{wordpress-EVNS3SAF.js → wordpress-S6NFAXJ6.js} +4 -4
  141. package/package.json +1 -1
  142. package/dist/activity-IDVGFHBZ.js +0 -13
  143. package/dist/cli-commands-DFFJYIZF.js +0 -18
  144. package/dist/intelligence-service-7DFVBFXY.js +0 -15
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProjectPage-er2nBpgg.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-C3F7vHjd.js","./vendor-radix-CXYx3LLU.js","./vendor-markdown-DMxglFrF.js","./vendor-tanstack-ZnWhYpCU.js","./vendor-recharts-DAGVAt0P.js","./ToneBadge-DSr49xyr.js","./preload-helper-CqQPtzI4.js","./ChartPrimitives-DIAAi1Eq.js","./account-context-CRwUczVQ.js","./async-handler-Bj3TnIRw.js","./query-client-DTIKbVqE.js","./react-query-Bt-PaSFW.js","./AccessControls-QW1RtXqK.js","./card-DtN_FyC4.js","./InfoTooltip-Dm4gYO4N.js","./use-tooltip-position-71Ffohl_.js","./extract-error-message-C1RkZ7dQ.js","./Hint-Drf3KqdJ.js","./AuditHistoryPanel-Cn9Tnnxo.js","./service--wSlHsiA.js","./server-traffic-BApvbZVl.js","./agent-trust-copy-DduiTpc0.js","./ServerTrafficSection-oViiKz3j.js","./RunsPage-wtzz8XIJ.js","./HistoryPage-Bfn3nVjo.js","./SettingsPage-CVL6mVTM.js","./AgentSetupPage-BFXD__2X.js","./BacklinksPage-Bv12EM38.js","./TrafficPage-drK_F4xY.js","./TrafficSourceDetailPage-BdvprrAg.js","./MeasurementPropertyPage-BuVvdugZ.js"])))=>i.map(i=>d[i]);
2
- import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{$ as n,C as r,D as i,E as a,F as o,H as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,U as v,W as y,X as b,Y as x,_ as S,a as C,at as w,d as T,et as E,h as D,it as O,j as k,k as A,l as j,lt as M,m as N,n as P,nt as F,ot as I,r as L,rt as ee,s as R,tt as te,u as z,v as ne,w as re,x as ie,y as ae}from"./vendor-lucide-C3F7vHjd.js";import{a as oe,c as se,i as ce,n as B,o as V,r as le,s as ue,t as de,u as fe}from"./vendor-radix-CXYx3LLU.js";import{n as H,r as pe,t as me}from"./vendor-markdown-DMxglFrF.js";import{D as he,E as ge,O as _e,S as ve,a as ye,b as U,c as be,d as xe,f as Se,g as Ce,h as we,i as Te,l as Ee,m as De,n as Oe,o as ke,r as Ae,s as je,u as W,v as Me,x as G}from"./vendor-tanstack-ZnWhYpCU.js";import{$ as Ne,$n as Pe,A as Fe,Ac as Ie,As as Le,At as Re,Bc as ze,Bn as Be,Bs as Ve,Cc as He,Cn as Ue,Ds as K,Dt as We,En as Ge,Es as Ke,F as qe,Fn as Je,Fo as Ye,Fs as Xe,Gc as Ze,Hn as Qe,Hs as $e,Ht as et,Ic as tt,In as nt,Io as rt,Is as it,It as at,Jc as ot,Jn as st,K as ct,Kc as lt,Kn as ut,L as dt,Ln as ft,Lo as pt,Lt as mt,M as ht,Mc as gt,Mn as _t,Ms as vt,N as yt,Nc as bt,Nn as xt,No as St,Ns as Ct,Nt as wt,O as Tt,Os as Et,Ot as Dt,Pn as Ot,Po as kt,Ps as At,Pt as jt,Q as Mt,Qn as Nt,Qs as Pt,Rn as Ft,S as It,Sc as q,Tc as Lt,Vn as Rt,Vs as zt,Vt as Bt,Wn as Vt,X as Ht,Xc as Ut,Xn as Wt,Xs as Gt,Xt as Kt,Yn as qt,Zc as Jt,Zn as Yt,_c as Xt,_l as Zt,_n as Qt,a as $t,al as en,an as tn,as as nn,at as rn,b as an,bc as on,bt as sn,cn,ct as ln,d as un,dl as dn,dn as fn,do as pn,el as mn,er as hn,f as gn,fl as _n,fn as vn,fo as yn,ft as bn,gc as xn,gl as Sn,gn as Cn,go as wn,hl as Tn,ho as En,ht as Dn,i as On,il as kn,in as An,is as jn,it as Mn,j as Nn,jc as Pn,jo as Fn,js as In,jt as Ln,k as Rn,kn as zn,ks as Bn,kt as Vn,ll as Hn,ln as Un,ls as Wn,lt as Gn,mc as Kn,ml as qn,mn as Jn,mo as Yn,mt as Xn,n as Zn,no as Qn,nr as $n,nt as er,o as tr,on as nr,os as rr,ot as ir,pc as ar,pl as or,pn as sr,po as cr,pt as lr,qc as ur,qn as dr,qs as fr,r as J,rc as pr,rn as mr,rt as hr,sl as gr,sn as _r,st as vr,t as yr,tn as br,tr as xr,tt as Sr,ul as Cr,ut as wr,vc as Tr,vn as Er,wc as Dr,wn as Or,x as kr,xc as Y,xt as X,yc as Ar,yt as jr,z as Mr,zc as Nr,zn as Pr,zs as Fr,zt as Ir}from"./ToneBadge-DSr49xyr.js";import{a as Lr,c as Rr,i as zr,n as Br,o as Vr,r as Hr,s as Ur,t as Wr}from"./preload-helper-CqQPtzI4.js";import{D as Gr,F as Kr,I as qr,L as Jr,O as Yr,k as Xr,v as Zr,w as Qr}from"./ChartPrimitives-DIAAi1Eq.js";import{n as $r,r as ei,t as ti}from"./account-context-CRwUczVQ.js";import{t as ni}from"./async-handler-Bj3TnIRw.js";import{a as ri,c as ii,d as ai,f as oi,i as si,l as ci,m as li,o as ui,p as di,r as fi}from"./query-client-DTIKbVqE.js";import{Cn as pi,Dn as mi,En as hi,Ft as gi,Gt as _i,It as vi,Kt as yi,Lt as bi,On as xi,Pt as Si,Sn as Ci,Tn as wi,Un as Ti,Ut as Ei,Wt as Di,Yn as Oi,a as ki,bn as Ai,c as ji,cn as Mi,i as Ni,ln as Pi,o as Fi,s as Ii,u as Li,wn as Ri,xn as zi}from"./react-query-Bt-PaSFW.js";import{E as Bi,_ as Vi,n as Hi,t as Ui}from"./AccessControls-QW1RtXqK.js";import{t as Wi}from"./InfoTooltip-Dm4gYO4N.js";import{i as Gi,n as Ki,r as qi,t as Ji}from"./card-DtN_FyC4.js";import{t as Yi}from"./vendor-yaml-Y43rmNgW.js";import{t as Xi}from"./extract-error-message-C1RkZ7dQ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Zi=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Qi=t(((e,t)=>{t.exports=Zi()})),$i=t((e=>{var t=Qi(),n=M(),r=fe();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),j=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),L=Symbol.for(`react.memo`),ee=Symbol.for(`react.lazy`),R=Symbol.for(`react.activity`),te=Symbol.for(`react.legacy_hidden`),z=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.for(`react.view_transition`),re=Symbol.for(`react.recoverable`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Symbol.for(`react.client.reference`);function se(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case R:return`Activity`;case ne:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case N:return e.displayName||`Context`;case j:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case L:return t=e.displayName||null,t===null?se(e.type)||`Memo`:t;case ee:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var ce=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function H(e){return{current:e}}function pe(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function me(e,t){de++,ue[de]=e.current,e.current=t}var he=H(null),ge=H(null),_e=H(null),ve=H(null);function ye(e,t){switch(me(_e,t),me(ge,e),me(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(he),me(he,e)}function U(){pe(he),pe(ge),pe(_e)}function be(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,me(ve,e)),t=he.current;var n=dp(t,e.type);t!==n&&(me(ge,e),me(he,n))}function xe(e){ge.current===e&&(pe(he),pe(ge)),ve.current===e&&(pe(ve),sh._currentValue=le)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProjectPage-DQgRsgAv.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-C3F7vHjd.js","./vendor-radix-CXYx3LLU.js","./vendor-markdown-DMxglFrF.js","./vendor-tanstack-ZnWhYpCU.js","./vendor-recharts-DAGVAt0P.js","./ToneBadge-CvjNM6Ls.js","./preload-helper-CkO9IcjS.js","./ChartPrimitives-0854i4GX.js","./account-context-DBJg_gVV.js","./async-handler-Bj3TnIRw.js","./query-client-BuEx84KK.js","./react-query-DF9z4xIx.js","./AccessControls-B1v2FZPP.js","./card-WjxG7OUP.js","./InfoTooltip-Dm4gYO4N.js","./use-tooltip-position-71Ffohl_.js","./extract-error-message-C1RkZ7dQ.js","./Hint-Drf3KqdJ.js","./AuditHistoryPanel-D_zRZDy7.js","./service-ZGP6b4iE.js","./server-traffic-s9vqPEWz.js","./agent-trust-copy-DELKG03R.js","./ServerTrafficSection-B4FdP2Yn.js","./RunsPage-BihA-xXz.js","./HistoryPage-Ci2llyKV.js","./SettingsPage-DuheQKDg.js","./AgentSetupPage-DAu_QuMy.js","./BacklinksPage-DMZKWIfa.js","./TrafficPage-DiG_i3h4.js","./TrafficSourceDetailPage-BRlxEdMd.js","./MeasurementPropertyPage-Bml0yUnY.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{$ as n,C as r,D as i,E as a,F as o,H as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,U as v,W as y,X as b,Y as x,_ as S,a as C,at as w,d as T,et as E,h as D,it as O,j as k,k as A,l as j,lt as M,m as N,n as P,nt as F,ot as I,r as L,rt as ee,s as R,tt as te,u as z,v as ne,w as re,x as ie,y as ae}from"./vendor-lucide-C3F7vHjd.js";import{a as oe,c as se,i as ce,n as B,o as V,r as le,s as ue,t as de,u as fe}from"./vendor-radix-CXYx3LLU.js";import{n as H,r as pe,t as me}from"./vendor-markdown-DMxglFrF.js";import{D as he,E as ge,O as _e,S as ve,a as ye,b as U,c as be,d as xe,f as Se,g as Ce,h as we,i as Te,l as Ee,m as De,n as Oe,o as ke,r as Ae,s as je,u as W,v as Me,x as G}from"./vendor-tanstack-ZnWhYpCU.js";import{$ as Ne,$n as Pe,A as Fe,Ac as Ie,As as Le,At as Re,Bc as ze,Bn as Be,Bs as Ve,Cc as He,Cn as Ue,Ds as K,Dt as We,En as Ge,Es as Ke,F as qe,Fn as Je,Fo as Ye,Fs as Xe,Gc as Ze,Hn as Qe,Hs as $e,Ht as et,Ic as tt,In as nt,Io as rt,Is as it,It as at,Jc as ot,Jn as st,K as ct,Kc as lt,Kn as ut,L as dt,Ln as ft,Lo as pt,Lt as mt,M as ht,Mc as gt,Mn as _t,Ms as vt,N as yt,Nc as bt,Nn as xt,No as St,Ns as Ct,Nt as wt,O as Tt,Os as Et,Ot as Dt,Pn as Ot,Po as kt,Ps as At,Pt as jt,Q as Mt,Qn as Nt,Qs as Pt,Rn as Ft,S as It,Sc as q,Tc as Lt,Vn as Rt,Vs as zt,Vt as Bt,Wn as Vt,X as Ht,Xc as Ut,Xn as Wt,Xs as Gt,Xt as Kt,Yn as qt,Zc as Jt,Zn as Yt,_c as Xt,_l as Zt,_n as Qt,a as $t,al as en,an as tn,as as nn,at as rn,b as an,bc as on,bt as sn,cn,ct as ln,d as un,dl as dn,dn as fn,do as pn,el as mn,er as hn,f as gn,fl as _n,fn as vn,fo as yn,ft as bn,gc as xn,gl as Sn,gn as Cn,go as wn,hl as Tn,ho as En,ht as Dn,i as On,il as kn,in as An,is as jn,it as Mn,j as Nn,jc as Pn,jo as Fn,js as In,jt as Ln,k as Rn,kn as zn,ks as Bn,kt as Vn,ll as Hn,ln as Un,ls as Wn,lt as Gn,mc as Kn,ml as qn,mn as Jn,mo as Yn,mt as Xn,n as Zn,no as Qn,nr as $n,nt as er,o as tr,on as nr,os as rr,ot as ir,pc as ar,pl as or,pn as sr,po as cr,pt as lr,qc as ur,qn as dr,qs as fr,r as J,rc as pr,rn as mr,rt as hr,sl as gr,sn as _r,st as vr,t as yr,tn as br,tr as xr,tt as Sr,ul as Cr,ut as wr,vc as Tr,vn as Er,wc as Dr,wn as Or,x as kr,xc as Y,xt as X,yc as Ar,yt as jr,z as Mr,zc as Nr,zn as Pr,zs as Fr,zt as Ir}from"./ToneBadge-CvjNM6Ls.js";import{a as Lr,c as Rr,i as zr,n as Br,o as Vr,r as Hr,s as Ur,t as Wr}from"./preload-helper-CkO9IcjS.js";import{D as Gr,F as Kr,I as qr,L as Jr,O as Yr,k as Xr,v as Zr,w as Qr}from"./ChartPrimitives-0854i4GX.js";import{n as $r,r as ei,t as ti}from"./account-context-DBJg_gVV.js";import{t as ni}from"./async-handler-Bj3TnIRw.js";import{a as ri,c as ii,d as ai,f as oi,i as si,l as ci,m as li,o as ui,p as di,r as fi}from"./query-client-BuEx84KK.js";import{Cn as pi,Dn as mi,En as hi,Ft as gi,Gt as _i,It as vi,Kt as yi,Lt as bi,On as xi,Pt as Si,Sn as Ci,Tn as wi,Un as Ti,Ut as Ei,Wt as Di,Yn as Oi,a as ki,bn as Ai,c as ji,cn as Mi,i as Ni,ln as Pi,o as Fi,s as Ii,u as Li,wn as Ri,xn as zi}from"./react-query-DF9z4xIx.js";import{E as Bi,_ as Vi,n as Hi,t as Ui}from"./AccessControls-B1v2FZPP.js";import{t as Wi}from"./InfoTooltip-Dm4gYO4N.js";import{i as Gi,n as Ki,r as qi,t as Ji}from"./card-WjxG7OUP.js";import{t as Yi}from"./vendor-yaml-Y43rmNgW.js";import{t as Xi}from"./extract-error-message-C1RkZ7dQ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Zi=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Qi=t(((e,t)=>{t.exports=Zi()})),$i=t((e=>{var t=Qi(),n=M(),r=fe();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),j=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),L=Symbol.for(`react.memo`),ee=Symbol.for(`react.lazy`),R=Symbol.for(`react.activity`),te=Symbol.for(`react.legacy_hidden`),z=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.for(`react.view_transition`),re=Symbol.for(`react.recoverable`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Symbol.for(`react.client.reference`);function se(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case R:return`Activity`;case ne:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case N:return e.displayName||`Context`;case j:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case L:return t=e.displayName||null,t===null?se(e.type)||`Memo`:t;case ee:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var ce=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function H(e){return{current:e}}function pe(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function me(e,t){de++,ue[de]=e.current,e.current=t}var he=H(null),ge=H(null),_e=H(null),ve=H(null);function ye(e,t){switch(me(_e,t),me(ge,e),me(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(he),me(he,e)}function U(){pe(he),pe(ge),pe(_e)}function be(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,me(ve,e)),t=he.current;var n=dp(t,e.type);t!==n&&(me(ge,e),me(he,n))}function xe(e){ge.current===e&&(pe(he),pe(ge)),ve.current===e&&(pe(ve),sh._currentValue=le)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -40,4 +40,4 @@ spec:
40
40
  `)),pt(!0)),z(!0))},[F.queriesText,x,M,u,te,E,pt,ft]),(0,Z.useEffect)(()=>{te&&(h({flowVersion:1,onboardingSessionId:p,event:`onboarding.started`,step:hn(M),resumed:!!g},`onboarding.started`),!g&&M>0&&h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`system`,method:`automatic`},`onboarding.step_completed:system`))},[h,M,p,te,g]),(0,Z.useEffect)(()=>{u||Wt(c)&&ct&&h({flowVersion:1,onboardingSessionId:p,event:`onboarding.blocked`,step:`system`,action:ct===`no_provider`?`configure_provider`:`continue`,reasonCode:ct},`onboarding.blocked:system:${ct}`)},[h,c,u,p,ct]);let mt=Ze.data?.status,ht=Ze.data?.snapshots?.length??0,gt=I===4&&Le&&!!(mt&&mm(mt,ht)),_t=T&&!Le;(0,Z.useEffect)(()=>{if(!Le||!mt)return;let e=Ie.current;if(!e||e!==K)return;if(mm(mt,ht)){h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`run`,method:`automatic`,countBucket:cr(ht)},`onboarding.step_completed:run:${e}`),Yt(e);return}let t=mt===`cancelled`?`run_cancelled`:mt===`failed`||(mt===`completed`||mt===`partial`)&&ht===0?`run_failed`:void 0;t&&(h({flowVersion:1,onboardingSessionId:p,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:t},`onboarding.blocked:run:${e}:${t}`),Yt(e))},[h,K,p,mt,ht,Le]);let vt=async()=>{if(it&&se){ve(!0),he(null);try{let e=await Fe(it,{displayName:ae||re,canonicalDomain:se,country:B,language:le,autoExtractBacklinks:de});pe(it),A.setEngineProject(e),ai({title:`Project created`,detail:`${e.displayName||e.name} is ready for setup.`,tone:`positive`,dedupeKey:`project:create:${e.name}`,dedupeMode:`drop`}),await r(),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),L(2)}catch(e){he(e instanceof Error?e.message:`Failed to create project`),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:`project_create_failed`},`onboarding.blocked:project:project_create_failed`)}finally{ve(!1)}}},yt=async()=>{if(!H)return;let e=at;if(e.length!==0){ke(!0),De(null);try{await br(H,e),Te(!0),await r(),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`competitors`,method:`manual`,countBucket:cr(e.length)},`onboarding.step_completed:competitors`),L(4)}catch(e){De(e instanceof Error?e.message:`Failed to save competitors`),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.blocked`,step:`competitors`,action:`save`,reasonCode:`unknown`},`onboarding.blocked:competitors:save`)}finally{ke(!1)}}},bt=async()=>{let e=Qe.trim();if(e){tt(!0),rt(null);try{await xt(`gemini`,{apiKey:e}),ai({title:`Gemini configured`,detail:`Connection saved. Your first check will verify it.`,tone:`positive`,dedupeKey:`setup:gemini:configured`,dedupeMode:`drop`}),$e(``),await r(),be.setSelectedProvider(o.providerStatuses.find(e=>e.name.toLowerCase()===`gemini`)?.name??`gemini`),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`system`,method:`inline`},`onboarding.step_completed:system`)}catch(e){rt(e instanceof Error?e.message:`Failed to save Gemini key`),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.blocked`,step:`system`,action:`configure_provider`,reasonCode:`provider_save_failed`},`onboarding.blocked:system:provider_save_failed`)}finally{tt(!1)}}},St=async()=>{if(Re()||qe.isError||qe.isFetching||qe.data?.canStart!==!0)return;if(!H||dt){Ue(dt??`Complete setup before launching the first check.`);let e=ct??(H?ot===0?`no_queries`:`run_rejected`:`unknown`);A.usesProjectProviderReadiness||h({flowVersion:1,onboardingSessionId:p,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:cr(A.runnableProviderCount),queryCountBucket:cr(ot),reasonCode:e});return}Ve(!0),Ue(null);let e=qe.data.requestCount;try{let t=await Ge.mutateAsync({projectName:H,projectLabel:ae||re||H,sourceAction:`setup-launch`});Xe({runId:t.id,requestCount:e}),We(t.id),ze(!0),Nt(H,t.id,Y[`answer-visibility`]),Ie.current=t.id,A.usesProjectProviderReadiness||h({flowVersion:1,onboardingSessionId:p,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:cr(A.runnableProviderCount),queryCountBucket:cr(ot)}),await r()}catch(e){Ue(e instanceof Error?e.message:`Failed to queue the AI Visibility check. Retry when the instance is ready.`),A.usesProjectProviderReadiness||h({flowVersion:1,onboardingSessionId:p,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:cr(A.runnableProviderCount),queryCountBucket:cr(ot),reasonCode:Pe(e,`run_rejected`)})}finally{Ve(!1)}},Ct=()=>L(e=>u?2:Math.max(0,e-1)),wt=(e,t,n)=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:e,method:`existing`,...n===void 0?{}:{countBucket:cr(n)}},`onboarding.step_completed:${e}`),L(t)},Tt=()=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`queries`,method:`skipped`,countBucket:`0`},`onboarding.step_completed:queries`),u?U():L(3)},Et=()=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`competitors`,method:`skipped`,countBucket:`0`},`onboarding.step_completed:competitors`),L(4)},Dt=u?`section`:Ji,Ot=u?ye:Ct,kt=u&&I===2||I===4&&(A.showProviderConfig||A.providerReadiness!==!0)?(0,Q.jsx)(Ip,{engines:A,headingLevel:`h2`,separated:!0}):null,At=(()=>{switch(I){case 0:return(0,Q.jsxs)(Ji,{className:`surface-card step-card`,children:[(0,Q.jsx)(`div`,{className:`section-head`,children:(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`h2`,{children:`System check`})})}),(0,Q.jsx)(`p`,{className:`supporting-copy`,children:`Checking that your Canonry instance is configured and reachable.`}),(0,Q.jsx)(`div`,{className:`compact-stack`,children:l.healthChecks.map(e=>(0,Q.jsxs)(`div`,{className:`health-check-row`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`run-row-title`,children:e.label}),(0,Q.jsx)(`p`,{className:`supporting-copy`,children:e.id===`provider`&&A.openRouterConnected?`OpenRouter connected. Choose models before your first check.`:e.detail}),e.id===`provider`&&e.state!==`ready`&&(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-13 text-secondary`,children:[`Connect Gemini with a key from`,` `,(0,Q.jsx)(`a`,{href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noreferrer`,className:`text-positive-400 hover:text-positive underline underline-offset-2`,children:`aistudio.google.com`}),`.`]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`password`,"aria-label":`Gemini API key`,autoComplete:`new-password`,value:Qe,onChange:e=>$e(e.target.value),placeholder:`AI… (paste here)`,className:`flex-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-14-mono text-heading placeholder:text-faint focus:border-mono-600 focus:outline-none`,disabled:et}),(0,Q.jsx)(J,{type:`button`,size:`sm`,disabled:et||!Qe.trim(),onClick:ni(bt),children:et?`Saving…`:`Save`})]}),nt&&(0,Q.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-label-12 text-negative`,children:[(0,Q.jsx)(`p`,{children:nt}),(0,Q.jsx)(`p`,{children:`Check that the key is complete, then retry Save.`})]}),(0,Q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Connect more answer engines later in`,` `,(0,Q.jsx)(W,{to:`/settings`,className:`text-link hover:underline`,children:`Settings`}),`.`]}),o.providerStatuses.some(e=>e.name===`openrouter`)&&(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-label-14 text-link`,children:`Connect OpenRouter`}),(0,Q.jsx)(Cp,{providerName:`openrouter`,compact:!0,keyUrl:o.providerStatuses.find(e=>e.name===`openrouter`)?.keyUrl,onSaved:()=>{r()}})]})]})]}),(0,Q.jsx)(yr,{tone:e.state===`ready`?e.id===`provider`?A.connectionStatus.tone:`positive`:`caution`,title:e.id===`api`?Hd(c.apiStatus):e.id===`worker`?Hd(c.workerStatus):e.detail,children:e.state===`ready`?e.id===`provider`?A.connectionStatus.label:`Ready`:`Attention`})]},e.id))}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[l.launchState.blockedReason?(0,Q.jsx)(`p`,{role:`status`,className:`supporting-copy text-negative`,children:l.launchState.blockedReason}):(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,disabled:!j,title:l.launchState.blockedReason,onClick:()=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`system`,method:`automatic`},`onboarding.step_completed:system`),L(N)},children:`Continue`})]})]});case 1:return(0,Q.jsxs)(Ji,{className:`surface-card step-card`,children:[(0,Q.jsxs)(`div`,{className:`section-head`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`h2`,{children:`Create project`})}),H?(0,Q.jsx)(yr,{tone:`positive`,children:`Created`}):null]}),H?(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsxs)(`p`,{className:`text-neutral`,children:[`Project `,(0,Q.jsx)(`span`,{className:`text-heading text-label-14-strong`,children:H}),` created successfully.`]}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:Ct,children:`Back`}),(0,Q.jsx)(J,{type:`button`,onClick:()=>wt(`project`,2),children:`Continue`})]})]}):(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsxs)(`div`,{className:`setup-field`,children:[(0,Q.jsx)(`label`,{className:`setup-label`,htmlFor:`project-name`,children:`Project name`}),(0,Q.jsx)(`input`,{id:`project-name`,className:`setup-input`,type:`text`,placeholder:`my-website`,value:re,onChange:e=>ie(e.target.value)}),it&&it!==re?(0,Q.jsxs)(`p`,{className:`supporting-copy`,children:[`Slug: `,it]}):null]}),(0,Q.jsxs)(`div`,{className:`setup-field`,children:[(0,Q.jsx)(`label`,{className:`setup-label`,htmlFor:`display-name`,children:`Display name (optional)`}),(0,Q.jsx)(`input`,{id:`display-name`,className:`setup-input`,type:`text`,placeholder:`My Website`,value:ae,onChange:e=>oe(e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`setup-field`,children:[(0,Q.jsx)(`label`,{className:`setup-label`,htmlFor:`domain`,children:`Canonical domain`}),(0,Q.jsx)(`input`,{id:`domain`,className:`setup-input`,type:`text`,placeholder:`example.com`,value:se,onChange:e=>ce(e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`setup-field-row`,children:[(0,Q.jsxs)(`div`,{className:`setup-field`,children:[(0,Q.jsx)(`label`,{className:`setup-label`,htmlFor:`country`,children:`Country`}),(0,Q.jsx)(`input`,{id:`country`,className:`setup-input`,type:`text`,placeholder:`US`,maxLength:2,value:B,onChange:e=>V(e.target.value.toUpperCase())})]}),(0,Q.jsxs)(`div`,{className:`setup-field`,children:[(0,Q.jsx)(`label`,{className:`setup-label`,htmlFor:`language`,children:`Language`}),(0,Q.jsx)(`input`,{id:`language`,className:`setup-input`,type:`text`,placeholder:`en`,maxLength:5,value:le,onChange:e=>ue(e.target.value.toLowerCase())})]})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-2 text-label-14 text-link`,children:`Backlink tracking`}),(0,Q.jsxs)(`label`,{className:`flex items-start gap-3 py-3 cursor-pointer`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 h-4 w-4 rounded border-strong bg-bg`,checked:de,onChange:e=>fe(e.target.checked)}),(0,Q.jsxs)(`span`,{className:`flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-label-14 text-heading`,children:`Auto-extract backlinks`}),(0,Q.jsxs)(`span`,{className:`block text-label-12 text-muted mt-0.5`,children:[`When a new Common Crawl release syncs, automatically extract backlinks for this project.`,` `,(0,Q.jsx)(W,{to:`/backlinks`,className:`text-positive-400 hover:text-positive underline underline-offset-2`,children:`Manage backlinks`})]})]})]})]}),me?(0,Q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:me}):null,(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:Ct,children:`Back`}),(0,Q.jsx)(J,{type:`button`,disabled:!it||!se||ge,onClick:ni(vt),children:ge?`Creating…`:`Create project`})]})]})]});case 2:return(0,Q.jsx)(Dt,{className:u?`visibility-setup-section step-card`:`surface-card step-card`,"aria-labelledby":`setup-queries-heading`,children:(0,Q.jsx)(Hp,{queries:be,headingLevel:`h2`,loading:ne,loadFailed:b.isError,onRetryLoad:()=>{b.refetch()},onBack:Ot,skipAction:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:Tt,children:u?`Finish without AI Visibility`:`Skip for now`}),saveVariant:A.providerFormVisible?`secondary`:`default`})});case 3:return(0,Q.jsxs)(Ji,{className:`surface-card step-card`,children:[(0,Q.jsxs)(`div`,{className:`section-head`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`h2`,{children:`Add competitors`})}),we?(0,Q.jsx)(yr,{tone:`positive`,children:`Saved`}):null]}),(0,Q.jsx)(`p`,{className:`supporting-copy`,children:`Optional. Domains that compete for the same queries, one per line. You can add them later from the project.`}),we?(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsx)(`ul`,{className:`detail-list`,children:at.map(e=>(0,Q.jsx)(`li`,{children:e},e))}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:Ct,children:`Back`}),(0,Q.jsx)(J,{type:`button`,onClick:()=>wt(`competitors`,4,at.length),children:`Continue`})]})]}):(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsxs)(`div`,{className:`setup-field`,children:[(0,Q.jsx)(`label`,{className:`setup-label`,htmlFor:`competitors`,children:`Competitor domains (one per line)`}),(0,Q.jsx)(`textarea`,{id:`competitors`,className:`setup-textarea text-copy-14`,rows:4,placeholder:`competitor1.com
41
41
  competitor2.com`,value:Se,onChange:e=>Ce(e.target.value)})]}),Ee?(0,Q.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:Ee}):null,(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:Ct,children:`Back`}),(0,Q.jsx)(`div`,{className:`flex gap-2`,children:at.length===0?(0,Q.jsx)(J,{type:`button`,onClick:Et,children:`Continue without competitors`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:Et,children:`Skip`}),(0,Q.jsx)(J,{type:`button`,disabled:Oe,onClick:ni(yt),children:Oe?`Saving…`:`Save ${at.length} competitor${at.length===1?``:`s`}`})]})})]})]})]});case 4:{let e=Ze.data,t=Le&&!e&&!!K,n=e?.status??(K===w?.id?w.status:void 0),r=n===`completed`||n===`partial`||n===`failed`||n===`cancelled`,i=e?.snapshots??[],a=e?.plannedAnswers??(e&&Ye?.runId===e.id?Ye.requestCount:null),o=Of(i,e=>x.find(t=>t.id===e)?.queryClass),c=ae||H||`your brand`,l=n?mm(n,i.length):!1,d=He??(e?.error?Kr(e.error):n===`cancelled`?`The check was cancelled before it produced a baseline.`:(n===`completed`||n===`partial`)&&i.length===0?`The check finished without saving any engine results.`:w?.statusDetail||`The check did not produce a baseline.`),f=null;return _t||l?f=(0,Q.jsx)(yr,{tone:`positive`,children:`Complete`}):He&&!Le?f=(0,Q.jsx)(yr,{tone:`negative`,children:`Failed`}):t?f=(0,Q.jsx)(yr,{tone:`neutral`,children:Ze.isError?`Unavailable`:`Loading`}):r?f=(0,Q.jsx)(yr,{tone:`negative`,children:n===`cancelled`?`Cancelled`:`Failed`}):Le&&(f=(0,Q.jsx)(yr,{tone:`caution`,children:n===q.queued?`Queued`:`Running`})),(0,Q.jsxs)(Ji,{className:`surface-card step-card`,children:[(0,Q.jsxs)(`div`,{className:`section-head`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`h2`,{children:l?`Saved answers`:Re()?`AI Visibility`:Le?`Your first AI Visibility check`:`Run your first AI Visibility check`}),l||Re()?null:(0,Q.jsx)(Wi,{text:Rp(c,Je)})]})}),f]}),_t?(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsxs)(`p`,{className:`text-secondary`,children:[(0,Q.jsx)(`span`,{className:`text-strong text-label-14-strong`,children:H}),` has saved AI Visibility results.`]}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,onClick:()=>U(),children:`Open project dashboard →`})]})]}):!Le&&Re()?(0,Q.jsx)(Vp,{projectName:H,error:He,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,onClick:()=>U(),children:`Open project dashboard →`})]})}):Le?t?(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsx)(`p`,{role:Ze.isError?`alert`:`status`,className:`text-copy-14 text-secondary`,children:Ze.isError?`Could not load the saved check. Try again to see its result.`:`Loading saved check…`}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>U(),children:`Open project dashboard →`}),Ze.isError?(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>{Ze.refetch()},children:`Retry status check`}):null]})]}):r?l?(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[(0,Q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:ae||H}),` · `,i.length,` `,i.length===1?`answer`:`answers`]}),(0,Q.jsx)(Mf,{byClass:e?.queryCountsByClass,pooled:e?.queryCounts}),o?(0,Q.jsx)(`section`,{className:`mt-3 border-t border-default pt-4`,"aria-label":`Your first saved answer`,children:(0,Q.jsx)(Nf,{answer:o})}):null,H?(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-2 text-label-14 text-link`,children:`More setup options`}),(0,Q.jsx)(Tf,{projectName:H})]}):null,(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,onClick:()=>U(),children:`Open project dashboard →`})]})]}):(0,Q.jsxs)(`div`,{className:`compact-stack`,children:[(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,Q.jsx)(`p`,{children:d}),(0,Q.jsx)(`p`,{className:`mt-1 text-copy-13 text-secondary`,children:Re()?Lc:s?`Review the connection, then retry.`:`Ask an administrator to review the provider and query configuration.`})]}),qe.isError&&!Re()?(0,Q.jsx)(Cf,{preview:qe.data,pending:qe.isFetching,failed:!0,onRetry:()=>{qe.refetch()}}):null,(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[s&&!Re()?(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:A.repairConnection,children:`Repair connection`}):(0,Q.jsx)(`span`,{}),Re()||!s?(0,Q.jsx)(J,{type:`button`,onClick:()=>U(),children:`Open project dashboard →`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>U(),children:`Open project dashboard →`}),(0,Q.jsx)(J,{type:`button`,disabled:Be||!!dt||qe.isError||qe.isFetching||qe.data?.canStart!==!0,onClick:ni(St),children:Be?`Retrying…`:`Retry check`})]})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsx)(Ef,{label:`AI Visibility check progress`,noun:`check`,phase:e?.startedAt?`Asking engines`:`Waiting to start`,count:e?a!==null&&i.length<=a?`${i.length} of ${a} ${a===1?`answer`:`answers`} saved`:`${i.length} ${i.length===1?`answer`:`answers`} saved`:null,done:e?i.length:null,total:a,startedAt:e?.startedAt,queuedAt:e?.createdAt}),Object.entries(e?.providerFailures??{}).map(([e,t])=>(0,Q.jsxs)(`div`,{role:`status`,className:`rounded-md border border-caution px-3 py-2`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-14 text-primary`,children:[Bi(e),`: `,t.failedQueries,` `,t.failedQueries===1?`query`:`queries`,` failed`,t.stopped?`, so this check stopped asking it`:``,`.`]}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:t.message})]})]},e)),Ze.isError&&(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,Q.jsx)(`p`,{children:Ze.error instanceof Error?Ze.error.message:`Could not refresh the check status.`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>{Ze.refetch()},children:`Retry status check`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>U(),children:`Open project dashboard →`})})]}):(0,Q.jsx)(Bp,{preview:qe,details:[{label:`Website`,value:se},{label:`Market`,value:Gt(B,le)}],queries:x,usesAccount:Je,alert:He??dt??null,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:Ct,children:`Back`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:U,children:`Finish without running`}),ct===`no_provider`&&!u?(0,Q.jsx)(J,{type:`button`,onClick:()=>A.setShowProviderConfig(!0),children:`Connect an AI engine`}):(0,Q.jsx)(J,{type:`button`,disabled:Be||!!dt||qe.isError||qe.isFetching||qe.data?.canStart!==!0,title:dt,onClick:ni(St),children:Be?`Starting…`:He?`Retry check`:`Run check`})]})})]})}default:return null}})(),jt=u?pm:fm,Mt=I===4&&(gt||_t)?jt.length:u?+(I===4):I,Pt=I===4&&!Le?(0,Q.jsx)(Lp,{engines:A}):null;return(0,Q.jsxs)(`div`,{className:u?`page-container visibility-setup`:`page-container`,children:[(0,Q.jsxs)(`div`,{className:`page-header`,children:[(0,Q.jsxs)(`div`,{className:`page-header-left`,children:[(0,Q.jsx)(`h1`,{ref:i?a:void 0,tabIndex:i?-1:void 0,className:`page-title outline-none`,children:gt?`Your first AI Visibility result`:i?`Set up AI Visibility`:`Setup`}),!gt&&!(I===4&&Le)?(0,Q.jsx)(`p`,{className:`page-subtitle`,children:i?I===4?`Review the queries and engines for your first check.`:A.providerReadiness===!0?`Choose the queries you want to track.`:`Connect an AI engine and add the queries you want to track.`:`Create a project and run its first AI Visibility check.`}):null]}),!gt&&I!==4?(0,Q.jsx)(`div`,{className:`page-header-right`,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!y&&!b.isSuccess||ge||be.saving||Oe||Be,onClick:Ae,children:`Reset unsaved fields`})}):null]}),(0,Q.jsx)(vm,{current:Mt,labels:jt}),(0,Q.jsxs)(`section`,{className:`setup-wizard`,children:[kt,Pt,(0,Q.jsx)(`div`,{ref:ee,children:At})]}),A.providerGuard.dialog]})}var Sm=[{id:`engine`,label:`AI engine`},{id:`queries`,label:`Queries`},{id:`first-check`,label:`First check`}];function Cm({current:e,done:t,hasBaseline:r}){return(0,Q.jsx)(`ol`,{"aria-label":`AI Visibility steps`,className:`mb-4 flex flex-wrap items-center gap-x-2 gap-y-1 text-label-14 text-secondary`,children:Sm.map((i,a)=>{let o=i.id===e,s=!o&&t[i.id];return(0,Q.jsxs)(`li`,{"aria-current":o?`step`:void 0,className:o?`inline-flex items-center gap-1.5 text-heading`:`inline-flex items-center gap-1.5`,children:[a>0?(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,s?(0,Q.jsx)(n,{className:`size-3.5 text-positive`,"aria-hidden":`true`}):(0,Q.jsx)(`span`,{className:`tabular-nums`,"aria-hidden":`true`,children:a+1}),i.id===`first-check`&&r?`Check`:i.label,s?(0,Q.jsx)(`span`,{className:`sr-only`,children:`, done`}):null]},i.id)})})}function wm(e){let t=Vs(),{isAdmin:n}=ei(),r=G({...Ai({client:X}),enabled:!t}),i=G({...hi({client:X}),enabled:!t&&n}),a=(0,Z.useMemo)(()=>zs(i.data??null),[i.data]),{refetch:o}=r,{refetch:s}=i;return{project:t?t.dashboard.projects.find(t=>t.project.name===e)?.project??null:r.data?.find(t=>t.name===e)??null,settings:t?.dashboard.settings??a,loading:!t&&(r.isPending||n&&i.isPending),failed:!t&&r.isError,refresh:async()=>{await Promise.all([o(),...n?[s()]:[]])}}}function Tm({projectName:e,initialStep:t,hasBaseline:n=!1,onClose:r,onLaunched:i}){let a=wm(e);return a.loading?(0,Q.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading AI engines and queries…`}):a.project?(0,Q.jsx)(Em,{project:a.project,settings:a.settings,refresh:a.refresh,initialStep:t,hasBaseline:n,onClose:r,onLaunched:i},e):(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-caution px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-copy-14 text-primary`,children:a.failed?`Canonry could not load the project list.`:(0,Q.jsxs)(Q.Fragment,{children:[`Canonry could not find `,e,` in the project list.`]})}),(0,Q.jsx)(J,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-2`,onClick:()=>{a.refresh()},children:`Retry`})]})}function Em({project:e,settings:t,refresh:n,initialStep:r,hasBaseline:i,onClose:a,onLaunched:o}){let s=e.name,c=xe(),l=_e(),u=rf(`wizard`),d=G({queryKey:om(s),queryFn:()=>Ne(s)}),f=d.data,p=f?.length??0,m=(f??[]).map(e=>e.query).join(`
42
42
  `),h=`wizard:${s}`,[g]=(0,Z.useState)(()=>ef(h)),[_,v]=(0,Z.useState)(r),[y,b]=(0,Z.useState)(!d.isPending),x=Up({settings:t,project:e,projectScoped:!0,refresh:n}),S=dm({projectName:s,initialText:g.queriesText??m,initialSaved:g.queriesText===void 0&&p>0,generateProviders:x.runnableApiProviders,research:{projectName:s,domain:e.canonicalDomain},telemetry:u,refreshAfterSave:e=>sm(l,e),onContinue:()=>v(`first-check`)}),{setText:C,setSaved:w}=S;(0,Z.useEffect)(()=>{y||d.isPending||(f&&f.length>0&&g.queriesText===void 0&&(C(f.map(e=>e.query).join(`
43
- `)),w(!0)),b(!0))},[g.queriesText,y,f,d.isPending,w,C]),(0,Z.useEffect)(()=>{y&&tf(h,{...!S.saved&&S.text!==m?{queriesText:S.text}:{},...g.competitorsText===void 0?{}:{competitorsText:g.competitorsText}})},[g.competitorsText,h,S.saved,S.text,y,m]);let{emit:T,onboardingSessionId:E}=u;(0,Z.useEffect)(()=>{y&&T({flowVersion:1,onboardingSessionId:E,event:`onboarding.started`,step:r===`first-check`?`run`:`queries`,resumed:!0},`onboarding.started`)},[T,r,E,y]);let D=(0,Z.useRef)(null),O=(0,Z.useRef)(_);(0,Z.useEffect)(()=>{if(O.current===_)return;O.current=_;let e=D.current?.querySelector(`h2, h3`);e&&(e.tabIndex=-1,e.focus())},[_]);let k=(0,Z.useRef)(null),A=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>{if(!A.current)return;let e=document.activeElement;if(e&&e!==document.body){A.current=!1;return}let t=k.current?.querySelector(`h3`);t&&(A.current=!1,t.tabIndex=-1,t.focus())});let j=Re(),M=_===`first-check`&&!j,N=Vs(),P=Zs(!N&&M,N?.health,!0).data??N?.health??Bd,F=bf(s,M),I=zp(F.data),{systemBlockReason:L,blockedReason:ee}=Wp(P,t,x),R=ee??(d.isSuccess&&p===0?`Add at least one query before launching the first check.`:void 0),te=$p(),[z,ne]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),ae=e.displayName||s,oe=async()=>{if(!j&&!(F.isError||F.isFetching||F.data?.canStart!==!0)){if(R)ie(R),x.usesProjectProviderReadiness||T({flowVersion:1,onboardingSessionId:E,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:cr(x.runnableProviderCount),queryCountBucket:cr(p),reasonCode:L??(p===0?`no_queries`:`run_rejected`)});else{ne(!0),ie(null);try{let e=await te.mutateAsync({projectName:s,projectLabel:ae,sourceAction:`setup-launch`,suppressQueuedToast:!0});Nt(s,e.id,Y[`answer-visibility`]),o(e.id),x.usesProjectProviderReadiness||T({flowVersion:1,onboardingSessionId:E,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:cr(x.runnableProviderCount),queryCountBucket:cr(p)})}catch(e){ie(e instanceof Error?e.message:`Failed to queue the AI Visibility check. Retry when the instance is ready.`),x.usesProjectProviderReadiness||T({flowVersion:1,onboardingSessionId:E,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:cr(x.runnableProviderCount),queryCountBucket:cr(p),reasonCode:Pe(e,`run_rejected`)})}finally{ne(!1)}}}},se=x.isAdmin&&(x.providerFormVisible||x.inlineModelPicker),ce=x.providerReadiness===!1&&!re;return(0,Q.jsxs)(`div`,{ref:k,children:[(0,Q.jsx)(Cm,{current:_,done:{engine:x.providerReadiness===!0,queries:p>0,"first-check":!1},hasBaseline:i}),(0,Q.jsx)(`div`,{ref:D,children:_===`engine`?(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsx)(Ip,{engines:x,headingLevel:`h3`}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>x.providerGuard.request(a),children:`Back`}),(0,Q.jsx)(J,{type:`button`,variant:se?`secondary`:`default`,onClick:()=>x.providerGuard.request(()=>{x.closeProviderForm(),v(`queries`)}),children:`Continue`})]})]}):_===`queries`?(0,Q.jsx)(`div`,{className:`space-y-3`,"aria-labelledby":`setup-queries-heading`,children:(0,Q.jsx)(Hp,{queries:S,headingLevel:`h3`,loading:d.isPending||!y,loadFailed:d.isError,onRetryLoad:()=>{d.refetch()},onBack:()=>v(`engine`),note:(0,Q.jsxs)(`p`,{className:`text-copy-13 text-secondary`,children:[`Queries naming `,ae,` are branded. Results keep branded and non-brand queries apart.`]}),saveVariant:`default`})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Lp,{engines:x}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`div`,{className:`section-head`,children:(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-heading-16 text-heading`,children:j?`AI Visibility`:i?`Run an AI Visibility check`:`Run your first AI Visibility check`}),j?null:(0,Q.jsx)(Wi,{text:Rp(ae,I)})]})})}),j?(0,Q.jsx)(Vp,{projectName:s,error:re,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,onClick:()=>{c({to:`/projects/$projectName`,params:{projectName:s},replace:!0})},children:`Open project dashboard →`})]})}):(0,Q.jsx)(Bp,{preview:F,details:[{label:`Website`,value:e.canonicalDomain},{label:`Market`,value:Gt(e.country,e.language)}],queries:f??[],usesAccount:I,alert:ce?null:re??R??null,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>v(`queries`),children:`Back`}),ce?(0,Q.jsx)(J,{type:`button`,onClick:()=>v(`engine`),children:`Connect an AI engine`}):(0,Q.jsx)(J,{type:`button`,disabled:z||!!R||F.isError||F.isFetching||F.data?.canStart!==!0,title:R,onClick:ni(oe),children:z?`Starting…`:re?`Retry check`:i?`Run check`:`Run first check`})]})})]})]})}),x.providerGuard.dialog]})}var Dm=`Public pages only, read by this Canonry server and stored with this project. The first scan reads up to 100 pages, then stops.`,Om=Xt.enum;function km(e){return e===K.queued||e===K.running}function Am(e){return e===K.not_started||e===K.cancelled||e===K.failed}function jm(e,t,n){return`${e} ${e===1?t:n}`}function Mm({projectName:e,firstRun:t,track:n}){let r=xe(),i=_e(),{canWrite:a,isAdmin:o}=ei(),s=G({...Mi({client:X,path:{name:e}}),retry:!1,refetchInterval:({state:e})=>{let t=e.data;return t&&(km(t.tracks.agentReadiness.state)||km(t.tracks.aiVisibility.state))?3e3:!t?.complete&&15e3}}),c=G({...gi({client:X,path:{name:e}}),retry:!1}),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(!1),h=s.data?.tracks.aiVisibility;(0,Z.useEffect)(()=>{h&&(km(h.state)?(m.current=!0,u(null)):n===`ai-visibility`&&!m.current&&(m.current=!0,u(Vm(h.blockedBy))))},[n,h]);let g=()=>i.invalidateQueries({queryKey:Pi({client:X,path:{name:e}})}),_=Nm(e,s.data);Pm(s.data);let v=s.isSuccess;(0,Z.useEffect)(()=>{v&&p.current?.focus({preventScroll:!0})},[v]);let y=e=>{r({to:`/setup`,search:t=>({...t,track:e}),replace:!0})},b=e=>{u(e),y(`ai-visibility`)},x=()=>{u(null),y(void 0)};if(s.isPending)return(0,Q.jsx)(Im,{});if(s.isError){let n=Xi(s.error).code===`NOT_FOUND`;return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:t?`Set up Canonry`:`Project setup`}),(0,Q.jsxs)(`div`,{role:`alert`,className:`mt-6 rounded-md border border-negative bg-negative-soft p-4`,children:[(0,Q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:n?`No project named ${e}.`:`Setup status could not be loaded.`}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:n?(0,Q.jsx)(J,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,Q.jsx)(W,{to:`/projects`,children:`View projects`})}):(0,Q.jsx)(J,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{s.refetch()},children:`Retry`})})]})]})}let S=s.data,C=c.data,w=S.project.displayName||S.project.name,T=Jt(S.project.canonicalDomain),E=C?Gt(C.country,C.language):null,D=S.tracks.agentReadiness,O=S.tracks.aiVisibility,k=d!==null&&O.runId===d.listedRunId&&O.runId!==d.runId,A=a&&l!==null&&!km(O.state),j=A||!a?null:Am(D.state)?`agent-readiness`:Am(O.state)&&!k?`ai-visibility`:null;return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{ref:p,tabIndex:-1,className:`text-heading-24 text-heading outline-none`,children:t?`Set up Canonry`:`Project setup`}),(0,Q.jsxs)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:[S.complete?`Setup complete · `:null,w,` · `,T]})]}),(0,Q.jsx)(J,{asChild:!0,variant:S.complete?`default`:`ghost`,className:`shrink-0`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open project`,S.complete?null:(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})]})})]}),(0,Q.jsxs)(lf,{label:`Setup progress`,children:[(0,Q.jsx)(uf,{id:`setup-website`,title:`Website`,mark:`done`,summary:E?`${T} · ${E}`:T,trailing:a?(0,Q.jsxs)(W,{className:`shrink-0 text-label-14 text-secondary underline underline-offset-4 hover:text-primary`,to:`/projects/$projectName/settings`,params:{projectName:e},children:[`Edit`,(0,Q.jsx)(`span`,{className:`sr-only`,children:` website`})]}):null}),(0,Q.jsx)(Bm,{projectName:e,projectId:C?.id??null,brand:w,track:D,primary:j===`agent-readiness`,canWrite:a,onStarted:async e=>{_(e,Y[`site-audit`]),await g()},onCancelled:g}),(0,Q.jsx)(Um,{projectName:e,brand:w,domain:T,track:O,panelStep:A?l:null,onOpenPanel:b,onClosePanel:x,starting:k,onLaunched:e=>{_(e,Y[`answer-visibility`]),f({runId:e,listedRunId:O.runId}),x(),g()},onCancelled:g,primary:j===`ai-visibility`,canWrite:a,isAdmin:o})]}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:Lm(D)}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:Rm(O,k?K.queued:O.state)}),S.complete?(0,Q.jsx)(Tf,{projectName:e}):null]})}function Nm(e,t){let{emit:n,onboardingSessionId:r}=rf(`site_health`),{emit:i,onboardingSessionId:a}=rf(`wizard`),o=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{let t=$n(e);t?.kind&&o.current.set(t.runId,t.kind)},[e]),(0,Z.useEffect)(()=>{if(!t)return;let e=[{...t.tracks.agentReadiness,kind:Y[`site-audit`],answers:null},{...t.tracks.aiVisibility,kind:Y[`answer-visibility`],answers:t.tracks.aiVisibility.result?.answers??null}];for(let{runId:t,state:s,kind:c,answers:l}of e){if(!t||o.current.get(t)!==c)continue;let e=c===Y[`site-audit`]?{emit:n,onboardingSessionId:r}:{emit:i,onboardingSessionId:a},u=(s===K.completed||s===K.partial)&&l!==0,d=s===K.cancelled?`run_cancelled`:s===K.failed||(s===K.completed||s===K.partial)&&l===0?`run_failed`:null;if(u)e.emit({flowVersion:1,onboardingSessionId:e.onboardingSessionId,event:`onboarding.step_completed`,step:`run`,method:`automatic`,...l===null?{}:{countBucket:cr(l)}},`onboarding.step_completed:run:${t}`);else if(d)e.emit({flowVersion:1,onboardingSessionId:e.onboardingSessionId,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:d},`onboarding.blocked:run:${t}:${d}`);else continue;o.current.delete(t),Yt(t)}},[a,i,n,r,t]),(t,i)=>{o.current.set(t,i),i===Y[`site-audit`]&&(Nt(e,t,i),n({flowVersion:1,onboardingSessionId:r,event:`onboarding.started`,step:`run`,resumed:!1},`onboarding.started:${t}`))}}function Pm(e){let t=_e(),n=e?.tracks.agentReadiness.state,r=e?.tracks.aiVisibility.state,i=(0,Z.useRef)({});(0,Z.useEffect)(()=>{let e=i.current;i.current={scan:n,check:r};let a=(e,t)=>e!==void 0&&t!==void 0&&km(e)&&!km(t);(a(e.scan,n)||a(e.check,r))&&t.invalidateQueries({queryKey:wi({client:X})})},[n,r,t])}function Fm({runIds:e,noun:t,note:n,onCancelled:r}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=Me({...Ti({client:X}),meta:{skipGlobalErrorToast:!0}}),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),d=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{d.current&&(d.current=!1,(i?u:l).current?.focus())},[i]);let f=e=>{d.current=!0,s(null),a(e)},p=async()=>{if(c.isPending)return;s(null);let n=(await Promise.allSettled(e.map(e=>c.mutateAsync({path:{id:e}})))).find(e=>e.status===`rejected`&&Xi(e.reason).code!==`RUN_NOT_CANCELLABLE`);n&&s(`The ${t} could not be stopped. ${mn(n.reason)}`),await r()};return i?(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Stop the ${t}`,className:`flex flex-wrap items-center justify-end gap-x-3 gap-y-2`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Stop the `,t,`? `,n]}),(0,Q.jsxs)(`div`,{className:`flex gap-2 max-sm:w-full max-sm:[&>*]:flex-1`,children:[(0,Q.jsx)(J,{ref:u,type:`button`,variant:`ghost`,"aria-disabled":c.isPending||void 0,onClick:()=>{c.isPending||f(!1)},children:`Keep running`}),(0,Q.jsx)(J,{type:`button`,variant:`secondary`,"aria-disabled":c.isPending||void 0,onClick:()=>{p()},children:c.isPending?`Stopping…`:`Stop ${t}`})]}),o?(0,Q.jsx)(`p`,{role:`alert`,className:`w-full text-right text-copy-14 text-negative`,children:o}):null]}):(0,Q.jsxs)(J,{ref:l,type:`button`,variant:`ghost`,"data-focus-skip":!0,onClick:()=>f(!0),children:[`Cancel `,t]})}function Im(){return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,children:[(0,Q.jsx)(`div`,{className:`skeleton-text h-6 w-40`}),(0,Q.jsx)(`div`,{className:`skeleton-text-sm mt-2 w-56`}),(0,Q.jsx)(`div`,{className:`material-base mt-6 space-y-6 p-5`,children:[1,2,3].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`skeleton-text w-32`}),(0,Q.jsx)(`div`,{className:`skeleton-text-sm w-64`})]}),(0,Q.jsx)(`div`,{className:`skeleton h-5 w-20 rounded-md`})]},e))})]})}function Lm(e){switch(e.state){case K.not_started:return``;case K.queued:return`Agent Readiness audit scan queued.`;case K.running:return`Agent Readiness audit scan running.`;case K.completed:case K.partial:{let t=e.state===K.partial?`Agent Readiness audit scan stopped partway.`:`Agent Readiness audit scan complete.`,n=e.result?.score??null;return[n===null?t:`${t} Score ${Math.round(n)} of 100.`,...Et(e)].join(` `)}case K.failed:return e.error?`Agent Readiness audit scan failed. ${e.error}`:`Agent Readiness audit scan failed.`;case K.cancelled:return`Agent Readiness audit scan cancelled.`;default:return e.state}}function Rm(e,t){switch(t){case K.not_started:return``;case K.queued:return`AI Visibility check queued.`;case K.running:return`AI Visibility check running.`;case K.completed:case K.partial:{let n=t===K.partial?`AI Visibility check stopped partway.`:`AI Visibility check complete.`,r=e.result;return r?`${n} ${jm(r.answers,`answer`,`answers`)} from ${jm(r.engines,`engine`,`engines`)}.`:n}case K.failed:return`AI Visibility check failed.`;case K.cancelled:return`AI Visibility check cancelled.`;default:return t}}function zm(e){let t=e.progress;if(!t)return{phase:e.state===K.queued?`Waiting to start`:`Starting the scan`,count:null,done:null,total:null};switch(t.phase){case Om.queued:return{phase:`Waiting to start`,count:null,done:null,total:null};case Om.discovering:return{phase:`Finding pages`,count:t.pagesFound===null?null:`${t.pagesFound} found`,done:null,total:null};case Om.checking:{let e=t.pagesFound,n=t.pageLimit;return e!==null&&(n===null||e<n)?{phase:`Checking pages`,count:`${t.pagesChecked} of ${e}`,done:t.pagesChecked,total:e}:{phase:`Checking pages`,count:n===null?`${t.pagesChecked} checked`:`${t.pagesChecked} of up to ${n}`,done:t.pagesChecked,total:n}}case Om[`arranging-map`]:return{phase:`Building the score`,count:jm(t.pagesChecked,`page checked`,`pages checked`),done:null,total:null};case Om.completed:case Om.partial:case Om.failed:case Om.cancelled:return{phase:`Finishing`,count:null,done:null,total:null};default:return t.phase}}function Bm({projectName:e,projectId:t,brand:n,track:r,primary:i,canWrite:a,onStarted:o,onCancelled:s}){let c=tm(),{onboardingSessionId:l,emit:u}=rf(`platform`),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(!1),h=r.state,g=async()=>{if(t&&!p){f(null),m(!0);try{let r=await c.mutateAsync({projectName:e,projectId:t,projectLabel:n,suppressErrorToast:!0,suppressQueuedToast:!0,body:{checkDeadLinks:!0,maxPages:100,sites:[]}});u({flowVersion:1,onboardingSessionId:l,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`}),await o(r.runId)}catch(e){f(`The audit scan could not start. ${mn(e)}`),u({flowVersion:1,onboardingSessionId:l,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:Pe(e,`run_rejected`)})}finally{m(!1)}}},_=e=>a?(0,Q.jsx)(J,{type:`button`,variant:i?`default`:`secondary`,disabled:!t,"aria-disabled":p||void 0,className:p?`opacity-50`:void 0,onClick:()=>{g()},children:p?`Starting…`:e}):null,v=null,y=null,b=null;switch(h){case K.not_started:case K.cancelled:v=(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1.5`,children:[h===K.cancelled?`The last scan was cancelled. `:null,`Reads up to `,100,` public pages. No AI engine needed.`,(0,Q.jsx)(Wi,{text:Dm})]}),b=_(h===K.cancelled?`Run audit scan again`:`Run audit scan`);break;case K.queued:case K.running:{let e=zm(r),t=r.progress;y=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ef,{label:`Agent Readiness audit scan progress`,noun:`scan`,phase:e.phase,count:e.count,done:e.done,total:e.total,startedAt:r.startedAt}),t?(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Scan details`}),(0,Q.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-4`,children:[[`Pages found`,t.pagesFound],[`Pages checked`,t.pagesChecked],[`Links found`,t.linksFound],[`Pages failed`,t.pagesFailed]].map(([e,t])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:e}),(0,Q.jsx)(`dd`,{className:`text-label-14-strong tabular-nums text-heading`,children:t===null?`Unavailable`:t.toLocaleString()})]},e))})]}):null]}),b=a&&r.runId?(0,Q.jsx)(Fm,{runIds:[r.runId],noun:`scan`,note:`It saves no score.`,onCancelled:s},r.runId):null;break}case K.completed:case K.partial:{let t=r.result;v=Et(r).join(` `)||null,y=t?(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`text-heading-20 tabular-nums text-heading`,children:t.score===null?`–`:Math.round(t.score)}),(0,Q.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[t.score===null?`Score unavailable`:h===K.partial?`of 100 so far`:`of 100`,` · `,jm(t.pagesScored,`page scored`,`pages scored`)]})]}):(0,Q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`The scan finished.`}),b=(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName/agent-readiness`,params:{projectName:e},search:{siteHealthRunId:r.runId??void 0},children:[`Open Agent Readiness`,(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})]})});break}case K.failed:v=(0,Q.jsx)(`span`,{className:`whitespace-pre-line`,children:`The scan did not finish.${r.error?` ${r.error}`:``}`}),b=_(`Run audit scan again`);break;default:return h}return(0,Q.jsxs)(uf,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:sf(h),summary:v,trailing:(0,Q.jsx)(of,{state:h}),action:b,children:[y,d?(0,Q.jsx)(`p`,{role:`alert`,className:`${y?`mt-3 `:``}text-copy-14 text-negative`,children:d}):null]})}function Vm(e){switch(e){case null:return`first-check`;case Ke.no_engine:case Ke.engines_failing:return`engine`;case Ke.no_queries:return`queries`;case Ke.plan_unpublished:return null;default:return e}}function Hm(e,t,n){let r=`Whether AI answers mention ${t} and cite ${n}.`,i=e.baselineRunId===null;switch(e.blockedBy){case Ke.no_engine:return{line:`${r} Needs an AI engine.`,action:`Connect an AI engine`,step:`engine`};case Ke.no_queries:return{line:`${r} Add queries to check.`,action:`Add queries`,step:`queries`};case Ke.plan_unpublished:return{line:`Publish the measurement plan before the ${i?`first`:`next`} check.`,action:`Open measurement plan`,step:`plan`};case Ke.engines_failing:return{line:`${r} The AI engine connection needs attention.`,action:`Repair connection`,step:`engine`};case null:{let t=e.engines.length;return{line:`Asks ${jm(t,`engine`,`engines`)} your ${jm(e.queries.total,`query`,`queries`)}.`,action:i?`Review first check`:`Review check`,step:`first-check`}}default:return e.blockedBy}}function Um({projectName:e,brand:t,domain:n,track:r,panelStep:i,onOpenPanel:a,onClosePanel:o,onLaunched:s,onCancelled:c,starting:l,primary:u,canWrite:d,isAdmin:f}){let p=l?K.queued:r.state,m=u?`default`:`secondary`;if(i!==null)return(0,Q.jsx)(uf,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:sf(p),trailing:(0,Q.jsx)(of,{state:p}),childrenManageFocus:!0,children:(0,Q.jsx)(Tm,{projectName:e,initialStep:i,hasBaseline:r.baselineRunId!==null,onClose:o,onLaunched:s})});let h=null,g=null,_=null;switch(p){case K.not_started:case K.cancelled:{let i=Hm(r,t,n);if(h=p===K.cancelled?`The last check was cancelled. ${i.line}`:i.line,d){let t=i.step;_=t===`plan`?(0,Q.jsx)(J,{asChild:!0,variant:m,children:(0,Q.jsx)(W,{to:`/projects/$projectName/portfolio`,params:{projectName:e},children:i.action})}):(0,Q.jsx)(J,{type:`button`,variant:m,onClick:()=>a(t),children:i.action})}break}case K.queued:case K.running:{let e=r.progress,t=e?e.answersPlanned!==null&&e.answersSaved<=e.answersPlanned?`${e.answersSaved} of ${jm(e.answersPlanned,`answer`,`answers`)} saved`:`${jm(e.answersSaved,`answer`,`answers`)} saved`:null;g=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ef,{label:`AI Visibility check progress`,noun:`check`,phase:p===K.queued?`Waiting to start`:`Asking engines`,count:t,done:e?.answersSaved??null,total:e?.answersPlanned??null,startedAt:r.startedAt}),Object.entries(r.providerFailures??{}).map(([e,t])=>(0,Q.jsxs)(`div`,{role:`status`,className:`mt-3 rounded-md border border-caution px-3 py-2`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-14 text-primary`,children:[Bi(e),`: `,jm(t.failedQueries,`query`,`queries`),` failed`,t.stopped?`, so this check stopped asking it`:``,`.`]}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:t.message})]})]},e)),(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Check details`}),(0,Q.jsxs)(`dl`,{className:`mt-2 grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Engines`}),(0,Q.jsx)(`dd`,{className:`text-label-14 text-heading`,children:r.engines.length>0?r.engines.map(e=>Bi(e)).join(`, `):`Unavailable`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Queries`}),(0,Q.jsxs)(`dd`,{className:`text-label-14 tabular-nums text-heading`,children:[jm(r.queries.nonBrand,`non-brand`,`non-brand`),` · `,jm(r.queries.branded,`branded`,`branded`)]})]})]})]})]}),_=d&&!l&&r.runId?(0,Q.jsx)(Fm,{runIds:r.runIds,noun:`check`,note:r.baselineRunId===null?`It saves no baseline.`:`Earlier results stay as they are.`,onCancelled:c},r.runId):null;break}case K.completed:case K.partial:{let t=r.result,n=r.runId!==null&&r.runId===r.baselineRunId;h=t?`${p===K.partial?`Partial results`:n?`Baseline`:`Latest check`} · ${jm(t.answers,`answer`,`answers`)} from ${jm(t.engines,`engine`,`engines`)}${r.finishedAt?` · ${Yr(r.finishedAt)}`:``}`:`The check finished.`,g=t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Mf,{byClass:t.queryCountsByClass,pooled:t.queryCounts,caption:n?void 0:`Latest AI Visibility check by query class`}),n?(0,Q.jsx)(`p`,{className:`mt-3 text-copy-13 text-secondary`,children:`Later checks are compared with this baseline.`}):null,r.runId?(0,Q.jsx)(Wm,{runId:r.runId,projectName:e}):null]}):null,_=(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open AI Visibility`,(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})]})});break}case K.failed:{h=r.baselineRunId===null?`The check did not finish. No baseline was saved.`:`The check did not finish. Earlier results are unchanged.`;let e=f?null:(0,Q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Ask an administrator to check the AI engine connection.`}),t=r.failedEngines??[];g=t.length>0?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[t.map(e=>{let t=Bi(e.provider),n=bt(e.code,Bi(dn(e.provider)));return(0,Q.jsx)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-copy-14 text-primary`,children:n}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Q.jsxs)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:[t,`: `,e.message]})]})]}):(0,Q.jsxs)(`p`,{className:`break-words text-copy-14 text-primary`,children:[t,`: `,e.message]})},e.provider)}),e]}):r.error?(0,Q.jsxs)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`break-words text-copy-14 text-primary`,children:r.error}),e?(0,Q.jsx)(`div`,{className:`mt-1`,children:e}):null]}):null,d&&(_=(0,Q.jsxs)(Q.Fragment,{children:[f?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>a(`engine`),children:`Change AI engines`}):null,(0,Q.jsx)(J,{type:`button`,variant:m,onClick:()=>a(`first-check`),children:`Run check again`})]}));break}default:return p}return(0,Q.jsx)(uf,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:sf(p),summary:h,trailing:(0,Q.jsx)(of,{state:p}),action:_,children:g})}function Wm({runId:e,projectName:t}){let[n,r]=(0,Z.useState)(!1),i=G({...pi({client:X,path:{id:e}}),enabled:n}),a=G({...vi({client:X,path:{name:t}}),enabled:n}),o=i.data?Of(i.data.snapshots??[],e=>a.data?.find(t=>t.id===e)?.queryClass):void 0;return(0,Q.jsxs)(`details`,{className:`mt-3`,onToggle:e=>r(e.currentTarget.open),children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-link`,children:`Example answer`}),(0,Q.jsx)(`div`,{className:`mt-3 border-t border-default pt-4`,children:i.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading the answer…`}):i.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`The answer could not be loaded.`}):o?(0,Q.jsx)(Nf,{answer:o}):(0,Q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`This check saved no answer text.`})})]})}var Gm=`pointer-coarse:min-h-11 max-md:min-h-11`,Km=`setup-input h-10 w-full max-md:text-label-16 ${Gm}`,qm=[{value:`US`,label:`United States`},{value:`CA`,label:`Canada`},{value:`GB`,label:`United Kingdom`},{value:`AU`,label:`Australia`},{value:`NZ`,label:`New Zealand`},{value:`IE`,label:`Ireland`},{value:`DE`,label:`Germany`},{value:`FR`,label:`France`},{value:`ES`,label:`Spain`},{value:`IT`,label:`Italy`},{value:`NL`,label:`Netherlands`},{value:`BR`,label:`Brazil`},{value:`MX`,label:`Mexico`},{value:`IN`,label:`India`},{value:`SG`,label:`Singapore`},{value:`JP`,label:`Japan`}],Jm=[{value:`en`,label:`English`},{value:`es`,label:`Spanish`},{value:`fr`,label:`French`},{value:`de`,label:`German`},{value:`it`,label:`Italian`},{value:`pt`,label:`Portuguese`},{value:`nl`,label:`Dutch`},{value:`ja`,label:`Japanese`}];function Ym(e,t){let n=e.trim().toUpperCase(),r=t.trim().toLowerCase();return{countryValid:qm.some(e=>e.value===n),languageValid:Jm.some(e=>e.value===r)}}function Xm(e){let t=e.replace(/^\[|\]$/g,``);return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes(`:`)}function Zm(e){let t=e.trim();if(!t)return null;let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`https://${t}`,r;try{r=new URL(n)}catch{return null}if(r.protocol!==`http:`&&r.protocol!==`https:`)return null;let i=r.hostname.toLowerCase().replace(/^www\./,``);if(!i||i===`localhost`||Xm(i)||!i.includes(`.`))return null;let a=zt(i);return a?{canonicalDomain:i,projectName:a,displayName:$e(i)}:null}function Qm(e,t){return e instanceof tr&&e.statusCode===409?`A project with this name already exists. Change the project name, or open the existing project.`:e instanceof Error&&e.message?e.message:t}function $m(){return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,Q.jsx)(`div`,{className:`page-header`,children:(0,Q.jsxs)(`div`,{className:`page-header-left`,children:[(0,Q.jsx)(`h1`,{className:`page-title`,children:`Preparing setup`}),(0,Q.jsx)(`p`,{className:`page-subtitle`,children:`Checking the projects already on this install.`})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 material-base p-4 text-label-14 text-secondary`,role:`status`,children:[(0,Q.jsx)(o,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading projects…`]})]})}function eh({onRetry:e}){return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsx)(`div`,{className:`page-header`,children:(0,Q.jsxs)(`div`,{className:`page-header-left`,children:[(0,Q.jsx)(`h1`,{className:`page-title`,children:`Can’t load projects`}),(0,Q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not confirm whether this install already has a project.`})]})}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,Q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Setup is paused to protect existing projects.`}),(0,Q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,Q.jsx)(J,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:e,children:`Retry project check`})]})]})}function th(){let e=Se({from:`/setup`});if(e.experience===`legacy`||e.experience!==`platform`&&Xn()===`legacy`)return(0,Q.jsx)(ym,{visibilityProjectName:e.setupProject??e.project});let t=e.project??e.setupProject;if(t){let n=e.track??(e.onboarding===`site-health`?`agent-readiness`:void 0);return(0,Q.jsx)(Mm,{projectName:t,firstRun:e.onboarding!==void 0,track:n},t)}let n=e.experience===`platform`;return(0,Q.jsx)(nh,{addProject:n},n?`add-project`:`entry`)}function nh({addProject:e}){let t=xe(),n=G({...Ai({client:X}),retry:!1,refetchOnMount:`always`}),r=n.isSuccess&&n.isFetchedAfterMount,i=!e&&r&&n.data.length===1?n.data[0]:void 0,a=G({...Mi({client:X,path:{name:i?.name??``}}),enabled:i!==void 0,retry:!1}),[o,s]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(o||!r)return;let t=n.data;if(e||t.length===0)s({firstRun:t.length===0});else if(i){if(a.isPending)return;s(a.data?.complete===!0?{addProject:!0}:{redirectTo:i.name})}else s({addProject:!0})},[e,o,r,i,a.data,a.isPending,n.data]),(0,Z.useEffect)(()=>{o&&(`redirectTo`in o?t({to:`/setup`,search:{project:o.redirectTo,onboarding:`first-run`},replace:!0}):`addProject`in o&&t({to:`/setup`,search:{experience:`platform`},replace:!0}))},[o,t]),!o&&n.isError?(0,Q.jsx)(eh,{onRetry:()=>{n.refetch()}}):!o||`redirectTo`in o||`addProject`in o?(0,Q.jsx)($m,{}):(0,Q.jsx)(rh,{firstRun:o.firstRun})}function rh({firstRun:e}){return(0,Q.jsx)(Ui,{title:e?`Set up Canonry`:`Add a project`,children:(0,Q.jsx)(ih,{firstRun:e})})}function ih({firstRun:e}){let t=xe(),n=_e(),r=e&&sn(),i=G({...mi({client:X}),enabled:r,retry:!1}),a=Me(Oi()),[s]=(0,Z.useState)(()=>ef(`platform`)),[c,l]=(0,Z.useState)(s.domain??``),[u,d]=(0,Z.useState)(s.projectName??``),[f,p]=(0,Z.useState)(s.displayName??``),[m,g]=(0,Z.useState)(s.country??`US`),[_,v]=(0,Z.useState)(s.language??`en`),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),D=G({...Ai({client:X}),enabled:T!==null,retry:!1}),O=T===null?null:D.data?.find(e=>zt(e.name)===T)?.name??T,k=!r||i.isError?void 0:i.data,A=typeof k?.enabled==`boolean`?k.enabled:null,j=a.isPending?a.variables.body.enabled:A,[M,N]=(0,Z.useState)(null),P=(0,Z.useRef)(null),I=(0,Z.useRef)(null),L=(0,Z.useRef)(null),{onboardingSessionId:ee,emit:R}=rf(`platform`);(0,Z.useEffect)(()=>{R({flowVersion:1,onboardingSessionId:ee,event:`onboarding.started`,step:`project`,resumed:!1},`onboarding.started`)},[R,ee]),(0,Z.useEffect)(()=>{tf(`platform`,{domain:c,projectName:u,displayName:f,country:m,language:_})},[c,u,f,m,_]);let te=()=>{nf(`platform`),l(``),d(``),p(``),g(`US`),v(`en`),w(null),E(null)},z=Zm(c),ne=u.trim()||z?.projectName||``,re=f.trim()||z?.displayName||``,ie=Gt(m,_),{countryValid:ae,languageValid:oe}=Ym(m,_),se=ae&&oe,ce=!!(c||u||f||m!==`US`||_!==`en`),B=!!(c&&!z&&x);(0,Z.useEffect)(()=>{C&&(T!==null&&L.current?(I.current&&(I.current.open=!0),L.current.focus()):P.current?.focus())},[T,C]);let V=async r=>{if(r.preventDefault(),S(!0),z&&se&&!y){b(!0),w(null),E(null);try{let r=await Rn({name:ne,displayName:re,canonicalDomain:z.canonicalDomain,country:m,language:_});nf(`platform`),R({flowVersion:1,onboardingSessionId:ee,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),await n.invalidateQueries({queryKey:zi({client:X})}),await t({to:`/setup`,search:{project:r.name,...e?{onboarding:`first-run`}:{}},replace:!0})}catch(e){b(!1);let t=e instanceof tr&&e.statusCode===409;E(t?zt(ne):null),w(Qm(e,`Could not create the project. Try again.`)),R({flowVersion:1,onboardingSessionId:ee,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:Pe(e,`project_create_failed`)},`onboarding.blocked:project`),t&&n.invalidateQueries({queryKey:zi({client:X})})}}},le=async e=>{N(null);try{let t=await a.mutateAsync({client:X,body:{enabled:e}});n.setQueryData(xi({client:X}),t),t.enabled!==e&&N(`The server kept telemetry ${t.enabled?`on`:`off`}. Check its telemetry settings.`)}catch{N(`Could not update telemetry. Try again.`)}};return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:e?`Set up Canonry`:`Add a project`}),e?(0,Q.jsx)(`p`,{className:`mt-1 max-w-prose text-copy-14 text-secondary`,children:`Add your first website to get its Agent Readiness score and first AI Visibility result.`}):null]}),e?(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,className:`shrink-0`,children:(0,Q.jsxs)(W,{to:`/agent-setup`,children:[(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":`true`}),`Set up with an agent`]})}):null]}),(0,Q.jsxs)(lf,{label:`Setup progress`,children:[(0,Q.jsx)(uf,{id:`setup-website`,title:`Website`,mark:`idle`,trailing:(0,Q.jsx)(yr,{tone:`neutral`,className:`shrink-0`,children:`Required`}),children:(0,Q.jsxs)(`form`,{"aria-label":`Website`,className:`space-y-5`,onSubmit:ni(V),noValidate:!0,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-domain`,children:`Website URL`}),(0,Q.jsx)(`input`,{id:`launchpad-domain`,className:Km,type:`text`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`none`,spellCheck:!1,required:!0,"aria-invalid":B,"aria-describedby":B?`launchpad-domain-error`:void 0,placeholder:`https://example.com`,value:c,onBlur:()=>S(!0),onChange:e=>{l(e.target.value),w(null),E(null)}}),B?(0,Q.jsx)(`p`,{id:`launchpad-domain-error`,className:`text-copy-14 text-negative`,role:`alert`,children:`Enter a public domain, such as example.com.`}):null]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-display-name`,children:`Brand name`}),(0,Q.jsx)(`input`,{id:`launchpad-display-name`,className:Km,type:`text`,autoComplete:`organization`,"aria-describedby":`launchpad-display-name-hint`,placeholder:z?.displayName??`Your brand`,value:f,onChange:e=>p(e.target.value)}),(0,Q.jsx)(`p`,{id:`launchpad-display-name-hint`,className:`text-copy-13 text-secondary`,children:`Answers that name this brand count as mentions.`})]}),(0,Q.jsxs)(`details`,{ref:I,className:`group border-t border-default`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center justify-between gap-4 py-2 text-label-14 [&::-webkit-details-marker]:hidden ${Gm}`,children:[(0,Q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Project details`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-secondary`,children:[ie,(0,Q.jsx)(h,{className:`size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":`true`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-5 pb-4 pt-2`,children:[z?(0,Q.jsxs)(`div`,{className:`grid gap-2 sm:max-w-[50%]`,children:[(0,Q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-project-name`,children:`Project name`}),(0,Q.jsx)(`input`,{ref:L,id:`launchpad-project-name`,className:Km,type:`text`,placeholder:z.projectName,"aria-invalid":T!==null,"aria-describedby":T===null?void 0:`launchpad-create-error`,value:u,onChange:e=>{d(e.target.value),T!==null&&(E(null),w(null))}})]}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-country`,children:`Country`}),(0,Q.jsx)(`select`,{id:`launchpad-country`,className:Km,value:m,onChange:e=>g(e.target.value),children:qm.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-language`,children:`Language`}),(0,Q.jsx)(`select`,{id:`launchpad-language`,className:Km,value:_,onChange:e=>v(e.target.value),children:Jm.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]}),C?(0,Q.jsxs)(`div`,{ref:P,className:`rounded-md border border-negative bg-negative-soft p-3`,role:`alert`,tabIndex:-1,children:[(0,Q.jsx)(`p`,{id:`launchpad-create-error`,className:`text-copy-14-strong text-heading`,children:C}),O===null?null:(0,Q.jsx)(J,{asChild:!0,variant:`secondary`,size:`sm`,className:`mt-3`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName`,params:{projectName:O},children:[`Open `,O]})})]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-sm:[&>*]:w-full`,children:[ce?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,disabled:y,onClick:te,children:`Reset unsaved fields`}):null,e?null:(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,className:Gm,children:(0,Q.jsx)(W,{to:`/projects`,onClick:()=>nf(`platform`),children:`Cancel`})}),(0,Q.jsx)(J,{className:Gm,type:`submit`,disabled:!z||!se||y,children:y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` Creating project…`]}):`Continue`})]})]})}),(0,Q.jsx)(uf,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:`idle`,summary:`How well AI agents can read your site`,trailing:(0,Q.jsx)(of,{state:K.not_started})}),(0,Q.jsx)(uf,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:`idle`,summary:`Whether AI answers mention your brand and cite your site`,trailing:(0,Q.jsx)(of,{state:K.not_started})})]}),A===null?null:(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-default pt-5`,"aria-labelledby":`telemetry-title`,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-3 py-2 ${a.isPending?`cursor-wait`:`cursor-pointer`}`,children:[(0,Q.jsx)(`input`,{className:`mt-0.5 size-4 shrink-0 rounded border-strong bg-bg accent-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-mono-500 disabled:cursor-wait`,type:`checkbox`,checked:j??!1,disabled:a.isPending,onChange:e=>{le(e.target.checked)},"aria-describedby":`telemetry-detail`}),(0,Q.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,Q.jsx)(`span`,{id:`telemetry-title`,className:`text-label-14 text-heading`,children:`Share anonymous product telemetry`}),(0,Q.jsx)(`span`,{id:`telemetry-detail`,className:`max-w-[70ch] text-label-14 text-secondary`,children:`Helps prioritize improvements. Canonry does not send raw domains, URLs, queries, answer content, or credentials.`})]})]}),a.isPending?(0,Q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,role:`status`,children:`Saving preference…`}):null,M?(0,Q.jsx)(`p`,{className:`mt-1 text-copy-14 text-negative`,role:`alert`,children:M}):null]})]})}function ah(){return(0,Q.jsx)(`div`,{className:`page-container`,children:(0,Q.jsx)(`section`,{className:`page-section`,children:(0,Q.jsxs)(Ji,{className:`surface-card empty-card`,children:[(0,Q.jsx)(`h1`,{children:`Page not found`}),(0,Q.jsx)(`p`,{children:`This page may have moved. Choose a project to continue.`}),(0,Q.jsx)(J,{asChild:!0,children:(0,Q.jsx)(W,{to:`/projects`,children:`View projects`})})]})})})}var oh=je(()=>Wr(()=>import(`./ProjectPage-er2nBpgg.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url),`ProjectPage`),sh=je(()=>Wr(()=>import(`./RunsPage-wtzz8XIJ.js`),__vite__mapDeps([25,1,2,3,4,5,6,7,9,12,13,14,10,15,16,17,18]),import.meta.url),`RunsPage`),ch=je(()=>Wr(()=>import(`./HistoryPage-Bfn3nVjo.js`),__vite__mapDeps([26,4,1,2,20,5,6,3,7,13,15]),import.meta.url),`HistoryPage`),lh=je(()=>Wr(()=>import(`./SettingsPage-CVL6mVTM.js`),__vite__mapDeps([27,1,2,4,5,6,3,7,11,12,14,9,10,15]),import.meta.url),`SettingsPage`),uh=je(()=>Wr(()=>import(`./AgentSetupPage-BFXD__2X.js`),__vite__mapDeps([28,1,2,4,7,3,6,10,11]),import.meta.url),`AgentSetupPage`),dh=je(()=>Wr(()=>import(`./BacklinksPage-Bv12EM38.js`),__vite__mapDeps([29,1,2,4,7,3,6,11,15,19,17]),import.meta.url),`BacklinksPage`),fh=je(()=>Wr(()=>import(`./TrafficPage-drK_F4xY.js`),__vite__mapDeps([30,1,2,4,5,6,3,7,13,15,24,8,10,11,12,16,17,18,22]),import.meta.url),`TrafficPage`),ph=je(()=>Wr(()=>import(`./TrafficSourceDetailPage-BdvprrAg.js`),__vite__mapDeps([31,1,2,4,5,6,3,7,9,10,16,17,15,18,22,12,13,23]),import.meta.url),`TrafficSourceDetailPage`),mh=je(()=>Wr(()=>import(`./MeasurementPropertyPage-BuVvdugZ.js`),__vite__mapDeps([32,1,2,4,5,6,3,7,9,10,13,14,15,16,17,21]),import.meta.url),`MeasurementPropertyPage`);function hh(){return(0,Q.jsx)(ju,{children:(0,Q.jsx)(ga,{children:(0,Q.jsx)(Eu,{})})})}var gh=be()({component:hh,notFoundComponent:ah,validateSearch:e=>({manageQueries:e.manageQueries===!0||e.manageQueries===`true`||void 0,runId:typeof e.runId==`string`?e.runId:void 0,siteHealthRunId:typeof e.siteHealthRunId==`string`?e.siteHealthRunId:void 0,connectCloudRun:Fn.safeParse(e.connectCloudRun).data,seoProfileId:typeof e.seoProfileId==`string`?e.seoProfileId:void 0,seoRunId:typeof e.seoRunId==`string`?e.seoRunId:void 0,seoView:typeof e.seoView==`string`?e.seoView:void 0,seoTrendDays:jn.safeParse(typeof e.seoTrendDays==`string`?Number(e.seoTrendDays):e.seoTrendDays).data,seoTrendMetric:rr.safeParse(e.seoTrendMetric).data,seoTrendKeyword:nn.safeParse(e.seoTrendKeyword).data,seoRegion:typeof e.seoRegion==`string`&&e.seoRegion?e.seoRegion:void 0,seoMarket:typeof e.seoMarket==`string`&&e.seoMarket?e.seoMarket:void 0,seoShow:typeof e.seoShow==`string`&&e.seoShow?e.seoShow:void 0,seoSort:typeof e.seoSort==`string`&&e.seoSort?e.seoSort:void 0,seoQ:typeof e.seoQ==`string`&&e.seoQ?e.seoQ:void 0,evidenceId:typeof e.evidenceId==`string`?e.evidenceId:void 0,runStatus:typeof e.runStatus==`string`?e.runStatus:void 0,runKind:typeof e.runKind==`string`?e.runKind:void 0,runProject:typeof e.runProject==`string`?e.runProject:void 0,runWindow:typeof e.runWindow==`string`?e.runWindow:void 0,runQuery:typeof e.runQuery==`string`?e.runQuery:void 0,onboarding:e.onboarding===`site-health`||e.onboarding===`first-run`||e.onboarding===`complete`?e.onboarding:void 0,experience:e.experience===`legacy`||e.experience===`platform`?e.experience:void 0,siteScan:e.siteScan===`skip`||e.siteScan===`scan`?e.siteScan:void 0,skipped:e.skipped===`visibility`?`visibility`:void 0,setupProject:typeof e.setupProject==`string`?e.setupProject:void 0,project:typeof e.project==`string`&&e.project?e.project:void 0,track:e.track===`agent-readiness`||e.track===`ai-visibility`?e.track:void 0,scope:typeof e.scope==`string`?e.scope:void 0,class:typeof e.class==`string`?e.class:void 0,...Object.fromEntries([`queryWorkspace`,`researchMode`,`trackingQueryId`,`measurementScope`,`measurementScopeKey`,`measurementMarketKey`,`queryClass`,`measurementProvider`,`measurementModel`,`measurementLocation`,`measurementFrom`,`measurementTo`,`measurementRevision`,`measurementRunId`,`measurementQueryKey`,`measurementAnswer`,`journeyView`,`journeyDays`,`journeyVisitor`,`journeyEngine`,`journeyReturned`,`journeyOffset`,`agentHours`,`trafficSource`].map(t=>[t,typeof e[t]==`string`&&e[t]?e[t]:void 0]))})}),_h=Ee({getParentRoute:()=>gh,path:`/`,component:Yd,beforeLoad:async({context:e})=>{let t=e.queryClient.getQueryData(zi({client:X}));if(t===void 0)try{t=await e.queryClient.ensureQueryData(Ai({client:X}))}catch{return}if(t.length===0)throw Ce({to:`/setup`})}}),vh=Ee({getParentRoute:()=>gh,path:`/projects`,component:Zd}),yh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,bh=Ee({getParentRoute:()=>gh,path:`/projects/$projectName`,component:()=>(0,Q.jsx)(ke,{}),beforeLoad:async({context:e,params:t,location:n})=>{let r=t.projectName;if(!yh.test(r))return;let i=e.queryClient.getQueryData(zi({client:X}));if(!i)try{i=await e.queryClient.ensureQueryData(Ai({client:X}))}catch{return}let a=i.find(e=>e.id===r);if(a)throw Ce({to:n.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(a.name)}`),replace:!0})}}),xh=Ee({getParentRoute:()=>bh,path:`/`,component:()=>(0,Q.jsx)(oh,{tab:`overview`})}),Sh=Ee({getParentRoute:()=>bh,path:`/portfolio`,component:()=>(0,Q.jsx)(oh,{tab:`portfolio`})}),Ch=Ee({getParentRoute:()=>bh,path:`/search-console`,component:()=>(0,Q.jsx)(oh,{tab:`search-console`})}),wh=Ee({getParentRoute:()=>bh,path:`/seo-data`,component:()=>(0,Q.jsx)(oh,{tab:`seo-data`})}),Th=Ee({getParentRoute:()=>bh,path:`/journeys`,component:()=>(0,Q.jsx)(oh,{tab:`journeys`})}),Eh=Ee({getParentRoute:()=>bh,path:`/conversions`,component:()=>(0,Q.jsx)(oh,{tab:`conversions`})}),Dh=Ee({getParentRoute:()=>bh,path:`/local`,component:()=>(0,Q.jsx)(oh,{tab:`local`})}),Oh=Ee({getParentRoute:()=>bh,path:`/discovery`,component:()=>(0,Q.jsx)(oh,{tab:`discovery`})}),kh=Ee({getParentRoute:()=>bh,path:`/queries`,component:()=>(0,Q.jsx)(oh,{tab:`queries`})}),Ah=Ee({getParentRoute:()=>bh,path:`/client-queries`,component:()=>(0,Q.jsx)(oh,{tab:`client-queries`})}),jh=Ee({getParentRoute:()=>bh,path:`/properties/$targetKey`,component:()=>(0,Q.jsx)(mh,{})}),Mh=Ee({getParentRoute:()=>bh,path:`/report`,beforeLoad:({params:e})=>{throw Ce({to:`/projects/$projectName`,params:e,replace:!0})}}),Nh=Ee({getParentRoute:()=>bh,path:`/activity`,component:()=>(0,Q.jsx)(oh,{tab:`activity`})}),Ph=Ee({getParentRoute:()=>bh,path:`/traffic`,component:()=>(0,Q.jsx)(oh,{tab:`traffic`})}),Fh=Ee({getParentRoute:()=>bh,path:`/backlinks`,component:()=>(0,Q.jsx)(oh,{tab:`backlinks`})}),Ih=Ee({getParentRoute:()=>bh,path:`/agent-readiness`,component:()=>(0,Q.jsx)(oh,{tab:`agent-readiness`})}),Lh=Ee({getParentRoute:()=>bh,path:`/technical-aeo`,beforeLoad:({params:e,location:t})=>{throw Ce({to:`/projects/$projectName/agent-readiness`,params:e,search:t.search,hash:t.hash,replace:!0})}}),Rh=Ee({getParentRoute:()=>bh,path:`/history`,component:()=>(0,Q.jsx)(oh,{tab:`history`})}),zh=Ee({getParentRoute:()=>bh,path:`/settings`,component:()=>(0,Q.jsx)(oh,{tab:`settings`})}),Bh=Ee({getParentRoute:()=>gh,path:`/runs`,component:sh}),Vh=Ee({getParentRoute:()=>gh,path:`/history`,component:ch}),Hh=Ee({getParentRoute:()=>gh,path:`/settings`,component:lh,beforeLoad:({context:e})=>{}}),Uh=Ee({getParentRoute:()=>gh,path:`/setup`,component:th}),Wh=Ee({getParentRoute:()=>gh,path:`/agent-setup`,component:uh}),Gh=Ee({getParentRoute:()=>gh,path:`/backlinks`,component:dh}),Kh=Ee({getParentRoute:()=>gh,path:`/traffic`,component:fh}),qh=Ee({getParentRoute:()=>gh,path:`/traffic/$projectName/$sourceId`,component:ph}),Jh=gh.addChildren([_h,vh,bh.addChildren([xh,Sh,Ch,wh,Th,Eh,Dh,Oh,kh,Ah,jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh,zh]),Bh,Vh,Hh,Uh,Wh,Gh,Kh,qh]);function Yh(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:`/`}var Xh=Yh(),Zh=Xh===`/`?``:Xh.replace(/\/$/,``);function Qh(e,t){return ye({routeTree:Jh,basepath:Zh||`/`,context:{queryClient:e},...t?.initialEntries&&{history:we({initialEntries:t.initialEntries})}})}var $h=6e4,eg=6e4,tg=1e4,ng=3e4;function rg(){let e=!1,t=null,n,r=null,i=performance.now(),a=Date.now(),o=i,s=i,c=document.visibilityState===`visible`&&document.hasFocus(),l=0,u=()=>{let e=performance.now(),t=Date.now(),n=e-i;if(r&&c&&n>=0&&n<=ng&&t-a<=ng){let e=pn-r.foregroundMs,t=Math.min(n,e);r.foregroundMs+=t,r.activeMs+=Math.min(t,Math.max(0,o+$h-i))}i=e,a=t},d=(e=!1)=>{!r||!t||r.foregroundMs<1||(e||Math.floor(r.foregroundMs)!==l)&&(l=Math.floor(r.foregroundMs),s=i,Vt({event:`ui.page_time`,page:t,visitId:r.id,foregroundMs:l,activeMs:Math.floor(r.activeMs),completed:e}))},f=()=>{r={id:dr(),foregroundMs:0,activeMs:0},l=0,s=i,o=i},p=()=>{u();let e=document.visibilityState===`visible`&&document.hasFocus();c&&!e&&d(),!c&&e&&(o=i),c=e},m=()=>{u(),c&&(o=i)},h=()=>{u(),d(!0),r=null,c=!1},g=()=>{p(),t&&!r&&f()},_=window.setInterval(()=>{u(),i-s>=eg&&d()},tg),v=[`pointerdown`,`pointermove`,`keydown`,`scroll`,`touchstart`];for(let e of v)document.addEventListener(e,m,{passive:!0,capture:!0});return document.addEventListener(`visibilitychange`,p),window.addEventListener(`focus`,p),window.addEventListener(`blur`,p),window.addEventListener(`pagehide`,h),window.addEventListener(`pageshow`,g),{clear(){r=null,t=null,n=void 0},navigate(i,a){if(e)return;let o=yn(i);t===o&&n===a&&r||(u(),d(!0),t=o,n=a,c=document.visibilityState===`visible`&&document.hasFocus(),f())},stop(){e=!0,r=null,window.clearInterval(_);for(let e of v)document.removeEventListener(e,m,!0);document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`focus`,p),window.removeEventListener(`blur`,p),window.removeEventListener(`pagehide`,h),window.removeEventListener(`pageshow`,g)}}}var ig=!1,ag;async function og(e){return(await Qn({client:X,body:e,keepalive:!0})).data}function sg(){ig||typeof window>`u`||(ig=!0,!(Ln()||wt())&&(ag=rg(),nt({send:og,onDisabled:()=>ag?.stop()}),X.interceptors.request.use((e,t)=>{let n=t.fetch??globalThis.fetch,r=typeof t.url==`string`?t.url:void 0;return t.fetch=async(t,i)=>{try{return await n(t,i)}catch(t){throw t instanceof DOMException&&t.name===`AbortError`||ft({method:e.method,route:r,network:!0}),t}},e}),X.interceptors.response.use((e,t,n)=>(ft({method:t.method,route:typeof n.url==`string`?n.url:void 0,path:lg(t.url),status:e.status}),e)),window.addEventListener(`error`,e=>{Ft({kind:`unhandled`,error:e.error})}),window.addEventListener(`unhandledrejection`,e=>{Ft({kind:`unhandled`,error:e.reason})}),mg()))}function cg(e){let t=null,n=()=>{let n=e.state.matches.at(-1);if(!n)return;ag?.navigate(n.fullPath,e.state.location?.pathname),Rt(n.fullPath);let r=e.state.location;if(!r)return;let i=r.search&&typeof r.search==`object`?r.search:{};t&&t.pathname===r.pathname&&Pr(t.search,i),t={pathname:r.pathname,search:i}};n();let r=e.subscribe(`onResolved`,n);return()=>{r(),ag?.clear()}}function lg(e){try{return new URL(e,window.location.origin).pathname}catch{return}}var ug={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function dg(e,t){let[n,r]=ug[e];return t<=n?`good`:t<=r?`needs-improvement`:`poor`}function fg(){let e=0,t=0,n=-1/0,r=-1/0;return{add(i){i.hadRecentInput||(i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,e=Math.max(e,t))},value:()=>e}}function pg(){let e=0;return{add(t){t.interactionId&&(e=Math.max(e,t.duration))},value:()=>e}}function mg(){if(typeof PerformanceObserver>`u`)return;let e=new Set,t=(t,n)=>{!e.has(t)&&Number.isFinite(n)&&(e.add(t),Be(t,dg(t,n)))},n=(e,t,n={})=>{try{new PerformanceObserver(e=>t(e.getEntries())).observe({type:e,buffered:!0,...n})}catch{}};try{let e=performance.getEntriesByType(`navigation`)[0];e&&e.responseStart>0&&t(`TTFB`,e.responseStart)}catch{}n(`paint`,e=>{let n=e.find(e=>e.name===`first-contentful-paint`);n&&t(`FCP`,n.startTime)});let r=0;n(`largest-contentful-paint`,e=>{let t=e.at(-1);t&&(r=t.startTime)});let i=fg();n(`layout-shift`,e=>{for(let t of e)i.add({startTime:t.startTime,value:t.value??0,hadRecentInput:t.hadRecentInput===!0})});let a=pg();n(`event`,e=>{for(let t of e)a.add(t)},{durationThreshold:40});let o=()=>{r>0&&t(`LCP`,r),t(`CLS`,i.value()),a.value()>0&&t(`INP`,a.value())};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&o()}),window.addEventListener(`pagehide`,o)}var hg=6e4,gg=`Anyone with this password can sign in to this dashboard.`,_g={label:`Root API key`,help:`To create the password from here, enter the root API key (apiKey in config.yaml). It is used once and not saved.`,missing:`Enter the root API key.`,rejected:`That is not the root API key for this install.`,show:`Show passwords and key`},vg={id:`embed`,scopes:[`read`,`embed`],projectId:`embed`,readOnly:!0};function yg(){let e=(0,Z.useRef)(sn()).current,[t,n]=(0,Z.useState)(e?`ready`:`checking`),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(e),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(`password`),[C,w]=(0,Z.useState)(!1),[T]=(0,Z.useState)(()=>new URLSearchParams(window.location.search).get(`token`)),E=(0,Z.useRef)(!1),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1),[L,ee]=(0,Z.useState)(!1),[R]=(0,Z.useState)(()=>pa().error),te=(0,Z.useRef)(null),z=(0,Z.useRef)(null),ne=(0,Z.useRef)(null),re=()=>{let t=r?`${r.name}:${r.role}`:e?`api-key:explicit`:a?`api-key:${a.id}`:`no-accounts`;if(!te.current||ne.current!==t){z.current?.clear();let e=ii();z.current=e,te.current=Qh(e),ne.current=t}return{queryClient:z.current,router:te.current}},ie=t===`ready`?re().router:null;(0,Z.useEffect)(()=>{if(ie)return cg(ie)},[ie]);let ae=e=>e.authRequired?(u(!0),I(e.signInMethods?.chatgpt===!0),i(e.user),o(null),c(!1),n(e.user?`ready`:`account-login`),!0):!1;(0,Z.useEffect)(()=>{if(!T)return;let e=new URL(window.location.href);e.searchParams.delete(`token`),window.history.replaceState(null,``,e)},[]),(0,Z.useEffect)(()=>{let t=!1,r=async(e,r=!1)=>{try{let e=await ct();if(t)return;o(e),c(!1),n(`ready`)}catch(i){if(t)return;if(r&&i instanceof tr&&i.statusCode===401)return It().then(()=>{t||(A(null),o(null),c(!1),P(!0),n(`login`))}).catch(r=>{t||(A(r instanceof Error?r.message:`Could not clear the invalid session`),n(e))});A(i instanceof Error?i.message:`Could not verify API key access`),n(e)}};return e?(r(`api-key-error`),()=>{t=!0}):(Promise.allSettled([Mr(),ln()]).then(([e,i])=>{if(t||e.status===`fulfilled`&&ae(e.value))return;if(i.status===`rejected`){let e=i.reason;A(e instanceof Error?e.message:`Failed to reach the Canonry API`),n(`login`);return}let a=i.value;a.authenticated&&Ln()?(o(vg),c(!1),n(`ready`)):a.authenticated?(c(!0),r(`api-key-error`,!0)):a.setupRequired&&T&&!E.current?(E.current=!0,o(null),c(!1),oe(T)):(o(null),c(!1),n(a.setupRequired?`setup`:`login`))}),()=>{t=!0})},[]),(0,Z.useEffect)(()=>{if(t!==`ready`||e)return;let r=setInterval(()=>{l?Mr().then(e=>{e.authRequired&&!e.user&&(P(!0),i(null),o(null),n(`account-login`))}).catch(()=>{}):ln().then(e=>{e.authenticated||(P(!0),o(null),n(e.setupRequired?`setup`:`login`))}).catch(()=>{})},hg);return mr(()=>{P(!0),i(null),o(null),c(!1),n(l?`account-login`:`login`)}),()=>{clearInterval(r),mr(null)}},[t,l,e]);let oe=async e=>{let t=()=>{let e=new URL(window.location.href);e.searchParams.delete(`token`),window.history.replaceState(null,``,e)};try{if(!(await nr(e)).authenticated)throw Error(`Setup failed`);t(),P(!1),o(null),c(!0),n(`checking`);try{let e=await ct();o(e),c(!1),n(`ready`)}catch(e){A(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){t(),A(e instanceof tr&&e.statusCode===401?`This setup link has already been used or is no longer valid. Create a dashboard password to continue.`:e instanceof Error?e.message:`Setup failed`),o(null),c(!1),n(`setup`)}},se=async e=>{if(e.preventDefault(),!p.trim()||p.trim().length<8){A(`Password must be at least 8 characters`);return}if(p!==g){A(`Passwords do not match`);return}let t=D.trim();if(C&&!t)A(_g.missing);else{M(!0),A(null);try{if(!(await tn(p.trim(),C?t:void 0)).authenticated){A(`Setup failed`);return}m(``),_(``),O(``),w(!1),y(!1),P(!1),o(null),c(!0),n(`checking`);try{let e=await ct();o(e),c(!1),n(`ready`)}catch(e){A(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){if(e instanceof tr&&e.statusCode===401&&e.code===`AUTH_REQUIRED`){A(C?_g.rejected:null),w(!0);return}A(e instanceof tr||e instanceof Error?e.message:`Setup failed`)}finally{M(!1)}}},ce=e=>{m(e),A(null)},B=e=>{O(e),A(null)},V=e=>{_(e),A(null)},le=async e=>{if(e.preventDefault(),p.trim()){M(!0),A(null);try{if(!(x===`api-key`?await at(p.trim()):await mt(p.trim())).authenticated){A(x===`api-key`?`Invalid API key`:`Incorrect password`);return}let e=await ct();o(e),c(!1),m(``),y(!1),P(!1),n(`ready`)}catch(e){A(e instanceof tr||e instanceof Error?e.message:`Authentication failed`)}finally{M(!1)}}},ue=e=>{S(e),m(``),y(!1),A(null)},de=async e=>{if(e.preventDefault(),d.trim()&&p){M(!0),A(null);try{let e=await sr(d.trim(),p);if(!e.user){A(`Incorrect name or password.`);return}m(``),P(!1),i(e.user),o(null),c(!1),n(`ready`)}catch(e){A(e instanceof tr?e.message:`Incorrect name or password.`)}finally{M(!1)}}};if(t===`ready`){let{queryClient:e,router:t}=re();return(0,Q.jsx)(ti,{account:r,apiKey:a,apiKeyPending:s,children:(0,Q.jsx)(he,{client:e,children:(0,Q.jsx)(Te,{router:t})})})}let fe=p.trim(),H=p.length>0&&fe.length<8,pe=g.length>0&&p!==g,me=fe.length>=8&&p===g&&(!C||D.trim().length>0),ge=e=>(0,Q.jsxs)(`form`,{id:e.formId,className:`space-y-4`,onSubmit:ni(de),children:[(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-name`,children:[(0,Q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Name`}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`account-name`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`text`,name:`username`,autoComplete:`username`,value:d,onChange:e=>{f(e.target.value),A(null)},"aria-invalid":!!k,"aria-describedby":k?`account-login-error`:void 0})]}),(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-password`,children:[(0,Q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Password`}),(0,Q.jsx)(`input`,{id:`account-password`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`password`,name:`password`,autoComplete:`current-password`,value:p,onChange:e=>ce(e.target.value),"aria-invalid":!!k,"aria-describedby":k?`account-login-error`:void 0})]}),k?(0,Q.jsx)(`p`,{id:`account-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:k}):null,(0,Q.jsx)(J,{type:`submit`,variant:e.secondary?`secondary`:`default`,disabled:j||!d.trim()||!p,children:j?`Signing in…`:`Sign in`})]});return(0,Q.jsx)(`div`,{className:`min-h-screen bg-bg px-4 py-8`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5`,children:[(0,Q.jsxs)(`div`,{"data-testid":`auth-brand`,className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(ro,{className:`size-7`}),(0,Q.jsx)(`span`,{className:`text-label-18-strong text-heading`,children:`Canonry`})]}),(0,Q.jsx)(Ji,{className:`surface-card w-full`,children:t===`checking`?(0,Q.jsx)(Ki,{className:`py-8`,children:(0,Q.jsx)(`p`,{className:`supporting-copy text-center`,children:`Connecting to Canonry…`})}):t===`api-key-error`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{children:(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Could not verify API key access`})}),(0,Q.jsxs)(Ki,{className:`space-y-4`,children:[(0,Q.jsx)(`p`,{className:`supporting-copy`,children:k??`Canonry could not verify this session’s access, so the dashboard stayed locked.`}),(0,Q.jsx)(J,{type:`button`,className:`w-full`,onClick:()=>{window.location.reload()},children:`Try again`})]})]}):t===`account-login`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{children:(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`})}),F?(0,Q.jsxs)(Ki,{className:`space-y-4`,children:[N?(0,Q.jsx)(`p`,{className:`rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`You were signed out. Sign in again.`}):R?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:Yn[R]}):null,(0,Q.jsx)(Kc,{href:an(`login`,ma()),className:`w-full`}),(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":L,"aria-controls":`account-password-form`,onClick:()=>ee(e=>!e),className:`flex items-center gap-1 rounded-md text-label-14 text-secondary transition hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[L?(0,Q.jsx)(h,{className:`h-4 w-4`,"aria-hidden":`true`}):(0,Q.jsx)(b,{className:`h-4 w-4`,"aria-hidden":`true`}),`Sign in with a password`]}),L?ge({secondary:!0,formId:`account-password-form`}):null]}):(0,Q.jsxs)(Ki,{children:[N?(0,Q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`You were signed out. Sign in again.`}):null,ge({secondary:!1})]})]}):t===`setup`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Gi,{children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Create a dashboard password`}),(0,Q.jsx)(qi,{children:gg})]}),(0,Q.jsx)(Ki,{children:(0,Q.jsxs)(`form`,{className:`space-y-4`,onSubmit:ni(se),children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-new`,children:`Password`}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-new`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:`new-password`,autoComplete:`new-password`,minLength:8,required:!0,value:p,onChange:e=>ce(e.target.value),"aria-invalid":H,"aria-describedby":`dashboard-password-new-help`}),(0,Q.jsx)(`span`,{id:`dashboard-password-new-help`,"aria-live":`polite`,className:H?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:H?`Enter at least 8 characters.`:`Use at least 8 characters.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-confirm`,children:`Confirm password`}),(0,Q.jsx)(`input`,{id:`dashboard-password-confirm`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:`confirm-password`,autoComplete:`new-password`,minLength:8,required:!0,value:g,onChange:e=>V(e.target.value),"aria-invalid":pe,"aria-describedby":`dashboard-password-confirm-help`}),(0,Q.jsx)(`span`,{id:`dashboard-password-confirm-help`,"aria-live":`polite`,className:pe?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:pe?`Passwords do not match.`:`Enter the same password again.`})]}),C?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-setup-root-key`,children:_g.label}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`dashboard-setup-root-key`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:`apiKey`,autoComplete:`off`,spellCheck:!1,required:!0,value:D,onChange:e=>B(e.target.value),"aria-invalid":k===_g.rejected,"aria-describedby":`dashboard-setup-root-key-help`}),(0,Q.jsx)(`span`,{id:`dashboard-setup-root-key-help`,"aria-live":`polite`,className:`block text-label-14 text-secondary`,children:_g.help})]}):null,(0,Q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-password-show`,children:[(0,Q.jsx)(`input`,{id:`dashboard-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),C?_g.show:`Show passwords`]}),k?(0,Q.jsx)(`p`,{id:`dashboard-password-setup-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:k}):null,(0,Q.jsx)(J,{type:`submit`,disabled:j||!me,children:j?`Creating password…`:`Create password and continue`})]})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Gi,{children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`}),(0,Q.jsx)(qi,{children:x===`api-key`?`Enter an API key from this Canonry install. This opens the dashboard with that key’s access and does not change the password.`:`Enter your dashboard password to continue.`})]}),(0,Q.jsxs)(Ki,{children:[N?(0,Q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`Your session expired. Sign in again.`}):null,(0,Q.jsxs)(`form`,{className:`space-y-4`,onSubmit:ni(le),children:[(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`dashboard-password-current`,children:[(0,Q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:x===`api-key`?`Canonry API key`:`Password`}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-current`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:x===`api-key`?`apiKey`:`password`,autoComplete:x===`api-key`?`off`:`current-password`,spellCheck:!1,required:!0,value:p,onChange:e=>ce(e.target.value),"aria-invalid":!!k,"aria-describedby":k?`dashboard-password-login-error`:void 0})]}),(0,Q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-login-password-show`,children:[(0,Q.jsx)(`input`,{id:`dashboard-login-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),x===`api-key`?`Show API key`:`Show password`]}),k?(0,Q.jsx)(`p`,{id:`dashboard-password-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:k}):null,(0,Q.jsx)(J,{type:`submit`,disabled:j||!p.trim(),children:j?`Signing in…`:`Open dashboard`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>ue(x===`api-key`?`password`:`api-key`),children:x===`api-key`?`Use dashboard password instead`:`Forgot password? Use API key`})]})]})]})})]})})}var bg=document.getElementById(`root`);if(!bg)throw Error(`Expected #root element for web app bootstrap.`);sg(),(0,ta.createRoot)(bg).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(fo,{children:(0,Q.jsx)(yg,{})})}));export{Dc as $,qd as A,Da as At,Nu as B,Cf as C,qa as Ct,df as D,wa as Dt,hf as E,Ya as Et,wd as F,Lc as G,_u as H,Td as I,Nc as J,Uc as K,_d as L,Hd as M,Dd as N,pf as O,Ea as Ot,bd as P,Mc as Q,gd as R,yf as S,oo as St,bf as T,Ja as Tt,fl as U,Mu as V,Rc as W,Ec as X,Oc as Y,Ac as Z,Wf as _,bo as _t,$p as a,Ks as at,Ff as b,_o as bt,Mp as c,_s as ct,cp as d,Vo as dt,jc as et,Yf as f,Fo as ft,Gf as g,So as gt,Hf as h,Co as ht,rm as i,Js as it,Bd as j,_a as jt,ff as k,ba as kt,gp as l,Ho as lt,zf as m,ko as mt,em as n,$s as nt,tm as o,Us as ot,Zf as p,Ao as pt,Hc as q,nm as r,Zs as rt,Kp as s,Vs as st,am as t,bc as tt,tp as u,Io as ut,Lf as v,xo as vt,gf as w,$a as wt,If as x,mo as xt,Pf as y,yo as yt,yd as z};
43
+ `)),w(!0)),b(!0))},[g.queriesText,y,f,d.isPending,w,C]),(0,Z.useEffect)(()=>{y&&tf(h,{...!S.saved&&S.text!==m?{queriesText:S.text}:{},...g.competitorsText===void 0?{}:{competitorsText:g.competitorsText}})},[g.competitorsText,h,S.saved,S.text,y,m]);let{emit:T,onboardingSessionId:E}=u;(0,Z.useEffect)(()=>{y&&T({flowVersion:1,onboardingSessionId:E,event:`onboarding.started`,step:r===`first-check`?`run`:`queries`,resumed:!0},`onboarding.started`)},[T,r,E,y]);let D=(0,Z.useRef)(null),O=(0,Z.useRef)(_);(0,Z.useEffect)(()=>{if(O.current===_)return;O.current=_;let e=D.current?.querySelector(`h2, h3`);e&&(e.tabIndex=-1,e.focus())},[_]);let k=(0,Z.useRef)(null),A=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>{if(!A.current)return;let e=document.activeElement;if(e&&e!==document.body){A.current=!1;return}let t=k.current?.querySelector(`h3`);t&&(A.current=!1,t.tabIndex=-1,t.focus())});let j=Re(),M=_===`first-check`&&!j,N=Vs(),P=Zs(!N&&M,N?.health,!0).data??N?.health??Bd,F=bf(s,M),I=zp(F.data),{systemBlockReason:L,blockedReason:ee}=Wp(P,t,x),R=ee??(d.isSuccess&&p===0?`Add at least one query before launching the first check.`:void 0),te=$p(),[z,ne]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),ae=e.displayName||s,oe=async()=>{if(!j&&!(F.isError||F.isFetching||F.data?.canStart!==!0)){if(R)ie(R),x.usesProjectProviderReadiness||T({flowVersion:1,onboardingSessionId:E,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:cr(x.runnableProviderCount),queryCountBucket:cr(p),reasonCode:L??(p===0?`no_queries`:`run_rejected`)});else{ne(!0),ie(null);try{let e=await te.mutateAsync({projectName:s,projectLabel:ae,sourceAction:`setup-launch`,suppressQueuedToast:!0});Nt(s,e.id,Y[`answer-visibility`]),o(e.id),x.usesProjectProviderReadiness||T({flowVersion:1,onboardingSessionId:E,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:cr(x.runnableProviderCount),queryCountBucket:cr(p)})}catch(e){ie(e instanceof Error?e.message:`Failed to queue the AI Visibility check. Retry when the instance is ready.`),x.usesProjectProviderReadiness||T({flowVersion:1,onboardingSessionId:E,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:cr(x.runnableProviderCount),queryCountBucket:cr(p),reasonCode:Pe(e,`run_rejected`)})}finally{ne(!1)}}}},se=x.isAdmin&&(x.providerFormVisible||x.inlineModelPicker),ce=x.providerReadiness===!1&&!re;return(0,Q.jsxs)(`div`,{ref:k,children:[(0,Q.jsx)(Cm,{current:_,done:{engine:x.providerReadiness===!0,queries:p>0,"first-check":!1},hasBaseline:i}),(0,Q.jsx)(`div`,{ref:D,children:_===`engine`?(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsx)(Ip,{engines:x,headingLevel:`h3`}),(0,Q.jsxs)(`div`,{className:`setup-nav`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>x.providerGuard.request(a),children:`Back`}),(0,Q.jsx)(J,{type:`button`,variant:se?`secondary`:`default`,onClick:()=>x.providerGuard.request(()=>{x.closeProviderForm(),v(`queries`)}),children:`Continue`})]})]}):_===`queries`?(0,Q.jsx)(`div`,{className:`space-y-3`,"aria-labelledby":`setup-queries-heading`,children:(0,Q.jsx)(Hp,{queries:S,headingLevel:`h3`,loading:d.isPending||!y,loadFailed:d.isError,onRetryLoad:()=>{d.refetch()},onBack:()=>v(`engine`),note:(0,Q.jsxs)(`p`,{className:`text-copy-13 text-secondary`,children:[`Queries naming `,ae,` are branded. Results keep branded and non-brand queries apart.`]}),saveVariant:`default`})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Lp,{engines:x}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`div`,{className:`section-head`,children:(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-heading-16 text-heading`,children:j?`AI Visibility`:i?`Run an AI Visibility check`:`Run your first AI Visibility check`}),j?null:(0,Q.jsx)(Wi,{text:Rp(ae,I)})]})})}),j?(0,Q.jsx)(Vp,{projectName:s,error:re,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,onClick:()=>{c({to:`/projects/$projectName`,params:{projectName:s},replace:!0})},children:`Open project dashboard →`})]})}):(0,Q.jsx)(Bp,{preview:F,details:[{label:`Website`,value:e.canonicalDomain},{label:`Market`,value:Gt(e.country,e.language)}],queries:f??[],usesAccount:I,alert:ce?null:re??R??null,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>v(`queries`),children:`Back`}),ce?(0,Q.jsx)(J,{type:`button`,onClick:()=>v(`engine`),children:`Connect an AI engine`}):(0,Q.jsx)(J,{type:`button`,disabled:z||!!R||F.isError||F.isFetching||F.data?.canStart!==!0,title:R,onClick:ni(oe),children:z?`Starting…`:re?`Retry check`:i?`Run check`:`Run first check`})]})})]})]})}),x.providerGuard.dialog]})}var Dm=`Public pages only, read by this Canonry server and stored with this project. The first scan reads up to 100 pages, then stops.`,Om=Xt.enum;function km(e){return e===K.queued||e===K.running}function Am(e){return e===K.not_started||e===K.cancelled||e===K.failed}function jm(e,t,n){return`${e} ${e===1?t:n}`}function Mm({projectName:e,firstRun:t,track:n}){let r=xe(),i=_e(),{canWrite:a,isAdmin:o}=ei(),s=G({...Mi({client:X,path:{name:e}}),retry:!1,refetchInterval:({state:e})=>{let t=e.data;return t&&(km(t.tracks.agentReadiness.state)||km(t.tracks.aiVisibility.state))?3e3:!t?.complete&&15e3}}),c=G({...gi({client:X,path:{name:e}}),retry:!1}),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(!1),h=s.data?.tracks.aiVisibility;(0,Z.useEffect)(()=>{h&&(km(h.state)?(m.current=!0,u(null)):n===`ai-visibility`&&!m.current&&(m.current=!0,u(Vm(h.blockedBy))))},[n,h]);let g=()=>i.invalidateQueries({queryKey:Pi({client:X,path:{name:e}})}),_=Nm(e,s.data);Pm(s.data);let v=s.isSuccess;(0,Z.useEffect)(()=>{v&&p.current?.focus({preventScroll:!0})},[v]);let y=e=>{r({to:`/setup`,search:t=>({...t,track:e}),replace:!0})},b=e=>{u(e),y(`ai-visibility`)},x=()=>{u(null),y(void 0)};if(s.isPending)return(0,Q.jsx)(Im,{});if(s.isError){let n=Xi(s.error).code===`NOT_FOUND`;return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:t?`Set up Canonry`:`Project setup`}),(0,Q.jsxs)(`div`,{role:`alert`,className:`mt-6 rounded-md border border-negative bg-negative-soft p-4`,children:[(0,Q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:n?`No project named ${e}.`:`Setup status could not be loaded.`}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:n?(0,Q.jsx)(J,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,Q.jsx)(W,{to:`/projects`,children:`View projects`})}):(0,Q.jsx)(J,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{s.refetch()},children:`Retry`})})]})]})}let S=s.data,C=c.data,w=S.project.displayName||S.project.name,T=Jt(S.project.canonicalDomain),E=C?Gt(C.country,C.language):null,D=S.tracks.agentReadiness,O=S.tracks.aiVisibility,k=d!==null&&O.runId===d.listedRunId&&O.runId!==d.runId,A=a&&l!==null&&!km(O.state),j=A||!a?null:Am(D.state)?`agent-readiness`:Am(O.state)&&!k?`ai-visibility`:null;return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{ref:p,tabIndex:-1,className:`text-heading-24 text-heading outline-none`,children:t?`Set up Canonry`:`Project setup`}),(0,Q.jsxs)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:[S.complete?`Setup complete · `:null,w,` · `,T]})]}),(0,Q.jsx)(J,{asChild:!0,variant:S.complete?`default`:`ghost`,className:`shrink-0`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open project`,S.complete?null:(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})]})})]}),(0,Q.jsxs)(lf,{label:`Setup progress`,children:[(0,Q.jsx)(uf,{id:`setup-website`,title:`Website`,mark:`done`,summary:E?`${T} · ${E}`:T,trailing:a?(0,Q.jsxs)(W,{className:`shrink-0 text-label-14 text-secondary underline underline-offset-4 hover:text-primary`,to:`/projects/$projectName/settings`,params:{projectName:e},children:[`Edit`,(0,Q.jsx)(`span`,{className:`sr-only`,children:` website`})]}):null}),(0,Q.jsx)(Bm,{projectName:e,projectId:C?.id??null,brand:w,track:D,primary:j===`agent-readiness`,canWrite:a,onStarted:async e=>{_(e,Y[`site-audit`]),await g()},onCancelled:g}),(0,Q.jsx)(Um,{projectName:e,brand:w,domain:T,track:O,panelStep:A?l:null,onOpenPanel:b,onClosePanel:x,starting:k,onLaunched:e=>{_(e,Y[`answer-visibility`]),f({runId:e,listedRunId:O.runId}),x(),g()},onCancelled:g,primary:j===`ai-visibility`,canWrite:a,isAdmin:o})]}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:Lm(D)}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:Rm(O,k?K.queued:O.state)}),S.complete?(0,Q.jsx)(Tf,{projectName:e}):null]})}function Nm(e,t){let{emit:n,onboardingSessionId:r}=rf(`site_health`),{emit:i,onboardingSessionId:a}=rf(`wizard`),o=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{let t=$n(e);t?.kind&&o.current.set(t.runId,t.kind)},[e]),(0,Z.useEffect)(()=>{if(!t)return;let e=[{...t.tracks.agentReadiness,kind:Y[`site-audit`],answers:null},{...t.tracks.aiVisibility,kind:Y[`answer-visibility`],answers:t.tracks.aiVisibility.result?.answers??null}];for(let{runId:t,state:s,kind:c,answers:l}of e){if(!t||o.current.get(t)!==c)continue;let e=c===Y[`site-audit`]?{emit:n,onboardingSessionId:r}:{emit:i,onboardingSessionId:a},u=(s===K.completed||s===K.partial)&&l!==0,d=s===K.cancelled?`run_cancelled`:s===K.failed||(s===K.completed||s===K.partial)&&l===0?`run_failed`:null;if(u)e.emit({flowVersion:1,onboardingSessionId:e.onboardingSessionId,event:`onboarding.step_completed`,step:`run`,method:`automatic`,...l===null?{}:{countBucket:cr(l)}},`onboarding.step_completed:run:${t}`);else if(d)e.emit({flowVersion:1,onboardingSessionId:e.onboardingSessionId,event:`onboarding.blocked`,step:`run`,action:`retry_run`,reasonCode:d},`onboarding.blocked:run:${t}:${d}`);else continue;o.current.delete(t),Yt(t)}},[a,i,n,r,t]),(t,i)=>{o.current.set(t,i),i===Y[`site-audit`]&&(Nt(e,t,i),n({flowVersion:1,onboardingSessionId:r,event:`onboarding.started`,step:`run`,resumed:!1},`onboarding.started:${t}`))}}function Pm(e){let t=_e(),n=e?.tracks.agentReadiness.state,r=e?.tracks.aiVisibility.state,i=(0,Z.useRef)({});(0,Z.useEffect)(()=>{let e=i.current;i.current={scan:n,check:r};let a=(e,t)=>e!==void 0&&t!==void 0&&km(e)&&!km(t);(a(e.scan,n)||a(e.check,r))&&t.invalidateQueries({queryKey:wi({client:X})})},[n,r,t])}function Fm({runIds:e,noun:t,note:n,onCancelled:r}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=Me({...Ti({client:X}),meta:{skipGlobalErrorToast:!0}}),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),d=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{d.current&&(d.current=!1,(i?u:l).current?.focus())},[i]);let f=e=>{d.current=!0,s(null),a(e)},p=async()=>{if(c.isPending)return;s(null);let n=(await Promise.allSettled(e.map(e=>c.mutateAsync({path:{id:e}})))).find(e=>e.status===`rejected`&&Xi(e.reason).code!==`RUN_NOT_CANCELLABLE`);n&&s(`The ${t} could not be stopped. ${mn(n.reason)}`),await r()};return i?(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Stop the ${t}`,className:`flex flex-wrap items-center justify-end gap-x-3 gap-y-2`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Stop the `,t,`? `,n]}),(0,Q.jsxs)(`div`,{className:`flex gap-2 max-sm:w-full max-sm:[&>*]:flex-1`,children:[(0,Q.jsx)(J,{ref:u,type:`button`,variant:`ghost`,"aria-disabled":c.isPending||void 0,onClick:()=>{c.isPending||f(!1)},children:`Keep running`}),(0,Q.jsx)(J,{type:`button`,variant:`secondary`,"aria-disabled":c.isPending||void 0,onClick:()=>{p()},children:c.isPending?`Stopping…`:`Stop ${t}`})]}),o?(0,Q.jsx)(`p`,{role:`alert`,className:`w-full text-right text-copy-14 text-negative`,children:o}):null]}):(0,Q.jsxs)(J,{ref:l,type:`button`,variant:`ghost`,"data-focus-skip":!0,onClick:()=>f(!0),children:[`Cancel `,t]})}function Im(){return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,children:[(0,Q.jsx)(`div`,{className:`skeleton-text h-6 w-40`}),(0,Q.jsx)(`div`,{className:`skeleton-text-sm mt-2 w-56`}),(0,Q.jsx)(`div`,{className:`material-base mt-6 space-y-6 p-5`,children:[1,2,3].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`skeleton-text w-32`}),(0,Q.jsx)(`div`,{className:`skeleton-text-sm w-64`})]}),(0,Q.jsx)(`div`,{className:`skeleton h-5 w-20 rounded-md`})]},e))})]})}function Lm(e){switch(e.state){case K.not_started:return``;case K.queued:return`Agent Readiness audit scan queued.`;case K.running:return`Agent Readiness audit scan running.`;case K.completed:case K.partial:{let t=e.state===K.partial?`Agent Readiness audit scan stopped partway.`:`Agent Readiness audit scan complete.`,n=e.result?.score??null;return[n===null?t:`${t} Score ${Math.round(n)} of 100.`,...Et(e)].join(` `)}case K.failed:return e.error?`Agent Readiness audit scan failed. ${e.error}`:`Agent Readiness audit scan failed.`;case K.cancelled:return`Agent Readiness audit scan cancelled.`;default:return e.state}}function Rm(e,t){switch(t){case K.not_started:return``;case K.queued:return`AI Visibility check queued.`;case K.running:return`AI Visibility check running.`;case K.completed:case K.partial:{let n=t===K.partial?`AI Visibility check stopped partway.`:`AI Visibility check complete.`,r=e.result;return r?`${n} ${jm(r.answers,`answer`,`answers`)} from ${jm(r.engines,`engine`,`engines`)}.`:n}case K.failed:return`AI Visibility check failed.`;case K.cancelled:return`AI Visibility check cancelled.`;default:return t}}function zm(e){let t=e.progress;if(!t)return{phase:e.state===K.queued?`Waiting to start`:`Starting the scan`,count:null,done:null,total:null};switch(t.phase){case Om.queued:return{phase:`Waiting to start`,count:null,done:null,total:null};case Om.discovering:return{phase:`Finding pages`,count:t.pagesFound===null?null:`${t.pagesFound} found`,done:null,total:null};case Om.checking:{let e=t.pagesFound,n=t.pageLimit;return e!==null&&(n===null||e<n)?{phase:`Checking pages`,count:`${t.pagesChecked} of ${e}`,done:t.pagesChecked,total:e}:{phase:`Checking pages`,count:n===null?`${t.pagesChecked} checked`:`${t.pagesChecked} of up to ${n}`,done:t.pagesChecked,total:n}}case Om[`arranging-map`]:return{phase:`Building the score`,count:jm(t.pagesChecked,`page checked`,`pages checked`),done:null,total:null};case Om.completed:case Om.partial:case Om.failed:case Om.cancelled:return{phase:`Finishing`,count:null,done:null,total:null};default:return t.phase}}function Bm({projectName:e,projectId:t,brand:n,track:r,primary:i,canWrite:a,onStarted:o,onCancelled:s}){let c=tm(),{onboardingSessionId:l,emit:u}=rf(`platform`),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(!1),h=r.state,g=async()=>{if(t&&!p){f(null),m(!0);try{let r=await c.mutateAsync({projectName:e,projectId:t,projectLabel:n,suppressErrorToast:!0,suppressQueuedToast:!0,body:{checkDeadLinks:!0,maxPages:100,sites:[]}});u({flowVersion:1,onboardingSessionId:l,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`}),await o(r.runId)}catch(e){f(`The audit scan could not start. ${mn(e)}`),u({flowVersion:1,onboardingSessionId:l,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:Pe(e,`run_rejected`)})}finally{m(!1)}}},_=e=>a?(0,Q.jsx)(J,{type:`button`,variant:i?`default`:`secondary`,disabled:!t,"aria-disabled":p||void 0,className:p?`opacity-50`:void 0,onClick:()=>{g()},children:p?`Starting…`:e}):null,v=null,y=null,b=null;switch(h){case K.not_started:case K.cancelled:v=(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1.5`,children:[h===K.cancelled?`The last scan was cancelled. `:null,`Reads up to `,100,` public pages. No AI engine needed.`,(0,Q.jsx)(Wi,{text:Dm})]}),b=_(h===K.cancelled?`Run audit scan again`:`Run audit scan`);break;case K.queued:case K.running:{let e=zm(r),t=r.progress;y=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ef,{label:`Agent Readiness audit scan progress`,noun:`scan`,phase:e.phase,count:e.count,done:e.done,total:e.total,startedAt:r.startedAt}),t?(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Scan details`}),(0,Q.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-4`,children:[[`Pages found`,t.pagesFound],[`Pages checked`,t.pagesChecked],[`Links found`,t.linksFound],[`Pages failed`,t.pagesFailed]].map(([e,t])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:e}),(0,Q.jsx)(`dd`,{className:`text-label-14-strong tabular-nums text-heading`,children:t===null?`Unavailable`:t.toLocaleString()})]},e))})]}):null]}),b=a&&r.runId?(0,Q.jsx)(Fm,{runIds:[r.runId],noun:`scan`,note:`It saves no score.`,onCancelled:s},r.runId):null;break}case K.completed:case K.partial:{let t=r.result;v=Et(r).join(` `)||null,y=t?(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`text-heading-20 tabular-nums text-heading`,children:t.score===null?`–`:Math.round(t.score)}),(0,Q.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[t.score===null?`Score unavailable`:h===K.partial?`of 100 so far`:`of 100`,` · `,jm(t.pagesScored,`page scored`,`pages scored`)]})]}):(0,Q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`The scan finished.`}),b=(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName/agent-readiness`,params:{projectName:e},search:{siteHealthRunId:r.runId??void 0},children:[`Open Agent Readiness`,(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})]})});break}case K.failed:v=(0,Q.jsx)(`span`,{className:`whitespace-pre-line`,children:`The scan did not finish.${r.error?` ${r.error}`:``}`}),b=_(`Run audit scan again`);break;default:return h}return(0,Q.jsxs)(uf,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:sf(h),summary:v,trailing:(0,Q.jsx)(of,{state:h}),action:b,children:[y,d?(0,Q.jsx)(`p`,{role:`alert`,className:`${y?`mt-3 `:``}text-copy-14 text-negative`,children:d}):null]})}function Vm(e){switch(e){case null:return`first-check`;case Ke.no_engine:case Ke.engines_failing:return`engine`;case Ke.no_queries:return`queries`;case Ke.plan_unpublished:return null;default:return e}}function Hm(e,t,n){let r=`Whether AI answers mention ${t} and cite ${n}.`,i=e.baselineRunId===null;switch(e.blockedBy){case Ke.no_engine:return{line:`${r} Needs an AI engine.`,action:`Connect an AI engine`,step:`engine`};case Ke.no_queries:return{line:`${r} Add queries to check.`,action:`Add queries`,step:`queries`};case Ke.plan_unpublished:return{line:`Publish the measurement plan before the ${i?`first`:`next`} check.`,action:`Open measurement plan`,step:`plan`};case Ke.engines_failing:return{line:`${r} The AI engine connection needs attention.`,action:`Repair connection`,step:`engine`};case null:{let t=e.engines.length;return{line:`Asks ${jm(t,`engine`,`engines`)} your ${jm(e.queries.total,`query`,`queries`)}.`,action:i?`Review first check`:`Review check`,step:`first-check`}}default:return e.blockedBy}}function Um({projectName:e,brand:t,domain:n,track:r,panelStep:i,onOpenPanel:a,onClosePanel:o,onLaunched:s,onCancelled:c,starting:l,primary:u,canWrite:d,isAdmin:f}){let p=l?K.queued:r.state,m=u?`default`:`secondary`;if(i!==null)return(0,Q.jsx)(uf,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:sf(p),trailing:(0,Q.jsx)(of,{state:p}),childrenManageFocus:!0,children:(0,Q.jsx)(Tm,{projectName:e,initialStep:i,hasBaseline:r.baselineRunId!==null,onClose:o,onLaunched:s})});let h=null,g=null,_=null;switch(p){case K.not_started:case K.cancelled:{let i=Hm(r,t,n);if(h=p===K.cancelled?`The last check was cancelled. ${i.line}`:i.line,d){let t=i.step;_=t===`plan`?(0,Q.jsx)(J,{asChild:!0,variant:m,children:(0,Q.jsx)(W,{to:`/projects/$projectName/portfolio`,params:{projectName:e},children:i.action})}):(0,Q.jsx)(J,{type:`button`,variant:m,onClick:()=>a(t),children:i.action})}break}case K.queued:case K.running:{let e=r.progress,t=e?e.answersPlanned!==null&&e.answersSaved<=e.answersPlanned?`${e.answersSaved} of ${jm(e.answersPlanned,`answer`,`answers`)} saved`:`${jm(e.answersSaved,`answer`,`answers`)} saved`:null;g=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ef,{label:`AI Visibility check progress`,noun:`check`,phase:p===K.queued?`Waiting to start`:`Asking engines`,count:t,done:e?.answersSaved??null,total:e?.answersPlanned??null,startedAt:r.startedAt}),Object.entries(r.providerFailures??{}).map(([e,t])=>(0,Q.jsxs)(`div`,{role:`status`,className:`mt-3 rounded-md border border-caution px-3 py-2`,children:[(0,Q.jsxs)(`p`,{className:`text-copy-14 text-primary`,children:[Bi(e),`: `,jm(t.failedQueries,`query`,`queries`),` failed`,t.stopped?`, so this check stopped asking it`:``,`.`]}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:t.message})]})]},e)),(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Check details`}),(0,Q.jsxs)(`dl`,{className:`mt-2 grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Engines`}),(0,Q.jsx)(`dd`,{className:`text-label-14 text-heading`,children:r.engines.length>0?r.engines.map(e=>Bi(e)).join(`, `):`Unavailable`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Queries`}),(0,Q.jsxs)(`dd`,{className:`text-label-14 tabular-nums text-heading`,children:[jm(r.queries.nonBrand,`non-brand`,`non-brand`),` · `,jm(r.queries.branded,`branded`,`branded`)]})]})]})]})]}),_=d&&!l&&r.runId?(0,Q.jsx)(Fm,{runIds:r.runIds,noun:`check`,note:r.baselineRunId===null?`It saves no baseline.`:`Earlier results stay as they are.`,onCancelled:c},r.runId):null;break}case K.completed:case K.partial:{let t=r.result,n=r.runId!==null&&r.runId===r.baselineRunId;h=t?`${p===K.partial?`Partial results`:n?`Baseline`:`Latest check`} · ${jm(t.answers,`answer`,`answers`)} from ${jm(t.engines,`engine`,`engines`)}${r.finishedAt?` · ${Yr(r.finishedAt)}`:``}`:`The check finished.`,g=t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Mf,{byClass:t.queryCountsByClass,pooled:t.queryCounts,caption:n?void 0:`Latest AI Visibility check by query class`}),n?(0,Q.jsx)(`p`,{className:`mt-3 text-copy-13 text-secondary`,children:`Later checks are compared with this baseline.`}):null,r.runId?(0,Q.jsx)(Wm,{runId:r.runId,projectName:e}):null]}):null,_=(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open AI Visibility`,(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})]})});break}case K.failed:{h=r.baselineRunId===null?`The check did not finish. No baseline was saved.`:`The check did not finish. Earlier results are unchanged.`;let e=f?null:(0,Q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Ask an administrator to check the AI engine connection.`}),t=r.failedEngines??[];g=t.length>0?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[t.map(e=>{let t=Bi(e.provider),n=bt(e.code,Bi(dn(e.provider)));return(0,Q.jsx)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-copy-14 text-primary`,children:n}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Q.jsxs)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:[t,`: `,e.message]})]})]}):(0,Q.jsxs)(`p`,{className:`break-words text-copy-14 text-primary`,children:[t,`: `,e.message]})},e.provider)}),e]}):r.error?(0,Q.jsxs)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`break-words text-copy-14 text-primary`,children:r.error}),e?(0,Q.jsx)(`div`,{className:`mt-1`,children:e}):null]}):null,d&&(_=(0,Q.jsxs)(Q.Fragment,{children:[f?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>a(`engine`),children:`Change AI engines`}):null,(0,Q.jsx)(J,{type:`button`,variant:m,onClick:()=>a(`first-check`),children:`Run check again`})]}));break}default:return p}return(0,Q.jsx)(uf,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:sf(p),summary:h,trailing:(0,Q.jsx)(of,{state:p}),action:_,children:g})}function Wm({runId:e,projectName:t}){let[n,r]=(0,Z.useState)(!1),i=G({...pi({client:X,path:{id:e}}),enabled:n}),a=G({...vi({client:X,path:{name:t}}),enabled:n}),o=i.data?Of(i.data.snapshots??[],e=>a.data?.find(t=>t.id===e)?.queryClass):void 0;return(0,Q.jsxs)(`details`,{className:`mt-3`,onToggle:e=>r(e.currentTarget.open),children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-link`,children:`Example answer`}),(0,Q.jsx)(`div`,{className:`mt-3 border-t border-default pt-4`,children:i.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading the answer…`}):i.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`The answer could not be loaded.`}):o?(0,Q.jsx)(Nf,{answer:o}):(0,Q.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`This check saved no answer text.`})})]})}var Gm=`pointer-coarse:min-h-11 max-md:min-h-11`,Km=`setup-input h-10 w-full max-md:text-label-16 ${Gm}`,qm=[{value:`US`,label:`United States`},{value:`CA`,label:`Canada`},{value:`GB`,label:`United Kingdom`},{value:`AU`,label:`Australia`},{value:`NZ`,label:`New Zealand`},{value:`IE`,label:`Ireland`},{value:`DE`,label:`Germany`},{value:`FR`,label:`France`},{value:`ES`,label:`Spain`},{value:`IT`,label:`Italy`},{value:`NL`,label:`Netherlands`},{value:`BR`,label:`Brazil`},{value:`MX`,label:`Mexico`},{value:`IN`,label:`India`},{value:`SG`,label:`Singapore`},{value:`JP`,label:`Japan`}],Jm=[{value:`en`,label:`English`},{value:`es`,label:`Spanish`},{value:`fr`,label:`French`},{value:`de`,label:`German`},{value:`it`,label:`Italian`},{value:`pt`,label:`Portuguese`},{value:`nl`,label:`Dutch`},{value:`ja`,label:`Japanese`}];function Ym(e,t){let n=e.trim().toUpperCase(),r=t.trim().toLowerCase();return{countryValid:qm.some(e=>e.value===n),languageValid:Jm.some(e=>e.value===r)}}function Xm(e){let t=e.replace(/^\[|\]$/g,``);return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes(`:`)}function Zm(e){let t=e.trim();if(!t)return null;let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`https://${t}`,r;try{r=new URL(n)}catch{return null}if(r.protocol!==`http:`&&r.protocol!==`https:`)return null;let i=r.hostname.toLowerCase().replace(/^www\./,``);if(!i||i===`localhost`||Xm(i)||!i.includes(`.`))return null;let a=zt(i);return a?{canonicalDomain:i,projectName:a,displayName:$e(i)}:null}function Qm(e,t){return e instanceof tr&&e.statusCode===409?`A project with this name already exists. Change the project name, or open the existing project.`:e instanceof Error&&e.message?e.message:t}function $m(){return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,Q.jsx)(`div`,{className:`page-header`,children:(0,Q.jsxs)(`div`,{className:`page-header-left`,children:[(0,Q.jsx)(`h1`,{className:`page-title`,children:`Preparing setup`}),(0,Q.jsx)(`p`,{className:`page-subtitle`,children:`Checking the projects already on this install.`})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 material-base p-4 text-label-14 text-secondary`,role:`status`,children:[(0,Q.jsx)(o,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading projects…`]})]})}function eh({onRetry:e}){return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsx)(`div`,{className:`page-header`,children:(0,Q.jsxs)(`div`,{className:`page-header-left`,children:[(0,Q.jsx)(`h1`,{className:`page-title`,children:`Can’t load projects`}),(0,Q.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not confirm whether this install already has a project.`})]})}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,Q.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Setup is paused to protect existing projects.`}),(0,Q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,Q.jsx)(J,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:e,children:`Retry project check`})]})]})}function th(){let e=Se({from:`/setup`});if(e.experience===`legacy`||e.experience!==`platform`&&Xn()===`legacy`)return(0,Q.jsx)(ym,{visibilityProjectName:e.setupProject??e.project});let t=e.project??e.setupProject;if(t){let n=e.track??(e.onboarding===`site-health`?`agent-readiness`:void 0);return(0,Q.jsx)(Mm,{projectName:t,firstRun:e.onboarding!==void 0,track:n},t)}let n=e.experience===`platform`;return(0,Q.jsx)(nh,{addProject:n},n?`add-project`:`entry`)}function nh({addProject:e}){let t=xe(),n=G({...Ai({client:X}),retry:!1,refetchOnMount:`always`}),r=n.isSuccess&&n.isFetchedAfterMount,i=!e&&r&&n.data.length===1?n.data[0]:void 0,a=G({...Mi({client:X,path:{name:i?.name??``}}),enabled:i!==void 0,retry:!1}),[o,s]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(o||!r)return;let t=n.data;if(e||t.length===0)s({firstRun:t.length===0});else if(i){if(a.isPending)return;s(a.data?.complete===!0?{addProject:!0}:{redirectTo:i.name})}else s({addProject:!0})},[e,o,r,i,a.data,a.isPending,n.data]),(0,Z.useEffect)(()=>{o&&(`redirectTo`in o?t({to:`/setup`,search:{project:o.redirectTo,onboarding:`first-run`},replace:!0}):`addProject`in o&&t({to:`/setup`,search:{experience:`platform`},replace:!0}))},[o,t]),!o&&n.isError?(0,Q.jsx)(eh,{onRetry:()=>{n.refetch()}}):!o||`redirectTo`in o||`addProject`in o?(0,Q.jsx)($m,{}):(0,Q.jsx)(rh,{firstRun:o.firstRun})}function rh({firstRun:e}){return(0,Q.jsx)(Ui,{title:e?`Set up Canonry`:`Add a project`,children:(0,Q.jsx)(ih,{firstRun:e})})}function ih({firstRun:e}){let t=xe(),n=_e(),r=e&&sn(),i=G({...mi({client:X}),enabled:r,retry:!1}),a=Me(Oi()),[s]=(0,Z.useState)(()=>ef(`platform`)),[c,l]=(0,Z.useState)(s.domain??``),[u,d]=(0,Z.useState)(s.projectName??``),[f,p]=(0,Z.useState)(s.displayName??``),[m,g]=(0,Z.useState)(s.country??`US`),[_,v]=(0,Z.useState)(s.language??`en`),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),D=G({...Ai({client:X}),enabled:T!==null,retry:!1}),O=T===null?null:D.data?.find(e=>zt(e.name)===T)?.name??T,k=!r||i.isError?void 0:i.data,A=typeof k?.enabled==`boolean`?k.enabled:null,j=a.isPending?a.variables.body.enabled:A,[M,N]=(0,Z.useState)(null),P=(0,Z.useRef)(null),I=(0,Z.useRef)(null),L=(0,Z.useRef)(null),{onboardingSessionId:ee,emit:R}=rf(`platform`);(0,Z.useEffect)(()=>{R({flowVersion:1,onboardingSessionId:ee,event:`onboarding.started`,step:`project`,resumed:!1},`onboarding.started`)},[R,ee]),(0,Z.useEffect)(()=>{tf(`platform`,{domain:c,projectName:u,displayName:f,country:m,language:_})},[c,u,f,m,_]);let te=()=>{nf(`platform`),l(``),d(``),p(``),g(`US`),v(`en`),w(null),E(null)},z=Zm(c),ne=u.trim()||z?.projectName||``,re=f.trim()||z?.displayName||``,ie=Gt(m,_),{countryValid:ae,languageValid:oe}=Ym(m,_),se=ae&&oe,ce=!!(c||u||f||m!==`US`||_!==`en`),B=!!(c&&!z&&x);(0,Z.useEffect)(()=>{C&&(T!==null&&L.current?(I.current&&(I.current.open=!0),L.current.focus()):P.current?.focus())},[T,C]);let V=async r=>{if(r.preventDefault(),S(!0),z&&se&&!y){b(!0),w(null),E(null);try{let r=await Rn({name:ne,displayName:re,canonicalDomain:z.canonicalDomain,country:m,language:_});nf(`platform`),R({flowVersion:1,onboardingSessionId:ee,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),await n.invalidateQueries({queryKey:zi({client:X})}),await t({to:`/setup`,search:{project:r.name,...e?{onboarding:`first-run`}:{}},replace:!0})}catch(e){b(!1);let t=e instanceof tr&&e.statusCode===409;E(t?zt(ne):null),w(Qm(e,`Could not create the project. Try again.`)),R({flowVersion:1,onboardingSessionId:ee,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:Pe(e,`project_create_failed`)},`onboarding.blocked:project`),t&&n.invalidateQueries({queryKey:zi({client:X})})}}},le=async e=>{N(null);try{let t=await a.mutateAsync({client:X,body:{enabled:e}});n.setQueryData(xi({client:X}),t),t.enabled!==e&&N(`The server kept telemetry ${t.enabled?`on`:`off`}. Check its telemetry settings.`)}catch{N(`Could not update telemetry. Try again.`)}};return(0,Q.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:e?`Set up Canonry`:`Add a project`}),e?(0,Q.jsx)(`p`,{className:`mt-1 max-w-prose text-copy-14 text-secondary`,children:`Add your first website to get its Agent Readiness score and first AI Visibility result.`}):null]}),e?(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,className:`shrink-0`,children:(0,Q.jsxs)(W,{to:`/agent-setup`,children:[(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":`true`}),`Set up with an agent`]})}):null]}),(0,Q.jsxs)(lf,{label:`Setup progress`,children:[(0,Q.jsx)(uf,{id:`setup-website`,title:`Website`,mark:`idle`,trailing:(0,Q.jsx)(yr,{tone:`neutral`,className:`shrink-0`,children:`Required`}),children:(0,Q.jsxs)(`form`,{"aria-label":`Website`,className:`space-y-5`,onSubmit:ni(V),noValidate:!0,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-domain`,children:`Website URL`}),(0,Q.jsx)(`input`,{id:`launchpad-domain`,className:Km,type:`text`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`none`,spellCheck:!1,required:!0,"aria-invalid":B,"aria-describedby":B?`launchpad-domain-error`:void 0,placeholder:`https://example.com`,value:c,onBlur:()=>S(!0),onChange:e=>{l(e.target.value),w(null),E(null)}}),B?(0,Q.jsx)(`p`,{id:`launchpad-domain-error`,className:`text-copy-14 text-negative`,role:`alert`,children:`Enter a public domain, such as example.com.`}):null]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-display-name`,children:`Brand name`}),(0,Q.jsx)(`input`,{id:`launchpad-display-name`,className:Km,type:`text`,autoComplete:`organization`,"aria-describedby":`launchpad-display-name-hint`,placeholder:z?.displayName??`Your brand`,value:f,onChange:e=>p(e.target.value)}),(0,Q.jsx)(`p`,{id:`launchpad-display-name-hint`,className:`text-copy-13 text-secondary`,children:`Answers that name this brand count as mentions.`})]}),(0,Q.jsxs)(`details`,{ref:I,className:`group border-t border-default`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center justify-between gap-4 py-2 text-label-14 [&::-webkit-details-marker]:hidden ${Gm}`,children:[(0,Q.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Project details`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-secondary`,children:[ie,(0,Q.jsx)(h,{className:`size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":`true`})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-5 pb-4 pt-2`,children:[z?(0,Q.jsxs)(`div`,{className:`grid gap-2 sm:max-w-[50%]`,children:[(0,Q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-project-name`,children:`Project name`}),(0,Q.jsx)(`input`,{ref:L,id:`launchpad-project-name`,className:Km,type:`text`,placeholder:z.projectName,"aria-invalid":T!==null,"aria-describedby":T===null?void 0:`launchpad-create-error`,value:u,onChange:e=>{d(e.target.value),T!==null&&(E(null),w(null))}})]}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-country`,children:`Country`}),(0,Q.jsx)(`select`,{id:`launchpad-country`,className:Km,value:m,onChange:e=>g(e.target.value),children:qm.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-language`,children:`Language`}),(0,Q.jsx)(`select`,{id:`launchpad-language`,className:Km,value:_,onChange:e=>v(e.target.value),children:Jm.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]}),C?(0,Q.jsxs)(`div`,{ref:P,className:`rounded-md border border-negative bg-negative-soft p-3`,role:`alert`,tabIndex:-1,children:[(0,Q.jsx)(`p`,{id:`launchpad-create-error`,className:`text-copy-14-strong text-heading`,children:C}),O===null?null:(0,Q.jsx)(J,{asChild:!0,variant:`secondary`,size:`sm`,className:`mt-3`,children:(0,Q.jsxs)(W,{to:`/projects/$projectName`,params:{projectName:O},children:[`Open `,O]})})]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-sm:[&>*]:w-full`,children:[ce?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,disabled:y,onClick:te,children:`Reset unsaved fields`}):null,e?null:(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,className:Gm,children:(0,Q.jsx)(W,{to:`/projects`,onClick:()=>nf(`platform`),children:`Cancel`})}),(0,Q.jsx)(J,{className:Gm,type:`submit`,disabled:!z||!se||y,children:y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` Creating project…`]}):`Continue`})]})]})}),(0,Q.jsx)(uf,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:`idle`,summary:`How well AI agents can read your site`,trailing:(0,Q.jsx)(of,{state:K.not_started})}),(0,Q.jsx)(uf,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:`idle`,summary:`Whether AI answers mention your brand and cite your site`,trailing:(0,Q.jsx)(of,{state:K.not_started})})]}),A===null?null:(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-default pt-5`,"aria-labelledby":`telemetry-title`,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-3 py-2 ${a.isPending?`cursor-wait`:`cursor-pointer`}`,children:[(0,Q.jsx)(`input`,{className:`mt-0.5 size-4 shrink-0 rounded border-strong bg-bg accent-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-mono-500 disabled:cursor-wait`,type:`checkbox`,checked:j??!1,disabled:a.isPending,onChange:e=>{le(e.target.checked)},"aria-describedby":`telemetry-detail`}),(0,Q.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,Q.jsx)(`span`,{id:`telemetry-title`,className:`text-label-14 text-heading`,children:`Share anonymous product telemetry`}),(0,Q.jsx)(`span`,{id:`telemetry-detail`,className:`max-w-[70ch] text-label-14 text-secondary`,children:`Helps prioritize improvements. Canonry does not send raw domains, URLs, queries, answer content, or credentials.`})]})]}),a.isPending?(0,Q.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,role:`status`,children:`Saving preference…`}):null,M?(0,Q.jsx)(`p`,{className:`mt-1 text-copy-14 text-negative`,role:`alert`,children:M}):null]})]})}function ah(){return(0,Q.jsx)(`div`,{className:`page-container`,children:(0,Q.jsx)(`section`,{className:`page-section`,children:(0,Q.jsxs)(Ji,{className:`surface-card empty-card`,children:[(0,Q.jsx)(`h1`,{children:`Page not found`}),(0,Q.jsx)(`p`,{children:`This page may have moved. Choose a project to continue.`}),(0,Q.jsx)(J,{asChild:!0,children:(0,Q.jsx)(W,{to:`/projects`,children:`View projects`})})]})})})}var oh=je(()=>Wr(()=>import(`./ProjectPage-DQgRsgAv.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url),`ProjectPage`),sh=je(()=>Wr(()=>import(`./RunsPage-BihA-xXz.js`),__vite__mapDeps([25,1,2,3,4,5,6,7,9,12,13,14,10,15,16,17,18]),import.meta.url),`RunsPage`),ch=je(()=>Wr(()=>import(`./HistoryPage-Ci2llyKV.js`),__vite__mapDeps([26,4,1,2,20,5,6,3,7,13,15]),import.meta.url),`HistoryPage`),lh=je(()=>Wr(()=>import(`./SettingsPage-DuheQKDg.js`),__vite__mapDeps([27,1,2,4,5,6,3,7,11,12,14,9,10,15]),import.meta.url),`SettingsPage`),uh=je(()=>Wr(()=>import(`./AgentSetupPage-DAu_QuMy.js`),__vite__mapDeps([28,1,2,4,7,3,6,10,11]),import.meta.url),`AgentSetupPage`),dh=je(()=>Wr(()=>import(`./BacklinksPage-DMZKWIfa.js`),__vite__mapDeps([29,1,2,4,7,3,6,11,15,19,17]),import.meta.url),`BacklinksPage`),fh=je(()=>Wr(()=>import(`./TrafficPage-DiG_i3h4.js`),__vite__mapDeps([30,1,2,4,5,6,3,7,13,15,24,8,10,11,12,16,17,18,22]),import.meta.url),`TrafficPage`),ph=je(()=>Wr(()=>import(`./TrafficSourceDetailPage-BRlxEdMd.js`),__vite__mapDeps([31,1,2,4,5,6,3,7,9,10,16,17,15,18,22,12,13,23]),import.meta.url),`TrafficSourceDetailPage`),mh=je(()=>Wr(()=>import(`./MeasurementPropertyPage-Bml0yUnY.js`),__vite__mapDeps([32,1,2,4,5,6,3,7,9,10,13,14,15,16,17,21]),import.meta.url),`MeasurementPropertyPage`);function hh(){return(0,Q.jsx)(ju,{children:(0,Q.jsx)(ga,{children:(0,Q.jsx)(Eu,{})})})}var gh=be()({component:hh,notFoundComponent:ah,validateSearch:e=>({manageQueries:e.manageQueries===!0||e.manageQueries===`true`||void 0,runId:typeof e.runId==`string`?e.runId:void 0,siteHealthRunId:typeof e.siteHealthRunId==`string`?e.siteHealthRunId:void 0,connectCloudRun:Fn.safeParse(e.connectCloudRun).data,seoProfileId:typeof e.seoProfileId==`string`?e.seoProfileId:void 0,seoRunId:typeof e.seoRunId==`string`?e.seoRunId:void 0,seoView:typeof e.seoView==`string`?e.seoView:void 0,seoTrendDays:jn.safeParse(typeof e.seoTrendDays==`string`?Number(e.seoTrendDays):e.seoTrendDays).data,seoTrendMetric:rr.safeParse(e.seoTrendMetric).data,seoTrendKeyword:nn.safeParse(e.seoTrendKeyword).data,seoRegion:typeof e.seoRegion==`string`&&e.seoRegion?e.seoRegion:void 0,seoMarket:typeof e.seoMarket==`string`&&e.seoMarket?e.seoMarket:void 0,seoShow:typeof e.seoShow==`string`&&e.seoShow?e.seoShow:void 0,seoSort:typeof e.seoSort==`string`&&e.seoSort?e.seoSort:void 0,seoQ:typeof e.seoQ==`string`&&e.seoQ?e.seoQ:void 0,evidenceId:typeof e.evidenceId==`string`?e.evidenceId:void 0,runStatus:typeof e.runStatus==`string`?e.runStatus:void 0,runKind:typeof e.runKind==`string`?e.runKind:void 0,runProject:typeof e.runProject==`string`?e.runProject:void 0,runWindow:typeof e.runWindow==`string`?e.runWindow:void 0,runQuery:typeof e.runQuery==`string`?e.runQuery:void 0,onboarding:e.onboarding===`site-health`||e.onboarding===`first-run`||e.onboarding===`complete`?e.onboarding:void 0,experience:e.experience===`legacy`||e.experience===`platform`?e.experience:void 0,siteScan:e.siteScan===`skip`||e.siteScan===`scan`?e.siteScan:void 0,skipped:e.skipped===`visibility`?`visibility`:void 0,setupProject:typeof e.setupProject==`string`?e.setupProject:void 0,project:typeof e.project==`string`&&e.project?e.project:void 0,track:e.track===`agent-readiness`||e.track===`ai-visibility`?e.track:void 0,scope:typeof e.scope==`string`?e.scope:void 0,class:typeof e.class==`string`?e.class:void 0,...Object.fromEntries([`queryWorkspace`,`researchMode`,`trackingQueryId`,`measurementScope`,`measurementScopeKey`,`measurementMarketKey`,`queryClass`,`measurementProvider`,`measurementModel`,`measurementLocation`,`measurementFrom`,`measurementTo`,`measurementRevision`,`measurementRunId`,`measurementQueryKey`,`measurementAnswer`,`journeyView`,`journeyDays`,`journeyVisitor`,`journeyEngine`,`journeyReturned`,`journeyOffset`,`agentHours`,`trafficSource`].map(t=>[t,typeof e[t]==`string`&&e[t]?e[t]:void 0]))})}),_h=Ee({getParentRoute:()=>gh,path:`/`,component:Yd,beforeLoad:async({context:e})=>{let t=e.queryClient.getQueryData(zi({client:X}));if(t===void 0)try{t=await e.queryClient.ensureQueryData(Ai({client:X}))}catch{return}if(t.length===0)throw Ce({to:`/setup`})}}),vh=Ee({getParentRoute:()=>gh,path:`/projects`,component:Zd}),yh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,bh=Ee({getParentRoute:()=>gh,path:`/projects/$projectName`,component:()=>(0,Q.jsx)(ke,{}),beforeLoad:async({context:e,params:t,location:n})=>{let r=t.projectName;if(!yh.test(r))return;let i=e.queryClient.getQueryData(zi({client:X}));if(!i)try{i=await e.queryClient.ensureQueryData(Ai({client:X}))}catch{return}let a=i.find(e=>e.id===r);if(a)throw Ce({to:n.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(a.name)}`),replace:!0})}}),xh=Ee({getParentRoute:()=>bh,path:`/`,component:()=>(0,Q.jsx)(oh,{tab:`overview`})}),Sh=Ee({getParentRoute:()=>bh,path:`/portfolio`,component:()=>(0,Q.jsx)(oh,{tab:`portfolio`})}),Ch=Ee({getParentRoute:()=>bh,path:`/search-console`,component:()=>(0,Q.jsx)(oh,{tab:`search-console`})}),wh=Ee({getParentRoute:()=>bh,path:`/seo-data`,component:()=>(0,Q.jsx)(oh,{tab:`seo-data`})}),Th=Ee({getParentRoute:()=>bh,path:`/journeys`,component:()=>(0,Q.jsx)(oh,{tab:`journeys`})}),Eh=Ee({getParentRoute:()=>bh,path:`/conversions`,component:()=>(0,Q.jsx)(oh,{tab:`conversions`})}),Dh=Ee({getParentRoute:()=>bh,path:`/local`,component:()=>(0,Q.jsx)(oh,{tab:`local`})}),Oh=Ee({getParentRoute:()=>bh,path:`/discovery`,component:()=>(0,Q.jsx)(oh,{tab:`discovery`})}),kh=Ee({getParentRoute:()=>bh,path:`/queries`,component:()=>(0,Q.jsx)(oh,{tab:`queries`})}),Ah=Ee({getParentRoute:()=>bh,path:`/client-queries`,component:()=>(0,Q.jsx)(oh,{tab:`client-queries`})}),jh=Ee({getParentRoute:()=>bh,path:`/properties/$targetKey`,component:()=>(0,Q.jsx)(mh,{})}),Mh=Ee({getParentRoute:()=>bh,path:`/report`,beforeLoad:({params:e})=>{throw Ce({to:`/projects/$projectName`,params:e,replace:!0})}}),Nh=Ee({getParentRoute:()=>bh,path:`/activity`,component:()=>(0,Q.jsx)(oh,{tab:`activity`})}),Ph=Ee({getParentRoute:()=>bh,path:`/traffic`,component:()=>(0,Q.jsx)(oh,{tab:`traffic`})}),Fh=Ee({getParentRoute:()=>bh,path:`/backlinks`,component:()=>(0,Q.jsx)(oh,{tab:`backlinks`})}),Ih=Ee({getParentRoute:()=>bh,path:`/agent-readiness`,component:()=>(0,Q.jsx)(oh,{tab:`agent-readiness`})}),Lh=Ee({getParentRoute:()=>bh,path:`/technical-aeo`,beforeLoad:({params:e,location:t})=>{throw Ce({to:`/projects/$projectName/agent-readiness`,params:e,search:t.search,hash:t.hash,replace:!0})}}),Rh=Ee({getParentRoute:()=>bh,path:`/history`,component:()=>(0,Q.jsx)(oh,{tab:`history`})}),zh=Ee({getParentRoute:()=>bh,path:`/settings`,component:()=>(0,Q.jsx)(oh,{tab:`settings`})}),Bh=Ee({getParentRoute:()=>gh,path:`/runs`,component:sh}),Vh=Ee({getParentRoute:()=>gh,path:`/history`,component:ch}),Hh=Ee({getParentRoute:()=>gh,path:`/settings`,component:lh,beforeLoad:({context:e})=>{}}),Uh=Ee({getParentRoute:()=>gh,path:`/setup`,component:th}),Wh=Ee({getParentRoute:()=>gh,path:`/agent-setup`,component:uh}),Gh=Ee({getParentRoute:()=>gh,path:`/backlinks`,component:dh}),Kh=Ee({getParentRoute:()=>gh,path:`/traffic`,component:fh}),qh=Ee({getParentRoute:()=>gh,path:`/traffic/$projectName/$sourceId`,component:ph}),Jh=gh.addChildren([_h,vh,bh.addChildren([xh,Sh,Ch,wh,Th,Eh,Dh,Oh,kh,Ah,jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh,zh]),Bh,Vh,Hh,Uh,Wh,Gh,Kh,qh]);function Yh(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:`/`}var Xh=Yh(),Zh=Xh===`/`?``:Xh.replace(/\/$/,``);function Qh(e,t){return ye({routeTree:Jh,basepath:Zh||`/`,context:{queryClient:e},...t?.initialEntries&&{history:we({initialEntries:t.initialEntries})}})}var $h=6e4,eg=6e4,tg=1e4,ng=3e4;function rg(){let e=!1,t=null,n,r=null,i=performance.now(),a=Date.now(),o=i,s=i,c=document.visibilityState===`visible`&&document.hasFocus(),l=0,u=()=>{let e=performance.now(),t=Date.now(),n=e-i;if(r&&c&&n>=0&&n<=ng&&t-a<=ng){let e=pn-r.foregroundMs,t=Math.min(n,e);r.foregroundMs+=t,r.activeMs+=Math.min(t,Math.max(0,o+$h-i))}i=e,a=t},d=(e=!1)=>{!r||!t||r.foregroundMs<1||(e||Math.floor(r.foregroundMs)!==l)&&(l=Math.floor(r.foregroundMs),s=i,Vt({event:`ui.page_time`,page:t,visitId:r.id,foregroundMs:l,activeMs:Math.floor(r.activeMs),completed:e}))},f=()=>{r={id:dr(),foregroundMs:0,activeMs:0},l=0,s=i,o=i},p=()=>{u();let e=document.visibilityState===`visible`&&document.hasFocus();c&&!e&&d(),!c&&e&&(o=i),c=e},m=()=>{u(),c&&(o=i)},h=()=>{u(),d(!0),r=null,c=!1},g=()=>{p(),t&&!r&&f()},_=window.setInterval(()=>{u(),i-s>=eg&&d()},tg),v=[`pointerdown`,`pointermove`,`keydown`,`scroll`,`touchstart`];for(let e of v)document.addEventListener(e,m,{passive:!0,capture:!0});return document.addEventListener(`visibilitychange`,p),window.addEventListener(`focus`,p),window.addEventListener(`blur`,p),window.addEventListener(`pagehide`,h),window.addEventListener(`pageshow`,g),{clear(){r=null,t=null,n=void 0},navigate(i,a){if(e)return;let o=yn(i);t===o&&n===a&&r||(u(),d(!0),t=o,n=a,c=document.visibilityState===`visible`&&document.hasFocus(),f())},stop(){e=!0,r=null,window.clearInterval(_);for(let e of v)document.removeEventListener(e,m,!0);document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`focus`,p),window.removeEventListener(`blur`,p),window.removeEventListener(`pagehide`,h),window.removeEventListener(`pageshow`,g)}}}var ig=!1,ag;async function og(e){return(await Qn({client:X,body:e,keepalive:!0})).data}function sg(){ig||typeof window>`u`||(ig=!0,!(Ln()||wt())&&(ag=rg(),nt({send:og,onDisabled:()=>ag?.stop()}),X.interceptors.request.use((e,t)=>{let n=t.fetch??globalThis.fetch,r=typeof t.url==`string`?t.url:void 0;return t.fetch=async(t,i)=>{try{return await n(t,i)}catch(t){throw t instanceof DOMException&&t.name===`AbortError`||ft({method:e.method,route:r,network:!0}),t}},e}),X.interceptors.response.use((e,t,n)=>(ft({method:t.method,route:typeof n.url==`string`?n.url:void 0,path:lg(t.url),status:e.status}),e)),window.addEventListener(`error`,e=>{Ft({kind:`unhandled`,error:e.error})}),window.addEventListener(`unhandledrejection`,e=>{Ft({kind:`unhandled`,error:e.reason})}),mg()))}function cg(e){let t=null,n=()=>{let n=e.state.matches.at(-1);if(!n)return;ag?.navigate(n.fullPath,e.state.location?.pathname),Rt(n.fullPath);let r=e.state.location;if(!r)return;let i=r.search&&typeof r.search==`object`?r.search:{};t&&t.pathname===r.pathname&&Pr(t.search,i),t={pathname:r.pathname,search:i}};n();let r=e.subscribe(`onResolved`,n);return()=>{r(),ag?.clear()}}function lg(e){try{return new URL(e,window.location.origin).pathname}catch{return}}var ug={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function dg(e,t){let[n,r]=ug[e];return t<=n?`good`:t<=r?`needs-improvement`:`poor`}function fg(){let e=0,t=0,n=-1/0,r=-1/0;return{add(i){i.hadRecentInput||(i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,e=Math.max(e,t))},value:()=>e}}function pg(){let e=0;return{add(t){t.interactionId&&(e=Math.max(e,t.duration))},value:()=>e}}function mg(){if(typeof PerformanceObserver>`u`)return;let e=new Set,t=(t,n)=>{!e.has(t)&&Number.isFinite(n)&&(e.add(t),Be(t,dg(t,n)))},n=(e,t,n={})=>{try{new PerformanceObserver(e=>t(e.getEntries())).observe({type:e,buffered:!0,...n})}catch{}};try{let e=performance.getEntriesByType(`navigation`)[0];e&&e.responseStart>0&&t(`TTFB`,e.responseStart)}catch{}n(`paint`,e=>{let n=e.find(e=>e.name===`first-contentful-paint`);n&&t(`FCP`,n.startTime)});let r=0;n(`largest-contentful-paint`,e=>{let t=e.at(-1);t&&(r=t.startTime)});let i=fg();n(`layout-shift`,e=>{for(let t of e)i.add({startTime:t.startTime,value:t.value??0,hadRecentInput:t.hadRecentInput===!0})});let a=pg();n(`event`,e=>{for(let t of e)a.add(t)},{durationThreshold:40});let o=()=>{r>0&&t(`LCP`,r),t(`CLS`,i.value()),a.value()>0&&t(`INP`,a.value())};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&o()}),window.addEventListener(`pagehide`,o)}var hg=6e4,gg=`Anyone with this password can sign in to this dashboard.`,_g={label:`Root API key`,help:`To create the password from here, enter the root API key (apiKey in config.yaml). It is used once and not saved.`,missing:`Enter the root API key.`,rejected:`That is not the root API key for this install.`,show:`Show passwords and key`},vg={id:`embed`,scopes:[`read`,`embed`],projectId:`embed`,readOnly:!0};function yg(){let e=(0,Z.useRef)(sn()).current,[t,n]=(0,Z.useState)(e?`ready`:`checking`),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(e),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(`password`),[C,w]=(0,Z.useState)(!1),[T]=(0,Z.useState)(()=>new URLSearchParams(window.location.search).get(`token`)),E=(0,Z.useRef)(!1),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1),[L,ee]=(0,Z.useState)(!1),[R]=(0,Z.useState)(()=>pa().error),te=(0,Z.useRef)(null),z=(0,Z.useRef)(null),ne=(0,Z.useRef)(null),re=()=>{let t=r?`${r.name}:${r.role}`:e?`api-key:explicit`:a?`api-key:${a.id}`:`no-accounts`;if(!te.current||ne.current!==t){z.current?.clear();let e=ii();z.current=e,te.current=Qh(e),ne.current=t}return{queryClient:z.current,router:te.current}},ie=t===`ready`?re().router:null;(0,Z.useEffect)(()=>{if(ie)return cg(ie)},[ie]);let ae=e=>e.authRequired?(u(!0),I(e.signInMethods?.chatgpt===!0),i(e.user),o(null),c(!1),n(e.user?`ready`:`account-login`),!0):!1;(0,Z.useEffect)(()=>{if(!T)return;let e=new URL(window.location.href);e.searchParams.delete(`token`),window.history.replaceState(null,``,e)},[]),(0,Z.useEffect)(()=>{let t=!1,r=async(e,r=!1)=>{try{let e=await ct();if(t)return;o(e),c(!1),n(`ready`)}catch(i){if(t)return;if(r&&i instanceof tr&&i.statusCode===401)return It().then(()=>{t||(A(null),o(null),c(!1),P(!0),n(`login`))}).catch(r=>{t||(A(r instanceof Error?r.message:`Could not clear the invalid session`),n(e))});A(i instanceof Error?i.message:`Could not verify API key access`),n(e)}};return e?(r(`api-key-error`),()=>{t=!0}):(Promise.allSettled([Mr(),ln()]).then(([e,i])=>{if(t||e.status===`fulfilled`&&ae(e.value))return;if(i.status===`rejected`){let e=i.reason;A(e instanceof Error?e.message:`Failed to reach the Canonry API`),n(`login`);return}let a=i.value;a.authenticated&&Ln()?(o(vg),c(!1),n(`ready`)):a.authenticated?(c(!0),r(`api-key-error`,!0)):a.setupRequired&&T&&!E.current?(E.current=!0,o(null),c(!1),oe(T)):(o(null),c(!1),n(a.setupRequired?`setup`:`login`))}),()=>{t=!0})},[]),(0,Z.useEffect)(()=>{if(t!==`ready`||e)return;let r=setInterval(()=>{l?Mr().then(e=>{e.authRequired&&!e.user&&(P(!0),i(null),o(null),n(`account-login`))}).catch(()=>{}):ln().then(e=>{e.authenticated||(P(!0),o(null),n(e.setupRequired?`setup`:`login`))}).catch(()=>{})},hg);return mr(()=>{P(!0),i(null),o(null),c(!1),n(l?`account-login`:`login`)}),()=>{clearInterval(r),mr(null)}},[t,l,e]);let oe=async e=>{let t=()=>{let e=new URL(window.location.href);e.searchParams.delete(`token`),window.history.replaceState(null,``,e)};try{if(!(await nr(e)).authenticated)throw Error(`Setup failed`);t(),P(!1),o(null),c(!0),n(`checking`);try{let e=await ct();o(e),c(!1),n(`ready`)}catch(e){A(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){t(),A(e instanceof tr&&e.statusCode===401?`This setup link has already been used or is no longer valid. Create a dashboard password to continue.`:e instanceof Error?e.message:`Setup failed`),o(null),c(!1),n(`setup`)}},se=async e=>{if(e.preventDefault(),!p.trim()||p.trim().length<8){A(`Password must be at least 8 characters`);return}if(p!==g){A(`Passwords do not match`);return}let t=D.trim();if(C&&!t)A(_g.missing);else{M(!0),A(null);try{if(!(await tn(p.trim(),C?t:void 0)).authenticated){A(`Setup failed`);return}m(``),_(``),O(``),w(!1),y(!1),P(!1),o(null),c(!0),n(`checking`);try{let e=await ct();o(e),c(!1),n(`ready`)}catch(e){A(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){if(e instanceof tr&&e.statusCode===401&&e.code===`AUTH_REQUIRED`){A(C?_g.rejected:null),w(!0);return}A(e instanceof tr||e instanceof Error?e.message:`Setup failed`)}finally{M(!1)}}},ce=e=>{m(e),A(null)},B=e=>{O(e),A(null)},V=e=>{_(e),A(null)},le=async e=>{if(e.preventDefault(),p.trim()){M(!0),A(null);try{if(!(x===`api-key`?await at(p.trim()):await mt(p.trim())).authenticated){A(x===`api-key`?`Invalid API key`:`Incorrect password`);return}let e=await ct();o(e),c(!1),m(``),y(!1),P(!1),n(`ready`)}catch(e){A(e instanceof tr||e instanceof Error?e.message:`Authentication failed`)}finally{M(!1)}}},ue=e=>{S(e),m(``),y(!1),A(null)},de=async e=>{if(e.preventDefault(),d.trim()&&p){M(!0),A(null);try{let e=await sr(d.trim(),p);if(!e.user){A(`Incorrect name or password.`);return}m(``),P(!1),i(e.user),o(null),c(!1),n(`ready`)}catch(e){A(e instanceof tr?e.message:`Incorrect name or password.`)}finally{M(!1)}}};if(t===`ready`){let{queryClient:e,router:t}=re();return(0,Q.jsx)(ti,{account:r,apiKey:a,apiKeyPending:s,children:(0,Q.jsx)(he,{client:e,children:(0,Q.jsx)(Te,{router:t})})})}let fe=p.trim(),H=p.length>0&&fe.length<8,pe=g.length>0&&p!==g,me=fe.length>=8&&p===g&&(!C||D.trim().length>0),ge=e=>(0,Q.jsxs)(`form`,{id:e.formId,className:`space-y-4`,onSubmit:ni(de),children:[(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-name`,children:[(0,Q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Name`}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`account-name`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`text`,name:`username`,autoComplete:`username`,value:d,onChange:e=>{f(e.target.value),A(null)},"aria-invalid":!!k,"aria-describedby":k?`account-login-error`:void 0})]}),(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-password`,children:[(0,Q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Password`}),(0,Q.jsx)(`input`,{id:`account-password`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:`password`,name:`password`,autoComplete:`current-password`,value:p,onChange:e=>ce(e.target.value),"aria-invalid":!!k,"aria-describedby":k?`account-login-error`:void 0})]}),k?(0,Q.jsx)(`p`,{id:`account-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:k}):null,(0,Q.jsx)(J,{type:`submit`,variant:e.secondary?`secondary`:`default`,disabled:j||!d.trim()||!p,children:j?`Signing in…`:`Sign in`})]});return(0,Q.jsx)(`div`,{className:`min-h-screen bg-bg px-4 py-8`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5`,children:[(0,Q.jsxs)(`div`,{"data-testid":`auth-brand`,className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(ro,{className:`size-7`}),(0,Q.jsx)(`span`,{className:`text-label-18-strong text-heading`,children:`Canonry`})]}),(0,Q.jsx)(Ji,{className:`surface-card w-full`,children:t===`checking`?(0,Q.jsx)(Ki,{className:`py-8`,children:(0,Q.jsx)(`p`,{className:`supporting-copy text-center`,children:`Connecting to Canonry…`})}):t===`api-key-error`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{children:(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Could not verify API key access`})}),(0,Q.jsxs)(Ki,{className:`space-y-4`,children:[(0,Q.jsx)(`p`,{className:`supporting-copy`,children:k??`Canonry could not verify this session’s access, so the dashboard stayed locked.`}),(0,Q.jsx)(J,{type:`button`,className:`w-full`,onClick:()=>{window.location.reload()},children:`Try again`})]})]}):t===`account-login`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{children:(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`})}),F?(0,Q.jsxs)(Ki,{className:`space-y-4`,children:[N?(0,Q.jsx)(`p`,{className:`rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`You were signed out. Sign in again.`}):R?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:Yn[R]}):null,(0,Q.jsx)(Kc,{href:an(`login`,ma()),className:`w-full`}),(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":L,"aria-controls":`account-password-form`,onClick:()=>ee(e=>!e),className:`flex items-center gap-1 rounded-md text-label-14 text-secondary transition hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[L?(0,Q.jsx)(h,{className:`h-4 w-4`,"aria-hidden":`true`}):(0,Q.jsx)(b,{className:`h-4 w-4`,"aria-hidden":`true`}),`Sign in with a password`]}),L?ge({secondary:!0,formId:`account-password-form`}):null]}):(0,Q.jsxs)(Ki,{children:[N?(0,Q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`You were signed out. Sign in again.`}):null,ge({secondary:!1})]})]}):t===`setup`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Gi,{children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Create a dashboard password`}),(0,Q.jsx)(qi,{children:gg})]}),(0,Q.jsx)(Ki,{children:(0,Q.jsxs)(`form`,{className:`space-y-4`,onSubmit:ni(se),children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-new`,children:`Password`}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-new`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:`new-password`,autoComplete:`new-password`,minLength:8,required:!0,value:p,onChange:e=>ce(e.target.value),"aria-invalid":H,"aria-describedby":`dashboard-password-new-help`}),(0,Q.jsx)(`span`,{id:`dashboard-password-new-help`,"aria-live":`polite`,className:H?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:H?`Enter at least 8 characters.`:`Use at least 8 characters.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-confirm`,children:`Confirm password`}),(0,Q.jsx)(`input`,{id:`dashboard-password-confirm`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:`confirm-password`,autoComplete:`new-password`,minLength:8,required:!0,value:g,onChange:e=>V(e.target.value),"aria-invalid":pe,"aria-describedby":`dashboard-password-confirm-help`}),(0,Q.jsx)(`span`,{id:`dashboard-password-confirm-help`,"aria-live":`polite`,className:pe?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:pe?`Passwords do not match.`:`Enter the same password again.`})]}),C?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-setup-root-key`,children:_g.label}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`dashboard-setup-root-key`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:`apiKey`,autoComplete:`off`,spellCheck:!1,required:!0,value:D,onChange:e=>B(e.target.value),"aria-invalid":k===_g.rejected,"aria-describedby":`dashboard-setup-root-key-help`}),(0,Q.jsx)(`span`,{id:`dashboard-setup-root-key-help`,"aria-live":`polite`,className:`block text-label-14 text-secondary`,children:_g.help})]}):null,(0,Q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-password-show`,children:[(0,Q.jsx)(`input`,{id:`dashboard-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),C?_g.show:`Show passwords`]}),k?(0,Q.jsx)(`p`,{id:`dashboard-password-setup-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:k}):null,(0,Q.jsx)(J,{type:`submit`,disabled:j||!me,children:j?`Creating password…`:`Create password and continue`})]})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Gi,{children:[(0,Q.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`}),(0,Q.jsx)(qi,{children:x===`api-key`?`Enter an API key from this Canonry install. This opens the dashboard with that key’s access and does not change the password.`:`Enter your dashboard password to continue.`})]}),(0,Q.jsxs)(Ki,{children:[N?(0,Q.jsx)(`p`,{className:`mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:`Your session expired. Sign in again.`}):null,(0,Q.jsxs)(`form`,{className:`space-y-4`,onSubmit:ni(le),children:[(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`dashboard-password-current`,children:[(0,Q.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:x===`api-key`?`Canonry API key`:`Password`}),(0,Q.jsx)(`input`,{autoFocus:!0,id:`dashboard-password-current`,className:`w-full rounded-md border border-base bg-bg px-3 py-2 text-label-14 text-heading outline-none transition focus:border-mono-600`,type:v?`text`:`password`,name:x===`api-key`?`apiKey`:`password`,autoComplete:x===`api-key`?`off`:`current-password`,spellCheck:!1,required:!0,value:p,onChange:e=>ce(e.target.value),"aria-invalid":!!k,"aria-describedby":k?`dashboard-password-login-error`:void 0})]}),(0,Q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-login-password-show`,children:[(0,Q.jsx)(`input`,{id:`dashboard-login-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),x===`api-key`?`Show API key`:`Show password`]}),k?(0,Q.jsx)(`p`,{id:`dashboard-password-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:k}):null,(0,Q.jsx)(J,{type:`submit`,disabled:j||!p.trim(),children:j?`Signing in…`:`Open dashboard`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>ue(x===`api-key`?`password`:`api-key`),children:x===`api-key`?`Use dashboard password instead`:`Forgot password? Use API key`})]})]})]})})]})})}var bg=document.getElementById(`root`);if(!bg)throw Error(`Expected #root element for web app bootstrap.`);sg(),(0,ta.createRoot)(bg).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(fo,{children:(0,Q.jsx)(yg,{})})}));export{Dc as $,qd as A,Da as At,Nu as B,Cf as C,qa as Ct,df as D,wa as Dt,hf as E,Ya as Et,wd as F,Lc as G,_u as H,Td as I,Nc as J,Uc as K,_d as L,Hd as M,Dd as N,pf as O,Ea as Ot,bd as P,Mc as Q,gd as R,yf as S,oo as St,bf as T,Ja as Tt,fl as U,Mu as V,Rc as W,Ec as X,Oc as Y,Ac as Z,Wf as _,bo as _t,$p as a,Ks as at,Ff as b,_o as bt,Mp as c,_s as ct,cp as d,Vo as dt,jc as et,Yf as f,Fo as ft,Gf as g,So as gt,Hf as h,Co as ht,rm as i,Js as it,Bd as j,_a as jt,ff as k,ba as kt,gp as l,Ho as lt,zf as m,ko as mt,em as n,$s as nt,tm as o,Us as ot,Zf as p,Ao as pt,Hc as q,nm as r,Zs as rt,Kp as s,Vs as st,am as t,bc as tt,tp as u,Io as ut,Lf as v,xo as vt,gf as w,$a as wt,If as x,mo as xt,Pf as y,yo as yt,yd as z};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{lt as t,n}from"./vendor-lucide-C3F7vHjd.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./vendor-radix-CXYx3LLU.js";import{r as u}from"./vendor-markdown-DMxglFrF.js";import{a as d}from"./ToneBadge-DSr49xyr.js";function f(e){return e!==``&&/^[\w./:@%+=,-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var p=e(t(),1),m=u(),h=l,g=o,_=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(r,{ref:n,className:d(`fixed inset-0 z-50 bg-overlay-scrim/70 backdrop-blur-sm`,e),...t}));_.displayName=r.displayName;var v=400,y=1200,b=720,x=p.forwardRef(({className:e,children:t,...r},i)=>{let[o,c]=p.useState(b),l=p.useRef(!1),u=p.useRef(0),f=p.useRef(0),h=p.useCallback(e=>{l.current=!0,u.current=e.clientX,f.current=o,e.target.setPointerCapture(e.pointerId),e.preventDefault()},[o]),x=p.useCallback(e=>{if(!l.current)return;let t=u.current-e.clientX,n=Math.min(y,Math.max(v,f.current+t));c(n)},[]),S=p.useCallback(()=>{l.current=!1},[]);return(0,m.jsxs)(g,{children:[(0,m.jsx)(_,{}),(0,m.jsxs)(s,{ref:i,className:d(`material-modal fixed z-50 flex flex-col px-5 py-4 overflow-hidden`,`max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-b-none`,`md:inset-y-0 md:right-0 md:h-full md:rounded-none`,e),style:{width:`min(${o}px, 100vw)`},...r,children:[(0,m.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-mono-700/50 active:bg-mono-600/50 transition-colors max-md:hidden`,onPointerDown:h,onPointerMove:x,onPointerUp:S}),t,(0,m.jsxs)(a,{className:`absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-muted transition hover:bg-bg-elevated hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,m.jsx)(n,{className:`size-4`}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});x.displayName=s.displayName;var S=({className:e,...t})=>(0,m.jsx)(`div`,{className:d(`flex flex-col gap-1.5 pr-10`,e),...t}),C=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(c,{ref:n,className:d(`text-heading-20 text-primary`,e),...t}));C.displayName=c.displayName;var w=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(i,{ref:n,className:d(`text-copy-14 text-secondary`,e),...t}));w.displayName=i.displayName;var T=`a, button, input, select, textarea, label, summary, details, [role="button"], [role="link"], [role="checkbox"], [role="menuitem"]`;function E(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.target;if(t&&typeof t.closest==`function`){let n=t.closest(T),r=e.currentTarget;if(n&&(typeof r?.contains!=`function`||r.contains(n)))return!1}let n=typeof window<`u`?window.getSelection():null;return!(n&&!n.isCollapsed&&n.toString().trim()!==``)}var D=`modulepreload`,O=function(e,t){return new URL(e,t).href},k={},A=function(e){return e.pathname.endsWith(`.css`)},j=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},M=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=O(t,n);let r=s(t),i=A(r);return j(k,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:D,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{w as a,f as c,x as i,E as n,S as o,h as r,C as s,M as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{lt as t,n}from"./vendor-lucide-C3F7vHjd.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./vendor-radix-CXYx3LLU.js";import{r as u}from"./vendor-markdown-DMxglFrF.js";import{a as d}from"./ToneBadge-CvjNM6Ls.js";function f(e){return e!==``&&/^[\w./:@%+=,-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var p=e(t(),1),m=u(),h=l,g=o,_=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(r,{ref:n,className:d(`fixed inset-0 z-50 bg-overlay-scrim/70 backdrop-blur-sm`,e),...t}));_.displayName=r.displayName;var v=400,y=1200,b=720,x=p.forwardRef(({className:e,children:t,...r},i)=>{let[o,c]=p.useState(b),l=p.useRef(!1),u=p.useRef(0),f=p.useRef(0),h=p.useCallback(e=>{l.current=!0,u.current=e.clientX,f.current=o,e.target.setPointerCapture(e.pointerId),e.preventDefault()},[o]),x=p.useCallback(e=>{if(!l.current)return;let t=u.current-e.clientX,n=Math.min(y,Math.max(v,f.current+t));c(n)},[]),S=p.useCallback(()=>{l.current=!1},[]);return(0,m.jsxs)(g,{children:[(0,m.jsx)(_,{}),(0,m.jsxs)(s,{ref:i,className:d(`material-modal fixed z-50 flex flex-col px-5 py-4 overflow-hidden`,`max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-b-none`,`md:inset-y-0 md:right-0 md:h-full md:rounded-none`,e),style:{width:`min(${o}px, 100vw)`},...r,children:[(0,m.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-mono-700/50 active:bg-mono-600/50 transition-colors max-md:hidden`,onPointerDown:h,onPointerMove:x,onPointerUp:S}),t,(0,m.jsxs)(a,{className:`absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-muted transition hover:bg-bg-elevated hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,m.jsx)(n,{className:`size-4`}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});x.displayName=s.displayName;var S=({className:e,...t})=>(0,m.jsx)(`div`,{className:d(`flex flex-col gap-1.5 pr-10`,e),...t}),C=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(c,{ref:n,className:d(`text-heading-20 text-primary`,e),...t}));C.displayName=c.displayName;var w=p.forwardRef(({className:e,...t},n)=>(0,m.jsx)(i,{ref:n,className:d(`text-copy-14 text-secondary`,e),...t}));w.displayName=i.displayName;var T=`a, button, input, select, textarea, label, summary, details, [role="button"], [role="link"], [role="checkbox"], [role="menuitem"]`;function E(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.target;if(t&&typeof t.closest==`function`){let n=t.closest(T),r=e.currentTarget;if(n&&(typeof r?.contains!=`function`||r.contains(n)))return!1}let n=typeof window<`u`?window.getSelection():null;return!(n&&!n.isCollapsed&&n.toString().trim()!==``)}var D=`modulepreload`,O=function(e,t){return new URL(e,t).href},k={},A=function(e){return e.pathname.endsWith(`.css`)},j=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},M=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=O(t,n);let r=s(t),i=A(r);return j(k,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:D,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{w as a,f as c,x as i,E as n,S as o,h as r,C as s,M as t};
@@ -1 +1 @@
1
- import{C as e,w as t}from"./vendor-tanstack-ZnWhYpCU.js";import{xt as n}from"./ToneBadge-DSr49xyr.js";var r=6e3,i=5,a=180,o=[],s=0,c=new Set,l=new Map,u=new Map;function d(){let e=[...o];for(let t of c)t(e)}function f(e){let t=l.get(e);t&&(clearTimeout(t),l.delete(e));let n=u.get(e);n&&(clearTimeout(n),u.delete(e))}function p(e){f(e);let t=o.length;o=o.filter(t=>t.id!==e),o.length!==t&&d()}function m(e){f(e.id),l.set(e.id,setTimeout(()=>{_(e.id)},e.durationMs))}function h(e,t,n){return typeof e==`string`?{title:e,tone:t,durationMs:n}:e}function g(e,t=`negative`,n=r){let a=h(e,t,n),c={id:String(++s),title:a.title,detail:a.detail,tone:a.tone??t,durationMs:a.durationMs??n,dedupeKey:a.dedupeKey,cta:a.cta,state:`open`};if(a.dedupeKey){let e=o.find(e=>e.dedupeKey===a.dedupeKey);if(e){if((a.dedupeMode??`drop`)===`drop`)return e.id;let t={...e,title:c.title,detail:c.detail,tone:c.tone,durationMs:c.durationMs,cta:c.cta,state:`open`};return o=o.map(n=>n.id===e.id?t:n),d(),m(t),e.id}}return o.length>=i&&p(o[0].id),o=[...o,c],d(),m(c),c.id}function _(e){let t=o.find(t=>t.id===e);t&&t.state!==`closing`&&(f(e),o=o.map(t=>t.id===e?{...t,state:`closing`}:t),d(),u.set(e,setTimeout(()=>{p(e)},a)))}function v(e){return c.add(e),()=>{c.delete(e)}}function y(){return o}var b={project:`getApiV1ProjectsByName`,google:`getApiV1ProjectsByNameGoogle`,gsc:`getApiV1ProjectsByNameGoogleGsc`,bing:`getApiV1ProjectsByNameBing`,ga:`getApiV1ProjectsByNameGa`,gbp:`getApiV1ProjectsByNameGbp`,ads:`getApiV1ProjectsByNameAds`,googleAds:`getApiV1ProjectsByNameGoogleAds`,gtm:`getApiV1ProjectsByNameGtm`,conversionTracking:`getApiV1ProjectsByNameConversionTracking`,traffic:`getApiV1ProjectsByNameTraffic`,discovery:`getApiV1ProjectsByNameDiscover`,researchRuns:`getApiV1ProjectsByNameResearchRuns`,visibilityReport:`getApiV1ProjectsByNameVisibilityReport`,queryTracking:`getApiV1ProjectsByNameQueryTracking`,technicalAeo:`getApiV1ProjectsByNameAgentReadiness`,seo:`getApiV1ProjectsByNameSeo`,trends:`getApiV1ProjectsByNameTrends`,sitemaps:`getApiV1ProjectsByNameSitemaps`,runs:`getApiV1ProjectsByNameRuns`,runAdmission:`getApiV1ProjectsByNameRunAdmission`,runPreview:`getApiV1ProjectsByNameRunPreview`};function x(e,t,n){let r=b[t];return e.invalidateQueries({predicate:e=>{let i=e.queryKey[0];return typeof i?._id==`string`&&(t===`project`?i._id===r:i._id.startsWith(r))&&(!n||i?.path?.name===n.projectName&&(n.profileId===void 0||i.query?.profileId===n.profileId))}})}function S(e,t){return e.invalidateQueries({predicate:e=>{let n=e.queryKey[0];return n?.path?.name!==t||typeof n._id!=`string`?!1:n._id.startsWith(`getApiV1ProjectsByNameMeasurement`)||n._id===b.queryTracking||n._id===b.visibilityReport||n._id===`getApiV1ProjectsByNameQueries`||n._id===`getApiV1ProjectsByName`}})}function C(e){return e!==void 0&&e.startsWith(`getApiV1ProjectsByNameAgent`)&&!e.startsWith(b.technicalAeo)}var w=new Set([`getApiV1Projects`,`getApiV1Runs`,`getApiV1History`,`getApiV1NotificationsEvents`]);function T(e,t,n){if(![`POST`,`PUT`,`PATCH`,`DELETE`].includes(t.method))return;let r=new URL(t.url).pathname.match(/\/api\/v1\/(.*)$/)?.[1];if(!r||/^(?:telemetry|feedback|auth|session)(?:\/|$)/.test(r))return;let i=r.match(/^projects\/([^/]+)(?:\/(.*))?$/),a=i?i[2]??``:r;if(t.method===`POST`&&a===`seo/refresh-intents`||t.method===`POST`&&/(?:^|\/)(?:[^/]*-preview|preview(?:-[^/]+)?|test|generate)$/.test(a))return;let o=n&&typeof n==`object`?n:null;if(o?.dryRun===!0||r.endsWith(`/results/clear`)&&o?.confirm!==!0)return;let s=i?decodeURIComponent(i[1]):null,c=i?.[2]?.startsWith(`agent/`)??!1,l=new Set(s?[s]:[]),u=new Set;if(s)for(let t of e.getQueryCache().getAll()){let e=t.queryKey[0],n=t.state.data,r=e?._id===`getApiV1Projects`&&Array.isArray(n)?n:n&&typeof n==`object`&&`project`in n?[n.project]:e?._id===`getApiV1ProjectsByName`?[n]:[];for(let e of r)e&&(e.name===s||e.id===s)&&(l.add(e.name),l.add(e.id),u.add(e.id))}let d=e=>{let t=e.queryKey[0];if(c)return t?.path?.name===s&&C(t._id)||e.queryKey[0]===`aero-preview`&&e.queryKey[1]===s;if(t?._id?.startsWith(`getApiV1ProjectsByName`)&&t.path?.name&&l.has(t.path.name))return!0;let n=e.queryKey[0];if([`projects`,`project-dashboard-full`,`project-overview-slim`].includes(n))return u.has(e.queryKey[1]);if([`sentiment`,`gbp-section-insights`,`analytics-metrics`,`aero-preview`].includes(n))return n===`analytics-metrics`&&i?.[2]?.startsWith(`competitors`)?!1:l.has(e.queryKey[1]);if(n===`setup`)return l.has(e.queryKey[2]);let r=e.state.data;return t?._id===`getApiV1RunsById`&&!!r?.projectId&&u.has(r.projectId)},f=e=>w.has(e.queryKey[0]?._id??``),p=t.method===`POST`&&/^(?:runs|(?:agent-readiness|technical-aeo)\/runs|discover\/run|backlinks\/extract|seo\/sync|google\/gsc\/(?:sync|inspect-sitemap)|bing\/inspect-sitemap|(?:gbp|ads|google-ads|gtm)\/sync)$/.test(a),m=e=>{let t=e.queryKey[0];return f(e)||[`getApiV1ProjectsByName`,`getApiV1ProjectsByNameOverview`,`getApiV1ProjectsByNameRuns`,`getApiV1ProjectsByNameRunPreview`,`getApiV1ProjectsByNameAgentReadinessRuns`,`getApiV1ProjectsByNameTimeline`].includes(t?._id??``)||[`getApiV1ProjectsByNameSeoOverview`,`getApiV1ProjectsByNameSeoRuns`,`getApiV1ProjectsByNameSeoStatus`].includes(t?._id??``)||e.queryKey[0]===`project-dashboard-full`&&e.queryKey[3]===`overview`},h=s?e=>d(e)&&(!p||m(e))||!c&&f(e):e=>!p||m(e);e.cancelQueries({predicate:h,type:`active`}),i&&!i[2]&&t.method===`DELETE`?(e.removeQueries({predicate:d}),e.setQueriesData({predicate:e=>e.queryKey[0]?._id===`getApiV1Projects`},e=>e?.filter(e=>!l.has(e.name)&&!l.has(e.id))),e.setQueriesData({predicate:e=>e.queryKey[0]?._id===`getApiV1Runs`},e=>e?.filter(e=>!u.has(e.projectId))),e.invalidateQueries({predicate:f})):e.invalidateQueries({predicate:h})}var E=3e5,D=18e5,O=3e4,k=6e4,A=3e4,j=2e3,M=3e4,N;function P(){let r=new e({defaultOptions:{queries:{staleTime:E,retry:1,refetchOnWindowFocus:!1}},mutationCache:new t({onError:(e,t,n,r)=>{r.meta?.skipGlobalErrorToast||g({title:e instanceof Error?e.message:`An unexpected error occurred`,tone:`negative`})}})});N?.();let i=new WeakSet,a=n.interceptors.request.use(e=>(i.add(e),e)),o=n.interceptors.response.use((e,t,n)=>(e.ok&&i.has(t)&&T(r,t,n.body),e));return N=()=>{n.interceptors.request.eject(a),n.interceptors.response.eject(o)},r}export{A as a,P as c,g as d,_ as f,j as i,x as l,v as m,k as n,D as o,y as p,M as r,O as s,E as t,S as u};
1
+ import{C as e,w as t}from"./vendor-tanstack-ZnWhYpCU.js";import{xt as n}from"./ToneBadge-CvjNM6Ls.js";var r=6e3,i=5,a=180,o=[],s=0,c=new Set,l=new Map,u=new Map;function d(){let e=[...o];for(let t of c)t(e)}function f(e){let t=l.get(e);t&&(clearTimeout(t),l.delete(e));let n=u.get(e);n&&(clearTimeout(n),u.delete(e))}function p(e){f(e);let t=o.length;o=o.filter(t=>t.id!==e),o.length!==t&&d()}function m(e){f(e.id),l.set(e.id,setTimeout(()=>{_(e.id)},e.durationMs))}function h(e,t,n){return typeof e==`string`?{title:e,tone:t,durationMs:n}:e}function g(e,t=`negative`,n=r){let a=h(e,t,n),c={id:String(++s),title:a.title,detail:a.detail,tone:a.tone??t,durationMs:a.durationMs??n,dedupeKey:a.dedupeKey,cta:a.cta,state:`open`};if(a.dedupeKey){let e=o.find(e=>e.dedupeKey===a.dedupeKey);if(e){if((a.dedupeMode??`drop`)===`drop`)return e.id;let t={...e,title:c.title,detail:c.detail,tone:c.tone,durationMs:c.durationMs,cta:c.cta,state:`open`};return o=o.map(n=>n.id===e.id?t:n),d(),m(t),e.id}}return o.length>=i&&p(o[0].id),o=[...o,c],d(),m(c),c.id}function _(e){let t=o.find(t=>t.id===e);t&&t.state!==`closing`&&(f(e),o=o.map(t=>t.id===e?{...t,state:`closing`}:t),d(),u.set(e,setTimeout(()=>{p(e)},a)))}function v(e){return c.add(e),()=>{c.delete(e)}}function y(){return o}var b={project:`getApiV1ProjectsByName`,google:`getApiV1ProjectsByNameGoogle`,gsc:`getApiV1ProjectsByNameGoogleGsc`,bing:`getApiV1ProjectsByNameBing`,ga:`getApiV1ProjectsByNameGa`,gbp:`getApiV1ProjectsByNameGbp`,ads:`getApiV1ProjectsByNameAds`,googleAds:`getApiV1ProjectsByNameGoogleAds`,gtm:`getApiV1ProjectsByNameGtm`,conversionTracking:`getApiV1ProjectsByNameConversionTracking`,traffic:`getApiV1ProjectsByNameTraffic`,discovery:`getApiV1ProjectsByNameDiscover`,researchRuns:`getApiV1ProjectsByNameResearchRuns`,visibilityReport:`getApiV1ProjectsByNameVisibilityReport`,queryTracking:`getApiV1ProjectsByNameQueryTracking`,technicalAeo:`getApiV1ProjectsByNameAgentReadiness`,seo:`getApiV1ProjectsByNameSeo`,trends:`getApiV1ProjectsByNameTrends`,sitemaps:`getApiV1ProjectsByNameSitemaps`,runs:`getApiV1ProjectsByNameRuns`,runAdmission:`getApiV1ProjectsByNameRunAdmission`,runPreview:`getApiV1ProjectsByNameRunPreview`};function x(e,t,n){let r=b[t];return e.invalidateQueries({predicate:e=>{let i=e.queryKey[0];return typeof i?._id==`string`&&(t===`project`?i._id===r:i._id.startsWith(r))&&(!n||i?.path?.name===n.projectName&&(n.profileId===void 0||i.query?.profileId===n.profileId))}})}function S(e,t){return e.invalidateQueries({predicate:e=>{let n=e.queryKey[0];return n?.path?.name!==t||typeof n._id!=`string`?!1:n._id.startsWith(`getApiV1ProjectsByNameMeasurement`)||n._id===b.queryTracking||n._id===b.visibilityReport||n._id===`getApiV1ProjectsByNameQueries`||n._id===`getApiV1ProjectsByName`}})}function C(e){return e!==void 0&&e.startsWith(`getApiV1ProjectsByNameAgent`)&&!e.startsWith(b.technicalAeo)}var w=new Set([`getApiV1Projects`,`getApiV1Runs`,`getApiV1History`,`getApiV1NotificationsEvents`]);function T(e,t,n){if(![`POST`,`PUT`,`PATCH`,`DELETE`].includes(t.method))return;let r=new URL(t.url).pathname.match(/\/api\/v1\/(.*)$/)?.[1];if(!r||/^(?:telemetry|feedback|auth|session)(?:\/|$)/.test(r))return;let i=r.match(/^projects\/([^/]+)(?:\/(.*))?$/),a=i?i[2]??``:r;if(t.method===`POST`&&a===`seo/refresh-intents`||t.method===`POST`&&/(?:^|\/)(?:[^/]*-preview|preview(?:-[^/]+)?|test|generate)$/.test(a))return;let o=n&&typeof n==`object`?n:null;if(o?.dryRun===!0||r.endsWith(`/results/clear`)&&o?.confirm!==!0)return;let s=i?decodeURIComponent(i[1]):null,c=i?.[2]?.startsWith(`agent/`)??!1,l=new Set(s?[s]:[]),u=new Set;if(s)for(let t of e.getQueryCache().getAll()){let e=t.queryKey[0],n=t.state.data,r=e?._id===`getApiV1Projects`&&Array.isArray(n)?n:n&&typeof n==`object`&&`project`in n?[n.project]:e?._id===`getApiV1ProjectsByName`?[n]:[];for(let e of r)e&&(e.name===s||e.id===s)&&(l.add(e.name),l.add(e.id),u.add(e.id))}let d=e=>{let t=e.queryKey[0];if(c)return t?.path?.name===s&&C(t._id)||e.queryKey[0]===`aero-preview`&&e.queryKey[1]===s;if(t?._id?.startsWith(`getApiV1ProjectsByName`)&&t.path?.name&&l.has(t.path.name))return!0;let n=e.queryKey[0];if([`projects`,`project-dashboard-full`,`project-overview-slim`].includes(n))return u.has(e.queryKey[1]);if([`sentiment`,`gbp-section-insights`,`analytics-metrics`,`aero-preview`].includes(n))return n===`analytics-metrics`&&i?.[2]?.startsWith(`competitors`)?!1:l.has(e.queryKey[1]);if(n===`setup`)return l.has(e.queryKey[2]);let r=e.state.data;return t?._id===`getApiV1RunsById`&&!!r?.projectId&&u.has(r.projectId)},f=e=>w.has(e.queryKey[0]?._id??``),p=t.method===`POST`&&/^(?:runs|(?:agent-readiness|technical-aeo)\/runs|discover\/run|backlinks\/extract|seo\/sync|google\/gsc\/(?:sync|inspect-sitemap)|bing\/inspect-sitemap|(?:gbp|ads|google-ads|gtm)\/sync)$/.test(a),m=e=>{let t=e.queryKey[0];return f(e)||[`getApiV1ProjectsByName`,`getApiV1ProjectsByNameOverview`,`getApiV1ProjectsByNameRuns`,`getApiV1ProjectsByNameRunPreview`,`getApiV1ProjectsByNameAgentReadinessRuns`,`getApiV1ProjectsByNameTimeline`].includes(t?._id??``)||[`getApiV1ProjectsByNameSeoOverview`,`getApiV1ProjectsByNameSeoRuns`,`getApiV1ProjectsByNameSeoStatus`].includes(t?._id??``)||e.queryKey[0]===`project-dashboard-full`&&e.queryKey[3]===`overview`},h=s?e=>d(e)&&(!p||m(e))||!c&&f(e):e=>!p||m(e);e.cancelQueries({predicate:h,type:`active`}),i&&!i[2]&&t.method===`DELETE`?(e.removeQueries({predicate:d}),e.setQueriesData({predicate:e=>e.queryKey[0]?._id===`getApiV1Projects`},e=>e?.filter(e=>!l.has(e.name)&&!l.has(e.id))),e.setQueriesData({predicate:e=>e.queryKey[0]?._id===`getApiV1Runs`},e=>e?.filter(e=>!u.has(e.projectId))),e.invalidateQueries({predicate:f})):e.invalidateQueries({predicate:h})}var E=3e5,D=18e5,O=3e4,k=6e4,A=3e4,j=2e3,M=3e4,N;function P(){let r=new e({defaultOptions:{queries:{staleTime:E,retry:1,refetchOnWindowFocus:!1}},mutationCache:new t({onError:(e,t,n,r)=>{r.meta?.skipGlobalErrorToast||g({title:e instanceof Error?e.message:`An unexpected error occurred`,tone:`negative`})}})});N?.();let i=new WeakSet,a=n.interceptors.request.use(e=>(i.add(e),e)),o=n.interceptors.response.use((e,t,n)=>(e.ok&&i.has(t)&&T(r,t,n.body),e));return N=()=>{n.interceptors.request.eject(a),n.interceptors.response.eject(o)},r}export{A as a,P as c,g as d,_ as f,j as i,x as l,v as m,k as n,D as o,y as p,M as r,O as s,E as t,S as u};