@canonry/canonry 7.20.1 → 7.22.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 (22) hide show
  1. package/assets/assets/{AuditHistoryPanel-DVtz1ZuT.js → AuditHistoryPanel-J8AR3x5F.js} +1 -1
  2. package/assets/assets/{BacklinksPage-Tvt0-ppX.js → BacklinksPage-CRDPutGA.js} +1 -1
  3. package/assets/assets/{ChartPrimitives-CYlrwLJs.js → ChartPrimitives-CZ4wVBJL.js} +1 -1
  4. package/assets/assets/{HistoryPage-DqXwPH3k.js → HistoryPage-C5taVW3t.js} +1 -1
  5. package/assets/assets/MeasurementPropertyPage-txucmLuz.js +4 -0
  6. package/assets/assets/ProjectPage-C4FaBoWI.js +8 -0
  7. package/assets/assets/{RunsPage-Io7ZFw4-.js → RunsPage-D-3XKUhh.js} +1 -1
  8. package/assets/assets/{SettingsPage-BPYxgchP.js → SettingsPage-Cq_SJRj_.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-CwffU3tv.js → SiteHealthSection-Cn_IZVO1.js} +3 -3
  10. package/assets/assets/{TrafficPage-DIm60m1J.js → TrafficPage-BMdFZs3X.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-DWT1Ip5P.js → TrafficSourceDetailPage-BmrIOc-2.js} +1 -1
  12. package/assets/assets/{extract-error-message-BVYchXhT.js → extract-error-message-HlQy5L7O.js} +1 -1
  13. package/assets/assets/{index-DrQLR1jE.js → index-BJcjB5XW.js} +2 -2
  14. package/assets/assets/{react-sigma_core.esm.min-f31sqfAC.js → react-sigma_core.esm.min-CogAr1i4.js} +1 -1
  15. package/assets/assets/{v2-overview-adapter-By0930UY.js → v2-overview-adapter-tps7TUxq.js} +1 -1
  16. package/assets/index.html +1 -1
  17. package/dist/{chunk-CIPWGVX6.js → chunk-6Z2LFFRT.js} +1 -1
  18. package/dist/cli.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/package.json +11 -11
  21. package/assets/assets/MeasurementPropertyPage-CsbfFEjB.js +0 -4
  22. package/assets/assets/ProjectPage-Cyvt96AV.js +0 -8
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-CwffU3tv.js","./vendor-tanstack-ZXXkndVj.js","./vendor-lucide-Y6jANGfG.js","./ChartPrimitives-CYlrwLJs.js","./vendor-recharts-D-cUuLZo.js","./ProjectPage-Cyvt96AV.js","./v2-overview-adapter-By0930UY.js","./vendor-markdown-B4giJcws.js","./extract-error-message-BVYchXhT.js","./Hint-DICI5Jq9.js","./AuditHistoryPanel-DVtz1ZuT.js","./vendor-radix-twS1M3FF.js","./vendor-yaml-GWJz5H2G.js","./RunsPage-Io7ZFw4-.js","./HistoryPage-DqXwPH3k.js","./SettingsPage-BPYxgchP.js","./BacklinksPage-Tvt0-ppX.js","./TrafficPage-DIm60m1J.js","./TrafficSourceDetailPage-DWT1Ip5P.js","./MeasurementPropertyPage-CsbfFEjB.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-Cn_IZVO1.js","./vendor-tanstack-ZXXkndVj.js","./vendor-lucide-Y6jANGfG.js","./ChartPrimitives-CZ4wVBJL.js","./vendor-recharts-D-cUuLZo.js","./ProjectPage-C4FaBoWI.js","./v2-overview-adapter-tps7TUxq.js","./vendor-markdown-B4giJcws.js","./extract-error-message-HlQy5L7O.js","./Hint-DICI5Jq9.js","./AuditHistoryPanel-J8AR3x5F.js","./vendor-radix-twS1M3FF.js","./vendor-yaml-GWJz5H2G.js","./RunsPage-D-3XKUhh.js","./HistoryPage-C5taVW3t.js","./SettingsPage-Cq_SJRj_.js","./BacklinksPage-CRDPutGA.js","./TrafficPage-BMdFZs3X.js","./TrafficSourceDetailPage-BmrIOc-2.js","./MeasurementPropertyPage-txucmLuz.js"])))=>i.map(i=>d[i]);
2
2
  import{c as F5,d as Z5,r as C,j as l,Q as Y5,M as X5,q as be,e as Bc,L as at,a as J5,t as Nr,u as yt,f as W5,h as Ds,k as zs,l as fk,m as e6,n as gk,O as Xf,o as oi,p as t6,s as Bt,v as Kg,x as Is,y as n6,z as a6,A as i6}from"./vendor-tanstack-ZXXkndVj.js";import{S as s6,O as Gg,P as yk,C as Hg,a as bk,T as Qg,D as vk,R as xk}from"./vendor-radix-twS1M3FF.js";import{c as wk}from"./vendor-recharts-D-cUuLZo.js";import{A as Tc,X as Gr,S as Fg,a as Sk,G as kk,C as Lc,L as Ts,R as hd,M as o6,b as r6,P as Jf,H as jk,c as Ak,d as l6,e as Uc,f as Zg,T as ym,g as Vc,W as Nk,h as c6,i as u6,j as d6,k as m6,l as p6,m as h6,n as f6,B as g6,F as y6,o as b6,p as v6,q as x6,r as w6,s as Ck,t as _k,u as Wf,v as Tk,w as S6,x as Ek,E as k6}from"./vendor-lucide-Y6jANGfG.js";import{M as j6,r as A6}from"./vendor-markdown-B4giJcws.js";import{p as N6}from"./vendor-yaml-GWJz5H2G.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const h of u)if(h.type==="childList")for(const f of h.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function i(u){const h={};return u.integrity&&(h.integrity=u.integrity),u.referrerPolicy&&(h.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?h.credentials="include":u.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function r(u){if(u.ep)return;u.ep=!0;const h=i(u);fetch(u.href,h)}})();var lf={exports:{}},cc={},cf={exports:{}},uf={};var bx;function C6(){return bx||(bx=1,(function(e){function n(B,W){var ve=B.length;B.push(W);e:for(;0<ve;){var Ae=ve-1>>>1,se=B[Ae];if(0<u(se,W))B[Ae]=W,B[ve]=se,ve=Ae;else break e}}function i(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var W=B[0],ve=B.pop();if(ve!==W){B[0]=ve;e:for(var Ae=0,se=B.length,Se=se>>>1;Ae<Se;){var Me=2*(Ae+1)-1,xe=B[Me],pe=Me+1,ce=B[pe];if(0>u(xe,ve))pe<se&&0>u(ce,xe)?(B[Ae]=ce,B[pe]=ve,Ae=pe):(B[Ae]=xe,B[Me]=ve,Ae=Me);else if(pe<se&&0>u(ce,ve))B[Ae]=ce,B[pe]=ve,Ae=pe;else break e}}return W}function u(B,W){var ve=B.sortIndex-W.sortIndex;return ve!==0?ve:B.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var f=Date,b=f.now();e.unstable_now=function(){return f.now()-b}}var v=[],x=[],S=1,k=null,N=3,T=!1,z=!1,q=!1,E=!1,P=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function $(B){for(var W=i(x);W!==null;){if(W.callback===null)r(x);else if(W.startTime<=B)r(x),W.sortIndex=W.expirationTime,n(v,W);else break;W=i(x)}}function F(B){if(q=!1,$(B),!z)if(i(v)!==null)z=!0,ae||(ae=!0,Ke());else{var W=i(x);W!==null&&Le(F,W.startTime-B)}}var ae=!1,V=-1,Z=5,X=-1;function Ce(){return E?!0:!(e.unstable_now()-X<Z)}function tt(){if(E=!1,ae){var B=e.unstable_now();X=B;var W=!0;try{e:{z=!1,q&&(q=!1,M(V),V=-1),T=!0;var ve=N;try{t:{for($(B),k=i(v);k!==null&&!(k.expirationTime>B&&Ce());){var Ae=k.callback;if(typeof Ae=="function"){k.callback=null,N=k.priorityLevel;var se=Ae(k.expirationTime<=B);if(B=e.unstable_now(),typeof se=="function"){k.callback=se,$(B),W=!0;break t}k===i(v)&&r(v),$(B)}else r(v);k=i(v)}if(k!==null)W=!0;else{var Se=i(x);Se!==null&&Le(F,Se.startTime-B),W=!1}}break e}finally{k=null,N=ve,T=!1}W=void 0}}finally{W?Ke():ae=!1}}}var Ke;if(typeof L=="function")Ke=function(){L(tt)};else if(typeof MessageChannel<"u"){var Ue=new MessageChannel,ke=Ue.port2;Ue.port1.onmessage=tt,Ke=function(){ke.postMessage(null)}}else Ke=function(){P(tt,0)};function Le(B,W){V=P(function(){B(e.unstable_now())},W)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return N},e.unstable_next=function(B){switch(N){case 1:case 2:case 3:var W=3;break;default:W=N}var ve=N;N=W;try{return B()}finally{N=ve}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(B,W){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ve=N;N=B;try{return W()}finally{N=ve}},e.unstable_scheduleCallback=function(B,W,ve){var Ae=e.unstable_now();switch(typeof ve=="object"&&ve!==null?(ve=ve.delay,ve=typeof ve=="number"&&0<ve?Ae+ve:Ae):ve=Ae,B){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=ve+se,B={id:S++,callback:W,priorityLevel:B,startTime:ve,expirationTime:se,sortIndex:-1},ve>Ae?(B.sortIndex=ve,n(x,B),i(v)===null&&B===i(x)&&(q?(M(V),V=-1):q=!0,Le(F,ve-Ae))):(B.sortIndex=se,n(v,B),z||T||(z=!0,ae||(ae=!0,Ke()))),B},e.unstable_shouldYield=Ce,e.unstable_wrapCallback=function(B){var W=N;return function(){var ve=N;N=W;try{return B.apply(this,arguments)}finally{N=ve}}}})(uf)),uf}var vx;function _6(){return vx||(vx=1,cf.exports=C6()),cf.exports}var xx;function T6(){if(xx)return cc;xx=1;var e=_6(),n=F5(),i=Z5();function r(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)a+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function h(t){var a=t,s=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(s=a.return),t=a.return;while(t)}return a.tag===3?s:null}function f(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function b(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function v(t){if(h(t)!==t)throw Error(r(188))}function x(t){var a=t.alternate;if(!a){if(a=h(t),a===null)throw Error(r(188));return a!==t?null:t}for(var s=t,c=a;;){var p=s.return;if(p===null)break;var g=p.alternate;if(g===null){if(c=p.return,c!==null){s=c;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===s)return v(p),t;if(g===c)return v(p),a;g=g.sibling}throw Error(r(188))}if(s.return!==c.return)s=p,c=g;else{for(var w=!1,A=p.child;A;){if(A===s){w=!0,s=p,c=g;break}if(A===c){w=!0,c=p,s=g;break}A=A.sibling}if(!w){for(A=g.child;A;){if(A===s){w=!0,s=g,c=p;break}if(A===c){w=!0,c=g,s=p;break}A=A.sibling}if(!w)throw Error(r(189))}}if(s.alternate!==c)throw Error(r(190))}if(s.tag!==3)throw Error(r(188));return s.stateNode.current===s?t:a}function S(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=S(t),a!==null)return a;t=t.sibling}return null}var k=Object.assign,N=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),L=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),Ce=Symbol.for("react.memo_cache_sentinel"),tt=Symbol.iterator;function Ke(t){return t===null||typeof t!="object"?null:(t=tt&&t[tt]||t["@@iterator"],typeof t=="function"?t:null)}var Ue=Symbol.for("react.client.reference");function ke(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Ue?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case q:return"Fragment";case P:return"Profiler";case E:return"StrictMode";case F:return"Suspense";case ae:return"SuspenseList";case X:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case z:return"Portal";case L:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case $:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return a=t.displayName||null,a!==null?a:ke(t.type)||"Memo";case Z:a=t._payload,t=t._init;try{return ke(t(a))}catch{}}return null}var Le=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve={pending:!1,data:null,method:null,action:null},Ae=[],se=-1;function Se(t){return{current:t}}function Me(t){0>se||(t.current=Ae[se],Ae[se]=null,se--)}function xe(t,a){se++,Ae[se]=t.current,t.current=a}var pe=Se(null),ce=Se(null),ue=Se(null),_e=Se(null);function Fe(t,a){switch(xe(ue,a),xe(ce,t),xe(pe,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Uv(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Uv(a),t=Vv(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Me(pe),xe(pe,t)}function Ee(){Me(pe),Me(ce),Me(ue)}function Ct(t){t.memoizedState!==null&&xe(_e,t);var a=pe.current,s=Vv(a,t.type);a!==s&&(xe(ce,t),xe(pe,s))}function me(t){ce.current===t&&(Me(pe),Me(ce)),_e.current===t&&(Me(_e),sc._currentValue=ve)}var Be,Ne;function re(t){if(Be===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);Be=a&&a[1]||"",Ne=-1<s.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Be+t+Ne}var Ze=!1;function bt(t,a){if(!t||Ze)return"";Ze=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Y){var Q=Y}Reflect.construct(t,[],ie)}else{try{ie.call()}catch(Y){Q=Y}t.call(ie.prototype)}}else{try{throw Error()}catch(Y){Q=Y}(ie=t())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Y){if(Y&&Q&&typeof Y.stack=="string")return[Y.stack,Q.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=c.DetermineComponentFrameRoot(),w=g[0],A=g[1];if(w&&A){var D=w.split(`
@@ -83,4 +83,4 @@ spec:
83
83
  `);En(Ye),Ks(!0)}}catch(H){ll(H instanceof Error?H.message:"Failed to generate queries"),M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.blocked",step:"queries",action:"generate_queries",reasonCode:Ac(H,"unknown")},"onboarding.blocked:queries:generate")}finally{ol(!1)}}},bl=async()=>{if(!Ne)return;const H=yi;if(H.length!==0){Fa(!0),ml(null);try{await fH(Ne,H),Ji(!0),await r(),M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.step_completed",step:"competitors",method:"manual",countBucket:si(H.length)},"onboarding.step_completed:competitors"),W(4)}catch(Ye){ml(Ye instanceof Error?Ye.message:"Failed to save competitors"),M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.blocked",step:"competitors",action:"save",reasonCode:"unknown"},"onboarding.blocked:competitors:save")}finally{Fa(!1)}}},vl=async()=>{const H=es.trim();if(H){Ho(!0),Qo(null);try{await KN("gemini",{apiKey:H}),bn({title:"Gemini configured",detail:"Provider is ready — continuing setup.",tone:"positive",dedupeKey:"setup:gemini:configured",dedupeMode:"drop"}),cu(""),await r(),hi(v.providerStatuses.find(Ye=>Ye.name.toLowerCase()==="gemini")?.name??"gemini"),M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.step_completed",step:"system",method:"inline"},"onboarding.step_completed:system")}catch(Ye){Qo(Ye instanceof Error?Ye.message:"Failed to save Gemini key"),M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.blocked",step:"system",action:"configure_provider",reasonCode:"provider_save_failed"},"onboarding.blocked:system:provider_save_failed")}finally{Ho(!1)}}},bi=async()=>{if(!bo()){if(!Ne||Xa){zn(Xa??"Complete setup before launching the first sweep.");const H=ba??(Ne?ya===0?"no_queries":"run_rejected":"unknown");Oa||M({flowVersion:ft,onboardingSessionId:E,event:"run.requested",origin:"dashboard_setup",result:"rejected",providerCountBucket:si(kt),queryCountBucket:si(ya),reasonCode:H});return}Fs(!0),zn(null);try{const H=await gl.mutateAsync({projectName:Ne,projectLabel:xe||Se||Ne,sourceAction:"setup-launch"});op(H.id),sp(!0),RN(Ne,H.id),fl.current=H.id,Oa||M({flowVersion:ft,onboardingSessionId:E,event:"run.requested",origin:"dashboard_setup",result:"queued",providerCountBucket:si(kt),queryCountBucket:si(ya)}),await r()}catch(H){zn(H instanceof Error?H.message:"Failed to queue the visibility sweep. Retry when the instance is ready."),Oa||M({flowVersion:ft,onboardingSessionId:E,event:"run.requested",origin:"dashboard_setup",result:"rejected",providerCountBucket:si(kt),queryCountBucket:si(ya),reasonCode:Ac(H,"run_rejected")})}finally{Fs(!1)}}},Mn=()=>W(H=>T?2:Math.max(0,H-1)),Yo=(H,Ye,vi)=>{M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.step_completed",step:H,method:"existing",...vi===void 0?{}:{countBucket:si(vi)}},`onboarding.step_completed:${H}`),W(Ye)},xl=()=>{if(M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.step_completed",step:"queries",method:"skipped",countBucket:"0"},"onboarding.step_completed:queries"),T){Qt();return}W(3)},wl=()=>{M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.step_completed",step:"competitors",method:"skipped",countBucket:"0"},"onboarding.step_completed:competitors"),W(4)},Zs=T?"section":_a,va=et!==!0||Ot===!0?l.jsx(le,{type:"button",variant:"ghost",size:"sm",className:"min-h-11",onClick:()=>{r(),Gs&&Je.refetch()},children:"Check again"}):null,Sl=(et===!1||ga)&&!!ta,Ys=T&&(B===2||B===4)?x?l.jsxs("section",{"aria-labelledby":"setup-provider-heading",className:"space-y-3 border-b border-default pb-6 mb-6",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx("h2",{id:"setup-provider-heading",className:"text-lg font-semibold text-heading",children:et===!1?"Connect a provider":"Answer engine provider"}),l.jsx(wn,{tone:et===!0?"positive":"neutral",children:et===!0?"Configured":et===!1?"Not connected":"Checking"})]}),l.jsx("p",{className:"max-w-prose text-sm text-secondary",children:et===!0?Et.length>0?`${Et.map(H=>H.displayName??H.name).join(", ")} available for this project. Research and sweeps use your provider account.`:"ChatGPT in Chrome is configured for sweeps. Query Research needs an API provider.":et===!1?"An answer engine is required for visibility sweeps. You can save queries now and connect later.":"Checking available providers. You can choose queries while this finishes."}),et===!1||ga?ta?l.jsx("div",{children:l.jsx(bW,{compact:!0,leadingField:l.jsxs("div",{className:"min-w-0 space-y-1.5",children:[l.jsx("label",{className:"block text-sm font-medium text-secondary",htmlFor:"setup-provider",children:"Provider to connect"}),l.jsx("select",{ref:ru,id:"setup-provider",className:"setup-input",value:ta.name,onChange:H=>{H.target.value!==ta.name&&($o.current=document.activeElement===H.currentTarget,ul(H.target.value))},children:Go.map(H=>l.jsx("option",{value:H.name,children:H.displayName??H.name},H.name))})]}),secondaryActions:va,providerName:ta.name,keyUrl:ta.keyUrl,modelHint:ta.modelHint,onSaved:()=>{on(!1),r()}},ta.name)}):l.jsx("p",{className:"max-w-prose text-sm text-secondary",children:vn.length>0?`This project's provider selection is ${vn.join(", ")}. Configure an allowed provider in Settings, or change the selection in project Settings.`:"Provider configuration is unavailable here. Open Settings to connect an answer engine, then check again."}):null,l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[et===!0&&!ga&&ta?l.jsx(le,{type:"button",variant:"outline",size:"sm",onClick:()=>on(!0),children:"Configure a provider"}):null,!ta||Ot===!0?l.jsx(le,{type:"button",variant:"outline",size:"sm",asChild:!0,children:l.jsx(at,{to:"/settings",target:"_blank",rel:"noopener noreferrer",children:"Open provider settings"})}):null,Sl?null:va]})]}):l.jsxs("section",{"aria-labelledby":"setup-provider-heading",className:"space-y-2 border-b border-default pb-6 mb-6",children:[l.jsx("h2",{id:"setup-provider-heading",className:"text-lg font-semibold text-heading",children:"Answer engine provider"}),l.jsx("p",{className:"max-w-prose text-sm text-secondary",children:"Provider settings are managed by an administrator."}),ze?l.jsx("p",{role:"alert",className:"text-sm text-negative",children:"Provider readiness could not be checked. Try again."}):l.jsx("p",{className:"max-w-prose text-sm text-secondary",role:"status",children:et===!0?"An answer engine is available for this project.":et===!1?"Ask an administrator to connect an answer engine for this project. You can save queries now.":"Checking provider readiness. You can save queries now."}),l.jsx(le,{type:"button",variant:"ghost",size:"sm",className:"min-h-11",disabled:ea.isFetching,onClick:()=>{ea.refetch()},children:ze?"Retry provider check":"Check again"})]}):null,Ja=(()=>{switch(B){case 0:return l.jsxs(_a,{className:"surface-card step-card",children:[l.jsx("div",{className:"section-head",children:l.jsxs("div",{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 1 of 5"}),l.jsx("h2",{children:"System check"})]})}),l.jsx("p",{className:"supporting-copy",children:"Checking that your Canonry instance is configured and reachable."}),l.jsx("div",{className:"compact-stack",children:N.healthChecks.map(H=>l.jsxs("div",{className:"health-check-row",children:[l.jsxs("div",{children:[l.jsx("p",{className:"run-row-title",children:H.label}),l.jsx("p",{className:"supporting-copy",children:H.detail}),H.id==="provider"&&H.state!=="ready"&&l.jsxs("div",{className:"mt-3 rounded-md border border-default bg-bg-elevated/40 p-3 space-y-2",children:[l.jsxs("p",{className:"text-xs text-secondary",children:["Paste a Gemini key to enable visibility checks (free at"," ",l.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"}),")."]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"password",value:es,onChange:Ye=>cu(Ye.target.value),placeholder:"AI... (paste here)",className:"flex-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-sm text-heading placeholder:text-faint focus:border-mono-600 focus:outline-none font-mono",disabled:In}),l.jsx(le,{type:"button",size:"sm",disabled:In||!es.trim(),onClick:fn(vl),children:In?"Saving...":"Save"})]}),yl&&l.jsxs("div",{role:"alert",className:"space-y-1 text-xs text-negative",children:[l.jsx("p",{children:yl}),l.jsx("p",{children:"Check that the key is complete, then retry Save."})]}),l.jsxs("p",{className:"text-sm text-secondary",children:["Connect more answer engines later in"," ",l.jsx(at,{to:"/settings",className:"text-link hover:underline",children:"Settings"}),"."]})]})]}),l.jsx(wn,{tone:H.state==="ready"?"positive":"caution",title:H.id==="api"?Kr(k.apiStatus):H.id==="worker"?Kr(k.workerStatus):H.detail,children:H.state==="ready"?"Ready":"Attention"})]},H.id))}),l.jsxs("div",{className:"setup-nav",children:[N.launchState.blockedReason?l.jsx("p",{role:"status",className:"supporting-copy text-negative",children:N.launchState.blockedReason}):l.jsx("span",{}),l.jsx(le,{type:"button",disabled:!N.launchState.enabled,title:N.launchState.blockedReason,onClick:()=>{M({flowVersion:ft,onboardingSessionId:E,event:"onboarding.step_completed",step:"system",method:"automatic"},"onboarding.step_completed:system"),W(Le)},children:"Continue"})]})]});case 1:return l.jsxs(_a,{className:"surface-card step-card",children:[l.jsxs("div",{className:"section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 2 of 5"}),l.jsx("h2",{children:"Create project"})]}),Ne?l.jsx(wn,{tone:"positive",children:"Created"}):null]}),Ne?l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"text-neutral",children:["Project ",l.jsx("span",{className:"text-heading font-medium",children:Ne})," created successfully."]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx(le,{type:"button",onClick:()=>Yo("project",2),children:"Continue"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"project-name",children:"Project name"}),l.jsx("input",{id:"project-name",className:"setup-input",type:"text",placeholder:"my-website",value:Se,onChange:H=>Me(H.target.value)}),Kn&&Kn!==Se?l.jsxs("p",{className:"supporting-copy",children:["Slug: ",Kn]}):null]}),l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"display-name",children:"Display name (optional)"}),l.jsx("input",{id:"display-name",className:"setup-input",type:"text",placeholder:"My Website",value:xe,onChange:H=>pe(H.target.value)})]}),l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"domain",children:"Canonical domain"}),l.jsx("input",{id:"domain",className:"setup-input",type:"text",placeholder:"example.com",value:ce,onChange:H=>ue(H.target.value)})]}),l.jsxs("div",{className:"setup-field-row",children:[l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"country",children:"Country"}),l.jsx("input",{id:"country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:_e,onChange:H=>Fe(H.target.value.toUpperCase())})]}),l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"language",children:"Language"}),l.jsx("input",{id:"language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:Ee,onChange:H=>Ct(H.target.value.toLowerCase())})]})]}),l.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-default bg-surface p-3 cursor-pointer hover:border-strong",children:[l.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 rounded border-strong bg-bg",checked:me,onChange:H=>Be(H.target.checked)}),l.jsxs("span",{className:"flex-1",children:[l.jsx("span",{className:"block text-sm text-heading",children:"Auto-extract backlinks"}),l.jsxs("span",{className:"block text-xs text-muted mt-0.5",children:["When a new Common Crawl release syncs, automatically extract backlinks for this project."," ",l.jsx(at,{to:"/backlinks",className:"text-positive-400 hover:text-positive underline underline-offset-2",children:"Manage backlinks"})]})]})]}),Ze?l.jsx("p",{className:"text-negative-400 text-sm",children:Ze}):null,l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx(le,{type:"button",disabled:!Kn||!ce||qn,onClick:fn(lp),children:qn?"Creating...":"Create project"})]})]})]});case 2:return l.jsxs(Zs,{className:T?"visibility-setup-section step-card":"surface-card step-card","aria-labelledby":"setup-queries-heading",children:[l.jsxs("div",{className:"section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:T?"Step 1 of 2":"Step 3 of 5"}),l.jsx("h2",{id:"setup-queries-heading",children:"Add queries"})]}),se?l.jsx(wn,{tone:"neutral",children:"Loading"}):V.isError?l.jsx(wn,{tone:"negative",children:"Load failed"}):Vt?l.jsxs(wn,{tone:"positive",children:[na.length," saved"]}):l.jsxs(wn,{tone:"neutral",children:[na.length," quer",na.length!==1?"ies":"y"]})]}),l.jsx("p",{className:"supporting-copy",children:"Add the queries your customers use, one per line. You can refine your list later."}),l.jsxs("div",{className:"space-y-2 border-b border-default pb-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[l.jsxs("div",{className:"min-w-0 space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold text-heading",children:"Research queries with your agent"}),l.jsx("p",{className:"max-w-prose text-sm text-secondary",children:"Ask your agent to compare answers and available sources with Canonry Research, then recommend queries. Research does not change your tracked queries."})]}),l.jsx(le,{type:"button",variant:"outline",size:"sm",className:"min-h-11 shrink-0 self-start",onClick:fn(dl),children:Dn?"Research prompt copied":"Copy research prompt"})]}),l.jsxs("details",{open:Ko||void 0,className:"text-sm text-secondary",children:[l.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-link",children:"View agent prompt"}),l.jsx("textarea",{"aria-label":"Agent query research prompt",readOnly:!0,className:"setup-textarea mt-2 w-full",rows:8,value:Zi})]}),Ko?l.jsx("p",{role:"alert",className:"text-sm text-negative",children:"Could not copy. Select and copy the prompt above."}):null]}),se?l.jsx("div",{className:"rounded-md border border-default bg-bg-elevated/40 p-4 text-sm text-secondary",role:"status",children:"Loading saved queries…"}):V.isError?l.jsxs("div",{className:"compact-stack",children:[l.jsx("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:"Saved queries could not be loaded. Retry before changing the query basket."}),l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:T?Ve:Mn,children:"Back"}),l.jsx(le,{type:"button",onClick:()=>{V.refetch()},children:"Retry loading queries"})]})]}):Vt?l.jsxs("div",{className:"compact-stack",children:[l.jsx("ul",{className:"detail-list",children:na.map(H=>l.jsx("li",{children:H},H))}),l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:T?Ve:Mn,children:"Back"}),l.jsx(le,{type:"button",variant:"outline",onClick:()=>di(!1),children:"Edit queries"}),l.jsx(le,{type:"button",onClick:()=>Yo("queries",T?4:3,na.length),children:"Continue"})]})]}):l.jsxs("div",{className:"compact-stack",children:[Et.length>0?l.jsxs("div",{className:"compact-stack",children:[l.jsxs("div",{className:"flex items-center gap-2 text-muted text-xs uppercase tracking-wide",children:[l.jsx("span",{className:"flex-1 border-t border-base"}),"auto-generate",l.jsx("span",{className:"flex-1 border-t border-base"})]}),l.jsxs("div",{className:"flex items-end gap-2",children:[l.jsxs("div",{className:"setup-field flex-1",children:[l.jsx("label",{className:"setup-label",htmlFor:"gen-provider",children:"Provider"}),l.jsx("select",{id:"gen-provider",className:"setup-input",value:sn,onChange:H=>hi(H.target.value),children:Et.map(H=>l.jsxs("option",{value:H.name,children:[H.displayName??H.name,H.model?` (${H.model})`:""]},H.name))})]}),l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"gen-count",children:"Count"}),l.jsx("select",{id:"gen-count",className:"setup-input",value:Vo,onChange:H=>Hs(Number(H.target.value)),children:[3,5,10,15,20].map(H=>l.jsx("option",{value:H,children:H},H))})]}),l.jsx(le,{type:"button",variant:"outline",disabled:ou||!sn,onClick:fn(qa),children:ou?"Analyzing site...":"Generate"})]}),rl?l.jsx("p",{className:"text-negative-400 text-sm",children:rl}):null]}):null,T?null:l.jsxs("div",{className:"flex items-center gap-2 text-muted text-xs uppercase tracking-wide",children:[l.jsx("span",{className:"flex-1 border-t border-base"}),"or type manually",l.jsx("span",{className:"flex-1 border-t border-base"})]}),l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"queries",children:"Queries (one per line)"}),l.jsx("textarea",{id:"queries",className:"setup-textarea",rows:6,placeholder:`emergency dentist brooklyn
84
84
  best invisalign downtown brooklyn
85
85
  pediatric dentist brooklyn heights`,value:Ft,onChange:H=>En(H.target.value)})]}),Vs?l.jsx("p",{className:"text-negative-400 text-sm",children:Vs}):null,l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:T?Ve:Mn,children:"Back"}),l.jsx(le,{type:"button",variant:"ghost",onClick:xl,children:T?"Finish without AI Visibility":"Skip for now"}),l.jsx(le,{type:"button",disabled:na.length===0||Rn,onClick:fn(Zo),children:Rn?"Saving...":`Save ${na.length} quer${na.length!==1?"ies":"y"}`})]})]})]});case 3:return l.jsxs(_a,{className:"surface-card step-card",children:[l.jsxs("div",{className:"section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 4 of 5"}),l.jsx("h2",{children:"Add competitors"})]}),Xi?l.jsx(wn,{tone:"positive",children:"Saved"}):null]}),l.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."}),Xi?l.jsxs("div",{className:"compact-stack",children:[l.jsx("ul",{className:"detail-list",children:yi.map(H=>l.jsx("li",{children:H},H))}),l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx(le,{type:"button",onClick:()=>Yo("competitors",4,yi.length),children:"Continue"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsxs("div",{className:"setup-field",children:[l.jsx("label",{className:"setup-label",htmlFor:"competitors",children:"Competitor domains (one per line)"}),l.jsx("textarea",{id:"competitors",className:"setup-textarea",rows:4,placeholder:`competitor1.com
86
- competitor2.com`,value:fi,onChange:H=>Yi(H.target.value)})]}),en?l.jsx("p",{className:"text-negative-400 text-sm",children:en}):null,l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx("div",{className:"flex gap-2",children:yi.length===0?l.jsx(le,{type:"button",onClick:wl,children:"Continue without competitors"}):l.jsxs(l.Fragment,{children:[l.jsx(le,{type:"button",variant:"outline",onClick:wl,children:"Skip"}),l.jsx(le,{type:"button",disabled:pl,onClick:fn(bl),children:pl?"Saving...":`Save ${yi.length} competitor${yi.length!==1?"s":""}`})]})})]})]})]});case 4:{const H=Ya.data,Ye=H?.status??(Wi===tt?.id?tt.status:void 0),vi=Ye==="completed"||Ye==="partial"||Ye==="failed"||Ye==="cancelled",ts=H?.snapshots??[],Ma=H?.queryCounts,kl=Ye?rk(Ye,ts.length):!1,An=Ke&&!Za,xi=jn??(H?.error?rQ(H.error):Ye==="cancelled"?"The sweep was cancelled before it produced a baseline.":(Ye==="completed"||Ye==="partial")&&ts.length===0?"The sweep finished without producing any snapshots.":tt?.statusDetail||"The sweep did not produce a baseline.");let Wa=null;return An||kl?Wa=l.jsx(wn,{tone:"positive",children:"Complete"}):jn&&!Za?Wa=l.jsx(wn,{tone:"negative",children:"Failed"}):vi?Wa=l.jsx(wn,{tone:"negative",children:Ye==="cancelled"?"Cancelled":"Failed"}):Za&&(Wa=l.jsx(wn,{tone:"caution",children:"Running"})),l.jsxs(_a,{className:"surface-card step-card",children:[l.jsxs("div",{className:"section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:T?"Step 2 of 2":"Step 5 of 5"}),l.jsx("h2",{children:bo()?"AI Visibility":"Launch first run"})]}),Wa]}),An?l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"text-secondary",children:["Setup is complete. ",l.jsx("span",{className:"text-strong font-medium",children:Ne})," already has a successful answer-visibility baseline."]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",onClick:()=>ct(),children:f?"Finish setup":"Open project dashboard →"})]})]}):!Za&&bo()?l.jsxs("div",{className:"compact-stack",children:[Ne?l.jsx(_X,{projectName:Ne}):l.jsx("p",{className:"text-sm text-secondary",children:Pg}),jn&&l.jsx("p",{role:"alert",className:"text-sm text-negative",children:jn}),l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",onClick:Ve,children:"Open project dashboard →"})]})]}):Za?vi?kl?l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"text-neutral",children:["Sweep complete. Your first answer-visibility snapshot for"," ",l.jsx("span",{className:"text-heading font-medium",children:Ne}),":"]}),l.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-1",children:[l.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[l.jsx("p",{className:"text-xs font-medium text-secondary",children:"Mentioned"}),l.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:Ma?l.jsxs(l.Fragment,{children:[Ma.mentionedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",Ma.totalQueries]})]}):"Unavailable"}),l.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries naming your brand"})]}),l.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[l.jsx("p",{className:"text-xs font-medium text-secondary",children:"Cited"}),l.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:Ma?l.jsxs(l.Fragment,{children:[Ma.citedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",Ma.totalQueries]})]}):"Unavailable"}),l.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries citing your site"})]}),l.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[l.jsx("p",{className:"text-xs font-medium text-secondary",children:"Results"}),l.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:ts.length}),l.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"completed engine checks"})]})]}),!b&&Ne?l.jsx(yW,{projectName:Ne}):null,l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",onClick:()=>ct(),children:f?"Finish setup":"Open project dashboard →"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[l.jsx("p",{children:xi}),l.jsx("p",{className:"mt-1 text-xs text-secondary",children:bo()?Pg:x?"Fix provider or query configuration if needed, then retry without leaving setup.":"Ask an administrator to review the provider and query configuration."})]}),l.jsxs("div",{className:"setup-nav",children:[x&&!bo()?l.jsx(le,{type:"button",variant:"outline",asChild:!0,children:l.jsx(at,{to:"/settings",children:"Configure providers"})}):l.jsx("span",{}),bo()||!x?l.jsx(le,{type:"button",onClick:Ve,children:"Open project dashboard →"}):l.jsx(le,{type:"button",disabled:gi||!!Xa,onClick:fn(bi),children:gi?"Retrying...":"Retry visibility sweep"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsx("p",{className:"text-neutral",children:"Sweep running. This usually takes 30 to 60 seconds."}),l.jsx("div",{className:"rounded-md border border-default bg-surface p-3 text-xs text-muted",children:l.jsxs("p",{children:["Status: ",l.jsx("span",{className:"text-neutral",children:Ye??"queued"})]})}),Ya.isError&&l.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[l.jsx("p",{children:Ya.error instanceof Error?Ya.error.message:"Could not refresh the sweep status."}),l.jsx(le,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{Ya.refetch()},children:"Retry status check"})]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",variant:"outline",onClick:f?()=>ct():Ve,children:f?"Finish setup":"Watch on project page"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"supporting-copy",children:["Your queries are saved. Run a first sweep to get a baseline for"," ",l.jsx("span",{className:"text-heading font-medium",children:Ne}),", or finish and run it later from the project. A sweep calls the answer engines, so it costs provider usage."]}),(Xa||jn)&&l.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[l.jsx("p",{children:jn??Xa}),l.jsx("p",{className:"mt-1 text-xs text-secondary",children:"Resolve the blocker above, then retry the sweep here."})]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx(le,{type:"button",variant:"ghost",onClick:Qt,children:"Finish without running"}),ba==="no_provider"&&!T?l.jsx(le,{type:"button",asChild:!0,children:l.jsx(at,{to:"/settings",children:"Configure a provider"})}):l.jsx(le,{type:"button",disabled:gi||!!Xa,title:Xa,onClick:fn(bi),children:gi?"Launching...":jn?"Retry visibility sweep":"Launch visibility sweep"})]})]})]})}default:return null}})();return l.jsxs("div",{className:T?"page-container visibility-setup":"page-container",children:[f?l.jsx(Ro,{current:"visibility"}):null,l.jsxs("div",{className:"page-header",children:[l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{ref:u?h:void 0,tabIndex:u?-1:void 0,className:"page-title",children:u?"Set up AI Visibility":"Setup"}),l.jsx("p",{className:"page-subtitle",children:u?"Connect an answer engine, then choose queries for your first sweep.":"Create a project and run its first visibility check."})]}),f?l.jsx("div",{className:"page-header-right",children:l.jsx(le,{type:"button",variant:"outline",className:"min-h-11",onClick:Qt,children:"Skip AI Visibility"})}):null]}),f?null:l.jsx(kW,{current:T?B===4?1:0:B,labels:T?wW:xW}),l.jsxs("section",{className:"setup-wizard",children:[Ys,Ja]})]})}const Yf="canonry mcp install --client claude-code",NW="https://github.com/Canonry/canonry/blob/main/docs/mcp.md";function CW(){const e=C.useRef(w1()).current,n=C.useRef(new Set),i=C.useCallback((r,u)=>{n.current.has(r)||(n.current.add(r),N1({...u,flowVersion:ft,onboardingSessionId:e,surface:"platform",eventId:S1()}))},[e]);return C.useEffect(()=>{i("started",{event:"onboarding.started",step:"finish",resumed:!1})},[i]),C.useCallback(r=>{i(`action:${r}`,{event:"onboarding.step_completed",step:"finish",method:"manual",nextAction:r})},[i])}const ap=C.createContext(()=>{});function _W({projectName:e,skippedVisibility:n=!1}){const i=yt({...QF({client:J,path:{name:e}}),retry:!1}),r=i.data?.hasData?i.data:null,u=CW(),h=uk(e,Oe["site-audit"]),f=uk(e,Oe["answer-visibility"]),b={...h?{site:h,fixes:h}:{},...TW(f,n)};return l.jsx(ap.Provider,{value:u,children:l.jsxs("div",{className:"page-container max-w-6xl py-8 md:py-10",children:[l.jsx(Ro,{current:"done",outcomes:b}),l.jsxs("header",{className:"relative mx-auto mt-12 max-w-2xl text-center md:mt-16",children:[l.jsx(EW,{}),l.jsx("p",{className:"onb-reveal mt-6 text-sm font-medium text-positive",style:Ta(250),children:"Setup complete"}),l.jsx("h1",{className:"onb-reveal mt-2 text-5xl font-semibold tracking-tight text-heading md:text-6xl",style:Ta(350),children:"You’re set."}),l.jsxs("p",{className:"onb-reveal mx-auto mt-4 max-w-xl text-lg text-secondary",style:Ta(450),children:["Canonry is tracking ",l.jsx("span",{className:"font-medium text-heading",children:e}),". Here’s how to get the most out of it from here."]})]}),l.jsxs("div",{className:"mt-14 grid gap-4 md:grid-cols-6",children:[l.jsx(Rd,{className:"md:col-span-4 md:row-span-2",delayMs:600,labelledBy:"onb-agent-heading",children:l.jsx(zW,{projectName:e})}),l.jsx(Rd,{className:"md:col-span-2 md:row-span-2",delayMs:700,labelledBy:"onb-data-heading",children:l.jsx(PW,{projectName:e})}),l.jsx(Rd,{className:"md:col-span-3",delayMs:800,labelledBy:"onb-schedule-heading",children:l.jsx(BW,{projectName:e})}),l.jsx(Rd,{className:"md:col-span-3",delayMs:900,labelledBy:"onb-alerts-heading",children:l.jsx(LW,{projectName:e,score:r?.aggregateScore??null})})]}),l.jsxs("div",{className:"onb-reveal mt-12 flex flex-col items-center gap-3 sm:flex-row sm:justify-center",style:Ta(1e3),children:[l.jsx(le,{asChild:!0,className:"h-11 rounded-full px-6 text-base md:h-11",children:l.jsxs(at,{to:"/projects/$projectName",params:{projectName:e},replace:!0,onClick:()=>u("open_project"),children:["Open ",e,l.jsx(Tc,{className:"size-4","aria-hidden":"true"})]})}),l.jsx(le,{asChild:!0,variant:"ghost",className:"h-11 rounded-full px-5 md:h-11",children:l.jsx(at,{to:"/projects/$projectName/technical-aeo",params:{projectName:e},replace:!0,onClick:()=>u("review_page_health"),children:"Review page health"})})]})]})})}function uk(e,n){const i=yt({...XN({client:J,path:{name:e},query:{kind:n,limit:20}}),retry:!1,refetchInterval:r=>dk(r.state.status==="success"?{isSuccess:!0,data:r.state.data}:{isSuccess:!1})==="pending"?5e3:!1});return dk(i)}function TW(e,n){return e===void 0?{}:n?{visibility:"skipped"}:{visibility:e}}function dk(e){if(!e.isSuccess||!e.data)return"unknown";const n=e.data.filter(i=>i.trigger!==$a.probe);if(!n.some(i=>i.status===Nt.completed||i.status===Nt.partial))return n.some(i=>i.status===Nt.queued||i.status===Nt.running)?"pending":n.length>0?"incomplete":"skipped"}function Ta(e){return{"--onb-delay":`${e}ms`}}function EW(){return l.jsx("div",{className:"onb-check relative mx-auto size-20","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 80 80",className:"relative size-20",children:[l.jsx("circle",{className:"onb-check-ring",cx:"40",cy:"40",r:"36",fill:"none",strokeWidth:"3",pathLength:"1"}),l.jsx("path",{className:"onb-check-mark",d:"M25 41 L35 51 L56 30",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round",pathLength:"1"})]})})}function Rd({className:e="",delayMs:n,labelledBy:i,children:r}){return l.jsx("section",{"aria-labelledby":i,className:`onb-reveal onb-tile flex flex-col overflow-hidden rounded-2xl border border-default bg-surface p-6 md:p-7 ${e}`,style:Ta(n),children:r})}function ip({id:e,eyebrow:n,title:i,children:r}){return l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted",children:n}),l.jsx("h2",{id:e,className:"mt-1.5 text-2xl font-semibold tracking-tight text-heading",children:i}),l.jsx("p",{className:"mt-2 text-sm text-secondary",children:r})]})}const Dd=[{id:"diagnose",label:"Diagnose",prompt:"Why did we lose citations this week?",calls:["canonry_insights_list","canonry_competitor_landscape"],reply:"Two engines started citing a competitor’s comparison page instead of yours. Want me to draft one that answers the same query?"},{id:"fix",label:"Fix",prompt:"Fix the weakest pages on the site.",calls:["canonry_technical_aeo_pages","canonry_site_health_page_audit"],reply:"The lowest-scoring pages are missing structured data and answer-first intros. I’ve written the changes for you to review."},{id:"automate",label:"Automate",prompt:"Re-check everything every Monday and tell me in Slack.",calls:["canonry_schedule_set","canonry_agent_webhook_attach"],reply:"Done. A sweep runs every Monday, and I’ll post what changed to Slack."}],RW=9e3;function DW(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function zW({projectName:e}){const n=C.useContext(ap),[i,r]=C.useState(0),[u,h]=C.useState(!1),[f,b]=C.useState(!1);C.useEffect(()=>{if(u||DW())return;const S=window.setTimeout(()=>r(k=>(k+1)%Dd.length),RW);return()=>window.clearTimeout(S)},[i,u]);const v=async()=>{try{await navigator.clipboard.writeText(Yf),n("copy_agent_command"),b(!0),window.setTimeout(()=>b(!1),1800)}catch{bn({tone:"negative",title:"Could not copy the command",detail:`Run ${Yf} in your terminal.`})}},x=Dd[i]??Dd[0];return l.jsxs(l.Fragment,{children:[l.jsxs(ip,{id:"onb-agent-heading",eyebrow:"Your agent",title:"Let your agent run it.",children:["Your agent can do everything in Canonry: diagnose a drop, fix pages, run sweeps and scans, and write the client report. Use Claude Code, Codex, Cursor, or Aero, the analyst built into"," ",l.jsx("span",{className:"text-heading",children:e})," that reviews every sweep on its own."]}),l.jsxs("div",{className:"mt-6 flex flex-1 flex-col rounded-xl border border-default bg-bg",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),onFocus:()=>h(!0),children:[l.jsxs("div",{className:"flex items-center gap-1 border-b border-default px-3 py-2",role:"tablist","aria-label":"Example agent sessions",children:[Dd.map((S,k)=>l.jsx("button",{type:"button",role:"tab","aria-selected":k===i,onClick:()=>{r(k),h(!0)},className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${k===i?"bg-surface-inset text-heading":"text-muted hover:text-secondary"}`,children:S.label},S.id)),l.jsx("span",{className:"ml-auto text-xs text-faint",children:"Example"})]}),l.jsxs("div",{role:"tabpanel","aria-label":`${x.label} example`,className:"flex-1 p-4 font-mono text-[13px] leading-relaxed",children:[l.jsxs("p",{className:"onb-type text-heading",style:Ta(150),children:[l.jsx("span",{className:"text-muted",children:"> "}),x.prompt]}),x.calls.map((S,k)=>l.jsxs("p",{className:"onb-line mt-1 text-muted first:mt-3",style:Ta(1300+k*450),children:[l.jsx("span",{className:"text-positive",children:"●"})," ",S]},S)),l.jsx("p",{className:"onb-line mt-3 text-secondary",style:Ta(1500+x.calls.length*450),children:x.reply}),l.jsx("span",{className:"onb-caret mt-2 inline-block h-4 w-2 bg-current align-middle text-secondary",style:Ta(1900+x.calls.length*450),"aria-hidden":"true"})]},x.id)]}),l.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[l.jsx("code",{className:"min-w-0 flex-1 truncate rounded-lg border border-default bg-surface-inset px-3 py-2 font-mono text-[13px] text-heading",children:Yf}),l.jsxs(le,{type:"button",variant:"secondary",size:"sm",className:"h-9 md:h-9",onClick:()=>{v()},children:[f?l.jsx(Uc,{className:"size-4","aria-hidden":"true"}):l.jsx(Zg,{className:"size-4","aria-hidden":"true"}),f?"Copied":"Copy"]}),l.jsx("a",{href:NW,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-link underline-offset-4 hover:underline",children:"Other clients"})]})]})}const IW=[{icon:Fg,label:"Search Console",action:"connect_search_console",to:"/projects/$projectName/search-console"},{icon:Ck,label:"Google Analytics",action:"connect_analytics",to:"/projects/$projectName/activity"},{icon:Tk,label:"Business Profile",action:"connect_business_profile",to:"/projects/$projectName/local"}],OW=["GPTBot","ClaudeBot","PerplexityBot"];function PW({projectName:e}){const n=C.useContext(ap);return l.jsxs(l.Fragment,{children:[l.jsx(ip,{id:"onb-data-heading",eyebrow:"Server-side traffic",title:"See the AI bots.",children:"AI crawlers and answer-engine fetches never run JavaScript, so Google Analytics never sees them. Canonry reads them straight from your server."}),l.jsx(qW,{}),l.jsxs(at,{to:"/traffic",onClick:()=>n("connect_server_traffic"),"aria-label":"Connect server-side traffic",className:"group flex items-center gap-3 rounded-xl border border-strong bg-surface-inset px-4 py-3 text-sm font-medium text-heading transition-colors hover:bg-surface-inset-hover",children:[l.jsx(Ek,{className:"size-4 text-positive","aria-hidden":"true"}),l.jsxs("span",{className:"flex-1",children:["Connect your server",l.jsx("span",{className:"block text-xs font-normal text-secondary",children:"Cloudflare, Vercel, WordPress, or Cloud Run"})]}),l.jsx(Tc,{className:"size-4 text-link transition-transform group-hover:translate-x-0.5","aria-hidden":"true"})]}),l.jsx("p",{className:"mt-5 text-xs font-medium uppercase tracking-wide text-muted",children:"Also connect"}),l.jsx("ul",{className:"mt-1 divide-y divide-default",children:IW.map(({icon:i,label:r,action:u,to:h})=>l.jsx("li",{children:l.jsxs(at,{to:h,params:{projectName:e},"aria-label":`Connect ${r}`,onClick:()=>n(u),className:"group flex items-center gap-3 py-2.5 text-sm text-heading",children:[l.jsx(i,{className:"size-4 text-muted","aria-hidden":"true"}),l.jsx("span",{className:"flex-1",children:r}),l.jsx(Tc,{className:"size-3.5 text-link transition-transform group-hover:translate-x-0.5","aria-hidden":"true"})]})},r))})]})}function qW(){const e=[22,70,118];return l.jsxs("div",{className:"relative my-6 h-36","aria-hidden":"true",children:[l.jsx("svg",{viewBox:"0 0 200 140",preserveAspectRatio:"none",className:"absolute inset-0 size-full",children:e.map((n,i)=>l.jsx("path",{className:"onb-flow",style:Ta(i*400),d:`M20 ${n} C 100 ${n}, 118 70, 170 70`,fill:"none",strokeWidth:"1.5"},n))}),OW.map((n,i)=>l.jsx("span",{className:"onb-bot absolute left-0 -translate-y-1/2 rounded-md border border-default bg-bg-elevated px-2 py-1 font-mono text-[11px] text-secondary",style:{top:`${(e[i]??70)/140*100}%`,...Ta(i*600)},children:n},n)),l.jsx("span",{className:"onb-hub absolute right-0 top-1/2 flex size-11 -translate-y-1/2 items-center justify-center rounded-2xl bg-accent text-on-inverse",children:l.jsx(Ek,{className:"size-5"})})]})}const MW=["M","T","W","T","F","S","S"];function BW({projectName:e}){return l.jsxs(l.Fragment,{children:[l.jsx(ip,{id:"onb-schedule-heading",eyebrow:"Scheduled sweeps",title:"Runs on its own.",children:"Re-measure every week without lifting a finger, so a drop shows up before a customer notices."}),l.jsx("ol",{className:"mt-6 grid grid-cols-7 gap-2","aria-hidden":"true",children:MW.map((n,i)=>l.jsxs("li",{className:"flex flex-col items-center gap-2",children:[l.jsx("span",{className:"onb-day size-3 rounded-full bg-surface-inset",style:Ta(i*500)}),l.jsx("span",{className:"text-xs text-muted",children:n})]},i))}),l.jsx(UC,{projectName:e,to:"/projects/$projectName/settings",icon:_k,label:"Set a schedule",action:"set_schedule"})]})}function LW({projectName:e,score:n}){return l.jsxs(l.Fragment,{children:[l.jsx(ip,{id:"onb-alerts-heading",eyebrow:"Notifications",title:"Hear about changes.",children:"Get a webhook in Slack or anywhere else when a sweep finishes or a score moves."}),l.jsxs("div",{className:"relative mt-6 flex h-14 items-center","aria-hidden":"true",children:[l.jsx("span",{className:"onb-bell flex size-10 items-center justify-center rounded-full border border-default bg-bg-elevated",children:l.jsx(Wf,{className:"size-4 text-secondary"})}),l.jsxs("span",{className:"onb-toast ml-3 flex items-center gap-2 rounded-xl border border-default bg-bg-elevated px-3 py-2 text-sm shadow-[0_8px_24px_var(--color-shadow-panel)]",children:[l.jsx("span",{className:"size-2 rounded-full bg-positive-400"}),l.jsx("span",{className:"text-heading",children:e}),l.jsx("span",{className:"text-secondary",children:n===null?"sweep finished":`page health ${n}`})]})]}),l.jsx(UC,{projectName:e,to:"/projects/$projectName/settings",icon:Wf,label:"Add a notification",action:"add_notification"})]})}function UC({projectName:e,to:n,icon:i,label:r,action:u}){const h=C.useContext(ap);return l.jsxs(at,{to:n,params:{projectName:e},onClick:()=>h(u),className:"group mt-6 inline-flex items-center gap-2 self-start text-sm font-medium text-link",children:[l.jsx(i,{className:"size-4","aria-hidden":"true"}),r,l.jsx(Tc,{className:"size-3.5 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"})]})}const UW=C.lazy(async()=>({default:(await Qi(()=>import("./SiteHealthSection-CwffU3tv.js").then(n=>n.d),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).SiteHealthSection})),VW=`Public pages only, crawled from this computer and stored locally. The first scan reads up to ${T2} pages, then stops.`,$W=1800,KW="https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent",GW="Help me set up Canonry for my public site.\n\nUse the official Canonry docs:\n- Agent quickstart: https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent\n- CLI reference: https://github.com/Canonry/canonry/blob/main/skills/canonry/references/canonry-cli.md\n- Plugin setup: https://github.com/Canonry/canonry/blob/main/docs/plugins.md\n- MCP setup: https://github.com/Canonry/canonry/blob/main/docs/mcp.md\n\nPick one path and stay on it. Use connected Canonry tools (plugin or MCP) only if you have them and I have not pointed you at a specific install. A connected tool runs in its own process and never sees `CANONRY_CONFIG_DIR`, `CANONRY_PORT`, or anything else you export in a shell, so it always acts on my default install. If I named a config directory, a port, or a sandbox, that is the shell path: use `cnry` and tell me which path you chose. Never mix the two in one run, and never create a duplicate project. The `cnry` and `canonry` commands are interchangeable.\n\n1. Ask for my public domain, country, and language. Do not create or scan anything yet. Country and language are only applied when a project is created, so if you reuse an existing project, report its country and language instead of changing them.\n2. Shell path only: confirm `cnry` is on PATH, then run `cnry --version`. If Canonry is missing, propose `npm install -g @canonry/canonry` and wait for approval. Then run `cnry doctor --format json`, which is the command that says whether config, database, and server are in place. `cnry --version` does not read config and succeeds on a completely unconfigured install, so it cannot answer this. If config is missing, run `cnry bootstrap` yourself: it is not interactive, takes about a second, and is safe to rerun. Do not hand it to me and wait. The interactive command is `cnry init`, which is optional provider and OAuth setup that Page Health does not need. Bootstrap prints an API key, so do not repeat its output back to me, and never ask me to paste passwords, API keys, OAuth credentials, or command output.\n3. Confirm the API is reachable. `cnry doctor --format json` reports it, and any project read exits non-zero with `CONNECTION_ERROR` when it is not. If it is unreachable, propose `cnry start` and wait for approval. Use `cnry start`, which is the background daemon, and not `cnry serve`, which runs in the foreground and will block you until I stop it, even though some error messages suggest it. Stop anything you started with `cnry stop`.\n4. List projects with the connected project tool or `cnry project list --format json`, and reuse one whose domain matches. Confirm the proposed name is not already assigned to a different domain. To find out whether a project has already been scanned, run `cnry technical-aeo score <project> --format json` with no `--run-id`, which reports the latest run. Read the `hasData` field, not the score: this command exits 0 and reports `aggregateScore: 0` for a project that has never been scanned, so reading the score alone would have you tell me my site scored zero. If `hasData` is true and `runStatus` is `completed` or `partial`, read that scan instead of starting a new one. If no project matches, show the exact create operation and wait for approval.\n5. Propose a bounded Site Health scan: `--max-pages 100` for a first look, plus whether dead-link checking is on (it is off unless you pass `--check-dead-links`). Show the connected operation or the exact `cnry technical-aeo run <project> --max-pages 100 --wait --format json` command with the project name filled in, and wait for separate approval before scanning. `--wait` polls for up to 15 minutes and returns only the run id and status. If the status it returns is still `queued` or `running`, the scan has not finished: do not rerun it or report results, poll `cnry technical-aeo progress <project> --run-id <run-id> --format json` until it is terminal. If `--wait` outruns your own tool timeout first, recover the run id with `cnry technical-aeo score <project> --format json` and poll the same way.\n6. When the run is `completed` or `partial`, read `cnry technical-aeo crawl <project> --run-id <run-id> --format json` first. It is the only one of these commands that carries `termination` and `complete`; the score and pages commands do not. Then read `cnry technical-aeo score <project> --run-id <run-id> --format json` and `cnry technical-aeo pages <project> --run-id <run-id> --sort score-asc --limit 10 --format jsonl`. Tell me the termination reason in plain words and whether the scan covered the whole site or stopped at a page, link, depth, or time limit. A `partial` run scored the pages it reached and not my site, so never present it as a full-site result. If it stopped early, the fix depends on the reason, so say which: a page or depth limit needs a larger budget, a time limit needs a smaller scan (a lower `--max-pages` or `--max-depth`). If the run failed or was cancelled, inspect the run error and stop.\n7. Summarize only completed evidence, then propose AI Visibility setup. Ask before you add queries, connect providers, start a provider-backed or quota-consuming run, edit files, or publish.";function HW(e,n){return e==="legacy"?"legacy":e==="platform"?"platform":n.state==="success"?n.projectCount===0?"platform":"legacy":n.state==="error"?"retry":"loading"}const QW="2000-01-01T00:00:00.000Z",FW=5e3;function ZW(e,n){const i=new Set,r=new Map;for(const f of n)f.trigger!==$a.probe&&(r.has(f.projectId)||r.set(f.projectId,f.id),(f.status===Nt.completed||f.status===Nt.partial)&&i.add(f.projectId));const h=(e.every(f=>f.createdAt)?[...e].sort((f,b)=>(f.createdAt??"").localeCompare(b.createdAt??"")||f.name.localeCompare(b.name)):e).find(f=>!i.has(f.id));return h?{projectName:h.name,runId:r.get(h.id)}:null}const VC=[{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"}],$C=[{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 YW(e,n){try{const i=new Intl.DisplayNames(["en"],{type:"region"}),r=new Intl.DisplayNames(["en"],{type:"language"}),u=e.length===2?i.of(e.toUpperCase()):void 0,h=n?r.of(n.toLowerCase()):void 0;return`${u??(e||"Country")} · ${h??(n||"Language")}`}catch{return`${e||"Country"} · ${n||"Language"}`}}function XW(e,n){const i=e.trim().toUpperCase(),r=n.trim().toLowerCase();return{countryValid:VC.some(u=>u.value===i),languageValid:$C.some(u=>u.value===r)}}function JW(e){const n=e.replace(/^\[|\]$/g,"");return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(n)||n.includes(":")}function WW(e){const n=e.trim();if(!n)return null;const i=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`https://${n}`;let r;try{r=new URL(i)}catch{return null}if(r.protocol!=="http:"&&r.protocol!=="https:")return null;const u=r.hostname.toLowerCase().replace(/^www\./,"");if(!u||u==="localhost"||JW(u)||!u.includes("."))return null;const h=u.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return h?{canonicalDomain:u,projectName:h,displayName:u}:null}async function eee(e,n=$W){let i;const r=new Promise(h=>{i=setTimeout(()=>h({state:"timed-out"}),n)}),u=await Promise.race([e.then(h=>({state:"queued",run:h})),r]);return i&&clearTimeout(i),u}function tee(e,n){e.catch(()=>{bn({title:"Site Health scan did not start",detail:"The project is safe. Choose Run scan in Site Health to retry.",tone:"negative",dedupeKey:`site-health-dispatch:${n}`})})}function KC(e){const n=C.useRef(w1()).current,i=C.useRef(new Set),r=C.useCallback((u,h)=>{if(h){if(i.current.has(h))return;i.current.add(h)}N1({...u,surface:e,eventId:S1()})},[e]);return{onboardingSessionId:n,emit:r}}function mk(e,n){return e instanceof gn&&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:n}function $g(){return l.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Preparing setup"}),l.jsx("p",{className:"page-subtitle",children:"Checking the projects already on this install."})]})}),l.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-default bg-surface p-4 text-sm text-secondary",role:"status",children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading projects…"]})]})}function nee({onRetry:e}){return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Can’t load projects"}),l.jsx("p",{className:"page-subtitle",children:"Canonry could not confirm whether this install already has a project."})]})}),l.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[l.jsx("p",{className:"text-sm font-medium text-heading",children:"Setup is paused to protect existing projects."}),l.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),l.jsx(le,{type:"button",className:"mt-4",variant:"secondary",onClick:e,children:"Retry project check"})]})]})}function aee({projectName:e,initialRunId:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(iee,{projectName:e,initialRunId:n})})}function iee({projectName:e,initialRunId:n}){const i=zs(),r=yt({...Bo({client:J}),enabled:!!e,retry:!1,refetchOnMount:"always"}),{onboardingSessionId:u,emit:h}=KC("site_health"),[f]=C.useState(()=>bG(n));C.useEffect(()=>{f&&vG()},[f]),C.useEffect(()=>{e&&h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.started",step:"run",resumed:!!n&&!f},"onboarding.started")},[h,f,n,u,e]),C.useEffect(()=>{!e||!n||DN(e)?.runId!==n&&RN(e,n)},[n,e]);const v=yt({...T1({client:J,path:{id:n??""}}),enabled:!!n,refetchInterval:({state:T})=>{const z=T.data?.status;return z==="completed"||z==="partial"||z==="failed"||z==="cancelled"?!1:2e3},refetchIntervalInBackground:!0}).data?.status;if(C.useEffect(()=>{if(!e||!n||!v)return;if(v==="completed"||v==="partial"){h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"automatic"},"onboarding.step_completed:run"),om(n);return}if(v!=="failed"&&v!=="cancelled")return;const T=v==="cancelled"?"run_cancelled":"run_failed";h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:T},`onboarding.blocked:run:${T}`),om(n)},[h,n,u,e,v]),!e)return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Project not found"}),l.jsx("p",{className:"page-subtitle",children:"This setup link does not identify a project."})]})}),l.jsx(le,{type:"button",variant:"secondary",onClick:()=>{i({to:"/projects"})},children:"View projects"})]});if(r.isPending)return l.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[l.jsx(Ro,{current:"site"}),l.jsxs("div",{className:"mt-8 flex items-center gap-3 text-sm text-secondary",role:"status",children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health setup…"]})]});if(r.isError)return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Can’t resume setup"}),l.jsx("p",{className:"page-subtitle",children:"Canonry could not load the project for this Site Health scan."})]})}),l.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",children:[l.jsx("p",{className:"text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),l.jsx(le,{type:"button",className:"mt-4",variant:"secondary",onClick:()=>{r.refetch()},children:"Retry project check"})]})]});const x=r.data.find(T=>T.name===e);if(!x)return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Project not found"}),l.jsxs("p",{className:"page-subtitle",children:["Canonry could not find ",e,". It will not open a different project."]})]})}),l.jsx(le,{type:"button",variant:"secondary",onClick:()=>{i({to:"/projects"})},children:"View projects"})]});const S=()=>{i({to:"/setup",search:{onboarding:"site-health",setupProject:x.name},replace:!0})},k=()=>{i({to:"/setup",search:{experience:"legacy",onboarding:"site-health",setupProject:x.name},replace:!0})},N=()=>{h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"skipped"},"onboarding.step_completed:run"),i({to:"/setup",search:{onboarding:"complete",setupProject:x.name,skipped:"visibility"},replace:!0})};return l.jsxs("div",{className:"page-container max-w-7xl py-8 md:py-10",children:[l.jsx("h1",{className:"sr-only",children:"Set up Canonry"}),l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"space-y-5",children:[l.jsx(Ro,{current:"site"}),l.jsxs("div",{className:"flex min-h-72 items-center justify-center gap-3 text-sm text-secondary",role:"status",children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health…"]})]}),children:l.jsx(UW,{projectName:x.name,projectId:x.id,initialRunId:n,onReleaseInitialRun:S,showOnboardingActions:!0,onContinueOnboarding:k,onSkipOnboarding:N})})]})}function see(){const e=fk({from:"/setup"}),n=e.onboarding==="site-health"&&!e.setupProject,i=e.onboarding==="site-health"&&e.experience!=="legacy",r=HG(),u=e.experience==="legacy"?"legacy":e.experience==="platform"?"platform":r,[h,f]=C.useState(!1),[b,v]=C.useState(void 0),x=yt({...Bo({client:J}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),S=yt({...qc({client:J,query:{kind:Oe["site-audit"],since:QW,limit:FW}}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),k=u==="auto"&&x.isSuccess&&x.isFetchedAfterMount&&x.data.length===0;C.useEffect(()=>{k&&f(!0)},[k]);const N=u!=="auto"?{state:"idle"}:x.isSuccess&&x.isFetchedAfterMount?{state:"success",projectCount:x.data.length}:x.isError?{state:"error"}:{state:"loading"},T=u==="legacy"?"legacy":h||k?"platform":HW(u,N);if(e.onboarding==="complete"&&e.setupProject)return l.jsx(_W,{projectName:e.setupProject,skippedVisibility:e.skipped==="visibility"});if(n||i)return l.jsx(aee,{projectName:e.setupProject,initialRunId:e.siteHealthRunId});const z=u==="auto"&&T==="legacy"&&!e.setupProject&&x.isSuccess;if(z&&b===void 0)return S.isError?v(null):S.isSuccess&&S.isFetchedAfterMount&&v(ZW(x.data,S.data)),l.jsx($g,{});const q=z?b:null;return q?l.jsx(oee,{projectName:q.projectName,runId:q.runId}):T==="legacy"?l.jsx(jW,{visibilityProjectName:e.setupProject,siteHealthOnboarding:e.onboarding==="site-health",onboardingFinish:e.onboarding==="site-health"||e.onboarding==="first-run"}):T==="loading"?l.jsx($g,{}):T==="retry"?l.jsx(nee,{onRetry:()=>{x.refetch()}}):l.jsx(ree,{onActivationStarted:()=>f(!0),skipSiteScan:e.siteScan==="skip"})}function oee({projectName:e,runId:n}){const i=zs();return C.useEffect(()=>{i({to:"/setup",search:{onboarding:"site-health",setupProject:e,...n?{siteHealthRunId:n}:{}},replace:!0})},[i,e,n]),l.jsx($g,{})}function ree({onActivationStarted:e,skipSiteScan:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(lee,{onActivationStarted:e,skipSiteScan:n})})}function lee({onActivationStarted:e,skipSiteScan:n}){const i=zs(),r=Ds(),u=pW(),h=yt({...XQ({client:J}),retry:!1}),f=oi(JQ()),[b,v]=C.useState(""),[x,S]=C.useState(""),[k,N]=C.useState(""),[T,z]=C.useState("US"),[q,E]=C.useState("en"),[P,M]=C.useState(!1),[L,$]=C.useState("idle"),[F,ae]=C.useState(null),[V,Z]=C.useState(null),[X,Ce]=C.useState(!1),[tt,Ke]=C.useState(null),[Ue,ke]=C.useState(!1),Le=h.isError?void 0:h.data,B=typeof Le?.enabled=="boolean"?Le.enabled:null,W=f.isPending?f.variables.body.enabled:B,[ve,Ae]=C.useState(null),se=C.useRef(null),{onboardingSessionId:Se,emit:Me}=KC("platform");C.useEffect(()=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.started",step:"project",resumed:!1},"onboarding.started")},[Me,Se]);const xe=WW(b),pe=x||xe?.projectName||"",ce=k||xe?.displayName||"",ue=L==="creating"||L==="dispatching",_e=V??tt,Fe=YW(T,q),{countryValid:Ee,languageValid:Ct}=XW(T,q),me=Ee&&Ct;C.useEffect(()=>{_e&&se.current?.focus()},[_e]);const Be=(Ve,ct)=>i({to:"/setup",search:{...ct?{siteHealthRunId:ct}:{},onboarding:"site-health",setupProject:Ve.name},replace:!0}),Ne=async Ve=>{$("dispatching"),Ke(null);try{const ct=u.mutateAsync({projectName:Ve.name,projectId:Ve.id,projectLabel:Ve.displayName||Ve.name,suppressErrorToast:!0,body:{checkDeadLinks:!0,maxPages:T2}}),Qt=await eee(ct);if(Qt.state==="queued"){Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"}),yG(Qt.run.runId),await Be(Ve,Qt.run.runId);return}ct.then(()=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"})},Ft=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Ac(Ft,"run_rejected")})}),tee(ct,Ve.id),await Be(Ve)}catch(ct){$("recovery"),Ke(mk(ct,"The project was created, but the Site Health scan could not be started."));const Qt=Ac(ct,"run_rejected");Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Qt}),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:Qt},`onboarding.blocked:run:${Qt}`)}},re=async Ve=>{if(Ve.preventDefault(),!(!xe||!n&&!P||!me||ue)){$("creating"),Z(null),Ce(!1),Ke(null);try{const ct=await mH({name:pe,displayName:ce,canonicalDomain:xe.canonicalDomain,country:T,language:q});if(e(),ae(ct),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.step_completed",step:"project",method:"manual"},"onboarding.step_completed:project"),await r.invalidateQueries({queryKey:$r({client:J})}),n){await i({to:"/setup",search:{experience:"legacy",onboarding:"first-run",setupProject:ct.name},replace:!0});return}await Ne(ct)}catch(ct){$("idle");const Qt=ct instanceof gn&&ct.statusCode===409;Ce(Qt),Z(mk(ct,"Could not create the project. Try again.")),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.blocked",step:"project",action:"save",reasonCode:Ac(ct,"project_create_failed")},"onboarding.blocked:project"),Qt&&(e(),r.invalidateQueries({queryKey:$r({client:J})}))}}},Ze=()=>{F&&!ue&&Ne(F)},bt=()=>{ue||i({to:"/projects"})},qn=async()=>{try{await navigator.clipboard.writeText(GW),ke(!0)}catch{bn({tone:"negative",title:"Could not copy setup request",detail:"Open the agent quickstart to continue with the CLI instead."})}},Ht=async Ve=>{Ae(null);try{const ct=await f.mutateAsync({client:J,body:{enabled:Ve}});r.setQueryData(WN({client:J}),ct),ct.enabled!==Ve&&Ae(`The server kept telemetry ${ct.enabled?"on":"off"}. Check its telemetry settings.`)}catch{Ae("Could not update telemetry. Try again.")}};return F&&L==="recovery"?l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx(Ro,{current:"site"}),l.jsx("div",{className:"page-header mt-8",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Project created"}),l.jsxs("p",{className:"page-subtitle",children:[F.displayName||F.name," is ready. The Site Health scan needs another try."]})]})}),l.jsxs("div",{ref:se,className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[l.jsx("p",{className:"text-sm font-medium text-heading",children:tt}),l.jsx("p",{className:"mt-1 text-sm text-secondary",children:"You can retry the scan or continue setup and retry from Site Health."}),l.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[l.jsx(le,{type:"button",onClick:Ze,children:"Retry Site Health scan"}),l.jsx(le,{type:"button",variant:"secondary",onClick:()=>{Be(F)},children:"Continue setup"})]})]})]}):l.jsxs("div",{className:"page-container max-w-xl py-8 md:py-12",children:[n?null:l.jsx(Ro,{current:"site"}),l.jsxs("header",{className:`mb-8 ${n?"":"mt-8"}`,children:[l.jsx("h1",{id:"site-map-setup-title",className:"text-2xl font-semibold tracking-[-0.025em] text-heading",children:n?"Create a project":"Scan your site"}),l.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-secondary",children:n?"Add a public domain, then choose the queries you want to track. No site scan will run.":"Enter your public website to see its pages, structure, internal links, and technical SEO scores."})]}),l.jsxs("form",{"aria-labelledby":"site-map-setup-title",className:"space-y-6",onSubmit:fn(re),noValidate:!0,children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm font-medium text-heading",htmlFor:"launchpad-domain",children:"Website URL"}),l.jsx("input",{id:"launchpad-domain",className:"h-11 w-full rounded-md border border-strong bg-bg-elevated/50 px-3 text-base text-heading outline-none transition placeholder:text-muted focus:border-mono-500 focus:ring-1 focus:ring-mono-500",type:"text",inputMode:"url",autoComplete:"url",autoCapitalize:"none",spellCheck:!1,required:!0,"aria-invalid":!!(b&&!xe),"aria-describedby":b&&!xe?"launchpad-domain-hint launchpad-domain-error":"launchpad-domain-hint",placeholder:"https://example.com",value:b,onChange:Ve=>{v(Ve.target.value),Z(null),Ce(!1)}}),l.jsx("p",{id:"launchpad-domain-hint",className:"text-sm text-secondary",children:n?l.jsxs(l.Fragment,{children:["A public domain is still required."," ",l.jsx(at,{to:"/setup",search:{experience:"platform"},className:"font-medium text-link underline-offset-4 hover:underline",children:"Map with Site Health instead"})]}):l.jsxs(l.Fragment,{children:["Only public pages are scanned."," ",l.jsx(at,{to:"/setup",search:{experience:"platform",onboarding:"first-run",siteScan:"skip"},className:"font-medium text-link underline-offset-4 hover:underline",children:"Set up without a site scan"})]})}),b&&!xe?l.jsx("p",{id:"launchpad-domain-error",className:"text-sm text-negative",role:"alert",children:"Enter a public domain, such as example.com."}):null]}),l.jsxs("details",{className:"group border-y border-default",children:[l.jsxs("summary",{className:"flex min-h-11 cursor-pointer list-none items-center justify-between gap-4 py-3 text-sm [&::-webkit-details-marker]:hidden",children:[l.jsx("span",{className:"font-medium text-heading",children:"Project name and locale"}),l.jsxs("span",{className:"flex items-center gap-2 text-secondary",children:[Fe,l.jsx(Lc,{className:"size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none","aria-hidden":"true"})]})]}),l.jsxs("div",{className:"space-y-5 border-t border-default py-4",children:[xe?l.jsxs("div",{children:[l.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Project"}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-project-name",children:"Project name"}),l.jsx("input",{id:"launchpad-project-name",className:"setup-input h-10",type:"text",value:pe,onChange:Ve=>S(Ve.target.value)})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-display-name",children:"Display name"}),l.jsx("input",{id:"launchpad-display-name",className:"setup-input h-10",type:"text",value:ce,onChange:Ve=>N(Ve.target.value)})]})]})]}):null,l.jsxs("div",{children:[l.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Locale"}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-country",children:"Country"}),l.jsx("select",{id:"launchpad-country",className:"setup-input h-10",value:T,onChange:Ve=>z(Ve.target.value),children:VC.map(Ve=>l.jsx("option",{value:Ve.value,children:Ve.label},Ve.value))})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-language",children:"Language"}),l.jsx("select",{id:"launchpad-language",className:"setup-input h-10",value:q,onChange:Ve=>E(Ve.target.value),children:$C.map(Ve=>l.jsx("option",{value:Ve.value,children:Ve.label},Ve.value))})]})]})]})]})]}),n?null:l.jsxs("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 py-2",children:[l.jsx("input",{className:"mt-0.5 size-4 shrink-0 rounded border-strong bg-bg",type:"checkbox",checked:P,onChange:Ve=>M(Ve.target.checked),"aria-label":"Allow Canonry to scan this public site."}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-sm leading-5 text-heading",children:"Allow Canonry to scan this public site."}),l.jsx(ua,{text:VW})]})]}),_e?l.jsxs("div",{ref:se,className:"rounded-md border border-negative bg-negative-soft p-3",role:"alert",tabIndex:-1,children:[l.jsx("p",{className:"text-sm font-medium text-heading",children:_e}),X?l.jsx(le,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:bt,children:"View projects"}):null]}):null,l.jsxs("div",{className:"grid gap-2",children:[l.jsx(le,{className:"h-11 w-full",type:"submit",disabled:!xe||!n&&!P||!me||ue,children:L==="creating"||L==="dispatching"?l.jsxs(l.Fragment,{children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"})," ",n?"Creating project…":"Mapping site…"]}):n?"Create project":"Scan site"}),L==="dispatching"?l.jsx("span",{className:"text-center text-sm text-secondary",role:"status",children:"Opening Site Health when the scan is ready."}):null]})]}),l.jsxs("section",{className:"mt-8 border-t border-default pt-6","aria-labelledby":"agent-setup-title",children:[l.jsx("p",{id:"agent-setup-title",className:"text-sm font-medium text-heading",children:"Use your agent instead"}),l.jsx("p",{className:"mt-1 text-sm leading-5 text-secondary",children:"Copy a complete CLI setup request into any agent."}),l.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[l.jsxs(le,{type:"button",variant:"ghost",size:"sm",className:"-ml-3",onClick:fn(qn),children:[Ue?l.jsx(Uc,{className:"size-3.5","aria-hidden":"true"}):l.jsx(Zg,{className:"size-3.5","aria-hidden":"true"}),l.jsx("span",{"aria-live":"polite",children:Ue?"Copied setup request":"Copy setup request"})]}),l.jsx(le,{asChild:!0,variant:"ghost",size:"sm",children:l.jsxs("a",{href:KW,target:"_blank",rel:"noopener noreferrer",children:["Agent quickstart",l.jsx(k6,{className:"size-3.5","aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})})]})]}),B!==null?l.jsxs("section",{className:"mt-6 border-t border-default pt-5","aria-labelledby":"telemetry-title",children:[l.jsxs("label",{className:`flex min-h-11 items-start gap-3 py-2 ${f.isPending?"cursor-wait":"cursor-pointer"}`,children:[l.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:W??!1,disabled:f.isPending,onChange:Ve=>{Ht(Ve.target.checked)},"aria-describedby":"telemetry-detail"}),l.jsxs("span",{className:"grid gap-0.5",children:[l.jsx("span",{id:"telemetry-title",className:"text-sm leading-5 text-heading",children:"Share anonymous product telemetry"}),l.jsx("span",{id:"telemetry-detail",className:"max-w-[70ch] text-sm leading-5 text-secondary",children:"Helps prioritize improvements. Canonry does not send raw domains, URLs, queries, answer content, or credentials."})]})]}),f.isPending?l.jsx("p",{className:"mt-1 text-sm text-secondary",role:"status",children:"Saving preference…"}):null,ve?l.jsx("p",{className:"mt-1 text-sm text-negative",role:"alert",children:ve}):null]}):null]})}function cee(){return l.jsx("div",{className:"page-container",children:l.jsx("section",{className:"page-section",children:l.jsxs(_a,{className:"surface-card empty-card",children:[l.jsx("h1",{children:"Route not found"}),l.jsx("p",{children:"The current path does not map to a dashboard view."}),l.jsx(le,{asChild:!0,children:l.jsx(at,{to:"/",children:"Return to overview"})})]})})})}const Ia=Is(()=>Qi(()=>import("./ProjectPage-Cyvt96AV.js"),__vite__mapDeps([5,1,0,2,3,4,6,7,8,9,10,11,12]),import.meta.url),"ProjectPage"),uee=Is(()=>Qi(()=>import("./RunsPage-Io7ZFw4-.js"),__vite__mapDeps([13,1,11,4,2,7,12]),import.meta.url),"RunsPage"),dee=Is(()=>Qi(()=>import("./HistoryPage-DqXwPH3k.js"),__vite__mapDeps([14,1,10,11,4,2,7,12]),import.meta.url),"HistoryPage"),mee=Is(()=>Qi(()=>import("./SettingsPage-BPYxgchP.js"),__vite__mapDeps([15,1,11,4,2,7,12]),import.meta.url),"SettingsPage"),pee=Is(()=>Qi(()=>import("./BacklinksPage-Tvt0-ppX.js"),__vite__mapDeps([16,1,9,2,11,4,7,12]),import.meta.url),"BacklinksPage"),hee=Is(()=>Qi(()=>import("./TrafficPage-DIm60m1J.js"),__vite__mapDeps([17,1,8,2,11,4,7,12]),import.meta.url),"TrafficPage"),fee=Is(()=>Qi(()=>import("./TrafficSourceDetailPage-DWT1Ip5P.js"),__vite__mapDeps([18,1,8,3,4,2,11,7,12]),import.meta.url),"TrafficSourceDetailPage"),gee=Is(()=>Qi(()=>import("./MeasurementPropertyPage-CsbfFEjB.js"),__vite__mapDeps([19,1,3,4,6,7,2,11,12]),import.meta.url),"MeasurementPropertyPage");function yee(){return l.jsx(wJ,{children:l.jsx(iQ,{children:l.jsx(xJ,{})})})}const Un=t6()({component:yee,validateSearch:e=>({manageQueries:e.manageQueries===!0||e.manageQueries==="true"?!0:void 0,runId:typeof e.runId=="string"?e.runId:void 0,siteHealthRunId:typeof e.siteHealthRunId=="string"?e.siteHealthRunId: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"?"skip":void 0,skipped:e.skipped==="visibility"?"visibility":void 0,setupProject:typeof e.setupProject=="string"?e.setupProject: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"].map(n=>[n,typeof e[n]=="string"?e[n]:void 0]))})}),bee=Bt({getParentRoute:()=>Un,path:"/",component:nW,beforeLoad:async({context:e})=>{let n=e.queryClient.getQueryData($r({client:J}));if(n===void 0)try{n=await e.queryClient.ensureQueryData(Bo({client:J}))}catch{return}if(n.length===0)throw Kg({to:"/setup"})}}),vee=Bt({getParentRoute:()=>Un,path:"/projects",component:oW}),xee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Vn=Bt({getParentRoute:()=>Un,path:"/projects/$projectName",component:()=>l.jsx(Xf,{}),beforeLoad:async({context:e,params:n,location:i})=>{const r=n.projectName;if(!xee.test(r))return;let u=e.queryClient.getQueryData($r({client:J}));if(!u)try{u=await e.queryClient.ensureQueryData(Bo({client:J}))}catch{return}const h=u.find(f=>f.id===r);if(h)throw Kg({to:i.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(h.name)}`),replace:!0})}}),wee=Bt({getParentRoute:()=>Vn,path:"/",component:()=>l.jsx(Ia,{tab:"overview"})}),See=Bt({getParentRoute:()=>Vn,path:"/portfolio",component:()=>l.jsx(Ia,{tab:"portfolio"})}),kee=Bt({getParentRoute:()=>Vn,path:"/search-console",component:()=>l.jsx(Ia,{tab:"search-console"})}),jee=Bt({getParentRoute:()=>Vn,path:"/conversions",component:()=>l.jsx(Ia,{tab:"conversions"})}),Aee=Bt({getParentRoute:()=>Vn,path:"/local",component:()=>l.jsx(Ia,{tab:"local"})}),Nee=Bt({getParentRoute:()=>Vn,path:"/discovery",component:()=>l.jsx(Ia,{tab:"discovery"})}),Cee=Bt({getParentRoute:()=>Vn,path:"/queries",component:()=>l.jsx(Ia,{tab:"queries"})}),_ee=Bt({getParentRoute:()=>Vn,path:"/properties/$targetKey",component:()=>l.jsx(gee,{})}),Tee=Bt({getParentRoute:()=>Vn,path:"/report",beforeLoad:({params:e})=>{throw Kg({to:"/projects/$projectName",params:e,replace:!0})}}),Eee=Bt({getParentRoute:()=>Vn,path:"/activity",component:()=>l.jsx(Ia,{tab:"activity"})}),Ree=Bt({getParentRoute:()=>Vn,path:"/backlinks",component:()=>l.jsx(Ia,{tab:"backlinks"})}),Dee=Bt({getParentRoute:()=>Vn,path:"/technical-aeo",component:()=>l.jsx(Ia,{tab:"technical-aeo"})}),zee=Bt({getParentRoute:()=>Vn,path:"/history",component:()=>l.jsx(Ia,{tab:"history"})}),Iee=Bt({getParentRoute:()=>Vn,path:"/settings",component:()=>l.jsx(Ia,{tab:"settings"})}),Oee=Bt({getParentRoute:()=>Un,path:"/runs",component:uee}),Pee=Bt({getParentRoute:()=>Un,path:"/history",component:dee}),qee=Bt({getParentRoute:()=>Un,path:"/settings",component:mee,beforeLoad:({context:e})=>{}}),Mee=Bt({getParentRoute:()=>Un,path:"/setup",component:see}),Bee=Bt({getParentRoute:()=>Un,path:"/backlinks",component:pee}),Lee=Bt({getParentRoute:()=>Un,path:"/traffic",component:hee}),Uee=Bt({getParentRoute:()=>Un,path:"/traffic/$projectName/$sourceId",component:fee}),Vee=Bt({getParentRoute:()=>Un,path:"*",component:cee}),$ee=Un.addChildren([bee,vee,Vn.addChildren([wee,See,kee,jee,Aee,Nee,Cee,_ee,Tee,Eee,Ree,Dee,zee,Iee]),Oee,Pee,qee,Mee,Bee,Lee,Uee,Vee]);function Kee(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const pk=Kee(),Gee=pk==="/"?"":pk.replace(/\/$/,"");function Hee(e,n){return n6({routeTree:$ee,basepath:Gee||"/",context:{queryClient:e},...n?.initialEntries})}let hk=!1;async function Qee(e){return(await lT({client:J,body:e,keepalive:!0})).data}function Fee(){hk||typeof window>"u"||(hk=!0,!(Gm()||jo())&&(NG({send:Qee}),J.interceptors.request.use((e,n)=>{const i=n.fetch??globalThis.fetch,r=typeof n.url=="string"?n.url:void 0;return n.fetch=async(u,h)=>{try{return await i(u,h)}catch(f){throw f instanceof DOMException&&f.name==="AbortError"||cm({method:e.method,route:r,network:!0}),f}},e}),J.interceptors.response.use((e,n,i)=>(cm({method:n.method,route:typeof i.url=="string"?i.url:void 0,path:Yee(n.url),status:e.status}),e)),window.addEventListener("error",e=>{lm({kind:"unhandled",error:e.error})}),window.addEventListener("unhandledrejection",e=>{lm({kind:"unhandled",error:e.reason})}),tte()))}function Zee(e){let n=null;const i=()=>{const r=e.state.matches.at(-1);if(!r)return;CG(r.fullPath);const u=e.state.location;if(!u)return;const h=u.search&&typeof u.search=="object"?u.search:{};n&&n.pathname===u.pathname&&DG(n.search,h),n={pathname:u.pathname,search:h}};return i(),e.subscribe("onResolved",i)}function Yee(e){try{return new URL(e,window.location.origin).pathname}catch{return}}const Xee={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function Jee(e,n){const[i,r]=Xee[e];return n<=i?"good":n<=r?"needs-improvement":"poor"}function Wee(){let e=0,n=0,i=-1/0,r=-1/0;return{add(u){u.hadRecentInput||(u.startTime-r<1e3&&u.startTime-i<5e3?n+=u.value:(n=u.value,i=u.startTime),r=u.startTime,e=Math.max(e,n))},value:()=>e}}function ete(){let e=0;return{add(n){n.interactionId&&(e=Math.max(e,n.duration))},value:()=>e}}function tte(){if(typeof PerformanceObserver>"u")return;const e=new Set,n=(b,v)=>{e.has(b)||!Number.isFinite(v)||(e.add(b),IG(b,Jee(b,v)))},i=(b,v,x={})=>{try{new PerformanceObserver(S=>v(S.getEntries())).observe({type:b,buffered:!0,...x})}catch{}};try{const b=performance.getEntriesByType("navigation")[0];b&&b.responseStart>0&&n("TTFB",b.responseStart)}catch{}i("paint",b=>{const v=b.find(x=>x.name==="first-contentful-paint");v&&n("FCP",v.startTime)});let r=0;i("largest-contentful-paint",b=>{const v=b.at(-1);v&&(r=v.startTime)});const u=Wee();i("layout-shift",b=>{for(const v of b)u.add({startTime:v.startTime,value:v.value??0,hadRecentInput:v.hadRecentInput===!0})});const h=ete();i("event",b=>{for(const v of b)h.add(v)},{durationThreshold:40});const f=()=>{r>0&&n("LCP",r),n("CLS",u.value()),h.value()>0&&n("INP",h.value())};document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&f()}),window.addEventListener("pagehide",f)}const nte=6e4,ate="Anyone with this password can sign in to this dashboard.",_r={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"};function ite(){const e=C.useRef(cH()).current,[n,i]=C.useState(e?"ready":"checking"),[r,u]=C.useState(null),[h,f]=C.useState(null),[b,v]=C.useState(e),[x,S]=C.useState(!1),[k,N]=C.useState(""),[T,z]=C.useState(""),[q,E]=C.useState(""),[P,M]=C.useState(!1),[L,$]=C.useState("password"),[F,ae]=C.useState(!1),[V,Z]=C.useState(""),[X,Ce]=C.useState(null),[tt,Ke]=C.useState(!1),[Ue,ke]=C.useState(!1),Le=C.useRef(null),B=C.useRef(null),W=C.useRef(null),ve=()=>{const me=r?`${r.name}:${r.role}`:e?"api-key:explicit":h?`api-key:${h.id}`:"no-accounts";if(!Le.current||W.current!==me){B.current?.clear();const Be=tQ();B.current=Be,Le.current=Hee(Be),Zee(Le.current),W.current=me}return{queryClient:B.current,router:Le.current}},Ae=me=>me.authRequired?(S(!0),u(me.user),f(null),v(!1),i(me.user?"ready":"account-login"),!0):!1;C.useEffect(()=>{let me=!1;const Be=async(Ne,re=!1)=>{try{const Ze=await Uf();if(me)return;f(Ze),v(!1),i("ready")}catch(Ze){if(me)return;if(re&&Ze instanceof gn&&Ze.statusCode===401)return xH().then(()=>{me||(Ce(null),f(null),v(!1),ke(!0),i("login"))}).catch(bt=>{me||(Ce(bt instanceof Error?bt.message:"Could not clear the invalid session"),i(Ne))});Ce(Ze instanceof Error?Ze.message:"Could not verify API key access"),i(Ne)}};return e?(Be("api-key-error"),()=>{me=!0}):(Promise.allSettled([hS(),pS()]).then(([Ne,re])=>{if(me||Ne.status==="fulfilled"&&Ae(Ne.value))return;if(re.status==="rejected"){const bt=re.reason;Ce(bt instanceof Error?bt.message:"Failed to reach the Canonry API"),i("login");return}const Ze=re.value;Ze.authenticated?(v(!0),Be("api-key-error",!0)):(f(null),v(!1),i(Ze.setupRequired?"setup":"login"))}),()=>{me=!0})},[]),C.useEffect(()=>{if(n!=="ready"||e)return;const me=setInterval(()=>{if(x){hS().then(Be=>{Be.authRequired&&!Be.user&&(ke(!0),u(null),f(null),i("account-login"))}).catch(()=>{});return}pS().then(Be=>{Be.authenticated||(ke(!0),f(null),i(Be.setupRequired?"setup":"login"))}).catch(()=>{})},nte);return mS(()=>{ke(!0),u(null),f(null),v(!1),i(x?"account-login":"login")}),()=>{clearInterval(me),mS(null)}},[n,x,e]);const se=async me=>{if(me.preventDefault(),!T.trim()||T.trim().length<8){Ce("Password must be at least 8 characters");return}if(T!==q){Ce("Passwords do not match");return}const Be=V.trim();if(F&&!Be){Ce(_r.missing);return}Ke(!0),Ce(null);try{if(!(await yH(T.trim(),F?Be:void 0)).authenticated){Ce("Setup failed");return}z(""),E(""),Z(""),ae(!1),M(!1),ke(!1),f(null),v(!0),i("checking");try{const re=await Uf();f(re),v(!1),i("ready")}catch(re){Ce(re instanceof Error?re.message:"Could not verify API key access"),i("api-key-error")}}catch(Ne){if(Ne instanceof gn&&Ne.statusCode===401&&Ne.code==="AUTH_REQUIRED"){Ce(F?_r.rejected:null),ae(!0);return}Ce(Ne instanceof gn||Ne instanceof Error?Ne.message:"Setup failed")}finally{Ke(!1)}},Se=me=>{z(me),Ce(null)},Me=me=>{Z(me),Ce(null)},xe=me=>{E(me),Ce(null)},pe=async me=>{if(me.preventDefault(),!!T.trim()){Ke(!0),Ce(null);try{if(!(L==="api-key"?await vH(T.trim()):await bH(T.trim())).authenticated){Ce(L==="api-key"?"Invalid API key":"Incorrect password");return}const Ne=await Uf();f(Ne),v(!1),z(""),M(!1),ke(!1),i("ready")}catch(Be){Ce(Be instanceof gn||Be instanceof Error?Be.message:"Authentication failed")}finally{Ke(!1)}}},ce=me=>{$(me),z(""),M(!1),Ce(null)},ue=async me=>{if(me.preventDefault(),!(!k.trim()||!T)){Ke(!0),Ce(null);try{const Be=await wH(k.trim(),T);if(!Be.user){Ce("Incorrect name or password.");return}z(""),ke(!1),u(Be.user),f(null),v(!1),i("ready")}catch(Be){Ce(Be instanceof gn?Be.message:"Incorrect name or password.")}finally{Ke(!1)}}};if(n==="ready"){const{queryClient:me,router:Be}=ve();return l.jsx($H,{account:r,apiKey:h,apiKeyPending:b,children:l.jsx(a6,{client:me,children:l.jsx(i6,{router:Be})})})}const _e=T.trim(),Fe=T.length>0&&_e.length<8,Ee=q.length>0&&T!==q,Ct=_e.length>=8&&T===q&&(!F||V.trim().length>0);return l.jsx("div",{className:"min-h-screen bg-bg px-4 py-8",children:l.jsxs("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5",children:[l.jsxs("div",{"data-testid":"auth-brand",className:"flex items-center gap-2.5",children:[l.jsx("img",{className:"size-7",src:"./favicon.svg",alt:"","aria-hidden":"true"}),l.jsx("span",{className:"text-lg font-semibold tracking-tight text-heading",children:"Canonry"})]}),l.jsx(_a,{className:"surface-card w-full",children:n==="checking"?l.jsx(vo,{className:"py-8",children:l.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):n==="api-key-error"?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Could not verify API key access"})]}),l.jsxs(vo,{className:"space-y-4",children:[l.jsx("p",{className:"supporting-copy",children:X??"Canonry could not verify this session’s access, so the dashboard stayed locked."}),l.jsx(le,{type:"button",className:"w-full",onClick:()=>{window.location.reload()},children:"Try again"})]})]}):n==="account-login"?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"})]}),l.jsxs(vo,{children:[Ue?l.jsx("p",{className:"mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-sm text-caution",children:"You were signed out — please sign in again."}):null,l.jsxs("form",{className:"space-y-4",onSubmit:fn(ue),children:[l.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-name",children:[l.jsx("span",{className:"text-xs font-medium text-secondary",children:"Name"}),l.jsx("input",{autoFocus:!0,id:"account-name",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:"text",name:"username",autoComplete:"username",value:k,onChange:me=>{N(me.target.value),Ce(null)},"aria-invalid":!!X,"aria-describedby":X?"account-login-error":void 0})]}),l.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-password",children:[l.jsx("span",{className:"text-xs font-medium text-secondary",children:"Password"}),l.jsx("input",{id:"account-password",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:"password",name:"password",autoComplete:"current-password",value:T,onChange:me=>Se(me.target.value),"aria-invalid":!!X,"aria-describedby":X?"account-login-error":void 0})]}),X?l.jsx("p",{id:"account-login-error",role:"alert",className:"text-sm text-negative-400",children:X}):null,l.jsx(le,{type:"submit",disabled:tt||!k.trim()||!T,children:tt?"Signing in…":"Sign in"})]})]})]}):n==="setup"?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Create a dashboard password"}),l.jsx(fm,{children:ate})]}),l.jsx(vo,{children:l.jsxs("form",{className:"space-y-4",onSubmit:fn(se),children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-new",children:"Password"}),l.jsx("input",{autoFocus:!0,id:"dashboard-password-new",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:"new-password",autoComplete:"new-password",minLength:8,required:!0,value:T,onChange:me=>Se(me.target.value),"aria-invalid":Fe,"aria-describedby":"dashboard-password-new-help"}),l.jsx("span",{id:"dashboard-password-new-help","aria-live":"polite",className:Fe?"block text-sm text-negative-400":"block text-sm text-secondary",children:Fe?"Enter at least 8 characters.":"Use at least 8 characters."})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-confirm",children:"Confirm password"}),l.jsx("input",{id:"dashboard-password-confirm",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:"confirm-password",autoComplete:"new-password",minLength:8,required:!0,value:q,onChange:me=>xe(me.target.value),"aria-invalid":Ee,"aria-describedby":"dashboard-password-confirm-help"}),l.jsx("span",{id:"dashboard-password-confirm-help","aria-live":"polite",className:Ee?"block text-sm text-negative-400":"block text-sm text-secondary",children:Ee?"Passwords do not match.":"Enter the same password again."})]}),F?l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-setup-root-key",children:_r.label}),l.jsx("input",{autoFocus:!0,id:"dashboard-setup-root-key",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:"apiKey",autoComplete:"off",spellCheck:!1,required:!0,value:V,onChange:me=>Me(me.target.value),"aria-invalid":X===_r.rejected,"aria-describedby":"dashboard-setup-root-key-help"}),l.jsx("span",{id:"dashboard-setup-root-key-help","aria-live":"polite",className:"block text-sm text-secondary",children:_r.help})]}):null,l.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-password-show",children:[l.jsx("input",{id:"dashboard-password-show",type:"checkbox",checked:P,onChange:me=>M(me.target.checked)}),F?_r.show:"Show passwords"]}),X?l.jsx("p",{id:"dashboard-password-setup-error",role:"alert",className:"text-sm text-negative-400",children:X}):null,l.jsx(le,{type:"submit",disabled:tt||!Ct,children:tt?"Creating password…":"Create password and continue"})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"}),l.jsx(fm,{children:L==="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."})]}),l.jsxs(vo,{children:[Ue?l.jsx("p",{className:"mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-sm text-caution",children:"Your session expired — please sign in again."}):null,l.jsxs("form",{className:"space-y-4",onSubmit:fn(pe),children:[l.jsxs("label",{className:"block space-y-1.5",htmlFor:"dashboard-password-current",children:[l.jsx("span",{className:"text-xs font-medium text-secondary",children:L==="api-key"?"Canonry API key":"Password"}),l.jsx("input",{autoFocus:!0,id:"dashboard-password-current",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:L==="api-key"?"apiKey":"password",autoComplete:L==="api-key"?"off":"current-password",spellCheck:!1,required:!0,value:T,onChange:me=>Se(me.target.value),"aria-invalid":!!X,"aria-describedby":X?"dashboard-password-login-error":void 0})]}),l.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-login-password-show",children:[l.jsx("input",{id:"dashboard-login-password-show",type:"checkbox",checked:P,onChange:me=>M(me.target.checked)}),L==="api-key"?"Show API key":"Show password"]}),X?l.jsx("p",{id:"dashboard-password-login-error",role:"alert",className:"text-sm text-negative-400",children:X}):null,l.jsx(le,{type:"submit",disabled:tt||!T.trim(),children:tt?"Signing in…":"Open dashboard"}),l.jsx(le,{type:"button",variant:"ghost",onClick:()=>ce(L==="api-key"?"password":"api-key"),children:L==="api-key"?"Use dashboard password instead":"Forgot password? Use API key"})]})]})]})})]})})}const GC=document.getElementById("root");if(!GC)throw new Error("Expected #root element for web app bootstrap.");Fee();R6.createRoot(GC).render(l.jsx(C.StrictMode,{children:l.jsx(ite,{})}));export{xY as $,jo as A,le as B,Sc as C,On as D,fn as E,ese as F,ase as G,nse as H,ua as I,tae as J,aae as K,nne as L,Nse as M,Wie as N,ane as O,Yte as P,tne as Q,Ga as R,sk as S,wn as T,sne as U,nae as V,ine as W,fa as X,oQ as Y,Vse as Z,$se as _,Ase as a,Jte as a$,pQ as a0,Xte as a1,Nae as a2,Rae as a3,Cne as a4,jae as a5,Eie as a6,zie as a7,Die as a8,Pne as a9,Lie as aA,Lg as aB,S9 as aC,k9 as aD,zte as aE,Dte as aF,mae as aG,bae as aH,vae as aI,gn as aJ,xae as aK,bne as aL,rQ as aM,vZ as aN,jg as aO,wae as aP,Bd as aQ,sse as aR,Pg as aS,bo as aT,uQ as aU,Nt as aV,JH as aW,Kae as aX,wX as aY,Bne as aZ,ene as a_,One as aa,Hne as ab,bn as ac,Pie as ad,qie as ae,Une as af,Mie as ag,Vne as ah,Mne as ai,Lne as aj,Iie as ak,Oie as al,Rie as am,qne as an,Bie as ao,Hie as ap,Vie as aq,Kie as ar,$ie as as,Gie as at,cae as au,E1 as av,Oe as aw,Uie as ax,aC as ay,Gi as az,Eae as b,eae as b$,qi as b0,qse as b1,Fte as b2,fne as b3,yq as b4,mne as b5,Qte as b6,Tae as b7,Hte as b8,kQ as b9,rie as bA,cie as bB,yie as bC,Cie as bD,Nie as bE,fie as bF,jie as bG,Tie as bH,die as bI,vie as bJ,xie as bK,wie as bL,uie as bM,bie as bN,mie as bO,Sie as bP,pie as bQ,kie as bR,gie as bS,Aie as bT,_ie as bU,lW as bV,hie as bW,pne as bX,Ane as bY,jne as bZ,kne as b_,QQ as ba,Yae as bb,tie as bc,Xae as bd,lne as be,une as bf,C$ as bg,dne as bh,OQ as bi,Zae as bj,T$ as bk,Sg as bl,cne as bm,eH as bn,Jae as bo,Fae as bp,qQ as bq,Wae as br,Sae as bs,eie as bt,use as bu,dse as bv,$ne as bw,JN as bx,ise as by,XN as bz,Rte as c,Ise as c$,WG as c0,_2 as c1,Dm as c2,T2 as c3,_s as c4,iie as c5,Ite as c6,YQ as c7,lie as c8,Iae as c9,vW as cA,Kse as cB,Rse as cC,bX as cD,Ese as cE,mW as cF,nie as cG,Mae as cH,Tse as cI,$ae as cJ,Bae as cK,Y9 as cL,VP as cM,aie as cN,_se as cO,Uae as cP,Sse as cQ,CX as cR,dH as cS,gQ as cT,_X as cU,xne as cV,wne as cW,vne as cX,hH as cY,Dse as cZ,zse as c_,Wte as ca,wS as cb,Tne as cc,Ene as cd,Dae as ce,zae as cf,Rne as cg,Dne as ch,Ine as ci,zne as cj,su as ck,Bo as cl,MN as cm,qae as cn,Pae as co,sX as cp,Dg as cq,mm as cr,zg as cs,pm as ct,hm as cu,xX as cv,CQ as cw,xo as cx,gm as cy,eF as cz,mQ as d,r9 as d$,Pse as d0,Sne as d1,SQ as d2,Nne as d3,fY as d4,Qie as d5,AH as d6,Xne as d7,Zie as d8,Yie as d9,Kr as dA,kS as dB,uae as dC,pae as dD,fae as dE,gae as dF,dae as dG,hae as dH,yae as dI,Mf as dJ,lae as dK,lse as dL,iW as dM,rne as dN,h1 as dO,Oae as dP,ose as dQ,cse as dR,rae as dS,one as dT,sae as dU,oae as dV,iae as dW,rse as dX,Gte as dY,o9 as dZ,Ra as d_,Xie as da,Fie as db,Cae as dc,Qne as dd,Fne as de,Zne as df,Jne as dg,Yne as dh,z1 as di,qc as dj,Use as dk,iu as dl,sie as dm,oie as dn,iH as dp,gne as dq,yne as dr,_ne as ds,Kne as dt,Gne as du,M1 as dv,Ym as dw,I1 as dx,bW as dy,Wne as dz,dQ as e,Vte as e$,EP as e0,Lae as e1,Aae as e2,bO as e3,Gae as e4,Vae as e5,Qae as e6,Hae as e7,IS as e8,ye as e9,Qi as eA,za as eB,qte as eC,lm as eD,hne as eE,QF as eF,pse as eG,mse as eH,pW as eI,gse as eJ,jX as eK,Ote as eL,kse as eM,jse as eN,hse as eO,fse as eP,Pte as eQ,bse as eR,wse as eS,yse as eT,xse as eU,Ro as eV,Kte as eW,Lte as eX,vse as eY,Bte as eZ,oP as e_,Ete as ea,Tte as eb,_te as ec,Cte as ed,jte as ee,kte as ef,Nte as eg,Ate as eh,Ste as ei,wte as ej,hte as ek,fte as el,xte as em,vte as en,bte as eo,gte as ep,yte as eq,pte as er,mte as es,dte as et,a_ as eu,n_ as ev,$te as ew,kw as ex,Mte as ey,Oj as ez,nm as f,Ute as f0,Mse as g,Ose as h,Bse as i,Lse as j,Ig as k,$c as l,Cse as m,LV as n,wY as o,EG as p,kae as q,Jie as r,_ae as s,cQ as t,O1 as u,tse as v,_a as w,Zte as x,J as y,Gm as z};
86
+ competitor2.com`,value:fi,onChange:H=>Yi(H.target.value)})]}),en?l.jsx("p",{className:"text-negative-400 text-sm",children:en}):null,l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx("div",{className:"flex gap-2",children:yi.length===0?l.jsx(le,{type:"button",onClick:wl,children:"Continue without competitors"}):l.jsxs(l.Fragment,{children:[l.jsx(le,{type:"button",variant:"outline",onClick:wl,children:"Skip"}),l.jsx(le,{type:"button",disabled:pl,onClick:fn(bl),children:pl?"Saving...":`Save ${yi.length} competitor${yi.length!==1?"s":""}`})]})})]})]})]});case 4:{const H=Ya.data,Ye=H?.status??(Wi===tt?.id?tt.status:void 0),vi=Ye==="completed"||Ye==="partial"||Ye==="failed"||Ye==="cancelled",ts=H?.snapshots??[],Ma=H?.queryCounts,kl=Ye?rk(Ye,ts.length):!1,An=Ke&&!Za,xi=jn??(H?.error?rQ(H.error):Ye==="cancelled"?"The sweep was cancelled before it produced a baseline.":(Ye==="completed"||Ye==="partial")&&ts.length===0?"The sweep finished without producing any snapshots.":tt?.statusDetail||"The sweep did not produce a baseline.");let Wa=null;return An||kl?Wa=l.jsx(wn,{tone:"positive",children:"Complete"}):jn&&!Za?Wa=l.jsx(wn,{tone:"negative",children:"Failed"}):vi?Wa=l.jsx(wn,{tone:"negative",children:Ye==="cancelled"?"Cancelled":"Failed"}):Za&&(Wa=l.jsx(wn,{tone:"caution",children:"Running"})),l.jsxs(_a,{className:"surface-card step-card",children:[l.jsxs("div",{className:"section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:T?"Step 2 of 2":"Step 5 of 5"}),l.jsx("h2",{children:bo()?"AI Visibility":"Launch first run"})]}),Wa]}),An?l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"text-secondary",children:["Setup is complete. ",l.jsx("span",{className:"text-strong font-medium",children:Ne})," already has a successful answer-visibility baseline."]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",onClick:()=>ct(),children:f?"Finish setup":"Open project dashboard →"})]})]}):!Za&&bo()?l.jsxs("div",{className:"compact-stack",children:[Ne?l.jsx(_X,{projectName:Ne}):l.jsx("p",{className:"text-sm text-secondary",children:Pg}),jn&&l.jsx("p",{role:"alert",className:"text-sm text-negative",children:jn}),l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",onClick:Ve,children:"Open project dashboard →"})]})]}):Za?vi?kl?l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"text-neutral",children:["Sweep complete. Your first answer-visibility snapshot for"," ",l.jsx("span",{className:"text-heading font-medium",children:Ne}),":"]}),l.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-1",children:[l.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[l.jsx("p",{className:"text-xs font-medium text-secondary",children:"Mentioned"}),l.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:Ma?l.jsxs(l.Fragment,{children:[Ma.mentionedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",Ma.totalQueries]})]}):"Unavailable"}),l.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries naming your brand"})]}),l.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[l.jsx("p",{className:"text-xs font-medium text-secondary",children:"Cited"}),l.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:Ma?l.jsxs(l.Fragment,{children:[Ma.citedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",Ma.totalQueries]})]}):"Unavailable"}),l.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries citing your site"})]}),l.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[l.jsx("p",{className:"text-xs font-medium text-secondary",children:"Results"}),l.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:ts.length}),l.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"completed engine checks"})]})]}),!b&&Ne?l.jsx(yW,{projectName:Ne}):null,l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",onClick:()=>ct(),children:f?"Finish setup":"Open project dashboard →"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[l.jsx("p",{children:xi}),l.jsx("p",{className:"mt-1 text-xs text-secondary",children:bo()?Pg:x?"Fix provider or query configuration if needed, then retry without leaving setup.":"Ask an administrator to review the provider and query configuration."})]}),l.jsxs("div",{className:"setup-nav",children:[x&&!bo()?l.jsx(le,{type:"button",variant:"outline",asChild:!0,children:l.jsx(at,{to:"/settings",children:"Configure providers"})}):l.jsx("span",{}),bo()||!x?l.jsx(le,{type:"button",onClick:Ve,children:"Open project dashboard →"}):l.jsx(le,{type:"button",disabled:gi||!!Xa,onClick:fn(bi),children:gi?"Retrying...":"Retry visibility sweep"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsx("p",{className:"text-neutral",children:"Sweep running. This usually takes 30 to 60 seconds."}),l.jsx("div",{className:"rounded-md border border-default bg-surface p-3 text-xs text-muted",children:l.jsxs("p",{children:["Status: ",l.jsx("span",{className:"text-neutral",children:Ye??"queued"})]})}),Ya.isError&&l.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[l.jsx("p",{children:Ya.error instanceof Error?Ya.error.message:"Could not refresh the sweep status."}),l.jsx(le,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{Ya.refetch()},children:"Retry status check"})]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx("span",{}),l.jsx(le,{type:"button",variant:"outline",onClick:f?()=>ct():Ve,children:f?"Finish setup":"Watch on project page"})]})]}):l.jsxs("div",{className:"compact-stack",children:[l.jsxs("p",{className:"supporting-copy",children:["Your queries are saved. Run a first sweep to get a baseline for"," ",l.jsx("span",{className:"text-heading font-medium",children:Ne}),", or finish and run it later from the project. A sweep calls the answer engines, so it costs provider usage."]}),(Xa||jn)&&l.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[l.jsx("p",{children:jn??Xa}),l.jsx("p",{className:"mt-1 text-xs text-secondary",children:"Resolve the blocker above, then retry the sweep here."})]}),l.jsxs("div",{className:"setup-nav",children:[l.jsx(le,{type:"button",variant:"outline",onClick:Mn,children:"Back"}),l.jsx(le,{type:"button",variant:"ghost",onClick:Qt,children:"Finish without running"}),ba==="no_provider"&&!T?l.jsx(le,{type:"button",asChild:!0,children:l.jsx(at,{to:"/settings",children:"Configure a provider"})}):l.jsx(le,{type:"button",disabled:gi||!!Xa,title:Xa,onClick:fn(bi),children:gi?"Launching...":jn?"Retry visibility sweep":"Launch visibility sweep"})]})]})]})}default:return null}})();return l.jsxs("div",{className:T?"page-container visibility-setup":"page-container",children:[f?l.jsx(Ro,{current:"visibility"}):null,l.jsxs("div",{className:"page-header",children:[l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{ref:u?h:void 0,tabIndex:u?-1:void 0,className:"page-title",children:u?"Set up AI Visibility":"Setup"}),l.jsx("p",{className:"page-subtitle",children:u?"Connect an answer engine, then choose queries for your first sweep.":"Create a project and run its first visibility check."})]}),f?l.jsx("div",{className:"page-header-right",children:l.jsx(le,{type:"button",variant:"outline",className:"min-h-11",onClick:Qt,children:"Skip AI Visibility"})}):null]}),f?null:l.jsx(kW,{current:T?B===4?1:0:B,labels:T?wW:xW}),l.jsxs("section",{className:"setup-wizard",children:[Ys,Ja]})]})}const Yf="canonry mcp install --client claude-code",NW="https://github.com/Canonry/canonry/blob/main/docs/mcp.md";function CW(){const e=C.useRef(w1()).current,n=C.useRef(new Set),i=C.useCallback((r,u)=>{n.current.has(r)||(n.current.add(r),N1({...u,flowVersion:ft,onboardingSessionId:e,surface:"platform",eventId:S1()}))},[e]);return C.useEffect(()=>{i("started",{event:"onboarding.started",step:"finish",resumed:!1})},[i]),C.useCallback(r=>{i(`action:${r}`,{event:"onboarding.step_completed",step:"finish",method:"manual",nextAction:r})},[i])}const ap=C.createContext(()=>{});function _W({projectName:e,skippedVisibility:n=!1}){const i=yt({...QF({client:J,path:{name:e}}),retry:!1}),r=i.data?.hasData?i.data:null,u=CW(),h=uk(e,Oe["site-audit"]),f=uk(e,Oe["answer-visibility"]),b={...h?{site:h,fixes:h}:{},...TW(f,n)};return l.jsx(ap.Provider,{value:u,children:l.jsxs("div",{className:"page-container max-w-6xl py-8 md:py-10",children:[l.jsx(Ro,{current:"done",outcomes:b}),l.jsxs("header",{className:"relative mx-auto mt-12 max-w-2xl text-center md:mt-16",children:[l.jsx(EW,{}),l.jsx("p",{className:"onb-reveal mt-6 text-sm font-medium text-positive",style:Ta(250),children:"Setup complete"}),l.jsx("h1",{className:"onb-reveal mt-2 text-5xl font-semibold tracking-tight text-heading md:text-6xl",style:Ta(350),children:"You’re set."}),l.jsxs("p",{className:"onb-reveal mx-auto mt-4 max-w-xl text-lg text-secondary",style:Ta(450),children:["Canonry is tracking ",l.jsx("span",{className:"font-medium text-heading",children:e}),". Here’s how to get the most out of it from here."]})]}),l.jsxs("div",{className:"mt-14 grid gap-4 md:grid-cols-6",children:[l.jsx(Rd,{className:"md:col-span-4 md:row-span-2",delayMs:600,labelledBy:"onb-agent-heading",children:l.jsx(zW,{projectName:e})}),l.jsx(Rd,{className:"md:col-span-2 md:row-span-2",delayMs:700,labelledBy:"onb-data-heading",children:l.jsx(PW,{projectName:e})}),l.jsx(Rd,{className:"md:col-span-3",delayMs:800,labelledBy:"onb-schedule-heading",children:l.jsx(BW,{projectName:e})}),l.jsx(Rd,{className:"md:col-span-3",delayMs:900,labelledBy:"onb-alerts-heading",children:l.jsx(LW,{projectName:e,score:r?.aggregateScore??null})})]}),l.jsxs("div",{className:"onb-reveal mt-12 flex flex-col items-center gap-3 sm:flex-row sm:justify-center",style:Ta(1e3),children:[l.jsx(le,{asChild:!0,className:"h-11 rounded-full px-6 text-base md:h-11",children:l.jsxs(at,{to:"/projects/$projectName",params:{projectName:e},replace:!0,onClick:()=>u("open_project"),children:["Open ",e,l.jsx(Tc,{className:"size-4","aria-hidden":"true"})]})}),l.jsx(le,{asChild:!0,variant:"ghost",className:"h-11 rounded-full px-5 md:h-11",children:l.jsx(at,{to:"/projects/$projectName/technical-aeo",params:{projectName:e},replace:!0,onClick:()=>u("review_page_health"),children:"Review page health"})})]})]})})}function uk(e,n){const i=yt({...XN({client:J,path:{name:e},query:{kind:n,limit:20}}),retry:!1,refetchInterval:r=>dk(r.state.status==="success"?{isSuccess:!0,data:r.state.data}:{isSuccess:!1})==="pending"?5e3:!1});return dk(i)}function TW(e,n){return e===void 0?{}:n?{visibility:"skipped"}:{visibility:e}}function dk(e){if(!e.isSuccess||!e.data)return"unknown";const n=e.data.filter(i=>i.trigger!==$a.probe);if(!n.some(i=>i.status===Nt.completed||i.status===Nt.partial))return n.some(i=>i.status===Nt.queued||i.status===Nt.running)?"pending":n.length>0?"incomplete":"skipped"}function Ta(e){return{"--onb-delay":`${e}ms`}}function EW(){return l.jsx("div",{className:"onb-check relative mx-auto size-20","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 80 80",className:"relative size-20",children:[l.jsx("circle",{className:"onb-check-ring",cx:"40",cy:"40",r:"36",fill:"none",strokeWidth:"3",pathLength:"1"}),l.jsx("path",{className:"onb-check-mark",d:"M25 41 L35 51 L56 30",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round",pathLength:"1"})]})})}function Rd({className:e="",delayMs:n,labelledBy:i,children:r}){return l.jsx("section",{"aria-labelledby":i,className:`onb-reveal onb-tile flex flex-col overflow-hidden rounded-2xl border border-default bg-surface p-6 md:p-7 ${e}`,style:Ta(n),children:r})}function ip({id:e,eyebrow:n,title:i,children:r}){return l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted",children:n}),l.jsx("h2",{id:e,className:"mt-1.5 text-2xl font-semibold tracking-tight text-heading",children:i}),l.jsx("p",{className:"mt-2 text-sm text-secondary",children:r})]})}const Dd=[{id:"diagnose",label:"Diagnose",prompt:"Why did we lose citations this week?",calls:["canonry_insights_list","canonry_competitor_landscape"],reply:"Two engines started citing a competitor’s comparison page instead of yours. Want me to draft one that answers the same query?"},{id:"fix",label:"Fix",prompt:"Fix the weakest pages on the site.",calls:["canonry_technical_aeo_pages","canonry_site_health_page_audit"],reply:"The lowest-scoring pages are missing structured data and answer-first intros. I’ve written the changes for you to review."},{id:"automate",label:"Automate",prompt:"Re-check everything every Monday and tell me in Slack.",calls:["canonry_schedule_set","canonry_agent_webhook_attach"],reply:"Done. A sweep runs every Monday, and I’ll post what changed to Slack."}],RW=9e3;function DW(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function zW({projectName:e}){const n=C.useContext(ap),[i,r]=C.useState(0),[u,h]=C.useState(!1),[f,b]=C.useState(!1);C.useEffect(()=>{if(u||DW())return;const S=window.setTimeout(()=>r(k=>(k+1)%Dd.length),RW);return()=>window.clearTimeout(S)},[i,u]);const v=async()=>{try{await navigator.clipboard.writeText(Yf),n("copy_agent_command"),b(!0),window.setTimeout(()=>b(!1),1800)}catch{bn({tone:"negative",title:"Could not copy the command",detail:`Run ${Yf} in your terminal.`})}},x=Dd[i]??Dd[0];return l.jsxs(l.Fragment,{children:[l.jsxs(ip,{id:"onb-agent-heading",eyebrow:"Your agent",title:"Let your agent run it.",children:["Your agent can do everything in Canonry: diagnose a drop, fix pages, run sweeps and scans, and write the client report. Use Claude Code, Codex, Cursor, or Aero, the analyst built into"," ",l.jsx("span",{className:"text-heading",children:e})," that reviews every sweep on its own."]}),l.jsxs("div",{className:"mt-6 flex flex-1 flex-col rounded-xl border border-default bg-bg",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),onFocus:()=>h(!0),children:[l.jsxs("div",{className:"flex items-center gap-1 border-b border-default px-3 py-2",role:"tablist","aria-label":"Example agent sessions",children:[Dd.map((S,k)=>l.jsx("button",{type:"button",role:"tab","aria-selected":k===i,onClick:()=>{r(k),h(!0)},className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${k===i?"bg-surface-inset text-heading":"text-muted hover:text-secondary"}`,children:S.label},S.id)),l.jsx("span",{className:"ml-auto text-xs text-faint",children:"Example"})]}),l.jsxs("div",{role:"tabpanel","aria-label":`${x.label} example`,className:"flex-1 p-4 font-mono text-[13px] leading-relaxed",children:[l.jsxs("p",{className:"onb-type text-heading",style:Ta(150),children:[l.jsx("span",{className:"text-muted",children:"> "}),x.prompt]}),x.calls.map((S,k)=>l.jsxs("p",{className:"onb-line mt-1 text-muted first:mt-3",style:Ta(1300+k*450),children:[l.jsx("span",{className:"text-positive",children:"●"})," ",S]},S)),l.jsx("p",{className:"onb-line mt-3 text-secondary",style:Ta(1500+x.calls.length*450),children:x.reply}),l.jsx("span",{className:"onb-caret mt-2 inline-block h-4 w-2 bg-current align-middle text-secondary",style:Ta(1900+x.calls.length*450),"aria-hidden":"true"})]},x.id)]}),l.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[l.jsx("code",{className:"min-w-0 flex-1 truncate rounded-lg border border-default bg-surface-inset px-3 py-2 font-mono text-[13px] text-heading",children:Yf}),l.jsxs(le,{type:"button",variant:"secondary",size:"sm",className:"h-9 md:h-9",onClick:()=>{v()},children:[f?l.jsx(Uc,{className:"size-4","aria-hidden":"true"}):l.jsx(Zg,{className:"size-4","aria-hidden":"true"}),f?"Copied":"Copy"]}),l.jsx("a",{href:NW,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-link underline-offset-4 hover:underline",children:"Other clients"})]})]})}const IW=[{icon:Fg,label:"Search Console",action:"connect_search_console",to:"/projects/$projectName/search-console"},{icon:Ck,label:"Google Analytics",action:"connect_analytics",to:"/projects/$projectName/activity"},{icon:Tk,label:"Business Profile",action:"connect_business_profile",to:"/projects/$projectName/local"}],OW=["GPTBot","ClaudeBot","PerplexityBot"];function PW({projectName:e}){const n=C.useContext(ap);return l.jsxs(l.Fragment,{children:[l.jsx(ip,{id:"onb-data-heading",eyebrow:"Server-side traffic",title:"See the AI bots.",children:"AI crawlers and answer-engine fetches never run JavaScript, so Google Analytics never sees them. Canonry reads them straight from your server."}),l.jsx(qW,{}),l.jsxs(at,{to:"/traffic",onClick:()=>n("connect_server_traffic"),"aria-label":"Connect server-side traffic",className:"group flex items-center gap-3 rounded-xl border border-strong bg-surface-inset px-4 py-3 text-sm font-medium text-heading transition-colors hover:bg-surface-inset-hover",children:[l.jsx(Ek,{className:"size-4 text-positive","aria-hidden":"true"}),l.jsxs("span",{className:"flex-1",children:["Connect your server",l.jsx("span",{className:"block text-xs font-normal text-secondary",children:"Cloudflare, Vercel, WordPress, or Cloud Run"})]}),l.jsx(Tc,{className:"size-4 text-link transition-transform group-hover:translate-x-0.5","aria-hidden":"true"})]}),l.jsx("p",{className:"mt-5 text-xs font-medium uppercase tracking-wide text-muted",children:"Also connect"}),l.jsx("ul",{className:"mt-1 divide-y divide-default",children:IW.map(({icon:i,label:r,action:u,to:h})=>l.jsx("li",{children:l.jsxs(at,{to:h,params:{projectName:e},"aria-label":`Connect ${r}`,onClick:()=>n(u),className:"group flex items-center gap-3 py-2.5 text-sm text-heading",children:[l.jsx(i,{className:"size-4 text-muted","aria-hidden":"true"}),l.jsx("span",{className:"flex-1",children:r}),l.jsx(Tc,{className:"size-3.5 text-link transition-transform group-hover:translate-x-0.5","aria-hidden":"true"})]})},r))})]})}function qW(){const e=[22,70,118];return l.jsxs("div",{className:"relative my-6 h-36","aria-hidden":"true",children:[l.jsx("svg",{viewBox:"0 0 200 140",preserveAspectRatio:"none",className:"absolute inset-0 size-full",children:e.map((n,i)=>l.jsx("path",{className:"onb-flow",style:Ta(i*400),d:`M20 ${n} C 100 ${n}, 118 70, 170 70`,fill:"none",strokeWidth:"1.5"},n))}),OW.map((n,i)=>l.jsx("span",{className:"onb-bot absolute left-0 -translate-y-1/2 rounded-md border border-default bg-bg-elevated px-2 py-1 font-mono text-[11px] text-secondary",style:{top:`${(e[i]??70)/140*100}%`,...Ta(i*600)},children:n},n)),l.jsx("span",{className:"onb-hub absolute right-0 top-1/2 flex size-11 -translate-y-1/2 items-center justify-center rounded-2xl bg-accent text-on-inverse",children:l.jsx(Ek,{className:"size-5"})})]})}const MW=["M","T","W","T","F","S","S"];function BW({projectName:e}){return l.jsxs(l.Fragment,{children:[l.jsx(ip,{id:"onb-schedule-heading",eyebrow:"Scheduled sweeps",title:"Runs on its own.",children:"Re-measure every week without lifting a finger, so a drop shows up before a customer notices."}),l.jsx("ol",{className:"mt-6 grid grid-cols-7 gap-2","aria-hidden":"true",children:MW.map((n,i)=>l.jsxs("li",{className:"flex flex-col items-center gap-2",children:[l.jsx("span",{className:"onb-day size-3 rounded-full bg-surface-inset",style:Ta(i*500)}),l.jsx("span",{className:"text-xs text-muted",children:n})]},i))}),l.jsx(UC,{projectName:e,to:"/projects/$projectName/settings",icon:_k,label:"Set a schedule",action:"set_schedule"})]})}function LW({projectName:e,score:n}){return l.jsxs(l.Fragment,{children:[l.jsx(ip,{id:"onb-alerts-heading",eyebrow:"Notifications",title:"Hear about changes.",children:"Get a webhook in Slack or anywhere else when a sweep finishes or a score moves."}),l.jsxs("div",{className:"relative mt-6 flex h-14 items-center","aria-hidden":"true",children:[l.jsx("span",{className:"onb-bell flex size-10 items-center justify-center rounded-full border border-default bg-bg-elevated",children:l.jsx(Wf,{className:"size-4 text-secondary"})}),l.jsxs("span",{className:"onb-toast ml-3 flex items-center gap-2 rounded-xl border border-default bg-bg-elevated px-3 py-2 text-sm shadow-[0_8px_24px_var(--color-shadow-panel)]",children:[l.jsx("span",{className:"size-2 rounded-full bg-positive-400"}),l.jsx("span",{className:"text-heading",children:e}),l.jsx("span",{className:"text-secondary",children:n===null?"sweep finished":`page health ${n}`})]})]}),l.jsx(UC,{projectName:e,to:"/projects/$projectName/settings",icon:Wf,label:"Add a notification",action:"add_notification"})]})}function UC({projectName:e,to:n,icon:i,label:r,action:u}){const h=C.useContext(ap);return l.jsxs(at,{to:n,params:{projectName:e},onClick:()=>h(u),className:"group mt-6 inline-flex items-center gap-2 self-start text-sm font-medium text-link",children:[l.jsx(i,{className:"size-4","aria-hidden":"true"}),r,l.jsx(Tc,{className:"size-3.5 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"})]})}const UW=C.lazy(async()=>({default:(await Qi(()=>import("./SiteHealthSection-Cn_IZVO1.js").then(n=>n.d),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).SiteHealthSection})),VW=`Public pages only, crawled from this computer and stored locally. The first scan reads up to ${T2} pages, then stops.`,$W=1800,KW="https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent",GW="Help me set up Canonry for my public site.\n\nUse the official Canonry docs:\n- Agent quickstart: https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent\n- CLI reference: https://github.com/Canonry/canonry/blob/main/skills/canonry/references/canonry-cli.md\n- Plugin setup: https://github.com/Canonry/canonry/blob/main/docs/plugins.md\n- MCP setup: https://github.com/Canonry/canonry/blob/main/docs/mcp.md\n\nPick one path and stay on it. Use connected Canonry tools (plugin or MCP) only if you have them and I have not pointed you at a specific install. A connected tool runs in its own process and never sees `CANONRY_CONFIG_DIR`, `CANONRY_PORT`, or anything else you export in a shell, so it always acts on my default install. If I named a config directory, a port, or a sandbox, that is the shell path: use `cnry` and tell me which path you chose. Never mix the two in one run, and never create a duplicate project. The `cnry` and `canonry` commands are interchangeable.\n\n1. Ask for my public domain, country, and language. Do not create or scan anything yet. Country and language are only applied when a project is created, so if you reuse an existing project, report its country and language instead of changing them.\n2. Shell path only: confirm `cnry` is on PATH, then run `cnry --version`. If Canonry is missing, propose `npm install -g @canonry/canonry` and wait for approval. Then run `cnry doctor --format json`, which is the command that says whether config, database, and server are in place. `cnry --version` does not read config and succeeds on a completely unconfigured install, so it cannot answer this. If config is missing, run `cnry bootstrap` yourself: it is not interactive, takes about a second, and is safe to rerun. Do not hand it to me and wait. The interactive command is `cnry init`, which is optional provider and OAuth setup that Page Health does not need. Bootstrap prints an API key, so do not repeat its output back to me, and never ask me to paste passwords, API keys, OAuth credentials, or command output.\n3. Confirm the API is reachable. `cnry doctor --format json` reports it, and any project read exits non-zero with `CONNECTION_ERROR` when it is not. If it is unreachable, propose `cnry start` and wait for approval. Use `cnry start`, which is the background daemon, and not `cnry serve`, which runs in the foreground and will block you until I stop it, even though some error messages suggest it. Stop anything you started with `cnry stop`.\n4. List projects with the connected project tool or `cnry project list --format json`, and reuse one whose domain matches. Confirm the proposed name is not already assigned to a different domain. To find out whether a project has already been scanned, run `cnry technical-aeo score <project> --format json` with no `--run-id`, which reports the latest run. Read the `hasData` field, not the score: this command exits 0 and reports `aggregateScore: 0` for a project that has never been scanned, so reading the score alone would have you tell me my site scored zero. If `hasData` is true and `runStatus` is `completed` or `partial`, read that scan instead of starting a new one. If no project matches, show the exact create operation and wait for approval.\n5. Propose a bounded Site Health scan: `--max-pages 100` for a first look, plus whether dead-link checking is on (it is off unless you pass `--check-dead-links`). Show the connected operation or the exact `cnry technical-aeo run <project> --max-pages 100 --wait --format json` command with the project name filled in, and wait for separate approval before scanning. `--wait` polls for up to 15 minutes and returns only the run id and status. If the status it returns is still `queued` or `running`, the scan has not finished: do not rerun it or report results, poll `cnry technical-aeo progress <project> --run-id <run-id> --format json` until it is terminal. If `--wait` outruns your own tool timeout first, recover the run id with `cnry technical-aeo score <project> --format json` and poll the same way.\n6. When the run is `completed` or `partial`, read `cnry technical-aeo crawl <project> --run-id <run-id> --format json` first. It is the only one of these commands that carries `termination` and `complete`; the score and pages commands do not. Then read `cnry technical-aeo score <project> --run-id <run-id> --format json` and `cnry technical-aeo pages <project> --run-id <run-id> --sort score-asc --limit 10 --format jsonl`. Tell me the termination reason in plain words and whether the scan covered the whole site or stopped at a page, link, depth, or time limit. A `partial` run scored the pages it reached and not my site, so never present it as a full-site result. If it stopped early, the fix depends on the reason, so say which: a page or depth limit needs a larger budget, a time limit needs a smaller scan (a lower `--max-pages` or `--max-depth`). If the run failed or was cancelled, inspect the run error and stop.\n7. Summarize only completed evidence, then propose AI Visibility setup. Ask before you add queries, connect providers, start a provider-backed or quota-consuming run, edit files, or publish.";function HW(e,n){return e==="legacy"?"legacy":e==="platform"?"platform":n.state==="success"?n.projectCount===0?"platform":"legacy":n.state==="error"?"retry":"loading"}const QW="2000-01-01T00:00:00.000Z",FW=5e3;function ZW(e,n){const i=new Set,r=new Map;for(const f of n)f.trigger!==$a.probe&&(r.has(f.projectId)||r.set(f.projectId,f.id),(f.status===Nt.completed||f.status===Nt.partial)&&i.add(f.projectId));const h=(e.every(f=>f.createdAt)?[...e].sort((f,b)=>(f.createdAt??"").localeCompare(b.createdAt??"")||f.name.localeCompare(b.name)):e).find(f=>!i.has(f.id));return h?{projectName:h.name,runId:r.get(h.id)}:null}const VC=[{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"}],$C=[{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 YW(e,n){try{const i=new Intl.DisplayNames(["en"],{type:"region"}),r=new Intl.DisplayNames(["en"],{type:"language"}),u=e.length===2?i.of(e.toUpperCase()):void 0,h=n?r.of(n.toLowerCase()):void 0;return`${u??(e||"Country")} · ${h??(n||"Language")}`}catch{return`${e||"Country"} · ${n||"Language"}`}}function XW(e,n){const i=e.trim().toUpperCase(),r=n.trim().toLowerCase();return{countryValid:VC.some(u=>u.value===i),languageValid:$C.some(u=>u.value===r)}}function JW(e){const n=e.replace(/^\[|\]$/g,"");return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(n)||n.includes(":")}function WW(e){const n=e.trim();if(!n)return null;const i=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`https://${n}`;let r;try{r=new URL(i)}catch{return null}if(r.protocol!=="http:"&&r.protocol!=="https:")return null;const u=r.hostname.toLowerCase().replace(/^www\./,"");if(!u||u==="localhost"||JW(u)||!u.includes("."))return null;const h=u.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return h?{canonicalDomain:u,projectName:h,displayName:u}:null}async function eee(e,n=$W){let i;const r=new Promise(h=>{i=setTimeout(()=>h({state:"timed-out"}),n)}),u=await Promise.race([e.then(h=>({state:"queued",run:h})),r]);return i&&clearTimeout(i),u}function tee(e,n){e.catch(()=>{bn({title:"Site Health scan did not start",detail:"The project is safe. Choose Run scan in Site Health to retry.",tone:"negative",dedupeKey:`site-health-dispatch:${n}`})})}function KC(e){const n=C.useRef(w1()).current,i=C.useRef(new Set),r=C.useCallback((u,h)=>{if(h){if(i.current.has(h))return;i.current.add(h)}N1({...u,surface:e,eventId:S1()})},[e]);return{onboardingSessionId:n,emit:r}}function mk(e,n){return e instanceof gn&&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:n}function $g(){return l.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Preparing setup"}),l.jsx("p",{className:"page-subtitle",children:"Checking the projects already on this install."})]})}),l.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-default bg-surface p-4 text-sm text-secondary",role:"status",children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading projects…"]})]})}function nee({onRetry:e}){return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Can’t load projects"}),l.jsx("p",{className:"page-subtitle",children:"Canonry could not confirm whether this install already has a project."})]})}),l.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[l.jsx("p",{className:"text-sm font-medium text-heading",children:"Setup is paused to protect existing projects."}),l.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),l.jsx(le,{type:"button",className:"mt-4",variant:"secondary",onClick:e,children:"Retry project check"})]})]})}function aee({projectName:e,initialRunId:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(iee,{projectName:e,initialRunId:n})})}function iee({projectName:e,initialRunId:n}){const i=zs(),r=yt({...Bo({client:J}),enabled:!!e,retry:!1,refetchOnMount:"always"}),{onboardingSessionId:u,emit:h}=KC("site_health"),[f]=C.useState(()=>bG(n));C.useEffect(()=>{f&&vG()},[f]),C.useEffect(()=>{e&&h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.started",step:"run",resumed:!!n&&!f},"onboarding.started")},[h,f,n,u,e]),C.useEffect(()=>{!e||!n||DN(e)?.runId!==n&&RN(e,n)},[n,e]);const v=yt({...T1({client:J,path:{id:n??""}}),enabled:!!n,refetchInterval:({state:T})=>{const z=T.data?.status;return z==="completed"||z==="partial"||z==="failed"||z==="cancelled"?!1:2e3},refetchIntervalInBackground:!0}).data?.status;if(C.useEffect(()=>{if(!e||!n||!v)return;if(v==="completed"||v==="partial"){h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"automatic"},"onboarding.step_completed:run"),om(n);return}if(v!=="failed"&&v!=="cancelled")return;const T=v==="cancelled"?"run_cancelled":"run_failed";h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:T},`onboarding.blocked:run:${T}`),om(n)},[h,n,u,e,v]),!e)return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Project not found"}),l.jsx("p",{className:"page-subtitle",children:"This setup link does not identify a project."})]})}),l.jsx(le,{type:"button",variant:"secondary",onClick:()=>{i({to:"/projects"})},children:"View projects"})]});if(r.isPending)return l.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[l.jsx(Ro,{current:"site"}),l.jsxs("div",{className:"mt-8 flex items-center gap-3 text-sm text-secondary",role:"status",children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health setup…"]})]});if(r.isError)return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Can’t resume setup"}),l.jsx("p",{className:"page-subtitle",children:"Canonry could not load the project for this Site Health scan."})]})}),l.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",children:[l.jsx("p",{className:"text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),l.jsx(le,{type:"button",className:"mt-4",variant:"secondary",onClick:()=>{r.refetch()},children:"Retry project check"})]})]});const x=r.data.find(T=>T.name===e);if(!x)return l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx("div",{className:"page-header",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Project not found"}),l.jsxs("p",{className:"page-subtitle",children:["Canonry could not find ",e,". It will not open a different project."]})]})}),l.jsx(le,{type:"button",variant:"secondary",onClick:()=>{i({to:"/projects"})},children:"View projects"})]});const S=()=>{i({to:"/setup",search:{onboarding:"site-health",setupProject:x.name},replace:!0})},k=()=>{i({to:"/setup",search:{experience:"legacy",onboarding:"site-health",setupProject:x.name},replace:!0})},N=()=>{h({flowVersion:ft,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"skipped"},"onboarding.step_completed:run"),i({to:"/setup",search:{onboarding:"complete",setupProject:x.name,skipped:"visibility"},replace:!0})};return l.jsxs("div",{className:"page-container max-w-7xl py-8 md:py-10",children:[l.jsx("h1",{className:"sr-only",children:"Set up Canonry"}),l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"space-y-5",children:[l.jsx(Ro,{current:"site"}),l.jsxs("div",{className:"flex min-h-72 items-center justify-center gap-3 text-sm text-secondary",role:"status",children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health…"]})]}),children:l.jsx(UW,{projectName:x.name,projectId:x.id,initialRunId:n,onReleaseInitialRun:S,showOnboardingActions:!0,onContinueOnboarding:k,onSkipOnboarding:N})})]})}function see(){const e=fk({from:"/setup"}),n=e.onboarding==="site-health"&&!e.setupProject,i=e.onboarding==="site-health"&&e.experience!=="legacy",r=HG(),u=e.experience==="legacy"?"legacy":e.experience==="platform"?"platform":r,[h,f]=C.useState(!1),[b,v]=C.useState(void 0),x=yt({...Bo({client:J}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),S=yt({...qc({client:J,query:{kind:Oe["site-audit"],since:QW,limit:FW}}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),k=u==="auto"&&x.isSuccess&&x.isFetchedAfterMount&&x.data.length===0;C.useEffect(()=>{k&&f(!0)},[k]);const N=u!=="auto"?{state:"idle"}:x.isSuccess&&x.isFetchedAfterMount?{state:"success",projectCount:x.data.length}:x.isError?{state:"error"}:{state:"loading"},T=u==="legacy"?"legacy":h||k?"platform":HW(u,N);if(e.onboarding==="complete"&&e.setupProject)return l.jsx(_W,{projectName:e.setupProject,skippedVisibility:e.skipped==="visibility"});if(n||i)return l.jsx(aee,{projectName:e.setupProject,initialRunId:e.siteHealthRunId});const z=u==="auto"&&T==="legacy"&&!e.setupProject&&x.isSuccess;if(z&&b===void 0)return S.isError?v(null):S.isSuccess&&S.isFetchedAfterMount&&v(ZW(x.data,S.data)),l.jsx($g,{});const q=z?b:null;return q?l.jsx(oee,{projectName:q.projectName,runId:q.runId}):T==="legacy"?l.jsx(jW,{visibilityProjectName:e.setupProject,siteHealthOnboarding:e.onboarding==="site-health",onboardingFinish:e.onboarding==="site-health"||e.onboarding==="first-run"}):T==="loading"?l.jsx($g,{}):T==="retry"?l.jsx(nee,{onRetry:()=>{x.refetch()}}):l.jsx(ree,{onActivationStarted:()=>f(!0),skipSiteScan:e.siteScan==="skip"})}function oee({projectName:e,runId:n}){const i=zs();return C.useEffect(()=>{i({to:"/setup",search:{onboarding:"site-health",setupProject:e,...n?{siteHealthRunId:n}:{}},replace:!0})},[i,e,n]),l.jsx($g,{})}function ree({onActivationStarted:e,skipSiteScan:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(lee,{onActivationStarted:e,skipSiteScan:n})})}function lee({onActivationStarted:e,skipSiteScan:n}){const i=zs(),r=Ds(),u=pW(),h=yt({...XQ({client:J}),retry:!1}),f=oi(JQ()),[b,v]=C.useState(""),[x,S]=C.useState(""),[k,N]=C.useState(""),[T,z]=C.useState("US"),[q,E]=C.useState("en"),[P,M]=C.useState(!1),[L,$]=C.useState("idle"),[F,ae]=C.useState(null),[V,Z]=C.useState(null),[X,Ce]=C.useState(!1),[tt,Ke]=C.useState(null),[Ue,ke]=C.useState(!1),Le=h.isError?void 0:h.data,B=typeof Le?.enabled=="boolean"?Le.enabled:null,W=f.isPending?f.variables.body.enabled:B,[ve,Ae]=C.useState(null),se=C.useRef(null),{onboardingSessionId:Se,emit:Me}=KC("platform");C.useEffect(()=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.started",step:"project",resumed:!1},"onboarding.started")},[Me,Se]);const xe=WW(b),pe=x||xe?.projectName||"",ce=k||xe?.displayName||"",ue=L==="creating"||L==="dispatching",_e=V??tt,Fe=YW(T,q),{countryValid:Ee,languageValid:Ct}=XW(T,q),me=Ee&&Ct;C.useEffect(()=>{_e&&se.current?.focus()},[_e]);const Be=(Ve,ct)=>i({to:"/setup",search:{...ct?{siteHealthRunId:ct}:{},onboarding:"site-health",setupProject:Ve.name},replace:!0}),Ne=async Ve=>{$("dispatching"),Ke(null);try{const ct=u.mutateAsync({projectName:Ve.name,projectId:Ve.id,projectLabel:Ve.displayName||Ve.name,suppressErrorToast:!0,body:{checkDeadLinks:!0,maxPages:T2}}),Qt=await eee(ct);if(Qt.state==="queued"){Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"}),yG(Qt.run.runId),await Be(Ve,Qt.run.runId);return}ct.then(()=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"})},Ft=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Ac(Ft,"run_rejected")})}),tee(ct,Ve.id),await Be(Ve)}catch(ct){$("recovery"),Ke(mk(ct,"The project was created, but the Site Health scan could not be started."));const Qt=Ac(ct,"run_rejected");Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Qt}),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:Qt},`onboarding.blocked:run:${Qt}`)}},re=async Ve=>{if(Ve.preventDefault(),!(!xe||!n&&!P||!me||ue)){$("creating"),Z(null),Ce(!1),Ke(null);try{const ct=await mH({name:pe,displayName:ce,canonicalDomain:xe.canonicalDomain,country:T,language:q});if(e(),ae(ct),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.step_completed",step:"project",method:"manual"},"onboarding.step_completed:project"),await r.invalidateQueries({queryKey:$r({client:J})}),n){await i({to:"/setup",search:{experience:"legacy",onboarding:"first-run",setupProject:ct.name},replace:!0});return}await Ne(ct)}catch(ct){$("idle");const Qt=ct instanceof gn&&ct.statusCode===409;Ce(Qt),Z(mk(ct,"Could not create the project. Try again.")),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.blocked",step:"project",action:"save",reasonCode:Ac(ct,"project_create_failed")},"onboarding.blocked:project"),Qt&&(e(),r.invalidateQueries({queryKey:$r({client:J})}))}}},Ze=()=>{F&&!ue&&Ne(F)},bt=()=>{ue||i({to:"/projects"})},qn=async()=>{try{await navigator.clipboard.writeText(GW),ke(!0)}catch{bn({tone:"negative",title:"Could not copy setup request",detail:"Open the agent quickstart to continue with the CLI instead."})}},Ht=async Ve=>{Ae(null);try{const ct=await f.mutateAsync({client:J,body:{enabled:Ve}});r.setQueryData(WN({client:J}),ct),ct.enabled!==Ve&&Ae(`The server kept telemetry ${ct.enabled?"on":"off"}. Check its telemetry settings.`)}catch{Ae("Could not update telemetry. Try again.")}};return F&&L==="recovery"?l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx(Ro,{current:"site"}),l.jsx("div",{className:"page-header mt-8",children:l.jsxs("div",{className:"page-header-left",children:[l.jsx("h1",{className:"page-title",children:"Project created"}),l.jsxs("p",{className:"page-subtitle",children:[F.displayName||F.name," is ready. The Site Health scan needs another try."]})]})}),l.jsxs("div",{ref:se,className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[l.jsx("p",{className:"text-sm font-medium text-heading",children:tt}),l.jsx("p",{className:"mt-1 text-sm text-secondary",children:"You can retry the scan or continue setup and retry from Site Health."}),l.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[l.jsx(le,{type:"button",onClick:Ze,children:"Retry Site Health scan"}),l.jsx(le,{type:"button",variant:"secondary",onClick:()=>{Be(F)},children:"Continue setup"})]})]})]}):l.jsxs("div",{className:"page-container max-w-xl py-8 md:py-12",children:[n?null:l.jsx(Ro,{current:"site"}),l.jsxs("header",{className:`mb-8 ${n?"":"mt-8"}`,children:[l.jsx("h1",{id:"site-map-setup-title",className:"text-2xl font-semibold tracking-[-0.025em] text-heading",children:n?"Create a project":"Scan your site"}),l.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-secondary",children:n?"Add a public domain, then choose the queries you want to track. No site scan will run.":"Enter your public website to see its pages, structure, internal links, and technical SEO scores."})]}),l.jsxs("form",{"aria-labelledby":"site-map-setup-title",className:"space-y-6",onSubmit:fn(re),noValidate:!0,children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm font-medium text-heading",htmlFor:"launchpad-domain",children:"Website URL"}),l.jsx("input",{id:"launchpad-domain",className:"h-11 w-full rounded-md border border-strong bg-bg-elevated/50 px-3 text-base text-heading outline-none transition placeholder:text-muted focus:border-mono-500 focus:ring-1 focus:ring-mono-500",type:"text",inputMode:"url",autoComplete:"url",autoCapitalize:"none",spellCheck:!1,required:!0,"aria-invalid":!!(b&&!xe),"aria-describedby":b&&!xe?"launchpad-domain-hint launchpad-domain-error":"launchpad-domain-hint",placeholder:"https://example.com",value:b,onChange:Ve=>{v(Ve.target.value),Z(null),Ce(!1)}}),l.jsx("p",{id:"launchpad-domain-hint",className:"text-sm text-secondary",children:n?l.jsxs(l.Fragment,{children:["A public domain is still required."," ",l.jsx(at,{to:"/setup",search:{experience:"platform"},className:"font-medium text-link underline-offset-4 hover:underline",children:"Map with Site Health instead"})]}):l.jsxs(l.Fragment,{children:["Only public pages are scanned."," ",l.jsx(at,{to:"/setup",search:{experience:"platform",onboarding:"first-run",siteScan:"skip"},className:"font-medium text-link underline-offset-4 hover:underline",children:"Set up without a site scan"})]})}),b&&!xe?l.jsx("p",{id:"launchpad-domain-error",className:"text-sm text-negative",role:"alert",children:"Enter a public domain, such as example.com."}):null]}),l.jsxs("details",{className:"group border-y border-default",children:[l.jsxs("summary",{className:"flex min-h-11 cursor-pointer list-none items-center justify-between gap-4 py-3 text-sm [&::-webkit-details-marker]:hidden",children:[l.jsx("span",{className:"font-medium text-heading",children:"Project name and locale"}),l.jsxs("span",{className:"flex items-center gap-2 text-secondary",children:[Fe,l.jsx(Lc,{className:"size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none","aria-hidden":"true"})]})]}),l.jsxs("div",{className:"space-y-5 border-t border-default py-4",children:[xe?l.jsxs("div",{children:[l.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Project"}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-project-name",children:"Project name"}),l.jsx("input",{id:"launchpad-project-name",className:"setup-input h-10",type:"text",value:pe,onChange:Ve=>S(Ve.target.value)})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-display-name",children:"Display name"}),l.jsx("input",{id:"launchpad-display-name",className:"setup-input h-10",type:"text",value:ce,onChange:Ve=>N(Ve.target.value)})]})]})]}):null,l.jsxs("div",{children:[l.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Locale"}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-country",children:"Country"}),l.jsx("select",{id:"launchpad-country",className:"setup-input h-10",value:T,onChange:Ve=>z(Ve.target.value),children:VC.map(Ve=>l.jsx("option",{value:Ve.value,children:Ve.label},Ve.value))})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-language",children:"Language"}),l.jsx("select",{id:"launchpad-language",className:"setup-input h-10",value:q,onChange:Ve=>E(Ve.target.value),children:$C.map(Ve=>l.jsx("option",{value:Ve.value,children:Ve.label},Ve.value))})]})]})]})]})]}),n?null:l.jsxs("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 py-2",children:[l.jsx("input",{className:"mt-0.5 size-4 shrink-0 rounded border-strong bg-bg",type:"checkbox",checked:P,onChange:Ve=>M(Ve.target.checked),"aria-label":"Allow Canonry to scan this public site."}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-sm leading-5 text-heading",children:"Allow Canonry to scan this public site."}),l.jsx(ua,{text:VW})]})]}),_e?l.jsxs("div",{ref:se,className:"rounded-md border border-negative bg-negative-soft p-3",role:"alert",tabIndex:-1,children:[l.jsx("p",{className:"text-sm font-medium text-heading",children:_e}),X?l.jsx(le,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:bt,children:"View projects"}):null]}):null,l.jsxs("div",{className:"grid gap-2",children:[l.jsx(le,{className:"h-11 w-full",type:"submit",disabled:!xe||!n&&!P||!me||ue,children:L==="creating"||L==="dispatching"?l.jsxs(l.Fragment,{children:[l.jsx(Ts,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"})," ",n?"Creating project…":"Mapping site…"]}):n?"Create project":"Scan site"}),L==="dispatching"?l.jsx("span",{className:"text-center text-sm text-secondary",role:"status",children:"Opening Site Health when the scan is ready."}):null]})]}),l.jsxs("section",{className:"mt-8 border-t border-default pt-6","aria-labelledby":"agent-setup-title",children:[l.jsx("p",{id:"agent-setup-title",className:"text-sm font-medium text-heading",children:"Use your agent instead"}),l.jsx("p",{className:"mt-1 text-sm leading-5 text-secondary",children:"Copy a complete CLI setup request into any agent."}),l.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[l.jsxs(le,{type:"button",variant:"ghost",size:"sm",className:"-ml-3",onClick:fn(qn),children:[Ue?l.jsx(Uc,{className:"size-3.5","aria-hidden":"true"}):l.jsx(Zg,{className:"size-3.5","aria-hidden":"true"}),l.jsx("span",{"aria-live":"polite",children:Ue?"Copied setup request":"Copy setup request"})]}),l.jsx(le,{asChild:!0,variant:"ghost",size:"sm",children:l.jsxs("a",{href:KW,target:"_blank",rel:"noopener noreferrer",children:["Agent quickstart",l.jsx(k6,{className:"size-3.5","aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})})]})]}),B!==null?l.jsxs("section",{className:"mt-6 border-t border-default pt-5","aria-labelledby":"telemetry-title",children:[l.jsxs("label",{className:`flex min-h-11 items-start gap-3 py-2 ${f.isPending?"cursor-wait":"cursor-pointer"}`,children:[l.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:W??!1,disabled:f.isPending,onChange:Ve=>{Ht(Ve.target.checked)},"aria-describedby":"telemetry-detail"}),l.jsxs("span",{className:"grid gap-0.5",children:[l.jsx("span",{id:"telemetry-title",className:"text-sm leading-5 text-heading",children:"Share anonymous product telemetry"}),l.jsx("span",{id:"telemetry-detail",className:"max-w-[70ch] text-sm leading-5 text-secondary",children:"Helps prioritize improvements. Canonry does not send raw domains, URLs, queries, answer content, or credentials."})]})]}),f.isPending?l.jsx("p",{className:"mt-1 text-sm text-secondary",role:"status",children:"Saving preference…"}):null,ve?l.jsx("p",{className:"mt-1 text-sm text-negative",role:"alert",children:ve}):null]}):null]})}function cee(){return l.jsx("div",{className:"page-container",children:l.jsx("section",{className:"page-section",children:l.jsxs(_a,{className:"surface-card empty-card",children:[l.jsx("h1",{children:"Route not found"}),l.jsx("p",{children:"The current path does not map to a dashboard view."}),l.jsx(le,{asChild:!0,children:l.jsx(at,{to:"/",children:"Return to overview"})})]})})})}const Ia=Is(()=>Qi(()=>import("./ProjectPage-C4FaBoWI.js"),__vite__mapDeps([5,1,0,2,3,4,6,7,8,9,10,11,12]),import.meta.url),"ProjectPage"),uee=Is(()=>Qi(()=>import("./RunsPage-D-3XKUhh.js"),__vite__mapDeps([13,1,11,4,2,7,12]),import.meta.url),"RunsPage"),dee=Is(()=>Qi(()=>import("./HistoryPage-C5taVW3t.js"),__vite__mapDeps([14,1,10,11,4,2,7,12]),import.meta.url),"HistoryPage"),mee=Is(()=>Qi(()=>import("./SettingsPage-Cq_SJRj_.js"),__vite__mapDeps([15,1,11,4,2,7,12]),import.meta.url),"SettingsPage"),pee=Is(()=>Qi(()=>import("./BacklinksPage-CRDPutGA.js"),__vite__mapDeps([16,1,9,2,11,4,7,12]),import.meta.url),"BacklinksPage"),hee=Is(()=>Qi(()=>import("./TrafficPage-BMdFZs3X.js"),__vite__mapDeps([17,1,8,2,11,4,7,12]),import.meta.url),"TrafficPage"),fee=Is(()=>Qi(()=>import("./TrafficSourceDetailPage-BmrIOc-2.js"),__vite__mapDeps([18,1,8,3,4,2,11,7,12]),import.meta.url),"TrafficSourceDetailPage"),gee=Is(()=>Qi(()=>import("./MeasurementPropertyPage-txucmLuz.js"),__vite__mapDeps([19,1,3,4,6,7,2,11,12]),import.meta.url),"MeasurementPropertyPage");function yee(){return l.jsx(wJ,{children:l.jsx(iQ,{children:l.jsx(xJ,{})})})}const Un=t6()({component:yee,validateSearch:e=>({manageQueries:e.manageQueries===!0||e.manageQueries==="true"?!0:void 0,runId:typeof e.runId=="string"?e.runId:void 0,siteHealthRunId:typeof e.siteHealthRunId=="string"?e.siteHealthRunId: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"?"skip":void 0,skipped:e.skipped==="visibility"?"visibility":void 0,setupProject:typeof e.setupProject=="string"?e.setupProject: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"].map(n=>[n,typeof e[n]=="string"?e[n]:void 0]))})}),bee=Bt({getParentRoute:()=>Un,path:"/",component:nW,beforeLoad:async({context:e})=>{let n=e.queryClient.getQueryData($r({client:J}));if(n===void 0)try{n=await e.queryClient.ensureQueryData(Bo({client:J}))}catch{return}if(n.length===0)throw Kg({to:"/setup"})}}),vee=Bt({getParentRoute:()=>Un,path:"/projects",component:oW}),xee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Vn=Bt({getParentRoute:()=>Un,path:"/projects/$projectName",component:()=>l.jsx(Xf,{}),beforeLoad:async({context:e,params:n,location:i})=>{const r=n.projectName;if(!xee.test(r))return;let u=e.queryClient.getQueryData($r({client:J}));if(!u)try{u=await e.queryClient.ensureQueryData(Bo({client:J}))}catch{return}const h=u.find(f=>f.id===r);if(h)throw Kg({to:i.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(h.name)}`),replace:!0})}}),wee=Bt({getParentRoute:()=>Vn,path:"/",component:()=>l.jsx(Ia,{tab:"overview"})}),See=Bt({getParentRoute:()=>Vn,path:"/portfolio",component:()=>l.jsx(Ia,{tab:"portfolio"})}),kee=Bt({getParentRoute:()=>Vn,path:"/search-console",component:()=>l.jsx(Ia,{tab:"search-console"})}),jee=Bt({getParentRoute:()=>Vn,path:"/conversions",component:()=>l.jsx(Ia,{tab:"conversions"})}),Aee=Bt({getParentRoute:()=>Vn,path:"/local",component:()=>l.jsx(Ia,{tab:"local"})}),Nee=Bt({getParentRoute:()=>Vn,path:"/discovery",component:()=>l.jsx(Ia,{tab:"discovery"})}),Cee=Bt({getParentRoute:()=>Vn,path:"/queries",component:()=>l.jsx(Ia,{tab:"queries"})}),_ee=Bt({getParentRoute:()=>Vn,path:"/properties/$targetKey",component:()=>l.jsx(gee,{})}),Tee=Bt({getParentRoute:()=>Vn,path:"/report",beforeLoad:({params:e})=>{throw Kg({to:"/projects/$projectName",params:e,replace:!0})}}),Eee=Bt({getParentRoute:()=>Vn,path:"/activity",component:()=>l.jsx(Ia,{tab:"activity"})}),Ree=Bt({getParentRoute:()=>Vn,path:"/backlinks",component:()=>l.jsx(Ia,{tab:"backlinks"})}),Dee=Bt({getParentRoute:()=>Vn,path:"/technical-aeo",component:()=>l.jsx(Ia,{tab:"technical-aeo"})}),zee=Bt({getParentRoute:()=>Vn,path:"/history",component:()=>l.jsx(Ia,{tab:"history"})}),Iee=Bt({getParentRoute:()=>Vn,path:"/settings",component:()=>l.jsx(Ia,{tab:"settings"})}),Oee=Bt({getParentRoute:()=>Un,path:"/runs",component:uee}),Pee=Bt({getParentRoute:()=>Un,path:"/history",component:dee}),qee=Bt({getParentRoute:()=>Un,path:"/settings",component:mee,beforeLoad:({context:e})=>{}}),Mee=Bt({getParentRoute:()=>Un,path:"/setup",component:see}),Bee=Bt({getParentRoute:()=>Un,path:"/backlinks",component:pee}),Lee=Bt({getParentRoute:()=>Un,path:"/traffic",component:hee}),Uee=Bt({getParentRoute:()=>Un,path:"/traffic/$projectName/$sourceId",component:fee}),Vee=Bt({getParentRoute:()=>Un,path:"*",component:cee}),$ee=Un.addChildren([bee,vee,Vn.addChildren([wee,See,kee,jee,Aee,Nee,Cee,_ee,Tee,Eee,Ree,Dee,zee,Iee]),Oee,Pee,qee,Mee,Bee,Lee,Uee,Vee]);function Kee(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const pk=Kee(),Gee=pk==="/"?"":pk.replace(/\/$/,"");function Hee(e,n){return n6({routeTree:$ee,basepath:Gee||"/",context:{queryClient:e},...n?.initialEntries})}let hk=!1;async function Qee(e){return(await lT({client:J,body:e,keepalive:!0})).data}function Fee(){hk||typeof window>"u"||(hk=!0,!(Gm()||jo())&&(NG({send:Qee}),J.interceptors.request.use((e,n)=>{const i=n.fetch??globalThis.fetch,r=typeof n.url=="string"?n.url:void 0;return n.fetch=async(u,h)=>{try{return await i(u,h)}catch(f){throw f instanceof DOMException&&f.name==="AbortError"||cm({method:e.method,route:r,network:!0}),f}},e}),J.interceptors.response.use((e,n,i)=>(cm({method:n.method,route:typeof i.url=="string"?i.url:void 0,path:Yee(n.url),status:e.status}),e)),window.addEventListener("error",e=>{lm({kind:"unhandled",error:e.error})}),window.addEventListener("unhandledrejection",e=>{lm({kind:"unhandled",error:e.reason})}),tte()))}function Zee(e){let n=null;const i=()=>{const r=e.state.matches.at(-1);if(!r)return;CG(r.fullPath);const u=e.state.location;if(!u)return;const h=u.search&&typeof u.search=="object"?u.search:{};n&&n.pathname===u.pathname&&DG(n.search,h),n={pathname:u.pathname,search:h}};return i(),e.subscribe("onResolved",i)}function Yee(e){try{return new URL(e,window.location.origin).pathname}catch{return}}const Xee={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function Jee(e,n){const[i,r]=Xee[e];return n<=i?"good":n<=r?"needs-improvement":"poor"}function Wee(){let e=0,n=0,i=-1/0,r=-1/0;return{add(u){u.hadRecentInput||(u.startTime-r<1e3&&u.startTime-i<5e3?n+=u.value:(n=u.value,i=u.startTime),r=u.startTime,e=Math.max(e,n))},value:()=>e}}function ete(){let e=0;return{add(n){n.interactionId&&(e=Math.max(e,n.duration))},value:()=>e}}function tte(){if(typeof PerformanceObserver>"u")return;const e=new Set,n=(b,v)=>{e.has(b)||!Number.isFinite(v)||(e.add(b),IG(b,Jee(b,v)))},i=(b,v,x={})=>{try{new PerformanceObserver(S=>v(S.getEntries())).observe({type:b,buffered:!0,...x})}catch{}};try{const b=performance.getEntriesByType("navigation")[0];b&&b.responseStart>0&&n("TTFB",b.responseStart)}catch{}i("paint",b=>{const v=b.find(x=>x.name==="first-contentful-paint");v&&n("FCP",v.startTime)});let r=0;i("largest-contentful-paint",b=>{const v=b.at(-1);v&&(r=v.startTime)});const u=Wee();i("layout-shift",b=>{for(const v of b)u.add({startTime:v.startTime,value:v.value??0,hadRecentInput:v.hadRecentInput===!0})});const h=ete();i("event",b=>{for(const v of b)h.add(v)},{durationThreshold:40});const f=()=>{r>0&&n("LCP",r),n("CLS",u.value()),h.value()>0&&n("INP",h.value())};document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&f()}),window.addEventListener("pagehide",f)}const nte=6e4,ate="Anyone with this password can sign in to this dashboard.",_r={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"};function ite(){const e=C.useRef(cH()).current,[n,i]=C.useState(e?"ready":"checking"),[r,u]=C.useState(null),[h,f]=C.useState(null),[b,v]=C.useState(e),[x,S]=C.useState(!1),[k,N]=C.useState(""),[T,z]=C.useState(""),[q,E]=C.useState(""),[P,M]=C.useState(!1),[L,$]=C.useState("password"),[F,ae]=C.useState(!1),[V,Z]=C.useState(""),[X,Ce]=C.useState(null),[tt,Ke]=C.useState(!1),[Ue,ke]=C.useState(!1),Le=C.useRef(null),B=C.useRef(null),W=C.useRef(null),ve=()=>{const me=r?`${r.name}:${r.role}`:e?"api-key:explicit":h?`api-key:${h.id}`:"no-accounts";if(!Le.current||W.current!==me){B.current?.clear();const Be=tQ();B.current=Be,Le.current=Hee(Be),Zee(Le.current),W.current=me}return{queryClient:B.current,router:Le.current}},Ae=me=>me.authRequired?(S(!0),u(me.user),f(null),v(!1),i(me.user?"ready":"account-login"),!0):!1;C.useEffect(()=>{let me=!1;const Be=async(Ne,re=!1)=>{try{const Ze=await Uf();if(me)return;f(Ze),v(!1),i("ready")}catch(Ze){if(me)return;if(re&&Ze instanceof gn&&Ze.statusCode===401)return xH().then(()=>{me||(Ce(null),f(null),v(!1),ke(!0),i("login"))}).catch(bt=>{me||(Ce(bt instanceof Error?bt.message:"Could not clear the invalid session"),i(Ne))});Ce(Ze instanceof Error?Ze.message:"Could not verify API key access"),i(Ne)}};return e?(Be("api-key-error"),()=>{me=!0}):(Promise.allSettled([hS(),pS()]).then(([Ne,re])=>{if(me||Ne.status==="fulfilled"&&Ae(Ne.value))return;if(re.status==="rejected"){const bt=re.reason;Ce(bt instanceof Error?bt.message:"Failed to reach the Canonry API"),i("login");return}const Ze=re.value;Ze.authenticated?(v(!0),Be("api-key-error",!0)):(f(null),v(!1),i(Ze.setupRequired?"setup":"login"))}),()=>{me=!0})},[]),C.useEffect(()=>{if(n!=="ready"||e)return;const me=setInterval(()=>{if(x){hS().then(Be=>{Be.authRequired&&!Be.user&&(ke(!0),u(null),f(null),i("account-login"))}).catch(()=>{});return}pS().then(Be=>{Be.authenticated||(ke(!0),f(null),i(Be.setupRequired?"setup":"login"))}).catch(()=>{})},nte);return mS(()=>{ke(!0),u(null),f(null),v(!1),i(x?"account-login":"login")}),()=>{clearInterval(me),mS(null)}},[n,x,e]);const se=async me=>{if(me.preventDefault(),!T.trim()||T.trim().length<8){Ce("Password must be at least 8 characters");return}if(T!==q){Ce("Passwords do not match");return}const Be=V.trim();if(F&&!Be){Ce(_r.missing);return}Ke(!0),Ce(null);try{if(!(await yH(T.trim(),F?Be:void 0)).authenticated){Ce("Setup failed");return}z(""),E(""),Z(""),ae(!1),M(!1),ke(!1),f(null),v(!0),i("checking");try{const re=await Uf();f(re),v(!1),i("ready")}catch(re){Ce(re instanceof Error?re.message:"Could not verify API key access"),i("api-key-error")}}catch(Ne){if(Ne instanceof gn&&Ne.statusCode===401&&Ne.code==="AUTH_REQUIRED"){Ce(F?_r.rejected:null),ae(!0);return}Ce(Ne instanceof gn||Ne instanceof Error?Ne.message:"Setup failed")}finally{Ke(!1)}},Se=me=>{z(me),Ce(null)},Me=me=>{Z(me),Ce(null)},xe=me=>{E(me),Ce(null)},pe=async me=>{if(me.preventDefault(),!!T.trim()){Ke(!0),Ce(null);try{if(!(L==="api-key"?await vH(T.trim()):await bH(T.trim())).authenticated){Ce(L==="api-key"?"Invalid API key":"Incorrect password");return}const Ne=await Uf();f(Ne),v(!1),z(""),M(!1),ke(!1),i("ready")}catch(Be){Ce(Be instanceof gn||Be instanceof Error?Be.message:"Authentication failed")}finally{Ke(!1)}}},ce=me=>{$(me),z(""),M(!1),Ce(null)},ue=async me=>{if(me.preventDefault(),!(!k.trim()||!T)){Ke(!0),Ce(null);try{const Be=await wH(k.trim(),T);if(!Be.user){Ce("Incorrect name or password.");return}z(""),ke(!1),u(Be.user),f(null),v(!1),i("ready")}catch(Be){Ce(Be instanceof gn?Be.message:"Incorrect name or password.")}finally{Ke(!1)}}};if(n==="ready"){const{queryClient:me,router:Be}=ve();return l.jsx($H,{account:r,apiKey:h,apiKeyPending:b,children:l.jsx(a6,{client:me,children:l.jsx(i6,{router:Be})})})}const _e=T.trim(),Fe=T.length>0&&_e.length<8,Ee=q.length>0&&T!==q,Ct=_e.length>=8&&T===q&&(!F||V.trim().length>0);return l.jsx("div",{className:"min-h-screen bg-bg px-4 py-8",children:l.jsxs("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5",children:[l.jsxs("div",{"data-testid":"auth-brand",className:"flex items-center gap-2.5",children:[l.jsx("img",{className:"size-7",src:"./favicon.svg",alt:"","aria-hidden":"true"}),l.jsx("span",{className:"text-lg font-semibold tracking-tight text-heading",children:"Canonry"})]}),l.jsx(_a,{className:"surface-card w-full",children:n==="checking"?l.jsx(vo,{className:"py-8",children:l.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):n==="api-key-error"?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Could not verify API key access"})]}),l.jsxs(vo,{className:"space-y-4",children:[l.jsx("p",{className:"supporting-copy",children:X??"Canonry could not verify this session’s access, so the dashboard stayed locked."}),l.jsx(le,{type:"button",className:"w-full",onClick:()=>{window.location.reload()},children:"Try again"})]})]}):n==="account-login"?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"})]}),l.jsxs(vo,{children:[Ue?l.jsx("p",{className:"mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-sm text-caution",children:"You were signed out — please sign in again."}):null,l.jsxs("form",{className:"space-y-4",onSubmit:fn(ue),children:[l.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-name",children:[l.jsx("span",{className:"text-xs font-medium text-secondary",children:"Name"}),l.jsx("input",{autoFocus:!0,id:"account-name",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:"text",name:"username",autoComplete:"username",value:k,onChange:me=>{N(me.target.value),Ce(null)},"aria-invalid":!!X,"aria-describedby":X?"account-login-error":void 0})]}),l.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-password",children:[l.jsx("span",{className:"text-xs font-medium text-secondary",children:"Password"}),l.jsx("input",{id:"account-password",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:"password",name:"password",autoComplete:"current-password",value:T,onChange:me=>Se(me.target.value),"aria-invalid":!!X,"aria-describedby":X?"account-login-error":void 0})]}),X?l.jsx("p",{id:"account-login-error",role:"alert",className:"text-sm text-negative-400",children:X}):null,l.jsx(le,{type:"submit",disabled:tt||!k.trim()||!T,children:tt?"Signing in…":"Sign in"})]})]})]}):n==="setup"?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Create a dashboard password"}),l.jsx(fm,{children:ate})]}),l.jsx(vo,{children:l.jsxs("form",{className:"space-y-4",onSubmit:fn(se),children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-new",children:"Password"}),l.jsx("input",{autoFocus:!0,id:"dashboard-password-new",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:"new-password",autoComplete:"new-password",minLength:8,required:!0,value:T,onChange:me=>Se(me.target.value),"aria-invalid":Fe,"aria-describedby":"dashboard-password-new-help"}),l.jsx("span",{id:"dashboard-password-new-help","aria-live":"polite",className:Fe?"block text-sm text-negative-400":"block text-sm text-secondary",children:Fe?"Enter at least 8 characters.":"Use at least 8 characters."})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-confirm",children:"Confirm password"}),l.jsx("input",{id:"dashboard-password-confirm",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:"confirm-password",autoComplete:"new-password",minLength:8,required:!0,value:q,onChange:me=>xe(me.target.value),"aria-invalid":Ee,"aria-describedby":"dashboard-password-confirm-help"}),l.jsx("span",{id:"dashboard-password-confirm-help","aria-live":"polite",className:Ee?"block text-sm text-negative-400":"block text-sm text-secondary",children:Ee?"Passwords do not match.":"Enter the same password again."})]}),F?l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-setup-root-key",children:_r.label}),l.jsx("input",{autoFocus:!0,id:"dashboard-setup-root-key",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:"apiKey",autoComplete:"off",spellCheck:!1,required:!0,value:V,onChange:me=>Me(me.target.value),"aria-invalid":X===_r.rejected,"aria-describedby":"dashboard-setup-root-key-help"}),l.jsx("span",{id:"dashboard-setup-root-key-help","aria-live":"polite",className:"block text-sm text-secondary",children:_r.help})]}):null,l.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-password-show",children:[l.jsx("input",{id:"dashboard-password-show",type:"checkbox",checked:P,onChange:me=>M(me.target.checked)}),F?_r.show:"Show passwords"]}),X?l.jsx("p",{id:"dashboard-password-setup-error",role:"alert",className:"text-sm text-negative-400",children:X}):null,l.jsx(le,{type:"submit",disabled:tt||!Ct,children:tt?"Creating password…":"Create password and continue"})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs(zr,{children:[l.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),l.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"}),l.jsx(fm,{children:L==="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."})]}),l.jsxs(vo,{children:[Ue?l.jsx("p",{className:"mb-4 rounded-md border border-caution bg-caution-soft px-3 py-2 text-sm text-caution",children:"Your session expired — please sign in again."}):null,l.jsxs("form",{className:"space-y-4",onSubmit:fn(pe),children:[l.jsxs("label",{className:"block space-y-1.5",htmlFor:"dashboard-password-current",children:[l.jsx("span",{className:"text-xs font-medium text-secondary",children:L==="api-key"?"Canonry API key":"Password"}),l.jsx("input",{autoFocus:!0,id:"dashboard-password-current",className:"w-full rounded-md border border-base bg-bg px-3 py-2 text-sm text-heading outline-none transition focus:border-mono-600",type:P?"text":"password",name:L==="api-key"?"apiKey":"password",autoComplete:L==="api-key"?"off":"current-password",spellCheck:!1,required:!0,value:T,onChange:me=>Se(me.target.value),"aria-invalid":!!X,"aria-describedby":X?"dashboard-password-login-error":void 0})]}),l.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-login-password-show",children:[l.jsx("input",{id:"dashboard-login-password-show",type:"checkbox",checked:P,onChange:me=>M(me.target.checked)}),L==="api-key"?"Show API key":"Show password"]}),X?l.jsx("p",{id:"dashboard-password-login-error",role:"alert",className:"text-sm text-negative-400",children:X}):null,l.jsx(le,{type:"submit",disabled:tt||!T.trim(),children:tt?"Signing in…":"Open dashboard"}),l.jsx(le,{type:"button",variant:"ghost",onClick:()=>ce(L==="api-key"?"password":"api-key"),children:L==="api-key"?"Use dashboard password instead":"Forgot password? Use API key"})]})]})]})})]})})}const GC=document.getElementById("root");if(!GC)throw new Error("Expected #root element for web app bootstrap.");Fee();R6.createRoot(GC).render(l.jsx(C.StrictMode,{children:l.jsx(ite,{})}));export{xY as $,jo as A,le as B,Sc as C,On as D,fn as E,ese as F,ase as G,nse as H,ua as I,tae as J,aae as K,nne as L,Nse as M,Wie as N,ane as O,Yte as P,tne as Q,Ga as R,sk as S,wn as T,sne as U,nae as V,ine as W,fa as X,oQ as Y,Vse as Z,$se as _,Ase as a,Jte as a$,pQ as a0,Xte as a1,Nae as a2,Rae as a3,Cne as a4,jae as a5,Eie as a6,zie as a7,Die as a8,Pne as a9,Lie as aA,Lg as aB,S9 as aC,k9 as aD,zte as aE,Dte as aF,mae as aG,bae as aH,vae as aI,gn as aJ,xae as aK,bne as aL,rQ as aM,vZ as aN,jg as aO,wae as aP,Bd as aQ,sse as aR,Pg as aS,bo as aT,uQ as aU,Nt as aV,JH as aW,Kae as aX,wX as aY,Bne as aZ,ene as a_,One as aa,Hne as ab,bn as ac,Pie as ad,qie as ae,Une as af,Mie as ag,Vne as ah,Mne as ai,Lne as aj,Iie as ak,Oie as al,Rie as am,qne as an,Bie as ao,Hie as ap,Vie as aq,Kie as ar,$ie as as,Gie as at,cae as au,E1 as av,Oe as aw,Uie as ax,aC as ay,Gi as az,Eae as b,eae as b$,qi as b0,qse as b1,Fte as b2,fne as b3,yq as b4,mne as b5,Qte as b6,Tae as b7,Hte as b8,kQ as b9,rie as bA,cie as bB,yie as bC,Cie as bD,Nie as bE,fie as bF,jie as bG,Tie as bH,die as bI,vie as bJ,xie as bK,wie as bL,uie as bM,bie as bN,mie as bO,Sie as bP,pie as bQ,kie as bR,gie as bS,Aie as bT,_ie as bU,lW as bV,hie as bW,pne as bX,Ane as bY,jne as bZ,kne as b_,QQ as ba,Yae as bb,tie as bc,Xae as bd,lne as be,une as bf,C$ as bg,dne as bh,OQ as bi,Zae as bj,T$ as bk,Sg as bl,cne as bm,eH as bn,Jae as bo,Fae as bp,qQ as bq,Wae as br,Sae as bs,eie as bt,use as bu,dse as bv,$ne as bw,JN as bx,ise as by,XN as bz,Rte as c,Ise as c$,WG as c0,_2 as c1,Dm as c2,T2 as c3,_s as c4,iie as c5,Ite as c6,YQ as c7,lie as c8,Iae as c9,vW as cA,Kse as cB,Rse as cC,bX as cD,Ese as cE,mW as cF,nie as cG,Mae as cH,Tse as cI,$ae as cJ,Bae as cK,Y9 as cL,VP as cM,aie as cN,_se as cO,Uae as cP,Sse as cQ,CX as cR,dH as cS,gQ as cT,_X as cU,xne as cV,wne as cW,vne as cX,hH as cY,Dse as cZ,zse as c_,Wte as ca,wS as cb,Tne as cc,Ene as cd,Dae as ce,zae as cf,Rne as cg,Dne as ch,Ine as ci,zne as cj,su as ck,Bo as cl,MN as cm,qae as cn,Pae as co,sX as cp,Dg as cq,mm as cr,zg as cs,pm as ct,hm as cu,xX as cv,CQ as cw,xo as cx,gm as cy,eF as cz,mQ as d,r9 as d$,Pse as d0,Sne as d1,SQ as d2,Nne as d3,fY as d4,Qie as d5,AH as d6,Xne as d7,Zie as d8,Yie as d9,Kr as dA,kS as dB,uae as dC,pae as dD,fae as dE,gae as dF,dae as dG,hae as dH,yae as dI,Mf as dJ,lae as dK,lse as dL,iW as dM,rne as dN,h1 as dO,Oae as dP,ose as dQ,cse as dR,rae as dS,one as dT,sae as dU,oae as dV,iae as dW,rse as dX,Gte as dY,o9 as dZ,Ra as d_,Xie as da,Fie as db,Cae as dc,Qne as dd,Fne as de,Zne as df,Jne as dg,Yne as dh,z1 as di,qc as dj,Use as dk,iu as dl,sie as dm,oie as dn,iH as dp,gne as dq,yne as dr,_ne as ds,Kne as dt,Gne as du,M1 as dv,Ym as dw,I1 as dx,bW as dy,Wne as dz,dQ as e,Vte as e$,EP as e0,Lae as e1,Aae as e2,bO as e3,Gae as e4,Vae as e5,Qae as e6,Hae as e7,IS as e8,ye as e9,Qi as eA,za as eB,qte as eC,lm as eD,hne as eE,QF as eF,pse as eG,mse as eH,pW as eI,gse as eJ,jX as eK,Ote as eL,kse as eM,jse as eN,hse as eO,fse as eP,Pte as eQ,bse as eR,wse as eS,yse as eT,xse as eU,Ro as eV,Kte as eW,Lte as eX,vse as eY,Bte as eZ,oP as e_,Ete as ea,Tte as eb,_te as ec,Cte as ed,jte as ee,kte as ef,Nte as eg,Ate as eh,Ste as ei,wte as ej,hte as ek,fte as el,xte as em,vte as en,bte as eo,gte as ep,yte as eq,pte as er,mte as es,dte as et,a_ as eu,n_ as ev,$te as ew,kw as ex,Mte as ey,Oj as ez,nm as f,Ute as f0,Mse as g,Ose as h,Bse as i,Lse as j,Ig as k,$c as l,Cse as m,LV as n,wY as o,EG as p,kae as q,Jie as r,_ae as s,cQ as t,O1 as u,tse as v,_a as w,Zte as x,J as y,Gm as z};
@@ -1,4 +1,4 @@
1
- import{g as Bt,t as S,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{e as Ht,G as Wt}from"./SiteHealthSection-CwffU3tv.js";import"./index-DrQLR1jE.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-lucide-Y6jANGfG.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-CYlrwLJs.js";function Vt(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var e=i.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function ae(r){var n=Vt(r,"string");return typeof n=="symbol"?n:n+""}function A(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function He(r,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,ae(e.key),e)}}function L(r,n,i){return n&&He(r.prototype,n),i&&He(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function Q(r){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(r)}function yt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yt=function(){return!!r})()}function jt(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zt(r,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(r)}function I(r,n,i){return n=Q(n),Zt(r,yt()?Reflect.construct(n,i||[],Q(r).constructor):n.apply(r,i))}function xe(r,n){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},xe(r,n)}function G(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&xe(r,n)}function qt(r){if(Array.isArray(r))return r}function Yt(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var e,t,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(r)).next,n===0){if(Object(i)!==i)return;l=!1}else for(;!(l=(e=a.call(i)).done)&&(s.push(e.value),s.length!==n);l=!0);}catch(u){h=!0,t=u}finally{try{if(!l&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw t}}return s}}function Se(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,e=Array(n);i<n;i++)e[i]=r[i];return e}function Tt(r,n){if(r){if(typeof r=="string")return Se(r,n);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Se(r,n):void 0}}function Xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{g as Bt,t as S,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{e as Ht,G as Wt}from"./SiteHealthSection-Cn_IZVO1.js";import"./index-BJcjB5XW.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-lucide-Y6jANGfG.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-CZ4wVBJL.js";function Vt(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var e=i.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function ae(r){var n=Vt(r,"string");return typeof n=="symbol"?n:n+""}function A(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function He(r,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,ae(e.key),e)}}function L(r,n,i){return n&&He(r.prototype,n),i&&He(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function Q(r){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(r)}function yt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yt=function(){return!!r})()}function jt(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zt(r,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(r)}function I(r,n,i){return n=Q(n),Zt(r,yt()?Reflect.construct(n,i||[],Q(r).constructor):n.apply(r,i))}function xe(r,n){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},xe(r,n)}function G(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&xe(r,n)}function qt(r){if(Array.isArray(r))return r}function Yt(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var e,t,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(r)).next,n===0){if(Object(i)!==i)return;l=!1}else for(;!(l=(e=a.call(i)).done)&&(s.push(e.value),s.length!==n);l=!0);}catch(u){h=!0,t=u}finally{try{if(!l&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw t}}return s}}function Se(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,e=Array(n);i<n;i++)e[i]=r[i];return e}function Tt(r,n){if(r){if(typeof r=="string")return Se(r,n);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Se(r,n):void 0}}function Xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ee(r,n){return qt(r)||Yt(r,n)||Tt(r,n)||Xt()}var pe={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},Ct=new Int8Array(4),be=new Int32Array(Ct.buffer,0,1),$t=new Float32Array(Ct.buffer,0,1),Kt=/^\s*rgba?\s*\(/,Jt=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Qt(r){var n=0,i=0,e=0,t=1;if(r[0]==="#")r.length===4?(n=parseInt(r.charAt(1)+r.charAt(1),16),i=parseInt(r.charAt(2)+r.charAt(2),16),e=parseInt(r.charAt(3)+r.charAt(3),16)):(n=parseInt(r.charAt(1)+r.charAt(2),16),i=parseInt(r.charAt(3)+r.charAt(4),16),e=parseInt(r.charAt(5)+r.charAt(6),16)),r.length===9&&(t=parseInt(r.charAt(7)+r.charAt(8),16)/255);else if(Kt.test(r)){var a=r.match(Jt);a&&(n=+a[1],i=+a[2],e=+a[3],a[4]&&(t=+a[4]))}return{r:n,g:i,b:e,a:t}}var J={};for(var le in pe)J[le]=oe(pe[le]),J[pe[le]]=J[le];function Rt(r,n,i,e,t){return be[0]=e<<24|i<<16|n<<8|r,be[0]=be[0]&4278190079,$t[0]}function oe(r){if(r=r.toLowerCase(),typeof J[r]<"u")return J[r];var n=Qt(r),i=n.r,e=n.g,t=n.b,a=n.a;a=a*255|0;var o=Rt(i,e,t,a);return J[r]=o,o}var Ee={};function _t(r){if(typeof Ee[r]<"u")return Ee[r];var n=(r&16711680)>>>16,i=(r&65280)>>>8,e=r&255,t=255,a=Rt(n,i,e,t);return Ee[r]=a,a}function We(r,n,i,e){return i+(n<<8)+(r<<16)}function Ve(r,n,i,e,t,a){var o=Math.floor(i/a*t),s=Math.floor(r.drawingBufferHeight/a-e/a*t),l=new Uint8Array(4);r.bindFramebuffer(r.FRAMEBUFFER,n),r.readPixels(o,s,1,1,r.RGBA,r.UNSIGNED_BYTE,l);var h=ee(l,4),u=h[0],d=h[1],f=h[2],g=h[3];return[u,d,f,g]}function c(r,n,i){return(n=ae(n))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,r}function je(r,n){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),i.push.apply(i,e)}return i}function b(r){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?je(Object(i),!0).forEach(function(e){c(r,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):je(Object(i)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})}return r}function ei(r,n){for(;!{}.hasOwnProperty.call(r,n)&&(r=Q(r))!==null;);return r}function Ae(){return Ae=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,n,i){var e=ei(r,n);if(e){var t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(arguments.length<3?r:i):t.value}},Ae.apply(null,arguments)}function wt(r,n,i,e){var t=Ae(Q(r.prototype),n,i);return typeof t=="function"?function(a){return t.apply(i,a)}:t}function ti(r){return r.normalized?1:r.size}function ye(r){var n=0;return r.forEach(function(i){return n+=ti(i)}),n}function xt(r,n,i){var e=r==="VERTEX"?n.VERTEX_SHADER:n.FRAGMENT_SHADER,t=n.createShader(e);if(t===null)throw new Error("loadShader: error while creating the shader");n.shaderSource(t,i),n.compileShader(t);var a=n.getShaderParameter(t,n.COMPILE_STATUS);if(!a){var o=n.getShaderInfoLog(t);throw n.deleteShader(t),new Error(`loadShader: error while compiling the shader:
3
3
  `.concat(o,`
4
4
  `).concat(i))}return t}function ii(r,n){return xt("VERTEX",r,n)}function ri(r,n){return xt("FRAGMENT",r,n)}function ni(r,n){var i=r.createProgram();if(i===null)throw new Error("loadProgram: error while creating the program.");var e,t;for(e=0,t=n.length;e<t;e++)r.attachShader(i,n[e]);r.linkProgram(i);var a=r.getProgramParameter(i,r.LINK_STATUS);if(!a){var o=r.getProgramInfoLog(i);throw r.deleteProgram(i),new Error("loadProgram: error while linking the program: ".concat(o))}return i}function Ze(r){var n=r.gl,i=r.buffer,e=r.program,t=r.vertexShader,a=r.fragmentShader;n.deleteShader(t),n.deleteShader(a),n.deleteProgram(e),n.deleteBuffer(i)}var qe=`#define PICKING_MODE