@ainyc/canonry 4.60.0 → 4.60.2
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/assets/assets/{BacklinksPage-CEL_F-c1.js → BacklinksPage-Dj4AVTma.js} +1 -1
- package/assets/assets/{ChartPrimitives-B8Z6fjCY.js → ChartPrimitives-7SFwUlCh.js} +1 -1
- package/assets/assets/{ProjectPage-ClmLZ1TC.js → ProjectPage-4tWuU1ZR.js} +1 -1
- package/assets/assets/{RunRow-oSEdTjB1.js → RunRow-CgPJfmWX.js} +1 -1
- package/assets/assets/{RunsPage-k-TX3mbf.js → RunsPage-Cdo4jBn4.js} +1 -1
- package/assets/assets/{SettingsPage-VCOwDDIL.js → SettingsPage-N5iccPoU.js} +1 -1
- package/assets/assets/{TrafficPage-GgkjI5RL.js → TrafficPage-pSlQPdDg.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-DhMF4157.js → TrafficSourceDetailPage-BQx3Evf6.js} +1 -1
- package/assets/assets/{extract-error-message-CYGeEBx9.js → extract-error-message-BOembgFV.js} +1 -1
- package/assets/assets/index-Cp0p2Bib.css +1 -0
- package/assets/assets/{index-BdGCBd0G.js → index-DjKFsFsl.js} +4 -4
- package/assets/assets/{server-traffic-If2bUKTD.js → server-traffic-DNgNJ4Ht.js} +1 -1
- package/assets/assets/{trash-2-NV5lw_nX.js → trash-2-DOznxxMW.js} +1 -1
- package/assets/index.html +2 -2
- package/dist/{chunk-X4ZZFZQZ.js → chunk-AUR7VMQF.js} +158 -64
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/assets/assets/index-bQ6xgP8c.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProjectPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProjectPage-4tWuU1ZR.js","./vendor-tanstack-Dq7p98wZ.js","./RunRow-CgPJfmWX.js","./ChartPrimitives-7SFwUlCh.js","./server-traffic-DNgNJ4Ht.js","./vendor-recharts-DWvKDyBF.js","./trash-2-DOznxxMW.js","./vendor-radix-B57xfQbP.js","./vendor-markdown-DK7fbRNb.js","./RunsPage-Cdo4jBn4.js","./SettingsPage-N5iccPoU.js","./BacklinksPage-Dj4AVTma.js","./TrafficPage-pSlQPdDg.js","./extract-error-message-BOembgFV.js","./TrafficSourceDetailPage-BQx3Evf6.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{c as aw,d as iw,Q as sw,M as rw,r as q,q as Le,j as f,L as rt,a as ow,e as ks,u as un,f as lw,h as dc,k as cw,l as uw,m as Xb,O as Jb,n as Qa,o as Ai,p as dw,s as Bt,t as Fb,v as Is,x as fw,y as pw,z as mw}from"./vendor-tanstack-Dq7p98wZ.js";import{S as hw,O as Df,P as Wb,C as Rf,a as ev,T as Mf,D as tv,R as nv}from"./vendor-radix-B57xfQbP.js";import{c as av}from"./vendor-recharts-DWvKDyBF.js";import{M as gw}from"./vendor-markdown-DK7fbRNb.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function i(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(l){if(l.ep)return;l.ep=!0;const c=i(l);fetch(l.href,c)}})();var Qd={exports:{}},Qr={},Yd={exports:{}},Xd={};var Ay;function yw(){return Ay||(Ay=1,(function(e){function n($,W){var fe=$.length;$.push(W);e:for(;0<fe;){var je=fe-1>>>1,ie=$[je];if(0<l(ie,W))$[je]=W,$[fe]=ie,fe=je;else break e}}function i($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var W=$[0],fe=$.pop();if(fe!==W){$[0]=fe;e:for(var je=0,ie=$.length,Qe=ie>>>1;je<Qe;){var J=2*(je+1)-1,le=$[J],te=J+1,ue=$[te];if(0>l(le,fe))te<ie&&0>l(ue,le)?($[je]=ue,$[te]=fe,je=te):($[je]=le,$[J]=fe,je=J);else if(te<ie&&0>l(ue,fe))$[je]=ue,$[te]=fe,je=te;else break e}}return W}function l($,W){var fe=$.sortIndex-W.sortIndex;return fe!==0?fe:$.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,m=d.now();e.unstable_now=function(){return d.now()-m}}var g=[],b=[],v=1,S=null,j=3,_=!1,C=!1,k=!1,T=!1,R=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function K($){for(var W=i(b);W!==null;){if(W.callback===null)r(b);else if(W.startTime<=$)r(b),W.sortIndex=W.expirationTime,n(g,W);else break;W=i(b)}}function Y($){if(k=!1,K($),!C)if(i(g)!==null)C=!0,X||(X=!0,ve());else{var W=i(b);W!==null&&me(Y,W.startTime-$)}}var X=!1,D=-1,M=5,oe=-1;function ke(){return T?!0:!(e.unstable_now()-oe<M)}function _e(){if(T=!1,X){var $=e.unstable_now();oe=$;var W=!0;try{e:{C=!1,k&&(k=!1,G(D),D=-1),_=!0;var fe=j;try{t:{for(K($),S=i(g);S!==null&&!(S.expirationTime>$&&ke());){var je=S.callback;if(typeof je=="function"){S.callback=null,j=S.priorityLevel;var ie=je(S.expirationTime<=$);if($=e.unstable_now(),typeof ie=="function"){S.callback=ie,K($),W=!0;break t}S===i(g)&&r(g),K($)}else r(g);S=i(g)}if(S!==null)W=!0;else{var Qe=i(b);Qe!==null&&me(Y,Qe.startTime-$),W=!1}}break e}finally{S=null,j=fe,_=!1}W=void 0}}finally{W?ve():X=!1}}}var ve;if(typeof H=="function")ve=function(){H(_e)};else if(typeof MessageChannel<"u"){var et=new MessageChannel,re=et.port2;et.port1.onmessage=_e,ve=function(){re.postMessage(null)}}else ve=function(){R(_e,0)};function me($,W){D=R(function(){$(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return j},e.unstable_next=function($){switch(j){case 1:case 2:case 3:var W=3;break;default:W=j}var fe=j;j=W;try{return $()}finally{j=fe}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function($,W){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var fe=j;j=$;try{return W()}finally{j=fe}},e.unstable_scheduleCallback=function($,W,fe){var je=e.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?je+fe:je):fe=je,$){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=fe+ie,$={id:v++,callback:W,priorityLevel:$,startTime:fe,expirationTime:ie,sortIndex:-1},fe>je?($.sortIndex=fe,n(b,$),i(g)===null&&$===i(b)&&(k?(G(D),D=-1):k=!0,me(Y,fe-je))):($.sortIndex=ie,n(g,$),C||_||(C=!0,X||(X=!0,ve()))),$},e.unstable_shouldYield=ke,e.unstable_wrapCallback=function($){var W=j;return function(){var fe=j;j=W;try{return $.apply(this,arguments)}finally{j=fe}}}})(Xd)),Xd}var _y;function bw(){return _y||(_y=1,Yd.exports=yw()),Yd.exports}var zy;function vw(){if(zy)return Qr;zy=1;var e=bw(),n=aw(),i=iw();function r(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)a+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,s=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(s=a.return),t=a.return;while(t)}return a.tag===3?s:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function m(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(r(188))}function b(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(r(188));return a!==t?null:t}for(var s=t,o=a;;){var u=s.return;if(u===null)break;var p=u.alternate;if(p===null){if(o=u.return,o!==null){s=o;continue}break}if(u.child===p.child){for(p=u.child;p;){if(p===s)return g(u),t;if(p===o)return g(u),a;p=p.sibling}throw Error(r(188))}if(s.return!==o.return)s=u,o=p;else{for(var y=!1,x=u.child;x;){if(x===s){y=!0,s=u,o=p;break}if(x===o){y=!0,o=u,s=p;break}x=x.sibling}if(!y){for(x=p.child;x;){if(x===s){y=!0,s=p,o=u;break}if(x===o){y=!0,o=p,s=u;break}x=x.sibling}if(!y)throw Error(r(189))}}if(s.alternate!==o)throw Error(r(190))}if(s.tag!==3)throw Error(r(188));return s.stateNode.current===s?t:a}function v(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=v(t),a!==null)return a;t=t.sibling}return null}var S=Object.assign,j=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),H=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ke=Symbol.for("react.memo_cache_sentinel"),_e=Symbol.iterator;function ve(t){return t===null||typeof t!="object"?null:(t=_e&&t[_e]||t["@@iterator"],typeof t=="function"?t:null)}var et=Symbol.for("react.client.reference");function re(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===et?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case k:return"Fragment";case R:return"Profiler";case T:return"StrictMode";case Y:return"Suspense";case X:return"SuspenseList";case oe:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case C:return"Portal";case H:return t.displayName||"Context";case G:return(t._context.displayName||"Context")+".Consumer";case K:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case D:return a=t.displayName||null,a!==null?a:re(t.type)||"Memo";case M:a=t._payload,t=t._init;try{return re(t(a))}catch{}}return null}var me=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},je=[],ie=-1;function Qe(t){return{current:t}}function J(t){0>ie||(t.current=je[ie],je[ie]=null,ie--)}function le(t,a){ie++,je[ie]=t.current,t.current=a}var te=Qe(null),ue=Qe(null),ne=Qe(null),Ne=Qe(null);function tt(t,a){switch(le(ne,a),le(ue,t),le(te,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Yg(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Yg(a),t=Xg(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}J(te),le(te,t)}function xe(){J(te),J(ue),J(ne)}function $e(t){t.memoizedState!==null&&le(Ne,t);var a=te.current,s=Xg(a,t.type);a!==s&&(le(ue,t),le(te,s))}function Pe(t){ue.current===t&&(J(te),J(ue)),Ne.current===t&&(J(Ne),Hr._currentValue=fe)}var Ct,Cn;function Tt(t){if(Ct===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);Ct=a&&a[1]||"",Cn=-1<s.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Ct+t+Cn}var Ws=!1;function Ei(t,a){if(!t||Ws)return"";Ws=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(a){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(V){var U=V}Reflect.construct(t,[],Q)}else{try{Q.call()}catch(V){U=V}t.call(Q.prototype)}}else{try{throw Error()}catch(V){U=V}(Q=t())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(V){if(V&&U&&typeof V.stack=="string")return[V.stack,U.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),y=p[0],x=p[1];if(y&&x){var A=y.split(`
|
|
@@ -55,13 +55,13 @@ ${JSON.stringify(r.raw,null,2)}`):n.push(l)}return n.length>0?n.join(`
|
|
|
55
55
|
|
|
56
56
|
`):"Run failed."}function _0(e){return e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function FM(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return e}}function WM(e){return e===null?"Unknown":e?"Pass":"Fail"}function pb(e){return e===0?"12:00 AM":e<12?`${e}:00 AM`:e===12?"12:00 PM":`${e-12}:00 PM`}function eB(e,n){return e==="twice-daily"?"twice-daily":e.startsWith("weekly@")?`${e}@${n}`:`daily@${n}`}function tB(e,n){if(!e)return{freq:"custom",hour:6,customCron:n};if(e==="twice-daily")return{freq:"twice-daily",hour:6,customCron:""};const i=e.match(/^daily(?:@(\d+))?$/);if(i)return{freq:"daily",hour:i[1]?parseInt(i[1]):6,customCron:""};const r=e.match(/^(weekly@(?:mon|tue|wed|thu|fri|sat|sun))(?:@(\d+))?$/);return r?{freq:r[1],hour:r[2]?parseInt(r[2]):6,customCron:""}:{freq:"custom",hour:6,customCron:n}}function nB(e,n,i){const r=i==="UTC"?"UTC":i.split("/").pop()?.replace(/_/g," ")??i;if(!e)return`Custom: ${n} · ${r}`;if(e==="twice-daily")return`Twice a day (6am & 6pm) · ${r}`;const l=e.match(/^daily(?:@(\d+))?$/);if(l){const d=l[1]?parseInt(l[1]):6;return`Every day at ${pb(d)} · ${r}`}const c=e.match(/^weekly@(mon|tue|wed|thu|fri|sat|sun)(?:@(\d+))?$/);if(c){const d={mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday",sun:"Sunday"},m=c[2]?parseInt(c[2]):6;return`Every ${d[c[1]]} at ${pb(m)} · ${r}`}return`${e} · ${r}`}function wO(e,n){return n&&n!==e?`${e} · ${n}`:e}function aB(){const e=Intl.DateTimeFormat().resolvedOptions().timeZone,n=new Intl.DateTimeFormat("en-US",{timeZoneName:"short"}).formatToParts().find(i=>i.type==="timeZoneName")?.value;return wO(e,n)}const Re=(e,n,i,r)=>{const l={_id:e,baseUrl:n?.baseUrl||(n?.client??F).getConfig().baseUrl};return n?.body&&(l.body=n.body),n?.headers&&(l.headers=n.headers),n?.path&&(l.path=n.path),n?.query&&(l.query=n.query),[l]},jO=e=>Re("getApiV1ProjectsByName",e),NO=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await uv({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:jO(e)}),Qs=e=>Re("getApiV1Projects",e),op=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Vw({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:Qs(e)}),lp=e=>Re("getApiV1Runs",e),cp=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await tj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:lp(e)}),kO=e=>Re("getApiV1RunsById",e),z0=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await dv({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:kO(e)}),AO=e=>Re("getApiV1Settings",e),_O=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await fv({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:AO(e)}),zO=e=>Re("getApiV1ProjectsByNameGoogleConnections",e),iB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await yj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:zO(e)}),CO=e=>Re("getApiV1ProjectsByNameGoogleProperties",e),sB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Sj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:CO(e)}),TO=e=>Re("getApiV1ProjectsByNameGoogleGscPerformance",e),rB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Nj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:TO(e)}),EO=e=>Re("getApiV1ProjectsByNameGoogleGscPerformanceDaily",e),oB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await kj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:EO(e)}),OO=e=>Re("getApiV1ProjectsByNameGoogleGscInspections",e),lB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await _j({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:OO(e)}),DO=e=>Re("getApiV1ProjectsByNameGoogleGscDeindexed",e),cB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await zj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:DO(e)}),RO=e=>Re("getApiV1ProjectsByNameGoogleGscCoverage",e),uB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await pv({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:RO(e)}),MO=e=>Re("getApiV1ProjectsByNameGoogleGscCoverageHistory",e),dB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Cj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:MO(e)}),fB=e=>Re("getApiV1ProjectsByNameGoogleGscSitemaps",e),BO=e=>Re("getApiV1ProjectsByNameGbpLocations",e),pB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Rj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:BO(e)}),mB=e=>({mutationFn:async i=>{const{data:r}=await Mj({...e,...i,throwOnError:!0});return r}}),hB=e=>({mutationFn:async i=>{const{data:r}=await Bj({...e,...i,throwOnError:!0});return r}}),LO=e=>Re("getApiV1ProjectsByNameGbpKeywords",e),gB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Lj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:LO(e)}),qO=e=>Re("getApiV1ProjectsByNameGbpSummary",e),yB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await qj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:qO(e)}),UO=e=>Re("getApiV1ProjectsByNameBingStatus",e),bB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Vj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:UO(e)}),$O=e=>Re("getApiV1ProjectsByNameBingSites",e),vB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Gj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:$O(e)}),VO=e=>Re("getApiV1ProjectsByNameBingCoverage",e),SB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await mv({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:VO(e)}),GO=e=>Re("getApiV1ProjectsByNameBingInspections",e),xB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Hj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:GO(e)}),IO=e=>Re("getApiV1ProjectsByNameBingPerformance",e),wB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Qj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:IO(e)}),HO=e=>Re("getApiV1ProjectsByNameGaStatus",e),jB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Jj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:HO(e)}),PO=e=>Re("getApiV1ProjectsByNameGaTraffic",e),NB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await Wj({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:PO(e)}),ZO=e=>Re("getApiV1ProjectsByNameGaAiReferralHistory",e),kB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await eN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:ZO(e)}),KO=e=>Re("getApiV1ProjectsByNameGaSocialReferralHistory",e),AB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await tN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:KO(e)}),QO=e=>Re("getApiV1ProjectsByNameGaSessionHistory",e),_B=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await nN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:QO(e)}),YO=e=>Re("getApiV1ProjectsByNameReport",e),zB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await iN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:YO(e)}),XO=e=>Re("getApiV1ProjectsByNameCitationsVisibility",e),CB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await sN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:XO(e)}),JO=e=>Re("getApiV1ProjectsByNameTrafficSources",e),TB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await kN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:JO(e)}),FO=e=>Re("getApiV1ProjectsByNameTrafficStatus",e),EB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await AN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:FO(e)}),WO=e=>Re("getApiV1ProjectsByNameTrafficSourcesById",e),OB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await _N({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:WO(e)}),e4=e=>Re("getApiV1ProjectsByNameTrafficEvents",e),DB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await zN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:e4(e)}),t4=e=>Re("getApiV1ProjectsByNameDiscoverSessions",e),RB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await TN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:t4(e)}),n4=e=>Re("getApiV1ProjectsByNameDiscoverSessionsById",e),MB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await EN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:n4(e)}),a4=e=>Re("getApiV1ProjectsByNameDiscoverSessionsByIdPromote",e),BB=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await ON({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:a4(e)}),i4=e=>Re("getApiV1ProjectsByNameAgentProviders",e),s4=e=>Le({queryFn:async({queryKey:n,signal:i})=>{const{data:r}=await RN({...e,...n[0],signal:i,throwOnError:!0});return r},queryKey:i4(e)});function mb(e){return e.state==="ok"?"positive":e.state==="checking"?"neutral":"negative"}function C0(e){switch(e){case"completed":return"positive";case"partial":return"caution";case"failed":return"negative";case"cancelled":return"caution";case"queued":case"running":return"neutral";default:return"neutral"}}function LB(e){switch(e){case"cited":return"positive";case"emerging":return"caution";case"not-cited":return"caution";case"lost":return"negative";case"pending":return"neutral";default:return"neutral"}}function qB(e){return e==="High"?"negative":e==="Moderate"?"caution":"neutral"}function UB(e){return e>=70?"positive":e>=40?"caution":"negative"}const $B={positive:"text-emerald-400",caution:"text-amber-400",negative:"text-rose-400",neutral:"text-zinc-400"};function r4(e){return e.displayName??e.name.charAt(0).toUpperCase()+e.name.slice(1)}function $s(e){const n=[e.detail,e.hint].filter(Boolean);return n.length>0?n.join(`
|
|
57
57
|
`):void 0}function o4(e,n,i){return e.map(r=>{if(r.id==="api")return{...r,tone:mb(n.apiStatus),detail:n.apiStatus.state==="ok"?"Healthy":"Needs attention",meta:n.apiStatus.detail};if(r.id==="worker")return{...r,tone:mb(n.workerStatus),detail:n.workerStatus.state==="ok"?"Healthy":"Needs attention",meta:n.workerStatus.detail};const l=i.providerStatuses.filter(g=>g.state==="ready").length,c=i.providerStatuses.length,d=l>0,m=i.providerStatuses.filter(g=>g.state==="ready").map(g=>r4(g)).join(" · ");return{...r,label:"Providers",tone:d?"positive":"caution",detail:`${l} of ${c} configured`,meta:m||"None configured"}})}function l4(e,n){if(e.apiStatus.state!=="ok")return"Launch is blocked until the API responds cleanly.";if(e.apiStatus.databaseConfigured===!1)return"Launch is blocked until the API has a database connection configured.";if(e.workerStatus.state!=="ok")return"Launch is blocked until the worker is healthy and heartbeats are current.";if(!n.providerStatuses.some(i=>i.state==="ready"))return"Launch is blocked until at least one provider is configured."}function c4(e,n,i){const r=l4(n,i),l=structuredClone(e);return l.healthChecks=l.healthChecks.map(c=>{if(c.id==="api")return{...c,detail:n.apiStatus.detail,state:n.apiStatus.state==="ok"?"ready":"attention"};if(c.id==="worker")return{...c,detail:n.workerStatus.detail,state:n.workerStatus.state==="ok"?"ready":"attention"};const d=i.providerStatuses.some(m=>m.state==="ready");return{...c,detail:d?"At least one provider configured.":"No providers configured.",state:d?"ready":"attention"}}),l.launchState.enabled=r===void 0,l.launchState.blockedReason=r,l.launchState.summary=r??"Queue a visibility sweep first, then follow with a site audit to explain movement.",l}const T0="canonry.run-tracker",wf=new Set;let hb=!1,u4=0,bc={runs:{},batches:{}};function d4(){const e=Ni();for(const n of wf)n(e)}function f4(e){if(!e)return{runs:{},batches:{}};try{const n=JSON.parse(e);return{runs:n.runs??{},batches:n.batches??{}}}catch{return{runs:{},batches:{}}}}function p4(){typeof window>"u"||window.sessionStorage.setItem(T0,JSON.stringify(bc))}function E0(){hb||(hb=!0,!(typeof window>"u")&&(bc=f4(window.sessionStorage.getItem(T0))))}function vc(e){bc=e,p4(),d4()}function Ni(){return E0(),bc}function m4(e){return E0(),wf.add(e),()=>{wf.delete(e)}}function O0(e){const n=Ni();vc({...n,runs:{...n.runs,[e.id]:{runId:e.id,projectId:e.projectId,projectLabel:e.projectLabel,kind:e.kind,sourceAction:e.sourceAction,lastAnnouncedStatus:e.lastAnnouncedStatus??"queued"}}})}function gb(e){const n=Ni();if(!n.runs[e])return;const{[e]:i,...r}=n.runs;vc({...n,runs:r})}function h4(e){const n=Ni(),i=`batch_${Date.now()}_${++u4}`;return vc({...n,batches:{...n.batches,[i]:{batchId:i,runIds:e.runIds,queuedCount:e.queuedCount,skippedCount:e.skippedCount}}}),i}function g4(e){const n=Ni();if(!n.batches[e])return;const{[e]:i,...r}=n.batches;vc({...n,batches:r})}function y4(e){return e==="completed"||e==="partial"||e==="failed"||e==="cancelled"}function b4(e,n){let i=0,r=0,l=0,c=0,d=0;for(const m of e){const g=n[m]?.status;g==="completed"?i+=1:g==="partial"?r+=1:g==="failed"?l+=1:g==="cancelled"?c+=1:d+=1}return{completed:i,partial:r,failed:l,cancelled:c,pending:d,finished:d===0}}const yb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bb=av,D0=(e,n)=>i=>{var r;if(n?.variants==null)return bb(e,i?.class,i?.className);const{variants:l,defaultVariants:c}=n,d=Object.keys(l).map(b=>{const v=i?.[b],S=c?.[b];if(v===null)return null;const j=yb(v)||yb(S);return l[b][j]}),m=i&&Object.entries(i).reduce((b,v)=>{let[S,j]=v;return j===void 0||(b[S]=j),b},{}),g=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((b,v)=>{let{class:S,className:j,..._}=v;return Object.entries(_).every(C=>{let[k,T]=C;return Array.isArray(T)?T.includes({...c,...m}[k]):{...c,...m}[k]===T})?[...b,S,j]:b},[]);return bb(e,d,g,i?.class,i?.className)},v4=(e,n)=>{const i=new Array(e.length+n.length);for(let r=0;r<e.length;r++)i[r]=e[r];for(let r=0;r<n.length;r++)i[e.length+r]=n[r];return i},S4=(e,n)=>({classGroupId:e,validator:n}),R0=(e=new Map,n=null,i)=>({nextPart:e,validators:n,classGroupId:i}),lc="-",vb=[],x4="arbitrary..",w4=e=>{const n=N4(e),{conflictingClassGroups:i,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return j4(d);const m=d.split(lc),g=m[0]===""&&m.length>1?1:0;return M0(m,g,n)},getConflictingClassGroupIds:(d,m)=>{if(m){const g=r[d],b=i[d];return g?b?v4(b,g):g:b||vb}return i[d]||vb}}},M0=(e,n,i)=>{if(e.length-n===0)return i.classGroupId;const l=e[n],c=i.nextPart.get(l);if(c){const b=M0(e,n+1,c);if(b)return b}const d=i.validators;if(d===null)return;const m=n===0?e.join(lc):e.slice(n).join(lc),g=d.length;for(let b=0;b<g;b++){const v=d[b];if(v.validator(m))return v.classGroupId}},j4=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=e.slice(1,-1),i=n.indexOf(":"),r=n.slice(0,i);return r?x4+r:void 0})(),N4=e=>{const{theme:n,classGroups:i}=e;return k4(i,n)},k4=(e,n)=>{const i=R0();for(const r in e){const l=e[r];up(l,i,r,n)}return i},up=(e,n,i,r)=>{const l=e.length;for(let c=0;c<l;c++){const d=e[c];A4(d,n,i,r)}},A4=(e,n,i,r)=>{if(typeof e=="string"){_4(e,n,i);return}if(typeof e=="function"){z4(e,n,i,r);return}C4(e,n,i,r)},_4=(e,n,i)=>{const r=e===""?n:B0(n,e);r.classGroupId=i},z4=(e,n,i,r)=>{if(T4(e)){up(e(r),n,i,r);return}n.validators===null&&(n.validators=[]),n.validators.push(S4(i,e))},C4=(e,n,i,r)=>{const l=Object.entries(e),c=l.length;for(let d=0;d<c;d++){const[m,g]=l[d];up(g,B0(n,m),i,r)}},B0=(e,n)=>{let i=e;const r=n.split(lc),l=r.length;for(let c=0;c<l;c++){const d=r[c];let m=i.nextPart.get(d);m||(m=R0(),i.nextPart.set(d,m)),i=m}return i},T4=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,E4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,i=Object.create(null),r=Object.create(null);const l=(c,d)=>{i[c]=d,n++,n>e&&(n=0,r=i,i=Object.create(null))};return{get(c){let d=i[c];if(d!==void 0)return d;if((d=r[c])!==void 0)return l(c,d),d},set(c,d){c in i?i[c]=d:l(c,d)}}},jf="!",Sb=":",O4=[],xb=(e,n,i,r,l)=>({modifiers:e,hasImportantModifier:n,baseClassName:i,maybePostfixModifierPosition:r,isExternal:l}),D4=e=>{const{prefix:n,experimentalParseClassName:i}=e;let r=l=>{const c=[];let d=0,m=0,g=0,b;const v=l.length;for(let k=0;k<v;k++){const T=l[k];if(d===0&&m===0){if(T===Sb){c.push(l.slice(g,k)),g=k+1;continue}if(T==="/"){b=k;continue}}T==="["?d++:T==="]"?d--:T==="("?m++:T===")"&&m--}const S=c.length===0?l:l.slice(g);let j=S,_=!1;S.endsWith(jf)?(j=S.slice(0,-1),_=!0):S.startsWith(jf)&&(j=S.slice(1),_=!0);const C=b&&b>g?b-g:void 0;return xb(c,_,j,C)};if(n){const l=n+Sb,c=r;r=d=>d.startsWith(l)?c(d.slice(l.length)):xb(O4,!1,d,void 0,!0)}if(i){const l=r;r=c=>i({className:c,parseClassName:l})}return r},R4=e=>{const n=new Map;return e.orderSensitiveModifiers.forEach((i,r)=>{n.set(i,1e6+r)}),i=>{const r=[];let l=[];for(let c=0;c<i.length;c++){const d=i[c],m=d[0]==="[",g=n.has(d);m||g?(l.length>0&&(l.sort(),r.push(...l),l=[]),r.push(d)):l.push(d)}return l.length>0&&(l.sort(),r.push(...l)),r}},M4=e=>({cache:E4(e.cacheSize),parseClassName:D4(e),sortModifiers:R4(e),...w4(e)}),B4=/\s+/,L4=(e,n)=>{const{parseClassName:i,getClassGroupId:r,getConflictingClassGroupIds:l,sortModifiers:c}=n,d=[],m=e.trim().split(B4);let g="";for(let b=m.length-1;b>=0;b-=1){const v=m[b],{isExternal:S,modifiers:j,hasImportantModifier:_,baseClassName:C,maybePostfixModifierPosition:k}=i(v);if(S){g=v+(g.length>0?" "+g:g);continue}let T=!!k,R=r(T?C.substring(0,k):C);if(!R){if(!T){g=v+(g.length>0?" "+g:g);continue}if(R=r(C),!R){g=v+(g.length>0?" "+g:g);continue}T=!1}const G=j.length===0?"":j.length===1?j[0]:c(j).join(":"),H=_?G+jf:G,K=H+R;if(d.indexOf(K)>-1)continue;d.push(K);const Y=l(R,T);for(let X=0;X<Y.length;++X){const D=Y[X];d.push(H+D)}g=v+(g.length>0?" "+g:g)}return g},q4=(...e)=>{let n=0,i,r,l="";for(;n<e.length;)(i=e[n++])&&(r=L0(i))&&(l&&(l+=" "),l+=r);return l},L0=e=>{if(typeof e=="string")return e;let n,i="";for(let r=0;r<e.length;r++)e[r]&&(n=L0(e[r]))&&(i&&(i+=" "),i+=n);return i},U4=(e,...n)=>{let i,r,l,c;const d=g=>{const b=n.reduce((v,S)=>S(v),e());return i=M4(b),r=i.cache.get,l=i.cache.set,c=m,m(g)},m=g=>{const b=r(g);if(b)return b;const v=L4(g,i);return l(g,v),v};return c=d,(...g)=>c(q4(...g))},$4=[],At=e=>{const n=i=>i[e]||$4;return n.isThemeGetter=!0,n},q0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,U0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,V4=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,G4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Z4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=e=>V4.test(e),Ee=e=>!!e&&!Number.isNaN(Number(e)),Ga=e=>!!e&&Number.isInteger(Number(e)),nf=e=>e.endsWith("%")&&Ee(e.slice(0,-1)),fa=e=>G4.test(e),$0=()=>!0,K4=e=>I4.test(e)&&!H4.test(e),dp=()=>!1,Q4=e=>P4.test(e),Y4=e=>Z4.test(e),X4=e=>!he(e)&&!ge(e),J4=e=>Ja(e,I0,dp),he=e=>q0.test(e),vi=e=>Ja(e,H0,K4),wb=e=>Ja(e,s3,Ee),F4=e=>Ja(e,Z0,$0),W4=e=>Ja(e,P0,dp),jb=e=>Ja(e,V0,dp),e3=e=>Ja(e,G0,Y4),ql=e=>Ja(e,K0,Q4),ge=e=>U0.test(e),Jr=e=>zi(e,H0),t3=e=>zi(e,P0),Nb=e=>zi(e,V0),n3=e=>zi(e,I0),a3=e=>zi(e,G0),Ul=e=>zi(e,K0,!0),i3=e=>zi(e,Z0,!0),Ja=(e,n,i)=>{const r=q0.exec(e);return r?r[1]?n(r[1]):i(r[2]):!1},zi=(e,n,i=!1)=>{const r=U0.exec(e);return r?r[1]?n(r[1]):i:!1},V0=e=>e==="position"||e==="percentage",G0=e=>e==="image"||e==="url",I0=e=>e==="length"||e==="size"||e==="bg-size",H0=e=>e==="length",s3=e=>e==="number",P0=e=>e==="family-name",Z0=e=>e==="number"||e==="weight",K0=e=>e==="shadow",r3=()=>{const e=At("color"),n=At("font"),i=At("text"),r=At("font-weight"),l=At("tracking"),c=At("leading"),d=At("breakpoint"),m=At("container"),g=At("spacing"),b=At("radius"),v=At("shadow"),S=At("inset-shadow"),j=At("text-shadow"),_=At("drop-shadow"),C=At("blur"),k=At("perspective"),T=At("aspect"),R=At("ease"),G=At("animate"),H=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Y=()=>[...K(),ge,he],X=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],M=()=>[ge,he,g],oe=()=>[Va,"full","auto",...M()],ke=()=>[Ga,"none","subgrid",ge,he],_e=()=>["auto",{span:["full",Ga,ge,he]},Ga,ge,he],ve=()=>[Ga,"auto",ge,he],et=()=>["auto","min","max","fr",ge,he],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...M()],W=()=>[Va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],fe=()=>[Va,"screen","full","dvw","lvw","svw","min","max","fit",...M()],je=()=>[Va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],ie=()=>[e,ge,he],Qe=()=>[...K(),Nb,jb,{position:[ge,he]}],J=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",n3,J4,{size:[ge,he]}],te=()=>[nf,Jr,vi],ue=()=>["","none","full",b,ge,he],ne=()=>["",Ee,Jr,vi],Ne=()=>["solid","dashed","dotted","double"],tt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],xe=()=>[Ee,nf,Nb,jb],$e=()=>["","none",C,ge,he],Pe=()=>["none",Ee,ge,he],Ct=()=>["none",Ee,ge,he],Cn=()=>[Ee,ge,he],Tt=()=>[Va,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fa],breakpoint:[fa],color:[$0],container:[fa],"drop-shadow":[fa],ease:["in","out","in-out"],font:[X4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fa],shadow:[fa],spacing:["px",Ee],text:[fa],"text-shadow":[fa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Va,he,ge,T]}],container:["container"],columns:[{columns:[Ee,he,ge,m]}],"break-after":[{"break-after":H()}],"break-before":[{"break-before":H()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:Y()}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:oe()}],"inset-x":[{"inset-x":oe()}],"inset-y":[{"inset-y":oe()}],start:[{"inset-s":oe(),start:oe()}],end:[{"inset-e":oe(),end:oe()}],"inset-bs":[{"inset-bs":oe()}],"inset-be":[{"inset-be":oe()}],top:[{top:oe()}],right:[{right:oe()}],bottom:[{bottom:oe()}],left:[{left:oe()}],visibility:["visible","invisible","collapse"],z:[{z:[Ga,"auto",ge,he]}],basis:[{basis:[Va,"full","auto",m,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ee,Va,"auto","initial","none",he]}],grow:[{grow:["",Ee,ge,he]}],shrink:[{shrink:["",Ee,ge,he]}],order:[{order:[Ga,"first","last","none",ge,he]}],"grid-cols":[{"grid-cols":ke()}],"col-start-end":[{col:_e()}],"col-start":[{"col-start":ve()}],"col-end":[{"col-end":ve()}],"grid-rows":[{"grid-rows":ke()}],"row-start-end":[{row:_e()}],"row-start":[{"row-start":ve()}],"row-end":[{"row-end":ve()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":et()}],"auto-rows":[{"auto-rows":et()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...re(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...fe()]}],"min-inline-size":[{"min-inline":["auto",...fe()]}],"max-inline-size":[{"max-inline":["none",...fe()]}],"block-size":[{block:["auto",...je()]}],"min-block-size":[{"min-block":["auto",...je()]}],"max-block-size":[{"max-block":["none",...je()]}],w:[{w:[m,"screen",...W()]}],"min-w":[{"min-w":[m,"screen","none",...W()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[d]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",i,Jr,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,i3,F4]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nf,he]}],"font-family":[{font:[t3,W4,n]}],"font-features":[{"font-features":[he]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,ge,he]}],"line-clamp":[{"line-clamp":[Ee,"none",ge,wb]}],leading:[{leading:[c,...M()]}],"list-image":[{"list-image":["none",ge,he]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,he]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ie()}],"text-color":[{text:ie()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ee,"from-font","auto",ge,vi]}],"text-decoration-color":[{decoration:ie()}],"underline-offset":[{"underline-offset":[Ee,"auto",ge,he]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,he]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Qe()}],"bg-repeat":[{bg:J()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ga,ge,he],radial:["",ge,he],conic:[Ga,ge,he]},a3,e3]}],"bg-color":[{bg:ie()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:ie()}],"gradient-via":[{via:ie()}],"gradient-to":[{to:ie()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:ie()}],"border-color-x":[{"border-x":ie()}],"border-color-y":[{"border-y":ie()}],"border-color-s":[{"border-s":ie()}],"border-color-e":[{"border-e":ie()}],"border-color-bs":[{"border-bs":ie()}],"border-color-be":[{"border-be":ie()}],"border-color-t":[{"border-t":ie()}],"border-color-r":[{"border-r":ie()}],"border-color-b":[{"border-b":ie()}],"border-color-l":[{"border-l":ie()}],"divide-color":[{divide:ie()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ee,ge,he]}],"outline-w":[{outline:["",Ee,Jr,vi]}],"outline-color":[{outline:ie()}],shadow:[{shadow:["","none",v,Ul,ql]}],"shadow-color":[{shadow:ie()}],"inset-shadow":[{"inset-shadow":["none",S,Ul,ql]}],"inset-shadow-color":[{"inset-shadow":ie()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ie()}],"ring-offset-w":[{"ring-offset":[Ee,vi]}],"ring-offset-color":[{"ring-offset":ie()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":ie()}],"text-shadow":[{"text-shadow":["none",j,Ul,ql]}],"text-shadow-color":[{"text-shadow":ie()}],opacity:[{opacity:[Ee,ge,he]}],"mix-blend":[{"mix-blend":[...tt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":tt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ee]}],"mask-image-linear-from-pos":[{"mask-linear-from":xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":xe()}],"mask-image-linear-from-color":[{"mask-linear-from":ie()}],"mask-image-linear-to-color":[{"mask-linear-to":ie()}],"mask-image-t-from-pos":[{"mask-t-from":xe()}],"mask-image-t-to-pos":[{"mask-t-to":xe()}],"mask-image-t-from-color":[{"mask-t-from":ie()}],"mask-image-t-to-color":[{"mask-t-to":ie()}],"mask-image-r-from-pos":[{"mask-r-from":xe()}],"mask-image-r-to-pos":[{"mask-r-to":xe()}],"mask-image-r-from-color":[{"mask-r-from":ie()}],"mask-image-r-to-color":[{"mask-r-to":ie()}],"mask-image-b-from-pos":[{"mask-b-from":xe()}],"mask-image-b-to-pos":[{"mask-b-to":xe()}],"mask-image-b-from-color":[{"mask-b-from":ie()}],"mask-image-b-to-color":[{"mask-b-to":ie()}],"mask-image-l-from-pos":[{"mask-l-from":xe()}],"mask-image-l-to-pos":[{"mask-l-to":xe()}],"mask-image-l-from-color":[{"mask-l-from":ie()}],"mask-image-l-to-color":[{"mask-l-to":ie()}],"mask-image-x-from-pos":[{"mask-x-from":xe()}],"mask-image-x-to-pos":[{"mask-x-to":xe()}],"mask-image-x-from-color":[{"mask-x-from":ie()}],"mask-image-x-to-color":[{"mask-x-to":ie()}],"mask-image-y-from-pos":[{"mask-y-from":xe()}],"mask-image-y-to-pos":[{"mask-y-to":xe()}],"mask-image-y-from-color":[{"mask-y-from":ie()}],"mask-image-y-to-color":[{"mask-y-to":ie()}],"mask-image-radial":[{"mask-radial":[ge,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":xe()}],"mask-image-radial-from-color":[{"mask-radial-from":ie()}],"mask-image-radial-to-color":[{"mask-radial-to":ie()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":K()}],"mask-image-conic-pos":[{"mask-conic":[Ee]}],"mask-image-conic-from-pos":[{"mask-conic-from":xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":xe()}],"mask-image-conic-from-color":[{"mask-conic-from":ie()}],"mask-image-conic-to-color":[{"mask-conic-to":ie()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Qe()}],"mask-repeat":[{mask:J()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,he]}],filter:[{filter:["","none",ge,he]}],blur:[{blur:$e()}],brightness:[{brightness:[Ee,ge,he]}],contrast:[{contrast:[Ee,ge,he]}],"drop-shadow":[{"drop-shadow":["","none",_,Ul,ql]}],"drop-shadow-color":[{"drop-shadow":ie()}],grayscale:[{grayscale:["",Ee,ge,he]}],"hue-rotate":[{"hue-rotate":[Ee,ge,he]}],invert:[{invert:["",Ee,ge,he]}],saturate:[{saturate:[Ee,ge,he]}],sepia:[{sepia:["",Ee,ge,he]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,he]}],"backdrop-blur":[{"backdrop-blur":$e()}],"backdrop-brightness":[{"backdrop-brightness":[Ee,ge,he]}],"backdrop-contrast":[{"backdrop-contrast":[Ee,ge,he]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ee,ge,he]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ee,ge,he]}],"backdrop-invert":[{"backdrop-invert":["",Ee,ge,he]}],"backdrop-opacity":[{"backdrop-opacity":[Ee,ge,he]}],"backdrop-saturate":[{"backdrop-saturate":[Ee,ge,he]}],"backdrop-sepia":[{"backdrop-sepia":["",Ee,ge,he]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,he]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ee,"initial",ge,he]}],ease:[{ease:["linear","initial",R,ge,he]}],delay:[{delay:[Ee,ge,he]}],animate:[{animate:["none",G,ge,he]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,ge,he]}],"perspective-origin":[{"perspective-origin":Y()}],rotate:[{rotate:Pe()}],"rotate-x":[{"rotate-x":Pe()}],"rotate-y":[{"rotate-y":Pe()}],"rotate-z":[{"rotate-z":Pe()}],scale:[{scale:Ct()}],"scale-x":[{"scale-x":Ct()}],"scale-y":[{"scale-y":Ct()}],"scale-z":[{"scale-z":Ct()}],"scale-3d":["scale-3d"],skew:[{skew:Cn()}],"skew-x":[{"skew-x":Cn()}],"skew-y":[{"skew-y":Cn()}],transform:[{transform:[ge,he,"","none","gpu","cpu"]}],"transform-origin":[{origin:Y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Tt()}],"translate-x":[{"translate-x":Tt()}],"translate-y":[{"translate-y":Tt()}],"translate-z":[{"translate-z":Tt()}],"translate-none":["translate-none"],accent:[{accent:ie()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ie()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,he]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,he]}],fill:[{fill:["none",...ie()]}],"stroke-w":[{stroke:[Ee,Jr,vi,wb]}],stroke:[{stroke:["none",...ie()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},o3=U4(r3);function zn(...e){return o3(av(e))}const l3=D0("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:ring-offset-2 focus-visible:ring-offset-black disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-zinc-50 text-black hover:bg-zinc-200",secondary:"border border-zinc-800 bg-zinc-950 text-zinc-100 hover:bg-zinc-900",ghost:"text-zinc-400 hover:bg-zinc-900 hover:text-zinc-50",outline:"border border-zinc-800 bg-transparent text-zinc-100 hover:bg-zinc-900",destructive:"bg-rose-600 text-white hover:bg-rose-700"},size:{default:"h-10 px-4 md:h-9",sm:"h-9 px-3 text-xs md:h-8",icon:"size-10 md:size-9"}},defaultVariants:{variant:"default",size:"default"}}),Ue=q.forwardRef(({className:e,variant:n,size:i,asChild:r=!1,...l},c)=>{const d=r?hw:"button";return f.jsx(d,{ref:c,className:zn(l3({variant:n,size:i,className:e})),...l})});Ue.displayName="Button";const c3=D0("inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium tracking-wide",{variants:{variant:{neutral:"border-zinc-800 bg-zinc-950 text-zinc-300",success:"border-emerald-500/25 bg-emerald-500/10 text-emerald-300",warning:"border-amber-500/25 bg-amber-500/10 text-amber-300",destructive:"border-rose-500/25 bg-rose-500/10 text-rose-300"}},defaultVariants:{variant:"neutral"}});function Q0({className:e,variant:n,...i}){return f.jsx("div",{className:zn(c3({variant:n}),e),...i})}const u3=220;function kb({compact:e=!1,version:n,updateAvailable:i,onDismissUpdate:r}){const l=!e&&n&&n!=="unknown",[c,d]=q.useState(!1),m=!e&&i&&r,g=()=>{d(!0),window.setTimeout(()=>{r?.(),d(!1)},u3)};return e?f.jsxs(rt,{to:"/",className:"brand-lockup brand-lockup-compact","aria-label":"Canonry home",children:[f.jsx("img",{className:"brand-icon",src:"./favicon.svg",alt:"","aria-hidden":"true"}),f.jsx("span",{className:"brand-copy",children:f.jsx("span",{className:"brand-mark",children:"Canonry"})})]}):f.jsxs("div",{className:"brand-lockup brand-lockup-wrapper",children:[f.jsx(rt,{to:"/",className:"brand-icon-link","aria-label":"Canonry home",tabIndex:-1,children:f.jsx("img",{className:"brand-icon",src:"./favicon.svg",alt:"","aria-hidden":"true"})}),f.jsxs("div",{className:"brand-copy",children:[f.jsx(rt,{to:"/",className:"brand-mark",children:"Canonry"}),m?f.jsxs("span",{className:`brand-update-bubble ${c?"brand-update-bubble-closing":""}`,role:"status","aria-live":"polite",children:[f.jsxs("a",{className:"brand-update-bubble-link",href:i.url,target:"_blank",rel:"noopener noreferrer",title:`Open release: ${i.upgradeCommand}`,"aria-label":`New version v${i.latest} available — open release page`,children:[f.jsxs("span",{className:"brand-update-bubble-from",children:["v",i.current]}),f.jsx(Ck,{className:"brand-update-bubble-arrow size-3","aria-hidden":"true"}),f.jsxs("span",{className:"brand-update-bubble-to",children:["v",i.latest]})]}),f.jsx("button",{type:"button",className:"brand-update-bubble-dismiss",onClick:g,"aria-label":`Dismiss update notification for v${i.latest}`,children:f.jsx(Ps,{className:"size-3","aria-hidden":"true"})})]}):l?f.jsxs("span",{className:"brand-version",children:["v",n]}):null]})]})}function d3({provider:e}){const n={gemini:"border-blue-800/50 bg-blue-950/40 text-blue-300",openai:"border-green-800/50 bg-green-950/40 text-green-300",claude:"border-amber-800/50 bg-amber-950/40 text-amber-300",perplexity:"border-teal-800/50 bg-teal-950/40 text-teal-300",local:"border-purple-800/50 bg-purple-950/40 text-purple-300"};return f.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ${n[e]??"border-zinc-700 bg-zinc-800 text-zinc-300"}`,children:e})}function Ln({tone:e,children:n,...i}){const r=e==="positive"?"success":e==="caution"?"warning":e==="negative"?"destructive":"neutral";return f.jsx(Q0,{variant:r,...i,children:n})}function fp({status:e}){return f.jsx(Ln,{tone:C0(e),children:_0(e)})}const f3=nv,p3=Wb,Y0=q.forwardRef(({className:e,...n},i)=>f.jsx(Df,{ref:i,className:zn("fixed inset-0 z-50 bg-black/70 backdrop-blur-sm",e),...n}));Y0.displayName=Df.displayName;const m3=400,h3=1200,g3=720,X0=q.forwardRef(({className:e,children:n,...i},r)=>{const[l,c]=q.useState(g3),d=q.useRef(!1),m=q.useRef(0),g=q.useRef(0),b=q.useCallback(j=>{d.current=!0,m.current=j.clientX,g.current=l,j.target.setPointerCapture(j.pointerId),j.preventDefault()},[l]),v=q.useCallback(j=>{if(!d.current)return;const _=m.current-j.clientX,C=Math.min(h3,Math.max(m3,g.current+_));c(C)},[]),S=q.useCallback(()=>{d.current=!1},[]);return f.jsxs(p3,{children:[f.jsx(Y0,{}),f.jsxs(Rf,{ref:r,className:zn("fixed z-50 flex flex-col bg-zinc-950 px-5 py-4 shadow-2xl overflow-hidden","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-t-2xl max-md:border-t","md:inset-y-0 md:right-0 md:h-full md:border-l","border-zinc-800",e),style:{width:`min(${l}px, 100vw)`},...i,children:[f.jsx("div",{className:"absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-zinc-700/50 active:bg-zinc-600/50 transition-colors max-md:hidden",onPointerDown:b,onPointerMove:v,onPointerUp:S}),n,f.jsxs(ev,{className:"absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-900 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",children:[f.jsx(Ps,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});X0.displayName=Rf.displayName;const y3=({className:e,...n})=>f.jsx("div",{className:zn("flex flex-col gap-1.5 pr-10",e),...n}),J0=q.forwardRef(({className:e,...n},i)=>f.jsx(Mf,{ref:i,className:zn("text-lg font-medium text-zinc-50",e),...n}));J0.displayName=Mf.displayName;const F0=q.forwardRef(({className:e,...n},i)=>f.jsx(tv,{ref:i,className:zn("text-sm text-zinc-500",e),...n}));F0.displayName=tv.displayName;function b3({title:e,subtitle:n,children:i,open:r,onClose:l}){return f.jsx(f3,{open:r,onOpenChange:c=>c?void 0:l(),children:f.jsxs(X0,{children:[f.jsxs(y3,{className:"drawer-head",children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:n}),f.jsx(J0,{id:"drawer-title",children:e}),f.jsx(F0,{className:"sr-only",children:n})]}),f.jsx("div",{className:"drawer-body",children:i})]})})}function $l({text:e}){const[n,i]=q.useState(null),r=q.useRef(null),l=q.useCallback(()=>{if(!r.current)return;const m=r.current.getBoundingClientRect();i({top:m.top,left:m.left+m.width/2})},[]),c=q.useCallback(()=>i(null),[]),d=q.useCallback(()=>{n===null?l():c()},[n,l,c]);return f.jsxs("span",{className:"info-tooltip-wrapper",onMouseEnter:l,onMouseLeave:c,children:[f.jsx("button",{ref:r,type:"button",className:"info-tooltip-trigger","aria-label":e,"aria-expanded":n!==null,onFocus:l,onBlur:c,onClick:d,onKeyDown:m=>{m.key==="Escape"&&c()},children:f.jsxs("svg",{className:"info-tooltip-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[f.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),f.jsx("path",{d:"M8 7v4M8 5.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),n!==null&&ow.createPortal(f.jsx("span",{"aria-hidden":"true",style:{position:"fixed",top:n.top,left:n.left,transform:"translateX(-50%) translateY(calc(-100% - 8px))",zIndex:9999,pointerEvents:"none",width:"14rem",padding:"0.5rem 0.75rem",fontSize:"11px",fontWeight:400,textTransform:"none",letterSpacing:"normal",lineHeight:"1rem",color:"#d4d4d8",backgroundColor:"#18181b",border:"1px solid rgba(63, 63, 70, 0.6)",borderRadius:"0.5rem",boxShadow:"0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1)"},children:e}),document.body)]})}const v3=/[\s\-_]+/;function S3(e){const n=e.split(v3).filter(Boolean);return n.length===0?null:n.map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("[\\s\\-_]*")}function Ab(e,n){const i=x3(n),r=e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(b=>b.startsWith("**")&&b.endsWith("**")?{type:"bold",value:b.slice(2,-2)}:{type:"text",value:b}),l=i.flatMap(b=>b.terms).filter(b=>b.trim().length>1);if(l.length===0)return r.map((b,v)=>b.type==="bold"?ks.createElement("strong",{key:`b-${v}`,className:"text-zinc-200 font-semibold"},b.value):b.value).filter(Boolean);const d=[...l].sort((b,v)=>v.length-b.length).map(S3).filter(b=>!!b);if(d.length===0)return r.map((b,v)=>b.type==="bold"?ks.createElement("strong",{key:`b-${v}`,className:"text-zinc-200 font-semibold"},b.value):b.value).filter(Boolean);const m=new RegExp(`(${d.join("|")})`,"gi"),g=new Map;for(const b of i)for(const v of b.terms){const S=oc(v);S&&!g.has(S)&&g.set(S,b.className)}return r.flatMap((b,v)=>b.value.split(m).map((j,_)=>{if(!j)return null;if(_%2===1){const k=g.get(oc(j))??"answer-highlight";return b.type==="bold"?ks.createElement("mark",{key:`hl-${v}-${_}`,className:k},ks.createElement("strong",{className:"text-zinc-200 font-semibold"},j)):ks.createElement("mark",{key:`hl-${v}-${_}`,className:k},j)}return b.type==="bold"?ks.createElement("strong",{key:`b-${v}-${_}`,className:"text-zinc-200 font-semibold"},j):j})).filter(Boolean)}function x3(e){return e.length===0?[]:typeof e[0]=="string"?[{terms:e,className:"answer-highlight"}]:e}function _b(e){const n=(e??"").trim();return n&&(n.startsWith("/")||/^https?:\/\//i.test(n)||/^mailto:/i.test(n))?n:null}function af(e,n){switch(e){case"new":return"First observation";case"emerging":return"First mention";case"lost":return"Lost since last run";default:return n==="mentioned"||n==="visible"?"Mentioned in latest run":n==="pending"?"Awaiting first run":"Not mentioned in latest run"}}function w3({evidence:e,project:n,onClose:i}){const[r,l]=q.useState(!1),[c,d]=q.useState("mentions"),[m,g]=q.useState(-1),[b,v]=q.useState(null),[S,j]=q.useState(!1),[_,C]=q.useState({}),k=rT(n.project),T=new Set(k.map(ac)),R=e.runHistory,G=R.length>1,[H,K]=q.useState(null),Y=q.useRef(!1);q.useEffect(()=>{if(Y.current||e.answerSnippet&&(e.visibilityState!=null||e.answerMentioned!=null))return;const te=R.at(-1);te&&(Y.current=!0,Fl(te.runId).then(ue=>{const ne=ue.snapshots?.find(Ne=>Ne.query===e.query&&Ne.provider===e.provider);ne&&K({citationState:ne.citationState,answerMentioned:ne.answerMentioned,visibilityState:ne.visibilityState,visibilityTransition:te.visibilityTransition,provider:ne.provider,model:ne.model??e.model,answerSnippet:ne.answerText??e.answerSnippet,citedDomains:ne.citedDomains??e.citedDomains,competitorDomains:ne.competitorOverlap??e.competitorDomains,recommendedCompetitors:ne.recommendedCompetitors??e.recommendedCompetitors??[],matchedTerms:ne.matchedTerms??e.matchedTerms??[],groundingSources:ne.groundingSources??e.groundingSources,evidenceUrls:[],changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary})}).catch(()=>{}))},[e,R]);const X=m>=0&&b!==null,D=X?b:H||{citationState:e.citationState,answerMentioned:e.answerMentioned,visibilityState:e.visibilityState,visibilityTransition:R.at(-1)?.visibilityTransition,provider:e.provider,model:e.model,answerSnippet:e.answerSnippet,citedDomains:e.citedDomains,competitorDomains:e.competitorDomains,recommendedCompetitors:e.recommendedCompetitors??[],matchedTerms:e.matchedTerms??[],groundingSources:e.groundingSources,evidenceUrls:e.evidenceUrls,changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary},M=D.visibilityState==="pending"||D.citationState==="pending",oe=M?!1:D.visibilityState!=null?D.visibilityState==="visible":D.answerMentioned!=null?D.answerMentioned:D.citationState===ic.cited||D.citationState==="emerging",ke=D.answerMentioned!=null||D.visibilityState!=null||D.recommendedCompetitors.length>0,_e=D.citedDomains.length>0||D.groundingSources.length>0||D.evidenceUrls.length>0,ve=n.project.displayName||n.project.name,et=[...k.map(ac),ve,ve.split(" ").slice(0,2).join(" "),...D.matchedTerms].filter(te=>te.trim().length>2),re=[...D.competitorDomains.flatMap(te=>{const ue=sT(te);return ue.length>=4?[ue]:[]}),...D.recommendedCompetitors].filter(te=>te.trim().length>2),me=[{terms:et,className:"answer-highlight-brand"},...re.length>0?[{terms:re,className:"answer-highlight-competitor"}]:[]],$=M?"pending":D.visibilityTransition==="lost"?"lost":oe?"mentioned":"not-mentioned",W=q.useRef(0),fe=q.useCallback(async te=>{const ue=++W.current;if(te===-1||te===R.length-1){g(-1),v(null),l(!1);return}g(te),l(!1);const ne=R[te],Ne=`${ne.runId}::${e.query}::${e.provider}`;if(_[Ne]){v(_[Ne]);return}j(!0);try{const tt=await Fl(ne.runId);if(ue!==W.current)return;const xe=tt.snapshots?.find(Pe=>Pe.query===e.query&&Pe.provider===e.provider)??tt.snapshots?.find(Pe=>Pe.query===e.query),$e=xe?{citationState:xe.citationState,answerMentioned:xe.answerMentioned,visibilityState:xe.visibilityState,visibilityTransition:ne.visibilityTransition,provider:xe.provider,model:xe.model??null,answerSnippet:xe.answerText??"",citedDomains:xe.citedDomains,competitorDomains:xe.competitorOverlap,recommendedCompetitors:xe.recommendedCompetitors??[],matchedTerms:xe.matchedTerms??[],groundingSources:xe.groundingSources,evidenceUrls:[],changeLabel:af(ne.mentionTransition??ne.visibilityTransition,ne.mentionState??ne.visibilityState),summary:""}:{citationState:ne.citationState,answerMentioned:ne.answerMentioned,visibilityState:ne.visibilityState,visibilityTransition:ne.visibilityTransition,provider:e.provider,model:ne.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],groundingSources:[],evidenceUrls:[],changeLabel:af(ne.mentionTransition??ne.visibilityTransition,ne.mentionState??ne.visibilityState),summary:"Snapshot data not available for this run."};C(Pe=>({...Pe,[Ne]:$e})),v($e)}catch{if(ue!==W.current)return;v({citationState:ne.citationState,answerMentioned:ne.answerMentioned,visibilityState:ne.visibilityState,visibilityTransition:ne.visibilityTransition,provider:e.provider,model:ne.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],groundingSources:[],evidenceUrls:[],changeLabel:af(ne.mentionTransition??ne.visibilityTransition,ne.mentionState??ne.visibilityState),summary:"Failed to load historical run data."})}finally{ue===W.current&&j(!1)}},[R,e.query,e.provider,_]),ie=(X||e.historyScope!=="provider")&&D.model?`${D.provider} (${D.model}) · ${D.changeLabel.toLowerCase()}`:`${D.provider} · ${D.changeLabel.toLowerCase()}`,Qe=!X&&e.historyScope==="provider"?[e.model?`Current model: ${e.model}`:null,e.modelsSeen&&e.modelsSeen.length>1?`History spans ${e.modelsSeen.length} models`:null].filter(Boolean).join(" · "):"",J=oe?{label:"Mentioned in answer",title:"Your brand or domain is mentioned in this answer",meta:ie}:D.visibilityTransition==="lost"?{label:"Mention lost",title:"Your brand no longer appears in this answer",meta:ie}:M?{label:"Pending",title:"Awaiting first run",meta:"No provider data yet"}:{label:"Not mentioned in answer",title:"Your brand or domain was not mentioned in this answer",meta:ie},le=()=>{if(!D.answerSnippet)return null;const te=D.answerSnippet.split(`
|
|
58
|
-
`),ue=[];let ne=[],Ne=0;const tt=()=>{if(ne.length===0)return;const xe=ne.join(" ").trim();xe&&ue.push(f.jsx("p",{className:ue.length>0?"mt-2.5":"",children:Ab(xe,me)},Ne++)),ne=[]};for(const xe of te){const $e=xe.trim();if(/^[-\u2013\u2014]{3,}$/.test($e)){tt(),ue.push(f.jsx("hr",{className:"border-zinc-800/60 my-3"},Ne++));continue}const Pe=$e.match(/^(#{1,3})\s+(\S.*)$/);if(Pe){tt();const Ct=Pe[1].length,Cn=Pe[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s]+/u,"").trim()||Pe[2],Tt=Ct===1?"text-[13px] font-semibold text-zinc-100 mt-4 mb-1":Ct===2?"text-xs font-semibold text-zinc-200 mt-3 mb-0.5":"text-xs font-medium text-zinc-300 mt-2";ue.push(f.jsx("p",{className:Tt,children:Ab(Cn,me)},Ne++));continue}if($e===""){tt();continue}ne.push($e)}return tt(),ue};return f.jsx(nv,{open:!0,onOpenChange:te=>{te||i()},children:f.jsxs(Wb,{children:[f.jsx(Df,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"}),f.jsxs(Rf,{className:"evidence-modal","aria-describedby":void 0,children:[f.jsxs("div",{className:"evidence-modal-header",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("p",{className:"eyebrow eyebrow-soft",children:[n.project.name," ","·"," ",D.provider||"All providers"]}),f.jsx(Mf,{className:"text-lg font-semibold text-zinc-50 truncate",children:e.query})]}),f.jsxs(ev,{className:"inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-800 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 shrink-0",children:[f.jsx(Ps,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]}),G&&f.jsxs("div",{className:"evidence-modal-timeline",children:[f.jsx("p",{className:"drawer-section-label mb-1.5",children:"Run history"}),f.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1",children:R.map((te,ue)=>{const ne=m===-1&&ue===R.length-1||m===ue,Ne=te.visibilityState??(te.answerMentioned?"visible":"not-visible"),tt=te.visibilityTransition??Ne,xe=Ne==="visible"?"bg-emerald-400":tt==="emerging"?"bg-amber-400":tt==="lost"?"bg-rose-400":"bg-zinc-600",Pe=new Date(te.createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),Ct=!!(te.model&&ue>0&&R[ue-1]?.model&&R[ue-1].model!==te.model);return f.jsxs("button",{type:"button",className:`evidence-run-dot ${ne?"evidence-run-dot--selected":""}`,onClick:()=>{fe(ue===R.length-1?-1:ue)},"aria-label":[`Run ${Pe}: ${Ne}`,te.model?`model ${te.model}`:null,Ct?"model changed":null].filter(Boolean).join(" — "),"aria-pressed":ne,children:[f.jsx("span",{className:`size-2 rounded-full ${xe} ${Ct?"ring-1 ring-amber-300/80 ring-offset-2 ring-offset-zinc-950":""}`,"aria-hidden":"true"}),f.jsx("span",{className:"text-[10px] text-zinc-500",children:Pe})]},ue)})}),m>=0&&m<R.length&&f.jsxs("p",{className:"text-[11px] text-zinc-500 mt-1",children:["Viewing run from ",new Date(R[m].createdAt).toLocaleString()," ","—"," ",f.jsx("span",{className:"capitalize",children:R[m].visibilityState??(R[m].answerMentioned?"visible":"not-visible")}),f.jsxs("button",{type:"button",className:"text-zinc-400 hover:text-zinc-200 ml-2",onClick:()=>{fe(-1)},children:["←"," Back to latest"]})]}),!X&&(e.modelTransitions?.length??0)>0&&f.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.modelTransitions.map(te=>f.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-1 text-[10px] text-amber-100",children:`${te.fromModel??"unknown"} -> ${te.toModel??"unknown"} on ${new Date(te.createdAt).toLocaleDateString()}`},`${te.runId}:${te.toModel??"unknown"}`))})]}),f.jsxs("div",{className:"evidence-modal-body",children:[S&&f.jsxs("div",{className:"md:col-span-2 flex items-center justify-center py-12 text-zinc-500 text-sm",children:["Loading historical run data","…"]}),!S&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"evidence-modal-main",children:[f.jsxs("div",{className:`evidence-position-hero evidence-position-hero--${$}`,children:[f.jsx("p",{className:`evidence-position-label evidence-position-label--${$}`,children:J.label}),f.jsx("p",{className:`evidence-position-title evidence-position-title--${$}`,children:J.title}),f.jsx("p",{className:"evidence-position-meta",children:J.meta}),Qe&&f.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:Qe})]}),D.answerSnippet&&f.jsxs("div",{children:[f.jsx("p",{className:"drawer-section-label",children:"What the AI said"}),f.jsx("div",{className:`answer-snippet-block ${r?"evidence-answer-expanded":"evidence-answer-collapsed"}`,children:le()}),D.answerSnippet.length>280&&f.jsx("button",{type:"button",className:"mt-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",onClick:()=>l(!r),children:r?"↑ Collapse":"↓ Show full answer"})]}),!D.answerSnippet&&!S&&f.jsx("div",{className:"rounded-lg border border-zinc-800/40 bg-zinc-900/20 px-4 py-8 text-center text-zinc-600 text-sm",children:"No answer text recorded for this run"}),!X&&e.relatedTechnicalSignals.length>0&&f.jsxs("div",{children:[f.jsx("p",{className:"drawer-section-label",children:oe?"Why you're visible":"What to fix"}),f.jsx("div",{className:"action-items-list",children:e.relatedTechnicalSignals.map((te,ue)=>f.jsxs("div",{className:"action-item",children:[f.jsx("svg",{className:`action-item-icon ${oe?"text-emerald-400":"text-amber-400"}`,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:oe?f.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),f.jsx("path",{d:"M8 5v3.5M8 10.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),f.jsx("span",{className:"action-item-text",children:te})]},ue))})]}),D.summary&&f.jsx("p",{className:"text-xs text-zinc-600 border-t border-zinc-800/40 pt-3 mt-1",children:D.summary})]}),f.jsxs("div",{className:"evidence-modal-sidebar",children:[(ke||_e)&&f.jsxs("div",{className:"sidebar-tabs",children:[f.jsx("button",{className:`sidebar-tab ${c==="mentions"?"sidebar-tab--active":""}`,onClick:()=>d("mentions"),type:"button",title:"Canonry's answer-level visibility assessment and any company names extracted from the answer text.",children:"Mentions"}),f.jsx("button",{className:`sidebar-tab ${c==="sources"?"sidebar-tab--active":""}`,onClick:()=>d("sources"),type:"button",title:"Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.",children:"Sources"})]}),c==="mentions"&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsx("span",{children:"Mention in answer"}),f.jsx($l,{text:"Canonry scans the AI answer for your owned domains and project name. This is independent from grounding or citation sources."})]}),f.jsxs("div",{className:`mention-status mention-status--${oe?"mentioned":"not-mentioned"}`,children:[f.jsx("span",{className:"mention-status-icon",children:M?"…":oe?"✓":"—"}),f.jsx("span",{className:"mention-status-label",children:M?"Pending":oe?"Mentioned":"Not mentioned"})]}),D.matchedTerms.length>0&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Matched in answer"}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:D.matchedTerms.map(te=>f.jsx("span",{className:"mention-chip mention-chip--brand",children:te},te))})]}),!M&&!oe&&D.matchedTerms.length===0&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Searched for"}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:et.map(te=>f.jsx("span",{className:"mention-chip mention-chip--muted",children:te},te))}),f.jsx("p",{className:"text-[11px] text-zinc-600 mt-1.5",children:"None of these appear in the answer text."})]})]}),(D.recommendedCompetitors.length>0||D.competitorDomains.length>0)&&f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsx("span",{children:"Competitors in answer"}),f.jsx($l,{text:"Competitors detected in the answer text or cited source links. Includes both tracked competitors and names extracted by Canonry."})]}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{const te=D.competitorDomains.map(Ne=>Ne.replace(/^www\./,"")),ue=new Set(te.map(Ne=>oc(Ne.replace(/\.[^.]+$/,""))));return[...D.recommendedCompetitors.filter(Ne=>!ue.has(oc(Ne))),...te].map(Ne=>f.jsx("span",{className:"mention-chip mention-chip--competitor",children:Ne},Ne))})()})]})]}),c==="sources"&&f.jsxs(f.Fragment,{children:[D.citedDomains.length>0&&f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsx("span",{children:"Domains from source links"}),f.jsx($l,{text:"These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them."})]}),f.jsx("div",{className:"citation-leaderboard",children:D.citedDomains.map((te,ue)=>{const ne=te.toLowerCase().replace(/^www\./,""),Ne=T.has(ne),tt=!Ne&&D.competitorDomains.some($e=>$e.toLowerCase().replace(/^www\./,"")===ne),xe=Ne?"you":tt?"competitor":"other";return f.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${xe}`,children:[f.jsxs("span",{className:"citation-leaderboard-rank",children:["#",ue+1]}),f.jsx("span",{className:"citation-leaderboard-domain",children:te}),Ne&&f.jsx("span",{className:"citation-leaderboard-tag",children:"You"}),tt&&f.jsx("span",{className:"citation-leaderboard-tag",children:"Competitor"})]},te)})})]}),D.groundingSources.length>0&&f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsxs("span",{children:["Grounding source links (",D.groundingSources.length,")"]}),f.jsx($l,{text:"Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility."})]}),f.jsx("ul",{className:"grid gap-0.5",children:D.groundingSources.map((te,ue)=>{const ne=_b(te.uri),Ne=te.title||te.uri;return f.jsx("li",{className:"truncate text-sm",children:ne?f.jsx("a",{href:ne,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:Ne}):f.jsx("span",{className:"text-zinc-400",children:Ne})},ue)})})]}),D.evidenceUrls.length>0&&f.jsxs("div",{children:[f.jsx("p",{className:"drawer-section-label",children:"Evidence URLs"}),f.jsx("ul",{className:"grid gap-1",children:D.evidenceUrls.map(te=>{const ue=_b(te);return f.jsx("li",{className:"truncate text-sm",children:ue?f.jsx("a",{href:ue,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:te}):f.jsx("span",{className:"text-zinc-400",children:te})},te)})})]}),D.citedDomains.length===0&&D.groundingSources.length===0&&D.evidenceUrls.length===0&&f.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No source data ",X?"for this run":"yet"]})]}),!ke&&!_e&&f.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No answer visibility data ",X?"for this run":"yet"]})]})]})]})]})]})})}function Bn(e){const n=new Date("2026-02-20");return e.map((i,r)=>({runId:`run_mock_${r+1}`,citationState:i,createdAt:new Date(n.getTime()+r*2*24*60*60*1e3).toISOString()}))}const sf=[{id:"project_citypoint",name:"Citypoint Dental NYC",canonicalDomain:"citypointdental.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["local intent","priority"],labels:{},providers:[],locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_harbor",name:"Harbor Legal Group",canonicalDomain:"harborlegal.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["lead gen"],labels:{},providers:[],locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_northstar",name:"Northstar Orthopedics",canonicalDomain:"northstarortho.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["multi-location"],labels:{},providers:[],locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1}];function Sc(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??"manual",createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel}}const j3=Sc({id:"run_citypoint_visibility_20260308",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T12:15:00.000Z",startedAt:"Mar 8, 12:15 PM",duration:"6m 12s",statusDetail:"18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.",summary:"Citation losses on emergency-intent prompts",triggerLabel:"Scheduled"}),N3=Sc({id:"run_citypoint_queued_20260309",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"queued",createdAt:"2026-03-09T08:05:00.000Z",startedAt:"Mar 9, 8:05 AM",duration:"Waiting for slot",statusDetail:"Ready to enqueue after the next provider rate window clears.",summary:"Queued follow-up after local ranking movement",triggerLabel:"Manual"}),k3=Sc({id:"run_harbor_visibility_20260308",projectId:"project_harbor",projectName:"Harbor Legal Group",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T11:05:00.000Z",startedAt:"Mar 8, 11:05 AM",duration:"5m 07s",statusDetail:"12 tracked queries checked; local-intent visibility held steady across branded prompts.",summary:"Branded prompts remain stable",triggerLabel:"Scheduled"}),A3=Sc({id:"run_northstar_visibility_20260308",projectId:"project_northstar",projectName:"Northstar Orthopedics",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"running",createdAt:"2026-03-08T13:40:00.000Z",startedAt:"Mar 8, 1:40 PM",duration:"3m 10s",statusDetail:"Provider responses still in flight for 9 multi-location prompts.",summary:"Mid-run on treatment-location prompts",triggerLabel:"Manual"}),_3=[{id:"evidence_citypoint_emergency_gemini",query:"emergency dentist brooklyn",provider:"gemini",model:"gemini-2.5-flash",location:null,citationState:"lost",changeLabel:"Lost since Mar 5",answerSnippet:"For urgent dental care in Brooklyn, Downtown Smiles and Harbor Dental are now cited first for emergency availability and same-day booking.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:["https://downtownsmiles.com/emergency-dentist-brooklyn","https://harbordental.com/same-day-emergency-care"],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing on the emergency service page","llms.txt not found during latest site audit","Location pages link weakly into the emergency care hub"],summary:"AI answers now cite two competitors while your emergency page is no longer grounded.",runHistory:Bn(["cited","cited","cited","cited","cited","cited","cited","not-cited","not-cited"])},{id:"evidence_citypoint_emergency_openai",query:"emergency dentist brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"Cited for 6 runs",answerSnippet:"Citypoint Dental is listed as a top emergency dentist in Brooklyn for same-day appointments and walk-in availability.",citedDomains:["citypointdental.com","downtownsmiles.com"],evidenceUrls:["https://citypointdental.com/emergency-dentist-brooklyn"],competitorDomains:["downtownsmiles.com"],groundingSources:[],relatedTechnicalSignals:["Emergency page indexed with structured data"],summary:"OpenAI cites your emergency page consistently alongside one competitor.",runHistory:Bn(["not-cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_emergency_claude",query:"emergency dentist brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"Based on the search results, top-rated emergency dental practices in Brooklyn include Downtown Smiles and Harbor Dental.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:[],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing","llms.txt not found"],summary:"Claude does not cite your domain for this emergency query.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_invisalign_openai",query:"best invisalign dentist downtown brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"emerging",changeLabel:"First citation in 7 days",answerSnippet:"Citypoint Dental appears as an emerging recommendation for Invisalign in Downtown Brooklyn, supported by recent before-and-after case pages.",citedDomains:["citypointdental.com","clearlineortho.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn","https://citypointdental.com/case-studies/invisalign-open-bite"],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["Structured data now present on two case-study pages","Internal links from service pages to case studies improved crawl depth"],summary:"Fresh case-study content is starting to earn citations on Invisalign prompts.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","cited"])},{id:"evidence_citypoint_invisalign_gemini",query:"best invisalign dentist downtown brooklyn",provider:"gemini",model:"gemini-2.5-flash",location:null,citationState:"cited",changeLabel:"Cited for 8 runs",answerSnippet:"Citypoint Dental in Downtown Brooklyn is highlighted for its Invisalign expertise and patient outcomes.",citedDomains:["citypointdental.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn"],competitorDomains:[],groundingSources:[],relatedTechnicalSignals:["Case study pages well-indexed"],summary:"Gemini consistently cites your Invisalign page with no competitor overlap.",runHistory:Bn(["cited","cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_invisalign_claude",query:"best invisalign dentist downtown brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For Invisalign in Downtown Brooklyn, Clear Line Ortho and Brooklyn Smiles are frequently recommended for their experienced orthodontists.",citedDomains:["clearlineortho.com","brooklynsmiles.com"],evidenceUrls:[],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["No before/after schema on case study pages"],summary:"Claude does not surface your Invisalign content despite strong page quality.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_claude",query:"pediatric dentist brooklyn heights",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 4 runs",answerSnippet:"Answers cite neighborhood-specific pediatric practices with stronger family-focused FAQ content and clearer insurance details.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:["https://brightkidsdental.com/pediatric-dentist-brooklyn-heights","https://parkpediatricdental.com/insurance"],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric service page exists for Brooklyn Heights","Insurance content is buried three clicks deep"],summary:"Coverage gap is content-driven, not purely technical.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_gemini",query:"pediatric dentist brooklyn heights",provider:"gemini",model:"gemini-2.5-flash",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For pediatric dentistry in Brooklyn Heights, Bright Kids Dental and Park Pediatric Dental are cited for family-friendly care.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:[],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric page for Brooklyn Heights"],summary:"Gemini does not surface your domain for pediatric queries in this area.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_openai",query:"pediatric dentist brooklyn heights",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"First citation this month",answerSnippet:"Citypoint Dental is mentioned as offering pediatric services in Brooklyn, though specialized pediatric-only practices are also highlighted.",citedDomains:["citypointdental.com","brightkidsdental.com"],evidenceUrls:["https://citypointdental.com/family-dentistry"],competitorDomains:["brightkidsdental.com"],groundingSources:[],relatedTechnicalSignals:["Family dentistry page recently updated"],summary:"OpenAI recently started citing your family dentistry page for this query.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","cited"])}];sf[0],sf[1],Bn(["cited","cited","cited","cited","cited"]),sf[2],2/7,3/7,Bn(["not-cited","not-cited","not-cited","cited"]);function z3(e,n){return e.runs.find(i=>i.id===n)}function C3(e,n){for(const i of e.projects){const r=i.visibilityEvidence.find(l=>l.id===n);if(r)return{project:i,evidence:r}}}function T3(e,n,i){if(e){const r=e.visibilityEvidence.find(l=>l.id===i);if(r)return{project:e,evidence:r}}if(n)return C3(n,i)}const E3={regression:"negative",gain:"positive",opportunity:"caution","first-citation":"positive","provider-pickup":"positive","persistent-gap":"caution","competitor-gained":"negative","competitor-lost":"neutral","gbp-lodging-gap":"negative","gbp-cta-gap":"caution","gbp-metric-drop":"negative","gbp-keyword-drop":"negative"},O3={opportunity:"write","persistent-gap":"write","competitor-gained":"write","competitor-lost":"write",regression:"investigate",gain:"monitor","first-citation":"monitor","provider-pickup":"monitor","gbp-lodging-gap":"write","gbp-cta-gap":"write","gbp-metric-drop":"investigate","gbp-keyword-drop":"investigate"},D3={regression:"lost",gain:"emerging",opportunity:"not-cited","first-citation":"emerging","provider-pickup":"emerging","persistent-gap":"not-cited","competitor-gained":"cited","competitor-lost":"not-cited","gbp-lodging-gap":"not-cited","gbp-cta-gap":"not-cited","gbp-metric-drop":"lost","gbp-keyword-drop":"lost"},R3={regression:"Regression",gain:"Gain",opportunity:"Opportunity","first-citation":"First citation","provider-pickup":"Pickup","persistent-gap":"Gap","competitor-gained":"Competitor","competitor-lost":"Competitor","gbp-lodging-gap":"Lodging gap","gbp-cta-gap":"Booking CTA","gbp-metric-drop":"Metric drop","gbp-keyword-drop":"Keyword drop"};function M3(e){return{id:e.id,tone:E3[e.type],title:e.title,detail:e.cause?.details??e.cause?.cause??"",actionLabel:e.recommendation?.action??R3[e.type],actionGroup:O3[e.type],affectedPhrases:[{query:e.query,evidenceId:"",provider:e.provider,citationState:D3[e.type]}]}}function B3(e){return e.filter(n=>!n.dismissed).map(M3)}function W0(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],aliases:e.aliases??[],country:e.country,language:e.language,tags:e.tags,labels:e.labels,providers:e.providers??[],locations:e.locations??[],defaultLocation:e.defaultLocation??null,autoExtractBacklinks:e.autoExtractBacklinks??!1,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function zb(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return e}}function L3(e,n){if(!e)return"Waiting";if(!n)return"Running";const i=new Date(n).getTime()-new Date(e).getTime();if(i<1e3)return"<1s";const r=Math.floor(i/1e3);if(r<60)return`${r}s`;const l=Math.floor(r/60),c=r%60;return`${l}m ${c}s`}function e1(e){switch(e){case Te["answer-visibility"]:return"Answer visibility sweep";case Te["gsc-sync"]:return"GSC sync";case Te["inspect-sitemap"]:return"Sitemap inspection";case Te["ga-sync"]:return"GA sync";case Te["traffic-sync"]:return"Traffic sync";case Te["bing-inspect"]:return"Bing URL inspection";case Te["bing-inspect-sitemap"]:return"Bing sitemap inspection";case Te["site-audit"]:return"Site audit";case Te["backlink-extract"]:return"Backlink extract";case Te["aeo-discover-seed"]:return"Discovery (seed phase)";case Te["aeo-discover-probe"]:return"Discovery (probe phase)";case Te["gbp-sync"]:return"Business Profile sync"}}function q3(e){return e===Ms.manual?"Manual":e===Ms.scheduled?"Scheduled":e===Ms["config-apply"]?"Config apply":e}function pp(e,n){return{id:e.id,projectId:e.projectId,projectName:n,kind:e.kind,kindLabel:e1(e.kind),status:e.status,trigger:e.trigger??"manual",location:e.location??null,createdAt:e.createdAt,startedAt:e.startedAt?zb(e.startedAt):zb(e.createdAt),duration:L3(e.startedAt??null,e.finishedAt??null),statusDetail:e.error?t1(e.error):U3(e),summary:$3(e),triggerLabel:q3(e.trigger)}}function t1(e){const n=Yf(e);return n.length>200?n.slice(0,200)+"…":n}function U3(e){switch(e.status){case Ht.queued:return"Waiting for execution slot.";case Ht.running:return"Provider queries in progress.";case Ht.completed:return"All queries checked.";case Ht.partial:return"Run completed with some queries skipped.";case Ht.failed:return e.error?t1(e.error):"Run failed.";case Ht.cancelled:return"Run was cancelled.";default:return""}}function $3(e){const n=e1(e.kind);switch(e.status){case Ht.queued:return`${n} queued`;case Ht.running:return`${n} in progress`;case Ht.completed:return`${n} completed`;case Ht.partial:return`${n} partially completed`;case Ht.failed:return`${n} failed`;case Ht.cancelled:return`${n} cancelled`;default:return e.status}}function V3(e,n,i,r){const l=[];let c=0;const d=new Set;if(i.length>0){const m=i.flatMap(C=>C.snapshots??[]),g=new Map;for(const C of m)if(C.query){const k=`${C.query}::${C.provider}::${C.location??""}`;g.set(k,C)}const b=new Set(m.map(C=>C.location??null));b.size===0&&b.add(null);const v=new Set(m.map(C=>C.provider)),S=new Set(n.flatMap(C=>Object.keys(C.providerRuns??{}))),j=[...new Set([...v,...S])].sort(),_=j.length>0?j:["gemini"];for(const C of n){if(C.runs.length===0)continue;d.add(C.query);const k=C.runs.at(-1),T=k?.transition??"not-cited";for(const R of _){const G=[...b].filter(Y=>g.has(`${C.query}::${R}::${Y??""}`)),H=(C.providerRuns?.[R]?.length??0)>0,K=G.length>0?G:H?[null]:[];for(const Y of K){const X=Y??"",D=g.get(`${C.query}::${R}::${X}`),M=D?.model??null,oe=M?`${R}:${M}`:null,ke=C.providerRuns?.[R],_e=oe?C.modelRuns?.[oe]:void 0,ve=$e=>$e?.filter(Pe=>(Pe.location??null)===Y),et=G.length>0?ve(ke):ke,re=G.length>0?ve(_e):_e,me=(et?.length?et:null)??(re?.length?re:null),$=et?.length?"provider":re?.length?"model":"query",W=me?me.at(-1).transition:T,fe=me?me.at(-1).visibilityTransition??(me.at(-1).visibilityState==="visible"?"visible":"not-visible"):k?.visibilityTransition??(k?.visibilityState==="visible"?"visible":"not-visible"),je=me?.at(-1)?.citationState,ie=me?.at(-1)?.visibilityState,Qe=D?W==="lost"?"lost":W==="emerging"?"emerging":D.citationState===ic.cited?"cited":"not-cited":je===ic.cited?"cited":"not-cited",J=D?.visibilityState??(ie==="visible"?"visible":ie==="pending"?"pending":"not-visible"),le=Cb(me||C.runs),te=Tb(me||C.runs),ue=G3(C,R),ne=(me??C.runs).map($e=>({runId:$e.runId,citationState:$e.citationState,createdAt:$e.createdAt,model:ue.get($e.runId)??null,answerMentioned:$e.answerMentioned,visibilityState:$e.visibilityState,visibilityTransition:$e.visibilityTransition,mentionState:$e.mentionState,mentionTransition:$e.mentionTransition})),Ne=I3(ne),tt=$==="provider"&&Ne.length<=1?"model":$,xe=H3(ne);l.push({id:`evidence_${e}_${c++}`,query:C.query,provider:D?.provider??R,model:D?.model??null,location:D?.location??Y,citationState:Qe,answerMentioned:D?.answerMentioned,visibilityState:J,visibilityChangeLabel:Eb(fe,te,{positive:"visible",negative:"not visible",first:"first visibility"}),changeLabel:Eb(W,le),answerSnippet:D?.answerText??"",citedDomains:D?.citedDomains??[],evidenceUrls:[],competitorDomains:D?.competitorOverlap??[],recommendedCompetitors:D?.recommendedCompetitors??[],matchedTerms:D?.matchedTerms??[],relatedTechnicalSignals:[],groundingSources:D?.groundingSources??[],summary:P3(J,fe,C.query),runHistory:ne,historyScope:tt,modelsSeen:Ne,modelTransitions:xe})}}}}for(const m of r)d.has(m.query)||l.push({id:`evidence_${e}_${c++}`,query:m.query,provider:"",model:null,location:null,citationState:"pending",visibilityState:"pending",visibilityChangeLabel:"Awaiting first run",changeLabel:"Awaiting first run",answerSnippet:"",citedDomains:[],evidenceUrls:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],relatedTechnicalSignals:[],groundingSources:[],summary:`"${m.query}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:"query",modelsSeen:[],modelTransitions:[]});return l}function G3(e,n){const i=new Map,r=`${n}:`;for(const[l,c]of Object.entries(e.modelRuns??{})){if(!l.startsWith(r))continue;const d=l.slice(r.length),m=d==="unknown"?null:d;for(const g of c)i.set(g.runId,m)}return i}function I3(e){const n=new Set;for(const i of e)i.model&&n.add(i.model);return[...n]}function H3(e){const n=[];let i=null;for(const r of e){const l=r.model??null;l!==i&&i!==null&&n.push({runId:r.runId,createdAt:r.createdAt,fromModel:i,toModel:l}),i=l}return n}function Cb(e){if(e.length===0)return 0;const n=e[e.length-1].citationState;let i=0;for(let r=e.length-1;r>=0&&e[r].citationState===n;r--)i++;return i}function Tb(e){if(e.length===0)return 0;const n=e[e.length-1].visibilityState??"not-visible";let i=0;for(let r=e.length-1;r>=0&&(e[r].visibilityState??"not-visible")===n;r--)i++;return i}function Eb(e,n,i){const r={positive:i?.positive??"cited",negative:i?.negative??"not cited",first:i?.first??"first citation"};switch(e){case"new":return"First observation";case"cited":case"visible":return n<=1?`${Fr(r.positive)} in latest run`:`${Fr(r.positive)} for ${n} runs`;case"lost":return"Lost since last run";case"emerging":return Fr(r.first);case"not-cited":case"not-visible":return n<=1?`${Fr(r.negative)} in latest run`:`${Fr(r.negative)} across ${n} runs`;default:return e}}function Fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function P3(e,n,i){switch(n){case"lost":return`Mention was lost for "${i}". Your brand no longer appeared in the latest answer.`;case"emerging":return`Your brand started appearing in AI answers for "${i}".`}switch(e){case"visible":return`Your brand or domain is mentioned in AI answers for "${i}".`;case"pending":return`"${i}" has been added but no run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${i}".`}}function n1(e){const n=W0(e.project),i=V3(n.name,e.timeline,e.latestRunDetails,e.queries),l=[...e.runs].sort((c,d)=>d.createdAt.localeCompare(c.createdAt)).map(c=>pp(c,e.project.displayName||e.project.name));return e.overview?Z3(n,e.overview,i,l):K3(n,i,l)}function Z3(e,n,i,r){const l=B3(n.topInsights);for(const c of n.attentionItems)c.id.startsWith("insight_")||l.push({id:c.id,tone:c.tone,title:c.title,detail:c.detail,actionLabel:c.actionLabel,actionGroup:"investigate",affectedPhrases:[]});return{project:e,dateRangeLabel:n.dateRangeLabel,contextLabel:n.contextLabel,mentionSummary:n.scores.mention,visibilitySummary:n.scores.visibility,mentionShareSummary:n.scores.mentionShare,queryCounts:{cited:n.queryCounts.citedQueries,total:n.queryCounts.totalQueries},gapQueries:n.scores.gapQueries,mentionGaps:n.scores.mentionGaps,indexCoverage:n.scores.indexCoverage,providerScores:n.providerScores,competitorPressure:n.scores.competitorPressure,runStatus:n.scores.runStatus,movementSummary:n.movementSummary,insights:l,visibilityEvidence:i,competitors:n.competitors.map(c=>({id:c.id,domain:c.domain,citationCount:c.citationCount,totalQueries:c.totalQueries,pressureLabel:c.pressureLabel,citedQueries:c.citedQueries,movement:"",notes:""})),recentRuns:r.slice(0,5),suggestedQueries:n.suggestedQueries}}function K3(e,n,i){const r={label:"",value:"No data",delta:"Loading…",tone:"neutral",description:"",tooltip:"",trend:[]};return{project:e,dateRangeLabel:"All time",contextLabel:`${e.country} / ${e.language.toUpperCase()}`,mentionSummary:{...r,label:"Mention Coverage"},visibilitySummary:{...r,label:"Citation Coverage"},mentionShareSummary:{...r,label:"Mention Share",breakdown:{projectMentionSnapshots:0,competitorMentionSnapshots:0,perCompetitor:[],snapshotsWithAnswerText:0,snapshotsTotal:0}},queryCounts:{cited:0,total:0},gapQueries:{...r,label:"Citation Gaps"},mentionGaps:{...r,label:"Mention Gaps"},indexCoverage:{...r,label:"Index Coverage"},providerScores:[],competitorPressure:{...r,label:"Competitor Pressure"},runStatus:{...r,label:"Run Status"},movementSummary:{gained:0,lost:0,tone:"neutral",hasPreviousRun:!1},insights:[],visibilityEvidence:n,competitors:[],recentRuns:i.slice(0,5),suggestedQueries:{rows:[],totalCandidates:0,skippedAlreadyTracked:0}}}function Q3(e){const n=W0(e.project),i=[...e.runs].sort((j,_)=>_.createdAt.localeCompare(j.createdAt)),r=i.find(j=>j.kind===Te["answer-visibility"])??i[0],l=e.project.displayName||e.project.name,c=r?pp(r,l):Y3(e.project.id,l),d=e.overview;if(!d)return{project:n,visibilityScore:0,visibilityDelta:"No data",visibilityTone:"neutral",lastRun:c,insight:"No runs completed yet.",trend:[],competitorPressureLabel:"None"};const m=d.scores.visibility,g=m.progress??0,b=d.queryCounts.citedQueries,v=d.queryCounts.totalQueries,S=d.providers.length;return{project:n,visibilityScore:g,visibilityDelta:v>0?`${b} of ${v} queries`:"No data",visibilityTone:m.tone,providerCoverage:m.providerCoverage,lastRun:c,insight:v>0?`${b} of ${v} queries mentioned across ${S} provider${S===1?"":"s"}.`:"No runs completed yet.",trend:[],competitorPressureLabel:d.scores.competitorPressure.value}}function Y3(e,n){return{id:"none",projectId:e,projectName:n,kind:Te["answer-visibility"],kindLabel:"No runs yet",status:Ht.queued,trigger:Ms.manual,createdAt:"",startedAt:"",duration:"",statusDetail:"",summary:"No runs yet",triggerLabel:""}}function X3(e,n){const i=[],r=[],l=[];for(const d of e){r.push(n1(d)),l.push(Q3(d));const m=[...d.runs].sort((g,b)=>b.createdAt.localeCompare(g.createdAt));for(const g of m)i.push(pp(g,d.project.displayName||d.project.name))}i.sort((d,m)=>m.createdAt.localeCompare(d.createdAt));const c=e.length>0;return{portfolioOverview:{projects:l,attentionItems:c?J3(r):[{id:"attention_setup",tone:"neutral",title:"No projects yet",detail:"Create your first project using the setup wizard, CLI, or API.",actionLabel:"Open setup",href:"/setup"}],recentRuns:i.slice(0,5),systemHealth:[{id:"api",label:"API",tone:"positive",detail:"Connected",meta:"Real-time data"},{id:"provider",label:"Gemini",tone:"positive",detail:"Configured",meta:"Provider active"}],lastUpdatedAt:new Date().toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),...c?{}:{emptyState:{title:"No projects yet",detail:"Canonry becomes useful after one project, a small query set, and one competitor list are in place.",ctaLabel:"Launch setup",ctaHref:"/setup"}}},projects:r,runs:i,setup:{healthChecks:[{id:"api",label:"API reachable",detail:"API is responding.",state:"ready",guidance:"Required for project creation and run history."},{id:"provider",label:"Provider configured",detail:"Gemini key is configured.",state:"ready",guidance:"Required for answer-visibility sweeps."}],projectDraft:{name:"",canonicalDomain:"",country:"US",language:"en"},queryImportState:{mode:"paste",queryCount:0,preview:[]},competitorDraft:{domains:[],notes:"Use the CLI to add competitors."},launchState:{enabled:c,ctaLabel:c?"Trigger run":"Create a project first",summary:c?"Ready to run.":"Create a project first to launch a run."}},settings:{providerStatuses:(n?.providers??[]).map(d=>({name:d.name,displayName:d.displayName,keyUrl:d.keyUrl,modelHint:d.modelHint,model:d.model,defaultModel:d.defaultModel,state:d.configured?"ready":"needs-config",detail:d.configured?"Provider is configured.":"API key is missing.",quota:d.quota})),google:{state:n?.google?.configured?"ready":"needs-config",detail:n?.google?.configured?"Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.":"Google OAuth client ID and client secret are not configured yet."},bing:{state:n?.bing?.configured?"ready":"needs-config",detail:n?.bing?.configured?"Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.":"Bing Webmaster Tools API key is not configured yet."},selfHostNotes:["Configuration is stored in ~/.canonry/config.yaml.","The local config file is the source of truth for authentication credentials.","Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.","Database is SQLite at ~/.canonry/data.db.","API key was auto-generated during canonry init."],bootstrapNote:"Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config."}}}function J3(e){const n=[];for(const i of e){const r=i.visibilityEvidence.filter(c=>c.citationState==="lost");r.length>0&&n.push({id:`attention_${i.project.id}_lost`,tone:"negative",title:`${i.project.displayName||i.project.name} lost citations`,detail:`${r.length} quer${r.length>1?"ies":"y"} lost citation.`,actionLabel:"Open project",href:`/projects/${i.project.id}`});const l=i.recentRuns.filter(c=>c.status===Ht.running||c.status===Ht.queued);l.length>0&&n.push({id:`attention_${i.project.id}_active`,tone:"neutral",title:`${i.project.displayName||i.project.name} has active runs`,detail:`${l.length} run${l.length>1?"s":""} in progress.`,actionLabel:"View runs",href:"/runs"})}return n.length===0&&n.push({id:"attention_stable",tone:"positive",title:"All projects stable",detail:"No citation losses or active runs to flag.",actionLabel:"View portfolio",href:"/"}),n}const a1=q.createContext(null);a1.Provider;function uo(){return q.useContext(a1)}function xc(e){const i=uo()?.dashboard??null,r=un({...op({client:ae}),enabled:!i,refetchInterval:bk}),l=un({...cp({client:ae,query:{kind:"answer-visibility"}}),enabled:!i,staleTime:io,refetchInterval:C=>C.state.data?.some(R=>R.status==="running"||R.status==="queued")?3e3:io}),c=un({..._O({client:ae}),enabled:!i}),d=r.data??[],m=l.data??[],g=lw({queries:d.map(C=>{const k=m.filter(G=>G.projectId===C.id),T=k.filter(G=>(G.status==="completed"||G.status==="partial")&&G.kind==="answer-visibility"&&G.trigger!=="probe").sort((G,H)=>H.createdAt.localeCompare(G.createdAt)),R=T.length>0?T[0].id:"no-run";return{queryKey:["project-overview-slim",C.id,R],queryFn:async()=>{const G=await yv(C.name).catch(()=>null);return{project:C,runs:k,queries:[],competitors:[],timeline:[],latestRunDetails:[],previousRunDetails:[],gscCoverage:null,bingCoverage:null,dbInsights:null,overview:G}},enabled:!i&&r.isSuccess&&l.isSuccess,staleTime:gf}})}),b=g.every(C=>C.isSuccess),v=q.useMemo(()=>{if(i)return i;if(!r.data||!l.data||d.length>0&&!b)return null;const C=g.map(k=>k.data?{...k.data,runs:m.filter(T=>T.projectId===k.data.project.id)}:null).filter(k=>k!=null);return X3(C,c.data??null)},[i,r.data,l.data,c.data,b,g,d.length,m]),S=!i&&(r.isError||l.isError),j=!i&&!v&&!S,_=q.useCallback(async()=>{await Promise.all([r.refetch(),l.refetch(),c.refetch()])},[r.refetch,l.refetch,c.refetch]);return{dashboard:v,isLoading:j,isError:S,refetch:_}}function F3(e){const n=uo(),i=q.useMemo(()=>!n||!e?null:n.dashboard.projects.find(C=>C.project.name===e)??null,[n,e]),r=un({...NO({client:ae,path:{name:e??""}}),enabled:!!e&&!i,staleTime:gf,refetchOnWindowFocus:"always"}),l=un({...cp({client:ae,query:{kind:"answer-visibility"}}),enabled:!!e,staleTime:io,refetchOnWindowFocus:"always",refetchInterval:C=>C.state.data?.some(R=>R.projectId===r.data?.id&&(R.status==="running"||R.status==="queued"))?3e3:io}),c=r.data??null,d=q.useMemo(()=>c?(l.data??[]).filter(C=>C.projectId===c.id):[],[c,l.data]),{latestRunIds:m,previousRunIds:g,latestRunIdsKey:b}=q.useMemo(()=>{const C=d.filter(H=>(H.status==="completed"||H.status==="partial")&&H.kind==="answer-visibility"&&H.trigger!=="probe").sort((H,K)=>K.createdAt.localeCompare(H.createdAt)),k=C[0]?.createdAt??null,T=k?C.filter(H=>H.createdAt===k).map(H=>H.id):[],R=C.find(H=>H.createdAt!==k)?.createdAt??null,G=R?C.filter(H=>H.createdAt===R).map(H=>H.id):[];return{latestRunIds:T,previousRunIds:G,latestRunIdsKey:[...T].sort().join(",")}},[d]),v=un({queryKey:["project-dashboard-full",c?.id??null,b||"none"],queryFn:async()=>{if(!c||!e)return null;const[C,k,T,R,G,H,K,Y,X]=await Promise.all([GN(e).catch(()=>[]),IN(e).catch(()=>[]),HN(e).catch(()=>[]),m.length?Promise.all(m.map(D=>Fl(D).catch(()=>null))).then(D=>D.filter(M=>M!=null)):Promise.resolve([]),g.length?Promise.all(g.map(D=>Fl(D).catch(()=>null))).then(D=>D.filter(M=>M!=null)):Promise.resolve([]),ak(e).catch(()=>null),rk(e).catch(()=>null),lk(e).catch(()=>null),yv(e).catch(()=>null)]);return{project:c,runs:d,queries:C,competitors:k,timeline:T,latestRunDetails:R,previousRunDetails:G,gscCoverage:H,bingCoverage:K,dbInsights:Y,overview:X}},enabled:!!c&&!!e&&l.isSuccess,staleTime:gf,refetchOnWindowFocus:"always",refetchInterval:vk}),S=q.useMemo(()=>v.data?n1({...v.data,runs:d}):i||null,[v.data,d,i]),j=q.useCallback(async()=>{await Promise.all([r.refetch(),l.refetch(),v.refetch()])},[r.refetch,l.refetch,v.refetch]),_=!S&&(r.isLoading||l.isLoading||v.isLoading);return{commandCenter:S,project:c,isLoading:_,isError:r.isError||l.isError||v.isError,refetch:j}}const W3=["health"];async function eD(){const e=await uk("/health","API"),n=e.state==="ok"?{label:"Worker",state:"ok",detail:"In-process job runner"}:{label:"Worker",state:e.state,detail:`Depends on API health check · ${e.detail}`,statusCode:e.statusCode,hint:e.hint?`Worker status is inferred from API health in this deployment mode. ${e.hint}`:"Worker status is inferred from API health in this deployment mode."};return{apiStatus:e,workerStatus:n}}function mp(e,n){return un({queryKey:W3,queryFn:eD,enabled:e,refetchInterval:15e3,initialData:n})}function tD(e){return un({...z0({client:ae,path:{id:e??""}}),enabled:!!e,refetchInterval:n=>{const i=n.state.data?.status;return i==="running"||i==="queued"?3e3:!1}})}function hp(){const e=dc(),n=cw({strict:!1}),i=uw({select:g=>g.location.pathname}),r=n.runId??null,l=n.evidenceId??null;return{runId:r,evidenceId:l,openRun:g=>{e({to:i,from:en.to,search:b=>({...b,runId:g,evidenceId:void 0})})},openEvidence:g=>{e({to:i,from:en.to,search:b=>({...b,evidenceId:g,runId:void 0})})},closeDrawer:()=>{e({to:i,from:en.to,search:g=>({...g,runId:void 0,evidenceId:void 0})})}}}const nD={negative:"toast-card-negative",caution:"toast-card-caution",positive:"toast-card-positive",neutral:"toast-card-neutral"};function aD(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function iD(){const e=q.useSyncExternalStore(gk,My,My),n=dc(),{openRun:i}=hp(),r=q.useCallback(c=>{hf(c)},[]),l=q.useCallback(c=>{c.cta&&(c.cta.intent==="open-run-drawer"?i(c.cta.runId):n({to:"/runs"}),hf(c.id))},[n,i]);return e.length===0?null:f.jsx("div",{className:"toast-viewport","aria-label":"Notifications",children:e.map(c=>f.jsxs("section",{role:c.tone==="negative"?"alert":"status","aria-live":c.tone==="negative"?"assertive":"polite","data-state":c.state,className:`toast-card ${nD[c.tone]}`,children:[f.jsxs("div",{className:"toast-copy",children:[f.jsx("p",{className:"toast-title",children:c.title}),c.detail?f.jsx("p",{className:"toast-detail",children:c.detail}):null,c.cta?f.jsx("button",{type:"button",className:"toast-action",onClick:()=>l(c),"aria-label":aD(c),children:c.cta.label}):null]}),f.jsx("button",{type:"button",onClick:()=>r(c.id),className:"toast-dismiss","aria-label":"Dismiss",children:f.jsx(Ps,{className:"size-3.5"})})]},c.id))})}function sD(e,n={}){const{threshold:i=80}=n,r=q.useRef(null),l=q.useRef({scrollHeight:0,wasAtEnd:!0});function c(g){return g.scrollHeight-g.scrollTop-g.clientHeight}function d(){const g=r.current;return g?c(g)<=i:!0}function m(){const g=r.current;g&&(g.scrollTop=g.scrollHeight,l.current.wasAtEnd=!0,l.current.scrollHeight=g.scrollHeight)}return q.useEffect(()=>{const g=r.current;if(!g)return;const b=()=>{l.current.wasAtEnd=c(g)<=i};return g.addEventListener("scroll",b,{passive:!0}),()=>g.removeEventListener("scroll",b)},[i]),q.useLayoutEffect(()=>{const g=r.current;if(!g)return;const b=g.scrollHeight;b>l.current.scrollHeight&&l.current.wasAtEnd&&(g.scrollTop=b),l.current.scrollHeight=b},e),q.useEffect(()=>{const g=r.current;if(!g||typeof ResizeObserver>"u")return;const b=new ResizeObserver(()=>{const v=g.scrollHeight;v>l.current.scrollHeight&&l.current.wasAtEnd&&(g.scrollTop=v),l.current.scrollHeight=v});return b.observe(g),g.firstElementChild&&b.observe(g.firstElementChild),()=>b.disconnect()},[]),{ref:r,scrollToEnd:m,isAtEnd:d}}async function gp(e){try{return await e.json()}catch{return{}}}function rD(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath.replace(/\/$/,"")+"/api/v1":"/api/v1"}const yp=rD();function bp(e){(e===401||e===403)&&Bf()}async function Ob(e){const n=await fetch(`${yp}/projects/${encodeURIComponent(e)}/agent/transcript`,{credentials:"include"});if(!n.ok){bp(n.status);const i=await gp(n);throw new Hn(i.error?.message??`transcript fetch failed: ${n.status}`,n.status,i.error?.code)}return await n.json()}async function oD(e){const n=await fetch(`${yp}/projects/${encodeURIComponent(e)}/agent/transcript`,{method:"DELETE",credentials:"include"});if(!n.ok){bp(n.status);const i=await gp(n);throw new Hn(i.error?.message??`reset failed: ${n.status}`,n.status,i.error?.code)}}async function lD({project:e,prompt:n,provider:i,modelId:r,scope:l,signal:c,onEvent:d}){const m={prompt:n};i&&(m.provider=i),r&&(m.modelId=r),l&&(m.scope=l);const g=await fetch(`${yp}/projects/${encodeURIComponent(e)}/agent/prompt`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(m),signal:c});if(!g.ok||!g.body){bp(g.status);const _=await gp(g);throw new Hn(_.error?.message??`prompt failed: ${g.status}`,g.status,_.error?.code)}const b=g.body.getReader(),v=new TextDecoder;let S="";const j=()=>{b.cancel().catch(()=>{})};c?.addEventListener("abort",j,{once:!0});try{for(;;){const{value:_,done:C}=await b.read();if(C)break;S+=v.decode(_,{stream:!0});let k=S.indexOf(`
|
|
58
|
+
`),ue=[];let ne=[],Ne=0;const tt=()=>{if(ne.length===0)return;const xe=ne.join(" ").trim();xe&&ue.push(f.jsx("p",{className:ue.length>0?"mt-2.5":"",children:Ab(xe,me)},Ne++)),ne=[]};for(const xe of te){const $e=xe.trim();if(/^[-\u2013\u2014]{3,}$/.test($e)){tt(),ue.push(f.jsx("hr",{className:"border-zinc-800/60 my-3"},Ne++));continue}const Pe=$e.match(/^(#{1,3})\s+(\S.*)$/);if(Pe){tt();const Ct=Pe[1].length,Cn=Pe[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s]+/u,"").trim()||Pe[2],Tt=Ct===1?"text-[13px] font-semibold text-zinc-100 mt-4 mb-1":Ct===2?"text-xs font-semibold text-zinc-200 mt-3 mb-0.5":"text-xs font-medium text-zinc-300 mt-2";ue.push(f.jsx("p",{className:Tt,children:Ab(Cn,me)},Ne++));continue}if($e===""){tt();continue}ne.push($e)}return tt(),ue};return f.jsx(nv,{open:!0,onOpenChange:te=>{te||i()},children:f.jsxs(Wb,{children:[f.jsx(Df,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"}),f.jsxs(Rf,{className:"evidence-modal","aria-describedby":void 0,children:[f.jsxs("div",{className:"evidence-modal-header",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("p",{className:"eyebrow eyebrow-soft",children:[n.project.name," ","·"," ",D.provider||"All providers"]}),f.jsx(Mf,{className:"text-lg font-semibold text-zinc-50 truncate",children:e.query})]}),f.jsxs(ev,{className:"inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-800 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 shrink-0",children:[f.jsx(Ps,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]}),G&&f.jsxs("div",{className:"evidence-modal-timeline",children:[f.jsx("p",{className:"drawer-section-label mb-1.5",children:"Run history"}),f.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1",children:R.map((te,ue)=>{const ne=m===-1&&ue===R.length-1||m===ue,Ne=te.visibilityState??(te.answerMentioned?"visible":"not-visible"),tt=te.visibilityTransition??Ne,xe=Ne==="visible"?"bg-emerald-400":tt==="emerging"?"bg-amber-400":tt==="lost"?"bg-rose-400":"bg-zinc-600",Pe=new Date(te.createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),Ct=!!(te.model&&ue>0&&R[ue-1]?.model&&R[ue-1].model!==te.model);return f.jsxs("button",{type:"button",className:`evidence-run-dot ${ne?"evidence-run-dot--selected":""}`,onClick:()=>{fe(ue===R.length-1?-1:ue)},"aria-label":[`Run ${Pe}: ${Ne}`,te.model?`model ${te.model}`:null,Ct?"model changed":null].filter(Boolean).join(" — "),"aria-pressed":ne,children:[f.jsx("span",{className:`size-2 rounded-full ${xe} ${Ct?"ring-1 ring-amber-300/80 ring-offset-2 ring-offset-zinc-950":""}`,"aria-hidden":"true"}),f.jsx("span",{className:"text-[10px] text-zinc-500",children:Pe})]},ue)})}),m>=0&&m<R.length&&f.jsxs("p",{className:"text-[11px] text-zinc-500 mt-1",children:["Viewing run from ",new Date(R[m].createdAt).toLocaleString()," ","—"," ",f.jsx("span",{className:"capitalize",children:R[m].visibilityState??(R[m].answerMentioned?"visible":"not-visible")}),f.jsxs("button",{type:"button",className:"text-zinc-400 hover:text-zinc-200 ml-2",onClick:()=>{fe(-1)},children:["←"," Back to latest"]})]}),!X&&(e.modelTransitions?.length??0)>0&&f.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.modelTransitions.map(te=>f.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-1 text-[10px] text-amber-100",children:`${te.fromModel??"unknown"} -> ${te.toModel??"unknown"} on ${new Date(te.createdAt).toLocaleDateString()}`},`${te.runId}:${te.toModel??"unknown"}`))})]}),f.jsxs("div",{className:"evidence-modal-body",children:[S&&f.jsxs("div",{className:"md:col-span-2 flex items-center justify-center py-12 text-zinc-500 text-sm",children:["Loading historical run data","…"]}),!S&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"evidence-modal-main",children:[f.jsxs("div",{className:`evidence-position-hero evidence-position-hero--${$}`,children:[f.jsx("p",{className:`evidence-position-label evidence-position-label--${$}`,children:J.label}),f.jsx("p",{className:`evidence-position-title evidence-position-title--${$}`,children:J.title}),f.jsx("p",{className:"evidence-position-meta",children:J.meta}),Qe&&f.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:Qe})]}),D.answerSnippet&&f.jsxs("div",{children:[f.jsx("p",{className:"drawer-section-label",children:"What the AI said"}),f.jsx("div",{className:`answer-snippet-block ${r?"evidence-answer-expanded":"evidence-answer-collapsed"}`,children:le()}),D.answerSnippet.length>280&&f.jsx("button",{type:"button",className:"mt-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",onClick:()=>l(!r),children:r?"↑ Collapse":"↓ Show full answer"})]}),!D.answerSnippet&&!S&&f.jsx("div",{className:"rounded-lg border border-zinc-800/40 bg-zinc-900/20 px-4 py-8 text-center text-zinc-600 text-sm",children:"No answer text recorded for this run"}),!X&&e.relatedTechnicalSignals.length>0&&f.jsxs("div",{children:[f.jsx("p",{className:"drawer-section-label",children:oe?"Why you're visible":"What to fix"}),f.jsx("div",{className:"action-items-list",children:e.relatedTechnicalSignals.map((te,ue)=>f.jsxs("div",{className:"action-item",children:[f.jsx("svg",{className:`action-item-icon ${oe?"text-emerald-400":"text-amber-400"}`,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:oe?f.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),f.jsx("path",{d:"M8 5v3.5M8 10.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),f.jsx("span",{className:"action-item-text",children:te})]},ue))})]}),D.summary&&f.jsx("p",{className:"text-xs text-zinc-600 border-t border-zinc-800/40 pt-3 mt-1",children:D.summary})]}),f.jsxs("div",{className:"evidence-modal-sidebar",children:[(ke||_e)&&f.jsxs("div",{className:"sidebar-tabs",children:[f.jsx("button",{className:`sidebar-tab ${c==="mentions"?"sidebar-tab--active":""}`,onClick:()=>d("mentions"),type:"button",title:"Canonry's answer-level visibility assessment and any company names extracted from the answer text.",children:"Mentions"}),f.jsx("button",{className:`sidebar-tab ${c==="sources"?"sidebar-tab--active":""}`,onClick:()=>d("sources"),type:"button",title:"Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.",children:"Sources"})]}),c==="mentions"&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsx("span",{children:"Mention in answer"}),f.jsx($l,{text:"Canonry scans the AI answer for your owned domains and project name. This is independent from grounding or citation sources."})]}),f.jsxs("div",{className:`mention-status mention-status--${oe?"mentioned":"not-mentioned"}`,children:[f.jsx("span",{className:"mention-status-icon",children:M?"…":oe?"✓":"—"}),f.jsx("span",{className:"mention-status-label",children:M?"Pending":oe?"Mentioned":"Not mentioned"})]}),D.matchedTerms.length>0&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Matched in answer"}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:D.matchedTerms.map(te=>f.jsx("span",{className:"mention-chip mention-chip--brand",children:te},te))})]}),!M&&!oe&&D.matchedTerms.length===0&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Searched for"}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:et.map(te=>f.jsx("span",{className:"mention-chip mention-chip--muted",children:te},te))}),f.jsx("p",{className:"text-[11px] text-zinc-600 mt-1.5",children:"None of these appear in the answer text."})]})]}),(D.recommendedCompetitors.length>0||D.competitorDomains.length>0)&&f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsx("span",{children:"Competitors in answer"}),f.jsx($l,{text:"Competitors detected in the answer text or cited source links. Includes both tracked competitors and names extracted by Canonry."})]}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{const te=D.competitorDomains.map(Ne=>Ne.replace(/^www\./,"")),ue=new Set(te.map(Ne=>oc(Ne.replace(/\.[^.]+$/,""))));return[...D.recommendedCompetitors.filter(Ne=>!ue.has(oc(Ne))),...te].map(Ne=>f.jsx("span",{className:"mention-chip mention-chip--competitor",children:Ne},Ne))})()})]})]}),c==="sources"&&f.jsxs(f.Fragment,{children:[D.citedDomains.length>0&&f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsx("span",{children:"Domains from source links"}),f.jsx($l,{text:"These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them."})]}),f.jsx("div",{className:"citation-leaderboard",children:D.citedDomains.map((te,ue)=>{const ne=te.toLowerCase().replace(/^www\./,""),Ne=T.has(ne),tt=!Ne&&D.competitorDomains.some($e=>$e.toLowerCase().replace(/^www\./,"")===ne),xe=Ne?"you":tt?"competitor":"other";return f.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${xe}`,children:[f.jsxs("span",{className:"citation-leaderboard-rank",children:["#",ue+1]}),f.jsx("span",{className:"citation-leaderboard-domain",children:te}),Ne&&f.jsx("span",{className:"citation-leaderboard-tag",children:"You"}),tt&&f.jsx("span",{className:"citation-leaderboard-tag",children:"Competitor"})]},te)})})]}),D.groundingSources.length>0&&f.jsxs("div",{children:[f.jsxs("div",{className:"drawer-section-label flex items-center",children:[f.jsxs("span",{children:["Grounding source links (",D.groundingSources.length,")"]}),f.jsx($l,{text:"Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility."})]}),f.jsx("ul",{className:"grid gap-0.5",children:D.groundingSources.map((te,ue)=>{const ne=_b(te.uri),Ne=te.title||te.uri;return f.jsx("li",{className:"truncate text-sm",children:ne?f.jsx("a",{href:ne,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:Ne}):f.jsx("span",{className:"text-zinc-400",children:Ne})},ue)})})]}),D.evidenceUrls.length>0&&f.jsxs("div",{children:[f.jsx("p",{className:"drawer-section-label",children:"Evidence URLs"}),f.jsx("ul",{className:"grid gap-1",children:D.evidenceUrls.map(te=>{const ue=_b(te);return f.jsx("li",{className:"truncate text-sm",children:ue?f.jsx("a",{href:ue,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:te}):f.jsx("span",{className:"text-zinc-400",children:te})},te)})})]}),D.citedDomains.length===0&&D.groundingSources.length===0&&D.evidenceUrls.length===0&&f.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No source data ",X?"for this run":"yet"]})]}),!ke&&!_e&&f.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No answer visibility data ",X?"for this run":"yet"]})]})]})]})]})]})})}function Bn(e){const n=new Date("2026-02-20");return e.map((i,r)=>({runId:`run_mock_${r+1}`,citationState:i,createdAt:new Date(n.getTime()+r*2*24*60*60*1e3).toISOString()}))}const sf=[{id:"project_citypoint",name:"Citypoint Dental NYC",canonicalDomain:"citypointdental.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["local intent","priority"],labels:{},providers:[],locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_harbor",name:"Harbor Legal Group",canonicalDomain:"harborlegal.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["lead gen"],labels:{},providers:[],locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_northstar",name:"Northstar Orthopedics",canonicalDomain:"northstarortho.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["multi-location"],labels:{},providers:[],locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1}];function Sc(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??"manual",createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel}}const j3=Sc({id:"run_citypoint_visibility_20260308",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T12:15:00.000Z",startedAt:"Mar 8, 12:15 PM",duration:"6m 12s",statusDetail:"18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.",summary:"Citation losses on emergency-intent prompts",triggerLabel:"Scheduled"}),N3=Sc({id:"run_citypoint_queued_20260309",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"queued",createdAt:"2026-03-09T08:05:00.000Z",startedAt:"Mar 9, 8:05 AM",duration:"Waiting for slot",statusDetail:"Ready to enqueue after the next provider rate window clears.",summary:"Queued follow-up after local ranking movement",triggerLabel:"Manual"}),k3=Sc({id:"run_harbor_visibility_20260308",projectId:"project_harbor",projectName:"Harbor Legal Group",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T11:05:00.000Z",startedAt:"Mar 8, 11:05 AM",duration:"5m 07s",statusDetail:"12 tracked queries checked; local-intent visibility held steady across branded prompts.",summary:"Branded prompts remain stable",triggerLabel:"Scheduled"}),A3=Sc({id:"run_northstar_visibility_20260308",projectId:"project_northstar",projectName:"Northstar Orthopedics",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"running",createdAt:"2026-03-08T13:40:00.000Z",startedAt:"Mar 8, 1:40 PM",duration:"3m 10s",statusDetail:"Provider responses still in flight for 9 multi-location prompts.",summary:"Mid-run on treatment-location prompts",triggerLabel:"Manual"}),_3=[{id:"evidence_citypoint_emergency_gemini",query:"emergency dentist brooklyn",provider:"gemini",model:"gemini-2.5-flash",location:null,citationState:"lost",changeLabel:"Lost since Mar 5",answerSnippet:"For urgent dental care in Brooklyn, Downtown Smiles and Harbor Dental are now cited first for emergency availability and same-day booking.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:["https://downtownsmiles.com/emergency-dentist-brooklyn","https://harbordental.com/same-day-emergency-care"],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing on the emergency service page","llms.txt not found during latest site audit","Location pages link weakly into the emergency care hub"],summary:"AI answers now cite two competitors while your emergency page is no longer grounded.",runHistory:Bn(["cited","cited","cited","cited","cited","cited","cited","not-cited","not-cited"])},{id:"evidence_citypoint_emergency_openai",query:"emergency dentist brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"Cited for 6 runs",answerSnippet:"Citypoint Dental is listed as a top emergency dentist in Brooklyn for same-day appointments and walk-in availability.",citedDomains:["citypointdental.com","downtownsmiles.com"],evidenceUrls:["https://citypointdental.com/emergency-dentist-brooklyn"],competitorDomains:["downtownsmiles.com"],groundingSources:[],relatedTechnicalSignals:["Emergency page indexed with structured data"],summary:"OpenAI cites your emergency page consistently alongside one competitor.",runHistory:Bn(["not-cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_emergency_claude",query:"emergency dentist brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"Based on the search results, top-rated emergency dental practices in Brooklyn include Downtown Smiles and Harbor Dental.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:[],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing","llms.txt not found"],summary:"Claude does not cite your domain for this emergency query.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_invisalign_openai",query:"best invisalign dentist downtown brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"emerging",changeLabel:"First citation in 7 days",answerSnippet:"Citypoint Dental appears as an emerging recommendation for Invisalign in Downtown Brooklyn, supported by recent before-and-after case pages.",citedDomains:["citypointdental.com","clearlineortho.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn","https://citypointdental.com/case-studies/invisalign-open-bite"],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["Structured data now present on two case-study pages","Internal links from service pages to case studies improved crawl depth"],summary:"Fresh case-study content is starting to earn citations on Invisalign prompts.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","cited"])},{id:"evidence_citypoint_invisalign_gemini",query:"best invisalign dentist downtown brooklyn",provider:"gemini",model:"gemini-2.5-flash",location:null,citationState:"cited",changeLabel:"Cited for 8 runs",answerSnippet:"Citypoint Dental in Downtown Brooklyn is highlighted for its Invisalign expertise and patient outcomes.",citedDomains:["citypointdental.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn"],competitorDomains:[],groundingSources:[],relatedTechnicalSignals:["Case study pages well-indexed"],summary:"Gemini consistently cites your Invisalign page with no competitor overlap.",runHistory:Bn(["cited","cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_invisalign_claude",query:"best invisalign dentist downtown brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For Invisalign in Downtown Brooklyn, Clear Line Ortho and Brooklyn Smiles are frequently recommended for their experienced orthodontists.",citedDomains:["clearlineortho.com","brooklynsmiles.com"],evidenceUrls:[],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["No before/after schema on case study pages"],summary:"Claude does not surface your Invisalign content despite strong page quality.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_claude",query:"pediatric dentist brooklyn heights",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 4 runs",answerSnippet:"Answers cite neighborhood-specific pediatric practices with stronger family-focused FAQ content and clearer insurance details.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:["https://brightkidsdental.com/pediatric-dentist-brooklyn-heights","https://parkpediatricdental.com/insurance"],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric service page exists for Brooklyn Heights","Insurance content is buried three clicks deep"],summary:"Coverage gap is content-driven, not purely technical.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_gemini",query:"pediatric dentist brooklyn heights",provider:"gemini",model:"gemini-2.5-flash",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For pediatric dentistry in Brooklyn Heights, Bright Kids Dental and Park Pediatric Dental are cited for family-friendly care.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:[],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric page for Brooklyn Heights"],summary:"Gemini does not surface your domain for pediatric queries in this area.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_openai",query:"pediatric dentist brooklyn heights",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"First citation this month",answerSnippet:"Citypoint Dental is mentioned as offering pediatric services in Brooklyn, though specialized pediatric-only practices are also highlighted.",citedDomains:["citypointdental.com","brightkidsdental.com"],evidenceUrls:["https://citypointdental.com/family-dentistry"],competitorDomains:["brightkidsdental.com"],groundingSources:[],relatedTechnicalSignals:["Family dentistry page recently updated"],summary:"OpenAI recently started citing your family dentistry page for this query.",runHistory:Bn(["not-cited","not-cited","not-cited","not-cited","not-cited","cited"])}];sf[0],sf[1],Bn(["cited","cited","cited","cited","cited"]),sf[2],2/7,3/7,Bn(["not-cited","not-cited","not-cited","cited"]);function z3(e,n){return e.runs.find(i=>i.id===n)}function C3(e,n){for(const i of e.projects){const r=i.visibilityEvidence.find(l=>l.id===n);if(r)return{project:i,evidence:r}}}function T3(e,n,i){if(e){const r=e.visibilityEvidence.find(l=>l.id===i);if(r)return{project:e,evidence:r}}if(n)return C3(n,i)}const E3={regression:"negative",gain:"positive",opportunity:"caution","first-citation":"positive","provider-pickup":"positive","persistent-gap":"caution","competitor-gained":"negative","competitor-lost":"neutral","gbp-lodging-gap":"negative","gbp-cta-gap":"caution","gbp-metric-drop":"negative","gbp-keyword-drop":"negative"},O3={opportunity:"write","persistent-gap":"write","competitor-gained":"write","competitor-lost":"write",regression:"investigate",gain:"monitor","first-citation":"monitor","provider-pickup":"monitor","gbp-lodging-gap":"write","gbp-cta-gap":"write","gbp-metric-drop":"investigate","gbp-keyword-drop":"investigate"},D3={regression:"lost",gain:"emerging",opportunity:"not-cited","first-citation":"emerging","provider-pickup":"emerging","persistent-gap":"not-cited","competitor-gained":"cited","competitor-lost":"not-cited","gbp-lodging-gap":"not-cited","gbp-cta-gap":"not-cited","gbp-metric-drop":"lost","gbp-keyword-drop":"lost"},R3={regression:"Regression",gain:"Gain",opportunity:"Opportunity","first-citation":"First citation","provider-pickup":"Pickup","persistent-gap":"Gap","competitor-gained":"Competitor","competitor-lost":"Competitor","gbp-lodging-gap":"Lodging gap","gbp-cta-gap":"Booking CTA","gbp-metric-drop":"Metric drop","gbp-keyword-drop":"Keyword drop"};function M3(e){return{id:e.id,tone:E3[e.type],title:e.title,detail:e.cause?.details??e.cause?.cause??"",actionLabel:e.recommendation?.action??R3[e.type],actionGroup:O3[e.type],affectedPhrases:[{query:e.query,evidenceId:"",provider:e.provider,citationState:D3[e.type]}]}}function B3(e){return e.filter(n=>!n.dismissed).map(M3)}function W0(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],aliases:e.aliases??[],country:e.country,language:e.language,tags:e.tags,labels:e.labels,providers:e.providers??[],locations:e.locations??[],defaultLocation:e.defaultLocation??null,autoExtractBacklinks:e.autoExtractBacklinks??!1,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function zb(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return e}}function L3(e,n){if(!e)return"Waiting";if(!n)return"Running";const i=new Date(n).getTime()-new Date(e).getTime();if(i<1e3)return"<1s";const r=Math.floor(i/1e3);if(r<60)return`${r}s`;const l=Math.floor(r/60),c=r%60;return`${l}m ${c}s`}function e1(e){switch(e){case Te["answer-visibility"]:return"Answer visibility sweep";case Te["gsc-sync"]:return"GSC sync";case Te["inspect-sitemap"]:return"Sitemap inspection";case Te["ga-sync"]:return"GA sync";case Te["traffic-sync"]:return"Traffic sync";case Te["bing-inspect"]:return"Bing URL inspection";case Te["bing-inspect-sitemap"]:return"Bing sitemap inspection";case Te["site-audit"]:return"Site audit";case Te["backlink-extract"]:return"Backlink extract";case Te["aeo-discover-seed"]:return"Discovery (seed phase)";case Te["aeo-discover-probe"]:return"Discovery (probe phase)";case Te["gbp-sync"]:return"Business Profile sync"}}function q3(e){return e===Ms.manual?"Manual":e===Ms.scheduled?"Scheduled":e===Ms["config-apply"]?"Config apply":e}function pp(e,n){return{id:e.id,projectId:e.projectId,projectName:n,kind:e.kind,kindLabel:e1(e.kind),status:e.status,trigger:e.trigger??"manual",location:e.location??null,createdAt:e.createdAt,startedAt:e.startedAt?zb(e.startedAt):zb(e.createdAt),duration:L3(e.startedAt??null,e.finishedAt??null),statusDetail:e.error?t1(e.error):U3(e),summary:$3(e),triggerLabel:q3(e.trigger)}}function t1(e){const n=Yf(e);return n.length>200?n.slice(0,200)+"…":n}function U3(e){switch(e.status){case Ht.queued:return"Waiting for execution slot.";case Ht.running:return"Provider queries in progress.";case Ht.completed:return"All queries checked.";case Ht.partial:return"Run completed with some queries skipped.";case Ht.failed:return e.error?t1(e.error):"Run failed.";case Ht.cancelled:return"Run was cancelled.";default:return""}}function $3(e){const n=e1(e.kind);switch(e.status){case Ht.queued:return`${n} queued`;case Ht.running:return`${n} in progress`;case Ht.completed:return`${n} completed`;case Ht.partial:return`${n} partially completed`;case Ht.failed:return`${n} failed`;case Ht.cancelled:return`${n} cancelled`;default:return e.status}}function V3(e,n,i,r){const l=[];let c=0;const d=new Set;if(i.length>0){const m=i.flatMap(C=>C.snapshots??[]),g=new Map;for(const C of m)if(C.query){const k=`${C.query}::${C.provider}::${C.location??""}`;g.set(k,C)}const b=new Set(m.map(C=>C.location??null));b.size===0&&b.add(null);const v=new Set(m.map(C=>C.provider)),S=new Set(n.flatMap(C=>Object.keys(C.providerRuns??{}))),j=[...new Set([...v,...S])].sort(),_=j.length>0?j:["gemini"];for(const C of n){if(C.runs.length===0)continue;d.add(C.query);const k=C.runs.at(-1),T=k?.transition??"not-cited";for(const R of _){const G=[...b].filter(Y=>g.has(`${C.query}::${R}::${Y??""}`)),H=(C.providerRuns?.[R]?.length??0)>0,K=G.length>0?G:H?[null]:[];for(const Y of K){const X=Y??"",D=g.get(`${C.query}::${R}::${X}`),M=D?.model??null,oe=M?`${R}:${M}`:null,ke=C.providerRuns?.[R],_e=oe?C.modelRuns?.[oe]:void 0,ve=$e=>$e?.filter(Pe=>(Pe.location??null)===Y),et=G.length>0?ve(ke):ke,re=G.length>0?ve(_e):_e,me=(et?.length?et:null)??(re?.length?re:null),$=et?.length?"provider":re?.length?"model":"query",W=me?me.at(-1).transition:T,fe=me?me.at(-1).visibilityTransition??(me.at(-1).visibilityState==="visible"?"visible":"not-visible"):k?.visibilityTransition??(k?.visibilityState==="visible"?"visible":"not-visible"),je=me?.at(-1)?.citationState,ie=me?.at(-1)?.visibilityState,Qe=D?W==="lost"?"lost":W==="emerging"?"emerging":D.citationState===ic.cited?"cited":"not-cited":je===ic.cited?"cited":"not-cited",J=D?.visibilityState??(ie==="visible"?"visible":ie==="pending"?"pending":"not-visible"),le=Cb(me||C.runs),te=Tb(me||C.runs),ue=G3(C,R),ne=(me??C.runs).map($e=>({runId:$e.runId,citationState:$e.citationState,createdAt:$e.createdAt,model:ue.get($e.runId)??null,answerMentioned:$e.answerMentioned,visibilityState:$e.visibilityState,visibilityTransition:$e.visibilityTransition,mentionState:$e.mentionState,mentionTransition:$e.mentionTransition})),Ne=I3(ne),tt=$==="provider"&&Ne.length<=1?"model":$,xe=H3(ne);l.push({id:`evidence_${e}_${c++}`,query:C.query,provider:D?.provider??R,model:D?.model??null,location:D?.location??Y,citationState:Qe,answerMentioned:D?.answerMentioned,visibilityState:J,visibilityChangeLabel:Eb(fe,te,{positive:"visible",negative:"not visible",first:"first visibility"}),changeLabel:Eb(W,le),answerSnippet:D?.answerText??"",citedDomains:D?.citedDomains??[],evidenceUrls:[],competitorDomains:D?.competitorOverlap??[],recommendedCompetitors:D?.recommendedCompetitors??[],matchedTerms:D?.matchedTerms??[],relatedTechnicalSignals:[],groundingSources:D?.groundingSources??[],summary:P3(J,fe,C.query),runHistory:ne,historyScope:tt,modelsSeen:Ne,modelTransitions:xe})}}}}for(const m of r)d.has(m.query)||l.push({id:`evidence_${e}_${c++}`,query:m.query,provider:"",model:null,location:null,citationState:"pending",visibilityState:"pending",visibilityChangeLabel:"Awaiting first run",changeLabel:"Awaiting first run",answerSnippet:"",citedDomains:[],evidenceUrls:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],relatedTechnicalSignals:[],groundingSources:[],summary:`"${m.query}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:"query",modelsSeen:[],modelTransitions:[]});return l}function G3(e,n){const i=new Map,r=`${n}:`;for(const[l,c]of Object.entries(e.modelRuns??{})){if(!l.startsWith(r))continue;const d=l.slice(r.length),m=d==="unknown"?null:d;for(const g of c)i.set(g.runId,m)}return i}function I3(e){const n=new Set;for(const i of e)i.model&&n.add(i.model);return[...n]}function H3(e){const n=[];let i=null;for(const r of e){const l=r.model??null;l!==i&&i!==null&&n.push({runId:r.runId,createdAt:r.createdAt,fromModel:i,toModel:l}),i=l}return n}function Cb(e){if(e.length===0)return 0;const n=e[e.length-1].citationState;let i=0;for(let r=e.length-1;r>=0&&e[r].citationState===n;r--)i++;return i}function Tb(e){if(e.length===0)return 0;const n=e[e.length-1].visibilityState??"not-visible";let i=0;for(let r=e.length-1;r>=0&&(e[r].visibilityState??"not-visible")===n;r--)i++;return i}function Eb(e,n,i){const r={positive:i?.positive??"cited",negative:i?.negative??"not cited",first:i?.first??"first citation"};switch(e){case"new":return"First observation";case"cited":case"visible":return n<=1?`${Fr(r.positive)} in latest run`:`${Fr(r.positive)} for ${n} runs`;case"lost":return"Lost since last run";case"emerging":return Fr(r.first);case"not-cited":case"not-visible":return n<=1?`${Fr(r.negative)} in latest run`:`${Fr(r.negative)} across ${n} runs`;default:return e}}function Fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function P3(e,n,i){switch(n){case"lost":return`Mention was lost for "${i}". Your brand no longer appeared in the latest answer.`;case"emerging":return`Your brand started appearing in AI answers for "${i}".`}switch(e){case"visible":return`Your brand or domain is mentioned in AI answers for "${i}".`;case"pending":return`"${i}" has been added but no run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${i}".`}}function n1(e){const n=W0(e.project),i=V3(n.name,e.timeline,e.latestRunDetails,e.queries),l=[...e.runs].sort((c,d)=>d.createdAt.localeCompare(c.createdAt)).map(c=>pp(c,e.project.displayName||e.project.name));return e.overview?Z3(n,e.overview,i,l):K3(n,i,l)}function Z3(e,n,i,r){const l=B3(n.topInsights);for(const c of n.attentionItems)c.id.startsWith("insight_")||l.push({id:c.id,tone:c.tone,title:c.title,detail:c.detail,actionLabel:c.actionLabel,actionGroup:"investigate",affectedPhrases:[]});return{project:e,dateRangeLabel:n.dateRangeLabel,contextLabel:n.contextLabel,mentionSummary:n.scores.mention,visibilitySummary:n.scores.visibility,mentionShareSummary:n.scores.mentionShare,queryCounts:{cited:n.queryCounts.citedQueries,total:n.queryCounts.totalQueries},gapQueries:n.scores.gapQueries,mentionGaps:n.scores.mentionGaps,indexCoverage:n.scores.indexCoverage,providerScores:n.providerScores,competitorPressure:n.scores.competitorPressure,runStatus:n.scores.runStatus,movementSummary:n.movementSummary,insights:l,visibilityEvidence:i,competitors:n.competitors.map(c=>({id:c.id,domain:c.domain,citationCount:c.citationCount,totalQueries:c.totalQueries,pressureLabel:c.pressureLabel,citedQueries:c.citedQueries,movement:"",notes:""})),recentRuns:r.slice(0,5),suggestedQueries:n.suggestedQueries}}function K3(e,n,i){const r={label:"",value:"No data",delta:"Loading…",tone:"neutral",description:"",tooltip:"",trend:[]};return{project:e,dateRangeLabel:"All time",contextLabel:`${e.country} / ${e.language.toUpperCase()}`,mentionSummary:{...r,label:"Mention Coverage"},visibilitySummary:{...r,label:"Citation Coverage"},mentionShareSummary:{...r,label:"Mention Share",breakdown:{projectMentionSnapshots:0,competitorMentionSnapshots:0,perCompetitor:[],snapshotsWithAnswerText:0,snapshotsTotal:0}},queryCounts:{cited:0,total:0},gapQueries:{...r,label:"Citation Gaps"},mentionGaps:{...r,label:"Mention Gaps"},indexCoverage:{...r,label:"Index Coverage"},providerScores:[],competitorPressure:{...r,label:"Competitor Pressure"},runStatus:{...r,label:"Run Status"},movementSummary:{gained:0,lost:0,tone:"neutral",hasPreviousRun:!1},insights:[],visibilityEvidence:n,competitors:[],recentRuns:i.slice(0,5),suggestedQueries:{rows:[],totalCandidates:0,skippedAlreadyTracked:0}}}function Q3(e){const n=W0(e.project),i=[...e.runs].sort((j,_)=>_.createdAt.localeCompare(j.createdAt)),r=i.find(j=>j.kind===Te["answer-visibility"])??i[0],l=e.project.displayName||e.project.name,c=r?pp(r,l):Y3(e.project.id,l),d=e.overview;if(!d)return{project:n,visibilityScore:0,visibilityDelta:"No data",visibilityTone:"neutral",lastRun:c,insight:"No runs completed yet.",trend:[],competitorPressureLabel:"None"};const m=d.scores.visibility,g=m.progress??0,b=d.queryCounts.citedQueries,v=d.queryCounts.totalQueries,S=d.providers.length;return{project:n,visibilityScore:g,visibilityDelta:v>0?`${b} of ${v} queries`:"No data",visibilityTone:m.tone,providerCoverage:m.providerCoverage,lastRun:c,insight:v>0?`${b} of ${v} queries mentioned across ${S} provider${S===1?"":"s"}.`:"No runs completed yet.",trend:[],competitorPressureLabel:d.scores.competitorPressure.value}}function Y3(e,n){return{id:"none",projectId:e,projectName:n,kind:Te["answer-visibility"],kindLabel:"No runs yet",status:Ht.queued,trigger:Ms.manual,createdAt:"",startedAt:"",duration:"",statusDetail:"",summary:"No runs yet",triggerLabel:""}}function X3(e,n){const i=[],r=[],l=[];for(const d of e){r.push(n1(d)),l.push(Q3(d));const m=[...d.runs].sort((g,b)=>b.createdAt.localeCompare(g.createdAt));for(const g of m)i.push(pp(g,d.project.displayName||d.project.name))}i.sort((d,m)=>m.createdAt.localeCompare(d.createdAt));const c=e.length>0;return{portfolioOverview:{projects:l,attentionItems:c?J3(r):[{id:"attention_setup",tone:"neutral",title:"No projects yet",detail:"Create your first project using the setup wizard, CLI, or API.",actionLabel:"Open setup",href:"/setup"}],recentRuns:i.slice(0,5),systemHealth:[{id:"api",label:"API",tone:"positive",detail:"Connected",meta:"Real-time data"},{id:"provider",label:"Gemini",tone:"positive",detail:"Configured",meta:"Provider active"}],lastUpdatedAt:new Date().toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),...c?{}:{emptyState:{title:"No projects yet",detail:"Canonry becomes useful after one project, a small query set, and one competitor list are in place.",ctaLabel:"Launch setup",ctaHref:"/setup"}}},projects:r,runs:i,setup:{healthChecks:[{id:"api",label:"API reachable",detail:"API is responding.",state:"ready",guidance:"Required for project creation and run history."},{id:"provider",label:"Provider configured",detail:"Gemini key is configured.",state:"ready",guidance:"Required for answer-visibility sweeps."}],projectDraft:{name:"",canonicalDomain:"",country:"US",language:"en"},queryImportState:{mode:"paste",queryCount:0,preview:[]},competitorDraft:{domains:[],notes:"Use the CLI to add competitors."},launchState:{enabled:c,ctaLabel:c?"Trigger run":"Create a project first",summary:c?"Ready to run.":"Create a project first to launch a run."}},settings:{providerStatuses:(n?.providers??[]).map(d=>({name:d.name,displayName:d.displayName,keyUrl:d.keyUrl,modelHint:d.modelHint,model:d.model,defaultModel:d.defaultModel,state:d.configured?"ready":"needs-config",detail:d.configured?"Provider is configured.":"API key is missing.",quota:d.quota})),google:{state:n?.google?.configured?"ready":"needs-config",detail:n?.google?.configured?"Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.":"Google OAuth client ID and client secret are not configured yet."},bing:{state:n?.bing?.configured?"ready":"needs-config",detail:n?.bing?.configured?"Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.":"Bing Webmaster Tools API key is not configured yet."},selfHostNotes:["Configuration is stored in ~/.canonry/config.yaml.","The local config file is the source of truth for authentication credentials.","Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.","Database is SQLite at ~/.canonry/data.db.","API key was auto-generated during canonry init."],bootstrapNote:"Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config."}}}function J3(e){const n=[];for(const i of e){const r=i.visibilityEvidence.filter(c=>c.citationState==="lost");r.length>0&&n.push({id:`attention_${i.project.id}_lost`,tone:"negative",title:`${i.project.displayName||i.project.name} lost citations`,detail:`${r.length} quer${r.length>1?"ies":"y"} lost citation.`,actionLabel:"Open project",href:`/projects/${i.project.id}`});const l=i.recentRuns.filter(c=>c.status===Ht.running||c.status===Ht.queued);l.length>0&&n.push({id:`attention_${i.project.id}_active`,tone:"neutral",title:`${i.project.displayName||i.project.name} has active runs`,detail:`${l.length} run${l.length>1?"s":""} in progress.`,actionLabel:"View runs",href:"/runs"})}return n.length===0&&n.push({id:"attention_stable",tone:"positive",title:"All projects stable",detail:"No citation losses or active runs to flag."}),n}const a1=q.createContext(null);a1.Provider;function uo(){return q.useContext(a1)}function xc(e){const i=uo()?.dashboard??null,r=un({...op({client:ae}),enabled:!i,refetchInterval:bk}),l=un({...cp({client:ae,query:{kind:"answer-visibility"}}),enabled:!i,staleTime:io,refetchInterval:C=>C.state.data?.some(R=>R.status==="running"||R.status==="queued")?3e3:io}),c=un({..._O({client:ae}),enabled:!i}),d=r.data??[],m=l.data??[],g=lw({queries:d.map(C=>{const k=m.filter(G=>G.projectId===C.id),T=k.filter(G=>(G.status==="completed"||G.status==="partial")&&G.kind==="answer-visibility"&&G.trigger!=="probe").sort((G,H)=>H.createdAt.localeCompare(G.createdAt)),R=T.length>0?T[0].id:"no-run";return{queryKey:["project-overview-slim",C.id,R],queryFn:async()=>{const G=await yv(C.name).catch(()=>null);return{project:C,runs:k,queries:[],competitors:[],timeline:[],latestRunDetails:[],previousRunDetails:[],gscCoverage:null,bingCoverage:null,dbInsights:null,overview:G}},enabled:!i&&r.isSuccess&&l.isSuccess,staleTime:gf}})}),b=g.every(C=>C.isSuccess),v=q.useMemo(()=>{if(i)return i;if(!r.data||!l.data||d.length>0&&!b)return null;const C=g.map(k=>k.data?{...k.data,runs:m.filter(T=>T.projectId===k.data.project.id)}:null).filter(k=>k!=null);return X3(C,c.data??null)},[i,r.data,l.data,c.data,b,g,d.length,m]),S=!i&&(r.isError||l.isError),j=!i&&!v&&!S,_=q.useCallback(async()=>{await Promise.all([r.refetch(),l.refetch(),c.refetch()])},[r.refetch,l.refetch,c.refetch]);return{dashboard:v,isLoading:j,isError:S,refetch:_}}function F3(e){const n=uo(),i=q.useMemo(()=>!n||!e?null:n.dashboard.projects.find(C=>C.project.name===e)??null,[n,e]),r=un({...NO({client:ae,path:{name:e??""}}),enabled:!!e&&!i,staleTime:gf,refetchOnWindowFocus:"always"}),l=un({...cp({client:ae,query:{kind:"answer-visibility"}}),enabled:!!e,staleTime:io,refetchOnWindowFocus:"always",refetchInterval:C=>C.state.data?.some(R=>R.projectId===r.data?.id&&(R.status==="running"||R.status==="queued"))?3e3:io}),c=r.data??null,d=q.useMemo(()=>c?(l.data??[]).filter(C=>C.projectId===c.id):[],[c,l.data]),{latestRunIds:m,previousRunIds:g,latestRunIdsKey:b}=q.useMemo(()=>{const C=d.filter(H=>(H.status==="completed"||H.status==="partial")&&H.kind==="answer-visibility"&&H.trigger!=="probe").sort((H,K)=>K.createdAt.localeCompare(H.createdAt)),k=C[0]?.createdAt??null,T=k?C.filter(H=>H.createdAt===k).map(H=>H.id):[],R=C.find(H=>H.createdAt!==k)?.createdAt??null,G=R?C.filter(H=>H.createdAt===R).map(H=>H.id):[];return{latestRunIds:T,previousRunIds:G,latestRunIdsKey:[...T].sort().join(",")}},[d]),v=un({queryKey:["project-dashboard-full",c?.id??null,b||"none"],queryFn:async()=>{if(!c||!e)return null;const[C,k,T,R,G,H,K,Y,X]=await Promise.all([GN(e).catch(()=>[]),IN(e).catch(()=>[]),HN(e).catch(()=>[]),m.length?Promise.all(m.map(D=>Fl(D).catch(()=>null))).then(D=>D.filter(M=>M!=null)):Promise.resolve([]),g.length?Promise.all(g.map(D=>Fl(D).catch(()=>null))).then(D=>D.filter(M=>M!=null)):Promise.resolve([]),ak(e).catch(()=>null),rk(e).catch(()=>null),lk(e).catch(()=>null),yv(e).catch(()=>null)]);return{project:c,runs:d,queries:C,competitors:k,timeline:T,latestRunDetails:R,previousRunDetails:G,gscCoverage:H,bingCoverage:K,dbInsights:Y,overview:X}},enabled:!!c&&!!e&&l.isSuccess,staleTime:gf,refetchOnWindowFocus:"always",refetchInterval:vk}),S=q.useMemo(()=>v.data?n1({...v.data,runs:d}):i||null,[v.data,d,i]),j=q.useCallback(async()=>{await Promise.all([r.refetch(),l.refetch(),v.refetch()])},[r.refetch,l.refetch,v.refetch]),_=!S&&(r.isLoading||l.isLoading||v.isLoading);return{commandCenter:S,project:c,isLoading:_,isError:r.isError||l.isError||v.isError,refetch:j}}const W3=["health"];async function eD(){const e=await uk("/health","API"),n=e.state==="ok"?{label:"Worker",state:"ok",detail:"In-process job runner"}:{label:"Worker",state:e.state,detail:`Depends on API health check · ${e.detail}`,statusCode:e.statusCode,hint:e.hint?`Worker status is inferred from API health in this deployment mode. ${e.hint}`:"Worker status is inferred from API health in this deployment mode."};return{apiStatus:e,workerStatus:n}}function mp(e,n){return un({queryKey:W3,queryFn:eD,enabled:e,refetchInterval:15e3,initialData:n})}function tD(e){return un({...z0({client:ae,path:{id:e??""}}),enabled:!!e,refetchInterval:n=>{const i=n.state.data?.status;return i==="running"||i==="queued"?3e3:!1}})}function hp(){const e=dc(),n=cw({strict:!1}),i=uw({select:g=>g.location.pathname}),r=n.runId??null,l=n.evidenceId??null;return{runId:r,evidenceId:l,openRun:g=>{e({to:i,from:en.to,search:b=>({...b,runId:g,evidenceId:void 0})})},openEvidence:g=>{e({to:i,from:en.to,search:b=>({...b,evidenceId:g,runId:void 0})})},closeDrawer:()=>{e({to:i,from:en.to,search:g=>({...g,runId:void 0,evidenceId:void 0})})}}}const nD={negative:"toast-card-negative",caution:"toast-card-caution",positive:"toast-card-positive",neutral:"toast-card-neutral"};function aD(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function iD(){const e=q.useSyncExternalStore(gk,My,My),n=dc(),{openRun:i}=hp(),r=q.useCallback(c=>{hf(c)},[]),l=q.useCallback(c=>{c.cta&&(c.cta.intent==="open-run-drawer"?i(c.cta.runId):n({to:"/runs"}),hf(c.id))},[n,i]);return e.length===0?null:f.jsx("div",{className:"toast-viewport","aria-label":"Notifications",children:e.map(c=>f.jsxs("section",{role:c.tone==="negative"?"alert":"status","aria-live":c.tone==="negative"?"assertive":"polite","data-state":c.state,className:`toast-card ${nD[c.tone]}`,children:[f.jsxs("div",{className:"toast-copy",children:[f.jsx("p",{className:"toast-title",children:c.title}),c.detail?f.jsx("p",{className:"toast-detail",children:c.detail}):null,c.cta?f.jsx("button",{type:"button",className:"toast-action",onClick:()=>l(c),"aria-label":aD(c),children:c.cta.label}):null]}),f.jsx("button",{type:"button",onClick:()=>r(c.id),className:"toast-dismiss","aria-label":"Dismiss",children:f.jsx(Ps,{className:"size-3.5"})})]},c.id))})}function sD(e,n={}){const{threshold:i=80}=n,r=q.useRef(null),l=q.useRef({scrollHeight:0,wasAtEnd:!0});function c(g){return g.scrollHeight-g.scrollTop-g.clientHeight}function d(){const g=r.current;return g?c(g)<=i:!0}function m(){const g=r.current;g&&(g.scrollTop=g.scrollHeight,l.current.wasAtEnd=!0,l.current.scrollHeight=g.scrollHeight)}return q.useEffect(()=>{const g=r.current;if(!g)return;const b=()=>{l.current.wasAtEnd=c(g)<=i};return g.addEventListener("scroll",b,{passive:!0}),()=>g.removeEventListener("scroll",b)},[i]),q.useLayoutEffect(()=>{const g=r.current;if(!g)return;const b=g.scrollHeight;b>l.current.scrollHeight&&l.current.wasAtEnd&&(g.scrollTop=b),l.current.scrollHeight=b},e),q.useEffect(()=>{const g=r.current;if(!g||typeof ResizeObserver>"u")return;const b=new ResizeObserver(()=>{const v=g.scrollHeight;v>l.current.scrollHeight&&l.current.wasAtEnd&&(g.scrollTop=v),l.current.scrollHeight=v});return b.observe(g),g.firstElementChild&&b.observe(g.firstElementChild),()=>b.disconnect()},[]),{ref:r,scrollToEnd:m,isAtEnd:d}}async function gp(e){try{return await e.json()}catch{return{}}}function rD(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath.replace(/\/$/,"")+"/api/v1":"/api/v1"}const yp=rD();function bp(e){(e===401||e===403)&&Bf()}async function Ob(e){const n=await fetch(`${yp}/projects/${encodeURIComponent(e)}/agent/transcript`,{credentials:"include"});if(!n.ok){bp(n.status);const i=await gp(n);throw new Hn(i.error?.message??`transcript fetch failed: ${n.status}`,n.status,i.error?.code)}return await n.json()}async function oD(e){const n=await fetch(`${yp}/projects/${encodeURIComponent(e)}/agent/transcript`,{method:"DELETE",credentials:"include"});if(!n.ok){bp(n.status);const i=await gp(n);throw new Hn(i.error?.message??`reset failed: ${n.status}`,n.status,i.error?.code)}}async function lD({project:e,prompt:n,provider:i,modelId:r,scope:l,signal:c,onEvent:d}){const m={prompt:n};i&&(m.provider=i),r&&(m.modelId=r),l&&(m.scope=l);const g=await fetch(`${yp}/projects/${encodeURIComponent(e)}/agent/prompt`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(m),signal:c});if(!g.ok||!g.body){bp(g.status);const _=await gp(g);throw new Hn(_.error?.message??`prompt failed: ${g.status}`,g.status,_.error?.code)}const b=g.body.getReader(),v=new TextDecoder;let S="";const j=()=>{b.cancel().catch(()=>{})};c?.addEventListener("abort",j,{once:!0});try{for(;;){const{value:_,done:C}=await b.read();if(C)break;S+=v.decode(_,{stream:!0});let k=S.indexOf(`
|
|
59
59
|
|
|
60
60
|
`);for(;k!==-1;){const T=S.slice(0,k);S=S.slice(k+2);for(const R of T.split(`
|
|
61
61
|
`)){if(!R.startsWith("data:"))continue;const G=R.slice(5).trim();if(G)try{d(JSON.parse(G))}catch{}}k=S.indexOf(`
|
|
62
62
|
|
|
63
63
|
`)}}}finally{c?.removeEventListener("abort",j);try{b.releaseLock()}catch{}}}function i1(e){return!e||e.role!=="assistant"?"":e.content.filter(n=>n.type==="text").map(n=>n.text).join("")}const cD=[{label:"Status",prompt:"Quick status overview for this project — latest runs, current health, anything unusual."},{label:"Top insights",prompt:"Walk me through the 3 most severe active insights and what to do about each."},{label:"Last failed run",prompt:"If the latest run failed, dig into it and tell me what went wrong plus how to fix it."},{label:"Schedule",prompt:"What is the current sweep schedule, and is it appropriate given recent volatility?"}],uD=[{command:"/status",label:"Status",hint:"Latest runs, health, anything unusual",prompt:"Quick status overview for this project — latest runs, current health, anything unusual."},{command:"/insights",label:"Top insights",hint:"Walk through the most severe active insights",prompt:"Walk me through the 3 most severe active insights and what to do about each."},{command:"/last-run",label:"Last run",hint:"Summarize the latest sweep",prompt:"Summarize the latest run for this project — provider mix, visibility changes, and anything that moved."},{command:"/last-failed",label:"Last failed run",hint:"Diagnose the most recent failure",prompt:"If the latest run failed, dig into it and tell me what went wrong plus how to fix it."},{command:"/run-sweep",label:"Run sweep now",hint:"Trigger a new visibility sweep",prompt:"Run a new answer-visibility sweep for this project now and tell me when it lands."},{command:"/schedule",label:"Schedule",hint:"Review the sweep schedule",prompt:"What is the current sweep schedule, and is it appropriate given recent volatility?"},{command:"/queries",label:"Queries",hint:"List tracked queries",prompt:"List the tracked queries for this project and flag any that are obvious duplicates or underperformers."},{command:"/competitors",label:"Competitors",hint:"List tracked competitors",prompt:"List this project's tracked competitors and call out which ones are showing up in answer citations."},{command:"/clear",label:"Clear conversation",hint:"Wipe transcript and start fresh",action:"clear"}],Vl=e=>`canonry:aero:provider:${e}`,Db=e=>`canonry:aero:scope:${e}`;function dD({projectName:e}){const[n,i]=q.useState(!1),[r,l]=q.useState(!1),[c,d]=q.useState([]),[m,g]=q.useState(""),[b,v]=q.useState(!1),[S,j]=q.useState([]),[_,C]=q.useState(""),[k,T]=q.useState(null),[R,G]=q.useState(()=>typeof window>"u"?null:window.localStorage.getItem(Vl(e))??null),[H,K]=q.useState(()=>typeof window>"u"?"read-only":window.localStorage.getItem(Db(e))==="all"?"all":"read-only"),Y=q.useRef(null),{ref:X}=sD([c,_,S]),D=q.useRef(null),[M,oe]=q.useState(0),ke=q.useMemo(()=>{const J=m.trimStart();if(!J.startsWith("/"))return[];if(/\s/.test(J))return[];const le=J.toLowerCase();return uD.filter(te=>te.command.startsWith(le)||te.label.toLowerCase().includes(le.slice(1)))},[m]);q.useEffect(()=>{oe(J=>ke.length===0?0:Math.min(J,ke.length-1))},[ke.length]);const _e=un({...s4({client:ae,path:{name:e}}),enabled:n,staleTime:6e4}),ve=q.useMemo(()=>{const J=_e.data?.providers??[];if(R){const te=J.find(ue=>ue.id===R&&ue.configured);if(te)return te}const le=_e.data?.defaultProvider;return le?J.find(te=>te.id===le)??null:null},[R,_e.data]);q.useEffect(()=>{if(!_e.data||!R)return;_e.data.providers.find(le=>le.id===R&&le.configured)||(G(null),window.localStorage.removeItem(Vl(e)))},[_e.data,R,e]);const et=q.useCallback(J=>{G(J),!(typeof window>"u")&&(J?window.localStorage.setItem(Vl(e),J):window.localStorage.removeItem(Vl(e)))},[e]),re=q.useCallback(()=>{K(J=>{const le=J==="all"?"read-only":"all";return typeof window<"u"&&window.localStorage.setItem(Db(e),le),le})},[e]);q.useEffect(()=>{if(!n)return;const J=le=>{le.key==="Escape"&&(r?l(!1):i(!1))};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[n,r]),q.useEffect(()=>{if(!n)return;let J=!1;T(null);const le=()=>{J||b||Ob(e).then(ne=>{J||d(ne.messages)}).catch(ne=>{J||T(ne instanceof Error?ne.message:"Failed to load transcript")})};le();const ue=window.setInterval(le,15e3);return()=>{J=!0,window.clearInterval(ue)}},[n,e,b]),q.useEffect(()=>()=>{Y.current?.abort()},[e]);async function me(J){const le=J.trim();if(!le||b)return;T(null),g(""),v(!0),C(""),j([]);const te={role:"user",content:le,timestamp:Date.now()};d(ne=>[...ne,te]);const ue=new AbortController;Y.current=ue;try{await lD({project:e,prompt:le,provider:R??void 0,scope:H,signal:ue.signal,onEvent:$});const ne=await Ob(e);d(ne.messages)}catch(ne){ne.name!=="AbortError"&&T(ne instanceof Error?ne.message:"Prompt failed")}finally{v(!1),C(""),Y.current=null}}function $(J){switch(J.type){case"message_update":C(i1(J.message));break;case"message_end":J.message.role==="assistant"&&C("");break;case"tool_execution_start":j(le=>[...le,{id:J.toolCallId,name:J.toolName,args:J.args,startedAt:Date.now()}]);break;case"tool_execution_end":j(le=>le.map(te=>te.id===J.toolCallId?{...te,endedAt:Date.now(),isError:J.isError,result:J.result}:te));break;case"error":T(J.message);break}}async function W(){Y.current?.abort();try{await oD(e),d([]),T(null)}catch(J){T(J instanceof Error?J.message:"Reset failed")}}const fe=c.length===0,je=n&&r?"pointer-events-auto fixed inset-0 z-40 flex items-stretch justify-center bg-zinc-950/70 p-4 sm:p-8 backdrop-blur-sm":"pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3",ie=r?"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden rounded-2xl border border-zinc-800/80 bg-zinc-950/95 shadow-2xl":"pointer-events-auto w-full max-w-3xl",Qe=r?"flex-1 overflow-y-auto px-6 py-5 text-sm text-zinc-200":"max-h-[40vh] min-h-[120px] overflow-y-auto px-4 py-3 text-sm text-zinc-200";return f.jsx("div",{className:je,onClick:J=>{r&&J.target===J.currentTarget&&l(!1)},children:f.jsx("div",{className:ie,children:n?f.jsxs("div",{className:r?"flex h-full flex-col":"flex flex-col overflow-hidden rounded-2xl border border-zinc-800/80 bg-zinc-950/95 shadow-xl backdrop-blur",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-zinc-800/70 px-4 py-2.5",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Uy,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"}),f.jsx("span",{className:"text-sm font-medium text-zinc-100",children:"Aero"}),f.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:b?"working…":e})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(fD,{providers:_e.data?.providers??[],active:ve,override:R,onPick:et,disabled:b}),f.jsx("button",{type:"button",onClick:wn(W),className:"rounded-md p-1.5 text-zinc-500 transition hover:bg-zinc-800/60 hover:text-zinc-200","aria-label":"Reset conversation",title:"Reset conversation",children:f.jsx(xv,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),f.jsx("button",{type:"button",onClick:()=>l(J=>!J),className:"rounded-md p-1.5 text-zinc-500 transition hover:bg-zinc-800/60 hover:text-zinc-200","aria-label":r?"Collapse":"Expand",title:r?"Collapse":"Expand",children:r?f.jsx(aA,{className:"h-3.5 w-3.5","aria-hidden":"true"}):f.jsx(Wk,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),f.jsx("button",{type:"button",onClick:()=>{l(!1),i(!1)},className:"rounded-md p-1.5 text-zinc-500 transition hover:bg-zinc-800/60 hover:text-zinc-200","aria-label":"Close Aero",children:f.jsx(Ps,{className:"h-4 w-4","aria-hidden":"true"})})]})]}),f.jsxs("div",{ref:X,className:Qe,children:[k&&f.jsx("div",{className:"mb-2 rounded-md border border-rose-700/40 bg-rose-950/40 px-3 py-2 text-xs text-rose-200",children:k}),fe&&!b&&f.jsxs("div",{className:"flex flex-col gap-3 py-2",children:[f.jsxs("p",{className:"text-xs text-zinc-500",children:["Ask anything about ",f.jsx("span",{className:"text-zinc-300",children:e}),", or start with:"]}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:cD.map(J=>f.jsx("button",{type:"button",onClick:()=>{me(J.prompt)},className:"rounded-full border border-zinc-800 bg-zinc-900/70 px-3 py-1 text-xs text-zinc-300 transition hover:border-zinc-700 hover:bg-zinc-800/70 hover:text-zinc-100",children:J.label},J.label))})]}),yD(c,e,R,H),S.length>0&&f.jsx("div",{className:"mt-3 space-y-1.5",children:S.map(J=>f.jsx(s1,{trail:J},J.id))}),b&&_&&f.jsxs("div",{className:"mt-3",children:[f.jsx("div",{className:"mb-0.5 text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),f.jsx(r1,{content:_})]}),b&&!_&&S.every(J=>J.endedAt!==void 0)&&f.jsx(xD,{})]}),f.jsx(pD,{projectName:e,activeProvider:ve,scope:H,onToggleScope:re,disabled:b}),f.jsxs("div",{className:"relative",children:[ke.length>0&&f.jsx(mD,{matches:ke,selectedIndex:M,onHover:oe,onPick:J=>{g(""),D.current?.focus(),J.action==="clear"?W():me(J.prompt)}}),f.jsxs("form",{className:"flex items-end gap-2 border-t border-zinc-800/70 bg-zinc-950/80 px-3 py-2.5",onSubmit:J=>{if(J.preventDefault(),ke.length>0){const le=ke[M];g(""),le.action==="clear"?W():me(le.prompt);return}me(m)},children:[f.jsx("textarea",{ref:D,value:m,onChange:J=>g(J.target.value),onKeyDown:J=>{if(ke.length>0){if(J.key==="ArrowDown"){J.preventDefault(),oe(le=>(le+1)%ke.length);return}if(J.key==="ArrowUp"){J.preventDefault(),oe(le=>(le-1+ke.length)%ke.length);return}if(J.key==="Tab"){J.preventDefault();const le=ke[M];g(`${le.command} `);return}if(J.key==="Escape"){J.preventDefault(),g("");return}}if(J.key==="Enter"&&!J.shiftKey)if(J.preventDefault(),ke.length>0){const le=ke[M];g(""),le.action==="clear"?W():me(le.prompt)}else me(m)},placeholder:"Ask Aero, or / for commands…",disabled:b,rows:r?3:1,className:"flex-1 resize-none bg-transparent text-sm text-zinc-100 placeholder:text-zinc-600 focus:outline-none disabled:opacity-60"}),f.jsx("button",{type:"submit",disabled:b||!m.trim(),className:"inline-flex h-7 w-7 items-center justify-center rounded-md bg-emerald-500 text-zinc-950 transition hover:bg-emerald-400 disabled:opacity-40","aria-label":"Send",children:f.jsx(Ek,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]}):f.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center justify-between rounded-full border border-zinc-800/80 bg-zinc-950/95 px-4 py-2 text-left text-sm text-zinc-400 shadow-lg backdrop-blur transition hover:border-zinc-700 hover:bg-zinc-900/90 hover:text-zinc-200",children:[f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx(Uy,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"}),"Ask Aero about ",e,"…"]}),f.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-600",children:"Enter"})]})})})}function fD({providers:e,active:n,override:i,onPick:r,disabled:l}){const[c,d]=q.useState(!1),m=q.useRef(null);if(q.useEffect(()=>{if(!c)return;const v=j=>{m.current?.contains(j.target)||d(!1)},S=j=>{j.key==="Escape"&&d(!1)};return window.addEventListener("mousedown",v),window.addEventListener("keydown",S),()=>{window.removeEventListener("mousedown",v),window.removeEventListener("keydown",S)}},[c]),e.length===0)return null;const g=n?.label.replace(/\s+\(.+\)$/,"")??"No provider",b=n?.defaultModel;return f.jsxs("div",{ref:m,className:"relative",children:[f.jsxs("button",{type:"button",onClick:()=>d(v=>!v),disabled:l,className:"flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-zinc-400 transition hover:bg-zinc-800/60 hover:text-zinc-200 disabled:opacity-50","aria-label":"Switch agent model","aria-haspopup":"listbox","aria-expanded":c,title:n?`${n.label} · ${n.defaultModel}`:"Pick a provider",children:[f.jsx("span",{className:"font-medium text-zinc-200",children:g}),b&&f.jsx("span",{className:"hidden font-mono text-[10px] text-zinc-500 sm:inline",children:b}),f.jsx(Bk,{className:"h-3 w-3","aria-hidden":"true"})]}),c&&f.jsxs("div",{role:"listbox",className:"absolute right-0 top-full z-50 mt-1 w-64 overflow-hidden rounded-lg border border-zinc-800 bg-zinc-950 shadow-xl",children:[f.jsx("div",{className:"border-b border-zinc-800/60 px-3 py-2 text-[10px] uppercase tracking-wider text-zinc-500",children:"Aero provider"}),f.jsx("ul",{className:"max-h-72 overflow-y-auto py-1",children:e.map(v=>{const S=n?.id===v.id,j=i===v.id;return f.jsx("li",{children:f.jsxs("button",{type:"button",role:"option","aria-selected":S,disabled:!v.configured,onClick:()=>{v.configured&&(r(j?null:v.id),d(!1))},className:"flex w-full items-start gap-2 px-3 py-2 text-left text-xs transition enabled:hover:bg-zinc-900 disabled:cursor-not-allowed disabled:opacity-50",children:[f.jsx("span",{className:"mt-0.5 flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:S?f.jsx(Sv,{className:"h-3 w-3 text-emerald-400","aria-hidden":"true"}):null}),f.jsxs("span",{className:"flex-1",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"font-medium text-zinc-100",children:v.label}),j&&f.jsx("span",{className:"rounded-full border border-emerald-800/60 bg-emerald-950/60 px-1.5 text-[9px] uppercase tracking-wider text-emerald-300",children:"Pinned"}),!v.configured&&f.jsx("span",{className:"rounded-full border border-zinc-800 px-1.5 text-[9px] uppercase tracking-wider text-zinc-500",children:"Key missing"})]}),f.jsx("span",{className:"mt-0.5 block font-mono text-[10px] text-zinc-500",children:v.defaultModel}),v.keySource==="env"&&f.jsx("span",{className:"mt-0.5 block text-[10px] text-zinc-600",children:"via env var"}),!v.configured&&f.jsxs("span",{className:"mt-0.5 block text-[10px] text-zinc-600",children:["Add key in config.yaml or export"," ",f.jsx("code",{className:"font-mono text-zinc-400",children:hD(v.id)})]})]})]})},v.id)})}),i&&f.jsx("button",{type:"button",onClick:()=>{r(null),d(!1)},className:"w-full border-t border-zinc-800/60 px-3 py-2 text-left text-[11px] text-zinc-400 transition hover:bg-zinc-900 hover:text-zinc-100",children:"Reset to auto-detected default"})]})]})}function pD({projectName:e,activeProvider:n,scope:i,onToggleScope:r,disabled:l}){const c=n?.label.replace(/\s+\(.+\)$/,"")??null,d=i==="all";return f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-zinc-800/70 bg-zinc-950/80 px-3 pt-2",children:[f.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-800 bg-zinc-900/70 px-2 py-0.5 text-[10px] text-zinc-400",children:[f.jsx("span",{className:"text-zinc-600",children:"project"}),f.jsx("span",{className:"font-medium text-zinc-200",children:e})]}),c&&f.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-800 bg-zinc-900/70 px-2 py-0.5 text-[10px] text-zinc-400",children:[f.jsx("span",{className:"text-zinc-600",children:"model"}),f.jsx("span",{className:"font-medium text-zinc-200",children:c})]}),f.jsxs("button",{type:"button",onClick:r,disabled:l,className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] transition disabled:opacity-50 ${d?"border-amber-800/60 bg-amber-950/40 text-amber-300 hover:border-amber-700 hover:text-amber-200":"border-zinc-800 bg-zinc-900/70 text-zinc-400 hover:border-zinc-700 hover:text-zinc-200"}`,title:d?"Aero can invoke write tools (run sweep, dismiss insight, etc). Click to restrict.":"Aero is restricted to read-only tools. Click to allow writes.",children:[f.jsx("span",{className:d?"text-amber-500":"text-zinc-600",children:"scope"}),f.jsx("span",{className:"font-medium",children:d?"all tools":"read-only"})]})]})}function mD({matches:e,selectedIndex:n,onHover:i,onPick:r}){return f.jsxs("div",{className:"absolute inset-x-3 bottom-full mb-2 overflow-hidden rounded-lg border border-zinc-800 bg-zinc-950/98 shadow-2xl",children:[f.jsx("div",{className:"border-b border-zinc-800/60 px-3 py-1.5 text-[10px] uppercase tracking-wider text-zinc-500",children:"Commands"}),f.jsx("ul",{role:"listbox",className:"max-h-72 overflow-y-auto py-1",children:e.map((l,c)=>{const d=c===n;return f.jsx("li",{children:f.jsxs("button",{type:"button",role:"option","aria-selected":d,onMouseEnter:()=>i(c),onClick:()=>r(l),className:`flex w-full items-center gap-3 px-3 py-1.5 text-left text-xs transition ${d?"bg-zinc-900 text-zinc-100":"text-zinc-300 hover:bg-zinc-900/60"}`,children:[f.jsx("span",{className:"font-mono text-[11px] text-emerald-400",children:l.command}),f.jsx("span",{className:"font-medium",children:l.label}),f.jsx("span",{className:"ml-auto text-[10px] text-zinc-500",children:l.hint})]})},l.command)})}),f.jsxs("div",{className:"border-t border-zinc-800/60 px-3 py-1.5 text-[10px] text-zinc-600",children:[f.jsx("span",{className:"mr-3",children:"↑↓ to select"}),f.jsx("span",{className:"mr-3",children:"Enter to run"}),f.jsx("span",{children:"Tab to autocomplete"})]})]})}function hD(e){switch(e){case"claude":return"ANTHROPIC_API_KEY";case"openai":return"OPENAI_API_KEY";case"gemini":return"GOOGLE_API_KEY";case"zai":return"ZAI_API_KEY"}}function gD(e,n){const i=e.timestamp??0;return`${e.role}:${i}:${n}`}function yD(e,n,i,r){const l=[];for(let c=0;c<e.length;c++){const d=e[c],m=gD(d,c);if(d.role==="user"){const g=typeof d.content=="string"?d.content:JSON.stringify(d.content);if(g.startsWith("[system]"))continue;l.push(f.jsx(bD,{text:g,projectName:n,providerOverride:i,scope:r},m));continue}if(d.role==="assistant"){const g=new Map;let b=c+1;for(;b<e.length&&e[b].role==="toolResult";){const j=e[b];g.set(j.toolCallId,j),b++}const v=SD(d,g,d.timestamp??0),S=i1(d);l.push(f.jsxs(q.Fragment,{children:[v.length>0&&f.jsx("div",{className:"mt-3 space-y-1.5",children:v.map(j=>f.jsx(s1,{trail:j},j.id))}),S.trim()&&f.jsxs("div",{className:"mt-3",children:[f.jsx("div",{className:"mb-0.5 text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),f.jsx(r1,{content:S})]})]},m)),c=b-1;continue}}return l}function bD({text:e,projectName:n,providerOverride:i,scope:r}){const[l,c]=q.useState(!1),d=q.useMemo(()=>vD(n,e,i,r),[n,e,i,r]);async function m(){try{await navigator.clipboard.writeText(d),c(!0),window.setTimeout(()=>c(!1),1500)}catch{}}return f.jsxs("div",{className:"group relative mt-3 rounded-md bg-zinc-900/60 px-3 py-2 text-zinc-200",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:"You"}),f.jsx("button",{type:"button",onClick:wn(m),className:"inline-flex items-center gap-1 rounded border border-zinc-800/70 bg-zinc-950/60 px-1.5 py-0.5 text-[10px] text-zinc-400 opacity-0 transition hover:border-zinc-700 hover:text-zinc-100 group-hover:opacity-100 focus:opacity-100","aria-label":"Copy as CLI command",title:d,children:l?f.jsxs(f.Fragment,{children:[f.jsx(Sv,{className:"h-2.5 w-2.5 text-emerald-400","aria-hidden":"true"}),"Copied"]}):f.jsxs(f.Fragment,{children:[f.jsx(Uk,{className:"h-2.5 w-2.5","aria-hidden":"true"}),"Copy as CLI"]})})]}),f.jsx("div",{className:"whitespace-pre-wrap",children:e})]})}function vD(e,n,i,r){const l=["canonry","agent","ask",Rb(e),Rb(n)];return i&&l.push("--provider",i),r==="read-only"&&l.push("--scope","read-only"),l.join(" ")}function Rb(e){return`'${e.replace(/'/g,"'\\''")}'`}function SD(e,n,i){const r=[];for(const l of e.content){if(l.type!=="toolCall")continue;const c=l,d=n.get(c.id);r.push({id:c.id,name:c.name,args:c.arguments,startedAt:i,endedAt:d?.timestamp,isError:d?.isError,result:d?.content})}return r}function s1({trail:e}){const[n,i]=q.useState(!1),r=e.endedAt===void 0,l=!r&&e.isError===!0,c=e.endedAt!=null?e.endedAt-e.startedAt:null,d=c==null||c<0?null:c<1e3?`${c}ms`:`${(c/1e3).toFixed(1)}s`,m=l?"border-rose-800/50":r?"border-emerald-800/50":"border-zinc-800/70",g=l?"bg-rose-950/20":r?"bg-emerald-950/20":"bg-zinc-900/40";return f.jsxs("div",{className:`rounded-md border ${m} ${g} font-mono`,children:[f.jsxs("button",{type:"button",onClick:()=>i(b=>!b),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left","aria-expanded":n,children:[f.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:r?f.jsx(Jk,{className:"h-3 w-3 animate-spin text-emerald-400","aria-hidden":"true"}):l?f.jsx(wv,{className:"h-3 w-3 text-rose-400","aria-hidden":"true"}):f.jsx(yA,{className:"h-3 w-3 text-zinc-500","aria-hidden":"true"})}),f.jsx("span",{className:"text-[11px] font-semibold text-zinc-100",children:e.name}),f.jsxs("span",{className:"ml-auto flex items-center gap-2 text-[10px] text-zinc-500",children:[r?f.jsx("span",{className:"text-emerald-400",children:"running…"}):f.jsxs(f.Fragment,{children:[f.jsx("span",{children:l?"failed":"ok"}),d&&f.jsx("span",{children:d})]}),f.jsx($f,{className:`h-3 w-3 transition-transform ${n?"rotate-90":""}`,"aria-hidden":"true"})]})]}),n&&f.jsxs("div",{className:"border-t border-zinc-800/60 px-2.5 py-2 text-[11px] text-zinc-400",children:[f.jsx("div",{className:"mb-1 text-[9px] uppercase tracking-wider text-zinc-600",children:"Args"}),f.jsx("pre",{className:"mb-2 overflow-x-auto whitespace-pre-wrap break-all text-[10px] text-zinc-300",children:Mb(e.args)}),!r&&e.result!==void 0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mb-1 text-[9px] uppercase tracking-wider text-zinc-600",children:l?"Error":"Result"}),f.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[10px] text-zinc-300",children:Mb(e.result)})]})]})]})}function Mb(e){try{const n=typeof e=="string"?e:JSON.stringify(e,null,2);return n.length>2e3?`${n.slice(0,2e3)}
|
|
64
|
-
… (${n.length-2e3} more chars)`:n}catch{return String(e)}}function r1({content:e}){return f.jsx("div",{className:"aero-markdown text-zinc-100",children:f.jsx(gw,{components:{h1:n=>f.jsx("h1",{...n,className:"mt-3 mb-2 text-base font-semibold text-zinc-50"}),h2:n=>f.jsx("h2",{...n,className:"mt-3 mb-2 text-sm font-semibold text-zinc-50"}),h3:n=>f.jsx("h3",{...n,className:"mt-3 mb-1.5 text-sm font-semibold text-zinc-100"}),h4:n=>f.jsx("h4",{...n,className:"mt-2 mb-1 text-xs font-semibold uppercase tracking-wide text-zinc-300"}),p:n=>f.jsx("p",{...n,className:"mb-2 leading-relaxed"}),ul:n=>f.jsx("ul",{...n,className:"mb-2 ml-4 list-disc space-y-1"}),ol:n=>f.jsx("ol",{...n,className:"mb-2 ml-4 list-decimal space-y-1"}),li:n=>f.jsx("li",{...n,className:"marker:text-zinc-600"}),strong:n=>f.jsx("strong",{...n,className:"font-semibold text-zinc-50"}),em:n=>f.jsx("em",{...n,className:"text-zinc-200"}),code:({children:n,...i})=>f.jsx("code",{...i,className:"rounded bg-zinc-800/70 px-1 py-0.5 font-mono text-[12px] text-emerald-200",children:n}),pre:n=>f.jsx("pre",{...n,className:"mb-2 overflow-x-auto rounded-md border border-zinc-800 bg-zinc-900/70 p-3 font-mono text-xs text-zinc-200"}),a:n=>f.jsx("a",{...n,className:"text-emerald-400 underline decoration-emerald-700 hover:decoration-emerald-400",target:"_blank",rel:"noopener noreferrer"}),table:n=>f.jsx("div",{className:"mb-2 overflow-x-auto",children:f.jsx("table",{...n,className:"w-full border-collapse text-xs"})}),thead:n=>f.jsx("thead",{...n,className:"border-b border-zinc-800"}),th:n=>f.jsx("th",{...n,className:"px-2 py-1 text-left font-semibold text-zinc-300"}),tr:n=>f.jsx("tr",{...n,className:"border-b border-zinc-900"}),td:n=>f.jsx("td",{...n,className:"px-2 py-1 text-zinc-200"}),blockquote:n=>f.jsx("blockquote",{...n,className:"mb-2 border-l-2 border-zinc-700 pl-3 italic text-zinc-400"}),hr:()=>f.jsx("hr",{className:"my-3 border-zinc-800"})},children:e})})}function xD(){return f.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),f.jsxs("div",{className:"flex items-center gap-1","aria-label":"Aero is thinking",children:[f.jsx("span",{className:"aero-dot h-1.5 w-1.5 rounded-full bg-emerald-400/80"}),f.jsx("span",{className:"aero-dot aero-dot-2 h-1.5 w-1.5 rounded-full bg-emerald-400/60"}),f.jsx("span",{className:"aero-dot aero-dot-3 h-1.5 w-1.5 rounded-full bg-emerald-400/40"})]})]})}function wD(){const e=Xb(),n=/^\/projects\/([^/]+)/.exec(e.pathname),i=n?decodeURIComponent(n[1]):null,r=un({...op({client:ae}),enabled:i!==null,staleTime:6e4});if(!i)return null;const l=r.data??[],c=l.find(d=>d.id===i)??l.find(d=>d.name===i);return c?f.jsx(dD,{projectName:c.name},c.name):null}function As(e,n){e.invalidateQueries({predicate:i=>{const r=i.queryKey[0];return typeof r?._id=="string"&&r._id.startsWith(n)}})}function wc(e,n,i){switch(e.invalidateQueries({queryKey:lp({client:ae})}),e.invalidateQueries({queryKey:Qs({client:ae})}),n){case Te["answer-visibility"]:case Te["site-audit"]:case Te["backlink-extract"]:return;case Te["gsc-sync"]:case Te["inspect-sitemap"]:As(e,"getApiV1ProjectsByNameGoogleGsc");return;case Te["ga-sync"]:As(e,"getApiV1ProjectsByNameGa");return;case Te["traffic-sync"]:As(e,"getApiV1ProjectsByNameGa"),As(e,"getApiV1ProjectsByNameTraffic");return;case Te["bing-inspect"]:case Te["bing-inspect-sitemap"]:As(e,"getApiV1ProjectsByNameBing");return;case Te["aeo-discover-seed"]:case Te["aeo-discover-probe"]:return;case Te["gbp-sync"]:As(e,"getApiV1ProjectsByNameGbp");return;default:return n}}const Bb=[{label:"GitHub",href:"https://github.com/AINYC/canonry",Icon:Ik},{label:"Docs",href:"https://github.com/AINYC/canonry/tree/main/docs",Icon:Dk},{label:"Changelog",href:"https://github.com/AINYC/canonry/releases",Icon:Vk}],Lb=e=>({label:e,state:"checking",detail:"Checking service health"}),jD={apiStatus:Lb("API"),workerStatus:Lb("Worker")};function ND(e){switch(e){case Te["answer-visibility"]:return"Visibility sweep";case Te["gsc-sync"]:return"GSC sync";case Te["inspect-sitemap"]:return"Sitemap inspection";case Te["ga-sync"]:return"GA sync";case Te["traffic-sync"]:return"Traffic sync";case Te["bing-inspect"]:return"Bing URL inspection";case Te["bing-inspect-sitemap"]:return"Bing sitemap inspection";case Te["site-audit"]:return"Site audit";case Te["backlink-extract"]:return"Backlink extract";case Te["aeo-discover-seed"]:return"Discovery (seed phase)";case Te["aeo-discover-probe"]:return"Discovery (probe phase)";case Te["gbp-sync"]:return"Business Profile sync"}}function kD(e){return e==="completed"?"positive":e==="partial"?"caution":"negative"}function AD(e){const n=ND(e.kind);return e.status==="completed"?`${n} completed`:e.status==="partial"?`${n} completed with partial results`:e.status==="cancelled"?`${n} cancelled`:`${n} failed`}function _D(e,n){return e.error?`${n}: ${Yf(e.error)}`:e.location?`${n} · ${e.location}`:n}function zD(e,n,i){if(n)return n;const r=i.find(l=>l.id===e);return r?.displayName||r?.name||e}function CD(e,n){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,n>0?`${n} skipped at queue time`:null].filter(Boolean).join(", ")}function TD(e){return e.failed>0||e.cancelled>0?"negative":e.partial>0?"caution":"positive"}function ED(){const e=Qa(),n=q.useSyncExternalStore(m4,Ni,Ni),i=Object.keys(n.runs).length>0||Object.keys(n.batches).length>0,r=un({...cp({client:ae}),enabled:i,staleTime:io,refetchInterval:3e3}),l=un({...op({client:ae}),enabled:i}),c=q.useRef({}),d=q.useCallback(()=>{r.refetch()},[r.refetch]);return q.useEffect(()=>{i&&d()},[i,d]),q.useEffect(()=>{if(!i||typeof window>"u")return;const m=()=>{document.visibilityState==="visible"&&d()};return window.addEventListener("focus",d),document.addEventListener("visibilitychange",m),()=>{window.removeEventListener("focus",d),document.removeEventListener("visibilitychange",m)}},[i,d]),q.useEffect(()=>{const m=r.data??[],g=l.data??[],b=Object.fromEntries(m.map(S=>[S.id,S])),v=Object.fromEntries(m.map(S=>[S.id,S.status]));for(const S of Object.values(n.runs)){const j=b[S.runId];if(!j||!y4(j.status)||(c.current[j.id]??S.lastAnnouncedStatus)===j.status)continue;const C=g.find(T=>T.id===j.projectId);if(C&&wc(e,j.kind,C.name),S.sourceAction==="run-all"){gb(j.id);continue}const k=zD(j.projectId,S.projectLabel,g);dn({title:AD(j),detail:_D(j,k),tone:kD(j.status),dedupeKey:`run:${j.id}`,dedupeMode:"replace",cta:{label:"View run",intent:"open-run-drawer",runId:j.id}}),gb(j.id)}for(const S of Object.values(n.batches)){const j=b4(S.runIds,b);j.finished&&(dn({title:"Run-all batch finished",detail:CD(j,S.skippedCount),tone:TD(j),dedupeKey:`batch:${S.batchId}`,dedupeMode:"replace",cta:{label:"View runs",intent:"go-to-runs"}}),g4(S.batchId))}c.current=v},[l.data,r.data,n,e]),null}function OD(){const e=uo(),{dashboard:n,isLoading:i,refetch:r}=xc(),d=mp(!e,e?.health).data??e?.health??jD,m=Xb(),{runId:g,evidenceId:b,closeDrawer:v}=hp(),[S,j]=q.useState(!1),[_,C]=q.useState(()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem("canonry:dismissedUpdateVersion")}catch{return null}}),[k]=q.useState(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("force-update")),T=k?{current:d.apiStatus.version??"0.0.0",latest:k,url:"https://www.npmjs.com/package/@ainyc/canonry",upgradeCommand:"npm install -g @ainyc/canonry"}:d.apiStatus.updateAvailable,R=T&&T.latest!==_,G=()=>{if(T){try{window.localStorage.setItem("canonry:dismissedUpdateVersion",T.latest)}catch{}C(T.latest)}},H=tD(g),K=H.data??null,Y=H.isLoading;q.useEffect(()=>{K&&K.status!=="running"&&K.status!=="queued"&&r()},[K?.status,r]),q.useEffect(()=>{j(!1)},[m.pathname]),q.useEffect(()=>{if(typeof window>"u"||!g&&!b)return;const re=me=>{me.key==="Escape"&&v()};return window.addEventListener("keydown",re),()=>{window.removeEventListener("keydown",re)}},[g,b,v]);const X=n??e?.dashboard??null,D=m.pathname==="/setup"&&X!==null&&X.portfolioOverview.projects.length===0,M=g&&X?z3(X,g):void 0,oe=q.useMemo(()=>m.pathname.match(/^\/projects\/([^/]+)/)?.[1]??null,[m.pathname]),ke=q.useMemo(()=>!oe||!X?null:X.projects.find(re=>re.project.id===oe)?.project.name??null,[oe,X]),{commandCenter:_e}=F3(ke),ve=q.useMemo(()=>{if(b)return T3(_e,X,b)},[b,_e,X]),et=(()=>{const re=m.pathname;if(re==="/")return"Portfolio";if(re==="/projects")return"Projects";if(re==="/runs")return"Runs";if(re==="/settings")return"Settings";if(re==="/setup")return"Setup";if(re==="/backlinks")return"Backlinks";if(re==="/traffic"||re.startsWith("/traffic/"))return"Server traffic";if(re.startsWith("/projects/")){const $=re.split("/").filter(Boolean)[1];if($&&X){const W=X.projects.find(fe=>fe.project.id===$);if(W)return W.project.name}return"Project"}return"Not found"})();return f.jsxs("div",{className:`app-shell ${D?"app-shell-focus":""}`,children:[f.jsx("a",{className:"skip-link",href:"#content",children:"Skip to content"}),!D&&f.jsxs("aside",{className:"sidebar","aria-label":"Primary navigation",children:[f.jsx("div",{className:"sidebar-brand",children:f.jsx(kb,{version:d.apiStatus.version,updateAvailable:R?T:null,onDismissUpdate:G})}),f.jsxs("nav",{className:"sidebar-nav",children:[f.jsxs(rt,{to:"/",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(Kk,{className:"sidebar-icon"}),f.jsx("span",{children:"Overview"})]}),f.jsxs(rt,{to:"/projects",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[f.jsx(Pk,{className:"sidebar-icon"}),f.jsx("span",{children:"Projects"})]}),f.jsxs(rt,{to:"/runs",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(sA,{className:"sidebar-icon"}),f.jsx("span",{children:"Runs"})]}),f.jsxs(rt,{to:"/traffic",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[f.jsx(lA,{className:"sidebar-icon"}),f.jsx("span",{children:"Server traffic"})]}),f.jsxs(rt,{to:"/backlinks",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(Yk,{className:"sidebar-icon"}),f.jsx("span",{children:"Backlinks"})]}),f.jsxs(rt,{to:"/settings",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(mA,{className:"sidebar-icon"}),f.jsx("span",{children:"Settings"})]}),i?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"sidebar-section-title",children:"Projects"}),[1,2,3].map(re=>f.jsxs("div",{className:"sidebar-skeleton-item",children:[f.jsx("span",{className:"skeleton-circle size-2"}),f.jsx("span",{className:"skeleton-text flex-1",style:{width:`${50+re*15}%`}})]},re))]}):X&&X.projects.length>0?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"sidebar-section-title",children:"Projects"}),X.projects.map(re=>{const me=re.visibilitySummary.tone;return f.jsxs(rt,{to:"/projects/$projectId",params:{projectId:re.project.id},className:"sidebar-project",activeProps:{className:"sidebar-project sidebar-project-active"},children:[f.jsx("span",{className:`sidebar-dot sidebar-dot-${me}`}),f.jsx("span",{children:re.project.displayName||re.project.name})]},re.project.id)})]}):i?null:f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"sidebar-section-title",children:"Resources"}),f.jsxs(rt,{to:"/setup",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(dA,{className:"sidebar-icon"}),f.jsx("span",{children:"Setup"})]})]})]}),f.jsx("div",{className:"sidebar-footer",children:Bb.map(({label:re,href:me,Icon:$})=>f.jsx("a",{className:"sidebar-footer-icon",href:me,target:"_blank",rel:"noopener noreferrer",title:re,"aria-label":re,children:f.jsx($,{className:"size-4"})},me))})]}),f.jsxs("div",{className:"main-area",children:[f.jsxs("header",{className:"topbar",children:[f.jsxs("div",{className:"topbar-left",children:[f.jsx("div",{className:"topbar-brand-mobile",children:f.jsx(kb,{compact:!0})}),f.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[f.jsx(rt,{to:"/",children:"Home"}),f.jsx($f,{className:"breadcrumb-sep size-3"}),f.jsx("span",{className:"breadcrumb-current",children:et})]})]}),f.jsxs("div",{className:"topbar-actions",children:[f.jsxs("div",{className:"health-pill-row",children:[f.jsxs("span",{className:`health-pill health-pill-${d.apiStatus.state}`,title:$s(d.apiStatus),children:["API ",d.apiStatus.state==="ok"?"ok":d.apiStatus.state]}),f.jsxs("span",{className:`health-pill health-pill-${d.workerStatus.state}`,title:$s(d.workerStatus),children:["Worker ",d.workerStatus.state==="ok"?"ok":d.workerStatus.state]})]}),f.jsxs(Ue,{className:"nav-toggle",variant:"secondary",size:"icon",type:"button","aria-expanded":S,"aria-controls":"mobile-nav",onClick:()=>j(re=>!re),children:[f.jsx(tA,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Open navigation"})]})]})]}),f.jsxs("div",{id:"mobile-nav",className:`mobile-nav ${S?"mobile-nav-open":""}`,children:[f.jsxs(Ue,{className:"mobile-nav-close",variant:"ghost",size:"icon",type:"button",onClick:()=>j(!1),children:[f.jsx(Ps,{className:"size-5"}),f.jsx("span",{className:"sr-only",children:"Close navigation"})]}),f.jsx(rt,{to:"/",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Overview"}),f.jsx(rt,{to:"/projects",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Projects"}),f.jsx(rt,{to:"/runs",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Runs"}),f.jsx(rt,{to:"/traffic",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Server traffic"}),f.jsx(rt,{to:"/settings",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Settings"}),X&&X.projects.length>0?f.jsxs("div",{className:"mobile-nav-section",children:[f.jsx("p",{className:"mobile-nav-section-title",children:"Projects"}),X.projects.map(re=>f.jsx(rt,{to:"/projects/$projectId",params:{projectId:re.project.id},className:"mobile-nav-link",children:re.project.name},re.project.id))]}):null]}),f.jsx("main",{id:"content",className:"page-shell",children:i&&!e?f.jsxs("div",{className:"page-skeleton",children:[f.jsxs("div",{className:"page-skeleton-header",children:[f.jsx("div",{className:"skeleton-text h-6 w-40"}),f.jsx("div",{className:"skeleton-text-sm w-72"})]}),f.jsx("div",{className:"page-skeleton-grid",children:[1,2,3].map(re=>f.jsxs("div",{className:"page-skeleton-card",children:[f.jsx("div",{className:"skeleton-text w-24"}),f.jsx("div",{className:"skeleton-text w-full"}),f.jsx("div",{className:"skeleton-text-sm w-3/4"})]},re))}),f.jsx("div",{className:"page-skeleton-grid",style:{gridTemplateColumns:"1fr 1fr"},children:[1,2].map(re=>f.jsxs("div",{className:"page-skeleton-card",children:[f.jsx("div",{className:"skeleton-text w-20"}),f.jsx("div",{className:"space-y-2",children:[1,2,3].map(me=>f.jsx("div",{className:"skeleton-text-sm w-full"},me))})]},re))})]}):f.jsx(Jb,{})}),f.jsxs("footer",{className:"footer",children:[f.jsxs("span",{className:"footer-brand",children:[f.jsx("span",{children:f.jsx("a",{href:"https://canonry.ai",children:"Canonry"})}),d.apiStatus.version&&d.apiStatus.version!=="unknown"?f.jsxs("span",{className:"footer-version",children:["v",d.apiStatus.version]}):null]}),f.jsx("div",{className:"footer-links",children:Bb.map(({label:re,href:me,Icon:$})=>f.jsx("a",{href:me,target:"_blank",rel:"noopener noreferrer",title:re,"aria-label":re,className:"footer-icon",children:f.jsx($,{className:"size-3.5"})},me))})]})]}),M?f.jsxs(b3,{open:!0,title:M.summary,subtitle:`${M.projectName} · ${M.kindLabel}`,onClose:v,children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[f.jsx(fp,{status:M.status}),f.jsx("span",{className:"text-zinc-400",children:M.startedAt}),f.jsx("span",{className:"text-zinc-500",children:M.duration}),f.jsx("span",{className:"text-zinc-600",children:M.triggerLabel})]}),M.status==="failed"&&M.statusDetail&&f.jsx("p",{className:"text-sm text-rose-300/80 mt-2",children:M.statusDetail}),f.jsxs("div",{className:"mt-4",children:[f.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-2",children:"Activity Log"}),Y?f.jsx("p",{className:"text-sm text-zinc-500",children:"Loading run details..."}):K?.snapshots&&K.snapshots.length>0?f.jsxs("div",{className:"space-y-2",children:[K.snapshots.map(re=>f.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[f.jsx("p",{className:"text-sm font-medium text-zinc-200 truncate",children:re.query??"Unknown query"}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(d3,{provider:re.provider}),f.jsx(Q0,{variant:re.citationState===ic.cited?"success":"neutral",children:re.citationState})]})]}),re.model&&f.jsx("p",{className:"text-[11px] text-zinc-500 font-mono",children:re.model}),re.citedDomains.length>0&&f.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[f.jsx("span",{className:"text-zinc-400",children:"Sources:"})," ",re.citedDomains.join(", ")]}),re.competitorOverlap.length>0&&f.jsxs("p",{className:"text-xs text-rose-400/80 mt-0.5",children:["Competitor cited: ",re.competitorOverlap.join(", ")]}),re.groundingSources&&re.groundingSources.length>0&&f.jsxs("details",{className:"mt-2",children:[f.jsxs("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:[re.groundingSources.length," grounding source",re.groundingSources.length!==1?"s":""]}),f.jsx("ul",{className:"mt-1 space-y-0.5",children:re.groundingSources.map((me,$)=>f.jsx("li",{className:"text-xs text-zinc-500 truncate",children:f.jsx("a",{href:me.uri,target:"_blank",rel:"noopener noreferrer",className:"hover:text-zinc-300",children:me.title||me.uri})},$))})]}),re.answerText&&f.jsxs("details",{className:"mt-1",children:[f.jsx("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:"Answer preview"}),f.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed whitespace-pre-wrap",children:re.answerText})]})]},re.id)),K.status==="running"&&f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[f.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Running remaining queries..."]})]}):K&&K.status==="running"?f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[f.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Waiting for first query result..."]}):K&&K.status==="queued"?f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[f.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-zinc-500 animate-pulse"}),"Run queued, waiting for execution slot..."]}):K&&K.error?f.jsxs("div",{className:"rounded-lg border border-rose-800/40 bg-rose-950/20 p-3",children:[f.jsx("p",{className:"text-sm font-medium text-rose-300 mb-2",children:"Run failed"}),f.jsx("pre",{className:"text-xs text-rose-300/80 whitespace-pre-wrap break-words max-h-48 overflow-y-auto font-mono leading-5",children:xO(K.error)})]}):f.jsx("p",{className:"text-sm text-zinc-500",children:"No snapshot data available."})]})]}):null,ve?f.jsx(w3,{evidence:ve.evidence,project:ve.project,onClose:v}):null,f.jsx(ED,{}),f.jsx(iD,{}),f.jsx(wD,{})]})}class DD extends q.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,i){console.error("[ErrorBoundary]",n,i.componentStack)}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?f.jsx("div",{className:"page-container",children:f.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-20 text-center",children:[f.jsx("div",{className:"rounded-full bg-rose-950/40 p-3",children:f.jsx(wv,{className:"size-6 text-rose-400"})}),f.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Something went wrong"}),f.jsx("p",{className:"text-sm text-zinc-400 max-w-md",children:this.state.error.message||"An unexpected error occurred while rendering this page."}),f.jsxs("div",{className:"flex gap-3 mt-2",children:[f.jsxs(Ue,{variant:"secondary",size:"sm",onClick:this.handleReset,children:[f.jsx(xv,{className:"size-3.5 mr-1.5"}),"Try again"]}),f.jsx(Ue,{variant:"secondary",size:"sm",onClick:()=>{const n=window.__CANONRY_CONFIG__?.basePath?.replace(/\/$/,"")??"";window.location.href=n||"/"},children:"Go home"})]})]})}):this.props.children}}const jn=q.forwardRef(({className:e,...n},i)=>f.jsx("div",{ref:i,className:zn("rounded-xl border border-zinc-800 bg-zinc-950/75 shadow-[0_0_0_1px_rgba(255,255,255,0.01)]",e),...n}));jn.displayName="Card";const Nf=q.forwardRef(({className:e,...n},i)=>f.jsx("div",{ref:i,className:zn("flex flex-col gap-1.5 p-5",e),...n}));Nf.displayName="CardHeader";const kf=q.forwardRef(({className:e,...n},i)=>f.jsx("h3",{ref:i,className:zn("font-medium tracking-tight text-zinc-50",e),...n}));kf.displayName="CardTitle";const Af=q.forwardRef(({className:e,...n},i)=>f.jsx("p",{ref:i,className:zn("text-sm text-zinc-500",e),...n}));Af.displayName="CardDescription";const Ql=q.forwardRef(({className:e,...n},i)=>f.jsx("div",{ref:i,className:zn("p-5 pt-0",e),...n}));Ql.displayName="CardContent";function RD({points:e,tone:n}){const i=q.useId();if(e.length===0)return null;const r=42,l=132,c=5,d=Math.min(...e),g=Math.max(...e)-d||1,b=l-c*2,v=r-c*2,S=e.map((j,_)=>{const C=c+_/Math.max(e.length-1,1)*b,k=c+(1-(j-d)/g)*v;return`${C},${k}`}).join(" ");return f.jsxs("svg",{className:`sparkline sparkline-${n}`,viewBox:`0 0 ${l} ${r}`,"aria-hidden":"true",children:[f.jsx("defs",{children:f.jsx("clipPath",{id:i,children:f.jsx("rect",{x:c,y:c,width:b,height:v,rx:"8"})})}),f.jsx("line",{className:"sparkline-guide",x1:c,x2:l-c,y1:r-c,y2:r-c}),f.jsx("polyline",{clipPath:`url(#${i})`,points:S,vectorEffect:"non-scaling-stroke"})]})}function MD({project:e}){return f.jsxs(rt,{to:"/projects/$projectId",params:{projectId:e.project.id},className:"project-row cursor-pointer",children:[f.jsxs("div",{className:"project-row-primary",children:[f.jsxs("div",{children:[f.jsx("p",{className:"project-name",children:e.project.name}),f.jsx("p",{className:"project-domain",children:e.project.canonicalDomain})]}),f.jsx("p",{className:"project-insight",children:e.insight})]}),f.jsx("div",{className:"project-row-stat",children:f.jsxs("div",{className:"metric-inline-block",children:[f.jsx("p",{className:"metric-inline-label",children:"Answer Visibility"}),f.jsx("p",{className:`metric-inline-value ${e.visibilityTone==="caution"?"text-amber-400":""}`,children:e.visibilityScore}),f.jsx("p",{className:"metric-inline-delta",children:e.visibilityDelta}),e.providerCoverage&&f.jsx("p",{className:"text-[10px] font-medium text-amber-400/80",children:e.providerCoverage})]})}),f.jsx("div",{className:"project-row-stat",children:f.jsxs("div",{className:"metric-inline-block",children:[f.jsx("p",{className:"metric-inline-label",children:"Competitor Pressure"}),f.jsx("p",{className:"metric-inline-value",children:e.competitorPressureLabel}),f.jsxs("p",{className:"metric-inline-delta",children:[e.lastRun.kindLabel," · ",_0(e.lastRun.status)]})]})}),f.jsx("div",{className:"project-row-chart",children:f.jsx(RD,{points:e.trend,tone:C0(e.lastRun.status)})}),f.jsx("span",{className:"project-row-link",children:f.jsx($f,{className:"h-4 w-4 text-zinc-500"})})]})}function BD(){const e=uo(),{dashboard:n,isLoading:i}=xc(),r=n??e?.dashboard;if(!r||i)return f.jsxs("div",{className:"page-skeleton",children:[f.jsxs("div",{className:"page-skeleton-header",children:[f.jsx("div",{className:"skeleton-text h-6 w-32"}),f.jsx("div",{className:"skeleton-text-sm w-64"})]}),f.jsx("div",{className:"space-y-3",children:[1,2,3].map(v=>f.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-4 flex items-center gap-4",children:[f.jsxs("div",{className:"flex-1 space-y-2",children:[f.jsx("div",{className:"skeleton-text w-36"}),f.jsx("div",{className:"skeleton-text-sm w-48"})]}),f.jsx("div",{className:"skeleton-text w-16"}),f.jsx("div",{className:"skeleton-text w-16"}),f.jsx("div",{className:"skeleton h-8 w-20 rounded"})]},v))})]});const l=r.portfolioOverview,m=mp(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},g=o4(l.systemHealth,m,r.settings),{openRun:b}=hp();return f.jsxs("div",{className:"page-container",children:[f.jsxs("div",{className:"page-header",children:[f.jsxs("div",{className:"page-header-left",children:[f.jsx("h1",{className:"page-title",children:"Portfolio"}),f.jsx("p",{className:"page-subtitle",children:"Visibility and execution state across all projects"})]}),f.jsx("div",{className:"page-header-right",children:f.jsx("p",{className:"text-[11px] text-zinc-600",children:l.lastUpdatedAt})})]}),l.projects.length>0?f.jsx("div",{className:"project-list project-list-scrollable",children:l.projects.map(v=>f.jsx(MD,{project:v},v.project.id))}):f.jsxs(jn,{className:"surface-card empty-card",children:[f.jsx("h3",{children:l.emptyState?.title??"No projects yet"}),f.jsx("p",{className:"supporting-copy",children:l.emptyState?.detail}),f.jsx(Ue,{size:"sm",asChild:!0,children:f.jsx(rt,{to:l.emptyState?.ctaHref==="/setup"||!l.emptyState?.ctaHref?"/setup":"/",children:l.emptyState?.ctaLabel??"Launch setup"})})]}),f.jsxs("div",{className:"overview-secondary-grid",children:[l.attentionItems.length>0&&f.jsxs("section",{className:"overview-secondary-section",children:[f.jsx("div",{className:"section-head section-head-inline",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Needs attention"}),f.jsx("h2",{className:"section-title-sm",children:"What changed"})]})}),f.jsx("div",{className:"attention-list attention-list-scrollable",children:l.attentionItems.map(v=>f.jsxs(rt,{to:v.href,className:`attention-item attention-item-${v.tone}`,children:[f.jsxs("div",{children:[f.jsx("p",{className:"attention-title",children:v.title}),f.jsx("p",{className:"attention-detail",children:v.detail})]}),f.jsx("span",{className:"attention-action",children:v.actionLabel})]},v.id))})]}),f.jsxs("section",{className:"overview-secondary-section",children:[f.jsx("div",{className:"section-head section-head-inline",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Recent runs"}),f.jsx("h2",{className:"section-title-sm",children:"Activity"})]})}),f.jsx("div",{className:"compact-stack compact-stack-scrollable",children:l.recentRuns.length>0?l.recentRuns.map(v=>f.jsxs("button",{className:"compact-run",type:"button",onClick:()=>b(v.id),children:[f.jsxs("div",{children:[f.jsx("p",{className:"compact-run-title",children:v.projectName}),f.jsx("p",{className:"compact-run-detail",children:v.summary})]}),f.jsx(fp,{status:v.status})]},v.id)):f.jsx("p",{className:"supporting-copy",children:"Run history appears here after the first launch."})})]})]}),f.jsxs("section",{className:"page-section",children:[f.jsx("div",{className:"section-head section-head-inline",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"System health"}),f.jsx("h2",{className:"section-title-sm",children:"Infrastructure"})]})}),f.jsx("div",{className:"health-grid",children:g.map(v=>f.jsxs(jn,{className:"surface-card compact-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:v.label}),f.jsx("h3",{children:v.detail})]}),f.jsx(Ln,{tone:v.tone,title:v.id==="api"?$s(m.apiStatus):v.id==="worker"?$s(m.workerStatus):void 0,children:v.label})]}),f.jsx("p",{className:"supporting-copy",children:v.meta})]},v.id))})]})]})}const vp=Symbol.for("yaml.alias"),_f=Symbol.for("yaml.document"),Ha=Symbol.for("yaml.map"),o1=Symbol.for("yaml.pair"),Pn=Symbol.for("yaml.scalar"),Ys=Symbol.for("yaml.seq"),An=Symbol.for("yaml.node.type"),Ci=e=>!!e&&typeof e=="object"&&e[An]===vp,jc=e=>!!e&&typeof e=="object"&&e[An]===_f,fo=e=>!!e&&typeof e=="object"&&e[An]===Ha,vt=e=>!!e&&typeof e=="object"&&e[An]===o1,nt=e=>!!e&&typeof e=="object"&&e[An]===Pn,po=e=>!!e&&typeof e=="object"&&e[An]===Ys;function yt(e){if(e&&typeof e=="object")switch(e[An]){case Ha:case Ys:return!0}return!1}function bt(e){if(e&&typeof e=="object")switch(e[An]){case vp:case Ha:case Pn:case Ys:return!0}return!1}const l1=e=>(nt(e)||yt(e))&&!!e.anchor,Si=Symbol("break visit"),LD=Symbol("skip children"),no=Symbol("remove node");function Xs(e,n){const i=qD(n);jc(e)?Es(null,e.contents,i,Object.freeze([e]))===no&&(e.contents=null):Es(null,e,i,Object.freeze([]))}Xs.BREAK=Si;Xs.SKIP=LD;Xs.REMOVE=no;function Es(e,n,i,r){const l=UD(e,n,i,r);if(bt(l)||vt(l))return $D(e,r,l),Es(e,l,i,r);if(typeof l!="symbol"){if(yt(n)){r=Object.freeze(r.concat(n));for(let c=0;c<n.items.length;++c){const d=Es(c,n.items[c],i,r);if(typeof d=="number")c=d-1;else{if(d===Si)return Si;d===no&&(n.items.splice(c,1),c-=1)}}}else if(vt(n)){r=Object.freeze(r.concat(n));const c=Es("key",n.key,i,r);if(c===Si)return Si;c===no&&(n.key=null);const d=Es("value",n.value,i,r);if(d===Si)return Si;d===no&&(n.value=null)}}return l}function qD(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function UD(e,n,i,r){if(typeof i=="function")return i(e,n,r);if(fo(n))return i.Map?.(e,n,r);if(po(n))return i.Seq?.(e,n,r);if(vt(n))return i.Pair?.(e,n,r);if(nt(n))return i.Scalar?.(e,n,r);if(Ci(n))return i.Alias?.(e,n,r)}function $D(e,n,i){const r=n[n.length-1];if(yt(r))r.items[e]=i;else if(vt(r))e==="key"?r.key=i:r.value=i;else if(jc(r))r.contents=i;else{const l=Ci(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${l} parent`)}}const VD={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},GD=e=>e.replace(/[!,[\]{}]/g,n=>VD[n]);class It{constructor(n,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},It.defaultYaml,n),this.tags=Object.assign({},It.defaultTags,i)}clone(){const n=new It(this.yaml,this.tags);return n.docStart=this.docStart,n}atDocument(){const n=new It(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:It.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},It.defaultTags);break}return n}add(n,i){this.atNextDocument&&(this.yaml={explicit:It.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},It.defaultTags),this.atNextDocument=!1);const r=n.trim().split(/[ \t]+/),l=r.shift();switch(l){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[c,d]=r;return this.tags[c]=d,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;const[c]=r;if(c==="1.1"||c==="1.2")return this.yaml.version=c,!0;{const d=/^\d+\.\d+$/.test(c);return i(6,`Unsupported YAML version ${c}`,d),!1}}default:return i(0,`Unknown directive ${l}`,!0),!1}}tagName(n,i){if(n==="!")return"!";if(n[0]!=="!")return i(`Not a valid tag: ${n}`),null;if(n[1]==="<"){const d=n.slice(2,-1);return d==="!"||d==="!!"?(i(`Verbatim tags aren't resolved, so ${n} is invalid.`),null):(n[n.length-1]!==">"&&i("Verbatim tags must end with a >"),d)}const[,r,l]=n.match(/^(.*!)([^!]*)$/s);l||i(`The ${n} tag has no suffix`);const c=this.tags[r];if(c)try{return c+decodeURIComponent(l)}catch(d){return i(String(d)),null}return r==="!"?n:(i(`Could not resolve tag: ${n}`),null)}tagString(n){for(const[i,r]of Object.entries(this.tags))if(n.startsWith(r))return i+GD(n.substring(r.length));return n[0]==="!"?n:`!<${n}>`}toString(n){const i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let l;if(n&&r.length>0&&bt(n.contents)){const c={};Xs(n.contents,(d,m)=>{bt(m)&&m.tag&&(c[m.tag]=!0)}),l=Object.keys(c)}else l=[];for(const[c,d]of r)c==="!!"&&d==="tag:yaml.org,2002:"||(!n||l.some(m=>m.startsWith(d)))&&i.push(`%TAG ${c} ${d}`);return i.join(`
|
|
64
|
+
… (${n.length-2e3} more chars)`:n}catch{return String(e)}}function r1({content:e}){return f.jsx("div",{className:"aero-markdown text-zinc-100",children:f.jsx(gw,{components:{h1:n=>f.jsx("h1",{...n,className:"mt-3 mb-2 text-base font-semibold text-zinc-50"}),h2:n=>f.jsx("h2",{...n,className:"mt-3 mb-2 text-sm font-semibold text-zinc-50"}),h3:n=>f.jsx("h3",{...n,className:"mt-3 mb-1.5 text-sm font-semibold text-zinc-100"}),h4:n=>f.jsx("h4",{...n,className:"mt-2 mb-1 text-xs font-semibold uppercase tracking-wide text-zinc-300"}),p:n=>f.jsx("p",{...n,className:"mb-2 leading-relaxed"}),ul:n=>f.jsx("ul",{...n,className:"mb-2 ml-4 list-disc space-y-1"}),ol:n=>f.jsx("ol",{...n,className:"mb-2 ml-4 list-decimal space-y-1"}),li:n=>f.jsx("li",{...n,className:"marker:text-zinc-600"}),strong:n=>f.jsx("strong",{...n,className:"font-semibold text-zinc-50"}),em:n=>f.jsx("em",{...n,className:"text-zinc-200"}),code:({children:n,...i})=>f.jsx("code",{...i,className:"rounded bg-zinc-800/70 px-1 py-0.5 font-mono text-[12px] text-emerald-200",children:n}),pre:n=>f.jsx("pre",{...n,className:"mb-2 overflow-x-auto rounded-md border border-zinc-800 bg-zinc-900/70 p-3 font-mono text-xs text-zinc-200"}),a:n=>f.jsx("a",{...n,className:"text-emerald-400 underline decoration-emerald-700 hover:decoration-emerald-400",target:"_blank",rel:"noopener noreferrer"}),table:n=>f.jsx("div",{className:"mb-2 overflow-x-auto",children:f.jsx("table",{...n,className:"w-full border-collapse text-xs"})}),thead:n=>f.jsx("thead",{...n,className:"border-b border-zinc-800"}),th:n=>f.jsx("th",{...n,className:"px-2 py-1 text-left font-semibold text-zinc-300"}),tr:n=>f.jsx("tr",{...n,className:"border-b border-zinc-900"}),td:n=>f.jsx("td",{...n,className:"px-2 py-1 text-zinc-200"}),blockquote:n=>f.jsx("blockquote",{...n,className:"mb-2 border-l-2 border-zinc-700 pl-3 italic text-zinc-400"}),hr:()=>f.jsx("hr",{className:"my-3 border-zinc-800"})},children:e})})}function xD(){return f.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),f.jsxs("div",{className:"flex items-center gap-1","aria-label":"Aero is thinking",children:[f.jsx("span",{className:"aero-dot h-1.5 w-1.5 rounded-full bg-emerald-400/80"}),f.jsx("span",{className:"aero-dot aero-dot-2 h-1.5 w-1.5 rounded-full bg-emerald-400/60"}),f.jsx("span",{className:"aero-dot aero-dot-3 h-1.5 w-1.5 rounded-full bg-emerald-400/40"})]})]})}function wD(){const e=Xb(),n=/^\/projects\/([^/]+)/.exec(e.pathname),i=n?decodeURIComponent(n[1]):null,r=un({...op({client:ae}),enabled:i!==null,staleTime:6e4});if(!i)return null;const l=r.data??[],c=l.find(d=>d.id===i)??l.find(d=>d.name===i);return c?f.jsx(dD,{projectName:c.name},c.name):null}function As(e,n){e.invalidateQueries({predicate:i=>{const r=i.queryKey[0];return typeof r?._id=="string"&&r._id.startsWith(n)}})}function wc(e,n,i){switch(e.invalidateQueries({queryKey:lp({client:ae})}),e.invalidateQueries({queryKey:Qs({client:ae})}),n){case Te["answer-visibility"]:case Te["site-audit"]:case Te["backlink-extract"]:return;case Te["gsc-sync"]:case Te["inspect-sitemap"]:As(e,"getApiV1ProjectsByNameGoogleGsc");return;case Te["ga-sync"]:As(e,"getApiV1ProjectsByNameGa");return;case Te["traffic-sync"]:As(e,"getApiV1ProjectsByNameGa"),As(e,"getApiV1ProjectsByNameTraffic");return;case Te["bing-inspect"]:case Te["bing-inspect-sitemap"]:As(e,"getApiV1ProjectsByNameBing");return;case Te["aeo-discover-seed"]:case Te["aeo-discover-probe"]:return;case Te["gbp-sync"]:As(e,"getApiV1ProjectsByNameGbp");return;default:return n}}const Bb=[{label:"GitHub",href:"https://github.com/AINYC/canonry",Icon:Ik},{label:"Docs",href:"https://github.com/AINYC/canonry/tree/main/docs",Icon:Dk},{label:"Changelog",href:"https://github.com/AINYC/canonry/releases",Icon:Vk}],Lb=e=>({label:e,state:"checking",detail:"Checking service health"}),jD={apiStatus:Lb("API"),workerStatus:Lb("Worker")};function ND(e){switch(e){case Te["answer-visibility"]:return"Visibility sweep";case Te["gsc-sync"]:return"GSC sync";case Te["inspect-sitemap"]:return"Sitemap inspection";case Te["ga-sync"]:return"GA sync";case Te["traffic-sync"]:return"Traffic sync";case Te["bing-inspect"]:return"Bing URL inspection";case Te["bing-inspect-sitemap"]:return"Bing sitemap inspection";case Te["site-audit"]:return"Site audit";case Te["backlink-extract"]:return"Backlink extract";case Te["aeo-discover-seed"]:return"Discovery (seed phase)";case Te["aeo-discover-probe"]:return"Discovery (probe phase)";case Te["gbp-sync"]:return"Business Profile sync"}}function kD(e){return e==="completed"?"positive":e==="partial"?"caution":"negative"}function AD(e){const n=ND(e.kind);return e.status==="completed"?`${n} completed`:e.status==="partial"?`${n} completed with partial results`:e.status==="cancelled"?`${n} cancelled`:`${n} failed`}function _D(e,n){return e.error?`${n}: ${Yf(e.error)}`:e.location?`${n} · ${e.location}`:n}function zD(e,n,i){if(n)return n;const r=i.find(l=>l.id===e);return r?.displayName||r?.name||e}function CD(e,n){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,n>0?`${n} skipped at queue time`:null].filter(Boolean).join(", ")}function TD(e){return e.failed>0||e.cancelled>0?"negative":e.partial>0?"caution":"positive"}function ED(){const e=Qa(),n=q.useSyncExternalStore(m4,Ni,Ni),i=Object.keys(n.runs).length>0||Object.keys(n.batches).length>0,r=un({...cp({client:ae}),enabled:i,staleTime:io,refetchInterval:3e3}),l=un({...op({client:ae}),enabled:i}),c=q.useRef({}),d=q.useCallback(()=>{r.refetch()},[r.refetch]);return q.useEffect(()=>{i&&d()},[i,d]),q.useEffect(()=>{if(!i||typeof window>"u")return;const m=()=>{document.visibilityState==="visible"&&d()};return window.addEventListener("focus",d),document.addEventListener("visibilitychange",m),()=>{window.removeEventListener("focus",d),document.removeEventListener("visibilitychange",m)}},[i,d]),q.useEffect(()=>{const m=r.data??[],g=l.data??[],b=Object.fromEntries(m.map(S=>[S.id,S])),v=Object.fromEntries(m.map(S=>[S.id,S.status]));for(const S of Object.values(n.runs)){const j=b[S.runId];if(!j||!y4(j.status)||(c.current[j.id]??S.lastAnnouncedStatus)===j.status)continue;const C=g.find(T=>T.id===j.projectId);if(C&&wc(e,j.kind,C.name),S.sourceAction==="run-all"){gb(j.id);continue}const k=zD(j.projectId,S.projectLabel,g);dn({title:AD(j),detail:_D(j,k),tone:kD(j.status),dedupeKey:`run:${j.id}`,dedupeMode:"replace",cta:{label:"View run",intent:"open-run-drawer",runId:j.id}}),gb(j.id)}for(const S of Object.values(n.batches)){const j=b4(S.runIds,b);j.finished&&(dn({title:"Run-all batch finished",detail:CD(j,S.skippedCount),tone:TD(j),dedupeKey:`batch:${S.batchId}`,dedupeMode:"replace",cta:{label:"View runs",intent:"go-to-runs"}}),g4(S.batchId))}c.current=v},[l.data,r.data,n,e]),null}function OD(){const e=uo(),{dashboard:n,isLoading:i,refetch:r}=xc(),d=mp(!e,e?.health).data??e?.health??jD,m=Xb(),{runId:g,evidenceId:b,closeDrawer:v}=hp(),[S,j]=q.useState(!1),[_,C]=q.useState(()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem("canonry:dismissedUpdateVersion")}catch{return null}}),[k]=q.useState(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("force-update")),T=k?{current:d.apiStatus.version??"0.0.0",latest:k,url:"https://www.npmjs.com/package/@ainyc/canonry",upgradeCommand:"npm install -g @ainyc/canonry"}:d.apiStatus.updateAvailable,R=T&&T.latest!==_,G=()=>{if(T){try{window.localStorage.setItem("canonry:dismissedUpdateVersion",T.latest)}catch{}C(T.latest)}},H=tD(g),K=H.data??null,Y=H.isLoading;q.useEffect(()=>{K&&K.status!=="running"&&K.status!=="queued"&&r()},[K?.status,r]),q.useEffect(()=>{j(!1)},[m.pathname]),q.useEffect(()=>{if(typeof window>"u"||!g&&!b)return;const re=me=>{me.key==="Escape"&&v()};return window.addEventListener("keydown",re),()=>{window.removeEventListener("keydown",re)}},[g,b,v]);const X=n??e?.dashboard??null,D=m.pathname==="/setup"&&X!==null&&X.portfolioOverview.projects.length===0,M=g&&X?z3(X,g):void 0,oe=q.useMemo(()=>m.pathname.match(/^\/projects\/([^/]+)/)?.[1]??null,[m.pathname]),ke=q.useMemo(()=>!oe||!X?null:X.projects.find(re=>re.project.id===oe)?.project.name??null,[oe,X]),{commandCenter:_e}=F3(ke),ve=q.useMemo(()=>{if(b)return T3(_e,X,b)},[b,_e,X]),et=(()=>{const re=m.pathname;if(re==="/")return"Portfolio";if(re==="/projects")return"Projects";if(re==="/runs")return"Runs";if(re==="/settings")return"Settings";if(re==="/setup")return"Setup";if(re==="/backlinks")return"Backlinks";if(re==="/traffic"||re.startsWith("/traffic/"))return"Server traffic";if(re.startsWith("/projects/")){const $=re.split("/").filter(Boolean)[1];if($&&X){const W=X.projects.find(fe=>fe.project.id===$);if(W)return W.project.name}return"Project"}return"Not found"})();return f.jsxs("div",{className:`app-shell ${D?"app-shell-focus":""}`,children:[f.jsx("a",{className:"skip-link",href:"#content",children:"Skip to content"}),!D&&f.jsxs("aside",{className:"sidebar","aria-label":"Primary navigation",children:[f.jsx("div",{className:"sidebar-brand",children:f.jsx(kb,{version:d.apiStatus.version,updateAvailable:R?T:null,onDismissUpdate:G})}),f.jsxs("nav",{className:"sidebar-nav",children:[f.jsxs(rt,{to:"/",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(Kk,{className:"sidebar-icon"}),f.jsx("span",{children:"Overview"})]}),f.jsxs(rt,{to:"/projects",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[f.jsx(Pk,{className:"sidebar-icon"}),f.jsx("span",{children:"Projects"})]}),f.jsxs(rt,{to:"/runs",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(sA,{className:"sidebar-icon"}),f.jsx("span",{children:"Runs"})]}),f.jsxs(rt,{to:"/traffic",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[f.jsx(lA,{className:"sidebar-icon"}),f.jsx("span",{children:"Server traffic"})]}),f.jsxs(rt,{to:"/backlinks",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(Yk,{className:"sidebar-icon"}),f.jsx("span",{children:"Backlinks"})]}),f.jsxs(rt,{to:"/settings",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(mA,{className:"sidebar-icon"}),f.jsx("span",{children:"Settings"})]}),i?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"sidebar-section-title",children:"Projects"}),[1,2,3].map(re=>f.jsxs("div",{className:"sidebar-skeleton-item",children:[f.jsx("span",{className:"skeleton-circle size-2"}),f.jsx("span",{className:"skeleton-text flex-1",style:{width:`${50+re*15}%`}})]},re))]}):X&&X.projects.length>0?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"sidebar-section-title",children:"Projects"}),X.projects.map(re=>{const me=re.visibilitySummary.tone;return f.jsxs(rt,{to:"/projects/$projectId",params:{projectId:re.project.id},className:"sidebar-project",activeProps:{className:"sidebar-project sidebar-project-active"},children:[f.jsx("span",{className:`sidebar-dot sidebar-dot-${me}`}),f.jsx("span",{children:re.project.displayName||re.project.name})]},re.project.id)})]}):i?null:f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"sidebar-section-title",children:"Resources"}),f.jsxs(rt,{to:"/setup",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[f.jsx(dA,{className:"sidebar-icon"}),f.jsx("span",{children:"Setup"})]})]})]}),f.jsx("div",{className:"sidebar-footer",children:Bb.map(({label:re,href:me,Icon:$})=>f.jsx("a",{className:"sidebar-footer-icon",href:me,target:"_blank",rel:"noopener noreferrer",title:re,"aria-label":re,children:f.jsx($,{className:"size-4"})},me))})]}),f.jsxs("div",{className:"main-area",children:[f.jsxs("header",{className:"topbar",children:[f.jsxs("div",{className:"topbar-left",children:[f.jsx("div",{className:"topbar-brand-mobile",children:f.jsx(kb,{compact:!0})}),f.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[f.jsx(rt,{to:"/",children:"Home"}),f.jsx($f,{className:"breadcrumb-sep size-3"}),f.jsx("span",{className:"breadcrumb-current",children:et})]})]}),f.jsxs("div",{className:"topbar-actions",children:[f.jsxs("div",{className:"health-pill-row",children:[f.jsxs("span",{className:`health-pill health-pill-${d.apiStatus.state}`,title:$s(d.apiStatus),children:["API ",d.apiStatus.state==="ok"?"ok":d.apiStatus.state]}),f.jsxs("span",{className:`health-pill health-pill-${d.workerStatus.state}`,title:$s(d.workerStatus),children:["Worker ",d.workerStatus.state==="ok"?"ok":d.workerStatus.state]})]}),f.jsxs(Ue,{className:"nav-toggle",variant:"secondary",size:"icon",type:"button","aria-expanded":S,"aria-controls":"mobile-nav",onClick:()=>j(re=>!re),children:[f.jsx(tA,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Open navigation"})]})]})]}),f.jsxs("div",{id:"mobile-nav",className:`mobile-nav ${S?"mobile-nav-open":""}`,children:[f.jsxs(Ue,{className:"mobile-nav-close",variant:"ghost",size:"icon",type:"button",onClick:()=>j(!1),children:[f.jsx(Ps,{className:"size-5"}),f.jsx("span",{className:"sr-only",children:"Close navigation"})]}),f.jsx(rt,{to:"/",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Overview"}),f.jsx(rt,{to:"/projects",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Projects"}),f.jsx(rt,{to:"/runs",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Runs"}),f.jsx(rt,{to:"/traffic",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Server traffic"}),f.jsx(rt,{to:"/settings",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Settings"}),X&&X.projects.length>0?f.jsxs("div",{className:"mobile-nav-section",children:[f.jsx("p",{className:"mobile-nav-section-title",children:"Projects"}),X.projects.map(re=>f.jsx(rt,{to:"/projects/$projectId",params:{projectId:re.project.id},className:"mobile-nav-link",children:re.project.name},re.project.id))]}):null]}),f.jsx("main",{id:"content",className:"page-shell",children:i&&!e?f.jsxs("div",{className:"page-skeleton",children:[f.jsxs("div",{className:"page-skeleton-header",children:[f.jsx("div",{className:"skeleton-text h-6 w-40"}),f.jsx("div",{className:"skeleton-text-sm w-72"})]}),f.jsx("div",{className:"page-skeleton-grid",children:[1,2,3].map(re=>f.jsxs("div",{className:"page-skeleton-card",children:[f.jsx("div",{className:"skeleton-text w-24"}),f.jsx("div",{className:"skeleton-text w-full"}),f.jsx("div",{className:"skeleton-text-sm w-3/4"})]},re))}),f.jsx("div",{className:"page-skeleton-grid",style:{gridTemplateColumns:"1fr 1fr"},children:[1,2].map(re=>f.jsxs("div",{className:"page-skeleton-card",children:[f.jsx("div",{className:"skeleton-text w-20"}),f.jsx("div",{className:"space-y-2",children:[1,2,3].map(me=>f.jsx("div",{className:"skeleton-text-sm w-full"},me))})]},re))})]}):f.jsx(Jb,{})}),f.jsxs("footer",{className:"footer",children:[f.jsxs("span",{className:"footer-brand",children:[f.jsx("span",{children:f.jsx("a",{href:"https://canonry.ai",children:"Canonry"})}),d.apiStatus.version&&d.apiStatus.version!=="unknown"?f.jsxs("span",{className:"footer-version",children:["v",d.apiStatus.version]}):null]}),f.jsx("div",{className:"footer-links",children:Bb.map(({label:re,href:me,Icon:$})=>f.jsx("a",{href:me,target:"_blank",rel:"noopener noreferrer",title:re,"aria-label":re,className:"footer-icon",children:f.jsx($,{className:"size-3.5"})},me))})]})]}),M?f.jsxs(b3,{open:!0,title:M.summary,subtitle:`${M.projectName} · ${M.kindLabel}`,onClose:v,children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[f.jsx(fp,{status:M.status}),f.jsx("span",{className:"text-zinc-400",children:M.startedAt}),f.jsx("span",{className:"text-zinc-500",children:M.duration}),f.jsx("span",{className:"text-zinc-600",children:M.triggerLabel})]}),M.status==="failed"&&M.statusDetail&&f.jsx("p",{className:"text-sm text-rose-300/80 mt-2",children:M.statusDetail}),f.jsxs("div",{className:"mt-4",children:[f.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-2",children:"Activity Log"}),Y?f.jsx("p",{className:"text-sm text-zinc-500",children:"Loading run details..."}):K?.snapshots&&K.snapshots.length>0?f.jsxs("div",{className:"space-y-2",children:[K.snapshots.map(re=>f.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[f.jsx("p",{className:"text-sm font-medium text-zinc-200 truncate",children:re.query??"Unknown query"}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(d3,{provider:re.provider}),f.jsx(Q0,{variant:re.citationState===ic.cited?"success":"neutral",children:re.citationState})]})]}),re.model&&f.jsx("p",{className:"text-[11px] text-zinc-500 font-mono",children:re.model}),re.citedDomains.length>0&&f.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[f.jsx("span",{className:"text-zinc-400",children:"Sources:"})," ",re.citedDomains.join(", ")]}),re.competitorOverlap.length>0&&f.jsxs("p",{className:"text-xs text-rose-400/80 mt-0.5",children:["Competitor cited: ",re.competitorOverlap.join(", ")]}),re.groundingSources&&re.groundingSources.length>0&&f.jsxs("details",{className:"mt-2",children:[f.jsxs("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:[re.groundingSources.length," grounding source",re.groundingSources.length!==1?"s":""]}),f.jsx("ul",{className:"mt-1 space-y-0.5",children:re.groundingSources.map((me,$)=>f.jsx("li",{className:"text-xs text-zinc-500 truncate",children:f.jsx("a",{href:me.uri,target:"_blank",rel:"noopener noreferrer",className:"hover:text-zinc-300",children:me.title||me.uri})},$))})]}),re.answerText&&f.jsxs("details",{className:"mt-1",children:[f.jsx("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:"Answer preview"}),f.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed whitespace-pre-wrap",children:re.answerText})]})]},re.id)),K.status==="running"&&f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[f.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Running remaining queries..."]})]}):K&&K.status==="running"?f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[f.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Waiting for first query result..."]}):K&&K.status==="queued"?f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[f.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-zinc-500 animate-pulse"}),"Run queued, waiting for execution slot..."]}):K&&K.error?f.jsxs("div",{className:"rounded-lg border border-rose-800/40 bg-rose-950/20 p-3",children:[f.jsx("p",{className:"text-sm font-medium text-rose-300 mb-2",children:"Run failed"}),f.jsx("pre",{className:"text-xs text-rose-300/80 whitespace-pre-wrap break-words max-h-48 overflow-y-auto font-mono leading-5",children:xO(K.error)})]}):f.jsx("p",{className:"text-sm text-zinc-500",children:"No snapshot data available."})]})]}):null,ve?f.jsx(w3,{evidence:ve.evidence,project:ve.project,onClose:v}):null,f.jsx(ED,{}),f.jsx(iD,{}),f.jsx(wD,{})]})}class DD extends q.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,i){console.error("[ErrorBoundary]",n,i.componentStack)}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?f.jsx("div",{className:"page-container",children:f.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-20 text-center",children:[f.jsx("div",{className:"rounded-full bg-rose-950/40 p-3",children:f.jsx(wv,{className:"size-6 text-rose-400"})}),f.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Something went wrong"}),f.jsx("p",{className:"text-sm text-zinc-400 max-w-md",children:this.state.error.message||"An unexpected error occurred while rendering this page."}),f.jsxs("div",{className:"flex gap-3 mt-2",children:[f.jsxs(Ue,{variant:"secondary",size:"sm",onClick:this.handleReset,children:[f.jsx(xv,{className:"size-3.5 mr-1.5"}),"Try again"]}),f.jsx(Ue,{variant:"secondary",size:"sm",onClick:()=>{const n=window.__CANONRY_CONFIG__?.basePath?.replace(/\/$/,"")??"";window.location.href=n||"/"},children:"Go home"})]})]})}):this.props.children}}const jn=q.forwardRef(({className:e,...n},i)=>f.jsx("div",{ref:i,className:zn("rounded-xl border border-zinc-800 bg-zinc-950/75 shadow-[0_0_0_1px_rgba(255,255,255,0.01)]",e),...n}));jn.displayName="Card";const Nf=q.forwardRef(({className:e,...n},i)=>f.jsx("div",{ref:i,className:zn("flex flex-col gap-1.5 p-5",e),...n}));Nf.displayName="CardHeader";const kf=q.forwardRef(({className:e,...n},i)=>f.jsx("h3",{ref:i,className:zn("font-medium tracking-tight text-zinc-50",e),...n}));kf.displayName="CardTitle";const Af=q.forwardRef(({className:e,...n},i)=>f.jsx("p",{ref:i,className:zn("text-sm text-zinc-500",e),...n}));Af.displayName="CardDescription";const Ql=q.forwardRef(({className:e,...n},i)=>f.jsx("div",{ref:i,className:zn("p-5 pt-0",e),...n}));Ql.displayName="CardContent";function RD({points:e,tone:n}){const i=q.useId();if(e.length===0)return null;const r=42,l=132,c=5,d=Math.min(...e),g=Math.max(...e)-d||1,b=l-c*2,v=r-c*2,S=e.map((j,_)=>{const C=c+_/Math.max(e.length-1,1)*b,k=c+(1-(j-d)/g)*v;return`${C},${k}`}).join(" ");return f.jsxs("svg",{className:`sparkline sparkline-${n}`,viewBox:`0 0 ${l} ${r}`,"aria-hidden":"true",children:[f.jsx("defs",{children:f.jsx("clipPath",{id:i,children:f.jsx("rect",{x:c,y:c,width:b,height:v,rx:"8"})})}),f.jsx("line",{className:"sparkline-guide",x1:c,x2:l-c,y1:r-c,y2:r-c}),f.jsx("polyline",{clipPath:`url(#${i})`,points:S,vectorEffect:"non-scaling-stroke"})]})}function MD({project:e}){return f.jsxs(rt,{to:"/projects/$projectId",params:{projectId:e.project.id},className:"project-row cursor-pointer",children:[f.jsxs("div",{className:"project-row-primary",children:[f.jsxs("div",{children:[f.jsx("p",{className:"project-name",children:e.project.name}),f.jsx("p",{className:"project-domain",children:e.project.canonicalDomain})]}),f.jsx("p",{className:"project-insight",children:e.insight})]}),f.jsx("div",{className:"project-row-stat",children:f.jsxs("div",{className:"metric-inline-block",children:[f.jsx("p",{className:"metric-inline-label",children:"Answer Visibility"}),f.jsx("p",{className:`metric-inline-value ${e.visibilityTone==="caution"?"text-amber-400":""}`,children:e.visibilityScore}),f.jsx("p",{className:"metric-inline-delta",children:e.visibilityDelta}),e.providerCoverage&&f.jsx("p",{className:"text-[10px] font-medium text-amber-400/80",children:e.providerCoverage})]})}),f.jsx("div",{className:"project-row-stat",children:f.jsxs("div",{className:"metric-inline-block",children:[f.jsx("p",{className:"metric-inline-label",children:"Competitor Pressure"}),f.jsx("p",{className:"metric-inline-value",children:e.competitorPressureLabel}),f.jsxs("p",{className:"metric-inline-delta",children:[e.lastRun.kindLabel," · ",_0(e.lastRun.status)]})]})}),f.jsx("div",{className:"project-row-chart",children:f.jsx(RD,{points:e.trend,tone:C0(e.lastRun.status)})}),f.jsx("span",{className:"project-row-link",children:f.jsx($f,{className:"h-4 w-4 text-zinc-500"})})]})}function BD(){const e=uo(),{dashboard:n,isLoading:i}=xc(),r=n??e?.dashboard;if(!r||i)return f.jsxs("div",{className:"page-skeleton",children:[f.jsxs("div",{className:"page-skeleton-header",children:[f.jsx("div",{className:"skeleton-text h-6 w-32"}),f.jsx("div",{className:"skeleton-text-sm w-64"})]}),f.jsx("div",{className:"space-y-3",children:[1,2,3].map(v=>f.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-4 flex items-center gap-4",children:[f.jsxs("div",{className:"flex-1 space-y-2",children:[f.jsx("div",{className:"skeleton-text w-36"}),f.jsx("div",{className:"skeleton-text-sm w-48"})]}),f.jsx("div",{className:"skeleton-text w-16"}),f.jsx("div",{className:"skeleton-text w-16"}),f.jsx("div",{className:"skeleton h-8 w-20 rounded"})]},v))})]});const l=r.portfolioOverview,m=mp(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},g=o4(l.systemHealth,m,r.settings),{openRun:b}=hp();return f.jsxs("div",{className:"page-container",children:[f.jsxs("div",{className:"page-header",children:[f.jsxs("div",{className:"page-header-left",children:[f.jsx("h1",{className:"page-title",children:"Portfolio"}),f.jsx("p",{className:"page-subtitle",children:"Visibility and execution state across all projects"})]}),f.jsx("div",{className:"page-header-right",children:f.jsx("p",{className:"text-[11px] text-zinc-600",children:l.lastUpdatedAt})})]}),l.projects.length>0?f.jsx("div",{className:"project-list project-list-scrollable",children:l.projects.map(v=>f.jsx(MD,{project:v},v.project.id))}):f.jsxs(jn,{className:"surface-card empty-card",children:[f.jsx("h3",{children:l.emptyState?.title??"No projects yet"}),f.jsx("p",{className:"supporting-copy",children:l.emptyState?.detail}),f.jsx(Ue,{size:"sm",asChild:!0,children:f.jsx(rt,{to:l.emptyState?.ctaHref==="/setup"||!l.emptyState?.ctaHref?"/setup":"/",children:l.emptyState?.ctaLabel??"Launch setup"})})]}),f.jsxs("div",{className:"overview-secondary-grid",children:[l.attentionItems.length>0&&f.jsxs("section",{className:"overview-secondary-section",children:[f.jsx("div",{className:"section-head section-head-inline",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Needs attention"}),f.jsx("h2",{className:"section-title-sm",children:"What changed"})]})}),f.jsx("div",{className:"attention-list attention-list-scrollable",children:l.attentionItems.map(v=>v.href?f.jsxs(rt,{to:v.href,className:`attention-item attention-item-${v.tone}`,children:[f.jsxs("div",{children:[f.jsx("p",{className:"attention-title",children:v.title}),f.jsx("p",{className:"attention-detail",children:v.detail})]}),v.actionLabel&&f.jsx("span",{className:"attention-action",children:v.actionLabel})]},v.id):f.jsxs("div",{className:`attention-item attention-item-static attention-item-${v.tone}`,children:[f.jsxs("div",{children:[f.jsx("p",{className:"attention-title",children:v.title}),f.jsx("p",{className:"attention-detail",children:v.detail})]}),v.actionLabel&&f.jsx("span",{className:"attention-action",children:v.actionLabel})]},v.id))})]}),f.jsxs("section",{className:"overview-secondary-section",children:[f.jsx("div",{className:"section-head section-head-inline",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Recent runs"}),f.jsx("h2",{className:"section-title-sm",children:"Activity"})]})}),f.jsx("div",{className:"compact-stack compact-stack-scrollable",children:l.recentRuns.length>0?l.recentRuns.map(v=>f.jsxs("button",{className:"compact-run",type:"button",onClick:()=>b(v.id),children:[f.jsxs("div",{children:[f.jsx("p",{className:"compact-run-title",children:v.projectName}),f.jsx("p",{className:"compact-run-detail",children:v.summary})]}),f.jsx(fp,{status:v.status})]},v.id)):f.jsx("p",{className:"supporting-copy",children:"Run history appears here after the first launch."})})]})]}),f.jsxs("section",{className:"page-section",children:[f.jsx("div",{className:"section-head section-head-inline",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"System health"}),f.jsx("h2",{className:"section-title-sm",children:"Infrastructure"})]})}),f.jsx("div",{className:"health-grid",children:g.map(v=>f.jsxs(jn,{className:"surface-card compact-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:v.label}),f.jsx("h3",{children:v.detail})]}),f.jsx(Ln,{tone:v.tone,title:v.id==="api"?$s(m.apiStatus):v.id==="worker"?$s(m.workerStatus):void 0,children:v.label})]}),f.jsx("p",{className:"supporting-copy",children:v.meta})]},v.id))})]})]})}const vp=Symbol.for("yaml.alias"),_f=Symbol.for("yaml.document"),Ha=Symbol.for("yaml.map"),o1=Symbol.for("yaml.pair"),Pn=Symbol.for("yaml.scalar"),Ys=Symbol.for("yaml.seq"),An=Symbol.for("yaml.node.type"),Ci=e=>!!e&&typeof e=="object"&&e[An]===vp,jc=e=>!!e&&typeof e=="object"&&e[An]===_f,fo=e=>!!e&&typeof e=="object"&&e[An]===Ha,vt=e=>!!e&&typeof e=="object"&&e[An]===o1,nt=e=>!!e&&typeof e=="object"&&e[An]===Pn,po=e=>!!e&&typeof e=="object"&&e[An]===Ys;function yt(e){if(e&&typeof e=="object")switch(e[An]){case Ha:case Ys:return!0}return!1}function bt(e){if(e&&typeof e=="object")switch(e[An]){case vp:case Ha:case Pn:case Ys:return!0}return!1}const l1=e=>(nt(e)||yt(e))&&!!e.anchor,Si=Symbol("break visit"),LD=Symbol("skip children"),no=Symbol("remove node");function Xs(e,n){const i=qD(n);jc(e)?Es(null,e.contents,i,Object.freeze([e]))===no&&(e.contents=null):Es(null,e,i,Object.freeze([]))}Xs.BREAK=Si;Xs.SKIP=LD;Xs.REMOVE=no;function Es(e,n,i,r){const l=UD(e,n,i,r);if(bt(l)||vt(l))return $D(e,r,l),Es(e,l,i,r);if(typeof l!="symbol"){if(yt(n)){r=Object.freeze(r.concat(n));for(let c=0;c<n.items.length;++c){const d=Es(c,n.items[c],i,r);if(typeof d=="number")c=d-1;else{if(d===Si)return Si;d===no&&(n.items.splice(c,1),c-=1)}}}else if(vt(n)){r=Object.freeze(r.concat(n));const c=Es("key",n.key,i,r);if(c===Si)return Si;c===no&&(n.key=null);const d=Es("value",n.value,i,r);if(d===Si)return Si;d===no&&(n.value=null)}}return l}function qD(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function UD(e,n,i,r){if(typeof i=="function")return i(e,n,r);if(fo(n))return i.Map?.(e,n,r);if(po(n))return i.Seq?.(e,n,r);if(vt(n))return i.Pair?.(e,n,r);if(nt(n))return i.Scalar?.(e,n,r);if(Ci(n))return i.Alias?.(e,n,r)}function $D(e,n,i){const r=n[n.length-1];if(yt(r))r.items[e]=i;else if(vt(r))e==="key"?r.key=i:r.value=i;else if(jc(r))r.contents=i;else{const l=Ci(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${l} parent`)}}const VD={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},GD=e=>e.replace(/[!,[\]{}]/g,n=>VD[n]);class It{constructor(n,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},It.defaultYaml,n),this.tags=Object.assign({},It.defaultTags,i)}clone(){const n=new It(this.yaml,this.tags);return n.docStart=this.docStart,n}atDocument(){const n=new It(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:It.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},It.defaultTags);break}return n}add(n,i){this.atNextDocument&&(this.yaml={explicit:It.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},It.defaultTags),this.atNextDocument=!1);const r=n.trim().split(/[ \t]+/),l=r.shift();switch(l){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[c,d]=r;return this.tags[c]=d,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;const[c]=r;if(c==="1.1"||c==="1.2")return this.yaml.version=c,!0;{const d=/^\d+\.\d+$/.test(c);return i(6,`Unsupported YAML version ${c}`,d),!1}}default:return i(0,`Unknown directive ${l}`,!0),!1}}tagName(n,i){if(n==="!")return"!";if(n[0]!=="!")return i(`Not a valid tag: ${n}`),null;if(n[1]==="<"){const d=n.slice(2,-1);return d==="!"||d==="!!"?(i(`Verbatim tags aren't resolved, so ${n} is invalid.`),null):(n[n.length-1]!==">"&&i("Verbatim tags must end with a >"),d)}const[,r,l]=n.match(/^(.*!)([^!]*)$/s);l||i(`The ${n} tag has no suffix`);const c=this.tags[r];if(c)try{return c+decodeURIComponent(l)}catch(d){return i(String(d)),null}return r==="!"?n:(i(`Could not resolve tag: ${n}`),null)}tagString(n){for(const[i,r]of Object.entries(this.tags))if(n.startsWith(r))return i+GD(n.substring(r.length));return n[0]==="!"?n:`!<${n}>`}toString(n){const i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let l;if(n&&r.length>0&&bt(n.contents)){const c={};Xs(n.contents,(d,m)=>{bt(m)&&m.tag&&(c[m.tag]=!0)}),l=Object.keys(c)}else l=[];for(const[c,d]of r)c==="!!"&&d==="tag:yaml.org,2002:"||(!n||l.some(m=>m.startsWith(d)))&&i.push(`%TAG ${c} ${d}`);return i.join(`
|
|
65
65
|
`)}}It.defaultYaml={explicit:!1,version:"1.2"};It.defaultTags={"!!":"tag:yaml.org,2002:"};function c1(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function u1(e){const n=new Set;return Xs(e,{Value(i,r){r.anchor&&n.add(r.anchor)}}),n}function d1(e,n){for(let i=1;;++i){const r=`${e}${i}`;if(!n.has(r))return r}}function ID(e,n){const i=[],r=new Map;let l=null;return{onAnchor:c=>{i.push(c),l??(l=u1(e));const d=d1(n,l);return l.add(d),d},setAnchors:()=>{for(const c of i){const d=r.get(c);if(typeof d=="object"&&d.anchor&&(nt(d.node)||yt(d.node)))d.node.anchor=d.anchor;else{const m=new Error("Failed to resolve repeated object (this should not happen)");throw m.source=c,m}}},sourceObjects:r}}function Os(e,n,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let l=0,c=r.length;l<c;++l){const d=r[l],m=Os(e,r,String(l),d);m===void 0?delete r[l]:m!==d&&(r[l]=m)}else if(r instanceof Map)for(const l of Array.from(r.keys())){const c=r.get(l),d=Os(e,r,l,c);d===void 0?r.delete(l):d!==c&&r.set(l,d)}else if(r instanceof Set)for(const l of Array.from(r)){const c=Os(e,r,l,l);c===void 0?r.delete(l):c!==l&&(r.delete(l),r.add(c))}else for(const[l,c]of Object.entries(r)){const d=Os(e,r,l,c);d===void 0?delete r[l]:d!==c&&(r[l]=d)}return e.call(n,i,r)}function kn(e,n,i){if(Array.isArray(e))return e.map((r,l)=>kn(r,String(l),i));if(e&&typeof e.toJSON=="function"){if(!i||!l1(e))return e.toJSON(n,i);const r={aliasCount:0,count:1,res:void 0};i.anchors.set(e,r),i.onCreate=c=>{r.res=c,delete i.onCreate};const l=e.toJSON(n,i);return i.onCreate&&i.onCreate(l),l}return typeof e=="bigint"&&!i?.keep?Number(e):e}class Sp{constructor(n){Object.defineProperty(this,An,{value:n})}clone(){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(n.range=this.range.slice()),n}toJS(n,{mapAsMap:i,maxAliasCount:r,onAnchor:l,reviver:c}={}){if(!jc(n))throw new TypeError("A document argument is required");const d={anchors:new Map,doc:n,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},m=kn(this,"",d);if(typeof l=="function")for(const{count:g,res:b}of d.anchors.values())l(b,g);return typeof c=="function"?Os(c,{"":m},"",m):m}}class xp extends Sp{constructor(n){super(vp),this.source=n,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(n,i){let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],Xs(n,{Node:(c,d)=>{(Ci(d)||l1(d))&&r.push(d)}}),i&&(i.aliasResolveCache=r));let l;for(const c of r){if(c===this)break;c.anchor===this.source&&(l=c)}return l}toJSON(n,i){if(!i)return{source:this.source};const{anchors:r,doc:l,maxAliasCount:c}=i,d=this.resolve(l,i);if(!d){const g=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(g)}let m=r.get(d);if(m||(kn(d,null,i),m=r.get(d)),m?.res===void 0){const g="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(g)}if(c>=0&&(m.count+=1,m.aliasCount===0&&(m.aliasCount=Yl(l,d,r)),m.count*m.aliasCount>c)){const g="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(g)}return m.res}toString(n,i,r){const l=`*${this.source}`;if(n){if(c1(this.source),n.options.verifyAliasOrder&&!n.anchors.has(this.source)){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(c)}if(n.implicitKey)return`${l} `}return l}}function Yl(e,n,i){if(Ci(n)){const r=n.resolve(e),l=i&&r&&i.get(r);return l?l.count*l.aliasCount:0}else if(yt(n)){let r=0;for(const l of n.items){const c=Yl(e,l,i);c>r&&(r=c)}return r}else if(vt(n)){const r=Yl(e,n.key,i),l=Yl(e,n.value,i);return Math.max(r,l)}return 1}const f1=e=>!e||typeof e!="function"&&typeof e!="object";class Ae extends Sp{constructor(n){super(Pn),this.value=n}toJSON(n,i){return i?.keep?this.value:kn(this.value,n,i)}toString(){return String(this.value)}}Ae.BLOCK_FOLDED="BLOCK_FOLDED";Ae.BLOCK_LITERAL="BLOCK_LITERAL";Ae.PLAIN="PLAIN";Ae.QUOTE_DOUBLE="QUOTE_DOUBLE";Ae.QUOTE_SINGLE="QUOTE_SINGLE";const HD="tag:yaml.org,2002:";function PD(e,n,i){if(n){const r=i.filter(c=>c.tag===n),l=r.find(c=>!c.format)??r[0];if(!l)throw new Error(`Tag ${n} not found`);return l}return i.find(r=>r.identify?.(e)&&!r.format)}function oo(e,n,i){if(jc(e)&&(e=e.contents),bt(e))return e;if(vt(e)){const S=i.schema[Ha].createNode?.(i.schema,null,i);return S.items.push(e),S}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:l,onTagObj:c,schema:d,sourceObjects:m}=i;let g;if(r&&e&&typeof e=="object"){if(g=m.get(e),g)return g.anchor??(g.anchor=l(e)),new xp(g.anchor);g={anchor:null,node:null},m.set(e,g)}n?.startsWith("!!")&&(n=HD+n.slice(2));let b=PD(e,n,d.tags);if(!b){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const S=new Ae(e);return g&&(g.node=S),S}b=e instanceof Map?d[Ha]:Symbol.iterator in Object(e)?d[Ys]:d[Ha]}c&&(c(b),delete i.onTagObj);const v=b?.createNode?b.createNode(i.schema,e,i):typeof b?.nodeClass?.from=="function"?b.nodeClass.from(i.schema,e,i):new Ae(e);return n?v.tag=n:b.default||(v.tag=b.tag),g&&(g.node=v),v}function cc(e,n,i){let r=i;for(let l=n.length-1;l>=0;--l){const c=n[l];if(typeof c=="number"&&Number.isInteger(c)&&c>=0){const d=[];d[c]=r,r=d}else r=new Map([[c,r]])}return oo(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const to=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class p1 extends Sp{constructor(n,i){super(n),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(n){const i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return n&&(i.schema=n),i.items=i.items.map(r=>bt(r)||vt(r)?r.clone(n):r),this.range&&(i.range=this.range.slice()),i}addIn(n,i){if(to(n))this.add(i);else{const[r,...l]=n,c=this.get(r,!0);if(yt(c))c.addIn(l,i);else if(c===void 0&&this.schema)this.set(r,cc(this.schema,l,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${l}`)}}deleteIn(n){const[i,...r]=n;if(r.length===0)return this.delete(i);const l=this.get(i,!0);if(yt(l))return l.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(n,i){const[r,...l]=n,c=this.get(r,!0);return l.length===0?!i&&nt(c)?c.value:c:yt(c)?c.getIn(l,i):void 0}hasAllNullValues(n){return this.items.every(i=>{if(!vt(i))return!1;const r=i.value;return r==null||n&&nt(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(n){const[i,...r]=n;if(r.length===0)return this.has(i);const l=this.get(i,!0);return yt(l)?l.hasIn(r):!1}setIn(n,i){const[r,...l]=n;if(l.length===0)this.set(r,i);else{const c=this.get(r,!0);if(yt(c))c.setIn(l,i);else if(c===void 0&&this.schema)this.set(r,cc(this.schema,l,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${l}`)}}}const ZD=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function pa(e,n){return/^\n+$/.test(e)?e.substring(1):n?e.replace(/^(?! *$)/gm,n):e}const xi=(e,n,i)=>e.endsWith(`
|
|
66
66
|
`)?pa(i,n):i.includes(`
|
|
67
67
|
`)?`
|
|
@@ -207,4 +207,4 @@ spec:
|
|
|
207
207
|
`);fe(Fe)}}catch(ee){Cn(ee instanceof Error?ee.message:"Failed to generate queries")}finally{Pe(!1)}}},Zn=async()=>{if(!oe)return;const ee=Wa;if(ee.length!==0){Ri(!0),Oi(null);try{await QN(oe,ee),Mc(!0),await r(),j(4)}catch(Fe){Oi(Fe instanceof Error?Fe.message:"Failed to save competitors")}finally{Ri(!1)}}},$i=async()=>{const ee=Bi.trim();if(ee){ga(!0),Tn(null);try{await FN("gemini",{apiKey:ee}),dn({title:"Gemini configured",detail:"Provider is ready — continuing setup.",tone:"positive",dedupeKey:"setup:gemini:configured",dedupeMode:"drop"}),vo(""),await r()}catch(Fe){Tn(Fe instanceof Error?Fe.message:"Failed to save Gemini key")}finally{ga(!1)}}},ei=async()=>{if(oe){yo(!0);try{const ee=await Mi.mutateAsync({projectName:oe,projectLabel:k||_||oe,sourceAction:"setup-launch"});bo(ee.id),Bc(!0),await r()}catch{}finally{yo(!1)}}},Kn=()=>j(ee=>Math.max(0,ee-1)),So=(()=>{switch(S){case 0:return f.jsxs(jn,{className:"surface-card step-card",children:[f.jsx("div",{className:"section-head",children:f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 1 of 5"}),f.jsx("h2",{children:"System ready"})]})}),f.jsx("p",{className:"supporting-copy",children:"Checking that your Canonry instance is configured and reachable."}),f.jsx("div",{className:"compact-stack",children:b.healthChecks.map(ee=>f.jsxs("div",{className:"health-check-row",children:[f.jsxs("div",{children:[f.jsx("p",{className:"run-row-title",children:ee.label}),f.jsx("p",{className:"supporting-copy",children:ee.detail}),ee.id==="provider"&&ee.state!=="ready"&&f.jsxs("div",{className:"mt-3 rounded-md border border-zinc-800/60 bg-zinc-900/40 p-3 space-y-2",children:[f.jsxs("p",{className:"text-xs text-zinc-400",children:["Paste a Gemini key to enable visibility checks (free at"," ",f.jsx("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noreferrer",className:"text-emerald-400 hover:text-emerald-300 underline underline-offset-2",children:"aistudio.google.com"}),")."]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"password",value:Bi,onChange:Fe=>vo(Fe.target.value),placeholder:"AI... (paste here)",className:"flex-1 rounded-md border border-zinc-800 bg-zinc-950 px-2.5 py-1.5 text-sm text-zinc-100 placeholder:text-zinc-600 focus:border-zinc-600 focus:outline-none font-mono",disabled:nr}),f.jsx(Ue,{type:"button",size:"sm",disabled:nr||!Bi.trim(),onClick:wn($i),children:nr?"Saving...":"Save"})]}),qt&&f.jsx("p",{className:"text-xs text-rose-400",children:qt}),f.jsxs("p",{className:"text-[11px] text-zinc-600",children:["Other providers (OpenAI, Claude, Perplexity) configurable later via"," ",f.jsx(rt,{to:"/settings",className:"text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:"/settings"}),"."]})]})]}),f.jsx(Ln,{tone:ee.state==="ready"?"positive":"caution",title:ee.id==="api"?$s(g.apiStatus):ee.id==="worker"?$s(g.workerStatus):ee.detail,children:ee.state==="ready"?"Ready":"Attention"})]},ee.id))}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",disabled:!qc,onClick:()=>j(1),children:"Continue"})]})]});case 1:return f.jsxs(jn,{className:"surface-card step-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 2 of 5"}),f.jsx("h2",{children:"Create project"})]}),oe?f.jsx(Ln,{tone:"positive",children:"Created"}):null]}),oe?f.jsxs("div",{className:"compact-stack",children:[f.jsxs("p",{className:"text-zinc-300",children:["Project ",f.jsx("span",{className:"text-zinc-100 font-medium",children:oe})," created successfully."]}),f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",onClick:()=>j(2),children:"Continue"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"project-name",children:"Project name"}),f.jsx("input",{id:"project-name",className:"setup-input",type:"text",placeholder:"my-website",value:_,onChange:ee=>C(ee.target.value)}),mt&&mt!==_?f.jsxs("p",{className:"supporting-copy",children:["Slug: ",mt]}):null]}),f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"display-name",children:"Display name (optional)"}),f.jsx("input",{id:"display-name",className:"setup-input",type:"text",placeholder:"My Website",value:k,onChange:ee=>T(ee.target.value)})]}),f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"domain",children:"Canonical domain"}),f.jsx("input",{id:"domain",className:"setup-input",type:"text",placeholder:"example.com",value:R,onChange:ee=>G(ee.target.value)})]}),f.jsxs("div",{className:"setup-field-row",children:[f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"country",children:"Country"}),f.jsx("input",{id:"country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:H,onChange:ee=>K(ee.target.value.toUpperCase())})]}),f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"language",children:"Language"}),f.jsx("input",{id:"language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:Y,onChange:ee=>X(ee.target.value.toLowerCase())})]})]}),f.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3 cursor-pointer hover:border-zinc-700",children:[f.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 rounded border-zinc-700 bg-zinc-950",checked:D,onChange:ee=>M(ee.target.checked)}),f.jsxs("span",{className:"flex-1",children:[f.jsx("span",{className:"block text-sm text-zinc-100",children:"Auto-extract backlinks"}),f.jsxs("span",{className:"block text-xs text-zinc-500 mt-0.5",children:["When a new Common Crawl release syncs, automatically extract backlinks for this project."," ",f.jsx(rt,{to:"/backlinks",className:"text-emerald-400 hover:text-emerald-300 underline underline-offset-2",children:"Manage backlinks"})]})]})]}),et?f.jsx("p",{className:"text-rose-400 text-sm",children:et}):null,f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",disabled:!mt||!R||me,onClick:wn(Li),children:me?"Creating...":"Create project"})]})]})]});case 2:return f.jsxs(jn,{className:"surface-card step-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 3 of 5"}),f.jsx("h2",{children:"Add queries"})]}),je?f.jsxs(Ln,{tone:"positive",children:[Un.length," saved"]}):f.jsxs(Ln,{tone:"neutral",children:[Un.length," quer",Un.length!==1?"ies":"y"]})]}),f.jsx("p",{className:"supporting-copy",children:"Enter the search queries you want to track. One per line."}),je?f.jsxs("div",{className:"compact-stack",children:[f.jsx("ul",{className:"detail-list",children:Un.map(ee=>f.jsx("li",{children:ee},ee))}),f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",onClick:()=>j(3),children:"Continue"})]})]}):f.jsxs("div",{className:"compact-stack",children:[ue.length>0?f.jsxs("div",{className:"compact-stack",children:[f.jsxs("div",{className:"flex items-center gap-2 text-zinc-500 text-xs uppercase tracking-wide",children:[f.jsx("span",{className:"flex-1 border-t border-zinc-800"}),"auto-generate",f.jsx("span",{className:"flex-1 border-t border-zinc-800"})]}),f.jsxs("div",{className:"flex items-end gap-2",children:[f.jsxs("div",{className:"setup-field flex-1",children:[f.jsx("label",{className:"setup-label",htmlFor:"gen-provider",children:"Provider"}),f.jsx("select",{id:"gen-provider",className:"setup-input",value:ne,onChange:ee=>Ne(ee.target.value),children:ue.map(ee=>f.jsxs("option",{value:ee.name,children:[ee.displayName??ee.name,ee.model?` (${ee.model})`:""]},ee.name))})]}),f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"gen-count",children:"Count"}),f.jsx("select",{id:"gen-count",className:"setup-input",value:tt,onChange:ee=>xe(Number(ee.target.value)),children:[3,5,10,15,20].map(ee=>f.jsx("option",{value:ee,children:ee},ee))})]}),f.jsx(Ue,{type:"button",variant:"outline",disabled:$e||!ne,onClick:wn(Ui),children:$e?"Analyzing site...":"Generate"})]}),Ct?f.jsx("p",{className:"text-rose-400 text-sm",children:Ct}):null]}):null,f.jsxs("div",{className:"flex items-center gap-2 text-zinc-500 text-xs uppercase tracking-wide",children:[f.jsx("span",{className:"flex-1 border-t border-zinc-800"}),"or type manually",f.jsx("span",{className:"flex-1 border-t border-zinc-800"})]}),f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"queries",children:"Queries (one per line)"}),f.jsx("textarea",{id:"queries",className:"setup-textarea",rows:6,placeholder:`emergency dentist brooklyn
|
|
208
208
|
best invisalign downtown brooklyn
|
|
209
209
|
pediatric dentist brooklyn heights`,value:W,onChange:ee=>fe(ee.target.value)})]}),Qe?f.jsx("p",{className:"text-rose-400 text-sm",children:Qe}):null,f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",disabled:Un.length===0||le,onClick:wn(qi),children:le?"Saving...":`Save ${Un.length} quer${Un.length!==1?"ies":"y"}`})]})]})]});case 3:return f.jsxs(jn,{className:"surface-card step-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 4 of 5"}),f.jsx("h2",{children:"Add competitors"})]}),Ei?f.jsx(Ln,{tone:"positive",children:"Saved"}):null]}),f.jsx("p",{className:"supporting-copy",children:"Domains that compete for the same queries. One per line."}),Ei?f.jsxs("div",{className:"compact-stack",children:[f.jsx("ul",{className:"detail-list",children:Wa.map(ee=>f.jsx("li",{children:ee},ee))}),f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",onClick:()=>j(4),children:"Continue"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsxs("div",{className:"setup-field",children:[f.jsx("label",{className:"setup-label",htmlFor:"competitors",children:"Competitor domains (one per line)"}),f.jsx("textarea",{id:"competitors",className:"setup-textarea",rows:4,placeholder:`competitor1.com
|
|
210
|
-
competitor2.com`,value:Tt,onChange:ee=>Ws(ee.target.value)})]}),er?f.jsx("p",{className:"text-rose-400 text-sm",children:er}):null,f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:()=>j(4),children:"Skip"}),f.jsx(Ue,{type:"button",disabled:Wa.length===0||Di,onClick:wn(Zn),children:Di?"Saving...":`Save ${Wa.length} competitor${Wa.length!==1?"s":""}`})]})]})]})]});case 4:{const ee=Lc.data,Fe=ee?.status==="completed"||ee?.status==="partial"||ee?.status==="failed"||ee?.status==="cancelled",ti=ee?.snapshots??[],xo=ti.filter(En=>En.citationState==="cited").length,wo=ti.filter(En=>En.answerMentioned===!0).length,ar=new Set(ti.map(En=>En.query).filter(En=>!!En)).size,ir=go?Fe&&(ee?.status==="completed"||ee?.status==="partial")?f.jsx(Ln,{tone:"positive",children:"Complete"}):Fe?f.jsx(Ln,{tone:"negative",children:"Failed"}):f.jsx(Ln,{tone:"caution",children:"Running"}):null;return f.jsxs(jn,{className:"surface-card step-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 5 of 5"}),f.jsx("h2",{children:"Launch first run"})]}),ir]}),go?Fe?ee?.status==="failed"?f.jsxs("div",{className:"compact-stack",children:[f.jsx("p",{className:"text-rose-400",children:"Sweep failed. Inspect the run on the project page for the provider error and retry from there."}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",onClick:()=>{v({to:_e?`/projects/${_e}`:"/"})},children:"Open project"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsxs("p",{className:"text-zinc-300",children:["Sweep complete. Your first answer-visibility snapshot for"," ",f.jsx("span",{className:"text-zinc-100 font-medium",children:oe}),":"]}),f.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-1",children:[f.jsxs("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500",children:"Mentioned"}),f.jsxs("p",{className:"text-2xl font-bold tabular-nums text-zinc-50 mt-1",children:[wo,f.jsxs("span",{className:"text-zinc-600 text-lg",children:[" / ",ar]})]}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:"queries with brand in answer"})]}),f.jsxs("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500",children:"Cited"}),f.jsxs("p",{className:"text-2xl font-bold tabular-nums text-zinc-50 mt-1",children:[xo,f.jsxs("span",{className:"text-zinc-600 text-lg",children:[" / ",ar]})]}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:"queries with domain in sources"})]}),f.jsxs("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500",children:"Snapshots"}),f.jsx("p",{className:"text-2xl font-bold tabular-nums text-zinc-50 mt-1",children:ti.length}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:"total (query × provider)"})]})]}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-1",children:"Full evidence, per-provider breakdown, and suggested next queries on the project dashboard."}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",onClick:()=>{v({to:_e?`/projects/${_e}`:"/"})},children:"Open project dashboard →"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsx("p",{className:"text-zinc-300",children:"Sweep running — typically 30-60s. Polling every 2s…"}),f.jsx("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3 text-xs text-zinc-500",children:f.jsxs("p",{children:["Status: ",f.jsx("span",{className:"text-zinc-300",children:ee?.status??"queued"})]})}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",variant:"outline",onClick:()=>{v({to:_e?`/projects/${_e}`:"/"})},children:"Watch on project page"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsxs("p",{className:"supporting-copy",children:["Everything is configured. Launch an answer-visibility sweep to start tracking citations for ",f.jsx("span",{className:"text-zinc-100 font-medium",children:oe}),"."]}),f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",disabled:Lt,onClick:wn(ei),children:Lt?"Launching...":"Launch visibility sweep"})]})]})]})}default:return null}})();return f.jsxs("div",{className:"page-container",children:[f.jsx("div",{className:"page-header",children:f.jsxs("div",{className:"page-header-left",children:[f.jsx("h1",{className:"page-title",children:"Setup"}),f.jsx("p",{className:"page-subtitle",children:"Create a project, add queries, add competitors, and launch the first run."})]})}),f.jsx(eR,{current:S,labels:W5}),f.jsx("section",{className:"setup-wizard",children:So})]})}function nR(){return f.jsx("div",{className:"page-container",children:f.jsx("section",{className:"page-section",children:f.jsxs(jn,{className:"surface-card empty-card",children:[f.jsx("h1",{children:"Route not found"}),f.jsx("p",{children:"The current path does not map to a dashboard view."}),f.jsx(Ue,{asChild:!0,children:f.jsx(rt,{to:"/",children:"Return to overview"})})]})})})}const Ti=Is(()=>Hs(()=>import("./ProjectPage-ClmLZ1TC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),"ProjectPage"),aR=Is(()=>Hs(()=>import("./RunsPage-k-TX3mbf.js"),__vite__mapDeps([9,1,2,7,5,8]),import.meta.url),"RunsPage"),iR=Is(()=>Hs(()=>import("./SettingsPage-VCOwDDIL.js"),__vite__mapDeps([10,1,7,5,8]),import.meta.url),"SettingsPage"),sR=Is(()=>Hs(()=>import("./BacklinksPage-CEL_F-c1.js"),__vite__mapDeps([11,1,6,7,5,8]),import.meta.url),"BacklinksPage"),rR=Is(()=>Hs(()=>import("./TrafficPage-GgkjI5RL.js"),__vite__mapDeps([12,1,4,13,7,5,8]),import.meta.url),"TrafficPage"),oR=Is(()=>Hs(()=>import("./TrafficSourceDetailPage-DhMF4157.js"),__vite__mapDeps([14,1,13,3,4,5,7,8]),import.meta.url),"TrafficSourceDetailPage");function lR(){return f.jsx(DD,{children:f.jsx(OD,{})})}const en=dw()({component:lR,validateSearch:e=>({runId:typeof e.runId=="string"?e.runId:void 0,evidenceId:typeof e.evidenceId=="string"?e.evidenceId:void 0})}),cR=Bt({getParentRoute:()=>en,path:"/",component:BD,beforeLoad:({context:e})=>{const n=e.queryClient.getQueryData(Qs({client:ae}));if(n&&n.length===0)throw Fb({to:"/setup"})}}),uR=Bt({getParentRoute:()=>en,path:"/projects",component:Q5}),Fa=Bt({getParentRoute:()=>en,path:"/projects/$projectId",component:()=>f.jsx(Jb,{})}),dR=Bt({getParentRoute:()=>Fa,path:"/",component:()=>f.jsx(Ti,{tab:"overview"})}),fR=Bt({getParentRoute:()=>Fa,path:"/search-console",component:()=>f.jsx(Ti,{tab:"search-console"})}),pR=Bt({getParentRoute:()=>Fa,path:"/discovery",component:()=>f.jsx(Ti,{tab:"discovery"})}),mR=Bt({getParentRoute:()=>Fa,path:"/report",component:()=>f.jsx(Ti,{tab:"report"})}),hR=Bt({getParentRoute:()=>Fa,path:"/activity",component:()=>f.jsx(Ti,{tab:"activity"})}),gR=Bt({getParentRoute:()=>Fa,path:"/backlinks",component:()=>f.jsx(Ti,{tab:"backlinks"})}),yR=Bt({getParentRoute:()=>Fa,path:"/settings",component:()=>f.jsx(Ti,{tab:"settings"})}),bR=Bt({getParentRoute:()=>en,path:"/runs",component:aR}),vR=Bt({getParentRoute:()=>en,path:"/settings",component:iR,beforeLoad:({context:e})=>{}}),SR=Bt({getParentRoute:()=>en,path:"/setup",component:tR,beforeLoad:({context:e})=>{const n=e.queryClient.getQueryData(Qs({client:ae}));if(n&&n.length>0)throw Fb({to:"/"})}}),xR=Bt({getParentRoute:()=>en,path:"/backlinks",component:sR}),wR=Bt({getParentRoute:()=>en,path:"/traffic",component:rR}),jR=Bt({getParentRoute:()=>en,path:"/traffic/$projectName/$sourceId",component:oR}),NR=Bt({getParentRoute:()=>en,path:"*",component:nR}),kR=en.addChildren([cR,uR,Fa.addChildren([dR,fR,pR,mR,hR,gR,yR]),bR,vR,SR,xR,wR,jR,NR]);function AR(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const Yb=AR(),_R=Yb==="/"?"":Yb.replace(/\/$/,"");function zR(e,n){return fw({routeTree:kR,basepath:_R||"/",context:{queryClient:e},...n?.initialEntries})}const CR=6e4;function TR(){const[e,n]=q.useState(Fd()?"ready":"checking"),[i,r]=q.useState(""),[l,c]=q.useState(""),[d,m]=q.useState(null),[g,b]=q.useState(!1),[v,S]=q.useState(!1),j=q.useRef(null),_=q.useRef(null),C=()=>{if(!j.current){const R=Sk();_.current=R,j.current=zR(R)}return{queryClient:_.current,router:j.current}};q.useEffect(()=>{if(Fd())return;let R=!1;return Dy().then(G=>{R||(G.authenticated?n("ready"):n(G.setupRequired?"setup":"login"))}).catch(G=>{R||(m(G instanceof Error?G.message:"Failed to reach the Canonry API"),n("login"))}),()=>{R=!0}},[]),q.useEffect(()=>{if(e!=="ready"||Fd())return;const R=setInterval(()=>{Dy().then(G=>{G.authenticated||(S(!0),n(G.setupRequired?"setup":"login"))}).catch(()=>{})},CR);return Oy(()=>{S(!0),n("login")}),()=>{clearInterval(R),Oy(null)}},[e]);const k=async R=>{if(R.preventDefault(),!i.trim()||i.trim().length<8){m("Password must be at least 8 characters");return}if(i!==l){m("Passwords do not match");return}b(!0),m(null);try{if(!(await XN(i.trim())).authenticated){m("Setup failed");return}r(""),c(""),S(!1),n("ready")}catch(G){m(G instanceof Hn||G instanceof Error?G.message:"Setup failed")}finally{b(!1)}},T=async R=>{if(R.preventDefault(),!!i.trim()){b(!0),m(null);try{if(!(await JN(i.trim())).authenticated){m("Incorrect password");return}r(""),S(!1),n("ready")}catch(G){m(G instanceof Hn||G instanceof Error?G.message:"Authentication failed")}finally{b(!1)}}};if(e==="ready"){const{queryClient:R,router:G}=C();return f.jsx(pw,{client:R,children:f.jsx(mw,{router:G})})}return f.jsx("div",{className:"min-h-screen bg-zinc-950 px-4 py-8",children:f.jsx("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md items-center justify-center",children:f.jsx(jn,{className:"surface-card w-full",children:e==="checking"?f.jsx(Ql,{className:"py-8",children:f.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):e==="setup"?f.jsxs(f.Fragment,{children:[f.jsxs(Nf,{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),f.jsx(kf,{children:"Create a dashboard password"}),f.jsx(Af,{children:"Choose a password to protect the Canonry dashboard. You will use this to sign in on future visits."})]}),f.jsx(Ql,{children:f.jsxs("form",{className:"space-y-4",onSubmit:wn(k),children:[f.jsxs("label",{className:"block space-y-1.5",children:[f.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),f.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:i,onChange:R=>r(R.target.value),placeholder:"At least 8 characters"})]}),f.jsxs("label",{className:"block space-y-1.5",children:[f.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Confirm password"}),f.jsx("input",{className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:l,onChange:R=>c(R.target.value),placeholder:"Re-enter password"})]}),d?f.jsx("p",{className:"text-sm text-rose-400",children:d}):null,f.jsx(Ue,{type:"submit",disabled:g||!i.trim()||!l.trim(),children:g?"Setting up…":"Create password & open dashboard"})]})})]}):f.jsxs(f.Fragment,{children:[f.jsxs(Nf,{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),f.jsx(kf,{children:"Sign in to Canonry"}),f.jsx(Af,{children:"Enter your dashboard password to continue."})]}),f.jsxs(Ql,{children:[v?f.jsx("p",{className:"mb-4 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-300",children:"Your session expired — please sign in again."}):null,f.jsxs("form",{className:"space-y-4",onSubmit:wn(T),children:[f.jsxs("label",{className:"block space-y-1.5",children:[f.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),f.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:i,onChange:R=>r(R.target.value),placeholder:"Dashboard password"})]}),d?f.jsx("p",{className:"text-sm text-rose-400",children:d}):null,f.jsx(Ue,{type:"submit",disabled:g||!i.trim(),children:g?"Signing in…":"Open dashboard"})]})]})]})})})})}const P1=document.getElementById("root");if(!P1)throw new Error("Expected #root element for web app bootstrap.");xw.createRoot(P1).render(f.jsx(q.StrictMode,{children:f.jsx(TR,{})}));export{gB as $,PR as A,Ue as B,ic as C,iB as D,rB as E,oB as F,$M as G,tM as H,$l as I,eM as J,aM as K,dn as L,uM as M,uB as N,dB as O,d3 as P,iM as Q,lB as R,SO as S,Ln as T,cB as U,sB as V,nM as W,sM as X,fB as Y,yB as Z,pB as _,LB as a,BR as a$,hB as a0,mB as a1,CM as a2,MM as a3,BM as a4,Hn as a5,LM as a6,MR as a7,Jk as a8,JM as a9,$R as aA,KR as aB,nB as aC,pb as aD,tB as aE,QR as aF,YR as aG,eB as aH,XR as aI,JR as aJ,WR as aK,FR as aL,uo as aM,op as aN,F3 as aO,F5 as aP,Ht as aQ,HN as aR,$B as aS,UB as aT,IR as aU,LR as aV,qR as aW,HR as aX,ZN as aY,IN as aZ,QN as a_,Yk as aa,sA as ab,Te as ac,y4 as ad,Fl as ae,qM as af,gf as ag,CB as ah,RB as ai,MB as aj,BB as ak,rM as al,Qs as am,oM as an,lp as ao,zB as ap,bM as aq,ZB as ar,HM as as,GM as at,PM as au,ZM as av,VM as aw,IM as ax,GR as ay,VR as az,$f as b,UR as b0,PB as b1,_O as b2,bB as b3,SB as b4,nk as b5,xB as b6,hM as b7,mM as b8,wB as b9,X0 as bA,y3 as bB,J0 as bC,F0 as bD,Pk as bE,AM as bF,qy as bG,OB as bH,KM as bI,QM as bJ,ap as bK,aB as bL,Ps as bM,TB as bN,DB as bO,kM as bP,jM as bQ,NM as bR,wM as bS,EB as bT,vB as ba,XM as bb,dM as bc,fM as bd,pM as be,gM as bf,xc as bg,VB as bh,fp as bi,FN as bj,ZR as bk,lM as bl,cM as bm,mp as bn,yM as bo,$s as bp,mb as bq,_M as br,TM as bs,OM as bt,DM as bu,wv as bv,zM as bw,EM as bx,RM as by,f3 as bz,at as c,sT as d,qB as e,FM as f,jn as g,Ab as h,wn as i,UM as j,jB as k,ae as l,NB as m,kB as n,_B as o,AB as p,vM as q,xM as r,SM as s,_0 as t,hp as u,GB as v,IB as w,HB as x,YM as y,WM as z};
|
|
210
|
+
competitor2.com`,value:Tt,onChange:ee=>Ws(ee.target.value)})]}),er?f.jsx("p",{className:"text-rose-400 text-sm",children:er}):null,f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:()=>j(4),children:"Skip"}),f.jsx(Ue,{type:"button",disabled:Wa.length===0||Di,onClick:wn(Zn),children:Di?"Saving...":`Save ${Wa.length} competitor${Wa.length!==1?"s":""}`})]})]})]})]});case 4:{const ee=Lc.data,Fe=ee?.status==="completed"||ee?.status==="partial"||ee?.status==="failed"||ee?.status==="cancelled",ti=ee?.snapshots??[],xo=ti.filter(En=>En.citationState==="cited").length,wo=ti.filter(En=>En.answerMentioned===!0).length,ar=new Set(ti.map(En=>En.query).filter(En=>!!En)).size,ir=go?Fe&&(ee?.status==="completed"||ee?.status==="partial")?f.jsx(Ln,{tone:"positive",children:"Complete"}):Fe?f.jsx(Ln,{tone:"negative",children:"Failed"}):f.jsx(Ln,{tone:"caution",children:"Running"}):null;return f.jsxs(jn,{className:"surface-card step-card",children:[f.jsxs("div",{className:"section-head",children:[f.jsxs("div",{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 5 of 5"}),f.jsx("h2",{children:"Launch first run"})]}),ir]}),go?Fe?ee?.status==="failed"?f.jsxs("div",{className:"compact-stack",children:[f.jsx("p",{className:"text-rose-400",children:"Sweep failed. Inspect the run on the project page for the provider error and retry from there."}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",onClick:()=>{v({to:_e?`/projects/${_e}`:"/"})},children:"Open project"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsxs("p",{className:"text-zinc-300",children:["Sweep complete. Your first answer-visibility snapshot for"," ",f.jsx("span",{className:"text-zinc-100 font-medium",children:oe}),":"]}),f.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-1",children:[f.jsxs("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500",children:"Mentioned"}),f.jsxs("p",{className:"text-2xl font-bold tabular-nums text-zinc-50 mt-1",children:[wo,f.jsxs("span",{className:"text-zinc-600 text-lg",children:[" / ",ar]})]}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:"queries with brand in answer"})]}),f.jsxs("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500",children:"Cited"}),f.jsxs("p",{className:"text-2xl font-bold tabular-nums text-zinc-50 mt-1",children:[xo,f.jsxs("span",{className:"text-zinc-600 text-lg",children:[" / ",ar]})]}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:"queries with domain in sources"})]}),f.jsxs("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500",children:"Snapshots"}),f.jsx("p",{className:"text-2xl font-bold tabular-nums text-zinc-50 mt-1",children:ti.length}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:"total (query × provider)"})]})]}),f.jsx("p",{className:"text-[11px] text-zinc-500 mt-1",children:"Full evidence, per-provider breakdown, and suggested next queries on the project dashboard."}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",onClick:()=>{v({to:_e?`/projects/${_e}`:"/"})},children:"Open project dashboard →"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsx("p",{className:"text-zinc-300",children:"Sweep running — typically 30-60s. Polling every 2s…"}),f.jsx("div",{className:"rounded-md border border-zinc-800/60 bg-zinc-900/30 p-3 text-xs text-zinc-500",children:f.jsxs("p",{children:["Status: ",f.jsx("span",{className:"text-zinc-300",children:ee?.status??"queued"})]})}),f.jsxs("div",{className:"setup-nav",children:[f.jsx("span",{}),f.jsx(Ue,{type:"button",variant:"outline",onClick:()=>{v({to:_e?`/projects/${_e}`:"/"})},children:"Watch on project page"})]})]}):f.jsxs("div",{className:"compact-stack",children:[f.jsxs("p",{className:"supporting-copy",children:["Everything is configured. Launch an answer-visibility sweep to start tracking citations for ",f.jsx("span",{className:"text-zinc-100 font-medium",children:oe}),"."]}),f.jsxs("div",{className:"setup-nav",children:[f.jsx(Ue,{type:"button",variant:"outline",onClick:Kn,children:"Back"}),f.jsx(Ue,{type:"button",disabled:Lt,onClick:wn(ei),children:Lt?"Launching...":"Launch visibility sweep"})]})]})]})}default:return null}})();return f.jsxs("div",{className:"page-container",children:[f.jsx("div",{className:"page-header",children:f.jsxs("div",{className:"page-header-left",children:[f.jsx("h1",{className:"page-title",children:"Setup"}),f.jsx("p",{className:"page-subtitle",children:"Create a project, add queries, add competitors, and launch the first run."})]})}),f.jsx(eR,{current:S,labels:W5}),f.jsx("section",{className:"setup-wizard",children:So})]})}function nR(){return f.jsx("div",{className:"page-container",children:f.jsx("section",{className:"page-section",children:f.jsxs(jn,{className:"surface-card empty-card",children:[f.jsx("h1",{children:"Route not found"}),f.jsx("p",{children:"The current path does not map to a dashboard view."}),f.jsx(Ue,{asChild:!0,children:f.jsx(rt,{to:"/",children:"Return to overview"})})]})})})}const Ti=Is(()=>Hs(()=>import("./ProjectPage-4tWuU1ZR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),"ProjectPage"),aR=Is(()=>Hs(()=>import("./RunsPage-Cdo4jBn4.js"),__vite__mapDeps([9,1,2,7,5,8]),import.meta.url),"RunsPage"),iR=Is(()=>Hs(()=>import("./SettingsPage-N5iccPoU.js"),__vite__mapDeps([10,1,7,5,8]),import.meta.url),"SettingsPage"),sR=Is(()=>Hs(()=>import("./BacklinksPage-Dj4AVTma.js"),__vite__mapDeps([11,1,6,7,5,8]),import.meta.url),"BacklinksPage"),rR=Is(()=>Hs(()=>import("./TrafficPage-pSlQPdDg.js"),__vite__mapDeps([12,1,4,13,7,5,8]),import.meta.url),"TrafficPage"),oR=Is(()=>Hs(()=>import("./TrafficSourceDetailPage-BQx3Evf6.js"),__vite__mapDeps([14,1,13,3,4,5,7,8]),import.meta.url),"TrafficSourceDetailPage");function lR(){return f.jsx(DD,{children:f.jsx(OD,{})})}const en=dw()({component:lR,validateSearch:e=>({runId:typeof e.runId=="string"?e.runId:void 0,evidenceId:typeof e.evidenceId=="string"?e.evidenceId:void 0})}),cR=Bt({getParentRoute:()=>en,path:"/",component:BD,beforeLoad:({context:e})=>{const n=e.queryClient.getQueryData(Qs({client:ae}));if(n&&n.length===0)throw Fb({to:"/setup"})}}),uR=Bt({getParentRoute:()=>en,path:"/projects",component:Q5}),Fa=Bt({getParentRoute:()=>en,path:"/projects/$projectId",component:()=>f.jsx(Jb,{})}),dR=Bt({getParentRoute:()=>Fa,path:"/",component:()=>f.jsx(Ti,{tab:"overview"})}),fR=Bt({getParentRoute:()=>Fa,path:"/search-console",component:()=>f.jsx(Ti,{tab:"search-console"})}),pR=Bt({getParentRoute:()=>Fa,path:"/discovery",component:()=>f.jsx(Ti,{tab:"discovery"})}),mR=Bt({getParentRoute:()=>Fa,path:"/report",component:()=>f.jsx(Ti,{tab:"report"})}),hR=Bt({getParentRoute:()=>Fa,path:"/activity",component:()=>f.jsx(Ti,{tab:"activity"})}),gR=Bt({getParentRoute:()=>Fa,path:"/backlinks",component:()=>f.jsx(Ti,{tab:"backlinks"})}),yR=Bt({getParentRoute:()=>Fa,path:"/settings",component:()=>f.jsx(Ti,{tab:"settings"})}),bR=Bt({getParentRoute:()=>en,path:"/runs",component:aR}),vR=Bt({getParentRoute:()=>en,path:"/settings",component:iR,beforeLoad:({context:e})=>{}}),SR=Bt({getParentRoute:()=>en,path:"/setup",component:tR,beforeLoad:({context:e})=>{const n=e.queryClient.getQueryData(Qs({client:ae}));if(n&&n.length>0)throw Fb({to:"/"})}}),xR=Bt({getParentRoute:()=>en,path:"/backlinks",component:sR}),wR=Bt({getParentRoute:()=>en,path:"/traffic",component:rR}),jR=Bt({getParentRoute:()=>en,path:"/traffic/$projectName/$sourceId",component:oR}),NR=Bt({getParentRoute:()=>en,path:"*",component:nR}),kR=en.addChildren([cR,uR,Fa.addChildren([dR,fR,pR,mR,hR,gR,yR]),bR,vR,SR,xR,wR,jR,NR]);function AR(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const Yb=AR(),_R=Yb==="/"?"":Yb.replace(/\/$/,"");function zR(e,n){return fw({routeTree:kR,basepath:_R||"/",context:{queryClient:e},...n?.initialEntries})}const CR=6e4;function TR(){const[e,n]=q.useState(Fd()?"ready":"checking"),[i,r]=q.useState(""),[l,c]=q.useState(""),[d,m]=q.useState(null),[g,b]=q.useState(!1),[v,S]=q.useState(!1),j=q.useRef(null),_=q.useRef(null),C=()=>{if(!j.current){const R=Sk();_.current=R,j.current=zR(R)}return{queryClient:_.current,router:j.current}};q.useEffect(()=>{if(Fd())return;let R=!1;return Dy().then(G=>{R||(G.authenticated?n("ready"):n(G.setupRequired?"setup":"login"))}).catch(G=>{R||(m(G instanceof Error?G.message:"Failed to reach the Canonry API"),n("login"))}),()=>{R=!0}},[]),q.useEffect(()=>{if(e!=="ready"||Fd())return;const R=setInterval(()=>{Dy().then(G=>{G.authenticated||(S(!0),n(G.setupRequired?"setup":"login"))}).catch(()=>{})},CR);return Oy(()=>{S(!0),n("login")}),()=>{clearInterval(R),Oy(null)}},[e]);const k=async R=>{if(R.preventDefault(),!i.trim()||i.trim().length<8){m("Password must be at least 8 characters");return}if(i!==l){m("Passwords do not match");return}b(!0),m(null);try{if(!(await XN(i.trim())).authenticated){m("Setup failed");return}r(""),c(""),S(!1),n("ready")}catch(G){m(G instanceof Hn||G instanceof Error?G.message:"Setup failed")}finally{b(!1)}},T=async R=>{if(R.preventDefault(),!!i.trim()){b(!0),m(null);try{if(!(await JN(i.trim())).authenticated){m("Incorrect password");return}r(""),S(!1),n("ready")}catch(G){m(G instanceof Hn||G instanceof Error?G.message:"Authentication failed")}finally{b(!1)}}};if(e==="ready"){const{queryClient:R,router:G}=C();return f.jsx(pw,{client:R,children:f.jsx(mw,{router:G})})}return f.jsx("div",{className:"min-h-screen bg-zinc-950 px-4 py-8",children:f.jsx("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md items-center justify-center",children:f.jsx(jn,{className:"surface-card w-full",children:e==="checking"?f.jsx(Ql,{className:"py-8",children:f.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):e==="setup"?f.jsxs(f.Fragment,{children:[f.jsxs(Nf,{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),f.jsx(kf,{children:"Create a dashboard password"}),f.jsx(Af,{children:"Choose a password to protect the Canonry dashboard. You will use this to sign in on future visits."})]}),f.jsx(Ql,{children:f.jsxs("form",{className:"space-y-4",onSubmit:wn(k),children:[f.jsxs("label",{className:"block space-y-1.5",children:[f.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),f.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:i,onChange:R=>r(R.target.value),placeholder:"At least 8 characters"})]}),f.jsxs("label",{className:"block space-y-1.5",children:[f.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Confirm password"}),f.jsx("input",{className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:l,onChange:R=>c(R.target.value),placeholder:"Re-enter password"})]}),d?f.jsx("p",{className:"text-sm text-rose-400",children:d}):null,f.jsx(Ue,{type:"submit",disabled:g||!i.trim()||!l.trim(),children:g?"Setting up…":"Create password & open dashboard"})]})})]}):f.jsxs(f.Fragment,{children:[f.jsxs(Nf,{children:[f.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),f.jsx(kf,{children:"Sign in to Canonry"}),f.jsx(Af,{children:"Enter your dashboard password to continue."})]}),f.jsxs(Ql,{children:[v?f.jsx("p",{className:"mb-4 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-300",children:"Your session expired — please sign in again."}):null,f.jsxs("form",{className:"space-y-4",onSubmit:wn(T),children:[f.jsxs("label",{className:"block space-y-1.5",children:[f.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),f.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:i,onChange:R=>r(R.target.value),placeholder:"Dashboard password"})]}),d?f.jsx("p",{className:"text-sm text-rose-400",children:d}):null,f.jsx(Ue,{type:"submit",disabled:g||!i.trim(),children:g?"Signing in…":"Open dashboard"})]})]})]})})})})}const P1=document.getElementById("root");if(!P1)throw new Error("Expected #root element for web app bootstrap.");xw.createRoot(P1).render(f.jsx(q.StrictMode,{children:f.jsx(TR,{})}));export{gB as $,PR as A,Ue as B,ic as C,iB as D,rB as E,oB as F,$M as G,tM as H,$l as I,eM as J,aM as K,dn as L,uM as M,uB as N,dB as O,d3 as P,iM as Q,lB as R,SO as S,Ln as T,cB as U,sB as V,nM as W,sM as X,fB as Y,yB as Z,pB as _,LB as a,BR as a$,hB as a0,mB as a1,CM as a2,MM as a3,BM as a4,Hn as a5,LM as a6,MR as a7,Jk as a8,JM as a9,$R as aA,KR as aB,nB as aC,pb as aD,tB as aE,QR as aF,YR as aG,eB as aH,XR as aI,JR as aJ,WR as aK,FR as aL,uo as aM,op as aN,F3 as aO,F5 as aP,Ht as aQ,HN as aR,$B as aS,UB as aT,IR as aU,LR as aV,qR as aW,HR as aX,ZN as aY,IN as aZ,QN as a_,Yk as aa,sA as ab,Te as ac,y4 as ad,Fl as ae,qM as af,gf as ag,CB as ah,RB as ai,MB as aj,BB as ak,rM as al,Qs as am,oM as an,lp as ao,zB as ap,bM as aq,ZB as ar,HM as as,GM as at,PM as au,ZM as av,VM as aw,IM as ax,GR as ay,VR as az,$f as b,UR as b0,PB as b1,_O as b2,bB as b3,SB as b4,nk as b5,xB as b6,hM as b7,mM as b8,wB as b9,X0 as bA,y3 as bB,J0 as bC,F0 as bD,Pk as bE,AM as bF,qy as bG,OB as bH,KM as bI,QM as bJ,ap as bK,aB as bL,Ps as bM,TB as bN,DB as bO,kM as bP,jM as bQ,NM as bR,wM as bS,EB as bT,vB as ba,XM as bb,dM as bc,fM as bd,pM as be,gM as bf,xc as bg,VB as bh,fp as bi,FN as bj,ZR as bk,lM as bl,cM as bm,mp as bn,yM as bo,$s as bp,mb as bq,_M as br,TM as bs,OM as bt,DM as bu,wv as bv,zM as bw,EM as bx,RM as by,f3 as bz,at as c,sT as d,qB as e,FM as f,jn as g,Ab as h,wn as i,UM as j,jB as k,ae as l,NB as m,kB as n,_B as o,AB as p,vM as q,xM as r,SM as s,_0 as t,hp as u,GB as v,IB as w,HB as x,YM as y,WM as z};
|