@ainyc/canonry 4.182.3 → 4.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -104
- package/assets/agent-workspace/skills/aero/references/orchestration.md +1 -1
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +1 -1
- package/assets/assets/{AuditHistoryPanel-1_FHpzj-.js → AuditHistoryPanel-ClwYugEs.js} +1 -1
- package/assets/assets/{BacklinksPage-045za10_.js → BacklinksPage-DaEn1w9_.js} +1 -1
- package/assets/assets/{HistoryPage-36K_6asu.js → HistoryPage-B4WWIXmx.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-B4DJGoY6.js → MeasurementPropertyPage-DFvelKfS.js} +1 -1
- package/assets/assets/{ProjectPage-CshC68Ne.js → ProjectPage-D3AuGcau.js} +8 -8
- package/assets/assets/{RunRow-U2CN755e.js → RunRow-0HuBq5KN.js} +1 -1
- package/assets/assets/{RunsPage-D0CtU4d-.js → RunsPage-DhdjoIdK.js} +1 -1
- package/assets/assets/{SettingsPage-zMWieTPK.js → SettingsPage-XzHCmYz4.js} +1 -1
- package/assets/assets/{SiteHealthSection-TpQPu_Uj.js → SiteHealthSection-BODUx0bX.js} +3 -3
- package/assets/assets/{TrafficPage-DfLUt-64.js → TrafficPage-2AKICLH_.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-DbjNNWSt.js → TrafficSourceDetailPage-CYVG7qZ0.js} +1 -1
- package/assets/assets/{extract-error-message-CWqz1QPC.js → extract-error-message-CtGLEBMO.js} +1 -1
- package/assets/assets/{index-Brb7M_6G.js → index-B64WXjg8.js} +2 -2
- package/assets/assets/{react-sigma_core.esm.min-Drqprr9L.js → react-sigma_core.esm.min-D5Honb13.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-K45YKXE4.js → chunk-ISONU3FA.js} +5 -3
- package/dist/{chunk-BDJT7XZL.js → chunk-OF3PKBW4.js} +8 -6
- package/dist/{chunk-I3KSOMJA.js → chunk-RQSSKN5F.js} +2 -2
- package/dist/{chunk-FVC7PGYQ.js → chunk-VFQPW2VX.js} +3 -3
- package/dist/{chunk-DY5ZDKQW.js → chunk-Z2HTLTQV.js} +3 -4
- package/dist/cli.js +5 -5
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-HGA553GT.js → intelligence-service-4XQBUFBU.js} +2 -2
- package/dist/mcp.js +3 -3
- package/package.json +13 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SiteHealthSection-BODUx0bX.js","./vendor-tanstack-CYBjbqVr.js","./vendor-lucide-XjCNFK0x.js","./ChartPrimitives-DLEICrrL.js","./vendor-recharts-FA0uySU7.js","./ProjectPage-D3AuGcau.js","./RunRow-0HuBq5KN.js","./extract-error-message-CtGLEBMO.js","./AuditHistoryPanel-ClwYugEs.js","./v2-overview-adapter-COMP5UGt.js","./vendor-radix-BpmvLvpp.js","./vendor-markdown-9tTeP8v7.js","./vendor-yaml-GWJz5H2G.js","./RunsPage-DhdjoIdK.js","./HistoryPage-B4WWIXmx.js","./SettingsPage-XzHCmYz4.js","./BacklinksPage-DaEn1w9_.js","./TrafficPage-2AKICLH_.js","./TrafficSourceDetailPage-CYVG7qZ0.js","./MeasurementPropertyPage-DFvelKfS.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{c as Ij,d as Vj,r as z,j as c,Q as Lj,M as Uj,q as he,e as Mu,L as Xe,a as Gj,t as Do,u as Ot,f as $j,h as va,k as Ps,l as Jv,m as Kj,n as Wv,O as Wp,o as Fi,p as Hj,s as St,v as ex,x as Zi,y as Qj,z as Fj,A as Zj}from"./vendor-tanstack-CYBjbqVr.js";import{S as Yj,O as Eh,P as tx,C as Dh,a as nx,T as Th,D as ax,R as ix}from"./vendor-radix-BpmvLvpp.js";import{c as sx}from"./vendor-recharts-FA0uySU7.js";import{A as Xj,X as Xo,S as Jj,L as Lo,C as Rh,R as eu,a as ox,M as Wj,b as e4,c as t4,d as Oh,T as rx,W as n4,e as Bh,f as lx,g as a4,G as i4,P as s4,H as o4,h as r4,i as l4,j as c4,k as u4,l as d4,B as m4,F as p4,m as h4,n as f4,o as g4,p as Ry,E as y4}from"./vendor-lucide-XjCNFK0x.js";import{M as b4}from"./vendor-markdown-9tTeP8v7.js";import{p as v4}from"./vendor-yaml-GWJz5H2G.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&r(g)}).observe(document,{childList:!0,subtree:!0});function s(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function r(u){if(u.ep)return;u.ep=!0;const f=s(u);fetch(u.href,f)}})();var wp={exports:{}},nl={},Sp={exports:{}},jp={};var Oy;function x4(){return Oy||(Oy=1,(function(e){function a(B,ie){var fe=B.length;B.push(ie);e:for(;0<fe;){var we=fe-1>>>1,ee=B[we];if(0<u(ee,ie))B[we]=ie,B[fe]=ee,fe=we;else break e}}function s(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var ie=B[0],fe=B.pop();if(fe!==ie){B[0]=fe;e:for(var we=0,ee=B.length,qe=ee>>>1;we<qe;){var je=2*(we+1)-1,F=B[je],I=je+1,ue=B[I];if(0>u(F,fe))I<ee&&0>u(ue,F)?(B[we]=ue,B[I]=fe,we=I):(B[we]=F,B[je]=fe,we=je);else if(I<ee&&0>u(ue,fe))B[we]=ue,B[I]=fe,we=I;else break e}}return ie}function u(B,ie){var fe=B.sortIndex-ie.sortIndex;return fe!==0?fe:B.id-ie.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,b=g.now();e.unstable_now=function(){return g.now()-b}}var x=[],k=[],S=1,C=null,j=3,E=!1,J=!1,T=!1,$=!1,U=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function oe(B){for(var ie=s(k);ie!==null;){if(ie.callback===null)r(k);else if(ie.startTime<=B)r(k),ie.sortIndex=ie.expirationTime,a(x,ie);else break;ie=s(k)}}function le(B){if(T=!1,oe(B),!J)if(s(x)!==null)J=!0,re||(re=!0,Ne());else{var ie=s(k);ie!==null&&be(le,ie.startTime-B)}}var re=!1,ne=-1,Q=5,Ae=-1;function Le(){return $?!0:!(e.unstable_now()-Ae<Q)}function Oe(){if($=!1,re){var B=e.unstable_now();Ae=B;var ie=!0;try{e:{J=!1,T&&(T=!1,H(ne),ne=-1),E=!0;var fe=j;try{t:{for(oe(B),C=s(x);C!==null&&!(C.expirationTime>B&&Le());){var we=C.callback;if(typeof we=="function"){C.callback=null,j=C.priorityLevel;var ee=we(C.expirationTime<=B);if(B=e.unstable_now(),typeof ee=="function"){C.callback=ee,oe(B),ie=!0;break t}C===s(x)&&r(x),oe(B)}else r(x);C=s(x)}if(C!==null)ie=!0;else{var qe=s(k);qe!==null&&be(le,qe.startTime-B),ie=!1}}break e}finally{C=null,j=fe,E=!1}ie=void 0}}finally{ie?Ne():re=!1}}}var Ne;if(typeof Z=="function")Ne=function(){Z(Oe)};else if(typeof MessageChannel<"u"){var _e=new MessageChannel,tt=_e.port2;_e.port1.onmessage=Oe,Ne=function(){tt.postMessage(null)}}else Ne=function(){U(Oe,0)};function be(B,ie){ne=U(function(){B(e.unstable_now())},ie)}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"):Q=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return j},e.unstable_next=function(B){switch(j){case 1:case 2:case 3:var ie=3;break;default:ie=j}var fe=j;j=ie;try{return B()}finally{j=fe}},e.unstable_requestPaint=function(){$=!0},e.unstable_runWithPriority=function(B,ie){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var fe=j;j=B;try{return ie()}finally{j=fe}},e.unstable_scheduleCallback=function(B,ie,fe){var we=e.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?we+fe:we):fe=we,B){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=fe+ee,B={id:S++,callback:ie,priorityLevel:B,startTime:fe,expirationTime:ee,sortIndex:-1},fe>we?(B.sortIndex=fe,a(k,B),s(x)===null&&B===s(k)&&(T?(H(ne),ne=-1):T=!0,be(le,fe-we))):(B.sortIndex=ee,a(x,B),J||E||(J=!0,re||(re=!0,Ne()))),B},e.unstable_shouldYield=Le,e.unstable_wrapCallback=function(B){var ie=j;return function(){var fe=j;j=ie;try{return B.apply(this,arguments)}finally{j=fe}}}})(jp)),jp}var By;function k4(){return By||(By=1,Sp.exports=x4()),Sp.exports}var qy;function w4(){if(qy)return nl;qy=1;var e=k4(),a=Ij(),s=Vj();function r(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+n+" 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 f(t){var n=t,i=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(i=n.return),t=n.return;while(t)}return n.tag===3?i:null}function g(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function b(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function x(t){if(f(t)!==t)throw Error(r(188))}function k(t){var n=t.alternate;if(!n){if(n=f(t),n===null)throw Error(r(188));return n!==t?null:t}for(var i=t,l=n;;){var m=i.return;if(m===null)break;var h=m.alternate;if(h===null){if(l=m.return,l!==null){i=l;continue}break}if(m.child===h.child){for(h=m.child;h;){if(h===i)return x(m),t;if(h===l)return x(m),n;h=h.sibling}throw Error(r(188))}if(i.return!==l.return)i=m,l=h;else{for(var v=!1,w=m.child;w;){if(w===i){v=!0,i=m,l=h;break}if(w===l){v=!0,l=m,i=h;break}w=w.sibling}if(!v){for(w=h.child;w;){if(w===i){v=!0,i=h,l=m;break}if(w===l){v=!0,l=h,i=m;break}w=w.sibling}if(!v)throw Error(r(189))}}if(i.alternate!==l)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:n}function S(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=S(t),n!==null)return n;t=t.sibling}return null}var C=Object.assign,j=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),J=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),oe=Symbol.for("react.forward_ref"),le=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),Ae=Symbol.for("react.activity"),Le=Symbol.for("react.memo_cache_sentinel"),Oe=Symbol.iterator;function Ne(t){return t===null||typeof t!="object"?null:(t=Oe&&t[Oe]||t["@@iterator"],typeof t=="function"?t:null)}var _e=Symbol.for("react.client.reference");function tt(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===_e?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case U:return"Profiler";case $:return"StrictMode";case le:return"Suspense";case re:return"SuspenseList";case Ae:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case J:return"Portal";case Z:return t.displayName||"Context";case H:return(t._context.displayName||"Context")+".Consumer";case oe:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ne:return n=t.displayName||null,n!==null?n:tt(t.type)||"Memo";case Q:n=t._payload,t=t._init;try{return tt(t(n))}catch{}}return null}var be=Array.isArray,B=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},we=[],ee=-1;function qe(t){return{current:t}}function je(t){0>ee||(t.current=we[ee],we[ee]=null,ee--)}function F(t,n){ee++,we[ee]=t.current,t.current=n}var I=qe(null),ue=qe(null),G=qe(null),ce=qe(null);function Ve(t,n){switch(F(G,n),F(ue,t),F(I,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?ny(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=ny(n),t=ay(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}je(I),F(I,t)}function Y(){je(I),je(ue),je(G)}function De(t){t.memoizedState!==null&&F(ce,t);var n=I.current,i=ay(n,t.type);n!==i&&(F(ue,t),F(I,i))}function Pe(t){ue.current===t&&(je(I),je(ue)),ce.current===t&&(je(ce),Jr._currentValue=fe)}var Te,Bt;function rt(t){if(Te===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Te=n&&n[1]||"",Bt=-1<i.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Te+t+Bt}var Sa=!1;function ui(t,n){if(!t||Sa)return"";Sa=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(K){var V=K}Reflect.construct(t,[],se)}else{try{se.call()}catch(K){V=K}t.call(se.prototype)}}else{try{throw Error()}catch(K){V=K}(se=t())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(K){if(K&&V&&typeof K.stack=="string")return[K.stack,V.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),v=h[0],w=h[1];if(v&&w){var _=v.split(`
|
|
@@ -83,4 +83,4 @@ spec:
|
|
|
83
83
|
`);ct(Be),$s(!0)}}catch(L){Vl(L instanceof Error?L.message:"Failed to generate queries"),U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.blocked",step:"queries",action:"generate_queries",reasonCode:fl(L,"unknown")},"onboarding.blocked:queries:generate")}finally{Hs(!1)}}},Sd=async()=>{if(!Te)return;const L=_a;if(L.length!==0){Dt(!0),fi(null);try{await lC(Te,L),hi(!0),await r(),U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.step_completed",step:"competitors",method:"manual",countBucket:Oa(L.length)},"onboarding.step_completed:competitors"),B(4)}catch(Be){fi(Be instanceof Error?Be.message:"Failed to save competitors"),U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.blocked",step:"competitors",action:"save",reasonCode:"unknown"},"onboarding.blocked:competitors:save")}finally{Dt(!1)}}},Js=async()=>{const L=hr.trim();if(L){ls(!0),cn(null);try{await Tx("gemini",{apiKey:L}),nn({title:"Gemini configured",detail:"Provider is ready — continuing setup.",tone:"positive",dedupeKey:"setup:gemini:configured",dedupeMode:"drop"}),Ys(""),await r(),Ia(b.providerStatuses.find(Be=>Be.name.toLowerCase()==="gemini")?.name??"gemini"),U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.step_completed",step:"system",method:"inline"},"onboarding.step_completed:system")}catch(Be){cn(Be instanceof Error?Be.message:"Failed to save Gemini key"),U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.blocked",step:"system",action:"configure_provider",reasonCode:"provider_save_failed"},"onboarding.blocked:system:provider_save_failed")}finally{ls(!1)}}},Qn=async()=>{if(!Te||kn){gi(kn??"Complete setup before launching the first sweep.");const L=Bn??(Te?Hn===0?"no_queries":"run_rejected":"unknown");sn||U({flowVersion:nt,onboardingSessionId:T,event:"run.requested",origin:"dashboard_setup",result:"rejected",providerCountBucket:Oa(di),queryCountBucket:Oa(Hn),reasonCode:L});return}pr(!0),gi(null);try{const L=await xn.mutateAsync({projectName:Te,projectLabel:je||ee||Te,sourceAction:"setup-launch"});ca(L.id),xd(!0),z3(Te,L.id),Aa.current=L.id,sn||U({flowVersion:nt,onboardingSessionId:T,event:"run.requested",origin:"dashboard_setup",result:"queued",providerCountBucket:Oa(di),queryCountBucket:Oa(Hn)}),await r()}catch(L){gi(L instanceof Error?L.message:"Failed to queue the visibility sweep. Retry when the instance is ready."),sn||U({flowVersion:nt,onboardingSessionId:T,event:"run.requested",origin:"dashboard_setup",result:"rejected",providerCountBucket:Oa(di),queryCountBucket:Oa(Hn),reasonCode:fl(L,"run_rejected")})}finally{pr(!1)}},Fn=()=>B(L=>j?2:Math.max(0,L-1)),us=(L,Be,un)=>{U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.step_completed",step:L,method:"existing",...un===void 0?{}:{countBucket:Oa(un)}},`onboarding.step_completed:${L}`),B(Be)},yi=()=>{if(U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.step_completed",step:"queries",method:"skipped",countBucket:"0"},"onboarding.step_completed:queries"),j){yn();return}B(3)},bi=()=>{U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.step_completed",step:"competitors",method:"skipped",countBucket:"0"},"onboarding.step_completed:competitors"),B(4)},Ql=j?"section":ia,Ws=Ut!==!0||Ma===!0?c.jsx(ge,{type:"button",variant:"ghost",size:"sm",className:"min-h-11",onClick:()=>{r(),Yt&&Ks.refetch()},children:"Check again"}):null,Fl=(Ut===!1||is)&&!!vn,ds=j&&(be===2||be===4)?x?c.jsxs("section",{"aria-labelledby":"setup-provider-heading",className:"space-y-3 border-b border-default pb-6 mb-6",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx("h2",{id:"setup-provider-heading",className:"text-lg font-semibold text-heading",children:Ut===!1?"Connect a provider":"Answer engine provider"}),c.jsx(rn,{tone:Ut===!0?"positive":"neutral",children:Ut===!0?"Configured":Ut===!1?"Not connected":"Checking"})]}),c.jsx("p",{className:"max-w-prose text-sm text-secondary",children:Ut===!0?Tn.length>0?`${Tn.map(L=>L.displayName??L.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.":Ut===!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."}),Ut===!1||is?vn?c.jsx("div",{children:c.jsx(JU,{compact:!0,leadingField:c.jsxs("div",{className:"min-w-0 space-y-1.5",children:[c.jsx("label",{className:"block text-sm font-medium text-secondary",htmlFor:"setup-provider",children:"Provider to connect"}),c.jsx("select",{ref:ur,id:"setup-provider",className:"setup-input",value:vn.name,onChange:L=>{L.target.value!==vn.name&&(Qs.current=document.activeElement===L.currentTarget,Ul(L.target.value))},children:la.map(L=>c.jsx("option",{value:L.name,children:L.displayName??L.name},L.name))})]}),secondaryActions:Ws,providerName:vn.name,keyUrl:vn.keyUrl,modelHint:vn.modelHint,onSaved:()=>{dr(!1),r()}},vn.name)}):c.jsx("p",{className:"max-w-prose text-sm text-secondary",children:Kn.length>0?`This project's provider selection is ${Kn.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,c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Ut===!0&&!is&&vn?c.jsx(ge,{type:"button",variant:"outline",size:"sm",onClick:()=>dr(!0),children:"Configure a provider"}):null,!vn||Ma===!0?c.jsx(ge,{type:"button",variant:"outline",size:"sm",asChild:!0,children:c.jsx(Xe,{to:"/settings",target:"_blank",rel:"noopener noreferrer",children:"Open provider settings"})}):null,Fl?null:Ws]})]}):c.jsxs("section",{"aria-labelledby":"setup-provider-heading",className:"space-y-2 border-b border-default pb-6 mb-6",children:[c.jsx("h2",{id:"setup-provider-heading",className:"text-lg font-semibold text-heading",children:"Answer engine provider"}),c.jsx("p",{className:"max-w-prose text-sm text-secondary",children:"Provider settings are managed by an administrator."}),lr?c.jsx("p",{role:"alert",className:"text-sm text-negative",children:"Provider readiness could not be checked. Try again."}):c.jsx("p",{className:"max-w-prose text-sm text-secondary",role:"status",children:Ut===!0?"An answer engine is available for this project.":Ut===!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."}),c.jsx(ge,{type:"button",variant:"ghost",size:"sm",className:"min-h-11",disabled:_t.isFetching,onClick:()=>{_t.refetch()},children:lr?"Retry provider check":"Check again"})]}):null,da=(()=>{switch(be){case 0:return c.jsxs(ia,{className:"surface-card step-card",children:[c.jsx("div",{className:"section-head",children:c.jsxs("div",{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 1 of 5"}),c.jsx("h2",{children:"System check"})]})}),c.jsx("p",{className:"supporting-copy",children:"Checking that your Canonry instance is configured and reachable."}),c.jsx("div",{className:"compact-stack",children:C.healthChecks.map(L=>c.jsxs("div",{className:"health-check-row",children:[c.jsxs("div",{children:[c.jsx("p",{className:"run-row-title",children:L.label}),c.jsx("p",{className:"supporting-copy",children:L.detail}),L.id==="provider"&&L.state!=="ready"&&c.jsxs("div",{className:"mt-3 rounded-md border border-default bg-bg-elevated/40 p-3 space-y-2",children:[c.jsxs("p",{className:"text-xs text-secondary",children:["Paste a Gemini key to enable visibility checks (free at"," ",c.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"}),")."]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"password",value:hr,onChange:Be=>Ys(Be.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:Xs}),c.jsx(ge,{type:"button",size:"sm",disabled:Xs||!hr.trim(),onClick:Kt(Js),children:Xs?"Saving...":"Save"})]}),Kl&&c.jsxs("div",{role:"alert",className:"space-y-1 text-xs text-negative",children:[c.jsx("p",{children:Kl}),c.jsx("p",{children:"Check that the key is complete, then retry Save."})]}),c.jsxs("p",{className:"text-sm text-secondary",children:["Connect more answer engines later in"," ",c.jsx(Xe,{to:"/settings",className:"text-link hover:underline",children:"Settings"}),"."]})]})]}),c.jsx(rn,{tone:L.state==="ready"?"positive":"caution",title:L.id==="api"?Zo(S.apiStatus):L.id==="worker"?Zo(S.workerStatus):L.detail,children:L.state==="ready"?"Ready":"Attention"})]},L.id))}),c.jsxs("div",{className:"setup-nav",children:[C.launchState.blockedReason?c.jsx("p",{role:"status",className:"supporting-copy text-negative",children:C.launchState.blockedReason}):c.jsx("span",{}),c.jsx(ge,{type:"button",disabled:!C.launchState.enabled,title:C.launchState.blockedReason,onClick:()=>{U({flowVersion:nt,onboardingSessionId:T,event:"onboarding.step_completed",step:"system",method:"automatic"},"onboarding.step_completed:system"),B(tt)},children:"Continue"})]})]});case 1:return c.jsxs(ia,{className:"surface-card step-card",children:[c.jsxs("div",{className:"section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 2 of 5"}),c.jsx("h2",{children:"Create project"})]}),Te?c.jsx(rn,{tone:"positive",children:"Created"}):null]}),Te?c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"text-neutral",children:["Project ",c.jsx("span",{className:"text-heading font-medium",children:Te})," created successfully."]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsx(ge,{type:"button",onClick:()=>us("project",2),children:"Continue"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"project-name",children:"Project name"}),c.jsx("input",{id:"project-name",className:"setup-input",type:"text",placeholder:"my-website",value:ee,onChange:L=>qe(L.target.value)}),ua&&ua!==ee?c.jsxs("p",{className:"supporting-copy",children:["Slug: ",ua]}):null]}),c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"display-name",children:"Display name (optional)"}),c.jsx("input",{id:"display-name",className:"setup-input",type:"text",placeholder:"My Website",value:je,onChange:L=>F(L.target.value)})]}),c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"domain",children:"Canonical domain"}),c.jsx("input",{id:"domain",className:"setup-input",type:"text",placeholder:"example.com",value:I,onChange:L=>ue(L.target.value)})]}),c.jsxs("div",{className:"setup-field-row",children:[c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"country",children:"Country"}),c.jsx("input",{id:"country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:G,onChange:L=>ce(L.target.value.toUpperCase())})]}),c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"language",children:"Language"}),c.jsx("input",{id:"language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:Ve,onChange:L=>Y(L.target.value.toLowerCase())})]})]}),c.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-default bg-surface p-3 cursor-pointer hover:border-strong",children:[c.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 rounded border-strong bg-bg",checked:De,onChange:L=>Pe(L.target.checked)}),c.jsxs("span",{className:"flex-1",children:[c.jsx("span",{className:"block text-sm text-heading",children:"Auto-extract backlinks"}),c.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."," ",c.jsx(Xe,{to:"/backlinks",className:"text-positive-400 hover:text-positive underline underline-offset-2",children:"Manage backlinks"})]})]})]}),rt?c.jsx("p",{className:"text-negative-400 text-sm",children:rt}):null,c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsx(ge,{type:"button",disabled:!ua||!I||ui,onClick:Kt(Hl),children:ui?"Creating...":"Create project"})]})]})]});case 2:return c.jsxs(Ql,{className:j?"visibility-setup-section step-card":"surface-card step-card","aria-labelledby":"setup-queries-heading",children:[c.jsxs("div",{className:"section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:j?"Step 1 of 2":"Step 3 of 5"}),c.jsx("h2",{id:"setup-queries-heading",children:"Add queries"})]}),we?c.jsx(rn,{tone:"neutral",children:"Loading"}):re.isError?c.jsx(rn,{tone:"negative",children:"Load failed"}):Zt?c.jsxs(rn,{tone:"positive",children:[On.length," saved"]}):c.jsxs(rn,{tone:"neutral",children:[On.length," quer",On.length!==1?"ies":"y"]})]}),c.jsx("p",{className:"supporting-copy",children:"Add the queries your customers use, one per line. You can refine your list later."}),c.jsxs("div",{className:"space-y-2 border-b border-default pb-4",children:[c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[c.jsxs("div",{className:"min-w-0 space-y-1",children:[c.jsx("h3",{className:"text-sm font-semibold text-heading",children:"Research queries with your agent"}),c.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."})]}),c.jsx(ge,{type:"button",variant:"outline",size:"sm",className:"min-h-11 shrink-0 self-start",onClick:Kt(bd),children:Gl?"Research prompt copied":"Copy research prompt"})]}),c.jsxs("details",{open:qt||void 0,className:"text-sm text-secondary",children:[c.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-link",children:"View agent prompt"}),c.jsx("textarea",{"aria-label":"Agent query research prompt",readOnly:!0,className:"setup-textarea mt-2 w-full",rows:8,value:$l})]}),qt?c.jsx("p",{role:"alert",className:"text-sm text-negative",children:"Could not copy. Select and copy the prompt above."}):null]}),we?c.jsx("div",{className:"rounded-md border border-default bg-bg-elevated/40 p-4 text-sm text-secondary",role:"status",children:"Loading saved queries…"}):re.isError?c.jsxs("div",{className:"compact-stack",children:[c.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."}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:j?yn:Fn,children:"Back"}),c.jsx(ge,{type:"button",onClick:()=>{re.refetch()},children:"Retry loading queries"})]})]}):Zt?c.jsxs("div",{className:"compact-stack",children:[c.jsx("ul",{className:"detail-list",children:On.map(L=>c.jsx("li",{children:L},L))}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:j?yn:Fn,children:"Back"}),c.jsx(ge,{type:"button",variant:"outline",onClick:()=>ns(!1),children:"Edit queries"}),c.jsx(ge,{type:"button",onClick:()=>us("queries",j?4:3,On.length),children:"Continue"})]})]}):c.jsxs("div",{className:"compact-stack",children:[Tn.length>0?c.jsxs("div",{className:"compact-stack",children:[c.jsxs("div",{className:"flex items-center gap-2 text-muted text-xs uppercase tracking-wide",children:[c.jsx("span",{className:"flex-1 border-t border-base"}),"auto-generate",c.jsx("span",{className:"flex-1 border-t border-base"})]}),c.jsxs("div",{className:"flex items-end gap-2",children:[c.jsxs("div",{className:"setup-field flex-1",children:[c.jsx("label",{className:"setup-label",htmlFor:"gen-provider",children:"Provider"}),c.jsx("select",{id:"gen-provider",className:"setup-input",value:bn,onChange:L=>Ia(L.target.value),children:Tn.map(L=>c.jsxs("option",{value:L.name,children:[L.displayName??L.name,L.model?` (${L.model})`:""]},L.name))})]}),c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"gen-count",children:"Count"}),c.jsx("select",{id:"gen-count",className:"setup-input",value:mi,onChange:L=>yd(Number(L.target.value)),children:[3,5,10,15,20].map(L=>c.jsx("option",{value:L,children:L},L))})]}),c.jsx(ge,{type:"button",variant:"outline",disabled:cr||!bn,onClick:Kt(wd),children:cr?"Analyzing site...":"Generate"})]}),pi?c.jsx("p",{className:"text-negative-400 text-sm",children:pi}):null]}):null,j?null:c.jsxs("div",{className:"flex items-center gap-2 text-muted text-xs uppercase tracking-wide",children:[c.jsx("span",{className:"flex-1 border-t border-base"}),"or type manually",c.jsx("span",{className:"flex-1 border-t border-base"})]}),c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"queries",children:"Queries (one per line)"}),c.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:Me,onChange:L=>ct(L.target.value)})]}),Bl?c.jsx("p",{className:"text-negative-400 text-sm",children:Bl}):null,c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:j?yn:Fn,children:"Back"}),c.jsx(ge,{type:"button",variant:"ghost",onClick:yi,children:j?"Finish without AI Visibility":"Skip for now"}),c.jsx(ge,{type:"button",disabled:On.length===0||ql,onClick:Kt(fr),children:ql?"Saving...":`Save ${On.length} quer${On.length!==1?"ies":"y"}`})]})]})]});case 3:return c.jsxs(ia,{className:"surface-card step-card",children:[c.jsxs("div",{className:"section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 4 of 5"}),c.jsx("h2",{children:"Add competitors"})]}),Fs?c.jsx(rn,{tone:"positive",children:"Saved"}):null]}),c.jsx("p",{className:"supporting-copy",children:"Domains that compete for the same queries. One per line."}),Fs?c.jsxs("div",{className:"compact-stack",children:[c.jsx("ul",{className:"detail-list",children:_a.map(L=>c.jsx("li",{children:L},L))}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsx(ge,{type:"button",onClick:()=>us("competitors",4,_a.length),children:"Continue"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsxs("div",{className:"setup-field",children:[c.jsx("label",{className:"setup-label",htmlFor:"competitors",children:"Competitor domains (one per line)"}),c.jsx("textarea",{id:"competitors",className:"setup-textarea",rows:4,placeholder:`competitor1.com
|
|
86
|
-
competitor2.com`,value:mr,onChange:L=>ss(L.target.value)})]}),Va?c.jsx("p",{className:"text-negative-400 text-sm",children:Va}):null,c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:bi,children:"Skip"}),c.jsx(ge,{type:"button",disabled:_a.length===0||La,onClick:Kt(Sd),children:La?"Saving...":`Save ${_a.length} competitor${_a.length!==1?"s":""}`})]})]})]})]});case 4:{const L=Na.data,Be=L?.status??(Ca===Le?.id?Le.status:void 0),un=Be==="completed"||Be==="partial"||Be==="failed"||Be==="cancelled",za=L?.snapshots??[],eo=za.filter(Zn=>Zn.citationState==="cited").length,Zl=za.filter(Zn=>Zn.answerMentioned===!0).length,ms=new Set(za.map(Zn=>Zn.query).filter(Zn=>!!Zn)).size,ps=Be?Qv(Be,za.length):!1,gr=Oe&&!Rn,on=rs??(L?.error?oM(L.error):Be==="cancelled"?"The sweep was cancelled before it produced a baseline.":(Be==="completed"||Be==="partial")&&za.length===0?"The sweep finished without producing any snapshots. Confirm the query set and provider configuration, then retry.":Le?.statusDetail||"The sweep did not produce a baseline. Review provider configuration, then retry.");let qn=null;return gr||ps?qn=c.jsx(rn,{tone:"positive",children:"Complete"}):rs&&!Rn?qn=c.jsx(rn,{tone:"negative",children:"Failed"}):un?qn=c.jsx(rn,{tone:"negative",children:Be==="cancelled"?"Cancelled":"Failed"}):Rn&&(qn=c.jsx(rn,{tone:"caution",children:"Running"})),c.jsxs(ia,{className:"surface-card step-card",children:[c.jsxs("div",{className:"section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:j?"Step 2 of 2":"Step 5 of 5"}),c.jsx("h2",{children:"Launch first run"})]}),qn]}),gr?c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"text-secondary",children:["Setup is complete. ",c.jsx("span",{className:"text-strong font-medium",children:Te})," already has a successful answer-visibility baseline."]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx("span",{}),c.jsx(ge,{type:"button",onClick:yn,children:g?"Finish and open project":"Open project dashboard →"})]})]}):Rn?un?ps?c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"text-neutral",children:["Sweep complete. Your first answer-visibility snapshot for"," ",c.jsx("span",{className:"text-heading font-medium",children:Te}),":"]}),c.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-1",children:[c.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[c.jsx("p",{className:"text-xs font-medium text-secondary",children:"Mentioned"}),c.jsxs("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:[Zl,c.jsxs("span",{className:"text-faint text-lg",children:[" / ",ms]})]}),c.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries naming your brand"})]}),c.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[c.jsx("p",{className:"text-xs font-medium text-secondary",children:"Cited"}),c.jsxs("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:[eo,c.jsxs("span",{className:"text-faint text-lg",children:[" / ",ms]})]}),c.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries citing your site"})]}),c.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[c.jsx("p",{className:"text-xs font-medium text-secondary",children:"Results"}),c.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:za.length}),c.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"completed engine checks"})]})]}),c.jsx("p",{className:"mt-1 text-sm text-secondary",children:g?"Your project is ready. Review the evidence in the project.":"Open the project to review the evidence."}),c.jsxs("div",{className:"setup-nav",children:[c.jsx("span",{}),c.jsx(ge,{type:"button",onClick:yn,children:g?"Finish and open project":"Open project dashboard →"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[c.jsx("p",{children:on}),c.jsx("p",{className:"mt-1 text-xs text-secondary",children:"Fix provider or query configuration if needed, then retry without leaving setup."})]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",asChild:!0,children:c.jsx(Xe,{to:"/settings",children:"Configure providers"})}),c.jsx(ge,{type:"button",disabled:os||!!kn,onClick:Kt(Qn),children:os?"Retrying...":"Retry visibility sweep"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsx("p",{className:"text-neutral",children:"Sweep running. This usually takes 30 to 60 seconds."}),c.jsx("div",{className:"rounded-md border border-default bg-surface p-3 text-xs text-muted",children:c.jsxs("p",{children:["Status: ",c.jsx("span",{className:"text-neutral",children:Be??"queued"})]})}),Na.isError&&c.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[c.jsx("p",{children:Na.error instanceof Error?Na.error.message:"Could not refresh the sweep status."}),c.jsx(ge,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{Na.refetch()},children:"Retry status check"})]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx("span",{}),c.jsx(ge,{type:"button",variant:"outline",onClick:yn,children:g?"Finish and open project":"Watch on project page"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"supporting-copy",children:["Your queries are saved. Run a first sweep to get a baseline for"," ",c.jsx("span",{className:"text-heading font-medium",children:Te}),", or finish and run it later from the project. A sweep calls the answer engines, so it costs provider usage."]}),(kn||rs)&&c.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[c.jsx("p",{children:rs??kn}),c.jsx("p",{className:"mt-1 text-xs text-secondary",children:"Resolve the blocker above, then retry the sweep here."})]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsx(ge,{type:"button",variant:"ghost",onClick:yn,children:"Finish without running"}),Bn==="no_provider"&&!j?c.jsx(ge,{type:"button",asChild:!0,children:c.jsx(Xe,{to:"/settings",children:"Configure a provider"})}):c.jsx(ge,{type:"button",disabled:os||!!kn,title:kn,onClick:Kt(Qn),children:os?"Launching...":rs?"Retry visibility sweep":"Launch visibility sweep"})]})]})]})}default:return null}})();return c.jsxs("div",{className:j?"page-container visibility-setup":"page-container",children:[g?c.jsx(Yo,{current:"visibility"}):null,c.jsxs("div",{className:"page-header",children:[c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{ref:u?f:void 0,tabIndex:u?-1:void 0,className:"page-title",children:u?"Set up AI Visibility":"Setup"}),c.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."})]}),g?c.jsx("div",{className:"page-header-right",children:c.jsx(ge,{type:"button",variant:"outline",className:"min-h-11",onClick:yn,children:"Skip AI Visibility"})}):null]}),g?null:c.jsx(aG,{current:j?be===4?1:0:be,labels:j?tG:eG}),c.jsxs("section",{className:"setup-wizard",children:[ds,da]})]})}const oG=z.lazy(async()=>({default:(await ci(()=>import("./SiteHealthSection-TpQPu_Uj.js").then(a=>a.d),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).SiteHealthSection})),rG=1800,lG="https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent",cG="Help me set up Canonry for my public site.\n\nUse Canonry's official 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\nUse an existing Canonry installation or connected plugin/MCP if one is already available. Do not create a duplicate. The `cnry` and `canonry` commands are interchangeable.\n\n1. Ask for my public domain, country, and language. Do not create or scan anything yet.\n2. Check the local setup with `command -v cnry`, `cnry --version`, `cnry doctor --format json`, and `cnry project list --format json`. If Canonry is missing, propose `npm install -g @canonry/canonry` and wait for approval. If initialization is required, tell me to run `cnry bootstrap` in my private terminal and wait. Never ask me to paste passwords, API keys, OAuth credentials, or `cnry bootstrap` output.\n3. Show the normalized domain, proposed project name, exact `cnry project create ...` command, and wait for explicit approval before creating it.\n4. Propose a bounded Site Health scan, including `--max-pages` and whether dead-link checking is enabled. Show the exact `cnry technical-aeo run ... --wait --format json` command and wait for separate approval before scanning.\n5. After the crawl, summarize the findings and propose AI Visibility setup. Ask before adding queries, connecting providers, starting any provider-backed or quota-consuming run, editing files, or publishing.";function uG(e,a){return e==="legacy"?"legacy":e==="platform"?"platform":a.state==="success"?a.projectCount===0?"platform":"legacy":a.state==="error"?"retry":"loading"}const R3=[{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"}],O3=[{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 dG(e,a){try{const s=new Intl.DisplayNames(["en"],{type:"region"}),r=new Intl.DisplayNames(["en"],{type:"language"}),u=e.length===2?s.of(e.toUpperCase()):void 0,f=a?r.of(a.toLowerCase()):void 0;return`${u??(e||"Country")} · ${f??(a||"Language")}`}catch{return`${e||"Country"} · ${a||"Language"}`}}function mG(e,a){const s=e.trim().toUpperCase(),r=a.trim().toLowerCase();return{countryValid:R3.some(u=>u.value===s),languageValid:O3.some(u=>u.value===r)}}function pG(e){const a=e.replace(/^\[|\]$/g,"");return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(a)||a.includes(":")}function hG(e){const a=e.trim();if(!a)return null;const s=/^[a-z][a-z\d+.-]*:\/\//i.test(a)?a:`https://${a}`;let r;try{r=new URL(s)}catch{return null}if(r.protocol!=="http:"&&r.protocol!=="https:")return null;const u=r.hostname.toLowerCase().replace(/^www\./,"");if(!u||u==="localhost"||pG(u)||!u.includes("."))return null;const f=u.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return f?{canonicalDomain:u,projectName:f,displayName:u}:null}async function fG(e,a=rG){let s;const r=new Promise(f=>{s=setTimeout(()=>f({state:"timed-out"}),a)}),u=await Promise.race([e.then(f=>({state:"queued",run:f})),r]);return s&&clearTimeout(s),u}function gG(e,a){e.catch(()=>{nn({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:${a}`})})}function B3(e){const a=z.useRef(C3()).current,s=z.useRef(new Set),r=z.useCallback((u,f)=>{if(f){if(s.current.has(f))return;s.current.add(f)}Rx({...u,surface:e,eventId:N3()})},[e]);return{onboardingSessionId:a,emit:r}}function Yv(e,a){return e instanceof hn&&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:a}function yG(){return c.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Preparing setup"}),c.jsx("p",{className:"page-subtitle",children:"Checking the projects already on this install."})]})}),c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-default bg-surface p-4 text-sm text-secondary",role:"status",children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading projects…"]})]})}function bG({onRetry:e}){return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Can’t load projects"}),c.jsx("p",{className:"page-subtitle",children:"Canonry could not confirm whether this install already has a project."})]})}),c.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[c.jsx("p",{className:"text-sm font-medium text-heading",children:"Setup is paused to protect existing projects."}),c.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),c.jsx(ge,{type:"button",className:"mt-4",variant:"secondary",onClick:e,children:"Retry project check"})]})]})}function vG({projectName:e,initialRunId:a}){return c.jsx(af,{title:"Site Health setup",children:c.jsx(xG,{projectName:e,initialRunId:a})})}function xG({projectName:e,initialRunId:a}){const s=Ps(),r=Ot({...Vs({client:ae}),enabled:!!e,retry:!1,refetchOnMount:"always"}),{onboardingSessionId:u,emit:f}=B3("site_health");z.useEffect(()=>{e&&f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.started",step:"run",resumed:!!a},"onboarding.started")},[f,a,u,e]),z.useEffect(()=>{!e||!a||E3(e)?.runId!==a&&z3(e,a)},[a,e]);const b=Ot({...K0({client:ae,path:{id:a??""}}),enabled:!!a,refetchInterval:({state:j})=>{const E=j.data?.status;return E==="completed"||E==="partial"||E==="failed"||E==="cancelled"?!1:2e3},refetchIntervalInBackground:!0}).data?.status;if(z.useEffect(()=>{if(!e||!a||!b)return;if(b==="completed"||b==="partial"){f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"automatic"},"onboarding.step_completed:run"),qu(a);return}if(b!=="failed"&&b!=="cancelled")return;const j=b==="cancelled"?"run_cancelled":"run_failed";f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:j},`onboarding.blocked:run:${j}`),qu(a)},[f,a,u,e,b]),!e)return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Project not found"}),c.jsx("p",{className:"page-subtitle",children:"This setup link does not identify a project."})]})}),c.jsx(ge,{type:"button",variant:"secondary",onClick:()=>{s({to:"/projects"})},children:"View projects"})]});if(r.isPending)return c.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[c.jsx(Yo,{current:"site"}),c.jsxs("div",{className:"mt-8 flex items-center gap-3 text-sm text-secondary",role:"status",children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health setup…"]})]});if(r.isError)return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Can’t resume setup"}),c.jsx("p",{className:"page-subtitle",children:"Canonry could not load the project for this Site Health scan."})]})}),c.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",children:[c.jsx("p",{className:"text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),c.jsx(ge,{type:"button",className:"mt-4",variant:"secondary",onClick:()=>{r.refetch()},children:"Retry project check"})]})]});const x=r.data.find(j=>j.name===e);if(!x)return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Project not found"}),c.jsxs("p",{className:"page-subtitle",children:["Canonry could not find ",e,". It will not open a different project."]})]})}),c.jsx(ge,{type:"button",variant:"secondary",onClick:()=>{s({to:"/projects"})},children:"View projects"})]});const k=()=>{s({to:"/setup",search:{onboarding:"site-health",setupProject:x.name},replace:!0})},S=()=>{s({to:"/setup",search:{experience:"legacy",onboarding:"site-health",setupProject:x.name},replace:!0})},C=()=>{f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"skipped"},"onboarding.step_completed:run"),s({to:"/projects/$projectName/technical-aeo",params:{projectName:x.name},replace:!0})};return c.jsxs("div",{className:"page-container max-w-7xl py-8 md:py-10",children:[c.jsx("h1",{className:"sr-only",children:"Set up Canonry"}),c.jsx(z.Suspense,{fallback:c.jsxs("div",{className:"space-y-5",children:[c.jsx(Yo,{current:"site"}),c.jsxs("div",{className:"flex min-h-72 items-center justify-center gap-3 text-sm text-secondary",role:"status",children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health…"]})]}),children:c.jsx(oG,{projectName:x.name,projectId:x.id,initialRunId:a,onReleaseInitialRun:k,showOnboardingActions:!0,onContinueOnboarding:S,onSkipOnboarding:C})})]})}function kG(){const e=Jv({from:"/setup"}),a=e.onboarding==="site-health"&&!e.setupProject,s=e.onboarding==="site-health"&&e.experience!=="legacy",r=V6(),u=e.experience==="legacy"?"legacy":e.experience==="platform"?"platform":r,[f,g]=z.useState(!1),b=Ot({...Vs({client:ae}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),x=u==="auto"&&b.isSuccess&&b.isFetchedAfterMount&&b.data.length===0;z.useEffect(()=>{x&&g(!0)},[x]);const k=u!=="auto"?{state:"idle"}:b.isSuccess&&b.isFetchedAfterMount?{state:"success",projectCount:b.data.length}:b.isError?{state:"error"}:{state:"loading"},S=u==="legacy"?"legacy":f||x?"platform":uG(u,k);return a||s?c.jsx(vG,{projectName:e.setupProject,initialRunId:e.siteHealthRunId}):S==="legacy"?c.jsx(iG,{visibilityProjectName:e.setupProject,siteHealthOnboarding:e.onboarding==="site-health"}):S==="loading"?c.jsx(yG,{}):S==="retry"?c.jsx(bG,{onRetry:()=>{b.refetch()}}):c.jsx(wG,{onActivationStarted:()=>g(!0),skipSiteScan:e.siteScan==="skip"})}function wG({onActivationStarted:e,skipSiteScan:a}){return c.jsx(af,{title:"Site Health setup",children:c.jsx(SG,{onActivationStarted:e,skipSiteScan:a})})}function SG({onActivationStarted:e,skipSiteScan:a}){const s=Ps(),r=va(),u=XU(),f=Ot({...IM({client:ae}),retry:!1}),g=Fi(VM()),[b,x]=z.useState(""),[k,S]=z.useState(""),[C,j]=z.useState(""),[E,J]=z.useState("US"),[T,$]=z.useState("en"),[U,H]=z.useState(!1),[Z,oe]=z.useState("idle"),[le,re]=z.useState(null),[ne,Q]=z.useState(null),[Ae,Le]=z.useState(!1),[Oe,Ne]=z.useState(null),[_e,tt]=z.useState(!1),be=f.data,B=typeof be?.enabled=="boolean"?be.enabled:null,ie=g.isPending?g.variables.body.enabled:B,[fe,we]=z.useState(null),ee=z.useRef(null),{onboardingSessionId:qe,emit:je}=B3("platform");z.useEffect(()=>{je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.started",step:"project",resumed:!1},"onboarding.started")},[je,qe]);const F=hG(b),I=k||F?.projectName||"",ue=C||F?.displayName||"",G=Z==="creating"||Z==="dispatching",ce=ne??Oe,Ve=dG(E,T),{countryValid:Y,languageValid:De}=mG(E,T),Pe=Y&&De;z.useEffect(()=>{ce&&ee.current?.focus()},[ce]);const Te=(Me,ct)=>s({to:"/setup",search:{...ct?{siteHealthRunId:ct}:{},onboarding:"site-health",setupProject:Me.name},replace:!0}),Bt=async Me=>{oe("dispatching"),Ne(null);try{const ct=u.mutateAsync({projectName:Me.name,projectId:Me.id,projectLabel:Me.displayName||Me.name,suppressErrorToast:!0,body:{checkDeadLinks:!0}}),Zt=await fG(ct);if(Zt.state==="queued"){je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"}),await Te(Me,Zt.run.runId);return}ct.then(()=>{je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"})},ns=>{je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:fl(ns,"run_rejected")})}),gG(ct,Me.id),await Te(Me)}catch(ct){oe("recovery"),Ne(Yv(ct,"The project was created, but the Site Health scan could not be started."));const Zt=fl(ct,"run_rejected");je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Zt}),je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:Zt},`onboarding.blocked:run:${Zt}`)}},rt=async Me=>{if(Me.preventDefault(),!(!F||!a&&!U||!Pe||G)){oe("creating"),Q(null),Le(!1),Ne(null);try{const ct=await iC({name:I,displayName:ue,canonicalDomain:F.canonicalDomain,country:E,language:T});if(e(),re(ct),je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.step_completed",step:"project",method:"manual"},"onboarding.step_completed:project"),await r.invalidateQueries({queryKey:Qi({client:ae})}),a){await s({to:"/setup",search:{experience:"legacy",onboarding:"first-run",setupProject:ct.name},replace:!0});return}await Bt(ct)}catch(ct){oe("idle");const Zt=ct instanceof hn&&ct.statusCode===409;Le(Zt),Q(Yv(ct,"Could not create the project. Try again.")),je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.blocked",step:"project",action:"save",reasonCode:fl(ct,"project_create_failed")},"onboarding.blocked:project"),Zt&&(e(),r.invalidateQueries({queryKey:Qi({client:ae})}))}}},Sa=()=>{le&&!G&&Bt(le)},ui=()=>{G||s({to:"/projects"})},Gs=async()=>{try{await navigator.clipboard.writeText(cG),tt(!0)}catch{nn({tone:"negative",title:"Could not copy setup request",detail:"Open the agent quickstart to continue with the CLI instead."})}},yn=async Me=>{we(null);try{const ct=await g.mutateAsync({client:ae,body:{enabled:Me}});r.setQueryData(Hw({client:ae}),ct),ct.enabled!==Me&&we(`The server kept telemetry ${ct.enabled?"on":"off"}. Check its telemetry settings.`)}catch{we("Could not update telemetry. Try again.")}};return le&&Z==="recovery"?c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx(Yo,{current:"site"}),c.jsx("div",{className:"page-header mt-8",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Project created"}),c.jsxs("p",{className:"page-subtitle",children:[le.displayName||le.name," is ready. The Site Health scan needs another try."]})]})}),c.jsxs("div",{ref:ee,className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[c.jsx("p",{className:"text-sm font-medium text-heading",children:Oe}),c.jsx("p",{className:"mt-1 text-sm text-secondary",children:"You can retry the scan or continue setup and retry from Site Health."}),c.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[c.jsx(ge,{type:"button",onClick:Sa,children:"Retry Site Health scan"}),c.jsx(ge,{type:"button",variant:"secondary",onClick:()=>{Te(le)},children:"Continue setup"})]})]})]}):c.jsxs("div",{className:"page-container max-w-xl py-8 md:py-12",children:[a?null:c.jsx(Yo,{current:"site"}),c.jsxs("header",{className:`mb-8 ${a?"":"mt-8"}`,children:[c.jsx("h1",{id:"site-map-setup-title",className:"text-2xl font-semibold tracking-[-0.025em] text-heading",children:a?"Create a project":"Map your site"}),c.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-secondary",children:a?"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."})]}),c.jsxs("form",{"aria-labelledby":"site-map-setup-title",className:"space-y-6",onSubmit:Kt(rt),noValidate:!0,children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-heading",htmlFor:"launchpad-domain",children:"Website URL"}),c.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&&!F),"aria-describedby":b&&!F?"launchpad-domain-hint launchpad-domain-error":"launchpad-domain-hint",placeholder:"https://example.com",value:b,onChange:Me=>{x(Me.target.value),Q(null),Le(!1)}}),c.jsx("p",{id:"launchpad-domain-hint",className:"text-sm text-secondary",children:a?c.jsxs(c.Fragment,{children:["A public domain is still required."," ",c.jsx(Xe,{to:"/setup",search:{experience:"platform"},className:"font-medium text-link underline-offset-4 hover:underline",children:"Map with Site Health instead"})]}):c.jsxs(c.Fragment,{children:["Only public pages are scanned."," ",c.jsx(Xe,{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&&!F?c.jsx("p",{id:"launchpad-domain-error",className:"text-sm text-negative",role:"alert",children:"Enter a public domain, such as example.com."}):null]}),c.jsxs("details",{className:"group border-y border-default",children:[c.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:[c.jsx("span",{className:"font-medium text-heading",children:"Advanced settings"}),c.jsxs("span",{className:"flex items-center gap-2 text-secondary",children:[Ve,c.jsx(Rh,{className:"size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none","aria-hidden":"true"})]})]}),c.jsxs("div",{className:"space-y-5 border-t border-default py-4",children:[F?c.jsxs("div",{children:[c.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Project"}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-project-name",children:"Project name"}),c.jsx("input",{id:"launchpad-project-name",className:"setup-input h-10",type:"text",value:I,onChange:Me=>S(Me.target.value)})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-display-name",children:"Display name"}),c.jsx("input",{id:"launchpad-display-name",className:"setup-input h-10",type:"text",value:ue,onChange:Me=>j(Me.target.value)})]})]})]}):null,c.jsxs("div",{children:[c.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Locale"}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-country",children:"Country"}),c.jsx("select",{id:"launchpad-country",className:"setup-input h-10",value:E,onChange:Me=>J(Me.target.value),children:R3.map(Me=>c.jsx("option",{value:Me.value,children:Me.label},Me.value))})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-language",children:"Language"}),c.jsx("select",{id:"launchpad-language",className:"setup-input h-10",value:T,onChange:Me=>$(Me.target.value),children:O3.map(Me=>c.jsx("option",{value:Me.value,children:Me.label},Me.value))})]})]})]})]})]}),a?null:c.jsxs("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 py-2",children:[c.jsx("input",{className:"mt-0.5 size-4 shrink-0 rounded border-strong bg-bg",type:"checkbox",checked:U,onChange:Me=>H(Me.target.checked),"aria-label":"Allow Canonry to scan this public site.","aria-describedby":"local-crawl-note"}),c.jsxs("span",{className:"grid gap-0.5",children:[c.jsx("span",{className:"text-sm leading-5 text-heading",children:"Allow Canonry to scan this public site."}),c.jsx("span",{id:"local-crawl-note",className:"text-sm leading-5 text-secondary",children:"The crawl runs on this Canonry instance, follows internal links, and stores its results locally."})]})]}),ce?c.jsxs("div",{ref:ee,className:"rounded-md border border-negative bg-negative-soft p-3",role:"alert",tabIndex:-1,children:[c.jsx("p",{className:"text-sm font-medium text-heading",children:ce}),Ae?c.jsx(ge,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:ui,children:"View projects"}):null]}):null,c.jsxs("div",{className:"grid gap-2",children:[c.jsx(ge,{className:"h-11 w-full",type:"submit",disabled:!F||!a&&!U||!Pe||G,children:Z==="creating"||Z==="dispatching"?c.jsxs(c.Fragment,{children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"})," ",a?"Creating project…":"Mapping site…"]}):a?"Create project":"Map site"}),Z==="dispatching"?c.jsx("span",{className:"text-center text-sm text-secondary",role:"status",children:"Opening Site Health when the scan is ready."}):null]})]}),c.jsxs("section",{className:"mt-8 border-t border-default pt-6","aria-labelledby":"agent-setup-title",children:[c.jsx("p",{id:"agent-setup-title",className:"text-sm font-medium text-heading",children:"Use your agent instead"}),c.jsx("p",{className:"mt-1 text-sm leading-5 text-secondary",children:"Copy a complete CLI setup request into any coding agent."}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[c.jsxs(ge,{type:"button",variant:"ghost",size:"sm",className:"-ml-3",onClick:Kt(Gs),children:[_e?c.jsx(Oh,{className:"size-3.5","aria-hidden":"true"}):c.jsx(lx,{className:"size-3.5","aria-hidden":"true"}),c.jsx("span",{"aria-live":"polite",children:_e?"Copied setup request":"Copy setup request"})]}),c.jsx(ge,{asChild:!0,variant:"ghost",size:"sm",children:c.jsxs("a",{href:lG,target:"_blank",rel:"noopener noreferrer",children:["Agent quickstart",c.jsx(y4,{className:"size-3.5","aria-hidden":"true"}),c.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})})]})]}),B!==null?c.jsxs("section",{className:"mt-6 border-t border-default pt-5","aria-labelledby":"telemetry-title",children:[c.jsxs("label",{className:`flex min-h-11 items-start gap-3 py-2 ${g.isPending?"cursor-wait":"cursor-pointer"}`,children:[c.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:ie??!1,disabled:g.isPending,onChange:Me=>{yn(Me.target.checked)},"aria-describedby":"telemetry-detail"}),c.jsxs("span",{className:"grid gap-0.5",children:[c.jsx("span",{id:"telemetry-title",className:"text-sm leading-5 text-heading",children:"Share anonymous product telemetry"}),c.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."})]})]}),g.isPending?c.jsx("p",{className:"mt-1 text-sm text-secondary",role:"status",children:"Saving preference…"}):null,fe?c.jsx("p",{className:"mt-1 text-sm text-negative",role:"alert",children:fe}):null]}):null]})}function jG(){return c.jsx("div",{className:"page-container",children:c.jsx("section",{className:"page-section",children:c.jsxs(ia,{className:"surface-card empty-card",children:[c.jsx("h1",{children:"Route not found"}),c.jsx("p",{children:"The current path does not map to a dashboard view."}),c.jsx(ge,{asChild:!0,children:c.jsx(Xe,{to:"/",children:"Return to overview"})})]})})})}const ra=Zi(()=>ci(()=>import("./ProjectPage-CshC68Ne.js"),__vite__mapDeps([5,1,6,0,2,3,4,7,8,9,10,11,12]),import.meta.url),"ProjectPage"),AG=Zi(()=>ci(()=>import("./RunsPage-D0CtU4d-.js"),__vite__mapDeps([13,1,6,10,4,2,11,12]),import.meta.url),"RunsPage"),CG=Zi(()=>ci(()=>import("./HistoryPage-36K_6asu.js"),__vite__mapDeps([14,1,8,10,4,2,11,12]),import.meta.url),"HistoryPage"),NG=Zi(()=>ci(()=>import("./SettingsPage-zMWieTPK.js"),__vite__mapDeps([15,1,10,4,2,11,12]),import.meta.url),"SettingsPage"),_G=Zi(()=>ci(()=>import("./BacklinksPage-045za10_.js"),__vite__mapDeps([16,1,2,10,4,11,12]),import.meta.url),"BacklinksPage"),zG=Zi(()=>ci(()=>import("./TrafficPage-DfLUt-64.js"),__vite__mapDeps([17,1,7,2,10,4,11,12]),import.meta.url),"TrafficPage"),EG=Zi(()=>ci(()=>import("./TrafficSourceDetailPage-DbjNNWSt.js"),__vite__mapDeps([18,1,7,3,4,2,10,11,12]),import.meta.url),"TrafficSourceDetailPage"),DG=Zi(()=>ci(()=>import("./MeasurementPropertyPage-B4DJGoY6.js"),__vite__mapDeps([19,1,3,4,9,2,10,11,12]),import.meta.url),"MeasurementPropertyPage");function TG(){return c.jsx(zU,{children:c.jsx(_U,{})})}const fn=Hj()({component:TG,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:void 0,experience:e.experience==="legacy"||e.experience==="platform"?e.experience:void 0,siteScan:e.siteScan==="skip"?"skip":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})}),RG=St({getParentRoute:()=>fn,path:"/",component:OU,beforeLoad:async({context:e})=>{let a=e.queryClient.getQueryData(Qi({client:ae}));if(a===void 0)try{a=await e.queryClient.ensureQueryData(Vs({client:ae}))}catch{return}if(a.length===0)throw ex({to:"/setup"})}}),OG=St({getParentRoute:()=>fn,path:"/projects",component:MU}),BG=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Dn=St({getParentRoute:()=>fn,path:"/projects/$projectName",component:()=>c.jsx(Wp,{}),beforeLoad:async({context:e,params:a,location:s})=>{const r=a.projectName;if(!BG.test(r))return;let u=e.queryClient.getQueryData(Qi({client:ae}));if(!u)try{u=await e.queryClient.ensureQueryData(Vs({client:ae}))}catch{return}const f=u.find(g=>g.id===r);if(f)throw ex({to:s.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(f.name)}`),replace:!0})}}),qG=St({getParentRoute:()=>Dn,path:"/",component:()=>c.jsx(ra,{tab:"overview"})}),PG=St({getParentRoute:()=>Dn,path:"/portfolio",component:()=>c.jsx(ra,{tab:"portfolio"})}),MG=St({getParentRoute:()=>Dn,path:"/search-console",component:()=>c.jsx(ra,{tab:"search-console"})}),IG=St({getParentRoute:()=>Dn,path:"/conversions",component:()=>c.jsx(ra,{tab:"conversions"})}),VG=St({getParentRoute:()=>Dn,path:"/local",component:()=>c.jsx(ra,{tab:"local"})}),LG=St({getParentRoute:()=>Dn,path:"/discovery",component:()=>c.jsx(ra,{tab:"discovery"})}),UG=St({getParentRoute:()=>Dn,path:"/properties/$targetKey",component:()=>c.jsx(DG,{})}),GG=St({getParentRoute:()=>Dn,path:"/report",component:()=>c.jsx(ra,{tab:"report"})}),$G=St({getParentRoute:()=>Dn,path:"/activity",component:()=>c.jsx(ra,{tab:"activity"})}),KG=St({getParentRoute:()=>Dn,path:"/backlinks",component:()=>c.jsx(ra,{tab:"backlinks"})}),HG=St({getParentRoute:()=>Dn,path:"/technical-aeo",component:()=>c.jsx(ra,{tab:"technical-aeo"})}),QG=St({getParentRoute:()=>Dn,path:"/history",component:()=>c.jsx(ra,{tab:"history"})}),FG=St({getParentRoute:()=>Dn,path:"/settings",component:()=>c.jsx(ra,{tab:"settings"})}),ZG=St({getParentRoute:()=>fn,path:"/runs",component:AG}),YG=St({getParentRoute:()=>fn,path:"/history",component:CG}),XG=St({getParentRoute:()=>fn,path:"/settings",component:NG,beforeLoad:({context:e})=>{}}),JG=St({getParentRoute:()=>fn,path:"/setup",component:kG}),WG=St({getParentRoute:()=>fn,path:"/backlinks",component:_G}),e$=St({getParentRoute:()=>fn,path:"/traffic",component:zG}),t$=St({getParentRoute:()=>fn,path:"/traffic/$projectName/$sourceId",component:EG}),n$=St({getParentRoute:()=>fn,path:"*",component:jG}),a$=fn.addChildren([RG,OG,Dn.addChildren([qG,PG,MG,IG,VG,LG,UG,GG,$G,KG,HG,QG,FG]),ZG,YG,XG,JG,WG,e$,t$,n$]);function i$(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const Xv=i$(),s$=Xv==="/"?"":Xv.replace(/\/$/,"");function o$(e,a){return Qj({routeTree:a$,basepath:s$||"/",context:{queryClient:e},...a?.initialEntries})}const r$=6e4;function l$(){const e=z.useRef(eC()).current,[a,s]=z.useState(e?"ready":"checking"),[r,u]=z.useState(null),[f,g]=z.useState(null),[b,x]=z.useState(e),[k,S]=z.useState(!1),[C,j]=z.useState(""),[E,J]=z.useState(""),[T,$]=z.useState(""),[U,H]=z.useState(!1),[Z,oe]=z.useState("password"),[le,re]=z.useState(null),[ne,Q]=z.useState(!1),[Ae,Le]=z.useState(!1),Oe=z.useRef(null),Ne=z.useRef(null),_e=z.useRef(null),tt=()=>{const G=r?`${r.name}:${r.role}`:e?"api-key:explicit":f?`api-key:${f.id}`:"no-accounts";if(!Oe.current||_e.current!==G){Ne.current?.clear();const ce=nM();Ne.current=ce,Oe.current=o$(ce),_e.current=G}return{queryClient:Ne.current,router:Oe.current}},be=G=>G.authRequired?(S(!0),u(G.user),g(null),x(!1),s(G.user?"ready":"account-login"),!0):!1;z.useEffect(()=>{let G=!1;const ce=async(Ve,Y=!1)=>{try{const De=await Cp();if(G)return;g(De),x(!1),s("ready")}catch(De){if(G)return;if(Y&&De instanceof hn&&De.statusCode===401)return pC().then(()=>{G||(re(null),g(null),x(!1),Le(!0),s("login"))}).catch(Pe=>{G||(re(Pe instanceof Error?Pe.message:"Could not clear the invalid session"),s(Ve))});re(De instanceof Error?De.message:"Could not verify API key access"),s(Ve)}};return e?(ce("api-key-error"),()=>{G=!0}):(Promise.allSettled([Uy(),Ly()]).then(([Ve,Y])=>{if(G||Ve.status==="fulfilled"&&be(Ve.value))return;if(Y.status==="rejected"){const Pe=Y.reason;re(Pe instanceof Error?Pe.message:"Failed to reach the Canonry API"),s("login");return}const De=Y.value;De.authenticated?(x(!0),ce("api-key-error",!0)):(g(null),x(!1),s(De.setupRequired?"setup":"login"))}),()=>{G=!0})},[]),z.useEffect(()=>{if(a!=="ready"||e)return;const G=setInterval(()=>{if(k){Uy().then(ce=>{ce.authRequired&&!ce.user&&(Le(!0),u(null),g(null),s("account-login"))}).catch(()=>{});return}Ly().then(ce=>{ce.authenticated||(Le(!0),g(null),s(ce.setupRequired?"setup":"login"))}).catch(()=>{})},r$);return Vy(()=>{Le(!0),u(null),g(null),x(!1),s(k?"account-login":"login")}),()=>{clearInterval(G),Vy(null)}},[a,k,e]);const B=async G=>{if(G.preventDefault(),!E.trim()||E.trim().length<8){re("Password must be at least 8 characters");return}if(E!==T){re("Passwords do not match");return}Q(!0),re(null);try{if(!(await uC(E.trim())).authenticated){re("Setup failed");return}J(""),$(""),H(!1),Le(!1),g(null),x(!0),s("checking");try{const Ve=await Cp();g(Ve),x(!1),s("ready")}catch(Ve){re(Ve instanceof Error?Ve.message:"Could not verify API key access"),s("api-key-error")}}catch(ce){re(ce instanceof hn||ce instanceof Error?ce.message:"Setup failed")}finally{Q(!1)}},ie=G=>{J(G),re(null)},fe=G=>{$(G),re(null)},we=async G=>{if(G.preventDefault(),!!E.trim()){Q(!0),re(null);try{if(!(Z==="api-key"?await mC(E.trim()):await dC(E.trim())).authenticated){re(Z==="api-key"?"Invalid API key":"Incorrect password");return}const Ve=await Cp();g(Ve),x(!1),J(""),H(!1),Le(!1),s("ready")}catch(ce){re(ce instanceof hn||ce instanceof Error?ce.message:"Authentication failed")}finally{Q(!1)}}},ee=G=>{oe(G),J(""),H(!1),re(null)},qe=async G=>{if(G.preventDefault(),!(!C.trim()||!E)){Q(!0),re(null);try{const ce=await hC(C.trim(),E);if(!ce.user){re("Incorrect name or password.");return}J(""),Le(!1),u(ce.user),g(null),x(!1),s("ready")}catch(ce){re(ce instanceof hn?ce.message:"Incorrect name or password.")}finally{Q(!1)}}};if(a==="ready"){const{queryClient:G,router:ce}=tt();return c.jsx(HP,{account:r,apiKey:f,apiKeyPending:b,children:c.jsx(Fj,{client:G,children:c.jsx(Zj,{router:ce})})})}const je=E.trim(),F=E.length>0&&je.length<8,I=T.length>0&&E!==T,ue=je.length>=8&&E===T;return c.jsx("div",{className:"min-h-screen bg-bg px-4 py-8",children:c.jsxs("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5",children:[c.jsxs("div",{"data-testid":"auth-brand",className:"flex items-center gap-2.5",children:[c.jsx("img",{className:"size-7",src:"./favicon.svg",alt:"","aria-hidden":"true"}),c.jsx("span",{className:"text-lg font-semibold tracking-tight text-heading",children:"Canonry"})]}),c.jsx(ia,{className:"surface-card w-full",children:a==="checking"?c.jsx(Es,{className:"py-8",children:c.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):a==="api-key-error"?c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Could not verify API key access"})]}),c.jsxs(Es,{className:"space-y-4",children:[c.jsx("p",{className:"supporting-copy",children:le??"Canonry could not verify this session’s access, so the dashboard stayed locked."}),c.jsx(ge,{type:"button",className:"w-full",onClick:()=>{window.location.reload()},children:"Try again"})]})]}):a==="account-login"?c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"})]}),c.jsxs(Es,{children:[Ae?c.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,c.jsxs("form",{className:"space-y-4",onSubmit:Kt(qe),children:[c.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-name",children:[c.jsx("span",{className:"text-xs font-medium text-secondary",children:"Name"}),c.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:C,onChange:G=>{j(G.target.value),re(null)},"aria-invalid":!!le,"aria-describedby":le?"account-login-error":void 0})]}),c.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-password",children:[c.jsx("span",{className:"text-xs font-medium text-secondary",children:"Password"}),c.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:E,onChange:G=>ie(G.target.value),"aria-invalid":!!le,"aria-describedby":le?"account-login-error":void 0})]}),le?c.jsx("p",{id:"account-login-error",role:"alert",className:"text-sm text-negative-400",children:le}):null,c.jsx(ge,{type:"submit",disabled:ne||!C.trim()||!E,children:ne?"Signing in…":"Sign in"})]})]})]}):a==="setup"?c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Create a dashboard password"}),c.jsx(Ou,{children:"Stored on this Canonry install as a salted, one-way hash. Canonry cannot recover it."})]}),c.jsx(Es,{children:c.jsxs("form",{className:"space-y-4",onSubmit:Kt(B),children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-new",children:"Password"}),c.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:U?"text":"password",name:"new-password",autoComplete:"new-password",minLength:8,required:!0,value:E,onChange:G=>ie(G.target.value),"aria-invalid":F,"aria-describedby":"dashboard-password-new-help"}),c.jsx("span",{id:"dashboard-password-new-help","aria-live":"polite",className:F?"block text-sm text-negative-400":"block text-sm text-secondary",children:F?"Enter at least 8 characters.":"Use at least 8 characters."})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-confirm",children:"Confirm password"}),c.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:U?"text":"password",name:"confirm-password",autoComplete:"new-password",minLength:8,required:!0,value:T,onChange:G=>fe(G.target.value),"aria-invalid":I,"aria-describedby":"dashboard-password-confirm-help"}),c.jsx("span",{id:"dashboard-password-confirm-help","aria-live":"polite",className:I?"block text-sm text-negative-400":"block text-sm text-secondary",children:I?"Passwords do not match.":"Enter the same password again."})]}),c.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-password-show",children:[c.jsx("input",{id:"dashboard-password-show",type:"checkbox",checked:U,onChange:G=>H(G.target.checked)}),"Show passwords"]}),le?c.jsx("p",{id:"dashboard-password-setup-error",role:"alert",className:"text-sm text-negative-400",children:le}):null,c.jsx(ge,{type:"submit",disabled:ne||!ue,children:ne?"Creating password…":"Create password and continue"})]})})]}):c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"}),c.jsx(Ou,{children:Z==="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."})]}),c.jsxs(Es,{children:[Ae?c.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,c.jsxs("form",{className:"space-y-4",onSubmit:Kt(we),children:[c.jsxs("label",{className:"block space-y-1.5",htmlFor:"dashboard-password-current",children:[c.jsx("span",{className:"text-xs font-medium text-secondary",children:Z==="api-key"?"Canonry API key":"Password"}),c.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:U?"text":"password",name:Z==="api-key"?"apiKey":"password",autoComplete:Z==="api-key"?"off":"current-password",spellCheck:!1,required:!0,value:E,onChange:G=>ie(G.target.value),"aria-invalid":!!le,"aria-describedby":le?"dashboard-password-login-error":void 0})]}),c.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-login-password-show",children:[c.jsx("input",{id:"dashboard-login-password-show",type:"checkbox",checked:U,onChange:G=>H(G.target.checked)}),Z==="api-key"?"Show API key":"Show password"]}),le?c.jsx("p",{id:"dashboard-password-login-error",role:"alert",className:"text-sm text-negative-400",children:le}):null,c.jsx(ge,{type:"submit",disabled:ne||!E.trim(),children:ne?"Signing in…":"Open dashboard"}),c.jsx(ge,{type:"button",variant:"ghost",onClick:()=>ee(Z==="api-key"?"password":"api-key"),children:Z==="api-key"?"Use dashboard password instead":"Forgot password? Use API key"})]})]})]})})]})})}const q3=document.getElementById("root");if(!q3)throw new Error("Expected #root element for web app bootstrap.");j4.createRoot(q3).render(c.jsx(z.StrictMode,{children:c.jsx(l$,{})}));export{SQ as $,rQ as A,ge as B,zu as C,uQ as D,cQ as E,nK as F,mH as G,tK as H,ll as I,pK as J,nn as K,pQ as L,sF as M,hQ as N,rK as O,aL as P,fQ as Q,lK as R,sM as S,rn as T,iK as U,oK as V,dQ as W,mQ as X,lQ as Y,aK as Z,gQ as _,iF as a,WH as a$,vQ as a0,kQ as a1,xQ as a2,wQ as a3,jC as a4,H0 as a5,Ee as a6,bQ as a7,Yw as a8,li as a9,cH as aA,uH as aB,LQ as aC,UQ as aD,GQ as aE,cK as aF,Qi as aG,uK as aH,G0 as aI,BQ as aJ,DM as aK,MH as aL,wa as aM,VH as aN,FH as aO,iQ as aP,aQ,HH as aR,tQ as aS,oQ as aT,UH as aU,YH as aV,XH as aW,JH as aX,LH as aY,ZH as aZ,GH as a_,yQ as aa,mF as ab,tR as ac,nR as ad,KK as ae,$K as af,RK as ag,IK as ah,VK as ai,hn as aj,LK as ak,M$ as al,oM as am,rV as an,bu as ao,UK as ap,jh as aq,qQ as ar,mz as as,sK as at,GK as au,yM as av,PM as aw,DH as ax,RH as ay,TH as az,C2 as b,UM as b$,$H as b0,eQ as b1,QH as b2,nQ as b3,sQ as b4,HU as b5,KH as b6,pe as b7,B$ as b8,O$ as b9,nH as bA,sH as bB,oH as bC,WK as bD,aH as bE,K$ as bF,$$ as bG,G$ as bH,wK as bI,MM as bJ,IH as bK,vH as bL,fv as bM,Z$ as bN,Y$ as bO,yH as bP,bH as bQ,X$ as bR,J$ as bS,eK as bT,W$ as bU,Ol as bV,Vs as bW,FL as bX,kM as bY,Ds as bZ,Pu as b_,R$ as ba,T$ as bb,z$ as bc,_$ as bd,D$ as be,E$ as bf,N$ as bg,C$ as bh,v$ as bi,x$ as bj,A$ as bk,j$ as bl,S$ as bm,k$ as bn,w$ as bo,b$ as bp,y$ as bq,g$ as br,f$ as bs,Z4 as bt,tH as bu,OQ as bv,eH as bw,kK as bx,dF as by,iH as bz,dH as c,MK as c$,WU as c0,Cx as c1,kH as c2,wH as c3,uF as c4,YU as c5,OH as c6,SH as c7,NH as c8,jH as c9,yK as cA,Fo as cB,$0 as cC,rF as cD,pd as cE,Z0 as cF,qH as cG,PH as cH,Z6 as cI,q$ as cJ,P$ as cK,F$ as cL,dK as cM,mK as cN,af as cO,hd as cP,Y0 as cQ,JU as cR,xK as cS,Zo as cT,yv as cU,DK as cV,OK as cW,qK as cX,PK as cY,TK as cZ,BK as c_,BH as ca,oF as cb,AH as cc,pn as cd,aC as ce,dM as cf,V$ as cg,L$ as ch,I$ as ci,oC as cj,U$ as ck,gM as cl,xM as cm,H$ as cn,jQ as co,bC as cp,bK as cq,CQ as cr,NQ as cs,_Q as ct,AQ as cu,hH as cv,hK as cw,fK as cx,gK as cy,vK as cz,DQ as d,iL as d0,h3 as d1,cL as d2,f3 as d3,g3 as d4,EK as d5,IQ as d6,qU as d7,lH as d8,P0 as d9,nF as dA,aF as dB,QQ as dC,FQ as dD,HK as dE,XQ as dF,eF as dG,YQ as dH,WQ as dI,Yo as dJ,YK as dK,JQ as dL,IR as dM,JK as dN,XK as dO,xH as da,PQ as db,VQ as dc,zK as dd,rH as de,NK as df,_K as dg,CK as dh,MQ as di,Q9 as dj,_H as dk,CH as dl,EH as dm,zH as dn,FK as dp,ci as dq,oa as dr,QK as ds,$Q as dt,HQ as du,KQ as dv,XU as dw,ZQ as dx,ZK as dy,tF as dz,ia as e,ae as f,zQ as g,_v as h,Nx as i,Nn as j,Kt as k,EQ as l,RQ as m,TQ as n,SK as o,AK as p,jK as q,lF as r,cF as s,lM as t,X0 as u,Nh as v,fH as w,pH as x,gH as y,Q$ as z};
|
|
86
|
+
competitor2.com`,value:mr,onChange:L=>ss(L.target.value)})]}),Va?c.jsx("p",{className:"text-negative-400 text-sm",children:Va}):null,c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:bi,children:"Skip"}),c.jsx(ge,{type:"button",disabled:_a.length===0||La,onClick:Kt(Sd),children:La?"Saving...":`Save ${_a.length} competitor${_a.length!==1?"s":""}`})]})]})]})]});case 4:{const L=Na.data,Be=L?.status??(Ca===Le?.id?Le.status:void 0),un=Be==="completed"||Be==="partial"||Be==="failed"||Be==="cancelled",za=L?.snapshots??[],eo=za.filter(Zn=>Zn.citationState==="cited").length,Zl=za.filter(Zn=>Zn.answerMentioned===!0).length,ms=new Set(za.map(Zn=>Zn.query).filter(Zn=>!!Zn)).size,ps=Be?Qv(Be,za.length):!1,gr=Oe&&!Rn,on=rs??(L?.error?oM(L.error):Be==="cancelled"?"The sweep was cancelled before it produced a baseline.":(Be==="completed"||Be==="partial")&&za.length===0?"The sweep finished without producing any snapshots. Confirm the query set and provider configuration, then retry.":Le?.statusDetail||"The sweep did not produce a baseline. Review provider configuration, then retry.");let qn=null;return gr||ps?qn=c.jsx(rn,{tone:"positive",children:"Complete"}):rs&&!Rn?qn=c.jsx(rn,{tone:"negative",children:"Failed"}):un?qn=c.jsx(rn,{tone:"negative",children:Be==="cancelled"?"Cancelled":"Failed"}):Rn&&(qn=c.jsx(rn,{tone:"caution",children:"Running"})),c.jsxs(ia,{className:"surface-card step-card",children:[c.jsxs("div",{className:"section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:j?"Step 2 of 2":"Step 5 of 5"}),c.jsx("h2",{children:"Launch first run"})]}),qn]}),gr?c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"text-secondary",children:["Setup is complete. ",c.jsx("span",{className:"text-strong font-medium",children:Te})," already has a successful answer-visibility baseline."]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx("span",{}),c.jsx(ge,{type:"button",onClick:yn,children:g?"Finish and open project":"Open project dashboard →"})]})]}):Rn?un?ps?c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"text-neutral",children:["Sweep complete. Your first answer-visibility snapshot for"," ",c.jsx("span",{className:"text-heading font-medium",children:Te}),":"]}),c.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-1",children:[c.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[c.jsx("p",{className:"text-xs font-medium text-secondary",children:"Mentioned"}),c.jsxs("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:[Zl,c.jsxs("span",{className:"text-faint text-lg",children:[" / ",ms]})]}),c.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries naming your brand"})]}),c.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[c.jsx("p",{className:"text-xs font-medium text-secondary",children:"Cited"}),c.jsxs("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:[eo,c.jsxs("span",{className:"text-faint text-lg",children:[" / ",ms]})]}),c.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"queries citing your site"})]}),c.jsxs("div",{className:"rounded-md border border-default bg-surface p-3",children:[c.jsx("p",{className:"text-xs font-medium text-secondary",children:"Results"}),c.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary mt-1",children:za.length}),c.jsx("p",{className:"mt-0.5 text-sm text-secondary",children:"completed engine checks"})]})]}),c.jsx("p",{className:"mt-1 text-sm text-secondary",children:g?"Your project is ready. Review the evidence in the project.":"Open the project to review the evidence."}),c.jsxs("div",{className:"setup-nav",children:[c.jsx("span",{}),c.jsx(ge,{type:"button",onClick:yn,children:g?"Finish and open project":"Open project dashboard →"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[c.jsx("p",{children:on}),c.jsx("p",{className:"mt-1 text-xs text-secondary",children:"Fix provider or query configuration if needed, then retry without leaving setup."})]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",asChild:!0,children:c.jsx(Xe,{to:"/settings",children:"Configure providers"})}),c.jsx(ge,{type:"button",disabled:os||!!kn,onClick:Kt(Qn),children:os?"Retrying...":"Retry visibility sweep"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsx("p",{className:"text-neutral",children:"Sweep running. This usually takes 30 to 60 seconds."}),c.jsx("div",{className:"rounded-md border border-default bg-surface p-3 text-xs text-muted",children:c.jsxs("p",{children:["Status: ",c.jsx("span",{className:"text-neutral",children:Be??"queued"})]})}),Na.isError&&c.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[c.jsx("p",{children:Na.error instanceof Error?Na.error.message:"Could not refresh the sweep status."}),c.jsx(ge,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{Na.refetch()},children:"Retry status check"})]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx("span",{}),c.jsx(ge,{type:"button",variant:"outline",onClick:yn,children:g?"Finish and open project":"Watch on project page"})]})]}):c.jsxs("div",{className:"compact-stack",children:[c.jsxs("p",{className:"supporting-copy",children:["Your queries are saved. Run a first sweep to get a baseline for"," ",c.jsx("span",{className:"text-heading font-medium",children:Te}),", or finish and run it later from the project. A sweep calls the answer engines, so it costs provider usage."]}),(kn||rs)&&c.jsxs("div",{role:"alert",className:"rounded-md border border-negative bg-negative-soft p-3 text-sm text-negative",children:[c.jsx("p",{children:rs??kn}),c.jsx("p",{className:"mt-1 text-xs text-secondary",children:"Resolve the blocker above, then retry the sweep here."})]}),c.jsxs("div",{className:"setup-nav",children:[c.jsx(ge,{type:"button",variant:"outline",onClick:Fn,children:"Back"}),c.jsx(ge,{type:"button",variant:"ghost",onClick:yn,children:"Finish without running"}),Bn==="no_provider"&&!j?c.jsx(ge,{type:"button",asChild:!0,children:c.jsx(Xe,{to:"/settings",children:"Configure a provider"})}):c.jsx(ge,{type:"button",disabled:os||!!kn,title:kn,onClick:Kt(Qn),children:os?"Launching...":rs?"Retry visibility sweep":"Launch visibility sweep"})]})]})]})}default:return null}})();return c.jsxs("div",{className:j?"page-container visibility-setup":"page-container",children:[g?c.jsx(Yo,{current:"visibility"}):null,c.jsxs("div",{className:"page-header",children:[c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{ref:u?f:void 0,tabIndex:u?-1:void 0,className:"page-title",children:u?"Set up AI Visibility":"Setup"}),c.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."})]}),g?c.jsx("div",{className:"page-header-right",children:c.jsx(ge,{type:"button",variant:"outline",className:"min-h-11",onClick:yn,children:"Skip AI Visibility"})}):null]}),g?null:c.jsx(aG,{current:j?be===4?1:0:be,labels:j?tG:eG}),c.jsxs("section",{className:"setup-wizard",children:[ds,da]})]})}const oG=z.lazy(async()=>({default:(await ci(()=>import("./SiteHealthSection-BODUx0bX.js").then(a=>a.d),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).SiteHealthSection})),rG=1800,lG="https://github.com/Canonry/canonry#or-use-any-shell-capable-coding-agent",cG="Help me set up Canonry for my public site.\n\nUse Canonry's official 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\nUse an existing Canonry installation or connected plugin/MCP if one is already available. Do not create a duplicate. The `cnry` and `canonry` commands are interchangeable.\n\n1. Ask for my public domain, country, and language. Do not create or scan anything yet.\n2. Check the local setup with `command -v cnry`, `cnry --version`, `cnry doctor --format json`, and `cnry project list --format json`. If Canonry is missing, propose `npm install -g @canonry/canonry` and wait for approval. If initialization is required, tell me to run `cnry bootstrap` in my private terminal and wait. Never ask me to paste passwords, API keys, OAuth credentials, or `cnry bootstrap` output.\n3. Show the normalized domain, proposed project name, exact `cnry project create ...` command, and wait for explicit approval before creating it.\n4. Propose a bounded Site Health scan, including `--max-pages` and whether dead-link checking is enabled. Show the exact `cnry technical-aeo run ... --wait --format json` command and wait for separate approval before scanning.\n5. After the crawl, summarize the findings and propose AI Visibility setup. Ask before adding queries, connecting providers, starting any provider-backed or quota-consuming run, editing files, or publishing.";function uG(e,a){return e==="legacy"?"legacy":e==="platform"?"platform":a.state==="success"?a.projectCount===0?"platform":"legacy":a.state==="error"?"retry":"loading"}const R3=[{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"}],O3=[{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 dG(e,a){try{const s=new Intl.DisplayNames(["en"],{type:"region"}),r=new Intl.DisplayNames(["en"],{type:"language"}),u=e.length===2?s.of(e.toUpperCase()):void 0,f=a?r.of(a.toLowerCase()):void 0;return`${u??(e||"Country")} · ${f??(a||"Language")}`}catch{return`${e||"Country"} · ${a||"Language"}`}}function mG(e,a){const s=e.trim().toUpperCase(),r=a.trim().toLowerCase();return{countryValid:R3.some(u=>u.value===s),languageValid:O3.some(u=>u.value===r)}}function pG(e){const a=e.replace(/^\[|\]$/g,"");return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(a)||a.includes(":")}function hG(e){const a=e.trim();if(!a)return null;const s=/^[a-z][a-z\d+.-]*:\/\//i.test(a)?a:`https://${a}`;let r;try{r=new URL(s)}catch{return null}if(r.protocol!=="http:"&&r.protocol!=="https:")return null;const u=r.hostname.toLowerCase().replace(/^www\./,"");if(!u||u==="localhost"||pG(u)||!u.includes("."))return null;const f=u.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return f?{canonicalDomain:u,projectName:f,displayName:u}:null}async function fG(e,a=rG){let s;const r=new Promise(f=>{s=setTimeout(()=>f({state:"timed-out"}),a)}),u=await Promise.race([e.then(f=>({state:"queued",run:f})),r]);return s&&clearTimeout(s),u}function gG(e,a){e.catch(()=>{nn({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:${a}`})})}function B3(e){const a=z.useRef(C3()).current,s=z.useRef(new Set),r=z.useCallback((u,f)=>{if(f){if(s.current.has(f))return;s.current.add(f)}Rx({...u,surface:e,eventId:N3()})},[e]);return{onboardingSessionId:a,emit:r}}function Yv(e,a){return e instanceof hn&&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:a}function yG(){return c.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Preparing setup"}),c.jsx("p",{className:"page-subtitle",children:"Checking the projects already on this install."})]})}),c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-default bg-surface p-4 text-sm text-secondary",role:"status",children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading projects…"]})]})}function bG({onRetry:e}){return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Can’t load projects"}),c.jsx("p",{className:"page-subtitle",children:"Canonry could not confirm whether this install already has a project."})]})}),c.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[c.jsx("p",{className:"text-sm font-medium text-heading",children:"Setup is paused to protect existing projects."}),c.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),c.jsx(ge,{type:"button",className:"mt-4",variant:"secondary",onClick:e,children:"Retry project check"})]})]})}function vG({projectName:e,initialRunId:a}){return c.jsx(af,{title:"Site Health setup",children:c.jsx(xG,{projectName:e,initialRunId:a})})}function xG({projectName:e,initialRunId:a}){const s=Ps(),r=Ot({...Vs({client:ae}),enabled:!!e,retry:!1,refetchOnMount:"always"}),{onboardingSessionId:u,emit:f}=B3("site_health");z.useEffect(()=>{e&&f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.started",step:"run",resumed:!!a},"onboarding.started")},[f,a,u,e]),z.useEffect(()=>{!e||!a||E3(e)?.runId!==a&&z3(e,a)},[a,e]);const b=Ot({...K0({client:ae,path:{id:a??""}}),enabled:!!a,refetchInterval:({state:j})=>{const E=j.data?.status;return E==="completed"||E==="partial"||E==="failed"||E==="cancelled"?!1:2e3},refetchIntervalInBackground:!0}).data?.status;if(z.useEffect(()=>{if(!e||!a||!b)return;if(b==="completed"||b==="partial"){f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"automatic"},"onboarding.step_completed:run"),qu(a);return}if(b!=="failed"&&b!=="cancelled")return;const j=b==="cancelled"?"run_cancelled":"run_failed";f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:j},`onboarding.blocked:run:${j}`),qu(a)},[f,a,u,e,b]),!e)return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Project not found"}),c.jsx("p",{className:"page-subtitle",children:"This setup link does not identify a project."})]})}),c.jsx(ge,{type:"button",variant:"secondary",onClick:()=>{s({to:"/projects"})},children:"View projects"})]});if(r.isPending)return c.jsxs("div",{className:"page-container max-w-3xl","aria-busy":"true","aria-live":"polite",children:[c.jsx(Yo,{current:"site"}),c.jsxs("div",{className:"mt-8 flex items-center gap-3 text-sm text-secondary",role:"status",children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health setup…"]})]});if(r.isError)return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Can’t resume setup"}),c.jsx("p",{className:"page-subtitle",children:"Canonry could not load the project for this Site Health scan."})]})}),c.jsxs("div",{className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",children:[c.jsx("p",{className:"text-sm text-secondary",children:"Check the connection or sign in again, then retry."}),c.jsx(ge,{type:"button",className:"mt-4",variant:"secondary",onClick:()=>{r.refetch()},children:"Retry project check"})]})]});const x=r.data.find(j=>j.name===e);if(!x)return c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx("div",{className:"page-header",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Project not found"}),c.jsxs("p",{className:"page-subtitle",children:["Canonry could not find ",e,". It will not open a different project."]})]})}),c.jsx(ge,{type:"button",variant:"secondary",onClick:()=>{s({to:"/projects"})},children:"View projects"})]});const k=()=>{s({to:"/setup",search:{onboarding:"site-health",setupProject:x.name},replace:!0})},S=()=>{s({to:"/setup",search:{experience:"legacy",onboarding:"site-health",setupProject:x.name},replace:!0})},C=()=>{f({flowVersion:nt,onboardingSessionId:u,event:"onboarding.step_completed",step:"run",method:"skipped"},"onboarding.step_completed:run"),s({to:"/projects/$projectName/technical-aeo",params:{projectName:x.name},replace:!0})};return c.jsxs("div",{className:"page-container max-w-7xl py-8 md:py-10",children:[c.jsx("h1",{className:"sr-only",children:"Set up Canonry"}),c.jsx(z.Suspense,{fallback:c.jsxs("div",{className:"space-y-5",children:[c.jsx(Yo,{current:"site"}),c.jsxs("div",{className:"flex min-h-72 items-center justify-center gap-3 text-sm text-secondary",role:"status",children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),"Loading Site Health…"]})]}),children:c.jsx(oG,{projectName:x.name,projectId:x.id,initialRunId:a,onReleaseInitialRun:k,showOnboardingActions:!0,onContinueOnboarding:S,onSkipOnboarding:C})})]})}function kG(){const e=Jv({from:"/setup"}),a=e.onboarding==="site-health"&&!e.setupProject,s=e.onboarding==="site-health"&&e.experience!=="legacy",r=V6(),u=e.experience==="legacy"?"legacy":e.experience==="platform"?"platform":r,[f,g]=z.useState(!1),b=Ot({...Vs({client:ae}),enabled:u==="auto",retry:!1,refetchOnMount:"always"}),x=u==="auto"&&b.isSuccess&&b.isFetchedAfterMount&&b.data.length===0;z.useEffect(()=>{x&&g(!0)},[x]);const k=u!=="auto"?{state:"idle"}:b.isSuccess&&b.isFetchedAfterMount?{state:"success",projectCount:b.data.length}:b.isError?{state:"error"}:{state:"loading"},S=u==="legacy"?"legacy":f||x?"platform":uG(u,k);return a||s?c.jsx(vG,{projectName:e.setupProject,initialRunId:e.siteHealthRunId}):S==="legacy"?c.jsx(iG,{visibilityProjectName:e.setupProject,siteHealthOnboarding:e.onboarding==="site-health"}):S==="loading"?c.jsx(yG,{}):S==="retry"?c.jsx(bG,{onRetry:()=>{b.refetch()}}):c.jsx(wG,{onActivationStarted:()=>g(!0),skipSiteScan:e.siteScan==="skip"})}function wG({onActivationStarted:e,skipSiteScan:a}){return c.jsx(af,{title:"Site Health setup",children:c.jsx(SG,{onActivationStarted:e,skipSiteScan:a})})}function SG({onActivationStarted:e,skipSiteScan:a}){const s=Ps(),r=va(),u=XU(),f=Ot({...IM({client:ae}),retry:!1}),g=Fi(VM()),[b,x]=z.useState(""),[k,S]=z.useState(""),[C,j]=z.useState(""),[E,J]=z.useState("US"),[T,$]=z.useState("en"),[U,H]=z.useState(!1),[Z,oe]=z.useState("idle"),[le,re]=z.useState(null),[ne,Q]=z.useState(null),[Ae,Le]=z.useState(!1),[Oe,Ne]=z.useState(null),[_e,tt]=z.useState(!1),be=f.data,B=typeof be?.enabled=="boolean"?be.enabled:null,ie=g.isPending?g.variables.body.enabled:B,[fe,we]=z.useState(null),ee=z.useRef(null),{onboardingSessionId:qe,emit:je}=B3("platform");z.useEffect(()=>{je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.started",step:"project",resumed:!1},"onboarding.started")},[je,qe]);const F=hG(b),I=k||F?.projectName||"",ue=C||F?.displayName||"",G=Z==="creating"||Z==="dispatching",ce=ne??Oe,Ve=dG(E,T),{countryValid:Y,languageValid:De}=mG(E,T),Pe=Y&&De;z.useEffect(()=>{ce&&ee.current?.focus()},[ce]);const Te=(Me,ct)=>s({to:"/setup",search:{...ct?{siteHealthRunId:ct}:{},onboarding:"site-health",setupProject:Me.name},replace:!0}),Bt=async Me=>{oe("dispatching"),Ne(null);try{const ct=u.mutateAsync({projectName:Me.name,projectId:Me.id,projectLabel:Me.displayName||Me.name,suppressErrorToast:!0,body:{checkDeadLinks:!0}}),Zt=await fG(ct);if(Zt.state==="queued"){je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"}),await Te(Me,Zt.run.runId);return}ct.then(()=>{je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"queued",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0"})},ns=>{je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:fl(ns,"run_rejected")})}),gG(ct,Me.id),await Te(Me)}catch(ct){oe("recovery"),Ne(Yv(ct,"The project was created, but the Site Health scan could not be started."));const Zt=fl(ct,"run_rejected");je({flowVersion:nt,onboardingSessionId:qe,event:"run.requested",origin:"dashboard_setup",result:"rejected",kind:"site_health",providerCountBucket:"0",queryCountBucket:"0",reasonCode:Zt}),je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.blocked",step:"run",action:"retry_run",reasonCode:Zt},`onboarding.blocked:run:${Zt}`)}},rt=async Me=>{if(Me.preventDefault(),!(!F||!a&&!U||!Pe||G)){oe("creating"),Q(null),Le(!1),Ne(null);try{const ct=await iC({name:I,displayName:ue,canonicalDomain:F.canonicalDomain,country:E,language:T});if(e(),re(ct),je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.step_completed",step:"project",method:"manual"},"onboarding.step_completed:project"),await r.invalidateQueries({queryKey:Qi({client:ae})}),a){await s({to:"/setup",search:{experience:"legacy",onboarding:"first-run",setupProject:ct.name},replace:!0});return}await Bt(ct)}catch(ct){oe("idle");const Zt=ct instanceof hn&&ct.statusCode===409;Le(Zt),Q(Yv(ct,"Could not create the project. Try again.")),je({flowVersion:nt,onboardingSessionId:qe,event:"onboarding.blocked",step:"project",action:"save",reasonCode:fl(ct,"project_create_failed")},"onboarding.blocked:project"),Zt&&(e(),r.invalidateQueries({queryKey:Qi({client:ae})}))}}},Sa=()=>{le&&!G&&Bt(le)},ui=()=>{G||s({to:"/projects"})},Gs=async()=>{try{await navigator.clipboard.writeText(cG),tt(!0)}catch{nn({tone:"negative",title:"Could not copy setup request",detail:"Open the agent quickstart to continue with the CLI instead."})}},yn=async Me=>{we(null);try{const ct=await g.mutateAsync({client:ae,body:{enabled:Me}});r.setQueryData(Hw({client:ae}),ct),ct.enabled!==Me&&we(`The server kept telemetry ${ct.enabled?"on":"off"}. Check its telemetry settings.`)}catch{we("Could not update telemetry. Try again.")}};return le&&Z==="recovery"?c.jsxs("div",{className:"page-container max-w-3xl",children:[c.jsx(Yo,{current:"site"}),c.jsx("div",{className:"page-header mt-8",children:c.jsxs("div",{className:"page-header-left",children:[c.jsx("h1",{className:"page-title",children:"Project created"}),c.jsxs("p",{className:"page-subtitle",children:[le.displayName||le.name," is ready. The Site Health scan needs another try."]})]})}),c.jsxs("div",{ref:ee,className:"rounded-lg border border-negative bg-negative-soft p-4",role:"alert",tabIndex:-1,children:[c.jsx("p",{className:"text-sm font-medium text-heading",children:Oe}),c.jsx("p",{className:"mt-1 text-sm text-secondary",children:"You can retry the scan or continue setup and retry from Site Health."}),c.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[c.jsx(ge,{type:"button",onClick:Sa,children:"Retry Site Health scan"}),c.jsx(ge,{type:"button",variant:"secondary",onClick:()=>{Te(le)},children:"Continue setup"})]})]})]}):c.jsxs("div",{className:"page-container max-w-xl py-8 md:py-12",children:[a?null:c.jsx(Yo,{current:"site"}),c.jsxs("header",{className:`mb-8 ${a?"":"mt-8"}`,children:[c.jsx("h1",{id:"site-map-setup-title",className:"text-2xl font-semibold tracking-[-0.025em] text-heading",children:a?"Create a project":"Map your site"}),c.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-secondary",children:a?"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."})]}),c.jsxs("form",{"aria-labelledby":"site-map-setup-title",className:"space-y-6",onSubmit:Kt(rt),noValidate:!0,children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-heading",htmlFor:"launchpad-domain",children:"Website URL"}),c.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&&!F),"aria-describedby":b&&!F?"launchpad-domain-hint launchpad-domain-error":"launchpad-domain-hint",placeholder:"https://example.com",value:b,onChange:Me=>{x(Me.target.value),Q(null),Le(!1)}}),c.jsx("p",{id:"launchpad-domain-hint",className:"text-sm text-secondary",children:a?c.jsxs(c.Fragment,{children:["A public domain is still required."," ",c.jsx(Xe,{to:"/setup",search:{experience:"platform"},className:"font-medium text-link underline-offset-4 hover:underline",children:"Map with Site Health instead"})]}):c.jsxs(c.Fragment,{children:["Only public pages are scanned."," ",c.jsx(Xe,{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&&!F?c.jsx("p",{id:"launchpad-domain-error",className:"text-sm text-negative",role:"alert",children:"Enter a public domain, such as example.com."}):null]}),c.jsxs("details",{className:"group border-y border-default",children:[c.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:[c.jsx("span",{className:"font-medium text-heading",children:"Advanced settings"}),c.jsxs("span",{className:"flex items-center gap-2 text-secondary",children:[Ve,c.jsx(Rh,{className:"size-4 transition-transform group-open:rotate-180 motion-reduce:transition-none","aria-hidden":"true"})]})]}),c.jsxs("div",{className:"space-y-5 border-t border-default py-4",children:[F?c.jsxs("div",{children:[c.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Project"}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-project-name",children:"Project name"}),c.jsx("input",{id:"launchpad-project-name",className:"setup-input h-10",type:"text",value:I,onChange:Me=>S(Me.target.value)})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-display-name",children:"Display name"}),c.jsx("input",{id:"launchpad-display-name",className:"setup-input h-10",type:"text",value:ue,onChange:Me=>j(Me.target.value)})]})]})]}):null,c.jsxs("div",{children:[c.jsx("p",{className:"mb-3 text-sm font-medium text-heading",children:"Locale"}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-country",children:"Country"}),c.jsx("select",{id:"launchpad-country",className:"setup-input h-10",value:E,onChange:Me=>J(Me.target.value),children:R3.map(Me=>c.jsx("option",{value:Me.value,children:Me.label},Me.value))})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx("label",{className:"text-sm text-secondary",htmlFor:"launchpad-language",children:"Language"}),c.jsx("select",{id:"launchpad-language",className:"setup-input h-10",value:T,onChange:Me=>$(Me.target.value),children:O3.map(Me=>c.jsx("option",{value:Me.value,children:Me.label},Me.value))})]})]})]})]})]}),a?null:c.jsxs("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 py-2",children:[c.jsx("input",{className:"mt-0.5 size-4 shrink-0 rounded border-strong bg-bg",type:"checkbox",checked:U,onChange:Me=>H(Me.target.checked),"aria-label":"Allow Canonry to scan this public site.","aria-describedby":"local-crawl-note"}),c.jsxs("span",{className:"grid gap-0.5",children:[c.jsx("span",{className:"text-sm leading-5 text-heading",children:"Allow Canonry to scan this public site."}),c.jsx("span",{id:"local-crawl-note",className:"text-sm leading-5 text-secondary",children:"The crawl runs on this Canonry instance, follows internal links, and stores its results locally."})]})]}),ce?c.jsxs("div",{ref:ee,className:"rounded-md border border-negative bg-negative-soft p-3",role:"alert",tabIndex:-1,children:[c.jsx("p",{className:"text-sm font-medium text-heading",children:ce}),Ae?c.jsx(ge,{type:"button",variant:"secondary",size:"sm",className:"mt-3",onClick:ui,children:"View projects"}):null]}):null,c.jsxs("div",{className:"grid gap-2",children:[c.jsx(ge,{className:"h-11 w-full",type:"submit",disabled:!F||!a&&!U||!Pe||G,children:Z==="creating"||Z==="dispatching"?c.jsxs(c.Fragment,{children:[c.jsx(Lo,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"})," ",a?"Creating project…":"Mapping site…"]}):a?"Create project":"Map site"}),Z==="dispatching"?c.jsx("span",{className:"text-center text-sm text-secondary",role:"status",children:"Opening Site Health when the scan is ready."}):null]})]}),c.jsxs("section",{className:"mt-8 border-t border-default pt-6","aria-labelledby":"agent-setup-title",children:[c.jsx("p",{id:"agent-setup-title",className:"text-sm font-medium text-heading",children:"Use your agent instead"}),c.jsx("p",{className:"mt-1 text-sm leading-5 text-secondary",children:"Copy a complete CLI setup request into any coding agent."}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[c.jsxs(ge,{type:"button",variant:"ghost",size:"sm",className:"-ml-3",onClick:Kt(Gs),children:[_e?c.jsx(Oh,{className:"size-3.5","aria-hidden":"true"}):c.jsx(lx,{className:"size-3.5","aria-hidden":"true"}),c.jsx("span",{"aria-live":"polite",children:_e?"Copied setup request":"Copy setup request"})]}),c.jsx(ge,{asChild:!0,variant:"ghost",size:"sm",children:c.jsxs("a",{href:lG,target:"_blank",rel:"noopener noreferrer",children:["Agent quickstart",c.jsx(y4,{className:"size-3.5","aria-hidden":"true"}),c.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})})]})]}),B!==null?c.jsxs("section",{className:"mt-6 border-t border-default pt-5","aria-labelledby":"telemetry-title",children:[c.jsxs("label",{className:`flex min-h-11 items-start gap-3 py-2 ${g.isPending?"cursor-wait":"cursor-pointer"}`,children:[c.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:ie??!1,disabled:g.isPending,onChange:Me=>{yn(Me.target.checked)},"aria-describedby":"telemetry-detail"}),c.jsxs("span",{className:"grid gap-0.5",children:[c.jsx("span",{id:"telemetry-title",className:"text-sm leading-5 text-heading",children:"Share anonymous product telemetry"}),c.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."})]})]}),g.isPending?c.jsx("p",{className:"mt-1 text-sm text-secondary",role:"status",children:"Saving preference…"}):null,fe?c.jsx("p",{className:"mt-1 text-sm text-negative",role:"alert",children:fe}):null]}):null]})}function jG(){return c.jsx("div",{className:"page-container",children:c.jsx("section",{className:"page-section",children:c.jsxs(ia,{className:"surface-card empty-card",children:[c.jsx("h1",{children:"Route not found"}),c.jsx("p",{children:"The current path does not map to a dashboard view."}),c.jsx(ge,{asChild:!0,children:c.jsx(Xe,{to:"/",children:"Return to overview"})})]})})})}const ra=Zi(()=>ci(()=>import("./ProjectPage-D3AuGcau.js"),__vite__mapDeps([5,1,2,6,0,3,4,7,8,9,10,11,12]),import.meta.url),"ProjectPage"),AG=Zi(()=>ci(()=>import("./RunsPage-DhdjoIdK.js"),__vite__mapDeps([13,1,6,10,4,2,11,12]),import.meta.url),"RunsPage"),CG=Zi(()=>ci(()=>import("./HistoryPage-B4WWIXmx.js"),__vite__mapDeps([14,1,8,10,4,2,11,12]),import.meta.url),"HistoryPage"),NG=Zi(()=>ci(()=>import("./SettingsPage-XzHCmYz4.js"),__vite__mapDeps([15,1,10,4,2,11,12]),import.meta.url),"SettingsPage"),_G=Zi(()=>ci(()=>import("./BacklinksPage-DaEn1w9_.js"),__vite__mapDeps([16,1,2,10,4,11,12]),import.meta.url),"BacklinksPage"),zG=Zi(()=>ci(()=>import("./TrafficPage-2AKICLH_.js"),__vite__mapDeps([17,1,7,2,10,4,11,12]),import.meta.url),"TrafficPage"),EG=Zi(()=>ci(()=>import("./TrafficSourceDetailPage-CYVG7qZ0.js"),__vite__mapDeps([18,1,7,3,4,2,10,11,12]),import.meta.url),"TrafficSourceDetailPage"),DG=Zi(()=>ci(()=>import("./MeasurementPropertyPage-DFvelKfS.js"),__vite__mapDeps([19,1,3,4,9,2,10,11,12]),import.meta.url),"MeasurementPropertyPage");function TG(){return c.jsx(zU,{children:c.jsx(_U,{})})}const fn=Hj()({component:TG,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:void 0,experience:e.experience==="legacy"||e.experience==="platform"?e.experience:void 0,siteScan:e.siteScan==="skip"?"skip":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})}),RG=St({getParentRoute:()=>fn,path:"/",component:OU,beforeLoad:async({context:e})=>{let a=e.queryClient.getQueryData(Qi({client:ae}));if(a===void 0)try{a=await e.queryClient.ensureQueryData(Vs({client:ae}))}catch{return}if(a.length===0)throw ex({to:"/setup"})}}),OG=St({getParentRoute:()=>fn,path:"/projects",component:MU}),BG=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Dn=St({getParentRoute:()=>fn,path:"/projects/$projectName",component:()=>c.jsx(Wp,{}),beforeLoad:async({context:e,params:a,location:s})=>{const r=a.projectName;if(!BG.test(r))return;let u=e.queryClient.getQueryData(Qi({client:ae}));if(!u)try{u=await e.queryClient.ensureQueryData(Vs({client:ae}))}catch{return}const f=u.find(g=>g.id===r);if(f)throw ex({to:s.pathname.replace(`/projects/${r}`,`/projects/${encodeURIComponent(f.name)}`),replace:!0})}}),qG=St({getParentRoute:()=>Dn,path:"/",component:()=>c.jsx(ra,{tab:"overview"})}),PG=St({getParentRoute:()=>Dn,path:"/portfolio",component:()=>c.jsx(ra,{tab:"portfolio"})}),MG=St({getParentRoute:()=>Dn,path:"/search-console",component:()=>c.jsx(ra,{tab:"search-console"})}),IG=St({getParentRoute:()=>Dn,path:"/conversions",component:()=>c.jsx(ra,{tab:"conversions"})}),VG=St({getParentRoute:()=>Dn,path:"/local",component:()=>c.jsx(ra,{tab:"local"})}),LG=St({getParentRoute:()=>Dn,path:"/discovery",component:()=>c.jsx(ra,{tab:"discovery"})}),UG=St({getParentRoute:()=>Dn,path:"/properties/$targetKey",component:()=>c.jsx(DG,{})}),GG=St({getParentRoute:()=>Dn,path:"/report",component:()=>c.jsx(ra,{tab:"report"})}),$G=St({getParentRoute:()=>Dn,path:"/activity",component:()=>c.jsx(ra,{tab:"activity"})}),KG=St({getParentRoute:()=>Dn,path:"/backlinks",component:()=>c.jsx(ra,{tab:"backlinks"})}),HG=St({getParentRoute:()=>Dn,path:"/technical-aeo",component:()=>c.jsx(ra,{tab:"technical-aeo"})}),QG=St({getParentRoute:()=>Dn,path:"/history",component:()=>c.jsx(ra,{tab:"history"})}),FG=St({getParentRoute:()=>Dn,path:"/settings",component:()=>c.jsx(ra,{tab:"settings"})}),ZG=St({getParentRoute:()=>fn,path:"/runs",component:AG}),YG=St({getParentRoute:()=>fn,path:"/history",component:CG}),XG=St({getParentRoute:()=>fn,path:"/settings",component:NG,beforeLoad:({context:e})=>{}}),JG=St({getParentRoute:()=>fn,path:"/setup",component:kG}),WG=St({getParentRoute:()=>fn,path:"/backlinks",component:_G}),e$=St({getParentRoute:()=>fn,path:"/traffic",component:zG}),t$=St({getParentRoute:()=>fn,path:"/traffic/$projectName/$sourceId",component:EG}),n$=St({getParentRoute:()=>fn,path:"*",component:jG}),a$=fn.addChildren([RG,OG,Dn.addChildren([qG,PG,MG,IG,VG,LG,UG,GG,$G,KG,HG,QG,FG]),ZG,YG,XG,JG,WG,e$,t$,n$]);function i$(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const Xv=i$(),s$=Xv==="/"?"":Xv.replace(/\/$/,"");function o$(e,a){return Qj({routeTree:a$,basepath:s$||"/",context:{queryClient:e},...a?.initialEntries})}const r$=6e4;function l$(){const e=z.useRef(eC()).current,[a,s]=z.useState(e?"ready":"checking"),[r,u]=z.useState(null),[f,g]=z.useState(null),[b,x]=z.useState(e),[k,S]=z.useState(!1),[C,j]=z.useState(""),[E,J]=z.useState(""),[T,$]=z.useState(""),[U,H]=z.useState(!1),[Z,oe]=z.useState("password"),[le,re]=z.useState(null),[ne,Q]=z.useState(!1),[Ae,Le]=z.useState(!1),Oe=z.useRef(null),Ne=z.useRef(null),_e=z.useRef(null),tt=()=>{const G=r?`${r.name}:${r.role}`:e?"api-key:explicit":f?`api-key:${f.id}`:"no-accounts";if(!Oe.current||_e.current!==G){Ne.current?.clear();const ce=nM();Ne.current=ce,Oe.current=o$(ce),_e.current=G}return{queryClient:Ne.current,router:Oe.current}},be=G=>G.authRequired?(S(!0),u(G.user),g(null),x(!1),s(G.user?"ready":"account-login"),!0):!1;z.useEffect(()=>{let G=!1;const ce=async(Ve,Y=!1)=>{try{const De=await Cp();if(G)return;g(De),x(!1),s("ready")}catch(De){if(G)return;if(Y&&De instanceof hn&&De.statusCode===401)return pC().then(()=>{G||(re(null),g(null),x(!1),Le(!0),s("login"))}).catch(Pe=>{G||(re(Pe instanceof Error?Pe.message:"Could not clear the invalid session"),s(Ve))});re(De instanceof Error?De.message:"Could not verify API key access"),s(Ve)}};return e?(ce("api-key-error"),()=>{G=!0}):(Promise.allSettled([Uy(),Ly()]).then(([Ve,Y])=>{if(G||Ve.status==="fulfilled"&&be(Ve.value))return;if(Y.status==="rejected"){const Pe=Y.reason;re(Pe instanceof Error?Pe.message:"Failed to reach the Canonry API"),s("login");return}const De=Y.value;De.authenticated?(x(!0),ce("api-key-error",!0)):(g(null),x(!1),s(De.setupRequired?"setup":"login"))}),()=>{G=!0})},[]),z.useEffect(()=>{if(a!=="ready"||e)return;const G=setInterval(()=>{if(k){Uy().then(ce=>{ce.authRequired&&!ce.user&&(Le(!0),u(null),g(null),s("account-login"))}).catch(()=>{});return}Ly().then(ce=>{ce.authenticated||(Le(!0),g(null),s(ce.setupRequired?"setup":"login"))}).catch(()=>{})},r$);return Vy(()=>{Le(!0),u(null),g(null),x(!1),s(k?"account-login":"login")}),()=>{clearInterval(G),Vy(null)}},[a,k,e]);const B=async G=>{if(G.preventDefault(),!E.trim()||E.trim().length<8){re("Password must be at least 8 characters");return}if(E!==T){re("Passwords do not match");return}Q(!0),re(null);try{if(!(await uC(E.trim())).authenticated){re("Setup failed");return}J(""),$(""),H(!1),Le(!1),g(null),x(!0),s("checking");try{const Ve=await Cp();g(Ve),x(!1),s("ready")}catch(Ve){re(Ve instanceof Error?Ve.message:"Could not verify API key access"),s("api-key-error")}}catch(ce){re(ce instanceof hn||ce instanceof Error?ce.message:"Setup failed")}finally{Q(!1)}},ie=G=>{J(G),re(null)},fe=G=>{$(G),re(null)},we=async G=>{if(G.preventDefault(),!!E.trim()){Q(!0),re(null);try{if(!(Z==="api-key"?await mC(E.trim()):await dC(E.trim())).authenticated){re(Z==="api-key"?"Invalid API key":"Incorrect password");return}const Ve=await Cp();g(Ve),x(!1),J(""),H(!1),Le(!1),s("ready")}catch(ce){re(ce instanceof hn||ce instanceof Error?ce.message:"Authentication failed")}finally{Q(!1)}}},ee=G=>{oe(G),J(""),H(!1),re(null)},qe=async G=>{if(G.preventDefault(),!(!C.trim()||!E)){Q(!0),re(null);try{const ce=await hC(C.trim(),E);if(!ce.user){re("Incorrect name or password.");return}J(""),Le(!1),u(ce.user),g(null),x(!1),s("ready")}catch(ce){re(ce instanceof hn?ce.message:"Incorrect name or password.")}finally{Q(!1)}}};if(a==="ready"){const{queryClient:G,router:ce}=tt();return c.jsx(HP,{account:r,apiKey:f,apiKeyPending:b,children:c.jsx(Fj,{client:G,children:c.jsx(Zj,{router:ce})})})}const je=E.trim(),F=E.length>0&&je.length<8,I=T.length>0&&E!==T,ue=je.length>=8&&E===T;return c.jsx("div",{className:"min-h-screen bg-bg px-4 py-8",children:c.jsxs("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col items-center justify-center gap-5",children:[c.jsxs("div",{"data-testid":"auth-brand",className:"flex items-center gap-2.5",children:[c.jsx("img",{className:"size-7",src:"./favicon.svg",alt:"","aria-hidden":"true"}),c.jsx("span",{className:"text-lg font-semibold tracking-tight text-heading",children:"Canonry"})]}),c.jsx(ia,{className:"surface-card w-full",children:a==="checking"?c.jsx(Es,{className:"py-8",children:c.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):a==="api-key-error"?c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Could not verify API key access"})]}),c.jsxs(Es,{className:"space-y-4",children:[c.jsx("p",{className:"supporting-copy",children:le??"Canonry could not verify this session’s access, so the dashboard stayed locked."}),c.jsx(ge,{type:"button",className:"w-full",onClick:()=>{window.location.reload()},children:"Try again"})]})]}):a==="account-login"?c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"})]}),c.jsxs(Es,{children:[Ae?c.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,c.jsxs("form",{className:"space-y-4",onSubmit:Kt(qe),children:[c.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-name",children:[c.jsx("span",{className:"text-xs font-medium text-secondary",children:"Name"}),c.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:C,onChange:G=>{j(G.target.value),re(null)},"aria-invalid":!!le,"aria-describedby":le?"account-login-error":void 0})]}),c.jsxs("label",{className:"block space-y-1.5",htmlFor:"account-password",children:[c.jsx("span",{className:"text-xs font-medium text-secondary",children:"Password"}),c.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:E,onChange:G=>ie(G.target.value),"aria-invalid":!!le,"aria-describedby":le?"account-login-error":void 0})]}),le?c.jsx("p",{id:"account-login-error",role:"alert",className:"text-sm text-negative-400",children:le}):null,c.jsx(ge,{type:"submit",disabled:ne||!C.trim()||!E,children:ne?"Signing in…":"Sign in"})]})]})]}):a==="setup"?c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Create a dashboard password"}),c.jsx(Ou,{children:"Stored on this Canonry install as a salted, one-way hash. Canonry cannot recover it."})]}),c.jsx(Es,{children:c.jsxs("form",{className:"space-y-4",onSubmit:Kt(B),children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-new",children:"Password"}),c.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:U?"text":"password",name:"new-password",autoComplete:"new-password",minLength:8,required:!0,value:E,onChange:G=>ie(G.target.value),"aria-invalid":F,"aria-describedby":"dashboard-password-new-help"}),c.jsx("span",{id:"dashboard-password-new-help","aria-live":"polite",className:F?"block text-sm text-negative-400":"block text-sm text-secondary",children:F?"Enter at least 8 characters.":"Use at least 8 characters."})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("label",{className:"block text-xs font-medium text-secondary",htmlFor:"dashboard-password-confirm",children:"Confirm password"}),c.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:U?"text":"password",name:"confirm-password",autoComplete:"new-password",minLength:8,required:!0,value:T,onChange:G=>fe(G.target.value),"aria-invalid":I,"aria-describedby":"dashboard-password-confirm-help"}),c.jsx("span",{id:"dashboard-password-confirm-help","aria-live":"polite",className:I?"block text-sm text-negative-400":"block text-sm text-secondary",children:I?"Passwords do not match.":"Enter the same password again."})]}),c.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-password-show",children:[c.jsx("input",{id:"dashboard-password-show",type:"checkbox",checked:U,onChange:G=>H(G.target.checked)}),"Show passwords"]}),le?c.jsx("p",{id:"dashboard-password-setup-error",role:"alert",className:"text-sm text-negative-400",children:le}):null,c.jsx(ge,{type:"submit",disabled:ne||!ue,children:ne?"Creating password…":"Create password and continue"})]})})]}):c.jsxs(c.Fragment,{children:[c.jsxs(Po,{children:[c.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),c.jsx("h1",{className:"font-medium tracking-tight text-primary",children:"Sign in to Canonry"}),c.jsx(Ou,{children:Z==="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."})]}),c.jsxs(Es,{children:[Ae?c.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,c.jsxs("form",{className:"space-y-4",onSubmit:Kt(we),children:[c.jsxs("label",{className:"block space-y-1.5",htmlFor:"dashboard-password-current",children:[c.jsx("span",{className:"text-xs font-medium text-secondary",children:Z==="api-key"?"Canonry API key":"Password"}),c.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:U?"text":"password",name:Z==="api-key"?"apiKey":"password",autoComplete:Z==="api-key"?"off":"current-password",spellCheck:!1,required:!0,value:E,onChange:G=>ie(G.target.value),"aria-invalid":!!le,"aria-describedby":le?"dashboard-password-login-error":void 0})]}),c.jsxs("label",{className:"flex min-h-10 cursor-pointer items-center gap-2 text-sm text-secondary",htmlFor:"dashboard-login-password-show",children:[c.jsx("input",{id:"dashboard-login-password-show",type:"checkbox",checked:U,onChange:G=>H(G.target.checked)}),Z==="api-key"?"Show API key":"Show password"]}),le?c.jsx("p",{id:"dashboard-password-login-error",role:"alert",className:"text-sm text-negative-400",children:le}):null,c.jsx(ge,{type:"submit",disabled:ne||!E.trim(),children:ne?"Signing in…":"Open dashboard"}),c.jsx(ge,{type:"button",variant:"ghost",onClick:()=>ee(Z==="api-key"?"password":"api-key"),children:Z==="api-key"?"Use dashboard password instead":"Forgot password? Use API key"})]})]})]})})]})})}const q3=document.getElementById("root");if(!q3)throw new Error("Expected #root element for web app bootstrap.");j4.createRoot(q3).render(c.jsx(z.StrictMode,{children:c.jsx(l$,{})}));export{SQ as $,rQ as A,ge as B,zu as C,uQ as D,cQ as E,nK as F,mH as G,tK as H,ll as I,pK as J,nn as K,pQ as L,sF as M,hQ as N,rK as O,aL as P,fQ as Q,lK as R,sM as S,rn as T,iK as U,oK as V,dQ as W,mQ as X,lQ as Y,aK as Z,gQ as _,iF as a,WH as a$,vQ as a0,kQ as a1,xQ as a2,wQ as a3,jC as a4,H0 as a5,Ee as a6,bQ as a7,Yw as a8,li as a9,cH as aA,uH as aB,LQ as aC,UQ as aD,GQ as aE,cK as aF,Qi as aG,uK as aH,G0 as aI,BQ as aJ,DM as aK,MH as aL,wa as aM,VH as aN,FH as aO,iQ as aP,aQ,HH as aR,tQ as aS,oQ as aT,UH as aU,YH as aV,XH as aW,JH as aX,LH as aY,ZH as aZ,GH as a_,yQ as aa,mF as ab,tR as ac,nR as ad,KK as ae,$K as af,RK as ag,IK as ah,VK as ai,hn as aj,LK as ak,M$ as al,oM as am,rV as an,bu as ao,UK as ap,jh as aq,qQ as ar,mz as as,sK as at,GK as au,yM as av,PM as aw,DH as ax,RH as ay,TH as az,C2 as b,UM as b$,$H as b0,eQ as b1,QH as b2,nQ as b3,sQ as b4,HU as b5,KH as b6,pe as b7,B$ as b8,O$ as b9,nH as bA,sH as bB,oH as bC,WK as bD,aH as bE,K$ as bF,$$ as bG,G$ as bH,wK as bI,MM as bJ,IH as bK,vH as bL,fv as bM,Z$ as bN,Y$ as bO,yH as bP,bH as bQ,X$ as bR,J$ as bS,eK as bT,W$ as bU,Ol as bV,Vs as bW,FL as bX,kM as bY,Ds as bZ,Pu as b_,R$ as ba,T$ as bb,z$ as bc,_$ as bd,D$ as be,E$ as bf,N$ as bg,C$ as bh,v$ as bi,x$ as bj,A$ as bk,j$ as bl,S$ as bm,k$ as bn,w$ as bo,b$ as bp,y$ as bq,g$ as br,f$ as bs,Z4 as bt,tH as bu,OQ as bv,eH as bw,kK as bx,dF as by,iH as bz,dH as c,MK as c$,WU as c0,Cx as c1,kH as c2,wH as c3,uF as c4,YU as c5,OH as c6,SH as c7,NH as c8,jH as c9,yK as cA,Fo as cB,$0 as cC,rF as cD,pd as cE,Z0 as cF,qH as cG,PH as cH,Z6 as cI,q$ as cJ,P$ as cK,F$ as cL,dK as cM,mK as cN,af as cO,hd as cP,Y0 as cQ,JU as cR,xK as cS,Zo as cT,yv as cU,DK as cV,OK as cW,qK as cX,PK as cY,TK as cZ,BK as c_,BH as ca,oF as cb,AH as cc,pn as cd,aC as ce,dM as cf,V$ as cg,L$ as ch,I$ as ci,oC as cj,U$ as ck,gM as cl,xM as cm,H$ as cn,jQ as co,bC as cp,bK as cq,CQ as cr,NQ as cs,_Q as ct,AQ as cu,hH as cv,hK as cw,fK as cx,gK as cy,vK as cz,DQ as d,iL as d0,h3 as d1,cL as d2,f3 as d3,g3 as d4,EK as d5,IQ as d6,qU as d7,lH as d8,P0 as d9,nF as dA,aF as dB,QQ as dC,FQ as dD,HK as dE,XQ as dF,eF as dG,YQ as dH,WQ as dI,Yo as dJ,YK as dK,JQ as dL,IR as dM,JK as dN,XK as dO,xH as da,PQ as db,VQ as dc,zK as dd,rH as de,NK as df,_K as dg,CK as dh,MQ as di,Q9 as dj,_H as dk,CH as dl,EH as dm,zH as dn,FK as dp,ci as dq,oa as dr,QK as ds,$Q as dt,HQ as du,KQ as dv,XU as dw,ZQ as dx,ZK as dy,tF as dz,ia as e,ae as f,zQ as g,_v as h,Nx as i,Nn as j,Kt as k,EQ as l,RQ as m,TQ as n,SK as o,AK as p,jK as q,lF as r,cF as s,lM as t,X0 as u,Nh as v,fH as w,pH as x,gH as y,Q$ as z};
|
package/assets/assets/{react-sigma_core.esm.min-Drqprr9L.js → react-sigma_core.esm.min-D5Honb13.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Bt,t as S,r as C}from"./vendor-tanstack-CYBjbqVr.js";import{e as Ht,G as Wt}from"./SiteHealthSection-
|
|
1
|
+
import{g as Bt,t as S,r as C}from"./vendor-tanstack-CYBjbqVr.js";import{e as Ht,G as Wt}from"./SiteHealthSection-BODUx0bX.js";import"./index-B64WXjg8.js";import"./vendor-radix-BpmvLvpp.js";import"./vendor-recharts-FA0uySU7.js";import"./vendor-lucide-XjCNFK0x.js";import"./vendor-markdown-9tTeP8v7.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-DLEICrrL.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
|
package/assets/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
|
|
13
13
|
<link rel="apple-touch-icon" href="./apple-touch-icon.png" />
|
|
14
14
|
<title>Canonry</title>
|
|
15
|
-
<script type="module" crossorigin src="./assets/index-
|
|
15
|
+
<script type="module" crossorigin src="./assets/index-B64WXjg8.js"></script>
|
|
16
16
|
<link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-CYBjbqVr.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="./assets/vendor-radix-BpmvLvpp.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="./assets/vendor-recharts-FA0uySU7.js">
|
|
@@ -652,7 +652,7 @@ import {
|
|
|
652
652
|
wordpressSchemaDeployResultDtoSchema,
|
|
653
653
|
wordpressSchemaStatusResultDtoSchema,
|
|
654
654
|
wordpressStatusDtoSchema
|
|
655
|
-
} from "./chunk-
|
|
655
|
+
} from "./chunk-Z2HTLTQV.js";
|
|
656
656
|
|
|
657
657
|
// src/intelligence-service.ts
|
|
658
658
|
import { eq as eq63, desc as desc27, asc as asc12, and as and52, ne as ne8, or as or14, inArray as inArray23, gte as gte16, lte as lte13, isNull as isNull9, sql as sql25, exists } from "drizzle-orm";
|
|
@@ -38203,7 +38203,7 @@ var routeCatalog = [
|
|
|
38203
38203
|
sitemapUrl: { ...stringSchema, description: "Deprecated compatibility alias for the sitemap override." },
|
|
38204
38204
|
limit: { ...integerSchema, minimum: 1, maximum: 2e3, description: "Deprecated compatibility alias for maxPages. Max 2000." },
|
|
38205
38205
|
maxPages: { ...integerSchema, minimum: 1, maximum: 5e4, description: "Crawl page budget. Defaults to 1000; max 50000." },
|
|
38206
|
-
maxEdges: { ...integerSchema, minimum: 1, maximum: 1e6, description: "Internal-link observation budget.
|
|
38206
|
+
maxEdges: { ...integerSchema, minimum: 1, maximum: 1e6, description: "Internal-link observation budget. When omitted the crawl engine derives it from the page count; max 1000000." },
|
|
38207
38207
|
maxDepth: { ...integerSchema, minimum: 0, maximum: 100, description: "Maximum crawl depth from the root. Max 100." },
|
|
38208
38208
|
checkDeadLinks: { ...booleanSchema, default: false, description: "Enable dead-link checking. Defaults to false." }
|
|
38209
38209
|
}
|
|
@@ -79595,7 +79595,9 @@ async function technicalAeoRoutes(app, opts) {
|
|
|
79595
79595
|
sitemapUrl: effectiveRequest.sitemapUrl ?? void 0,
|
|
79596
79596
|
limit: parsed.data.limit,
|
|
79597
79597
|
maxPages: effectiveRequest.maxPages,
|
|
79598
|
-
|
|
79598
|
+
// Stays undefined when unset so the engine derives the edge budget
|
|
79599
|
+
// from the page count instead of inheriting a flat ceiling here.
|
|
79600
|
+
maxEdges: effectiveRequest.maxEdges ?? void 0,
|
|
79599
79601
|
maxDepth: effectiveRequest.maxDepth ?? void 0,
|
|
79600
79602
|
checkDeadLinks: effectiveRequest.checkDeadLinks
|
|
79601
79603
|
});
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
loadConfig,
|
|
12
12
|
loadConfigRaw,
|
|
13
13
|
saveConfigPatch
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VFQPW2VX.js";
|
|
15
15
|
import {
|
|
16
16
|
CC_CACHE_DIR,
|
|
17
17
|
DUCKDB_SPEC,
|
|
@@ -157,7 +157,7 @@ import {
|
|
|
157
157
|
siteCrawlSnapshots,
|
|
158
158
|
toAlertView,
|
|
159
159
|
usageCounters
|
|
160
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-ISONU3FA.js";
|
|
161
161
|
import {
|
|
162
162
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
163
163
|
AGENT_PROVIDER_IDS,
|
|
@@ -296,7 +296,7 @@ import {
|
|
|
296
296
|
validationError,
|
|
297
297
|
winnabilityClassLabel,
|
|
298
298
|
withRetry
|
|
299
|
-
} from "./chunk-
|
|
299
|
+
} from "./chunk-Z2HTLTQV.js";
|
|
300
300
|
|
|
301
301
|
// src/telemetry.ts
|
|
302
302
|
import crypto from "crypto";
|
|
@@ -11304,15 +11304,17 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
11304
11304
|
indexabilityVersion: crawlSummary.indexabilityRulesetVersion,
|
|
11305
11305
|
linkScoreVersion: crawlSummary.linkScoreAlgorithmVersion,
|
|
11306
11306
|
effectiveOptions: {
|
|
11307
|
+
// Null, never absent: a reader must be able to tell "the operator set
|
|
11308
|
+
// no edge budget and the engine derived one" from a missing field.
|
|
11307
11309
|
mode: "summary",
|
|
11308
11310
|
sitemapUrl: opts.sitemapUrl ?? null,
|
|
11309
11311
|
maxPages,
|
|
11310
|
-
maxEdges,
|
|
11312
|
+
maxEdges: maxEdges ?? null,
|
|
11311
11313
|
maxDepth: opts.maxDepth ?? null,
|
|
11312
11314
|
checkDeadLinks: opts.checkDeadLinks ?? false
|
|
11313
11315
|
},
|
|
11314
11316
|
pageBudget: maxPages,
|
|
11315
|
-
edgeBudget: maxEdges,
|
|
11317
|
+
edgeBudget: maxEdges ?? null,
|
|
11316
11318
|
maxDepth: opts.maxDepth ?? null,
|
|
11317
11319
|
checkDeadLinks: opts.checkDeadLinks ?? false,
|
|
11318
11320
|
complete: crawlSummary.complete,
|
|
@@ -11867,7 +11869,7 @@ function readStoredGroundingSources(rawResponse) {
|
|
|
11867
11869
|
return result;
|
|
11868
11870
|
}
|
|
11869
11871
|
async function backfillInsightsCommand(project, opts) {
|
|
11870
|
-
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-
|
|
11872
|
+
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-4XQBUFBU.js");
|
|
11871
11873
|
const config = loadConfig();
|
|
11872
11874
|
const db = createClient(config.database);
|
|
11873
11875
|
migrate(db);
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
installSkills,
|
|
6
6
|
loadConfigRaw,
|
|
7
7
|
saveConfigPatch
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VFQPW2VX.js";
|
|
9
9
|
import {
|
|
10
10
|
SKILL_MANIFEST_FILENAME,
|
|
11
11
|
SkillsClients
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z2HTLTQV.js";
|
|
13
13
|
|
|
14
14
|
// src/skills-autosync.ts
|
|
15
15
|
import fs from "fs";
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
trafficConnectWordpressRequestSchema,
|
|
94
94
|
trafficEventKindSchema,
|
|
95
95
|
trafficSeriesGranularitySchema
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-Z2HTLTQV.js";
|
|
97
97
|
|
|
98
98
|
// src/config.ts
|
|
99
99
|
import fs from "fs";
|
|
@@ -9387,7 +9387,7 @@ var technicalAeoRunInputSchema = z3.object({
|
|
|
9387
9387
|
sitemapUrl: z3.string().url().optional().describe("Override the sitemap URL. Defaults to https://<canonicalDomain>/sitemap.xml."),
|
|
9388
9388
|
limit: z3.number().int().positive().max(2e3).optional().describe("Deprecated compatibility alias for maxPages."),
|
|
9389
9389
|
maxPages: z3.number().int().positive().max(5e4).optional().describe("Maximum pages crawled and audited. Defaults to 1,000; hard maximum 50,000."),
|
|
9390
|
-
maxEdges: z3.number().int().positive().max(1e6).optional().describe("Maximum link observations retained for this crawl.
|
|
9390
|
+
maxEdges: z3.number().int().positive().max(1e6).optional().describe("Maximum link observations retained for this crawl. When omitted the crawl engine derives the budget from the page count; hard maximum 1,000,000."),
|
|
9391
9391
|
maxDepth: z3.number().int().min(0).max(100).optional().describe("Maximum internal-link depth from the root page."),
|
|
9392
9392
|
checkDeadLinks: z3.boolean().optional().describe("Opt in to internal dead-link checks. Omitted and false both disable checks.")
|
|
9393
9393
|
});
|
|
@@ -11445,7 +11445,7 @@ var canonryMcpTools = [
|
|
|
11445
11445
|
defineTool({
|
|
11446
11446
|
name: "canonry_technical_aeo_run",
|
|
11447
11447
|
title: "Run Technical AEO site audit",
|
|
11448
|
-
description: "Start a site-audit run. The run discovers root, sitemap, and linked pages.
|
|
11448
|
+
description: "Start a site-audit run. The run discovers root, sitemap, and linked pages. It defaults to 1,000 pages, and the engine derives the link-observation budget from that page count with a 100,000 floor, so raising maxPages raises it too. An explicit maxEdges is a ceiling that replaces the derivation and can sit below it. It returns {runId, status} and continues in the background. If an active run has identical effective options, this tool returns it; different options are refused. Poll canonry_run_get, then read the crawl and score tools.",
|
|
11449
11449
|
access: "write",
|
|
11450
11450
|
tier: "monitoring",
|
|
11451
11451
|
inputSchema: technicalAeoRunInputSchema,
|
|
@@ -10643,7 +10643,6 @@ var siteCrawlDeadLinksResponseSchema = z30.discriminatedUnion("state", [
|
|
|
10643
10643
|
]);
|
|
10644
10644
|
var SITE_AUDIT_DEFAULT_PAGE_LIMIT = 1e3;
|
|
10645
10645
|
var SITE_AUDIT_MAX_PAGE_LIMIT = 5e4;
|
|
10646
|
-
var SITE_AUDIT_DEFAULT_EDGE_LIMIT = 1e5;
|
|
10647
10646
|
var SITE_AUDIT_MAX_EDGE_LIMIT = 1e6;
|
|
10648
10647
|
var siteAuditRunRequestSchema = z30.object({
|
|
10649
10648
|
/** @deprecated Prefer the configured project sitemap; retained for compatibility. */
|
|
@@ -10652,7 +10651,7 @@ var siteAuditRunRequestSchema = z30.object({
|
|
|
10652
10651
|
limit: z30.number().int().positive().max(2e3).optional(),
|
|
10653
10652
|
/** Crawl page budget. When omitted, Canonry crawls up to 1,000 pages. */
|
|
10654
10653
|
maxPages: z30.number().int().positive().max(5e4).optional(),
|
|
10655
|
-
/** Internal-link observation budget. When omitted,
|
|
10654
|
+
/** Internal-link observation budget. When omitted, the crawl engine derives it from the page count. */
|
|
10656
10655
|
maxEdges: z30.number().int().positive().max(1e6).optional(),
|
|
10657
10656
|
/** Maximum crawl depth from the root. */
|
|
10658
10657
|
maxDepth: z30.number().int().min(0).max(100).optional(),
|
|
@@ -10661,10 +10660,10 @@ var siteAuditRunRequestSchema = z30.object({
|
|
|
10661
10660
|
});
|
|
10662
10661
|
function normalizeSiteAuditRunRequest(request) {
|
|
10663
10662
|
return {
|
|
10664
|
-
schemaVersion:
|
|
10663
|
+
schemaVersion: 2,
|
|
10665
10664
|
sitemapUrl: request.sitemapUrl ? new URL(request.sitemapUrl).toString() : null,
|
|
10666
10665
|
maxPages: request.maxPages ?? request.limit ?? SITE_AUDIT_DEFAULT_PAGE_LIMIT,
|
|
10667
|
-
maxEdges: request.maxEdges ??
|
|
10666
|
+
maxEdges: request.maxEdges ?? null,
|
|
10668
10667
|
maxDepth: request.maxDepth ?? null,
|
|
10669
10668
|
checkDeadLinks: request.checkDeadLinks === true
|
|
10670
10669
|
};
|