@canonry/canonry 7.104.4 → 7.105.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 (140) hide show
  1. package/assets/agent-workspace/skills/aero/SKILL.md +11 -0
  2. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +11 -2
  3. package/assets/assets/{AccessControls-hIgRxmCY.js → AccessControls-BL5Ohk1o.js} +1 -1
  4. package/assets/assets/{AgentSetupPage-BEYkXfMI.js → AgentSetupPage-DOlYQxIa.js} +1 -1
  5. package/assets/assets/{AuditHistoryPanel-B4RSWnDd.js → AuditHistoryPanel-YeKe0CdO.js} +1 -1
  6. package/assets/assets/{BacklinksPage-CU089NxY.js → BacklinksPage--cebdWId.js} +1 -1
  7. package/assets/assets/{ChartPrimitives-DfRYjnsb.js → ChartPrimitives-DXCNvCNq.js} +1 -1
  8. package/assets/assets/{HistoryPage-CtOK4bCH.js → HistoryPage-Bv5Nsm5B.js} +1 -1
  9. package/assets/assets/{MeasurementPropertyPage-C-XeLSL1.js → MeasurementPropertyPage-Czyfi0Cy.js} +1 -1
  10. package/assets/assets/{ProjectPage-HpOMuZBk.js → ProjectPage-DJe32kjK.js} +9 -9
  11. package/assets/assets/{RunsPage-CRnzj7dU.js → RunsPage-BBMqOkFs.js} +1 -1
  12. package/assets/assets/{ServerTrafficSection-x_7QecPB.js → ServerTrafficSection-DGWMEhEc.js} +1 -1
  13. package/assets/assets/{SettingsPage-BumPFoPz.js → SettingsPage-9PzZpqL2.js} +1 -1
  14. package/assets/assets/{ToneBadge-BoscSKWW.js → ToneBadge-DRmwaKRk.js} +2 -2
  15. package/assets/assets/{TrafficPage-CxEO_Y2c.js → TrafficPage-Cejn8Fnv.js} +1 -1
  16. package/assets/assets/{TrafficSourceDetailPage-D9me5kmv.js → TrafficSourceDetailPage-DIeCgXFX.js} +1 -1
  17. package/assets/assets/{account-context-n5iq1FxI.js → account-context-CfBDR6hl.js} +1 -1
  18. package/assets/assets/{agent-trust-copy-BWQkohiR.js → agent-trust-copy-DMeyA6SQ.js} +1 -1
  19. package/assets/assets/{card-CnZ3aU1G.js → card-CtxpcVrz.js} +1 -1
  20. package/assets/assets/{index-DPz1idfn.css → index-BfcVhcae.css} +1 -1
  21. package/assets/assets/{index-BEk3rfJu.js → index-C9zbuGlp.js} +3 -3
  22. package/assets/assets/{query-client-CTKEElDQ.js → query-client-HEvA-XRl.js} +1 -1
  23. package/assets/assets/{react-query-D-G5epGz.js → react-query-D-u-W_MC.js} +1 -1
  24. package/assets/assets/{react-sigma_core.esm.min-4Kr0Zt4p.js → react-sigma_core.esm.min-nHUsVjqN.js} +1 -1
  25. package/assets/assets/{server-traffic-Deh27adW.js → server-traffic-CiE8LDtb.js} +1 -1
  26. package/assets/assets/{service-Dur_GX4q.js → service-CpuZCGWk.js} +1 -1
  27. package/assets/index.html +9 -9
  28. package/dist/{ads-LPBLEQBU.js → ads-SDMYCM7U.js} +3 -3
  29. package/dist/{agent-NUQQRFIX.js → agent-KAJ7N4K5.js} +7 -7
  30. package/dist/{agent-ask-RLIEXI6J.js → agent-ask-VRBAA3LD.js} +3 -3
  31. package/dist/{agent-conversations-HXWBYGSK.js → agent-conversations-UJKZIBTJ.js} +3 -3
  32. package/dist/{agent-journeys-DZ4OK6RG.js → agent-journeys-ZEXWTKIX.js} +3 -3
  33. package/dist/{agent-memory-QASRDHY6.js → agent-memory-ZLNG67QP.js} +3 -3
  34. package/dist/{agent-providers-UNJBT65F.js → agent-providers-DC26H7L7.js} +3 -3
  35. package/dist/{agent-transcript-IYQDRVLL.js → agent-transcript-LQ7MD25B.js} +3 -3
  36. package/dist/{analytics-TGZAZQ4V.js → analytics-ECTVTHBL.js} +3 -3
  37. package/dist/{apply-OVSQL4ND.js → apply-PU5SMSQT.js} +3 -3
  38. package/dist/{backfill-QEYMNKWT.js → backfill-UOBJ74WV.js} +10 -10
  39. package/dist/{backlinks-TAEE5NW2.js → backlinks-5ACAELA4.js} +3 -3
  40. package/dist/{bing-Y47PPL2K.js → bing-EJAYJY2Q.js} +3 -3
  41. package/dist/{bootstrap-6SVPLI2X.js → bootstrap-67SLL4TQ.js} +10 -10
  42. package/dist/{cdp-AQQZBCSJ.js → cdp-RRK6SI5J.js} +7 -7
  43. package/dist/{chunk-MXCBG4Z7.js → chunk-237UH5XU.js} +1 -1
  44. package/dist/{chunk-2P2YNCJB.js → chunk-2NIALUNF.js} +1 -1
  45. package/dist/{chunk-VFT4AFA6.js → chunk-342SRLS4.js} +4 -4
  46. package/dist/{chunk-ZGAOBFAT.js → chunk-36E6ONH7.js} +1 -1
  47. package/dist/{chunk-WMZYHYKE.js → chunk-3YWBDKEM.js} +2 -2
  48. package/dist/{chunk-T52VRYI6.js → chunk-4RSE4WVE.js} +4 -4
  49. package/dist/{chunk-7X5YFLPM.js → chunk-4ZJ5OBHI.js} +2 -2
  50. package/dist/{chunk-VZXLMIPS.js → chunk-AP6NF7XZ.js} +3 -3
  51. package/dist/{chunk-FS65HPCW.js → chunk-CIRM6CYI.js} +2 -2
  52. package/dist/{chunk-FEHIXKYR.js → chunk-DNMJVN2G.js} +3 -3
  53. package/dist/{chunk-NWOPXLH3.js → chunk-DXHZAE7B.js} +3 -3
  54. package/dist/{chunk-MUBVE7E5.js → chunk-FX2WXFRS.js} +2 -2
  55. package/dist/{chunk-34ZFWATV.js → chunk-HOBBF66T.js} +1 -1
  56. package/dist/{chunk-5NU6BWCL.js → chunk-HUOJB576.js} +5 -5
  57. package/dist/{chunk-BNSSB6H4.js → chunk-IDSJ2UL7.js} +1 -1
  58. package/dist/{chunk-BDPFPPPQ.js → chunk-ITTJLJAV.js} +1 -1
  59. package/dist/{chunk-OBDOHDDJ.js → chunk-JCRR4R6U.js} +2 -2
  60. package/dist/{chunk-GOKYM7T5.js → chunk-KNDCEG3S.js} +923 -605
  61. package/dist/{chunk-7OGHD6Z2.js → chunk-KRMQHEHA.js} +22 -22
  62. package/dist/{chunk-VBNULTRM.js → chunk-KVBHT4RM.js} +1 -1
  63. package/dist/{chunk-ANAZ6ANA.js → chunk-KWZY4DGQ.js} +366 -366
  64. package/dist/{chunk-QZKQL65D.js → chunk-LOXYLU6K.js} +1 -1
  65. package/dist/{chunk-HM25YXM4.js → chunk-NF6H2HWJ.js} +7 -7
  66. package/dist/{chunk-CPLY2O4L.js → chunk-NW7CHK4V.js} +121 -4
  67. package/dist/{chunk-W6ORSOMS.js → chunk-QWVE4LB4.js} +1 -1
  68. package/dist/{chunk-2TFDE7HA.js → chunk-RMH7VXGG.js} +5 -5
  69. package/dist/{chunk-PQ6AORS2.js → chunk-T3NIHALJ.js} +4 -4
  70. package/dist/{chunk-TXH5BMVL.js → chunk-T45PRIHN.js} +3 -3
  71. package/dist/{chunk-T6TLIZEO.js → chunk-TBJKDTRW.js} +1 -1
  72. package/dist/{chunk-N5YFWTDQ.js → chunk-UPS2WHB3.js} +1 -1
  73. package/dist/{chunk-73SA4H5D.js → chunk-VTQMKA45.js} +1 -1
  74. package/dist/{chunk-HUH6676A.js → chunk-VZS2C7IA.js} +4 -4
  75. package/dist/{chunk-5KKU3YTF.js → chunk-XDCUJC4K.js} +4 -4
  76. package/dist/{chunk-O3HY3VSN.js → chunk-XZTCLR3G.js} +1 -1
  77. package/dist/{chunk-4PLVST2T.js → chunk-YO3SECAK.js} +2 -2
  78. package/dist/{chunk-2FWYWGIR.js → chunk-YW6J3STO.js} +1 -1
  79. package/dist/{chunk-KUNOMUUG.js → chunk-ZYG7V5RY.js} +7 -7
  80. package/dist/{citations-EPWMDINT.js → citations-F5X6YTXT.js} +4 -4
  81. package/dist/{cli-catalog-LOONVW4I.js → cli-catalog-3TK244WS.js} +3 -3
  82. package/dist/{cli-commands-3GFP4QFF.js → cli-commands-PFMEKY4J.js} +7 -7
  83. package/dist/cli.js +13 -13
  84. package/dist/{competitor-XUXFF3N5.js → competitor-3BLGH7MK.js} +3 -3
  85. package/dist/{content-X4VUI6Q4.js → content-7QRCYQT6.js} +3 -3
  86. package/dist/{dashboard-B5MO4JD6.js → dashboard-C42KGKG4.js} +6 -6
  87. package/dist/{demo-QTTEHPTG.js → demo-XYLOAE34.js} +1 -1
  88. package/dist/{demo-server-NQG5YAQE.js → demo-server-PTXOU2UU.js} +65 -15
  89. package/dist/{discover-Q53AI7AP.js → discover-LYRDQHZJ.js} +4 -4
  90. package/dist/{discover-eval-72A2EKS5.js → discover-eval-DPXWK35F.js} +3 -3
  91. package/dist/{doctor-PSJW22ME.js → doctor-57L3Q4O2.js} +3 -3
  92. package/dist/{evidence-BVP2S73D.js → evidence-K6K7BVTX.js} +3 -3
  93. package/dist/{export-cmd-3LZAJ24E.js → export-cmd-LIBMZHI5.js} +3 -3
  94. package/dist/{ga-VRCCYIOW.js → ga-U56VPNRX.js} +46 -5
  95. package/dist/{gbp-OK4CJ6JF.js → gbp-MRFDJ2HK.js} +3 -3
  96. package/dist/{google-GULK767N.js → google-QQDJNZ3O.js} +4 -4
  97. package/dist/{google-marketing-TQPEDQY6.js → google-marketing-MXFKQNQF.js} +1 -1
  98. package/dist/{health-cmd-IC5IQKBN.js → health-cmd-FECKLV5E.js} +4 -4
  99. package/dist/{history-EAEYLEVG.js → history-S3UJGH7B.js} +3 -3
  100. package/dist/index.d.ts +25 -25
  101. package/dist/index.js +26 -26
  102. package/dist/{init-SXOJJUNJ.js → init-X4WUARKM.js} +12 -12
  103. package/dist/{insights-ICTSKQD6.js → insights-2UAIY4EV.js} +3 -3
  104. package/dist/intelligence-service-64ZLE37W.js +16 -0
  105. package/dist/{journeys-H2BOW42B.js → journeys-44U2W4WQ.js} +3 -3
  106. package/dist/{keys-OTJZGBGX.js → keys-JKUNWJQN.js} +3 -3
  107. package/dist/{keyword-ZZ4SPADG.js → keyword-5W3PDFCZ.js} +3 -3
  108. package/dist/{logs-IH74KKBP.js → logs-67S2VOW2.js} +3 -3
  109. package/dist/{mcp-U736ZMVE.js → mcp-RBZEEULW.js} +4 -4
  110. package/dist/mcp.js +10 -10
  111. package/dist/{measurement-plan-EJ5H5S3X.js → measurement-plan-H2WHPS6M.js} +5 -5
  112. package/dist/{notify-PVTESANP.js → notify-5MHM43II.js} +3 -3
  113. package/dist/{organic-evidence-PGDCDE7I.js → organic-evidence-PT37WD5D.js} +3 -3
  114. package/dist/{overview-3QPRHIML.js → overview-YSGLVOQL.js} +5 -5
  115. package/dist/{project-FLF4NQYK.js → project-I7VQRW4I.js} +3 -3
  116. package/dist/{project-setup-HMIMB7LA.js → project-setup-ABNKGLKM.js} +3 -3
  117. package/dist/{query-WFNBO5IA.js → query-6HCKL366.js} +3 -3
  118. package/dist/{research-NOC77N5S.js → research-4D3GNHI6.js} +3 -3
  119. package/dist/{results-export-MQ372TJX.js → results-export-CHHMZU7K.js} +3 -3
  120. package/dist/{run-KQEZAMFC.js → run-TYIRQZD6.js} +5 -5
  121. package/dist/{schedule-RXJR7S5O.js → schedule-JLTS2OH4.js} +3 -3
  122. package/dist/{search-AVPIH3SH.js → search-LRBIRDUD.js} +3 -3
  123. package/dist/{serve-Z3WLVD46.js → serve-X7MZKZ3B.js} +27 -27
  124. package/dist/{session-HEV5XBJI.js → session-F3FYX2QK.js} +14 -14
  125. package/dist/{settings-FOPSQVXA.js → settings-K5SUV5Y4.js} +3 -3
  126. package/dist/{sitemaps-GOA3STCM.js → sitemaps-YWWBI67M.js} +3 -3
  127. package/dist/{skills-XJKTJ6LH.js → skills-ECQG3MBE.js} +2 -2
  128. package/dist/{snapshot-4W4FLLRV.js → snapshot-62BXAS6C.js} +3 -3
  129. package/dist/{src-VTBSLT3E.js → src-R53436JE.js} +2 -2
  130. package/dist/{status-DMP7OCRB.js → status-TNOLPP73.js} +5 -5
  131. package/dist/{technical-aeo-IBYKY4VO.js → technical-aeo-YDVU5TWC.js} +3 -3
  132. package/dist/{telemetry-PXSA7GSQ.js → telemetry-WBO4WDQB.js} +4 -4
  133. package/dist/{tools-B3B7I7OU.js → tools-BI3B6WLL.js} +11 -11
  134. package/dist/{traffic-USZLDNGC.js → traffic-CPSRCVU7.js} +5 -5
  135. package/dist/{trends-FT5WL6EZ.js → trends-TD6UGUYE.js} +3 -3
  136. package/dist/{users-C5QGTAEE.js → users-NPOXIJ3C.js} +3 -3
  137. package/dist/{visibility-stats-FJRKQAIB.js → visibility-stats-VHU4F3VL.js} +4 -4
  138. package/dist/{wordpress-DII4DF43.js → wordpress-OLPTUY5E.js} +3 -3
  139. package/package.json +1 -1
  140. package/dist/intelligence-service-MFMPHWQM.js +0 -16
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProjectPage-HpOMuZBk.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-iE5MEh2-.js","./vendor-radix-DKCt5Z_h.js","./vendor-markdown-BBGbNklj.js","./vendor-tanstack-B90HW50P.js","./vendor-recharts-D3MLFU3q.js","./ToneBadge-BoscSKWW.js","./AccessControls-hIgRxmCY.js","./ChartPrimitives-DfRYjnsb.js","./account-context-n5iq1FxI.js","./card-CnZ3aU1G.js","./async-handler-Bj3TnIRw.js","./query-client-CTKEElDQ.js","./react-query-D-G5epGz.js","./InfoTooltip-D29JcNMW.js","./use-tooltip-position-BOzm-6Wy.js","./Hint-3TTi0MgX.js","./AuditHistoryPanel-B4RSWnDd.js","./service-Dur_GX4q.js","./server-traffic-Deh27adW.js","./agent-trust-copy-BWQkohiR.js","./ServerTrafficSection-x_7QecPB.js","./RunsPage-CRnzj7dU.js","./HistoryPage-CtOK4bCH.js","./SettingsPage-BumPFoPz.js","./AgentSetupPage-BEYkXfMI.js","./BacklinksPage-CU089NxY.js","./TrafficPage-CxEO_Y2c.js","./TrafficSourceDetailPage-D9me5kmv.js","./MeasurementPropertyPage-C-XeLSL1.js"])))=>i.map(i=>d[i]);
2
- import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{C as n,D as r,E as i,F as a,G as o,I as s,J 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 _,V as v,W as y,Z as b,_ as x,a as S,at as C,ct as w,d as T,et as E,ft as D,h as O,it as k,j as A,k as j,l as M,lt as N,m as ee,n as P,nt as F,ot as I,r as te,rt as ne,s as L,st as re,tt as ie,u as ae,v as oe,w as se,x as ce,y as le,z as ue}from"./vendor-lucide-iE5MEh2-.js";import{a as R,c as z,i as de,n as fe,o as pe,r as me,s as B,t as he,u as ge}from"./vendor-radix-DKCt5Z_h.js";import{n as _e,r as ve,t as ye}from"./vendor-markdown-BBGbNklj.js";import{D as be,E as xe,O as Se,S as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,n as Pe,o as Fe,r as Ie,s as V,u as H,v as Le,x as U}from"./vendor-tanstack-B90HW50P.js";import{$n as Re,$s as ze,A as Be,Ac as Ve,An as He,Ao as Ue,At as We,Bc as Ge,Bt as Ke,Cc as qe,Cs as Je,Do as Ye,Ds as Xe,Dt as Ze,Eo as Qe,Es as $e,Et as et,Fc as tt,Fn as nt,Ft as rt,G as it,Gc as at,Gn as ot,Hc as st,I as ct,In as lt,It as ut,Jc as dt,Jn as ft,Jo as pt,Kc as mt,Kn as ht,Lc as W,Ln as gt,Ls as _t,M as vt,Mc as yt,Mn as bt,Mo as xt,Mt as St,Nn as Ct,Nt as wt,O as Tt,On as Et,Oo as Dt,Os as Ot,Ot as kt,P as At,Pc as jt,Pn as Mt,Q as Nt,Qc as Pt,Qn as Ft,Qo as It,R as Lt,Rn as Rt,Rt as zt,S as Bt,Sn as Vt,Ss as Ht,Tn as Ut,To as Wt,Un as Gt,Vn as Kt,Vt as qt,Wc as Jt,Wn as Yt,Ws as Xt,Xc as Zt,Xn as Qt,Xo as $t,Y as en,Ya as tn,Yc as nn,Yn as rn,Yo as an,Yt as on,Z as sn,Zc as cn,Zn as ln,Zo as un,_c as dn,_s as fn,a as pn,ac as mn,an as hn,at as gn,b as _n,bn as vn,bs as yn,bt as G,cc as bn,cn as xn,ct as Sn,d as Cn,dc as wn,dt as Tn,ec as En,en as Dn,et as On,f as kn,fn as An,ft as jn,gc as Mn,gs as K,hs as Nn,i as Pn,ic as Fn,in as In,it as Ln,j as Rn,jc as zn,jn as Bn,jo as Vn,k as Hn,kc as Un,kn as Wn,ko as Gn,ks as Kn,kt as qn,lc as Jn,ln as Yn,lt as Xn,mn as Zn,mt as Qn,n as $n,nc as er,nn as tr,nt as nr,o as rr,oc as ir,ot as ar,pn as or,pt as sr,qc as cr,qn as lr,r as q,rc as ur,rn as dr,rt as fr,sc as J,sn as pr,st as mr,t as hr,tt as gr,uc as _r,un as vr,vc as yr,vs as br,vt as xr,wc as Sr,wo as Cr,x as wr,xs as Tr,yn as Er,ys as Dr,yt as Or,zc as kr,zn as Ar,zs as jr}from"./ToneBadge-BoscSKWW.js";import{E as Mr,H as Nr,_ as Pr,n as Fr,t as Ir}from"./AccessControls-hIgRxmCY.js";import{D as Lr,F as Rr,I as zr,L as Br,O as Vr,k as Hr,v as Ur,w as Wr}from"./ChartPrimitives-DfRYjnsb.js";import{n as Gr,r as Kr,t as qr}from"./account-context-n5iq1FxI.js";import{t as Jr}from"./async-handler-Bj3TnIRw.js";import{a as Yr,c as Xr,d as Zr,f as Qr,i as $r,l as ei,m as ti,o as ni,p as ri,r as ii}from"./query-client-CTKEElDQ.js";import{Cn as ai,Ft as oi,Gn as si,Ht as ci,Mt as li,Nt as ui,Pt as di,Sn as fi,Tn as pi,Ut as mi,Vt as hi,Wt as gi,_n as _i,a as vi,an as yi,bn as bi,i as xi,l as Si,o as Ci,on as wi,r as Ti,s as Ei,vn as Di,wn as Oi,xn as ki,yn as Ai,zn as ji}from"./react-query-D-G5epGz.js";import{t as Mi}from"./InfoTooltip-D29JcNMW.js";import{i as Ni,n as Pi,r as Fi,t as Ii}from"./card-CnZ3aU1G.js";import{t as Li}from"./vendor-yaml-Y43rmNgW.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 Ri=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}}}})),zi=t(((e,t)=>{t.exports=Ri()})),Bi=t((e=>{var t=zi(),n=D(),r=ge();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`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),P=Symbol.for(`react.suspense`),F=Symbol.for(`react.suspense_list`),I=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),L=Symbol.for(`react.legacy_hidden`),re=Symbol.for(`react.memo_cache_sentinel`),ie=Symbol.for(`react.view_transition`),ae=Symbol.for(`react.recoverable`),oe=Symbol.iterator;function se(e){return typeof e!=`object`||!e?null:(e=oe&&e[oe]||e[`@@iterator`],typeof e==`function`?e:null)}var ce=Symbol.for(`react.client.reference`);function le(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case P:return`Suspense`;case F:return`SuspenseList`;case ne:return`Activity`;case ie:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case I:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var ue=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function B(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function he(e,t){pe++,fe[pe]=e.current,e.current=t}var _e=me(null),ve=me(null),ye=me(null),be=me(null);function xe(e,t){switch(he(ye,t),he(ve,e),he(_e,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}}B(_e),he(_e,e)}function Se(){B(_e),B(ve),B(ye)}function Ce(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,he(be,e)),t=_e.current;var n=dp(t,e.type);t!==n&&(he(ve,e),he(_e,n))}function we(e){ve.current===e&&(B(_e),B(ve)),be.current===e&&(B(be),sh._currentValue=de)}var Te,Ee;function De(e){if(Te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Te=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProjectPage-DJe32kjK.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-iE5MEh2-.js","./vendor-radix-DKCt5Z_h.js","./vendor-markdown-BBGbNklj.js","./vendor-tanstack-B90HW50P.js","./vendor-recharts-D3MLFU3q.js","./ToneBadge-DRmwaKRk.js","./AccessControls-BL5Ohk1o.js","./ChartPrimitives-DXCNvCNq.js","./account-context-CfBDR6hl.js","./card-CtxpcVrz.js","./async-handler-Bj3TnIRw.js","./query-client-HEvA-XRl.js","./react-query-D-u-W_MC.js","./InfoTooltip-D29JcNMW.js","./use-tooltip-position-BOzm-6Wy.js","./Hint-3TTi0MgX.js","./AuditHistoryPanel-YeKe0CdO.js","./service-CpuZCGWk.js","./server-traffic-CiE8LDtb.js","./agent-trust-copy-DMeyA6SQ.js","./ServerTrafficSection-DGWMEhEc.js","./RunsPage-BBMqOkFs.js","./HistoryPage-Bv5Nsm5B.js","./SettingsPage-9PzZpqL2.js","./AgentSetupPage-DOlYQxIa.js","./BacklinksPage--cebdWId.js","./TrafficPage-Cejn8Fnv.js","./TrafficSourceDetailPage-DIeCgXFX.js","./MeasurementPropertyPage-Czyfi0Cy.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{C as n,D as r,E as i,F as a,G as o,I as s,J 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 _,V as v,W as y,Z as b,_ as x,a as S,at as C,ct as w,d as T,et as E,ft as D,h as O,it as k,j as A,k as j,l as M,lt as N,m as ee,n as P,nt as F,ot as I,r as te,rt as ne,s as L,st as re,tt as ie,u as ae,v as oe,w as se,x as ce,y as le,z as ue}from"./vendor-lucide-iE5MEh2-.js";import{a as R,c as z,i as de,n as fe,o as pe,r as me,s as B,t as he,u as ge}from"./vendor-radix-DKCt5Z_h.js";import{n as _e,r as ve,t as ye}from"./vendor-markdown-BBGbNklj.js";import{D as be,E as xe,O as Se,S as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,n as Pe,o as Fe,r as Ie,s as V,u as H,v as Le,x as U}from"./vendor-tanstack-B90HW50P.js";import{$n as Re,$s as ze,A as Be,Ac as Ve,An as He,Ao as Ue,At as We,Bc as Ge,Bt as Ke,Cc as qe,Cs as Je,Do as Ye,Ds as Xe,Dt as Ze,Eo as Qe,Es as $e,Et as et,Fc as tt,Fn as nt,Ft as rt,G as it,Gc as at,Gn as ot,Hc as st,I as ct,In as lt,It as ut,Jc as dt,Jn as ft,Jo as pt,Kc as mt,Kn as ht,Lc as W,Ln as gt,Ls as _t,M as vt,Mc as yt,Mn as bt,Mo as xt,Mt as St,Nn as Ct,Nt as wt,O as Tt,On as Et,Oo as Dt,Os as Ot,Ot as kt,P as At,Pc as jt,Pn as Mt,Q as Nt,Qc as Pt,Qn as Ft,Qo as It,R as Lt,Rn as Rt,Rt as zt,S as Bt,Sn as Vt,Ss as Ht,Tn as Ut,To as Wt,Un as Gt,Vn as Kt,Vt as qt,Wc as Jt,Wn as Yt,Ws as Xt,Xc as Zt,Xn as Qt,Xo as $t,Y as en,Ya as tn,Yc as nn,Yn as rn,Yo as an,Yt as on,Z as sn,Zc as cn,Zn as ln,Zo as un,_c as dn,_s as fn,a as pn,ac as mn,an as hn,at as gn,b as _n,bn as vn,bs as yn,bt as G,cc as bn,cn as xn,ct as Sn,d as Cn,dc as wn,dt as Tn,ec as En,en as Dn,et as On,f as kn,fn as An,ft as jn,gc as Mn,gs as K,hs as Nn,i as Pn,ic as Fn,in as In,it as Ln,j as Rn,jc as zn,jn as Bn,jo as Vn,k as Hn,kc as Un,kn as Wn,ko as Gn,ks as Kn,kt as qn,lc as Jn,ln as Yn,lt as Xn,mn as Zn,mt as Qn,n as $n,nc as er,nn as tr,nt as nr,o as rr,oc as ir,ot as ar,pn as or,pt as sr,qc as cr,qn as lr,r as q,rc as ur,rn as dr,rt as fr,sc as J,sn as pr,st as mr,t as hr,tt as gr,uc as _r,un as vr,vc as yr,vs as br,vt as xr,wc as Sr,wo as Cr,x as wr,xs as Tr,yn as Er,ys as Dr,yt as Or,zc as kr,zn as Ar,zs as jr}from"./ToneBadge-DRmwaKRk.js";import{E as Mr,H as Nr,_ as Pr,n as Fr,t as Ir}from"./AccessControls-BL5Ohk1o.js";import{D as Lr,F as Rr,I as zr,L as Br,O as Vr,k as Hr,v as Ur,w as Wr}from"./ChartPrimitives-DXCNvCNq.js";import{n as Gr,r as Kr,t as qr}from"./account-context-CfBDR6hl.js";import{t as Jr}from"./async-handler-Bj3TnIRw.js";import{a as Yr,c as Xr,d as Zr,f as Qr,i as $r,l as ei,m as ti,o as ni,p as ri,r as ii}from"./query-client-HEvA-XRl.js";import{Cn as ai,Ft as oi,Gn as si,Ht as ci,Mt as li,Nt as ui,Pt as di,Sn as fi,Tn as pi,Ut as mi,Vt as hi,Wt as gi,_n as _i,a as vi,an as yi,bn as bi,i as xi,l as Si,o as Ci,on as wi,r as Ti,s as Ei,vn as Di,wn as Oi,xn as ki,yn as Ai,zn as ji}from"./react-query-D-u-W_MC.js";import{t as Mi}from"./InfoTooltip-D29JcNMW.js";import{i as Ni,n as Pi,r as Fi,t as Ii}from"./card-CtxpcVrz.js";import{t as Li}from"./vendor-yaml-Y43rmNgW.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 Ri=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}}}})),zi=t(((e,t)=>{t.exports=Ri()})),Bi=t((e=>{var t=zi(),n=D(),r=ge();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`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),P=Symbol.for(`react.suspense`),F=Symbol.for(`react.suspense_list`),I=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),L=Symbol.for(`react.legacy_hidden`),re=Symbol.for(`react.memo_cache_sentinel`),ie=Symbol.for(`react.view_transition`),ae=Symbol.for(`react.recoverable`),oe=Symbol.iterator;function se(e){return typeof e!=`object`||!e?null:(e=oe&&e[oe]||e[`@@iterator`],typeof e==`function`?e:null)}var ce=Symbol.for(`react.client.reference`);function le(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case P:return`Suspense`;case F:return`SuspenseList`;case ne:return`Activity`;case ie:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case I:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var ue=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function B(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function he(e,t){pe++,fe[pe]=e.current,e.current=t}var _e=me(null),ve=me(null),ye=me(null),be=me(null);function xe(e,t){switch(he(ye,t),he(ve,e),he(_e,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}}B(_e),he(_e,e)}function Se(){B(_e),B(ve),B(ye)}function Ce(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,he(be,e)),t=_e.current;var n=dp(t,e.type);t!==n&&(he(ve,e),he(_e,n))}function we(e){ve.current===e&&(B(_e),B(ve)),be.current===e&&(B(be),sh._currentValue=de)}var Te,Ee;function De(e){if(Te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Te=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Te+e+Ee}var Oe=!1;function ke(e,t){if(!e||Oe)return``;Oe=!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
  `)),mt(!0)),re(!0))},[P.queriesText,x,M,u,L,E,mt,pt]),(0,Y.useEffect)(()=>{L&&(h({flowVersion:1,onboardingSessionId:p,event:`onboarding.started`,step:ln(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,L,g]),(0,Y.useEffect)(()=>{u||lr(c)&&lt&&h({flowVersion:1,onboardingSessionId:p,event:`onboarding.blocked`,step:`system`,action:lt===`no_provider`?`configure_provider`:`continue`,reasonCode:lt},`onboarding.blocked:system:${lt}`)},[h,c,u,p,lt]);let W=Qe.data?.status,gt=Qe.data?.snapshots?.length??0,vt=F===4&&V&&!!(W&&$p(W,gt)),yt=T&&!V;(0,Y.useEffect)(()=>{if(!V||!W)return;let e=Ie.current;if(!e||e!==We)return;if($p(W,gt)){h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`run`,method:`automatic`,countBucket:Gn(gt)},`onboarding.step_completed:run:${e}`),ft(e);return}let t=W===`cancelled`?`run_cancelled`:W===`failed`||(W===`completed`||W===`partial`)&&gt===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}`),ft(e))},[h,We,p,W,gt,V]);let bt=async()=>{if(at&&le){ye(!0),_e(null);try{let e=await Be(at,{displayName:se||ae,canonicalDomain:le,country:R,language:de,autoExtractBacklinks:pe});he(at),A.setEngineProject(e),Zr({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`),I(2)}catch(e){_e(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{ye(!1)}}},xt=async()=>{if(!B)return;let e=st;if(e.length!==0){Me(!0),Ae(null);try{await Dn(B,e),Oe(!0),await r(),h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`competitors`,method:`manual`,countBucket:Gn(e.length)},`onboarding.step_completed:competitors`),I(4)}catch(e){Ae(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{Me(!1)}}},St=async()=>{let e=$e.trim();if(e){nt(!0),it(null);try{await Wn(`gemini`,{apiKey:e}),Zr({title:`Gemini configured`,detail:`Connection saved. Your first check will verify it.`,tone:`positive`,dedupeKey:`setup:gemini:configured`,dedupeMode:`drop`}),et(``),await r(),Ce.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){it(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{nt(!1)}}},Ct=async()=>{if(qn()||Je.isError||Je.isFetching||Je.data?.canStart!==!0)return;if(!B||dt){Ue(dt??`Complete setup before launching the first check.`);let e=lt??(B?ct===0?`no_queries`:`run_rejected`:`unknown`);A.usesProjectProviderReadiness||h({flowVersion:1,onboardingSessionId:p,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:Gn(A.runnableProviderCount),queryCountBucket:Gn(ct),reasonCode:e});return}Ve(!0),Ue(null);let e=Je.data.requestCount;try{let t=await qe.mutateAsync({projectName:B,projectLabel:se||ae||B,sourceAction:`setup-launch`});Ze({runId:t.id,requestCount:e}),Ge(t.id),Le(!0),rn(B,t.id,J[`answer-visibility`]),Ie.current=t.id,A.usesProjectProviderReadiness||h({flowVersion:1,onboardingSessionId:p,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:Gn(A.runnableProviderCount),queryCountBucket:Gn(ct)}),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:Gn(A.runnableProviderCount),queryCountBucket:Gn(ct),reasonCode:Qt(e,`run_rejected`)})}finally{Ve(!1)}},wt=()=>I(e=>u?2:Math.max(0,e-1)),Tt=(e,t,n)=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:e,method:`existing`,...n===void 0?{}:{countBucket:Gn(n)}},`onboarding.step_completed:${e}`),I(t)},Et=()=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`queries`,method:`skipped`,countBucket:`0`},`onboarding.step_completed:queries`),u?xe():I(3)},Dt=()=>{h({flowVersion:1,onboardingSessionId:p,event:`onboarding.step_completed`,step:`competitors`,method:`skipped`,countBucket:`0`},`onboarding.step_completed:competitors`),I(4)},Ot=u?`section`:Ii,kt=u?be:wt,At=u&&F===2||F===4&&(A.showProviderConfig||A.providerReadiness!==!0)?(0,Z.jsx)(xp,{engines:A,headingLevel:`h2`,separated:!0}):null,jt=(()=>{switch(F){case 0:return(0,Z.jsxs)(Ii,{className:`surface-card step-card`,children:[(0,Z.jsx)(`div`,{className:`section-head`,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`h2`,{children:`System check`})})}),(0,Z.jsx)(`p`,{className:`supporting-copy`,children:`Checking that your Canonry instance is configured and reachable.`}),(0,Z.jsx)(`div`,{className:`compact-stack`,children:l.healthChecks.map(e=>(0,Z.jsxs)(`div`,{className:`health-check-row`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`run-row-title`,children:e.label}),(0,Z.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,Z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Z.jsxs)(`p`,{className:`text-copy-13 text-secondary`,children:[`Connect Gemini with a key from`,` `,(0,Z.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,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{type:`password`,"aria-label":`Gemini API key`,autoComplete:`new-password`,value:$e,onChange:e=>et(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:tt}),(0,Z.jsx)(q,{type:`button`,size:`sm`,disabled:tt||!$e.trim(),onClick:Jr(St),children:tt?`Saving…`:`Save`})]}),rt&&(0,Z.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-label-12 text-negative`,children:[(0,Z.jsx)(`p`,{children:rt}),(0,Z.jsx)(`p`,{children:`Check that the key is complete, then retry Save.`})]}),(0,Z.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Connect more answer engines later in`,` `,(0,Z.jsx)(H,{to:`/settings`,className:`text-link hover:underline`,children:`Settings`}),`.`]}),o.providerStatuses.some(e=>e.name===`openrouter`)&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-label-14 text-link`,children:`Connect OpenRouter`}),(0,Z.jsx)(lp,{providerName:`openrouter`,compact:!0,keyUrl:o.providerStatuses.find(e=>e.name===`openrouter`)?.keyUrl,onSaved:()=>{r()}})]})]})]}),(0,Z.jsx)(hr,{tone:e.state===`ready`?e.id===`provider`?A.connectionStatus.tone:`positive`:`caution`,title:e.id===`api`?au(c.apiStatus):e.id===`worker`?au(c.workerStatus):e.detail,children:e.state===`ready`?e.id===`provider`?A.connectionStatus.label:`Ready`:`Attention`})]},e.id))}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[l.launchState.blockedReason?(0,Z.jsx)(`p`,{role:`status`,className:`supporting-copy text-negative`,children:l.launchState.blockedReason}):(0,Z.jsx)(`span`,{}),(0,Z.jsx)(q,{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`),I(N)},children:`Continue`})]})]});case 1:return(0,Z.jsxs)(Ii,{className:`surface-card step-card`,children:[(0,Z.jsxs)(`div`,{className:`section-head`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`h2`,{children:`Create project`})}),B?(0,Z.jsx)(hr,{tone:`positive`,children:`Created`}):null]}),B?(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsxs)(`p`,{className:`text-neutral`,children:[`Project `,(0,Z.jsx)(`span`,{className:`text-heading text-label-14-strong`,children:B}),` created successfully.`]}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:wt,children:`Back`}),(0,Z.jsx)(q,{type:`button`,onClick:()=>Tt(`project`,2),children:`Continue`})]})]}):(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsxs)(`div`,{className:`setup-field`,children:[(0,Z.jsx)(`label`,{className:`setup-label`,htmlFor:`project-name`,children:`Project name`}),(0,Z.jsx)(`input`,{id:`project-name`,className:`setup-input`,type:`text`,placeholder:`my-website`,value:ae,onChange:e=>oe(e.target.value)}),at&&at!==ae?(0,Z.jsxs)(`p`,{className:`supporting-copy`,children:[`Slug: `,at]}):null]}),(0,Z.jsxs)(`div`,{className:`setup-field`,children:[(0,Z.jsx)(`label`,{className:`setup-label`,htmlFor:`display-name`,children:`Display name (optional)`}),(0,Z.jsx)(`input`,{id:`display-name`,className:`setup-input`,type:`text`,placeholder:`My Website`,value:se,onChange:e=>ce(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`setup-field`,children:[(0,Z.jsx)(`label`,{className:`setup-label`,htmlFor:`domain`,children:`Canonical domain`}),(0,Z.jsx)(`input`,{id:`domain`,className:`setup-input`,type:`text`,placeholder:`example.com`,value:le,onChange:e=>ue(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`setup-field-row`,children:[(0,Z.jsxs)(`div`,{className:`setup-field`,children:[(0,Z.jsx)(`label`,{className:`setup-label`,htmlFor:`country`,children:`Country`}),(0,Z.jsx)(`input`,{id:`country`,className:`setup-input`,type:`text`,placeholder:`US`,maxLength:2,value:R,onChange:e=>z(e.target.value.toUpperCase())})]}),(0,Z.jsxs)(`div`,{className:`setup-field`,children:[(0,Z.jsx)(`label`,{className:`setup-label`,htmlFor:`language`,children:`Language`}),(0,Z.jsx)(`input`,{id:`language`,className:`setup-input`,type:`text`,placeholder:`en`,maxLength:5,value:de,onChange:e=>fe(e.target.value.toLowerCase())})]})]}),(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-2 text-label-14 text-link`,children:`Backlink tracking`}),(0,Z.jsxs)(`label`,{className:`flex items-start gap-3 py-3 cursor-pointer`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 h-4 w-4 rounded border-strong bg-bg`,checked:pe,onChange:e=>me(e.target.checked)}),(0,Z.jsxs)(`span`,{className:`flex-1`,children:[(0,Z.jsx)(`span`,{className:`block text-label-14 text-heading`,children:`Auto-extract backlinks`}),(0,Z.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,Z.jsx)(H,{to:`/backlinks`,className:`text-positive-400 hover:text-positive underline underline-offset-2`,children:`Manage backlinks`})]})]})]})]}),ge?(0,Z.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:ge}):null,(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:wt,children:`Back`}),(0,Z.jsx)(q,{type:`button`,disabled:!at||!le||ve,onClick:Jr(bt),children:ve?`Creating…`:`Create project`})]})]})]});case 2:return(0,Z.jsx)(Ot,{className:u?`visibility-setup-section step-card`:`surface-card step-card`,"aria-labelledby":`setup-queries-heading`,children:(0,Z.jsx)(Dp,{queries:Ce,headingLevel:`h2`,loading:ie,loadFailed:b.isError,onRetryLoad:()=>{b.refetch()},onBack:kt,skipAction:(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:Et,children:u?`Finish without AI Visibility`:`Skip for now`}),saveVariant:A.providerFormVisible?`secondary`:`default`})});case 3:return(0,Z.jsxs)(Ii,{className:`surface-card step-card`,children:[(0,Z.jsxs)(`div`,{className:`section-head`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`h2`,{children:`Add competitors`})}),Ee?(0,Z.jsx)(hr,{tone:`positive`,children:`Saved`}):null]}),(0,Z.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.`}),Ee?(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsx)(`ul`,{className:`detail-list`,children:st.map(e=>(0,Z.jsx)(`li`,{children:e},e))}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:wt,children:`Back`}),(0,Z.jsx)(q,{type:`button`,onClick:()=>Tt(`competitors`,4,st.length),children:`Continue`})]})]}):(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsxs)(`div`,{className:`setup-field`,children:[(0,Z.jsx)(`label`,{className:`setup-label`,htmlFor:`competitors`,children:`Competitor domains (one per line)`}),(0,Z.jsx)(`textarea`,{id:`competitors`,className:`setup-textarea text-copy-14`,rows:4,placeholder:`competitor1.com
41
41
  competitor2.com`,value:we,onChange:e=>Te(e.target.value)})]}),ke?(0,Z.jsx)(`p`,{className:`text-negative-400 text-copy-14`,children:ke}):null,(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:wt,children:`Back`}),(0,Z.jsx)(`div`,{className:`flex gap-2`,children:st.length===0?(0,Z.jsx)(q,{type:`button`,onClick:Dt,children:`Continue without competitors`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:Dt,children:`Skip`}),(0,Z.jsx)(q,{type:`button`,disabled:je,onClick:Jr(xt),children:je?`Saving…`:`Save ${st.length} competitor${st.length===1?``:`s`}`})]})})]})]})]});case 4:{let e=Qe.data,t=V&&!e&&!!We,n=e?.status??(We===w?.id?w.status:void 0),r=n===`completed`||n===`partial`||n===`failed`||n===`cancelled`,i=e?.snapshots??[],a=e?.plannedAnswers??(e&&Xe?.runId===e.id?Xe.requestCount:null),o=mf(i,e=>x.find(t=>t.id===e)?.queryClass),c=se||B||`your brand`,l=n?$p(n,i.length):!1,d=He??(e?.error?Rr(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 yt||l?f=(0,Z.jsx)(hr,{tone:`positive`,children:`Complete`}):He&&!V?f=(0,Z.jsx)(hr,{tone:`negative`,children:`Failed`}):t?f=(0,Z.jsx)(hr,{tone:`neutral`,children:Qe.isError?`Unavailable`:`Loading`}):r?f=(0,Z.jsx)(hr,{tone:`negative`,children:n===`cancelled`?`Cancelled`:`Failed`}):V&&(f=(0,Z.jsx)(hr,{tone:`caution`,children:n===bn.queued?`Queued`:`Running`})),(0,Z.jsxs)(Ii,{className:`surface-card step-card`,children:[(0,Z.jsxs)(`div`,{className:`section-head`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h2`,{children:l?`Saved answers`:qn()?`AI Visibility`:V?`Your first AI Visibility check`:`Run your first AI Visibility check`}),l||qn()?null:(0,Z.jsx)(Mi,{text:Cp(c,Ye)})]})}),f]}),yt?(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsxs)(`p`,{className:`text-secondary`,children:[(0,Z.jsx)(`span`,{className:`text-strong text-label-14-strong`,children:B}),` has saved AI Visibility results.`]}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(q,{type:`button`,onClick:()=>xe(),children:`Open project dashboard →`})]})]}):!V&&qn()?(0,Z.jsx)(Ep,{projectName:B,error:He,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(q,{type:`button`,onClick:()=>xe(),children:`Open project dashboard →`})]})}):V?t?(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsx)(`p`,{role:Qe.isError?`alert`:`status`,className:`text-copy-14 text-secondary`,children:Qe.isError?`Could not load the saved check. Try again to see its result.`:`Loading saved check…`}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>xe(),children:`Open project dashboard →`}),Qe.isError?(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{Qe.refetch()},children:`Retry status check`}):null]})]}):r?l?(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[(0,Z.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:se||B}),` · `,i.length,` `,i.length===1?`answer`:`answers`]}),(0,Z.jsx)(vf,{byClass:e?.queryCountsByClass,pooled:e?.queryCounts}),o?(0,Z.jsx)(`section`,{className:`mt-3 border-t border-default pt-4`,"aria-label":`Your first saved answer`,children:(0,Z.jsx)(yf,{answer:o})}):null,B?(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-2 text-label-14 text-link`,children:`More setup options`}),(0,Z.jsx)(df,{projectName:B})]}):null,(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(q,{type:`button`,onClick:()=>xe(),children:`Open project dashboard →`})]})]}):(0,Z.jsxs)(`div`,{className:`compact-stack`,children:[(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,Z.jsx)(`p`,{children:d}),(0,Z.jsx)(`p`,{className:`mt-1 text-copy-13 text-secondary`,children:qn()?xc:s?`Review the connection, then retry.`:`Ask an administrator to review the provider and query configuration.`})]}),Je.isError&&!qn()?(0,Z.jsx)(lf,{preview:Je.data,pending:Je.isFetching,failed:!0,onRetry:()=>{Je.refetch()}}):null,(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[s&&!qn()?(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:A.repairConnection,children:`Repair connection`}):(0,Z.jsx)(`span`,{}),qn()||!s?(0,Z.jsx)(q,{type:`button`,onClick:()=>xe(),children:`Open project dashboard →`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>xe(),children:`Open project dashboard →`}),(0,Z.jsx)(q,{type:`button`,disabled:ze||!!dt||Je.isError||Je.isFetching||Je.data?.canStart!==!0,onClick:Jr(Ct),children:ze?`Retrying…`:`Retry check`})]})]})]}):(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsx)(ff,{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,Z.jsxs)(`div`,{role:`status`,className:`rounded-md border border-caution px-3 py-2`,children:[(0,Z.jsxs)(`p`,{className:`text-copy-14 text-primary`,children:[Mr(e),`: `,t.failedQueries,` `,t.failedQueries===1?`query`:`queries`,` failed`,t.stopped?`, so this check stopped asking it`:``,`.`]}),(0,Z.jsxs)(`details`,{className:`mt-1`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:t.message})]})]},e)),Qe.isError&&(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-negative bg-negative-soft p-3 text-label-14 text-negative`,children:[(0,Z.jsx)(`p`,{children:Qe.error instanceof Error?Qe.error.message:`Could not refresh the check status.`}),(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>{Qe.refetch()},children:`Retry status check`})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>xe(),children:`Open project dashboard →`})})]}):(0,Z.jsx)(Tp,{preview:Je,details:[{label:`Website`,value:le},{label:`Market`,value:_t(R,de)}],queries:x,usesAccount:Ye,alert:He??dt??null,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:wt,children:`Back`}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:xe,children:`Finish without running`}),lt===`no_provider`&&!u?(0,Z.jsx)(q,{type:`button`,onClick:()=>A.setShowProviderConfig(!0),children:`Connect an AI engine`}):(0,Z.jsx)(q,{type:`button`,disabled:ze||!!dt||Je.isError||Je.isFetching||Je.data?.canStart!==!0,title:dt,onClick:Jr(Ct),children:ze?`Starting…`:He?`Retry check`:`Run check`})]})})]})}default:return null}})(),Mt=u?Qp:Zp,Pt=F===4&&(vt||yt)?Mt.length:u?+(F===4):F,Ft=F===4&&!V?(0,Z.jsx)(Sp,{engines:A}):null;return(0,Z.jsxs)(`div`,{className:u?`page-container visibility-setup`:`page-container`,children:[(0,Z.jsxs)(`div`,{className:`page-header`,children:[(0,Z.jsxs)(`div`,{className:`page-header-left`,children:[(0,Z.jsx)(`h1`,{ref:i?a:void 0,tabIndex:i?-1:void 0,className:`page-title outline-none`,children:vt?`Your first AI Visibility result`:i?`Set up AI Visibility`:`Setup`}),!vt&&!(F===4&&V)?(0,Z.jsx)(`p`,{className:`page-subtitle`,children:i?F===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]}),!vt&&F!==4?(0,Z.jsx)(`div`,{className:`page-header-right`,children:(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!y&&!b.isSuccess||ve||Ce.saving||je||ze,onClick:Ne,children:`Reset unsaved fields`})}):null]}),(0,Z.jsx)(rm,{current:Pt,labels:Mt}),(0,Z.jsxs)(`section`,{className:`setup-wizard`,children:[At,Ft,(0,Z.jsx)(`div`,{ref:te,children:jt})]}),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:n}){return(0,Z.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((r,i)=>{let a=r.id===e,o=!a&&t[r.id];return(0,Z.jsxs)(`li`,{"aria-current":a?`step`:void 0,className:a?`inline-flex items-center gap-1.5 text-heading`:`inline-flex items-center gap-1.5`,children:[i>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,o?(0,Z.jsx)(ie,{className:`size-3.5 text-positive`,"aria-hidden":`true`}):(0,Z.jsx)(`span`,{className:`tabular-nums`,"aria-hidden":`true`,children:i+1}),r.id===`first-check`&&n?`Check`:r.label,o?(0,Z.jsx)(`span`,{className:`sr-only`,children:`, done`}):null]},r.id)})})}function lm(e){let t=Ls(),{isAdmin:n}=Kr(),r=U({..._i({client:G}),enabled:!t}),i=U({...fi({client:G}),enabled:!t&&n}),a=qs(!t,t?.health),o=(0,Y.useMemo)(()=>Fs(i.data??null),[i.data]),{refetch:s}=r,{refetch:c}=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??o,health:a.data??t?.health??ru,loading:!t&&(r.isPending||n&&i.isPending),failed:!t&&r.isError,refresh:async()=>{await Promise.all([s(),...n?[c()]:[]])}}}function um({projectName:e,initialStep:t,hasBaseline:n=!1,onClose:r,onLaunched:i}){let a=lm(e);return a.loading?(0,Z.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading AI engines and queries…`}):a.project?(0,Z.jsx)(dm,{project:a.project,settings:a.settings,health:a.health,refresh:a.refresh,initialStep:t,hasBaseline:n,onClose:r,onLaunched:i},e):(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-caution px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`text-copy-14 text-primary`,children:a.failed?`Canonry could not load the project list.`:(0,Z.jsxs)(Z.Fragment,{children:[`Canonry could not find `,e,` in the project list.`]})}),(0,Z.jsx)(q,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-2`,onClick:()=>{a.refresh()},children:`Retry`})]})}function dm({project:e,settings:t,health:n,refresh:r,initialStep:i,hasBaseline:a,onClose:o,onLaunched:s}){let c=e.name,l=De(),u=Se(),d=Ud(`wizard`),f=U({queryKey:Gp(c),queryFn:()=>Nt(c)}),p=f.data,m=p?.length??0,h=(p??[]).map(e=>e.query).join(`
42
42
  `),g=`wizard:${c}`,[_]=(0,Y.useState)(()=>Bd(g)),[v,y]=(0,Y.useState)(i),[b,x]=(0,Y.useState)(!f.isPending),S=Op({settings:t,project:e,projectScoped:!0,refresh:r}),C=Xp({projectName:c,initialText:_.queriesText??h,initialSaved:_.queriesText===void 0&&m>0,generateProviders:S.runnableApiProviders,research:{projectName:c,domain:e.canonicalDomain},telemetry:d,refreshAfterSave:e=>Kp(u,e),onContinue:()=>y(`first-check`)}),{setText:w,setSaved:T}=C;(0,Y.useEffect)(()=>{b||f.isPending||(p&&p.length>0&&_.queriesText===void 0&&(w(p.map(e=>e.query).join(`
43
- `)),T(!0)),x(!0))},[_.queriesText,b,p,f.isPending,T,w]),(0,Y.useEffect)(()=>{b&&Vd(g,{...!C.saved&&C.text!==h?{queriesText:C.text}:{},..._.competitorsText===void 0?{}:{competitorsText:_.competitorsText}})},[_.competitorsText,g,C.saved,C.text,b,h]);let{emit:E,onboardingSessionId:D}=d;(0,Y.useEffect)(()=>{b&&E({flowVersion:1,onboardingSessionId:D,event:`onboarding.started`,step:i===`first-check`?`run`:`queries`,resumed:!0},`onboarding.started`)},[E,i,D,b]);let O=(0,Y.useRef)(null),k=(0,Y.useRef)(v);(0,Y.useEffect)(()=>{if(k.current===v)return;k.current=v;let e=O.current?.querySelector(`h2, h3`);e&&(e.tabIndex=-1,e.focus())},[v]);let A=(0,Y.useRef)(null),j=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{if(!j.current)return;let e=document.activeElement;if(e&&e!==document.body){j.current=!1;return}let t=A.current?.querySelector(`h3`);t&&(j.current=!1,t.tabIndex=-1,t.focus())});let M=qn(),N=of(c,v===`first-check`&&!M),ee=wp(N.data),{systemBlockReason:P,blockedReason:F}=kp(n,t,S),I=F??(f.isSuccess&&m===0?`Add at least one query before launching the first check.`:void 0),te=Rp(),[ne,L]=(0,Y.useState)(!1),[re,ie]=(0,Y.useState)(null),ae=e.displayName||c,oe=async()=>{if(!M&&!(N.isError||N.isFetching||N.data?.canStart!==!0)){if(I)ie(I),S.usesProjectProviderReadiness||E({flowVersion:1,onboardingSessionId:D,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:Gn(S.runnableProviderCount),queryCountBucket:Gn(m),reasonCode:P??(m===0?`no_queries`:`run_rejected`)});else{L(!0),ie(null);try{let e=await te.mutateAsync({projectName:c,projectLabel:ae,sourceAction:`setup-launch`,suppressQueuedToast:!0});rn(c,e.id,J[`answer-visibility`]),s(e.id),S.usesProjectProviderReadiness||E({flowVersion:1,onboardingSessionId:D,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:Gn(S.runnableProviderCount),queryCountBucket:Gn(m)})}catch(e){ie(e instanceof Error?e.message:`Failed to queue the AI Visibility check. Retry when the instance is ready.`),S.usesProjectProviderReadiness||E({flowVersion:1,onboardingSessionId:D,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:Gn(S.runnableProviderCount),queryCountBucket:Gn(m),reasonCode:Qt(e,`run_rejected`)})}finally{L(!1)}}}},se=S.isAdmin&&(S.providerFormVisible||S.inlineModelPicker),ce=S.providerReadiness===!1&&!re;return(0,Z.jsxs)(`div`,{ref:A,children:[(0,Z.jsx)(cm,{current:v,done:{engine:S.providerReadiness===!0,queries:m>0,"first-check":!1},hasBaseline:a}),(0,Z.jsx)(`div`,{ref:O,children:v===`engine`?(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsx)(xp,{engines:S,headingLevel:`h3`}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>S.providerGuard.request(o),children:`Back`}),(0,Z.jsx)(q,{type:`button`,variant:se?`secondary`:`default`,onClick:()=>S.providerGuard.request(()=>{S.closeProviderForm(),y(`queries`)}),children:`Continue`})]})]}):v===`queries`?(0,Z.jsx)(`div`,{className:`space-y-3`,"aria-labelledby":`setup-queries-heading`,children:(0,Z.jsx)(Dp,{queries:C,headingLevel:`h3`,loading:f.isPending||!b,loadFailed:f.isError,onRetryLoad:()=>{f.refetch()},onBack:()=>y(`engine`),note:(0,Z.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Sp,{engines:S}),(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`section-head`,children:(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-heading-16 text-heading`,children:M?`AI Visibility`:a?`Run an AI Visibility check`:`Run your first AI Visibility check`}),M?null:(0,Z.jsx)(Mi,{text:Cp(ae,ee)})]})})}),M?(0,Z.jsx)(Ep,{projectName:c,error:re,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(q,{type:`button`,onClick:()=>{l({to:`/projects/$projectName`,params:{projectName:c},replace:!0})},children:`Open project dashboard →`})]})}):(0,Z.jsx)(Tp,{preview:N,details:[{label:`Website`,value:e.canonicalDomain},{label:`Market`,value:_t(e.country,e.language)}],queries:p??[],usesAccount:ee,alert:ce?null:re??I??null,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>y(`queries`),children:`Back`}),ce?(0,Z.jsx)(q,{type:`button`,onClick:()=>y(`engine`),children:`Connect an AI engine`}):(0,Z.jsx)(q,{type:`button`,disabled:ne||!!I||N.isError||N.isFetching||N.data?.canStart!==!0,title:I,onClick:Jr(oe),children:ne?`Starting…`:re?`Retry check`:a?`Run check`:`Run first check`})]})})]})]})}),S.providerGuard.dialog]})}var fm=`Public pages only, read by this Canonry server and stored with this project. The first scan reads up to 100 pages, then stops.`,pm=ur.enum;function mm(e){return e===K.queued||e===K.running}function hm(e){return e===K.not_started||e===K.cancelled||e===K.failed}function gm(e,t,n){return`${e} ${e===1?t:n}`}function _m({projectName:e,firstRun:t,track:n}){let r=De(),i=Se(),{canWrite:a,isAdmin:o}=Kr(),s=U({...yi({client:G,path:{name:e}}),retry:!1,refetchInterval:({state:e})=>{let t=e.data;return t&&(mm(t.tracks.agentReadiness.state)||mm(t.tracks.aiVisibility.state))?3e3:!t?.complete&&15e3}}),c=U({...ui({client:G,path:{name:e}}),retry:!1}),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useRef)(!1),h=s.data?.tracks.aiVisibility;(0,Y.useEffect)(()=>{h&&(mm(h.state)?(m.current=!0,u(null)):n===`ai-visibility`&&!m.current&&(m.current=!0,u(Em(h.blockedBy))))},[n,h]);let g=()=>i.invalidateQueries({queryKey:wi({client:G,path:{name:e}})}),_=vm(e,s.data);ym(s.data);let v=s.isSuccess;(0,Y.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,Z.jsx)(xm,{});if(s.isError){let n=eo(s.error).code===`NOT_FOUND`;return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:t?`Set up Canonry`:`Project setup`}),(0,Z.jsxs)(`div`,{role:`alert`,className:`mt-6 rounded-md border border-negative bg-negative-soft p-4`,children:[(0,Z.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:n?`No project named ${e}.`:`Setup status could not be loaded.`}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:n?(0,Z.jsx)(q,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,Z.jsx)(H,{to:`/projects`,children:`View projects`})}):(0,Z.jsx)(q,{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=tt(S.project.canonicalDomain),E=C?_t(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&&!mm(O.state),j=A||!a?null:hm(D.state)?`agent-readiness`:hm(O.state)&&!k?`ai-visibility`:null;return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{ref:p,tabIndex:-1,className:`text-heading-24 text-heading outline-none`,children:t?`Set up Canonry`:`Project setup`}),(0,Z.jsxs)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:[S.complete?`Setup complete · `:null,w,` · `,T]})]}),(0,Z.jsx)(q,{asChild:!0,variant:S.complete?`default`:`ghost`,className:`shrink-0`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open project`,S.complete?null:(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":`true`})]})})]}),(0,Z.jsxs)(Jd,{label:`Setup progress`,children:[(0,Z.jsx)(Yd,{id:`setup-website`,title:`Website`,mark:`done`,summary:E?`${T} · ${E}`:T,trailing:a?(0,Z.jsxs)(H,{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,Z.jsx)(`span`,{className:`sr-only`,children:` website`})]}):null}),(0,Z.jsx)(Tm,{projectName:e,projectId:C?.id??null,brand:w,track:D,primary:j===`agent-readiness`,canWrite:a,onStarted:async e=>{_(e,J[`site-audit`]),await g()},onCancelled:g}),(0,Z.jsx)(Om,{projectName:e,brand:w,domain:T,track:O,panelStep:A?l:null,onOpenPanel:b,onClosePanel:x,starting:k,onLaunched:e=>{_(e,J[`answer-visibility`]),f({runId:e,listedRunId:O.runId}),x(),g()},onCancelled:g,primary:j===`ai-visibility`,canWrite:a,isAdmin:o})]}),(0,Z.jsx)(`p`,{role:`status`,className:`sr-only`,children:Sm(D)}),(0,Z.jsx)(`p`,{role:`status`,className:`sr-only`,children:Cm(O,k?K.queued:O.state)}),S.complete?(0,Z.jsx)(df,{projectName:e}):null]})}function vm(e,t){let{emit:n,onboardingSessionId:r}=Ud(`site_health`),{emit:i,onboardingSessionId:a}=Ud(`wizard`),o=(0,Y.useRef)(new Map);return(0,Y.useEffect)(()=>{let t=Re(e);t?.kind&&o.current.set(t.runId,t.kind)},[e]),(0,Y.useEffect)(()=>{if(!t)return;let e=[{...t.tracks.agentReadiness,kind:J[`site-audit`],answers:null},{...t.tracks.aiVisibility,kind:J[`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===J[`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:Gn(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),ft(t)}},[a,i,n,r,t]),(t,i)=>{o.current.set(t,i),i===J[`site-audit`]&&(rn(e,t,i),n({flowVersion:1,onboardingSessionId:r,event:`onboarding.started`,step:`run`,resumed:!1},`onboarding.started:${t}`))}}function ym(e){let t=Se(),n=e?.tracks.agentReadiness.state,r=e?.tracks.aiVisibility.state,i=(0,Y.useRef)({});(0,Y.useEffect)(()=>{let e=i.current;i.current={scan:n,check:r};let a=(e,t)=>e!==void 0&&t!==void 0&&mm(e)&&!mm(t);(a(e.scan,n)||a(e.check,r))&&t.invalidateQueries({queryKey:ki({client:G})})},[n,r,t])}function bm({runIds:e,noun:t,note:n,onCancelled:r}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),c=Le({...ji({client:G}),meta:{skipGlobalErrorToast:!0}}),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=(0,Y.useRef)(!1);(0,Y.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`&&eo(e.reason).code!==`RUN_NOT_CANCELLABLE`);n&&s(`The ${t} could not be stopped. ${W(n.reason)}`),await r()};return i?(0,Z.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,Z.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Stop the `,t,`? `,n]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 max-sm:w-full max-sm:[&>*]:flex-1`,children:[(0,Z.jsx)(q,{ref:u,type:`button`,variant:`ghost`,"aria-disabled":c.isPending||void 0,onClick:()=>{c.isPending||f(!1)},children:`Keep running`}),(0,Z.jsx)(q,{type:`button`,variant:`secondary`,"aria-disabled":c.isPending||void 0,onClick:()=>{p()},children:c.isPending?`Stopping…`:`Stop ${t}`})]}),o?(0,Z.jsx)(`p`,{role:`alert`,className:`w-full text-right text-copy-14 text-negative`,children:o}):null]}):(0,Z.jsxs)(q,{ref:l,type:`button`,variant:`ghost`,"data-focus-skip":!0,onClick:()=>f(!0),children:[`Cancel `,t]})}function xm(){return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,children:[(0,Z.jsx)(`div`,{className:`skeleton-text h-6 w-40`}),(0,Z.jsx)(`div`,{className:`skeleton-text-sm mt-2 w-56`}),(0,Z.jsx)(`div`,{className:`material-base mt-6 space-y-6 p-5`,children:[1,2,3].map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`div`,{className:`skeleton-text w-32`}),(0,Z.jsx)(`div`,{className:`skeleton-text-sm w-64`})]}),(0,Z.jsx)(`div`,{className:`skeleton h-5 w-20 rounded-md`})]},e))})]})}function Sm(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.`}case K.failed:return`Agent Readiness audit scan failed.`;case K.cancelled:return`Agent Readiness audit scan cancelled.`;default:return e.state}}function Cm(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} ${gm(r.answers,`answer`,`answers`)} from ${gm(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 wm(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 pm.queued:return{phase:`Waiting to start`,count:null,done:null,total:null};case pm.discovering:return{phase:`Finding pages`,count:t.pagesFound===null?null:`${t.pagesFound} found`,done:null,total:null};case pm.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 pm[`arranging-map`]:return{phase:`Building the score`,count:gm(t.pagesChecked,`page checked`,`pages checked`),done:null,total:null};case pm.completed:case pm.partial:case pm.failed:case pm.cancelled:return{phase:`Finishing`,count:null,done:null,total:null};default:return t.phase}}function Tm({projectName:e,projectId:t,brand:n,track:r,primary:i,canWrite:a,onStarted:o,onCancelled:s}){let c=Bp(),{onboardingSessionId:l,emit:u}=Ud(`platform`),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.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. ${W(e)}`),u({flowVersion:1,onboardingSessionId:l,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:Qt(e,`run_rejected`)})}finally{m(!1)}}},_=e=>a?(0,Z.jsx)(q,{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,Z.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,Z.jsx)(Mi,{text:fm})]}),b=_(h===K.cancelled?`Run audit scan again`:`Run audit scan`);break;case K.queued:case K.running:{let e=wm(r),t=r.progress;y=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ff,{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,Z.jsxs)(`details`,{className:`mt-2`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Scan details`}),(0,Z.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,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:e}),(0,Z.jsx)(`dd`,{className:`text-label-14-strong tabular-nums text-heading`,children:t===null?`Unavailable`:t.toLocaleString()})]},e))})]}):null]}),b=a&&r.runId?(0,Z.jsx)(bm,{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=h===K.partial?`The scan stopped before it reached every page.`:null,y=t?(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`text-heading-20 tabular-nums text-heading`,children:t.score===null?`–`:Math.round(t.score)}),(0,Z.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[t.score===null?`Score unavailable`:h===K.partial?`of 100 so far`:`of 100`,` · `,gm(t.pagesScored,`page scored`,`pages scored`)]})]}):(0,Z.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`The scan finished.`}),b=(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName/agent-readiness`,params:{projectName:e},children:[`Open Agent Readiness`,(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":`true`})]})});break}case K.failed:v=`The scan did not finish.${r.error?` ${r.error}`:``}`,b=_(`Run audit scan again`);break;default:return h}return(0,Z.jsxs)(Yd,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:Kd(h),summary:v,trailing:(0,Z.jsx)(Gd,{state:h}),action:b,children:[y,d?(0,Z.jsx)(`p`,{role:`alert`,className:`${y?`mt-3 `:``}text-copy-14 text-negative`,children:d}):null]})}function Em(e){switch(e){case null:return`first-check`;case Nn.no_engine:case Nn.engines_failing:return`engine`;case Nn.no_queries:return`queries`;case Nn.plan_unpublished:return null;default:return e}}function Dm(e,t,n){let r=`Whether AI answers mention ${t} and cite ${n}.`,i=e.baselineRunId===null;switch(e.blockedBy){case Nn.no_engine:return{line:`${r} Needs an AI engine.`,action:`Connect an AI engine`,step:`engine`};case Nn.no_queries:return{line:`${r} Add queries to check.`,action:`Add queries`,step:`queries`};case Nn.plan_unpublished:return{line:`Publish the measurement plan before the ${i?`first`:`next`} check.`,action:`Open measurement plan`,step:`plan`};case Nn.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 ${gm(t,`engine`,`engines`)} your ${gm(e.queries.total,`query`,`queries`)}.`,action:i?`Review first check`:`Review check`,step:`first-check`}}default:return e.blockedBy}}function Om({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,Z.jsx)(Yd,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:Kd(p),trailing:(0,Z.jsx)(Gd,{state:p}),childrenManageFocus:!0,children:(0,Z.jsx)(um,{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=Dm(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,Z.jsx)(q,{asChild:!0,variant:m,children:(0,Z.jsx)(H,{to:`/projects/$projectName/portfolio`,params:{projectName:e},children:i.action})}):(0,Z.jsx)(q,{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 ${gm(e.answersPlanned,`answer`,`answers`)} saved`:`${gm(e.answersSaved,`answer`,`answers`)} saved`:null;g=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ff,{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,Z.jsxs)(`div`,{role:`status`,className:`mt-3 rounded-md border border-caution px-3 py-2`,children:[(0,Z.jsxs)(`p`,{className:`text-copy-14 text-primary`,children:[Mr(e),`: `,gm(t.failedQueries,`query`,`queries`),` failed`,t.stopped?`, so this check stopped asking it`:``,`.`]}),(0,Z.jsxs)(`details`,{className:`mt-1`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:t.message})]})]},e)),(0,Z.jsxs)(`details`,{className:`mt-2`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Check details`}),(0,Z.jsxs)(`dl`,{className:`mt-2 grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Engines`}),(0,Z.jsx)(`dd`,{className:`text-label-14 text-heading`,children:r.engines.length>0?r.engines.map(e=>Mr(e)).join(`, `):`Unavailable`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Queries`}),(0,Z.jsxs)(`dd`,{className:`text-label-14 tabular-nums text-heading`,children:[gm(r.queries.nonBrand,`non-brand`,`non-brand`),` · `,gm(r.queries.branded,`branded`,`branded`)]})]})]})]})]}),_=d&&!l&&r.runId?(0,Z.jsx)(bm,{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`} · ${gm(t.answers,`answer`,`answers`)} from ${gm(t.engines,`engine`,`engines`)}${r.finishedAt?` · ${Vr(r.finishedAt)}`:``}`:`The check finished.`,g=t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vf,{byClass:t.queryCountsByClass,pooled:t.queryCounts,caption:n?void 0:`Latest AI Visibility check by query class`}),n?(0,Z.jsx)(`p`,{className:`mt-3 text-copy-13 text-secondary`,children:`Later checks are compared with this baseline.`}):null,r.runId?(0,Z.jsx)(km,{runId:r.runId,projectName:e}):null]}):null,_=(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open AI Visibility`,(0,Z.jsx)(N,{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,Z.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,Z.jsxs)(`div`,{className:`space-y-2`,children:[t.map(e=>{let t=Mr(e.provider),n=yr(e.code,Mr(mt(e.provider)));return(0,Z.jsx)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-copy-14 text-primary`,children:n}),(0,Z.jsxs)(`details`,{className:`mt-1`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Z.jsxs)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:[t,`: `,e.message]})]})]}):(0,Z.jsxs)(`p`,{className:`break-words text-copy-14 text-primary`,children:[t,`: `,e.message]})},e.provider)}),e]}):r.error?(0,Z.jsxs)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`break-words text-copy-14 text-primary`,children:r.error}),e?(0,Z.jsx)(`div`,{className:`mt-1`,children:e}):null]}):null,d&&(_=(0,Z.jsxs)(Z.Fragment,{children:[f?(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>a(`engine`),children:`Change AI engines`}):null,(0,Z.jsx)(q,{type:`button`,variant:m,onClick:()=>a(`first-check`),children:`Run check again`})]}));break}default:return p}return(0,Z.jsx)(Yd,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:Kd(p),summary:h,trailing:(0,Z.jsx)(Gd,{state:p}),action:_,children:g})}function km({runId:e,projectName:t}){let[n,r]=(0,Y.useState)(!1),i=U({...Ai({client:G,path:{id:e}}),enabled:n}),a=U({...di({client:G,path:{name:t}}),enabled:n}),o=i.data?mf(i.data.snapshots??[],e=>a.data?.find(t=>t.id===e)?.queryClass):void 0;return(0,Z.jsxs)(`details`,{className:`mt-3`,onToggle:e=>r(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-link`,children:`Example answer`}),(0,Z.jsx)(`div`,{className:`mt-3 border-t border-default pt-4`,children:i.isPending?(0,Z.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading the answer…`}):i.isError?(0,Z.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`The answer could not be loaded.`}):o?(0,Z.jsx)(yf,{answer:o}):(0,Z.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`This check saved no answer text.`})})]})}var Am=`pointer-coarse:min-h-11 max-md:min-h-11`,jm=`setup-input h-10 w-full max-md:text-label-16 ${Am}`,Mm=[{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`}],Nm=[{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 Pm(e,t){let n=e.trim().toUpperCase(),r=t.trim().toLowerCase();return{countryValid:Mm.some(e=>e.value===n),languageValid:Nm.some(e=>e.value===r)}}function Fm(e){let t=e.replace(/^\[|\]$/g,``);return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes(`:`)}function Im(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`||Fm(i)||!i.includes(`.`))return null;let a=Ot(i);return a?{canonicalDomain:i,projectName:a,displayName:Kn(i)}:null}function Lm(e,t){return e instanceof rr&&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 Rm(){return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,Z.jsx)(`div`,{className:`page-header`,children:(0,Z.jsxs)(`div`,{className:`page-header-left`,children:[(0,Z.jsx)(`h1`,{className:`page-title`,children:`Preparing setup`}),(0,Z.jsx)(`p`,{className:`page-subtitle`,children:`Checking the projects already on this install.`})]})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 material-base p-4 text-label-14 text-secondary`,role:`status`,children:[(0,Z.jsx)(s,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading projects…`]})]})}function zm({onRetry:e}){return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsx)(`div`,{className:`page-header`,children:(0,Z.jsxs)(`div`,{className:`page-header-left`,children:[(0,Z.jsx)(`h1`,{className:`page-title`,children:`Can’t load projects`}),(0,Z.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not confirm whether this install already has a project.`})]})}),(0,Z.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,Z.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Setup is paused to protect existing projects.`}),(0,Z.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,Z.jsx)(q,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:e,children:`Retry project check`})]})]})}function Bm(){let e=Oe({from:`/setup`});if(e.experience===`legacy`||e.experience!==`platform`&&sr()===`legacy`)return(0,Z.jsx)(im,{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,Z.jsx)(_m,{projectName:t,firstRun:e.onboarding!==void 0,track:n},t)}let n=e.experience===`platform`;return(0,Z.jsx)(Vm,{addProject:n},n?`add-project`:`entry`)}function Vm({addProject:e}){let t=De(),n=U({..._i({client:G}),retry:!1,refetchOnMount:`always`}),r=n.isSuccess&&n.isFetchedAfterMount,i=!e&&r&&n.data.length===1?n.data[0]:void 0,a=U({...yi({client:G,path:{name:i?.name??``}}),enabled:i!==void 0,retry:!1}),[o,s]=(0,Y.useState)(null);return(0,Y.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,Y.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,Z.jsx)(zm,{onRetry:()=>{n.refetch()}}):!o||`redirectTo`in o||`addProject`in o?(0,Z.jsx)(Rm,{}):(0,Z.jsx)(Hm,{firstRun:o.firstRun})}function Hm({firstRun:e}){return(0,Z.jsx)(Ir,{title:e?`Set up Canonry`:`Add a project`,children:(0,Z.jsx)(Um,{firstRun:e})})}function Um({firstRun:e}){let t=De(),n=Se(),r=e&&Or(),i=U({...ai({client:G}),enabled:r,retry:!1}),a=Le(si()),[o]=(0,Y.useState)(()=>Bd(`platform`)),[c,l]=(0,Y.useState)(o.domain??``),[u,d]=(0,Y.useState)(o.projectName??``),[f,p]=(0,Y.useState)(o.displayName??``),[m,h]=(0,Y.useState)(o.country??`US`),[g,_]=(0,Y.useState)(o.language??`en`),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),D=U({..._i({client:G}),enabled:w!==null,retry:!1}),O=w===null?null:D.data?.find(e=>Ot(e.name)===w)?.name??w,A=!r||i.isError?void 0:i.data,j=typeof A?.enabled==`boolean`?A.enabled:null,M=a.isPending?a.variables.body.enabled:j,[N,ee]=(0,Y.useState)(null),P=(0,Y.useRef)(null),F=(0,Y.useRef)(null),I=(0,Y.useRef)(null),{onboardingSessionId:te,emit:ne}=Ud(`platform`);(0,Y.useEffect)(()=>{ne({flowVersion:1,onboardingSessionId:te,event:`onboarding.started`,step:`project`,resumed:!1},`onboarding.started`)},[ne,te]),(0,Y.useEffect)(()=>{Vd(`platform`,{domain:c,projectName:u,displayName:f,country:m,language:g})},[c,u,f,m,g]);let L=()=>{Hd(`platform`),l(``),d(``),p(``),h(`US`),_(`en`),C(null),T(null)},re=Im(c),ie=u.trim()||re?.projectName||``,ae=f.trim()||re?.displayName||``,oe=_t(m,g),{countryValid:se,languageValid:ce}=Pm(m,g),le=se&&ce,ue=!!(c||u||f||m!==`US`||g!==`en`),R=!!(c&&!re&&b);(0,Y.useEffect)(()=>{S&&(w!==null&&I.current?(F.current&&(F.current.open=!0),I.current.focus()):P.current?.focus())},[w,S]);let z=async r=>{if(r.preventDefault(),x(!0),re&&le&&!v){y(!0),C(null),T(null);try{let r=await Hn({name:ie,displayName:ae,canonicalDomain:re.canonicalDomain,country:m,language:g});Hd(`platform`),ne({flowVersion:1,onboardingSessionId:te,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),await n.invalidateQueries({queryKey:Di({client:G})}),await t({to:`/setup`,search:{project:r.name,...e?{onboarding:`first-run`}:{}},replace:!0})}catch(e){y(!1);let t=e instanceof rr&&e.statusCode===409;T(t?Ot(ie):null),C(Lm(e,`Could not create the project. Try again.`)),ne({flowVersion:1,onboardingSessionId:te,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:Qt(e,`project_create_failed`)},`onboarding.blocked:project`),t&&n.invalidateQueries({queryKey:Di({client:G})})}}},de=async e=>{ee(null);try{let t=await a.mutateAsync({client:G,body:{enabled:e}});n.setQueryData(Oi({client:G}),t),t.enabled!==e&&ee(`The server kept telemetry ${t.enabled?`on`:`off`}. Check its telemetry settings.`)}catch{ee(`Could not update telemetry. Try again.`)}};return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:e?`Set up Canonry`:`Add a project`}),e?(0,Z.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,Z.jsx)(q,{asChild:!0,variant:`ghost`,className:`shrink-0`,children:(0,Z.jsxs)(H,{to:`/agent-setup`,children:[(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":`true`}),`Set up with an agent`]})}):null]}),(0,Z.jsxs)(Jd,{label:`Setup progress`,children:[(0,Z.jsx)(Yd,{id:`setup-website`,title:`Website`,mark:`idle`,trailing:(0,Z.jsx)(hr,{tone:`neutral`,className:`shrink-0`,children:`Required`}),children:(0,Z.jsxs)(`form`,{"aria-label":`Website`,className:`space-y-5`,onSubmit:Jr(z),noValidate:!0,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-domain`,children:`Website URL`}),(0,Z.jsx)(`input`,{id:`launchpad-domain`,className:jm,type:`text`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`none`,spellCheck:!1,required:!0,"aria-invalid":R,"aria-describedby":R?`launchpad-domain-error`:void 0,placeholder:`https://example.com`,value:c,onBlur:()=>x(!0),onChange:e=>{l(e.target.value),C(null),T(null)}}),R?(0,Z.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,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-display-name`,children:`Brand name`}),(0,Z.jsx)(`input`,{id:`launchpad-display-name`,className:jm,type:`text`,autoComplete:`organization`,"aria-describedby":`launchpad-display-name-hint`,placeholder:re?.displayName??`Your brand`,value:f,onChange:e=>p(e.target.value)}),(0,Z.jsx)(`p`,{id:`launchpad-display-name-hint`,className:`text-copy-13 text-secondary`,children:`Answers that name this brand count as mentions.`})]}),(0,Z.jsxs)(`details`,{ref:F,className:`group border-t border-default`,children:[(0,Z.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 ${Am}`,children:[(0,Z.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Project details`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 text-secondary`,children:[oe,(0,Z.jsx)(E,{className:`size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":`true`})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-5 pb-4 pt-2`,children:[re?(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:max-w-[50%]`,children:[(0,Z.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-project-name`,children:`Project name`}),(0,Z.jsx)(`input`,{ref:I,id:`launchpad-project-name`,className:jm,type:`text`,placeholder:re.projectName,"aria-invalid":w!==null,"aria-describedby":w===null?void 0:`launchpad-create-error`,value:u,onChange:e=>{d(e.target.value),w!==null&&(T(null),C(null))}})]}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-country`,children:`Country`}),(0,Z.jsx)(`select`,{id:`launchpad-country`,className:jm,value:m,onChange:e=>h(e.target.value),children:Mm.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-language`,children:`Language`}),(0,Z.jsx)(`select`,{id:`launchpad-language`,className:jm,value:g,onChange:e=>_(e.target.value),children:Nm.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]}),S?(0,Z.jsxs)(`div`,{ref:P,className:`rounded-md border border-negative bg-negative-soft p-3`,role:`alert`,tabIndex:-1,children:[(0,Z.jsx)(`p`,{id:`launchpad-create-error`,className:`text-copy-14-strong text-heading`,children:S}),O===null?null:(0,Z.jsx)(q,{asChild:!0,variant:`secondary`,size:`sm`,className:`mt-3`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName`,params:{projectName:O},children:[`Open `,O]})})]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-sm:[&>*]:w-full`,children:[ue?(0,Z.jsx)(q,{type:`button`,variant:`ghost`,disabled:v,onClick:L,children:`Reset unsaved fields`}):null,e?null:(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,className:Am,children:(0,Z.jsx)(H,{to:`/projects`,onClick:()=>Hd(`platform`),children:`Cancel`})}),(0,Z.jsx)(q,{className:Am,type:`submit`,disabled:!re||!le||v,children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` Creating project…`]}):`Continue`})]})]})}),(0,Z.jsx)(Yd,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:`idle`,summary:`How well AI agents can read your site`,trailing:(0,Z.jsx)(Gd,{state:K.not_started})}),(0,Z.jsx)(Yd,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:`idle`,summary:`Whether AI answers mention your brand and cite your site`,trailing:(0,Z.jsx)(Gd,{state:K.not_started})})]}),j===null?null:(0,Z.jsxs)(`section`,{className:`mt-6 border-t border-default pt-5`,"aria-labelledby":`telemetry-title`,children:[(0,Z.jsxs)(`label`,{className:`flex min-h-11 items-start gap-3 py-2 ${a.isPending?`cursor-wait`:`cursor-pointer`}`,children:[(0,Z.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:M??!1,disabled:a.isPending,onChange:e=>{de(e.target.checked)},"aria-describedby":`telemetry-detail`}),(0,Z.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{id:`telemetry-title`,className:`text-label-14 text-heading`,children:`Share anonymous product telemetry`}),(0,Z.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,Z.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,role:`status`,children:`Saving preference…`}):null,N?(0,Z.jsx)(`p`,{className:`mt-1 text-copy-14 text-negative`,role:`alert`,children:N}):null]})]})}function Wm(){return(0,Z.jsx)(`div`,{className:`page-container`,children:(0,Z.jsx)(`section`,{className:`page-section`,children:(0,Z.jsxs)(Ii,{className:`surface-card empty-card`,children:[(0,Z.jsx)(`h1`,{children:`Page not found`}),(0,Z.jsx)(`p`,{children:`This page may have moved. Choose a project to continue.`}),(0,Z.jsx)(q,{asChild:!0,children:(0,Z.jsx)(H,{to:`/projects`,children:`View projects`})})]})})})}var Gm=`modulepreload`,Km=function(e,t){return new URL(e,t).href},qm={},Jm=function(e){return e.pathname.endsWith(`.css`)},Ym=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},Xm=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=Km(t,n);let r=s(t),i=Jm(r);return Ym(qm,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`:Gm,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)})},Zm=V(()=>Xm(()=>import(`./ProjectPage-HpOMuZBk.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]),import.meta.url),`ProjectPage`),Qm=V(()=>Xm(()=>import(`./RunsPage-CRnzj7dU.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,13,14,15,16]),import.meta.url),`RunsPage`),$m=V(()=>Xm(()=>import(`./HistoryPage-CtOK4bCH.js`),__vite__mapDeps([24,4,1,2,18,5,6,3,7,14,11]),import.meta.url),`HistoryPage`),eh=V(()=>Xm(()=>import(`./SettingsPage-BumPFoPz.js`),__vite__mapDeps([25,1,2,4,5,6,3,7,8,9,10,11,12,13]),import.meta.url),`SettingsPage`),th=V(()=>Xm(()=>import(`./AgentSetupPage-BEYkXfMI.js`),__vite__mapDeps([26,1,2,4,7,3,6,10,12]),import.meta.url),`AgentSetupPage`),nh=V(()=>Xm(()=>import(`./BacklinksPage-CU089NxY.js`),__vite__mapDeps([27,1,2,4,7,3,6,12,11,17,16]),import.meta.url),`BacklinksPage`),rh=V(()=>Xm(()=>import(`./TrafficPage-CxEO_Y2c.js`),__vite__mapDeps([28,1,2,4,5,6,3,7,14,11,22,12,13,15,16,20]),import.meta.url),`TrafficPage`),ih=V(()=>Xm(()=>import(`./TrafficSourceDetailPage-D9me5kmv.js`),__vite__mapDeps([29,1,2,4,5,6,3,7,9,15,16,11,20,13,14,21]),import.meta.url),`TrafficSourceDetailPage`),ah=V(()=>Xm(()=>import(`./MeasurementPropertyPage-C-XeLSL1.js`),__vite__mapDeps([30,1,2,4,5,6,3,7,8,9,10,11,14,15,16,19]),import.meta.url),`MeasurementPropertyPage`);function oh(){return(0,Z.jsx)(Cu,{children:(0,Z.jsx)(Qi,{children:(0,Z.jsx)(vu,{})})})}var sh=Ee()({component:oh,notFoundComponent:Wm,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,seoProfileId:typeof e.seoProfileId==`string`?e.seoProfileId:void 0,seoRunId:typeof e.seoRunId==`string`?e.seoRunId:void 0,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`].map(t=>[t,typeof e[t]==`string`&&e[t]?e[t]:void 0]))})}),ch=Me({getParentRoute:()=>sh,path:`/`,component:Nd,beforeLoad:async({context:e})=>{let t=e.queryClient.getQueryData(Di({client:G}));if(t===void 0)try{t=await e.queryClient.ensureQueryData(_i({client:G}))}catch{return}if(t.length===0)throw ke({to:`/setup`})}}),lh=Me({getParentRoute:()=>sh,path:`/projects`,component:Ld}),uh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,dh=Me({getParentRoute:()=>sh,path:`/projects/$projectName`,component:()=>(0,Z.jsx)(Fe,{}),beforeLoad:async({context:e,params:t,location:n})=>{let r=t.projectName;if(!uh.test(r))return;let i=e.queryClient.getQueryData(Di({client:G}));if(!i)try{i=await e.queryClient.ensureQueryData(_i({client:G}))}catch{return}let a=i.find(e=>e.id===r);if(a)throw ke({to:n.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(a.name)}`),replace:!0})}}),fh=Me({getParentRoute:()=>dh,path:`/`,component:()=>(0,Z.jsx)(Zm,{tab:`overview`})}),ph=Me({getParentRoute:()=>dh,path:`/portfolio`,component:()=>(0,Z.jsx)(Zm,{tab:`portfolio`})}),mh=Me({getParentRoute:()=>dh,path:`/search-console`,component:()=>(0,Z.jsx)(Zm,{tab:`search-console`})}),hh=Me({getParentRoute:()=>dh,path:`/seo-data`,component:()=>(0,Z.jsx)(Zm,{tab:`seo-data`})}),gh=Me({getParentRoute:()=>dh,path:`/journeys`,component:()=>(0,Z.jsx)(Zm,{tab:`journeys`})}),_h=Me({getParentRoute:()=>dh,path:`/conversions`,component:()=>(0,Z.jsx)(Zm,{tab:`conversions`})}),vh=Me({getParentRoute:()=>dh,path:`/local`,component:()=>(0,Z.jsx)(Zm,{tab:`local`})}),yh=Me({getParentRoute:()=>dh,path:`/discovery`,component:()=>(0,Z.jsx)(Zm,{tab:`discovery`})}),bh=Me({getParentRoute:()=>dh,path:`/queries`,component:()=>(0,Z.jsx)(Zm,{tab:`queries`})}),xh=Me({getParentRoute:()=>dh,path:`/client-queries`,component:()=>(0,Z.jsx)(Zm,{tab:`client-queries`})}),Sh=Me({getParentRoute:()=>dh,path:`/properties/$targetKey`,component:()=>(0,Z.jsx)(ah,{})}),Ch=Me({getParentRoute:()=>dh,path:`/report`,beforeLoad:({params:e})=>{throw ke({to:`/projects/$projectName`,params:e,replace:!0})}}),wh=Me({getParentRoute:()=>dh,path:`/activity`,component:()=>(0,Z.jsx)(Zm,{tab:`activity`})}),Th=Me({getParentRoute:()=>dh,path:`/traffic`,component:()=>(0,Z.jsx)(Zm,{tab:`traffic`})}),Eh=Me({getParentRoute:()=>dh,path:`/backlinks`,component:()=>(0,Z.jsx)(Zm,{tab:`backlinks`})}),Dh=Me({getParentRoute:()=>dh,path:`/agent-readiness`,component:()=>(0,Z.jsx)(Zm,{tab:`agent-readiness`})}),Oh=Me({getParentRoute:()=>dh,path:`/technical-aeo`,beforeLoad:({params:e,location:t})=>{throw ke({to:`/projects/$projectName/agent-readiness`,params:e,search:t.search,hash:t.hash,replace:!0})}}),kh=Me({getParentRoute:()=>dh,path:`/history`,component:()=>(0,Z.jsx)(Zm,{tab:`history`})}),Ah=Me({getParentRoute:()=>dh,path:`/settings`,component:()=>(0,Z.jsx)(Zm,{tab:`settings`})}),jh=Me({getParentRoute:()=>sh,path:`/runs`,component:Qm}),Mh=Me({getParentRoute:()=>sh,path:`/history`,component:$m}),Nh=Me({getParentRoute:()=>sh,path:`/settings`,component:eh,beforeLoad:({context:e})=>{}}),Ph=Me({getParentRoute:()=>sh,path:`/setup`,component:Bm}),Fh=Me({getParentRoute:()=>sh,path:`/agent-setup`,component:th}),Ih=Me({getParentRoute:()=>sh,path:`/backlinks`,component:nh}),Lh=Me({getParentRoute:()=>sh,path:`/traffic`,component:rh}),Rh=Me({getParentRoute:()=>sh,path:`/traffic/$projectName/$sourceId`,component:ih}),zh=sh.addChildren([ch,lh,dh.addChildren([fh,ph,mh,hh,gh,_h,vh,yh,bh,xh,Sh,Ch,wh,Th,Eh,Dh,Oh,kh,Ah]),jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh]);function Bh(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:`/`}var Vh=Bh(),Hh=Vh===`/`?``:Vh.replace(/\/$/,``);function Uh(e,t){return we({routeTree:zh,basepath:Hh||`/`,context:{queryClient:e},...t?.initialEntries&&{history:Ae({initialEntries:t.initialEntries})}})}var Wh=6e4,Gh=6e4,Kh=1e4,qh=3e4;function Jh(){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<=qh&&t-a<=qh){let e=Ye-r.foregroundMs,t=Math.min(n,e);r.foregroundMs+=t,r.activeMs+=Math.min(t,Math.max(0,o+Wh-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,Kt({event:`ui.page_time`,page:t,visitId:r.id,foregroundMs:l,activeMs:Math.floor(r.activeMs),completed:e}))},f=()=>{r={id:Yt(),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>=Gh&&d()},Kh),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=Dt(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 Yh=!1,Xh;async function Zh(e){return(await tn({client:G,body:e,keepalive:!0})).data}function Qh(){Yh||typeof window>`u`||(Yh=!0,!(We()||St())&&(Xh=Jh(),bt({send:Zh,onDisabled:()=>Xh?.stop()}),G.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`||Mt({method:e.method,route:r,network:!0}),t}},e}),G.interceptors.response.use((e,t,n)=>(Mt({method:t.method,route:typeof n.url==`string`?n.url:void 0,path:eg(t.url),status:e.status}),e)),window.addEventListener(`error`,e=>{nt({kind:`unhandled`,error:e.error})}),window.addEventListener(`unhandledrejection`,e=>{nt({kind:`unhandled`,error:e.reason})}),ag()))}function $h(e){let t=null,n=()=>{let n=e.state.matches.at(-1);if(!n)return;Xh?.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&&lt(t.search,i),t={pathname:r.pathname,search:i}};n();let r=e.subscribe(`onResolved`,n);return()=>{r(),Xh?.clear()}}function eg(e){try{return new URL(e,window.location.origin).pathname}catch{return}}var tg={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function ng(e,t){let[n,r]=tg[e];return t<=n?`good`:t<=r?`needs-improvement`:`poor`}function rg(){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 ig(){let e=0;return{add(t){t.interactionId&&(e=Math.max(e,t.duration))},value:()=>e}}function ag(){if(typeof PerformanceObserver>`u`)return;let e=new Set,t=(t,n)=>{!e.has(t)&&Number.isFinite(n)&&(e.add(t),gt(t,ng(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=rg();n(`layout-shift`,e=>{for(let t of e)i.add({startTime:t.startTime,value:t.value??0,hadRecentInput:t.hadRecentInput===!0})});let a=ig();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 og=6e4,sg=`Anyone with this password can sign in to this dashboard.`,cg={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`},lg={id:`embed`,scopes:[`read`,`embed`],projectId:`embed`,readOnly:!0};function ug(){let e=(0,Y.useRef)(Or()).current,[t,n]=(0,Y.useState)(e?`ready`:`checking`),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(e),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(`password`),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(``),[D,O]=(0,Y.useState)(null),[k,A]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(!1),[N,ee]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(!1),[I]=(0,Y.useState)(()=>Yi().error),te=(0,Y.useRef)(null),ne=(0,Y.useRef)(null),L=(0,Y.useRef)(null),re=()=>{let t=r?`${r.name}:${r.role}`:e?`api-key:explicit`:a?`api-key:${a.id}`:`no-accounts`;if(!te.current||L.current!==t){ne.current?.clear();let e=Xr();ne.current=e,te.current=Uh(e),L.current=t}return{queryClient:ne.current,router:te.current}},ie=t===`ready`?re().router:null;(0,Y.useEffect)(()=>{if(ie)return $h(ie)},[ie]);let ae=e=>e.authRequired?(u(!0),ee(e.signInMethods?.chatgpt===!0),i(e.user),o(null),c(!1),n(e.user?`ready`:`account-login`),!0):!1;(0,Y.useEffect)(()=>{let t=!1,r=async(e,r=!1)=>{try{let e=await it();if(t)return;o(e),c(!1),n(`ready`)}catch(i){if(t)return;if(r&&i instanceof rr&&i.statusCode===401)return Bt().then(()=>{t||(O(null),o(null),c(!1),M(!0),n(`login`))}).catch(r=>{t||(O(r instanceof Error?r.message:`Could not clear the invalid session`),n(e))});O(i instanceof Error?i.message:`Could not verify API key access`),n(e)}};return e?(r(`api-key-error`),()=>{t=!0}):(Promise.allSettled([Lt(),mr()]).then(([e,i])=>{if(t||e.status===`fulfilled`&&ae(e.value))return;if(i.status===`rejected`){let e=i.reason;O(e instanceof Error?e.message:`Failed to reach the Canonry API`),n(`login`);return}let a=i.value;a.authenticated&&We()?(o(lg),c(!1),n(`ready`)):a.authenticated?(c(!0),r(`api-key-error`,!0)):(o(null),c(!1),n(a.setupRequired?`setup`:`login`))}),()=>{t=!0})},[]),(0,Y.useEffect)(()=>{if(t!==`ready`||e)return;let r=setInterval(()=>{l?Lt().then(e=>{e.authRequired&&!e.user&&(M(!0),i(null),o(null),n(`account-login`))}).catch(()=>{}):mr().then(e=>{e.authenticated||(M(!0),o(null),n(e.setupRequired?`setup`:`login`))}).catch(()=>{})},og);return tr(()=>{M(!0),i(null),o(null),c(!1),n(l?`account-login`:`login`)}),()=>{clearInterval(r),tr(null)}},[t,l,e]);let oe=async e=>{if(e.preventDefault(),!p.trim()||p.trim().length<8){O(`Password must be at least 8 characters`);return}if(p!==g){O(`Passwords do not match`);return}let t=w.trim();if(S&&!t)O(cg.missing);else{A(!0),O(null);try{if(!(await In(p.trim(),S?t:void 0)).authenticated){O(`Setup failed`);return}m(``),_(``),T(``),C(!1),y(!1),M(!1),o(null),c(!0),n(`checking`);try{let e=await it();o(e),c(!1),n(`ready`)}catch(e){O(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){if(e instanceof rr&&e.statusCode===401&&e.code===`AUTH_REQUIRED`){O(S?cg.rejected:null),C(!0);return}O(e instanceof rr||e instanceof Error?e.message:`Setup failed`)}finally{A(!1)}}},se=e=>{m(e),O(null)},ce=e=>{T(e),O(null)},le=e=>{_(e),O(null)},ue=async e=>{if(e.preventDefault(),p.trim()){A(!0),O(null);try{if(!(b===`api-key`?await rt(p.trim()):await ut(p.trim())).authenticated){O(b===`api-key`?`Invalid API key`:`Incorrect password`);return}let e=await it();o(e),c(!1),m(``),y(!1),M(!1),n(`ready`)}catch(e){O(e instanceof rr||e instanceof Error?e.message:`Authentication failed`)}finally{A(!1)}}},R=e=>{x(e),m(``),y(!1),O(null)},z=async e=>{if(e.preventDefault(),d.trim()&&p){A(!0),O(null);try{let e=await Yn(d.trim(),p);if(!e.user){O(`Incorrect name or password.`);return}m(``),M(!1),i(e.user),o(null),c(!1),n(`ready`)}catch(e){O(e instanceof rr?e.message:`Incorrect name or password.`)}finally{A(!1)}}};if(t===`ready`){let{queryClient:e,router:t}=re();return(0,Z.jsx)(qr,{account:r,apiKey:a,apiKeyPending:s,children:(0,Z.jsx)(be,{client:e,children:(0,Z.jsx)(je,{router:t})})})}let de=p.trim(),fe=p.length>0&&de.length<8,pe=g.length>0&&p!==g,me=de.length>=8&&p===g&&(!S||w.trim().length>0),B=e=>(0,Z.jsxs)(`form`,{id:e.formId,className:`space-y-4`,onSubmit:Jr(z),children:[(0,Z.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-name`,children:[(0,Z.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Name`}),(0,Z.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),O(null)},"aria-invalid":!!D,"aria-describedby":D?`account-login-error`:void 0})]}),(0,Z.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-password`,children:[(0,Z.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Password`}),(0,Z.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=>se(e.target.value),"aria-invalid":!!D,"aria-describedby":D?`account-login-error`:void 0})]}),D?(0,Z.jsx)(`p`,{id:`account-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:D}):null,(0,Z.jsx)(q,{type:`submit`,variant:e.secondary?`secondary`:`default`,disabled:k||!d.trim()||!p,children:k?`Signing in…`:`Sign in`})]});return(0,Z.jsx)(`div`,{className:`min-h-screen bg-bg px-4 py-8`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5`,children:[(0,Z.jsxs)(`div`,{"data-testid":`auth-brand`,className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(Ba,{className:`size-7`}),(0,Z.jsx)(`span`,{className:`text-label-18-strong text-heading`,children:`Canonry`})]}),(0,Z.jsx)(Ii,{className:`surface-card w-full`,children:t===`checking`?(0,Z.jsx)(Pi,{className:`py-8`,children:(0,Z.jsx)(`p`,{className:`supporting-copy text-center`,children:`Connecting to Canonry…`})}):t===`api-key-error`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ni,{children:(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Could not verify API key access`})}),(0,Z.jsxs)(Pi,{className:`space-y-4`,children:[(0,Z.jsx)(`p`,{className:`supporting-copy`,children:D??`Canonry could not verify this session’s access, so the dashboard stayed locked.`}),(0,Z.jsx)(q,{type:`button`,className:`w-full`,onClick:()=>{window.location.reload()},children:`Try again`})]})]}):t===`account-login`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ni,{children:(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`})}),N?(0,Z.jsxs)(Pi,{className:`space-y-4`,children:[j?(0,Z.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.`}):I?(0,Z.jsx)(`p`,{role:`alert`,className:`rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:Ue[I]}):null,(0,Z.jsx)(Ac,{href:_n(`login`,Xi()),className:`w-full`}),(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":P,"aria-controls":`account-password-form`,onClick:()=>F(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:[P?(0,Z.jsx)(E,{className:`h-4 w-4`,"aria-hidden":`true`}):(0,Z.jsx)(h,{className:`h-4 w-4`,"aria-hidden":`true`}),`Sign in with a password`]}),P?B({secondary:!0,formId:`account-password-form`}):null]}):(0,Z.jsxs)(Pi,{children:[j?(0,Z.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,B({secondary:!1})]})]}):t===`setup`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ni,{children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Create a dashboard password`}),(0,Z.jsx)(Fi,{children:sg})]}),(0,Z.jsx)(Pi,{children:(0,Z.jsxs)(`form`,{className:`space-y-4`,onSubmit:Jr(oe),children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-new`,children:`Password`}),(0,Z.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=>se(e.target.value),"aria-invalid":fe,"aria-describedby":`dashboard-password-new-help`}),(0,Z.jsx)(`span`,{id:`dashboard-password-new-help`,"aria-live":`polite`,className:fe?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:fe?`Enter at least 8 characters.`:`Use at least 8 characters.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-confirm`,children:`Confirm password`}),(0,Z.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=>le(e.target.value),"aria-invalid":pe,"aria-describedby":`dashboard-password-confirm-help`}),(0,Z.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.`})]}),S?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-setup-root-key`,children:cg.label}),(0,Z.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:w,onChange:e=>ce(e.target.value),"aria-invalid":D===cg.rejected,"aria-describedby":`dashboard-setup-root-key-help`}),(0,Z.jsx)(`span`,{id:`dashboard-setup-root-key-help`,"aria-live":`polite`,className:`block text-label-14 text-secondary`,children:cg.help})]}):null,(0,Z.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-password-show`,children:[(0,Z.jsx)(`input`,{id:`dashboard-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),S?cg.show:`Show passwords`]}),D?(0,Z.jsx)(`p`,{id:`dashboard-password-setup-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:D}):null,(0,Z.jsx)(q,{type:`submit`,disabled:k||!me,children:k?`Creating password…`:`Create password and continue`})]})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ni,{children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`}),(0,Z.jsx)(Fi,{children:b===`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,Z.jsxs)(Pi,{children:[j?(0,Z.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,Z.jsxs)(`form`,{className:`space-y-4`,onSubmit:Jr(ue),children:[(0,Z.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`dashboard-password-current`,children:[(0,Z.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:b===`api-key`?`Canonry API key`:`Password`}),(0,Z.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:b===`api-key`?`apiKey`:`password`,autoComplete:b===`api-key`?`off`:`current-password`,spellCheck:!1,required:!0,value:p,onChange:e=>se(e.target.value),"aria-invalid":!!D,"aria-describedby":D?`dashboard-password-login-error`:void 0})]}),(0,Z.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,Z.jsx)(`input`,{id:`dashboard-login-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),b===`api-key`?`Show API key`:`Show password`]}),D?(0,Z.jsx)(`p`,{id:`dashboard-password-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:D}):null,(0,Z.jsx)(q,{type:`submit`,disabled:k||!p.trim(),children:k?`Signing in…`:`Open dashboard`}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>R(b===`api-key`?`password`:`api-key`),children:b===`api-key`?`Use dashboard password instead`:`Forgot password? Use API key`})]})]})]})})]})})}var dg=document.getElementById(`root`);if(!dg)throw Error(`Expected #root element for web app bootstrap.`);Qh(),(0,Hi.createRoot)(dg).render((0,Z.jsx)(Y.StrictMode,{children:(0,Z.jsx)(Ja,{children:(0,Z.jsx)(ug,{})})}));export{mc as $,Zd as A,to as At,Tu as B,la as Bt,af as C,po as Ct,ef as D,so as Dt,of as E,lo as Et,gd as F,Aa as Ft,Xc as G,ru as H,Ji as Ht,_d as I,ja as It,Dc as J,Sc as K,ld as L,oa as Lt,jd as M,Ua as Mt,yd as N,ka as Nt,Xd as O,io as Ot,fd as P,Fa as Pt,uc as Q,cd as R,ca as Rt,Sf as S,ho as St,tf as T,fo as Tt,au as U,wu as V,$i as Vt,tu as W,_c as X,Ec as Y,fc as Z,jf as _,go as _t,Hp as a,qs as at,bf as b,Co as bt,jp as c,zs as ct,Vf as d,zo as dt,gc as et,Jf as f,No as ft,Of as g,Do as gt,Tf as h,Oo as ht,Vp as i,Ys as it,Fd as j,Xa as jt,Qd as k,eo as kt,_p as l,Ls as lt,Lf as m,Mo as mt,Wp as n,hc as nt,Rp as o,Ws as ot,Ff as p,Ro as pt,xc as q,zp as r,ic as rt,Bp as s,Hs as st,Xm as t,dc as tt,np as u,ps as ut,Af as v,So as vt,lf as w,mo as wt,xf as x,wo as xt,Cf as y,To as yt,dd as z,na as zt};
43
+ `)),T(!0)),x(!0))},[_.queriesText,b,p,f.isPending,T,w]),(0,Y.useEffect)(()=>{b&&Vd(g,{...!C.saved&&C.text!==h?{queriesText:C.text}:{},..._.competitorsText===void 0?{}:{competitorsText:_.competitorsText}})},[_.competitorsText,g,C.saved,C.text,b,h]);let{emit:E,onboardingSessionId:D}=d;(0,Y.useEffect)(()=>{b&&E({flowVersion:1,onboardingSessionId:D,event:`onboarding.started`,step:i===`first-check`?`run`:`queries`,resumed:!0},`onboarding.started`)},[E,i,D,b]);let O=(0,Y.useRef)(null),k=(0,Y.useRef)(v);(0,Y.useEffect)(()=>{if(k.current===v)return;k.current=v;let e=O.current?.querySelector(`h2, h3`);e&&(e.tabIndex=-1,e.focus())},[v]);let A=(0,Y.useRef)(null),j=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{if(!j.current)return;let e=document.activeElement;if(e&&e!==document.body){j.current=!1;return}let t=A.current?.querySelector(`h3`);t&&(j.current=!1,t.tabIndex=-1,t.focus())});let M=qn(),N=of(c,v===`first-check`&&!M),ee=wp(N.data),{systemBlockReason:P,blockedReason:F}=kp(n,t,S),I=F??(f.isSuccess&&m===0?`Add at least one query before launching the first check.`:void 0),te=Rp(),[ne,L]=(0,Y.useState)(!1),[re,ie]=(0,Y.useState)(null),ae=e.displayName||c,oe=async()=>{if(!M&&!(N.isError||N.isFetching||N.data?.canStart!==!0)){if(I)ie(I),S.usesProjectProviderReadiness||E({flowVersion:1,onboardingSessionId:D,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:Gn(S.runnableProviderCount),queryCountBucket:Gn(m),reasonCode:P??(m===0?`no_queries`:`run_rejected`)});else{L(!0),ie(null);try{let e=await te.mutateAsync({projectName:c,projectLabel:ae,sourceAction:`setup-launch`,suppressQueuedToast:!0});rn(c,e.id,J[`answer-visibility`]),s(e.id),S.usesProjectProviderReadiness||E({flowVersion:1,onboardingSessionId:D,event:`run.requested`,origin:`dashboard_setup`,result:`queued`,providerCountBucket:Gn(S.runnableProviderCount),queryCountBucket:Gn(m)})}catch(e){ie(e instanceof Error?e.message:`Failed to queue the AI Visibility check. Retry when the instance is ready.`),S.usesProjectProviderReadiness||E({flowVersion:1,onboardingSessionId:D,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,providerCountBucket:Gn(S.runnableProviderCount),queryCountBucket:Gn(m),reasonCode:Qt(e,`run_rejected`)})}finally{L(!1)}}}},se=S.isAdmin&&(S.providerFormVisible||S.inlineModelPicker),ce=S.providerReadiness===!1&&!re;return(0,Z.jsxs)(`div`,{ref:A,children:[(0,Z.jsx)(cm,{current:v,done:{engine:S.providerReadiness===!0,queries:m>0,"first-check":!1},hasBaseline:a}),(0,Z.jsx)(`div`,{ref:O,children:v===`engine`?(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsx)(xp,{engines:S,headingLevel:`h3`}),(0,Z.jsxs)(`div`,{className:`setup-nav`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>S.providerGuard.request(o),children:`Back`}),(0,Z.jsx)(q,{type:`button`,variant:se?`secondary`:`default`,onClick:()=>S.providerGuard.request(()=>{S.closeProviderForm(),y(`queries`)}),children:`Continue`})]})]}):v===`queries`?(0,Z.jsx)(`div`,{className:`space-y-3`,"aria-labelledby":`setup-queries-heading`,children:(0,Z.jsx)(Dp,{queries:C,headingLevel:`h3`,loading:f.isPending||!b,loadFailed:f.isError,onRetryLoad:()=>{f.refetch()},onBack:()=>y(`engine`),note:(0,Z.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Sp,{engines:S}),(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`section-head`,children:(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-heading-16 text-heading`,children:M?`AI Visibility`:a?`Run an AI Visibility check`:`Run your first AI Visibility check`}),M?null:(0,Z.jsx)(Mi,{text:Cp(ae,ee)})]})})}),M?(0,Z.jsx)(Ep,{projectName:c,error:re,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(q,{type:`button`,onClick:()=>{l({to:`/projects/$projectName`,params:{projectName:c},replace:!0})},children:`Open project dashboard →`})]})}):(0,Z.jsx)(Tp,{preview:N,details:[{label:`Website`,value:e.canonicalDomain},{label:`Market`,value:_t(e.country,e.language)}],queries:p??[],usesAccount:ee,alert:ce?null:re??I??null,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>y(`queries`),children:`Back`}),ce?(0,Z.jsx)(q,{type:`button`,onClick:()=>y(`engine`),children:`Connect an AI engine`}):(0,Z.jsx)(q,{type:`button`,disabled:ne||!!I||N.isError||N.isFetching||N.data?.canStart!==!0,title:I,onClick:Jr(oe),children:ne?`Starting…`:re?`Retry check`:a?`Run check`:`Run first check`})]})})]})]})}),S.providerGuard.dialog]})}var fm=`Public pages only, read by this Canonry server and stored with this project. The first scan reads up to 100 pages, then stops.`,pm=ur.enum;function mm(e){return e===K.queued||e===K.running}function hm(e){return e===K.not_started||e===K.cancelled||e===K.failed}function gm(e,t,n){return`${e} ${e===1?t:n}`}function _m({projectName:e,firstRun:t,track:n}){let r=De(),i=Se(),{canWrite:a,isAdmin:o}=Kr(),s=U({...yi({client:G,path:{name:e}}),retry:!1,refetchInterval:({state:e})=>{let t=e.data;return t&&(mm(t.tracks.agentReadiness.state)||mm(t.tracks.aiVisibility.state))?3e3:!t?.complete&&15e3}}),c=U({...ui({client:G,path:{name:e}}),retry:!1}),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useRef)(!1),h=s.data?.tracks.aiVisibility;(0,Y.useEffect)(()=>{h&&(mm(h.state)?(m.current=!0,u(null)):n===`ai-visibility`&&!m.current&&(m.current=!0,u(Em(h.blockedBy))))},[n,h]);let g=()=>i.invalidateQueries({queryKey:wi({client:G,path:{name:e}})}),_=vm(e,s.data);ym(s.data);let v=s.isSuccess;(0,Y.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,Z.jsx)(xm,{});if(s.isError){let n=eo(s.error).code===`NOT_FOUND`;return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:t?`Set up Canonry`:`Project setup`}),(0,Z.jsxs)(`div`,{role:`alert`,className:`mt-6 rounded-md border border-negative bg-negative-soft p-4`,children:[(0,Z.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:n?`No project named ${e}.`:`Setup status could not be loaded.`}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:n?(0,Z.jsx)(q,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,Z.jsx)(H,{to:`/projects`,children:`View projects`})}):(0,Z.jsx)(q,{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=tt(S.project.canonicalDomain),E=C?_t(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&&!mm(O.state),j=A||!a?null:hm(D.state)?`agent-readiness`:hm(O.state)&&!k?`ai-visibility`:null;return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{ref:p,tabIndex:-1,className:`text-heading-24 text-heading outline-none`,children:t?`Set up Canonry`:`Project setup`}),(0,Z.jsxs)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:[S.complete?`Setup complete · `:null,w,` · `,T]})]}),(0,Z.jsx)(q,{asChild:!0,variant:S.complete?`default`:`ghost`,className:`shrink-0`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open project`,S.complete?null:(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":`true`})]})})]}),(0,Z.jsxs)(Jd,{label:`Setup progress`,children:[(0,Z.jsx)(Yd,{id:`setup-website`,title:`Website`,mark:`done`,summary:E?`${T} · ${E}`:T,trailing:a?(0,Z.jsxs)(H,{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,Z.jsx)(`span`,{className:`sr-only`,children:` website`})]}):null}),(0,Z.jsx)(Tm,{projectName:e,projectId:C?.id??null,brand:w,track:D,primary:j===`agent-readiness`,canWrite:a,onStarted:async e=>{_(e,J[`site-audit`]),await g()},onCancelled:g}),(0,Z.jsx)(Om,{projectName:e,brand:w,domain:T,track:O,panelStep:A?l:null,onOpenPanel:b,onClosePanel:x,starting:k,onLaunched:e=>{_(e,J[`answer-visibility`]),f({runId:e,listedRunId:O.runId}),x(),g()},onCancelled:g,primary:j===`ai-visibility`,canWrite:a,isAdmin:o})]}),(0,Z.jsx)(`p`,{role:`status`,className:`sr-only`,children:Sm(D)}),(0,Z.jsx)(`p`,{role:`status`,className:`sr-only`,children:Cm(O,k?K.queued:O.state)}),S.complete?(0,Z.jsx)(df,{projectName:e}):null]})}function vm(e,t){let{emit:n,onboardingSessionId:r}=Ud(`site_health`),{emit:i,onboardingSessionId:a}=Ud(`wizard`),o=(0,Y.useRef)(new Map);return(0,Y.useEffect)(()=>{let t=Re(e);t?.kind&&o.current.set(t.runId,t.kind)},[e]),(0,Y.useEffect)(()=>{if(!t)return;let e=[{...t.tracks.agentReadiness,kind:J[`site-audit`],answers:null},{...t.tracks.aiVisibility,kind:J[`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===J[`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:Gn(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),ft(t)}},[a,i,n,r,t]),(t,i)=>{o.current.set(t,i),i===J[`site-audit`]&&(rn(e,t,i),n({flowVersion:1,onboardingSessionId:r,event:`onboarding.started`,step:`run`,resumed:!1},`onboarding.started:${t}`))}}function ym(e){let t=Se(),n=e?.tracks.agentReadiness.state,r=e?.tracks.aiVisibility.state,i=(0,Y.useRef)({});(0,Y.useEffect)(()=>{let e=i.current;i.current={scan:n,check:r};let a=(e,t)=>e!==void 0&&t!==void 0&&mm(e)&&!mm(t);(a(e.scan,n)||a(e.check,r))&&t.invalidateQueries({queryKey:ki({client:G})})},[n,r,t])}function bm({runIds:e,noun:t,note:n,onCancelled:r}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),c=Le({...ji({client:G}),meta:{skipGlobalErrorToast:!0}}),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=(0,Y.useRef)(!1);(0,Y.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`&&eo(e.reason).code!==`RUN_NOT_CANCELLABLE`);n&&s(`The ${t} could not be stopped. ${W(n.reason)}`),await r()};return i?(0,Z.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,Z.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Stop the `,t,`? `,n]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 max-sm:w-full max-sm:[&>*]:flex-1`,children:[(0,Z.jsx)(q,{ref:u,type:`button`,variant:`ghost`,"aria-disabled":c.isPending||void 0,onClick:()=>{c.isPending||f(!1)},children:`Keep running`}),(0,Z.jsx)(q,{type:`button`,variant:`secondary`,"aria-disabled":c.isPending||void 0,onClick:()=>{p()},children:c.isPending?`Stopping…`:`Stop ${t}`})]}),o?(0,Z.jsx)(`p`,{role:`alert`,className:`w-full text-right text-copy-14 text-negative`,children:o}):null]}):(0,Z.jsxs)(q,{ref:l,type:`button`,variant:`ghost`,"data-focus-skip":!0,onClick:()=>f(!0),children:[`Cancel `,t]})}function xm(){return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,children:[(0,Z.jsx)(`div`,{className:`skeleton-text h-6 w-40`}),(0,Z.jsx)(`div`,{className:`skeleton-text-sm mt-2 w-56`}),(0,Z.jsx)(`div`,{className:`material-base mt-6 space-y-6 p-5`,children:[1,2,3].map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`div`,{className:`skeleton-text w-32`}),(0,Z.jsx)(`div`,{className:`skeleton-text-sm w-64`})]}),(0,Z.jsx)(`div`,{className:`skeleton h-5 w-20 rounded-md`})]},e))})]})}function Sm(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.`}case K.failed:return`Agent Readiness audit scan failed.`;case K.cancelled:return`Agent Readiness audit scan cancelled.`;default:return e.state}}function Cm(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} ${gm(r.answers,`answer`,`answers`)} from ${gm(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 wm(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 pm.queued:return{phase:`Waiting to start`,count:null,done:null,total:null};case pm.discovering:return{phase:`Finding pages`,count:t.pagesFound===null?null:`${t.pagesFound} found`,done:null,total:null};case pm.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 pm[`arranging-map`]:return{phase:`Building the score`,count:gm(t.pagesChecked,`page checked`,`pages checked`),done:null,total:null};case pm.completed:case pm.partial:case pm.failed:case pm.cancelled:return{phase:`Finishing`,count:null,done:null,total:null};default:return t.phase}}function Tm({projectName:e,projectId:t,brand:n,track:r,primary:i,canWrite:a,onStarted:o,onCancelled:s}){let c=Bp(),{onboardingSessionId:l,emit:u}=Ud(`platform`),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.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. ${W(e)}`),u({flowVersion:1,onboardingSessionId:l,event:`run.requested`,origin:`dashboard_setup`,result:`rejected`,kind:`site_health`,providerCountBucket:`0`,queryCountBucket:`0`,reasonCode:Qt(e,`run_rejected`)})}finally{m(!1)}}},_=e=>a?(0,Z.jsx)(q,{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,Z.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,Z.jsx)(Mi,{text:fm})]}),b=_(h===K.cancelled?`Run audit scan again`:`Run audit scan`);break;case K.queued:case K.running:{let e=wm(r),t=r.progress;y=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ff,{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,Z.jsxs)(`details`,{className:`mt-2`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Scan details`}),(0,Z.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,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:e}),(0,Z.jsx)(`dd`,{className:`text-label-14-strong tabular-nums text-heading`,children:t===null?`Unavailable`:t.toLocaleString()})]},e))})]}):null]}),b=a&&r.runId?(0,Z.jsx)(bm,{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=h===K.partial?`The scan stopped before it reached every page.`:null,y=t?(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`text-heading-20 tabular-nums text-heading`,children:t.score===null?`–`:Math.round(t.score)}),(0,Z.jsxs)(`span`,{className:`text-label-14 text-secondary`,children:[t.score===null?`Score unavailable`:h===K.partial?`of 100 so far`:`of 100`,` · `,gm(t.pagesScored,`page scored`,`pages scored`)]})]}):(0,Z.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`The scan finished.`}),b=(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName/agent-readiness`,params:{projectName:e},children:[`Open Agent Readiness`,(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":`true`})]})});break}case K.failed:v=`The scan did not finish.${r.error?` ${r.error}`:``}`,b=_(`Run audit scan again`);break;default:return h}return(0,Z.jsxs)(Yd,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:Kd(h),summary:v,trailing:(0,Z.jsx)(Gd,{state:h}),action:b,children:[y,d?(0,Z.jsx)(`p`,{role:`alert`,className:`${y?`mt-3 `:``}text-copy-14 text-negative`,children:d}):null]})}function Em(e){switch(e){case null:return`first-check`;case Nn.no_engine:case Nn.engines_failing:return`engine`;case Nn.no_queries:return`queries`;case Nn.plan_unpublished:return null;default:return e}}function Dm(e,t,n){let r=`Whether AI answers mention ${t} and cite ${n}.`,i=e.baselineRunId===null;switch(e.blockedBy){case Nn.no_engine:return{line:`${r} Needs an AI engine.`,action:`Connect an AI engine`,step:`engine`};case Nn.no_queries:return{line:`${r} Add queries to check.`,action:`Add queries`,step:`queries`};case Nn.plan_unpublished:return{line:`Publish the measurement plan before the ${i?`first`:`next`} check.`,action:`Open measurement plan`,step:`plan`};case Nn.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 ${gm(t,`engine`,`engines`)} your ${gm(e.queries.total,`query`,`queries`)}.`,action:i?`Review first check`:`Review check`,step:`first-check`}}default:return e.blockedBy}}function Om({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,Z.jsx)(Yd,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:Kd(p),trailing:(0,Z.jsx)(Gd,{state:p}),childrenManageFocus:!0,children:(0,Z.jsx)(um,{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=Dm(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,Z.jsx)(q,{asChild:!0,variant:m,children:(0,Z.jsx)(H,{to:`/projects/$projectName/portfolio`,params:{projectName:e},children:i.action})}):(0,Z.jsx)(q,{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 ${gm(e.answersPlanned,`answer`,`answers`)} saved`:`${gm(e.answersSaved,`answer`,`answers`)} saved`:null;g=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ff,{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,Z.jsxs)(`div`,{role:`status`,className:`mt-3 rounded-md border border-caution px-3 py-2`,children:[(0,Z.jsxs)(`p`,{className:`text-copy-14 text-primary`,children:[Mr(e),`: `,gm(t.failedQueries,`query`,`queries`),` failed`,t.stopped?`, so this check stopped asking it`:``,`.`]}),(0,Z.jsxs)(`details`,{className:`mt-1`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:t.message})]})]},e)),(0,Z.jsxs)(`details`,{className:`mt-2`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-secondary`,children:`Check details`}),(0,Z.jsxs)(`dl`,{className:`mt-2 grid gap-x-6 gap-y-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Engines`}),(0,Z.jsx)(`dd`,{className:`text-label-14 text-heading`,children:r.engines.length>0?r.engines.map(e=>Mr(e)).join(`, `):`Unavailable`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-label-13 text-secondary`,children:`Queries`}),(0,Z.jsxs)(`dd`,{className:`text-label-14 tabular-nums text-heading`,children:[gm(r.queries.nonBrand,`non-brand`,`non-brand`),` · `,gm(r.queries.branded,`branded`,`branded`)]})]})]})]})]}),_=d&&!l&&r.runId?(0,Z.jsx)(bm,{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`} · ${gm(t.answers,`answer`,`answers`)} from ${gm(t.engines,`engine`,`engines`)}${r.finishedAt?` · ${Vr(r.finishedAt)}`:``}`:`The check finished.`,g=t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vf,{byClass:t.queryCountsByClass,pooled:t.queryCounts,caption:n?void 0:`Latest AI Visibility check by query class`}),n?(0,Z.jsx)(`p`,{className:`mt-3 text-copy-13 text-secondary`,children:`Later checks are compared with this baseline.`}):null,r.runId?(0,Z.jsx)(km,{runId:r.runId,projectName:e}):null]}):null,_=(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName`,params:{projectName:e},children:[`Open AI Visibility`,(0,Z.jsx)(N,{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,Z.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,Z.jsxs)(`div`,{className:`space-y-2`,children:[t.map(e=>{let t=Mr(e.provider),n=yr(e.code,Mr(mt(e.provider)));return(0,Z.jsx)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-copy-14 text-primary`,children:n}),(0,Z.jsxs)(`details`,{className:`mt-1`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-label-13 text-secondary`,children:`Engine message`}),(0,Z.jsxs)(`p`,{className:`mt-1 break-words text-copy-13 text-secondary`,children:[t,`: `,e.message]})]})]}):(0,Z.jsxs)(`p`,{className:`break-words text-copy-14 text-primary`,children:[t,`: `,e.message]})},e.provider)}),e]}):r.error?(0,Z.jsxs)(`div`,{className:`rounded-md border border-caution px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`break-words text-copy-14 text-primary`,children:r.error}),e?(0,Z.jsx)(`div`,{className:`mt-1`,children:e}):null]}):null,d&&(_=(0,Z.jsxs)(Z.Fragment,{children:[f?(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>a(`engine`),children:`Change AI engines`}):null,(0,Z.jsx)(q,{type:`button`,variant:m,onClick:()=>a(`first-check`),children:`Run check again`})]}));break}default:return p}return(0,Z.jsx)(Yd,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:Kd(p),summary:h,trailing:(0,Z.jsx)(Gd,{state:p}),action:_,children:g})}function km({runId:e,projectName:t}){let[n,r]=(0,Y.useState)(!1),i=U({...Ai({client:G,path:{id:e}}),enabled:n}),a=U({...di({client:G,path:{name:t}}),enabled:n}),o=i.data?mf(i.data.snapshots??[],e=>a.data?.find(t=>t.id===e)?.queryClass):void 0;return(0,Z.jsxs)(`details`,{className:`mt-3`,onToggle:e=>r(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1 text-label-14 text-link`,children:`Example answer`}),(0,Z.jsx)(`div`,{className:`mt-3 border-t border-default pt-4`,children:i.isPending?(0,Z.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:`Loading the answer…`}):i.isError?(0,Z.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`The answer could not be loaded.`}):o?(0,Z.jsx)(yf,{answer:o}):(0,Z.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`This check saved no answer text.`})})]})}var Am=`pointer-coarse:min-h-11 max-md:min-h-11`,jm=`setup-input h-10 w-full max-md:text-label-16 ${Am}`,Mm=[{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`}],Nm=[{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 Pm(e,t){let n=e.trim().toUpperCase(),r=t.trim().toLowerCase();return{countryValid:Mm.some(e=>e.value===n),languageValid:Nm.some(e=>e.value===r)}}function Fm(e){let t=e.replace(/^\[|\]$/g,``);return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes(`:`)}function Im(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`||Fm(i)||!i.includes(`.`))return null;let a=Ot(i);return a?{canonicalDomain:i,projectName:a,displayName:Kn(i)}:null}function Lm(e,t){return e instanceof rr&&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 Rm(){return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,Z.jsx)(`div`,{className:`page-header`,children:(0,Z.jsxs)(`div`,{className:`page-header-left`,children:[(0,Z.jsx)(`h1`,{className:`page-title`,children:`Preparing setup`}),(0,Z.jsx)(`p`,{className:`page-subtitle`,children:`Checking the projects already on this install.`})]})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 material-base p-4 text-label-14 text-secondary`,role:`status`,children:[(0,Z.jsx)(s,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading projects…`]})]})}function zm({onRetry:e}){return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsx)(`div`,{className:`page-header`,children:(0,Z.jsxs)(`div`,{className:`page-header-left`,children:[(0,Z.jsx)(`h1`,{className:`page-title`,children:`Can’t load projects`}),(0,Z.jsx)(`p`,{className:`page-subtitle`,children:`Canonry could not confirm whether this install already has a project.`})]})}),(0,Z.jsxs)(`div`,{className:`rounded-md border border-negative bg-negative-soft p-4`,role:`alert`,tabIndex:-1,children:[(0,Z.jsx)(`p`,{className:`text-copy-14-strong text-heading`,children:`Setup is paused to protect existing projects.`}),(0,Z.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Check the connection or sign in again, then retry.`}),(0,Z.jsx)(q,{type:`button`,className:`mt-4`,variant:`secondary`,onClick:e,children:`Retry project check`})]})]})}function Bm(){let e=Oe({from:`/setup`});if(e.experience===`legacy`||e.experience!==`platform`&&sr()===`legacy`)return(0,Z.jsx)(im,{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,Z.jsx)(_m,{projectName:t,firstRun:e.onboarding!==void 0,track:n},t)}let n=e.experience===`platform`;return(0,Z.jsx)(Vm,{addProject:n},n?`add-project`:`entry`)}function Vm({addProject:e}){let t=De(),n=U({..._i({client:G}),retry:!1,refetchOnMount:`always`}),r=n.isSuccess&&n.isFetchedAfterMount,i=!e&&r&&n.data.length===1?n.data[0]:void 0,a=U({...yi({client:G,path:{name:i?.name??``}}),enabled:i!==void 0,retry:!1}),[o,s]=(0,Y.useState)(null);return(0,Y.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,Y.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,Z.jsx)(zm,{onRetry:()=>{n.refetch()}}):!o||`redirectTo`in o||`addProject`in o?(0,Z.jsx)(Rm,{}):(0,Z.jsx)(Hm,{firstRun:o.firstRun})}function Hm({firstRun:e}){return(0,Z.jsx)(Ir,{title:e?`Set up Canonry`:`Add a project`,children:(0,Z.jsx)(Um,{firstRun:e})})}function Um({firstRun:e}){let t=De(),n=Se(),r=e&&Or(),i=U({...ai({client:G}),enabled:r,retry:!1}),a=Le(si()),[o]=(0,Y.useState)(()=>Bd(`platform`)),[c,l]=(0,Y.useState)(o.domain??``),[u,d]=(0,Y.useState)(o.projectName??``),[f,p]=(0,Y.useState)(o.displayName??``),[m,h]=(0,Y.useState)(o.country??`US`),[g,_]=(0,Y.useState)(o.language??`en`),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),D=U({..._i({client:G}),enabled:w!==null,retry:!1}),O=w===null?null:D.data?.find(e=>Ot(e.name)===w)?.name??w,A=!r||i.isError?void 0:i.data,j=typeof A?.enabled==`boolean`?A.enabled:null,M=a.isPending?a.variables.body.enabled:j,[N,ee]=(0,Y.useState)(null),P=(0,Y.useRef)(null),F=(0,Y.useRef)(null),I=(0,Y.useRef)(null),{onboardingSessionId:te,emit:ne}=Ud(`platform`);(0,Y.useEffect)(()=>{ne({flowVersion:1,onboardingSessionId:te,event:`onboarding.started`,step:`project`,resumed:!1},`onboarding.started`)},[ne,te]),(0,Y.useEffect)(()=>{Vd(`platform`,{domain:c,projectName:u,displayName:f,country:m,language:g})},[c,u,f,m,g]);let L=()=>{Hd(`platform`),l(``),d(``),p(``),h(`US`),_(`en`),C(null),T(null)},re=Im(c),ie=u.trim()||re?.projectName||``,ae=f.trim()||re?.displayName||``,oe=_t(m,g),{countryValid:se,languageValid:ce}=Pm(m,g),le=se&&ce,ue=!!(c||u||f||m!==`US`||g!==`en`),R=!!(c&&!re&&b);(0,Y.useEffect)(()=>{S&&(w!==null&&I.current?(F.current&&(F.current.open=!0),I.current.focus()):P.current?.focus())},[w,S]);let z=async r=>{if(r.preventDefault(),x(!0),re&&le&&!v){y(!0),C(null),T(null);try{let r=await Hn({name:ie,displayName:ae,canonicalDomain:re.canonicalDomain,country:m,language:g});Hd(`platform`),ne({flowVersion:1,onboardingSessionId:te,event:`onboarding.step_completed`,step:`project`,method:`manual`},`onboarding.step_completed:project`),await n.invalidateQueries({queryKey:Di({client:G})}),await t({to:`/setup`,search:{project:r.name,...e?{onboarding:`first-run`}:{}},replace:!0})}catch(e){y(!1);let t=e instanceof rr&&e.statusCode===409;T(t?Ot(ie):null),C(Lm(e,`Could not create the project. Try again.`)),ne({flowVersion:1,onboardingSessionId:te,event:`onboarding.blocked`,step:`project`,action:`save`,reasonCode:Qt(e,`project_create_failed`)},`onboarding.blocked:project`),t&&n.invalidateQueries({queryKey:Di({client:G})})}}},de=async e=>{ee(null);try{let t=await a.mutateAsync({client:G,body:{enabled:e}});n.setQueryData(Oi({client:G}),t),t.enabled!==e&&ee(`The server kept telemetry ${t.enabled?`on`:`off`}. Check its telemetry settings.`)}catch{ee(`Could not update telemetry. Try again.`)}};return(0,Z.jsxs)(`div`,{className:`page-container max-w-3xl`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-heading`,children:e?`Set up Canonry`:`Add a project`}),e?(0,Z.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,Z.jsx)(q,{asChild:!0,variant:`ghost`,className:`shrink-0`,children:(0,Z.jsxs)(H,{to:`/agent-setup`,children:[(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":`true`}),`Set up with an agent`]})}):null]}),(0,Z.jsxs)(Jd,{label:`Setup progress`,children:[(0,Z.jsx)(Yd,{id:`setup-website`,title:`Website`,mark:`idle`,trailing:(0,Z.jsx)(hr,{tone:`neutral`,className:`shrink-0`,children:`Required`}),children:(0,Z.jsxs)(`form`,{"aria-label":`Website`,className:`space-y-5`,onSubmit:Jr(z),noValidate:!0,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-domain`,children:`Website URL`}),(0,Z.jsx)(`input`,{id:`launchpad-domain`,className:jm,type:`text`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`none`,spellCheck:!1,required:!0,"aria-invalid":R,"aria-describedby":R?`launchpad-domain-error`:void 0,placeholder:`https://example.com`,value:c,onBlur:()=>x(!0),onChange:e=>{l(e.target.value),C(null),T(null)}}),R?(0,Z.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,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14-strong text-heading`,htmlFor:`launchpad-display-name`,children:`Brand name`}),(0,Z.jsx)(`input`,{id:`launchpad-display-name`,className:jm,type:`text`,autoComplete:`organization`,"aria-describedby":`launchpad-display-name-hint`,placeholder:re?.displayName??`Your brand`,value:f,onChange:e=>p(e.target.value)}),(0,Z.jsx)(`p`,{id:`launchpad-display-name-hint`,className:`text-copy-13 text-secondary`,children:`Answers that name this brand count as mentions.`})]}),(0,Z.jsxs)(`details`,{ref:F,className:`group border-t border-default`,children:[(0,Z.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 ${Am}`,children:[(0,Z.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:`Project details`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 text-secondary`,children:[oe,(0,Z.jsx)(E,{className:`size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":`true`})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-5 pb-4 pt-2`,children:[re?(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:max-w-[50%]`,children:[(0,Z.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-project-name`,children:`Project name`}),(0,Z.jsx)(`input`,{ref:I,id:`launchpad-project-name`,className:jm,type:`text`,placeholder:re.projectName,"aria-invalid":w!==null,"aria-describedby":w===null?void 0:`launchpad-create-error`,value:u,onChange:e=>{d(e.target.value),w!==null&&(T(null),C(null))}})]}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-country`,children:`Country`}),(0,Z.jsx)(`select`,{id:`launchpad-country`,className:jm,value:m,onChange:e=>h(e.target.value),children:Mm.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-label-14 text-secondary`,htmlFor:`launchpad-language`,children:`Language`}),(0,Z.jsx)(`select`,{id:`launchpad-language`,className:jm,value:g,onChange:e=>_(e.target.value),children:Nm.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]}),S?(0,Z.jsxs)(`div`,{ref:P,className:`rounded-md border border-negative bg-negative-soft p-3`,role:`alert`,tabIndex:-1,children:[(0,Z.jsx)(`p`,{id:`launchpad-create-error`,className:`text-copy-14-strong text-heading`,children:S}),O===null?null:(0,Z.jsx)(q,{asChild:!0,variant:`secondary`,size:`sm`,className:`mt-3`,children:(0,Z.jsxs)(H,{to:`/projects/$projectName`,params:{projectName:O},children:[`Open `,O]})})]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-sm:[&>*]:w-full`,children:[ue?(0,Z.jsx)(q,{type:`button`,variant:`ghost`,disabled:v,onClick:L,children:`Reset unsaved fields`}):null,e?null:(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,className:Am,children:(0,Z.jsx)(H,{to:`/projects`,onClick:()=>Hd(`platform`),children:`Cancel`})}),(0,Z.jsx)(q,{className:Am,type:`submit`,disabled:!re||!le||v,children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` Creating project…`]}):`Continue`})]})]})}),(0,Z.jsx)(Yd,{id:`setup-agent-readiness`,title:`Agent Readiness`,mark:`idle`,summary:`How well AI agents can read your site`,trailing:(0,Z.jsx)(Gd,{state:K.not_started})}),(0,Z.jsx)(Yd,{id:`setup-ai-visibility`,title:`AI Visibility`,mark:`idle`,summary:`Whether AI answers mention your brand and cite your site`,trailing:(0,Z.jsx)(Gd,{state:K.not_started})})]}),j===null?null:(0,Z.jsxs)(`section`,{className:`mt-6 border-t border-default pt-5`,"aria-labelledby":`telemetry-title`,children:[(0,Z.jsxs)(`label`,{className:`flex min-h-11 items-start gap-3 py-2 ${a.isPending?`cursor-wait`:`cursor-pointer`}`,children:[(0,Z.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:M??!1,disabled:a.isPending,onChange:e=>{de(e.target.checked)},"aria-describedby":`telemetry-detail`}),(0,Z.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{id:`telemetry-title`,className:`text-label-14 text-heading`,children:`Share anonymous product telemetry`}),(0,Z.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,Z.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,role:`status`,children:`Saving preference…`}):null,N?(0,Z.jsx)(`p`,{className:`mt-1 text-copy-14 text-negative`,role:`alert`,children:N}):null]})]})}function Wm(){return(0,Z.jsx)(`div`,{className:`page-container`,children:(0,Z.jsx)(`section`,{className:`page-section`,children:(0,Z.jsxs)(Ii,{className:`surface-card empty-card`,children:[(0,Z.jsx)(`h1`,{children:`Page not found`}),(0,Z.jsx)(`p`,{children:`This page may have moved. Choose a project to continue.`}),(0,Z.jsx)(q,{asChild:!0,children:(0,Z.jsx)(H,{to:`/projects`,children:`View projects`})})]})})})}var Gm=`modulepreload`,Km=function(e,t){return new URL(e,t).href},qm={},Jm=function(e){return e.pathname.endsWith(`.css`)},Ym=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},Xm=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=Km(t,n);let r=s(t),i=Jm(r);return Ym(qm,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`:Gm,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)})},Zm=V(()=>Xm(()=>import(`./ProjectPage-DJe32kjK.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]),import.meta.url),`ProjectPage`),Qm=V(()=>Xm(()=>import(`./RunsPage-BBMqOkFs.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,13,14,15,16]),import.meta.url),`RunsPage`),$m=V(()=>Xm(()=>import(`./HistoryPage-Bv5Nsm5B.js`),__vite__mapDeps([24,4,1,2,18,5,6,3,7,14,11]),import.meta.url),`HistoryPage`),eh=V(()=>Xm(()=>import(`./SettingsPage-9PzZpqL2.js`),__vite__mapDeps([25,1,2,4,5,6,3,7,8,9,10,11,12,13]),import.meta.url),`SettingsPage`),th=V(()=>Xm(()=>import(`./AgentSetupPage-DOlYQxIa.js`),__vite__mapDeps([26,1,2,4,7,3,6,10,12]),import.meta.url),`AgentSetupPage`),nh=V(()=>Xm(()=>import(`./BacklinksPage--cebdWId.js`),__vite__mapDeps([27,1,2,4,7,3,6,12,11,17,16]),import.meta.url),`BacklinksPage`),rh=V(()=>Xm(()=>import(`./TrafficPage-Cejn8Fnv.js`),__vite__mapDeps([28,1,2,4,5,6,3,7,14,11,22,12,13,15,16,20]),import.meta.url),`TrafficPage`),ih=V(()=>Xm(()=>import(`./TrafficSourceDetailPage-DIeCgXFX.js`),__vite__mapDeps([29,1,2,4,5,6,3,7,9,15,16,11,20,13,14,21]),import.meta.url),`TrafficSourceDetailPage`),ah=V(()=>Xm(()=>import(`./MeasurementPropertyPage-Czyfi0Cy.js`),__vite__mapDeps([30,1,2,4,5,6,3,7,8,9,10,11,14,15,16,19]),import.meta.url),`MeasurementPropertyPage`);function oh(){return(0,Z.jsx)(Cu,{children:(0,Z.jsx)(Qi,{children:(0,Z.jsx)(vu,{})})})}var sh=Ee()({component:oh,notFoundComponent:Wm,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,seoProfileId:typeof e.seoProfileId==`string`?e.seoProfileId:void 0,seoRunId:typeof e.seoRunId==`string`?e.seoRunId:void 0,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`].map(t=>[t,typeof e[t]==`string`&&e[t]?e[t]:void 0]))})}),ch=Me({getParentRoute:()=>sh,path:`/`,component:Nd,beforeLoad:async({context:e})=>{let t=e.queryClient.getQueryData(Di({client:G}));if(t===void 0)try{t=await e.queryClient.ensureQueryData(_i({client:G}))}catch{return}if(t.length===0)throw ke({to:`/setup`})}}),lh=Me({getParentRoute:()=>sh,path:`/projects`,component:Ld}),uh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,dh=Me({getParentRoute:()=>sh,path:`/projects/$projectName`,component:()=>(0,Z.jsx)(Fe,{}),beforeLoad:async({context:e,params:t,location:n})=>{let r=t.projectName;if(!uh.test(r))return;let i=e.queryClient.getQueryData(Di({client:G}));if(!i)try{i=await e.queryClient.ensureQueryData(_i({client:G}))}catch{return}let a=i.find(e=>e.id===r);if(a)throw ke({to:n.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(a.name)}`),replace:!0})}}),fh=Me({getParentRoute:()=>dh,path:`/`,component:()=>(0,Z.jsx)(Zm,{tab:`overview`})}),ph=Me({getParentRoute:()=>dh,path:`/portfolio`,component:()=>(0,Z.jsx)(Zm,{tab:`portfolio`})}),mh=Me({getParentRoute:()=>dh,path:`/search-console`,component:()=>(0,Z.jsx)(Zm,{tab:`search-console`})}),hh=Me({getParentRoute:()=>dh,path:`/seo-data`,component:()=>(0,Z.jsx)(Zm,{tab:`seo-data`})}),gh=Me({getParentRoute:()=>dh,path:`/journeys`,component:()=>(0,Z.jsx)(Zm,{tab:`journeys`})}),_h=Me({getParentRoute:()=>dh,path:`/conversions`,component:()=>(0,Z.jsx)(Zm,{tab:`conversions`})}),vh=Me({getParentRoute:()=>dh,path:`/local`,component:()=>(0,Z.jsx)(Zm,{tab:`local`})}),yh=Me({getParentRoute:()=>dh,path:`/discovery`,component:()=>(0,Z.jsx)(Zm,{tab:`discovery`})}),bh=Me({getParentRoute:()=>dh,path:`/queries`,component:()=>(0,Z.jsx)(Zm,{tab:`queries`})}),xh=Me({getParentRoute:()=>dh,path:`/client-queries`,component:()=>(0,Z.jsx)(Zm,{tab:`client-queries`})}),Sh=Me({getParentRoute:()=>dh,path:`/properties/$targetKey`,component:()=>(0,Z.jsx)(ah,{})}),Ch=Me({getParentRoute:()=>dh,path:`/report`,beforeLoad:({params:e})=>{throw ke({to:`/projects/$projectName`,params:e,replace:!0})}}),wh=Me({getParentRoute:()=>dh,path:`/activity`,component:()=>(0,Z.jsx)(Zm,{tab:`activity`})}),Th=Me({getParentRoute:()=>dh,path:`/traffic`,component:()=>(0,Z.jsx)(Zm,{tab:`traffic`})}),Eh=Me({getParentRoute:()=>dh,path:`/backlinks`,component:()=>(0,Z.jsx)(Zm,{tab:`backlinks`})}),Dh=Me({getParentRoute:()=>dh,path:`/agent-readiness`,component:()=>(0,Z.jsx)(Zm,{tab:`agent-readiness`})}),Oh=Me({getParentRoute:()=>dh,path:`/technical-aeo`,beforeLoad:({params:e,location:t})=>{throw ke({to:`/projects/$projectName/agent-readiness`,params:e,search:t.search,hash:t.hash,replace:!0})}}),kh=Me({getParentRoute:()=>dh,path:`/history`,component:()=>(0,Z.jsx)(Zm,{tab:`history`})}),Ah=Me({getParentRoute:()=>dh,path:`/settings`,component:()=>(0,Z.jsx)(Zm,{tab:`settings`})}),jh=Me({getParentRoute:()=>sh,path:`/runs`,component:Qm}),Mh=Me({getParentRoute:()=>sh,path:`/history`,component:$m}),Nh=Me({getParentRoute:()=>sh,path:`/settings`,component:eh,beforeLoad:({context:e})=>{}}),Ph=Me({getParentRoute:()=>sh,path:`/setup`,component:Bm}),Fh=Me({getParentRoute:()=>sh,path:`/agent-setup`,component:th}),Ih=Me({getParentRoute:()=>sh,path:`/backlinks`,component:nh}),Lh=Me({getParentRoute:()=>sh,path:`/traffic`,component:rh}),Rh=Me({getParentRoute:()=>sh,path:`/traffic/$projectName/$sourceId`,component:ih}),zh=sh.addChildren([ch,lh,dh.addChildren([fh,ph,mh,hh,gh,_h,vh,yh,bh,xh,Sh,Ch,wh,Th,Eh,Dh,Oh,kh,Ah]),jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh]);function Bh(){return typeof window<`u`&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:`/`}var Vh=Bh(),Hh=Vh===`/`?``:Vh.replace(/\/$/,``);function Uh(e,t){return we({routeTree:zh,basepath:Hh||`/`,context:{queryClient:e},...t?.initialEntries&&{history:Ae({initialEntries:t.initialEntries})}})}var Wh=6e4,Gh=6e4,Kh=1e4,qh=3e4;function Jh(){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<=qh&&t-a<=qh){let e=Ye-r.foregroundMs,t=Math.min(n,e);r.foregroundMs+=t,r.activeMs+=Math.min(t,Math.max(0,o+Wh-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,Kt({event:`ui.page_time`,page:t,visitId:r.id,foregroundMs:l,activeMs:Math.floor(r.activeMs),completed:e}))},f=()=>{r={id:Yt(),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>=Gh&&d()},Kh),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=Dt(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 Yh=!1,Xh;async function Zh(e){return(await tn({client:G,body:e,keepalive:!0})).data}function Qh(){Yh||typeof window>`u`||(Yh=!0,!(We()||St())&&(Xh=Jh(),bt({send:Zh,onDisabled:()=>Xh?.stop()}),G.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`||Mt({method:e.method,route:r,network:!0}),t}},e}),G.interceptors.response.use((e,t,n)=>(Mt({method:t.method,route:typeof n.url==`string`?n.url:void 0,path:eg(t.url),status:e.status}),e)),window.addEventListener(`error`,e=>{nt({kind:`unhandled`,error:e.error})}),window.addEventListener(`unhandledrejection`,e=>{nt({kind:`unhandled`,error:e.reason})}),ag()))}function $h(e){let t=null,n=()=>{let n=e.state.matches.at(-1);if(!n)return;Xh?.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&&lt(t.search,i),t={pathname:r.pathname,search:i}};n();let r=e.subscribe(`onResolved`,n);return()=>{r(),Xh?.clear()}}function eg(e){try{return new URL(e,window.location.origin).pathname}catch{return}}var tg={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function ng(e,t){let[n,r]=tg[e];return t<=n?`good`:t<=r?`needs-improvement`:`poor`}function rg(){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 ig(){let e=0;return{add(t){t.interactionId&&(e=Math.max(e,t.duration))},value:()=>e}}function ag(){if(typeof PerformanceObserver>`u`)return;let e=new Set,t=(t,n)=>{!e.has(t)&&Number.isFinite(n)&&(e.add(t),gt(t,ng(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=rg();n(`layout-shift`,e=>{for(let t of e)i.add({startTime:t.startTime,value:t.value??0,hadRecentInput:t.hadRecentInput===!0})});let a=ig();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 og=6e4,sg=`Anyone with this password can sign in to this dashboard.`,cg={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`},lg={id:`embed`,scopes:[`read`,`embed`],projectId:`embed`,readOnly:!0};function ug(){let e=(0,Y.useRef)(Or()).current,[t,n]=(0,Y.useState)(e?`ready`:`checking`),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(e),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(`password`),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(``),[D,O]=(0,Y.useState)(null),[k,A]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(!1),[N,ee]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(!1),[I]=(0,Y.useState)(()=>Yi().error),te=(0,Y.useRef)(null),ne=(0,Y.useRef)(null),L=(0,Y.useRef)(null),re=()=>{let t=r?`${r.name}:${r.role}`:e?`api-key:explicit`:a?`api-key:${a.id}`:`no-accounts`;if(!te.current||L.current!==t){ne.current?.clear();let e=Xr();ne.current=e,te.current=Uh(e),L.current=t}return{queryClient:ne.current,router:te.current}},ie=t===`ready`?re().router:null;(0,Y.useEffect)(()=>{if(ie)return $h(ie)},[ie]);let ae=e=>e.authRequired?(u(!0),ee(e.signInMethods?.chatgpt===!0),i(e.user),o(null),c(!1),n(e.user?`ready`:`account-login`),!0):!1;(0,Y.useEffect)(()=>{let t=!1,r=async(e,r=!1)=>{try{let e=await it();if(t)return;o(e),c(!1),n(`ready`)}catch(i){if(t)return;if(r&&i instanceof rr&&i.statusCode===401)return Bt().then(()=>{t||(O(null),o(null),c(!1),M(!0),n(`login`))}).catch(r=>{t||(O(r instanceof Error?r.message:`Could not clear the invalid session`),n(e))});O(i instanceof Error?i.message:`Could not verify API key access`),n(e)}};return e?(r(`api-key-error`),()=>{t=!0}):(Promise.allSettled([Lt(),mr()]).then(([e,i])=>{if(t||e.status===`fulfilled`&&ae(e.value))return;if(i.status===`rejected`){let e=i.reason;O(e instanceof Error?e.message:`Failed to reach the Canonry API`),n(`login`);return}let a=i.value;a.authenticated&&We()?(o(lg),c(!1),n(`ready`)):a.authenticated?(c(!0),r(`api-key-error`,!0)):(o(null),c(!1),n(a.setupRequired?`setup`:`login`))}),()=>{t=!0})},[]),(0,Y.useEffect)(()=>{if(t!==`ready`||e)return;let r=setInterval(()=>{l?Lt().then(e=>{e.authRequired&&!e.user&&(M(!0),i(null),o(null),n(`account-login`))}).catch(()=>{}):mr().then(e=>{e.authenticated||(M(!0),o(null),n(e.setupRequired?`setup`:`login`))}).catch(()=>{})},og);return tr(()=>{M(!0),i(null),o(null),c(!1),n(l?`account-login`:`login`)}),()=>{clearInterval(r),tr(null)}},[t,l,e]);let oe=async e=>{if(e.preventDefault(),!p.trim()||p.trim().length<8){O(`Password must be at least 8 characters`);return}if(p!==g){O(`Passwords do not match`);return}let t=w.trim();if(S&&!t)O(cg.missing);else{A(!0),O(null);try{if(!(await In(p.trim(),S?t:void 0)).authenticated){O(`Setup failed`);return}m(``),_(``),T(``),C(!1),y(!1),M(!1),o(null),c(!0),n(`checking`);try{let e=await it();o(e),c(!1),n(`ready`)}catch(e){O(e instanceof Error?e.message:`Could not verify API key access`),n(`api-key-error`)}}catch(e){if(e instanceof rr&&e.statusCode===401&&e.code===`AUTH_REQUIRED`){O(S?cg.rejected:null),C(!0);return}O(e instanceof rr||e instanceof Error?e.message:`Setup failed`)}finally{A(!1)}}},se=e=>{m(e),O(null)},ce=e=>{T(e),O(null)},le=e=>{_(e),O(null)},ue=async e=>{if(e.preventDefault(),p.trim()){A(!0),O(null);try{if(!(b===`api-key`?await rt(p.trim()):await ut(p.trim())).authenticated){O(b===`api-key`?`Invalid API key`:`Incorrect password`);return}let e=await it();o(e),c(!1),m(``),y(!1),M(!1),n(`ready`)}catch(e){O(e instanceof rr||e instanceof Error?e.message:`Authentication failed`)}finally{A(!1)}}},R=e=>{x(e),m(``),y(!1),O(null)},z=async e=>{if(e.preventDefault(),d.trim()&&p){A(!0),O(null);try{let e=await Yn(d.trim(),p);if(!e.user){O(`Incorrect name or password.`);return}m(``),M(!1),i(e.user),o(null),c(!1),n(`ready`)}catch(e){O(e instanceof rr?e.message:`Incorrect name or password.`)}finally{A(!1)}}};if(t===`ready`){let{queryClient:e,router:t}=re();return(0,Z.jsx)(qr,{account:r,apiKey:a,apiKeyPending:s,children:(0,Z.jsx)(be,{client:e,children:(0,Z.jsx)(je,{router:t})})})}let de=p.trim(),fe=p.length>0&&de.length<8,pe=g.length>0&&p!==g,me=de.length>=8&&p===g&&(!S||w.trim().length>0),B=e=>(0,Z.jsxs)(`form`,{id:e.formId,className:`space-y-4`,onSubmit:Jr(z),children:[(0,Z.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-name`,children:[(0,Z.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Name`}),(0,Z.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),O(null)},"aria-invalid":!!D,"aria-describedby":D?`account-login-error`:void 0})]}),(0,Z.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`account-password`,children:[(0,Z.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:`Password`}),(0,Z.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=>se(e.target.value),"aria-invalid":!!D,"aria-describedby":D?`account-login-error`:void 0})]}),D?(0,Z.jsx)(`p`,{id:`account-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:D}):null,(0,Z.jsx)(q,{type:`submit`,variant:e.secondary?`secondary`:`default`,disabled:k||!d.trim()||!p,children:k?`Signing in…`:`Sign in`})]});return(0,Z.jsx)(`div`,{className:`min-h-screen bg-bg px-4 py-8`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5`,children:[(0,Z.jsxs)(`div`,{"data-testid":`auth-brand`,className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(Ba,{className:`size-7`}),(0,Z.jsx)(`span`,{className:`text-label-18-strong text-heading`,children:`Canonry`})]}),(0,Z.jsx)(Ii,{className:`surface-card w-full`,children:t===`checking`?(0,Z.jsx)(Pi,{className:`py-8`,children:(0,Z.jsx)(`p`,{className:`supporting-copy text-center`,children:`Connecting to Canonry…`})}):t===`api-key-error`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ni,{children:(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Could not verify API key access`})}),(0,Z.jsxs)(Pi,{className:`space-y-4`,children:[(0,Z.jsx)(`p`,{className:`supporting-copy`,children:D??`Canonry could not verify this session’s access, so the dashboard stayed locked.`}),(0,Z.jsx)(q,{type:`button`,className:`w-full`,onClick:()=>{window.location.reload()},children:`Try again`})]})]}):t===`account-login`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ni,{children:(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`})}),N?(0,Z.jsxs)(Pi,{className:`space-y-4`,children:[j?(0,Z.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.`}):I?(0,Z.jsx)(`p`,{role:`alert`,className:`rounded-md border border-caution bg-caution-soft px-3 py-2 text-copy-14 text-caution`,children:Ue[I]}):null,(0,Z.jsx)(Ac,{href:_n(`login`,Xi()),className:`w-full`}),(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":P,"aria-controls":`account-password-form`,onClick:()=>F(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:[P?(0,Z.jsx)(E,{className:`h-4 w-4`,"aria-hidden":`true`}):(0,Z.jsx)(h,{className:`h-4 w-4`,"aria-hidden":`true`}),`Sign in with a password`]}),P?B({secondary:!0,formId:`account-password-form`}):null]}):(0,Z.jsxs)(Pi,{children:[j?(0,Z.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,B({secondary:!1})]})]}):t===`setup`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ni,{children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Create a dashboard password`}),(0,Z.jsx)(Fi,{children:sg})]}),(0,Z.jsx)(Pi,{children:(0,Z.jsxs)(`form`,{className:`space-y-4`,onSubmit:Jr(oe),children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-new`,children:`Password`}),(0,Z.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=>se(e.target.value),"aria-invalid":fe,"aria-describedby":`dashboard-password-new-help`}),(0,Z.jsx)(`span`,{id:`dashboard-password-new-help`,"aria-live":`polite`,className:fe?`block text-label-14 text-negative-400`:`block text-label-14 text-secondary`,children:fe?`Enter at least 8 characters.`:`Use at least 8 characters.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-password-confirm`,children:`Confirm password`}),(0,Z.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=>le(e.target.value),"aria-invalid":pe,"aria-describedby":`dashboard-password-confirm-help`}),(0,Z.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.`})]}),S?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`block text-label-12-strong text-secondary`,htmlFor:`dashboard-setup-root-key`,children:cg.label}),(0,Z.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:w,onChange:e=>ce(e.target.value),"aria-invalid":D===cg.rejected,"aria-describedby":`dashboard-setup-root-key-help`}),(0,Z.jsx)(`span`,{id:`dashboard-setup-root-key-help`,"aria-live":`polite`,className:`block text-label-14 text-secondary`,children:cg.help})]}):null,(0,Z.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-label-14 text-secondary`,htmlFor:`dashboard-password-show`,children:[(0,Z.jsx)(`input`,{id:`dashboard-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),S?cg.show:`Show passwords`]}),D?(0,Z.jsx)(`p`,{id:`dashboard-password-setup-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:D}):null,(0,Z.jsx)(q,{type:`submit`,disabled:k||!me,children:k?`Creating password…`:`Create password and continue`})]})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ni,{children:[(0,Z.jsx)(`h1`,{className:`text-heading-24 text-primary`,children:`Sign in to Canonry`}),(0,Z.jsx)(Fi,{children:b===`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,Z.jsxs)(Pi,{children:[j?(0,Z.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,Z.jsxs)(`form`,{className:`space-y-4`,onSubmit:Jr(ue),children:[(0,Z.jsxs)(`label`,{className:`block space-y-1.5`,htmlFor:`dashboard-password-current`,children:[(0,Z.jsx)(`span`,{className:`text-label-12-strong text-secondary`,children:b===`api-key`?`Canonry API key`:`Password`}),(0,Z.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:b===`api-key`?`apiKey`:`password`,autoComplete:b===`api-key`?`off`:`current-password`,spellCheck:!1,required:!0,value:p,onChange:e=>se(e.target.value),"aria-invalid":!!D,"aria-describedby":D?`dashboard-password-login-error`:void 0})]}),(0,Z.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,Z.jsx)(`input`,{id:`dashboard-login-password-show`,type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),b===`api-key`?`Show API key`:`Show password`]}),D?(0,Z.jsx)(`p`,{id:`dashboard-password-login-error`,role:`alert`,className:`text-copy-14 text-negative-400`,children:D}):null,(0,Z.jsx)(q,{type:`submit`,disabled:k||!p.trim(),children:k?`Signing in…`:`Open dashboard`}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>R(b===`api-key`?`password`:`api-key`),children:b===`api-key`?`Use dashboard password instead`:`Forgot password? Use API key`})]})]})]})})]})})}var dg=document.getElementById(`root`);if(!dg)throw Error(`Expected #root element for web app bootstrap.`);Qh(),(0,Hi.createRoot)(dg).render((0,Z.jsx)(Y.StrictMode,{children:(0,Z.jsx)(Ja,{children:(0,Z.jsx)(ug,{})})}));export{mc as $,Zd as A,to as At,Tu as B,la as Bt,af as C,po as Ct,ef as D,so as Dt,of as E,lo as Et,gd as F,Aa as Ft,Xc as G,ru as H,Ji as Ht,_d as I,ja as It,Dc as J,Sc as K,ld as L,oa as Lt,jd as M,Ua as Mt,yd as N,ka as Nt,Xd as O,io as Ot,fd as P,Fa as Pt,uc as Q,cd as R,ca as Rt,Sf as S,ho as St,tf as T,fo as Tt,au as U,wu as V,$i as Vt,tu as W,_c as X,Ec as Y,fc as Z,jf as _,go as _t,Hp as a,qs as at,bf as b,Co as bt,jp as c,zs as ct,Vf as d,zo as dt,gc as et,Jf as f,No as ft,Of as g,Do as gt,Tf as h,Oo as ht,Vp as i,Ys as it,Fd as j,Xa as jt,Qd as k,eo as kt,_p as l,Ls as lt,Lf as m,Mo as mt,Wp as n,hc as nt,Rp as o,Ws as ot,Ff as p,Ro as pt,xc as q,zp as r,ic as rt,Bp as s,Hs as st,Xm as t,dc as tt,np as u,ps as ut,Af as v,So as vt,lf as w,mo as wt,xf as x,wo as xt,Cf as y,To as yt,dd as z,na as zt};
@@ -1 +1 @@
1
- import{C as e,w as t}from"./vendor-tanstack-B90HW50P.js";import{bt as n}from"./ToneBadge-BoscSKWW.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 t=e.queryKey[0];return typeof t?._id==`string`&&t._id.startsWith(r)&&(!n||t.path?.name===n.projectName&&(n.profileId===void 0||t.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-B90HW50P.js";import{bt as n}from"./ToneBadge-DRmwaKRk.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 t=e.queryKey[0];return typeof t?._id==`string`&&t._id.startsWith(r)&&(!n||t.path?.name===n.projectName&&(n.profileId===void 0||t.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};