@canonry/canonry 7.18.0 → 7.18.1

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-dGXxZ8IR.js","./vendor-tanstack-ZXXkndVj.js","./vendor-lucide-Y6jANGfG.js","./ChartPrimitives-CYlrwLJs.js","./vendor-recharts-D-cUuLZo.js","./ProjectPage-CP4fvluh.js","./v2-overview-adapter-1MHnrdnr.js","./vendor-markdown-B4giJcws.js","./extract-error-message-BYvzTsML.js","./Hint-DICI5Jq9.js","./AuditHistoryPanel-CgKpjgpq.js","./vendor-radix-twS1M3FF.js","./vendor-yaml-GWJz5H2G.js","./RunsPage-D0qkTwas.js","./HistoryPage-D8nQ8E8_.js","./SettingsPage-DaqR1wKC.js","./BacklinksPage-BBqbRSeG.js","./TrafficPage-DodOmnVv.js","./TrafficSourceDetailPage-C7b-BcKF.js","./MeasurementPropertyPage-CQ8lLoeA.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-XOUI_75e.js","./vendor-tanstack-ZXXkndVj.js","./vendor-lucide-Y6jANGfG.js","./ChartPrimitives-CYlrwLJs.js","./vendor-recharts-D-cUuLZo.js","./ProjectPage-C1_-qiHw.js","./v2-overview-adapter-Ca5F20Kr.js","./vendor-markdown-B4giJcws.js","./extract-error-message-Cw5pcZtv.js","./Hint-DICI5Jq9.js","./AuditHistoryPanel-RAYlf3B4.js","./vendor-radix-twS1M3FF.js","./vendor-yaml-GWJz5H2G.js","./RunsPage-Cx5yMuzN.js","./HistoryPage-BHV_3wbQ.js","./SettingsPage-DrZ-eswp.js","./BacklinksPage-BT3j4tQK.js","./TrafficPage-DciX-fl5.js","./TrafficSourceDetailPage-D1_lnRoS.js","./MeasurementPropertyPage-9UFPKw-i.js"])))=>i.map(i=>d[i]);
2
2
  import{c as H5,d as F5,r as C,j as l,Q as Q5,M as Z5,q as be,e as Mc,L as at,a as Y5,t as Ar,u as yt,f as X5,h as Ds,k as zs,l as fk,m as J5,n as gk,O as Xf,o as oi,p as W5,s as Bt,v as Gg,x as Is,y as e6,z as t6,A as n6}from"./vendor-tanstack-ZXXkndVj.js";import{S as a6,O as Kg,P as yk,C as Hg,a as bk,T as Fg,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 Kr,S as Qg,a as Sk,G as kk,C as Bc,L as Ts,R as pd,M as i6,b as s6,P as Jf,H as jk,c as Ak,d as o6,e as Lc,f as Zg,T as ym,g as Uc,W as Nk,h as r6,i as l6,j as c6,k as u6,l as d6,m as m6,n as p6,B as h6,F as f6,o as g6,p as y6,q as b6,r as v6,s as Ck,t as _k,u as Wf,v as Tk,w as x6,x as Ek,E as w6}from"./vendor-lucide-Y6jANGfG.js";import{M as S6,r as k6}from"./vendor-markdown-B4giJcws.js";import{p as j6}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 A6(){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 Q(B){if(q=!1,$(B),!z)if(i(v)!==null)z=!0,ae||(ae=!0,Ge());else{var W=i(x);W!==null&&Le(Q,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(Q,Se.startTime-B),W=!1}}break e}finally{k=null,N=ve,T=!1}W=void 0}}finally{W?Ge():ae=!1}}}var Ge;if(typeof L=="function")Ge=function(){L(tt)};else if(typeof MessageChannel<"u"){var Ue=new MessageChannel,ke=Ue.port2;Ue.port1.onmessage=tt,Ge=function(){ke.postMessage(null)}}else Ge=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(Q,ve-Ae))):(B.sortIndex=se,n(v,B),z||T||(z=!0,ae||(ae=!0,Ge()))),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 N6(){return vx||(vx=1,cf.exports=A6()),cf.exports}var xx;function C6(){if(xx)return cc;xx=1;var e=N6(),n=H5(),i=F5();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"),Q=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 Ge(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 Q: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 Qe(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 F=Y}Reflect.construct(t,[],ie)}else{try{ie.call()}catch(Y){F=Y}t.call(ie.prototype)}}else{try{throw Error()}catch(Y){F=Y}(ie=t())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Y){if(Y&&F&&typeof Y.stack=="string")return[Y.stack,F.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),Gs(!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){Qa(!0),ml(null);try{await dH(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{Qa(!1)}}},vl=async()=>{const H=es.trim();if(H){Ko(!0),Ho(null);try{await VN("gemini",{apiKey:H}),bn({title:"Gemini configured",detail:"Provider is ready — continuing setup.",tone:"positive",dedupeKey:"setup:gemini:configured",dedupeMode:"drop"}),lu(""),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){Ho(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{Ko(!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");Ia||M({flowVersion:ft,onboardingSessionId:E,event:"run.requested",origin:"dashboard_setup",result:"rejected",providerCountBucket:si(wt),queryCountBucket:si(ya),reasonCode:H});return}Qs(!0),zn(null);try{const H=await gl.mutateAsync({projectName:Ne,projectLabel:xe||Se||Ne,sourceAction:"setup-launch"});op(H.id),sp(!0),TN(Ne,H.id),fl.current=H.id,Ia||M({flowVersion:ft,onboardingSessionId:E,event:"run.requested",origin:"dashboard_setup",result:"queued",providerCountBucket:si(wt),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."),Ia||M({flowVersion:ft,onboardingSessionId:E,event:"run.requested",origin:"dashboard_setup",result:"rejected",providerCountBucket:si(wt),queryCountBucket:si(ya),reasonCode:Ac(H,"run_rejected")})}finally{Qs(!1)}}},Mn=()=>W(H=>T?2:Math.max(0,H-1)),Zo=(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){Ft();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(),Ks&&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(mW,{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:ou,id:"setup-provider",className:"setup-input",value:ta.name,onChange:H=>{H.target.value!==ta.name&&(Vo.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=>lu(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"?Gr(k.apiStatus):H.id==="worker"?Gr(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:()=>Zo("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)}),Gn&&Gn!==Se?l.jsxs("p",{className:"supporting-copy",children:["Slug: ",Gn]}):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=>Qe(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:!Gn||!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:$o||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})]}),$o?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:()=>Zo("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:Uo,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:su||!sn,onClick:fn(Pa),children:su?"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:Qt,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(Qo),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:()=>Zo("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??[],qa=H?.queryCounts,kl=Ye?rk(Ye,ts.length):!1,An=Ge&&!Za,xi=jn??(H?.error?aF(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(SX,{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:qa?l.jsxs(l.Fragment,{children:[qa.mentionedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",qa.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:qa?l.jsxs(l.Fragment,{children:[qa.citedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",qa.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(dW,{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:Ft,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(Eo,{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:Ft,children:"Skip AI Visibility"})}):null]}),f?null:l.jsx(yW,{current:T?B===4?1:0:B,labels:T?fW:hW}),l.jsxs("section",{className:"setup-wizard",children:[Ys,Ja]})]})}const Yf="canonry mcp install --client claude-code",xW="https://github.com/Canonry/canonry/blob/main/docs/mcp.md";function wW(){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 SW({projectName:e,skippedVisibility:n=!1}){const i=yt({...VQ({client:J,path:{name:e}}),retry:!1}),r=i.data?.hasData?i.data:null,u=wW(),h=uk(e,Oe["site-audit"]),f=uk(e,Oe["answer-visibility"]),b={...h?{site:h,fixes:h}:{},...kW(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(Eo,{current:"done",outcomes:b}),l.jsxs("header",{className:"relative mx-auto mt-12 max-w-2xl text-center md:mt-16",children:[l.jsx(jW,{}),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(Ed,{className:"md:col-span-4 md:row-span-2",delayMs:600,labelledBy:"onb-agent-heading",children:l.jsx(CW,{projectName:e})}),l.jsx(Ed,{className:"md:col-span-2 md:row-span-2",delayMs:700,labelledBy:"onb-data-heading",children:l.jsx(EW,{projectName:e})}),l.jsx(Ed,{className:"md:col-span-3",delayMs:800,labelledBy:"onb-schedule-heading",children:l.jsx(zW,{projectName:e})}),l.jsx(Ed,{className:"md:col-span-3",delayMs:900,labelledBy:"onb-alerts-heading",children:l.jsx(IW,{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({...ZN({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 kW(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!==Va.probe);if(!n.some(i=>i.status===At.completed||i.status===At.partial))return n.some(i=>i.status===At.queued||i.status===At.running)?"pending":n.length>0?"incomplete":"skipped"}function Ta(e){return{"--onb-delay":`${e}ms`}}function jW(){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 Ed({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 Rd=[{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."}],AW=9e3;function NW(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function CW({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||NW())return;const S=window.setTimeout(()=>r(k=>(k+1)%Rd.length),AW);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=Rd[i]??Rd[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:[Rd.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(Lc,{className:"size-4","aria-hidden":"true"}):l.jsx(Zg,{className:"size-4","aria-hidden":"true"}),f?"Copied":"Copy"]}),l.jsx("a",{href:xW,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-link underline-offset-4 hover:underline",children:"Other clients"})]})]})}const _W=[{icon:Qg,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"}],TW=["GPTBot","ClaudeBot","PerplexityBot"];function EW({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(RW,{}),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:_W.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 RW(){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))}),TW.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 DW=["M","T","W","T","F","S","S"];function zW({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:DW.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(BC,{projectName:e,to:"/projects/$projectName/settings",icon:_k,label:"Set a schedule",action:"set_schedule"})]})}function IW({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(BC,{projectName:e,to:"/projects/$projectName/settings",icon:Wf,label:"Add a notification",action:"add_notification"})]})}function BC({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 OW=C.lazy(async()=>({default:(await Fi(()=>import("./SiteHealthSection-dGXxZ8IR.js").then(n=>n.d),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).SiteHealthSection})),PW=`Public pages only, crawled from this computer and stored locally. The first scan reads up to ${T2} pages, then stops.`,qW=1800,MW="https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent",BW="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 LW(e,n){return e==="legacy"?"legacy":e==="platform"?"platform":n.state==="success"?n.projectCount===0?"platform":"legacy":n.state==="error"?"retry":"loading"}const UW="2000-01-01T00:00:00.000Z",VW=5e3;function $W(e,n){const i=new Set,r=new Map;for(const f of n)f.trigger!==Va.probe&&(r.has(f.projectId)||r.set(f.projectId,f.id),(f.status===At.completed||f.status===At.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 LC=[{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"}],UC=[{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 GW(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 KW(e,n){const i=e.trim().toUpperCase(),r=n.trim().toLowerCase();return{countryValid:LC.some(u=>u.value===i),languageValid:UC.some(u=>u.value===r)}}function HW(e){const n=e.replace(/^\[|\]$/g,"");return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(n)||n.includes(":")}function FW(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"||HW(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 QW(e,n=qW){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 ZW(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 VC(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 YW({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 XW({projectName:e,initialRunId:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(JW,{projectName:e,initialRunId:n})})}function JW({projectName:e,initialRunId:n}){const i=zs(),r=yt({...Mo({client:J}),enabled:!!e,retry:!1,refetchOnMount:"always"}),{onboardingSessionId:u,emit:h}=VC("site_health"),[f]=C.useState(()=>hK(n));C.useEffect(()=>{f&&fK()},[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||EN(e)?.runId!==n&&TN(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(Eo,{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(Eo,{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(OW,{projectName:x.name,projectId:x.id,initialRunId:n,onReleaseInitialRun:S,showOnboardingActions:!0,onContinueOnboarding:k,onSkipOnboarding:N})})]})}function WW(){const e=fk({from:"/setup"}),n=e.onboarding==="site-health"&&!e.setupProject,i=e.onboarding==="site-health"&&e.experience!=="legacy",r=VK(),u=e.experience==="legacy"?"legacy":e.experience==="platform"?"platform":r,[h,f]=C.useState(!1),[b,v]=C.useState(void 0),x=yt({...Mo({client:J}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),S=yt({...Pc({client:J,query:{kind:Oe["site-audit"],since:UW,limit:VW}}),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":LW(u,N);if(e.onboarding==="complete"&&e.setupProject)return l.jsx(SW,{projectName:e.setupProject,skippedVisibility:e.skipped==="visibility"});if(n||i)return l.jsx(XW,{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($W(x.data,S.data)),l.jsx($g,{});const q=z?b:null;return q?l.jsx(eee,{projectName:q.projectName,runId:q.runId}):T==="legacy"?l.jsx(bW,{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(YW,{onRetry:()=>{x.refetch()}}):l.jsx(tee,{onActivationStarted:()=>f(!0),skipSiteScan:e.siteScan==="skip"})}function eee({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 tee({onActivationStarted:e,skipSiteScan:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(nee,{onActivationStarted:e,skipSiteScan:n})})}function nee({onActivationStarted:e,skipSiteScan:n}){const i=zs(),r=Ds(),u=rW(),h=yt({...HF({client:J}),retry:!1}),f=oi(FF()),[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"),[Q,ae]=C.useState(null),[V,Z]=C.useState(null),[X,Ce]=C.useState(!1),[tt,Ge]=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}=VC("platform");C.useEffect(()=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.started",step:"project",resumed:!1},"onboarding.started")},[Me,Se]);const xe=FW(b),pe=x||xe?.projectName||"",ce=k||xe?.displayName||"",ue=L==="creating"||L==="dispatching",_e=V??tt,Qe=GW(T,q),{countryValid:Ee,languageValid:Ct}=KW(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"),Ge(null);try{const ct=u.mutateAsync({projectName:Ve.name,projectId:Ve.id,projectLabel:Ve.displayName||Ve.name,suppressErrorToast:!0,body:{checkDeadLinks:!0,maxPages:T2}}),Ft=await QW(ct);if(Ft.state==="queued"){Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"}),pK(Ft.run.runId),await Be(Ve,Ft.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"})},Qt=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Ac(Qt,"run_rejected")})}),ZW(ct,Ve.id),await Be(Ve)}catch(ct){$("recovery"),Ge(mk(ct,"The project was created, but the Site Health scan could not be started."));const Ft=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:Ft}),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:Ft},`onboarding.blocked:run:${Ft}`)}},re=async Ve=>{if(Ve.preventDefault(),!(!xe||!n&&!P||!me||ue)){$("creating"),Z(null),Ce(!1),Ge(null);try{const ct=await lH({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 Ft=ct instanceof gn&&ct.statusCode===409;Ce(Ft),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"),Ft&&(e(),r.invalidateQueries({queryKey:$r({client:J})}))}}},Ze=()=>{Q&&!ue&&Ne(Q)},bt=()=>{ue||i({to:"/projects"})},qn=async()=>{try{await navigator.clipboard.writeText(BW),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(XN({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 Q&&L==="recovery"?l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx(Eo,{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:[Q.displayName||Q.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(Q)},children:"Continue setup"})]})]})]}):l.jsxs("div",{className:"page-container max-w-xl py-8 md:py-12",children:[n?null:l.jsx(Eo,{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:[Qe,l.jsx(Bc,{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:LC.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:UC.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:PW})]})]}),_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(Lc,{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:MW,target:"_blank",rel:"noopener noreferrer",children:["Agent quickstart",l.jsx(w6,{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 aee(){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 za=Is(()=>Fi(()=>import("./ProjectPage-CP4fvluh.js"),__vite__mapDeps([5,1,0,2,3,4,6,7,8,9,10,11,12]),import.meta.url),"ProjectPage"),iee=Is(()=>Fi(()=>import("./RunsPage-D0qkTwas.js"),__vite__mapDeps([13,1,11,4,2,7,12]),import.meta.url),"RunsPage"),see=Is(()=>Fi(()=>import("./HistoryPage-D8nQ8E8_.js"),__vite__mapDeps([14,1,10,11,4,2,7,12]),import.meta.url),"HistoryPage"),oee=Is(()=>Fi(()=>import("./SettingsPage-DaqR1wKC.js"),__vite__mapDeps([15,1,11,4,2,7,12]),import.meta.url),"SettingsPage"),ree=Is(()=>Fi(()=>import("./BacklinksPage-BBqbRSeG.js"),__vite__mapDeps([16,1,9,2,11,4,7,12]),import.meta.url),"BacklinksPage"),lee=Is(()=>Fi(()=>import("./TrafficPage-DodOmnVv.js"),__vite__mapDeps([17,1,8,2,11,4,7,12]),import.meta.url),"TrafficPage"),cee=Is(()=>Fi(()=>import("./TrafficSourceDetailPage-C7b-BcKF.js"),__vite__mapDeps([18,1,8,3,4,2,11,7,12]),import.meta.url),"TrafficSourceDetailPage"),uee=Is(()=>Fi(()=>import("./MeasurementPropertyPage-CQ8lLoeA.js"),__vite__mapDeps([19,1,3,4,6,7,2,11,12]),import.meta.url),"MeasurementPropertyPage");function dee(){return l.jsx(fJ,{children:l.jsx(eF,{children:l.jsx(hJ,{})})})}const Un=W5()({component:dee,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]))})}),mee=Bt({getParentRoute:()=>Un,path:"/",component:YJ,beforeLoad:async({context:e})=>{let n=e.queryClient.getQueryData($r({client:J}));if(n===void 0)try{n=await e.queryClient.ensureQueryData(Mo({client:J}))}catch{return}if(n.length===0)throw Gg({to:"/setup"})}}),pee=Bt({getParentRoute:()=>Un,path:"/projects",component:eW}),hee=/^[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(!hee.test(r))return;let u=e.queryClient.getQueryData($r({client:J}));if(!u)try{u=await e.queryClient.ensureQueryData(Mo({client:J}))}catch{return}const h=u.find(f=>f.id===r);if(h)throw Gg({to:i.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(h.name)}`),replace:!0})}}),fee=Bt({getParentRoute:()=>Vn,path:"/",component:()=>l.jsx(za,{tab:"overview"})}),gee=Bt({getParentRoute:()=>Vn,path:"/portfolio",component:()=>l.jsx(za,{tab:"portfolio"})}),yee=Bt({getParentRoute:()=>Vn,path:"/search-console",component:()=>l.jsx(za,{tab:"search-console"})}),bee=Bt({getParentRoute:()=>Vn,path:"/conversions",component:()=>l.jsx(za,{tab:"conversions"})}),vee=Bt({getParentRoute:()=>Vn,path:"/local",component:()=>l.jsx(za,{tab:"local"})}),xee=Bt({getParentRoute:()=>Vn,path:"/discovery",component:()=>l.jsx(za,{tab:"discovery"})}),wee=Bt({getParentRoute:()=>Vn,path:"/queries",component:()=>l.jsx(za,{tab:"queries"})}),See=Bt({getParentRoute:()=>Vn,path:"/properties/$targetKey",component:()=>l.jsx(uee,{})}),kee=Bt({getParentRoute:()=>Vn,path:"/report",beforeLoad:({params:e})=>{throw Gg({to:"/projects/$projectName",params:e,replace:!0})}}),jee=Bt({getParentRoute:()=>Vn,path:"/activity",component:()=>l.jsx(za,{tab:"activity"})}),Aee=Bt({getParentRoute:()=>Vn,path:"/backlinks",component:()=>l.jsx(za,{tab:"backlinks"})}),Nee=Bt({getParentRoute:()=>Vn,path:"/technical-aeo",component:()=>l.jsx(za,{tab:"technical-aeo"})}),Cee=Bt({getParentRoute:()=>Vn,path:"/history",component:()=>l.jsx(za,{tab:"history"})}),_ee=Bt({getParentRoute:()=>Vn,path:"/settings",component:()=>l.jsx(za,{tab:"settings"})}),Tee=Bt({getParentRoute:()=>Un,path:"/runs",component:iee}),Eee=Bt({getParentRoute:()=>Un,path:"/history",component:see}),Ree=Bt({getParentRoute:()=>Un,path:"/settings",component:oee,beforeLoad:({context:e})=>{}}),Dee=Bt({getParentRoute:()=>Un,path:"/setup",component:WW}),zee=Bt({getParentRoute:()=>Un,path:"/backlinks",component:ree}),Iee=Bt({getParentRoute:()=>Un,path:"/traffic",component:lee}),Oee=Bt({getParentRoute:()=>Un,path:"/traffic/$projectName/$sourceId",component:cee}),Pee=Bt({getParentRoute:()=>Un,path:"*",component:aee}),qee=Un.addChildren([mee,pee,Vn.addChildren([fee,gee,yee,bee,vee,xee,wee,See,kee,jee,Aee,Nee,Cee,_ee]),Tee,Eee,Ree,Dee,zee,Iee,Oee,Pee]);function Mee(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const pk=Mee(),Bee=pk==="/"?"":pk.replace(/\/$/,"");function Lee(e,n){return e6({routeTree:qee,basepath:Bee||"/",context:{queryClient:e},...n?.initialEntries})}let hk=!1;async function Uee(e){return(await sT({client:J,body:e,keepalive:!0})).data}function Vee(){hk||typeof window>"u"||(hk=!0,!(Km()||ko())&&(SK({send:Uee}),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:Gee(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})}),Zee()))}function $ee(e){let n=null;const i=()=>{const r=e.state.matches.at(-1);if(!r)return;kK(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&&_K(n.search,h),n={pathname:u.pathname,search:h}};return i(),e.subscribe("onResolved",i)}function Gee(e){try{return new URL(e,window.location.origin).pathname}catch{return}}const Kee={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function Hee(e,n){const[i,r]=Kee[e];return n<=i?"good":n<=r?"needs-improvement":"poor"}function Fee(){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 Qee(){let e=0;return{add(n){n.interactionId&&(e=Math.max(e,n.duration))},value:()=>e}}function Zee(){if(typeof PerformanceObserver>"u")return;const e=new Set,n=(b,v)=>{e.has(b)||!Number.isFinite(v)||(e.add(b),EK(b,Hee(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=Fee();i("layout-shift",b=>{for(const v of b)u.add({startTime:v.startTime,value:v.value??0,hadRecentInput:v.hadRecentInput===!0})});const h=Qee();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 Yee=6e4,Xee="Anyone with this password can sign in to this dashboard.",Cr={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 Jee(){const e=C.useRef(sH()).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"),[Q,ae]=C.useState(!1),[V,Z]=C.useState(""),[X,Ce]=C.useState(null),[tt,Ge]=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=XH();B.current=Be,Le.current=Lee(Be),$ee(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 gH().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(()=>{})},Yee);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(Q&&!Be){Ce(Cr.missing);return}Ge(!0),Ce(null);try{if(!(await pH(T.trim(),Q?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(Q?Cr.rejected:null),ae(!0);return}Ce(Ne instanceof gn||Ne instanceof Error?Ne.message:"Setup failed")}finally{Ge(!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()){Ge(!0),Ce(null);try{if(!(L==="api-key"?await fH(T.trim()):await hH(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{Ge(!1)}}},ce=me=>{$(me),z(""),M(!1),Ce(null)},ue=async me=>{if(me.preventDefault(),!(!k.trim()||!T)){Ge(!0),Ce(null);try{const Be=await yH(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{Ge(!1)}}};if(n==="ready"){const{queryClient:me,router:Be}=ve();return l.jsx(BH,{account:r,apiKey:h,apiKeyPending:b,children:l.jsx(t6,{client:me,children:l.jsx(n6,{router:Be})})})}const _e=T.trim(),Qe=T.length>0&&_e.length<8,Ee=q.length>0&&T!==q,Ct=_e.length>=8&&T===q&&(!Q||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(Dr,{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(Dr,{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(Dr,{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:Xee})]}),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":Qe,"aria-describedby":"dashboard-password-new-help"}),l.jsx("span",{id:"dashboard-password-new-help","aria-live":"polite",className:Qe?"block text-sm text-negative-400":"block text-sm text-secondary",children:Qe?"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."})]}),Q?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:Cr.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===Cr.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:Cr.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)}),Q?Cr.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(Dr,{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 $C=document.getElementById("root");if(!$C)throw new Error("Expected #root element for web app bootstrap.");Vee();T6.createRoot($C).render(l.jsx(C.StrictMode,{children:l.jsx(Jee,{})}));export{cF as $,On as A,le as B,Sc as C,fn as D,Hie as E,Zie as F,Qie as G,Zne as H,ua as I,Xne as J,Yte as K,Kie as L,bse as M,Xte as N,Gte as O,Zte as P,Wte as Q,Ga as R,sk as S,wn as T,Yne as U,Jte as V,fa as W,nF as X,Ise as Y,Ose as Z,fY as _,yse as a,qi as a$,Kte as a0,xae as a1,jae as a2,wne as a3,bae as a4,Sie as a5,Aie as a6,jie as a7,Ene as a8,Tne as a9,Lg as aA,v9 as aB,x9 as aC,_te as aD,Cte as aE,oae as aF,mae as aG,pae as aH,gn as aI,hae as aJ,mne as aK,aF as aL,hZ as aM,jg as aN,fae as aO,Md as aP,Xie as aQ,Pg as aR,bo as aS,oF as aT,At as aU,QH as aV,Pae as aW,fX as aX,zne as aY,Qte as aZ,Hte as a_,Lne as aa,bn as ab,_ie as ac,Tie as ad,One as ae,Eie as af,Pne as ag,Dne as ah,Ine as ai,Nie as aj,Cie as ak,kie as al,Rne as am,Rie as an,Mie as ao,Iie as ap,Pie as aq,Oie as ar,qie as as,aae as at,E1 as au,Oe as av,zie as aw,tC as ax,Ki as ay,Die as az,lF as b,vte as b$,Tse as b0,Vte as b1,cne as b2,fq as b3,one as b4,Ute as b5,kae as b6,Lte as b7,vF as b8,VF as b9,tie as bA,cie as bB,vie as bC,bie as bD,rie as bE,gie as bF,wie as bG,aie as bH,die as bI,mie as bJ,pie as bK,nie as bL,uie as bM,iie as bN,hie as bO,sie as bP,fie as bQ,lie as bR,yie as bS,xie as bT,nW as bU,oie as bV,ge as bW,Ate as bX,jte as bY,kte as bZ,Ste as b_,Vae as ba,Fae as bb,$ae as bc,nne as bd,ine as be,k$ as bf,sne as bg,EF as bh,Uae as bi,A$ as bj,Sg as bk,ane as bl,YK as bm,Gae as bn,Lae as bo,DF as bp,Kae as bq,gae as br,Hae as bs,nse as bt,ase as bu,qne as bv,YN as bw,Yie as bx,ZN as by,Wae as bz,Nte as c,oW as c$,bte as c0,wte as c1,xte as c2,yte as c3,gte as c4,cte as c5,ute as c6,fte as c7,hte as c8,pte as c9,Aae as cA,Nae as cB,Ane as cC,Nne as cD,_ne as cE,Cne as cF,iu as cG,Mo as cH,PN as cI,Eae as cJ,Tae as cK,WY as cL,Dg as cM,mm as cN,zg as cO,pm as cP,hm as cQ,hX as cR,kF as cS,xo as cT,gm as cU,ZF as cV,pW as cW,Pse as cX,kse as cY,mX as cZ,Sse as c_,dte as ca,mte as cb,lte as cc,rte as cd,ote as ce,ste as cf,e_ as cg,rne as ch,vne as ci,bne as cj,yne as ck,Qne as cl,ZK as cm,_2 as cn,Dm as co,T2 as cp,_s as cq,Yae as cr,Tte as cs,KF as ct,eie as cu,Cae as cv,Fte as cw,wS as cx,kne as cy,jne as cz,rF as d,uae as d$,Qae as d0,Rae as d1,wse as d2,Oae as d3,Dae as d4,F9 as d5,LP as d6,Zae as d7,xse as d8,zae as d9,Une as dA,Vne as dB,$ne as dC,Hne as dD,Gne as dE,z1 as dF,Pc as dG,zse as dH,au as dI,Xae as dJ,Jae as dK,eH as dL,une as dM,dne as dN,Sne as dO,Mne as dP,Bne as dQ,M1 as dR,Ym as dS,I1 as dT,mW as dU,Fne as dV,Gr as dW,kS as dX,iae as dY,rae as dZ,cae as d_,hse as da,wX as db,rH as dc,mF as dd,SX as de,hne as df,fne as dg,pne as dh,uH as di,jse as dj,Ase as dk,Nse as dl,_se as dm,gne as dn,bF as dp,xne as dq,uY as dr,Bie as ds,wH as dt,Kne as du,Uie as dv,Vie as dw,$ie as dx,Lie as dy,wae as dz,Ese as e,sae as e0,lae as e1,dae as e2,Mf as e3,nae as e4,ese as e5,JJ as e6,tne as e7,h1 as e8,_ae as e9,ise as eA,rW as eB,lse as eC,bX as eD,Ete as eE,fse as eF,gse as eG,ose as eH,rse as eI,Rte as eJ,use as eK,pse as eL,cse as eM,mse as eN,Eo as eO,Bte as eP,Ote as eQ,dse as eR,Ite as eS,aP as eT,qte as eU,Pte as eV,Jie as ea,tse as eb,tae as ec,ene as ed,Wne as ee,eae as ef,Jne as eg,Wie as eh,vae as ei,fO as ej,qae as ek,Iae as el,Bae as em,Mae as en,IS as eo,Mte as ep,kw as eq,zte as er,Oj as es,Fi as et,Da as eu,Dte as ev,lm as ew,lne as ex,VQ as ey,sse as ez,nm as f,Cse as g,Rse as h,Dse as i,Ig as j,Vc as k,gY as l,vse as m,PV as n,NK as o,yae as p,Gie as q,Fie as r,Sae as s,sF as t,O1 as u,_a as v,$te as w,J as x,Km as y,ko 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??[],qa=H?.queryCounts,kl=Ye?rk(Ye,ts.length):!1,An=Ge&&!Za,xi=jn??(H?.error?aF(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(SX,{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:qa?l.jsxs(l.Fragment,{children:[qa.mentionedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",qa.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:qa?l.jsxs(l.Fragment,{children:[qa.citedQueries,l.jsxs("span",{className:"text-faint text-lg",children:[" / ",qa.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(dW,{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:Ft,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(Eo,{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:Ft,children:"Skip AI Visibility"})}):null]}),f?null:l.jsx(yW,{current:T?B===4?1:0:B,labels:T?fW:hW}),l.jsxs("section",{className:"setup-wizard",children:[Ys,Ja]})]})}const Yf="canonry mcp install --client claude-code",xW="https://github.com/Canonry/canonry/blob/main/docs/mcp.md";function wW(){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 SW({projectName:e,skippedVisibility:n=!1}){const i=yt({...VQ({client:J,path:{name:e}}),retry:!1}),r=i.data?.hasData?i.data:null,u=wW(),h=uk(e,Oe["site-audit"]),f=uk(e,Oe["answer-visibility"]),b={...h?{site:h,fixes:h}:{},...kW(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(Eo,{current:"done",outcomes:b}),l.jsxs("header",{className:"relative mx-auto mt-12 max-w-2xl text-center md:mt-16",children:[l.jsx(jW,{}),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(Ed,{className:"md:col-span-4 md:row-span-2",delayMs:600,labelledBy:"onb-agent-heading",children:l.jsx(CW,{projectName:e})}),l.jsx(Ed,{className:"md:col-span-2 md:row-span-2",delayMs:700,labelledBy:"onb-data-heading",children:l.jsx(EW,{projectName:e})}),l.jsx(Ed,{className:"md:col-span-3",delayMs:800,labelledBy:"onb-schedule-heading",children:l.jsx(zW,{projectName:e})}),l.jsx(Ed,{className:"md:col-span-3",delayMs:900,labelledBy:"onb-alerts-heading",children:l.jsx(IW,{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({...ZN({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 kW(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!==Va.probe);if(!n.some(i=>i.status===At.completed||i.status===At.partial))return n.some(i=>i.status===At.queued||i.status===At.running)?"pending":n.length>0?"incomplete":"skipped"}function Ta(e){return{"--onb-delay":`${e}ms`}}function jW(){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 Ed({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 Rd=[{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."}],AW=9e3;function NW(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function CW({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||NW())return;const S=window.setTimeout(()=>r(k=>(k+1)%Rd.length),AW);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=Rd[i]??Rd[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:[Rd.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(Lc,{className:"size-4","aria-hidden":"true"}):l.jsx(Zg,{className:"size-4","aria-hidden":"true"}),f?"Copied":"Copy"]}),l.jsx("a",{href:xW,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-link underline-offset-4 hover:underline",children:"Other clients"})]})]})}const _W=[{icon:Qg,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"}],TW=["GPTBot","ClaudeBot","PerplexityBot"];function EW({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(RW,{}),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:_W.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 RW(){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))}),TW.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 DW=["M","T","W","T","F","S","S"];function zW({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:DW.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(BC,{projectName:e,to:"/projects/$projectName/settings",icon:_k,label:"Set a schedule",action:"set_schedule"})]})}function IW({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(BC,{projectName:e,to:"/projects/$projectName/settings",icon:Wf,label:"Add a notification",action:"add_notification"})]})}function BC({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 OW=C.lazy(async()=>({default:(await Fi(()=>import("./SiteHealthSection-XOUI_75e.js").then(n=>n.d),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).SiteHealthSection})),PW=`Public pages only, crawled from this computer and stored locally. The first scan reads up to ${T2} pages, then stops.`,qW=1800,MW="https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent",BW="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 LW(e,n){return e==="legacy"?"legacy":e==="platform"?"platform":n.state==="success"?n.projectCount===0?"platform":"legacy":n.state==="error"?"retry":"loading"}const UW="2000-01-01T00:00:00.000Z",VW=5e3;function $W(e,n){const i=new Set,r=new Map;for(const f of n)f.trigger!==Va.probe&&(r.has(f.projectId)||r.set(f.projectId,f.id),(f.status===At.completed||f.status===At.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 LC=[{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"}],UC=[{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 GW(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 KW(e,n){const i=e.trim().toUpperCase(),r=n.trim().toLowerCase();return{countryValid:LC.some(u=>u.value===i),languageValid:UC.some(u=>u.value===r)}}function HW(e){const n=e.replace(/^\[|\]$/g,"");return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(n)||n.includes(":")}function FW(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"||HW(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 QW(e,n=qW){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 ZW(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 VC(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 YW({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 XW({projectName:e,initialRunId:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(JW,{projectName:e,initialRunId:n})})}function JW({projectName:e,initialRunId:n}){const i=zs(),r=yt({...Mo({client:J}),enabled:!!e,retry:!1,refetchOnMount:"always"}),{onboardingSessionId:u,emit:h}=VC("site_health"),[f]=C.useState(()=>hK(n));C.useEffect(()=>{f&&fK()},[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||EN(e)?.runId!==n&&TN(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(Eo,{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(Eo,{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(OW,{projectName:x.name,projectId:x.id,initialRunId:n,onReleaseInitialRun:S,showOnboardingActions:!0,onContinueOnboarding:k,onSkipOnboarding:N})})]})}function WW(){const e=fk({from:"/setup"}),n=e.onboarding==="site-health"&&!e.setupProject,i=e.onboarding==="site-health"&&e.experience!=="legacy",r=VK(),u=e.experience==="legacy"?"legacy":e.experience==="platform"?"platform":r,[h,f]=C.useState(!1),[b,v]=C.useState(void 0),x=yt({...Mo({client:J}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),S=yt({...Pc({client:J,query:{kind:Oe["site-audit"],since:UW,limit:VW}}),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":LW(u,N);if(e.onboarding==="complete"&&e.setupProject)return l.jsx(SW,{projectName:e.setupProject,skippedVisibility:e.skipped==="visibility"});if(n||i)return l.jsx(XW,{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($W(x.data,S.data)),l.jsx($g,{});const q=z?b:null;return q?l.jsx(eee,{projectName:q.projectName,runId:q.runId}):T==="legacy"?l.jsx(bW,{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(YW,{onRetry:()=>{x.refetch()}}):l.jsx(tee,{onActivationStarted:()=>f(!0),skipSiteScan:e.siteScan==="skip"})}function eee({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 tee({onActivationStarted:e,skipSiteScan:n}){return l.jsx(M1,{title:"Site Health setup",children:l.jsx(nee,{onActivationStarted:e,skipSiteScan:n})})}function nee({onActivationStarted:e,skipSiteScan:n}){const i=zs(),r=Ds(),u=rW(),h=yt({...HF({client:J}),retry:!1}),f=oi(FF()),[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"),[Q,ae]=C.useState(null),[V,Z]=C.useState(null),[X,Ce]=C.useState(!1),[tt,Ge]=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}=VC("platform");C.useEffect(()=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.started",step:"project",resumed:!1},"onboarding.started")},[Me,Se]);const xe=FW(b),pe=x||xe?.projectName||"",ce=k||xe?.displayName||"",ue=L==="creating"||L==="dispatching",_e=V??tt,Qe=GW(T,q),{countryValid:Ee,languageValid:Ct}=KW(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"),Ge(null);try{const ct=u.mutateAsync({projectName:Ve.name,projectId:Ve.id,projectLabel:Ve.displayName||Ve.name,suppressErrorToast:!0,body:{checkDeadLinks:!0,maxPages:T2}}),Ft=await QW(ct);if(Ft.state==="queued"){Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"}),pK(Ft.run.runId),await Be(Ve,Ft.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"})},Qt=>{Me({flowVersion:ft,onboardingSessionId:Se,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Ac(Qt,"run_rejected")})}),ZW(ct,Ve.id),await Be(Ve)}catch(ct){$("recovery"),Ge(mk(ct,"The project was created, but the Site Health scan could not be started."));const Ft=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:Ft}),Me({flowVersion:ft,onboardingSessionId:Se,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:Ft},`onboarding.blocked:run:${Ft}`)}},re=async Ve=>{if(Ve.preventDefault(),!(!xe||!n&&!P||!me||ue)){$("creating"),Z(null),Ce(!1),Ge(null);try{const ct=await lH({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 Ft=ct instanceof gn&&ct.statusCode===409;Ce(Ft),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"),Ft&&(e(),r.invalidateQueries({queryKey:$r({client:J})}))}}},Ze=()=>{Q&&!ue&&Ne(Q)},bt=()=>{ue||i({to:"/projects"})},qn=async()=>{try{await navigator.clipboard.writeText(BW),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(XN({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 Q&&L==="recovery"?l.jsxs("div",{className:"page-container max-w-3xl",children:[l.jsx(Eo,{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:[Q.displayName||Q.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(Q)},children:"Continue setup"})]})]})]}):l.jsxs("div",{className:"page-container max-w-xl py-8 md:py-12",children:[n?null:l.jsx(Eo,{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:[Qe,l.jsx(Bc,{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:LC.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:UC.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:PW})]})]}),_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(Lc,{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:MW,target:"_blank",rel:"noopener noreferrer",children:["Agent quickstart",l.jsx(w6,{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 aee(){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 za=Is(()=>Fi(()=>import("./ProjectPage-C1_-qiHw.js"),__vite__mapDeps([5,1,0,2,3,4,6,7,8,9,10,11,12]),import.meta.url),"ProjectPage"),iee=Is(()=>Fi(()=>import("./RunsPage-Cx5yMuzN.js"),__vite__mapDeps([13,1,11,4,2,7,12]),import.meta.url),"RunsPage"),see=Is(()=>Fi(()=>import("./HistoryPage-BHV_3wbQ.js"),__vite__mapDeps([14,1,10,11,4,2,7,12]),import.meta.url),"HistoryPage"),oee=Is(()=>Fi(()=>import("./SettingsPage-DrZ-eswp.js"),__vite__mapDeps([15,1,11,4,2,7,12]),import.meta.url),"SettingsPage"),ree=Is(()=>Fi(()=>import("./BacklinksPage-BT3j4tQK.js"),__vite__mapDeps([16,1,9,2,11,4,7,12]),import.meta.url),"BacklinksPage"),lee=Is(()=>Fi(()=>import("./TrafficPage-DciX-fl5.js"),__vite__mapDeps([17,1,8,2,11,4,7,12]),import.meta.url),"TrafficPage"),cee=Is(()=>Fi(()=>import("./TrafficSourceDetailPage-D1_lnRoS.js"),__vite__mapDeps([18,1,8,3,4,2,11,7,12]),import.meta.url),"TrafficSourceDetailPage"),uee=Is(()=>Fi(()=>import("./MeasurementPropertyPage-9UFPKw-i.js"),__vite__mapDeps([19,1,3,4,6,7,2,11,12]),import.meta.url),"MeasurementPropertyPage");function dee(){return l.jsx(fJ,{children:l.jsx(eF,{children:l.jsx(hJ,{})})})}const Un=W5()({component:dee,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]))})}),mee=Bt({getParentRoute:()=>Un,path:"/",component:YJ,beforeLoad:async({context:e})=>{let n=e.queryClient.getQueryData($r({client:J}));if(n===void 0)try{n=await e.queryClient.ensureQueryData(Mo({client:J}))}catch{return}if(n.length===0)throw Gg({to:"/setup"})}}),pee=Bt({getParentRoute:()=>Un,path:"/projects",component:eW}),hee=/^[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(!hee.test(r))return;let u=e.queryClient.getQueryData($r({client:J}));if(!u)try{u=await e.queryClient.ensureQueryData(Mo({client:J}))}catch{return}const h=u.find(f=>f.id===r);if(h)throw Gg({to:i.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(h.name)}`),replace:!0})}}),fee=Bt({getParentRoute:()=>Vn,path:"/",component:()=>l.jsx(za,{tab:"overview"})}),gee=Bt({getParentRoute:()=>Vn,path:"/portfolio",component:()=>l.jsx(za,{tab:"portfolio"})}),yee=Bt({getParentRoute:()=>Vn,path:"/search-console",component:()=>l.jsx(za,{tab:"search-console"})}),bee=Bt({getParentRoute:()=>Vn,path:"/conversions",component:()=>l.jsx(za,{tab:"conversions"})}),vee=Bt({getParentRoute:()=>Vn,path:"/local",component:()=>l.jsx(za,{tab:"local"})}),xee=Bt({getParentRoute:()=>Vn,path:"/discovery",component:()=>l.jsx(za,{tab:"discovery"})}),wee=Bt({getParentRoute:()=>Vn,path:"/queries",component:()=>l.jsx(za,{tab:"queries"})}),See=Bt({getParentRoute:()=>Vn,path:"/properties/$targetKey",component:()=>l.jsx(uee,{})}),kee=Bt({getParentRoute:()=>Vn,path:"/report",beforeLoad:({params:e})=>{throw Gg({to:"/projects/$projectName",params:e,replace:!0})}}),jee=Bt({getParentRoute:()=>Vn,path:"/activity",component:()=>l.jsx(za,{tab:"activity"})}),Aee=Bt({getParentRoute:()=>Vn,path:"/backlinks",component:()=>l.jsx(za,{tab:"backlinks"})}),Nee=Bt({getParentRoute:()=>Vn,path:"/technical-aeo",component:()=>l.jsx(za,{tab:"technical-aeo"})}),Cee=Bt({getParentRoute:()=>Vn,path:"/history",component:()=>l.jsx(za,{tab:"history"})}),_ee=Bt({getParentRoute:()=>Vn,path:"/settings",component:()=>l.jsx(za,{tab:"settings"})}),Tee=Bt({getParentRoute:()=>Un,path:"/runs",component:iee}),Eee=Bt({getParentRoute:()=>Un,path:"/history",component:see}),Ree=Bt({getParentRoute:()=>Un,path:"/settings",component:oee,beforeLoad:({context:e})=>{}}),Dee=Bt({getParentRoute:()=>Un,path:"/setup",component:WW}),zee=Bt({getParentRoute:()=>Un,path:"/backlinks",component:ree}),Iee=Bt({getParentRoute:()=>Un,path:"/traffic",component:lee}),Oee=Bt({getParentRoute:()=>Un,path:"/traffic/$projectName/$sourceId",component:cee}),Pee=Bt({getParentRoute:()=>Un,path:"*",component:aee}),qee=Un.addChildren([mee,pee,Vn.addChildren([fee,gee,yee,bee,vee,xee,wee,See,kee,jee,Aee,Nee,Cee,_ee]),Tee,Eee,Ree,Dee,zee,Iee,Oee,Pee]);function Mee(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const pk=Mee(),Bee=pk==="/"?"":pk.replace(/\/$/,"");function Lee(e,n){return e6({routeTree:qee,basepath:Bee||"/",context:{queryClient:e},...n?.initialEntries})}let hk=!1;async function Uee(e){return(await sT({client:J,body:e,keepalive:!0})).data}function Vee(){hk||typeof window>"u"||(hk=!0,!(Km()||ko())&&(SK({send:Uee}),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:Gee(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})}),Zee()))}function $ee(e){let n=null;const i=()=>{const r=e.state.matches.at(-1);if(!r)return;kK(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&&_K(n.search,h),n={pathname:u.pathname,search:h}};return i(),e.subscribe("onResolved",i)}function Gee(e){try{return new URL(e,window.location.origin).pathname}catch{return}}const Kee={LCP:[2500,4e3],INP:[200,500],CLS:[.1,.25],FCP:[1800,3e3],TTFB:[800,1800]};function Hee(e,n){const[i,r]=Kee[e];return n<=i?"good":n<=r?"needs-improvement":"poor"}function Fee(){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 Qee(){let e=0;return{add(n){n.interactionId&&(e=Math.max(e,n.duration))},value:()=>e}}function Zee(){if(typeof PerformanceObserver>"u")return;const e=new Set,n=(b,v)=>{e.has(b)||!Number.isFinite(v)||(e.add(b),EK(b,Hee(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=Fee();i("layout-shift",b=>{for(const v of b)u.add({startTime:v.startTime,value:v.value??0,hadRecentInput:v.hadRecentInput===!0})});const h=Qee();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 Yee=6e4,Xee="Anyone with this password can sign in to this dashboard.",Cr={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 Jee(){const e=C.useRef(sH()).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"),[Q,ae]=C.useState(!1),[V,Z]=C.useState(""),[X,Ce]=C.useState(null),[tt,Ge]=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=XH();B.current=Be,Le.current=Lee(Be),$ee(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 gH().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(()=>{})},Yee);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(Q&&!Be){Ce(Cr.missing);return}Ge(!0),Ce(null);try{if(!(await pH(T.trim(),Q?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(Q?Cr.rejected:null),ae(!0);return}Ce(Ne instanceof gn||Ne instanceof Error?Ne.message:"Setup failed")}finally{Ge(!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()){Ge(!0),Ce(null);try{if(!(L==="api-key"?await fH(T.trim()):await hH(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{Ge(!1)}}},ce=me=>{$(me),z(""),M(!1),Ce(null)},ue=async me=>{if(me.preventDefault(),!(!k.trim()||!T)){Ge(!0),Ce(null);try{const Be=await yH(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{Ge(!1)}}};if(n==="ready"){const{queryClient:me,router:Be}=ve();return l.jsx(BH,{account:r,apiKey:h,apiKeyPending:b,children:l.jsx(t6,{client:me,children:l.jsx(n6,{router:Be})})})}const _e=T.trim(),Qe=T.length>0&&_e.length<8,Ee=q.length>0&&T!==q,Ct=_e.length>=8&&T===q&&(!Q||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(Dr,{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(Dr,{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(Dr,{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:Xee})]}),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":Qe,"aria-describedby":"dashboard-password-new-help"}),l.jsx("span",{id:"dashboard-password-new-help","aria-live":"polite",className:Qe?"block text-sm text-negative-400":"block text-sm text-secondary",children:Qe?"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."})]}),Q?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:Cr.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===Cr.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:Cr.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)}),Q?Cr.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(Dr,{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 $C=document.getElementById("root");if(!$C)throw new Error("Expected #root element for web app bootstrap.");Vee();T6.createRoot($C).render(l.jsx(C.StrictMode,{children:l.jsx(Jee,{})}));export{cF as $,On as A,le as B,Sc as C,fn as D,Hie as E,Zie as F,Qie as G,Zne as H,ua as I,Xne as J,Yte as K,Kie as L,bse as M,Xte as N,Gte as O,Zte as P,Wte as Q,Ga as R,sk as S,wn as T,Yne as U,Jte as V,fa as W,nF as X,Ise as Y,Ose as Z,fY as _,yse as a,qi as a$,Kte as a0,xae as a1,jae as a2,wne as a3,bae as a4,Sie as a5,Aie as a6,jie as a7,Ene as a8,Tne as a9,Lg as aA,v9 as aB,x9 as aC,_te as aD,Cte as aE,oae as aF,mae as aG,pae as aH,gn as aI,hae as aJ,mne as aK,aF as aL,hZ as aM,jg as aN,fae as aO,Md as aP,Xie as aQ,Pg as aR,bo as aS,oF as aT,At as aU,QH as aV,Pae as aW,fX as aX,zne as aY,Qte as aZ,Hte as a_,Lne as aa,bn as ab,_ie as ac,Tie as ad,One as ae,Eie as af,Pne as ag,Dne as ah,Ine as ai,Nie as aj,Cie as ak,kie as al,Rne as am,Rie as an,Mie as ao,Iie as ap,Pie as aq,Oie as ar,qie as as,aae as at,E1 as au,Oe as av,zie as aw,tC as ax,Ki as ay,Die as az,lF as b,vte as b$,Tse as b0,Vte as b1,cne as b2,fq as b3,one as b4,Ute as b5,kae as b6,Lte as b7,vF as b8,VF as b9,tie as bA,cie as bB,vie as bC,bie as bD,rie as bE,gie as bF,wie as bG,aie as bH,die as bI,mie as bJ,pie as bK,nie as bL,uie as bM,iie as bN,hie as bO,sie as bP,fie as bQ,lie as bR,yie as bS,xie as bT,nW as bU,oie as bV,ge as bW,Ate as bX,jte as bY,kte as bZ,Ste as b_,Vae as ba,Fae as bb,$ae as bc,nne as bd,ine as be,k$ as bf,sne as bg,EF as bh,Uae as bi,A$ as bj,Sg as bk,ane as bl,YK as bm,Gae as bn,Lae as bo,DF as bp,Kae as bq,gae as br,Hae as bs,nse as bt,ase as bu,qne as bv,YN as bw,Yie as bx,ZN as by,Wae as bz,Nte as c,oW as c$,bte as c0,wte as c1,xte as c2,yte as c3,gte as c4,cte as c5,ute as c6,fte as c7,hte as c8,pte as c9,Aae as cA,Nae as cB,Ane as cC,Nne as cD,_ne as cE,Cne as cF,iu as cG,Mo as cH,PN as cI,Eae as cJ,Tae as cK,WY as cL,Dg as cM,mm as cN,zg as cO,pm as cP,hm as cQ,hX as cR,kF as cS,xo as cT,gm as cU,ZF as cV,pW as cW,Pse as cX,kse as cY,mX as cZ,Sse as c_,dte as ca,mte as cb,lte as cc,rte as cd,ote as ce,ste as cf,e_ as cg,rne as ch,vne as ci,bne as cj,yne as ck,Qne as cl,ZK as cm,_2 as cn,Dm as co,T2 as cp,_s as cq,Yae as cr,Tte as cs,KF as ct,eie as cu,Cae as cv,Fte as cw,wS as cx,kne as cy,jne as cz,rF as d,uae as d$,Qae as d0,Rae as d1,wse as d2,Oae as d3,Dae as d4,F9 as d5,LP as d6,Zae as d7,xse as d8,zae as d9,Une as dA,Vne as dB,$ne as dC,Hne as dD,Gne as dE,z1 as dF,Pc as dG,zse as dH,au as dI,Xae as dJ,Jae as dK,eH as dL,une as dM,dne as dN,Sne as dO,Mne as dP,Bne as dQ,M1 as dR,Ym as dS,I1 as dT,mW as dU,Fne as dV,Gr as dW,kS as dX,iae as dY,rae as dZ,cae as d_,hse as da,wX as db,rH as dc,mF as dd,SX as de,hne as df,fne as dg,pne as dh,uH as di,jse as dj,Ase as dk,Nse as dl,_se as dm,gne as dn,bF as dp,xne as dq,uY as dr,Bie as ds,wH as dt,Kne as du,Uie as dv,Vie as dw,$ie as dx,Lie as dy,wae as dz,Ese as e,sae as e0,lae as e1,dae as e2,Mf as e3,nae as e4,ese as e5,JJ as e6,tne as e7,h1 as e8,_ae as e9,ise as eA,rW as eB,lse as eC,bX as eD,Ete as eE,fse as eF,gse as eG,ose as eH,rse as eI,Rte as eJ,use as eK,pse as eL,cse as eM,mse as eN,Eo as eO,Bte as eP,Ote as eQ,dse as eR,Ite as eS,aP as eT,qte as eU,Pte as eV,Jie as ea,tse as eb,tae as ec,ene as ed,Wne as ee,eae as ef,Jne as eg,Wie as eh,vae as ei,fO as ej,qae as ek,Iae as el,Bae as em,Mae as en,IS as eo,Mte as ep,kw as eq,zte as er,Oj as es,Fi as et,Da as eu,Dte as ev,lm as ew,lne as ex,VQ as ey,sse as ez,nm as f,Cse as g,Rse as h,Dse as i,Ig as j,Vc as k,gY as l,vse as m,PV as n,NK as o,yae as p,Gie as q,Fie as r,Sae as s,sF as t,O1 as u,_a as v,$te as w,J as x,Km as y,ko 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-dGXxZ8IR.js";import"./index-BVzozur0.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-XOUI_75e.js";import"./index-DIA9jvMi.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.
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