@canonry/canonry 7.58.2 → 7.58.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +5 -0
  2. package/assets/assets/{AgentSetupPage-BSkstQJa.js → AgentSetupPage-CoD9a386.js} +2 -2
  3. package/assets/assets/{AuditHistoryPanel-DAY6GbzH.js → AuditHistoryPanel-DSUKF9GC.js} +1 -1
  4. package/assets/assets/{BacklinksPage-Ci9s8osY.js → BacklinksPage-DIZy0NkW.js} +1 -1
  5. package/assets/assets/{ChartPrimitives-BgY3tqbD.js → ChartPrimitives-CksxPvHn.js} +1 -1
  6. package/assets/assets/{Hint-BsfMSR5e.js → Hint-C0TmIzHX.js} +1 -1
  7. package/assets/assets/{HistoryPage-BM7PM3Ow.js → HistoryPage-B2Xtxu5L.js} +1 -1
  8. package/assets/assets/{InfoTooltip-COkeQYiP.js → InfoTooltip-DV3_9Qp1.js} +1 -1
  9. package/assets/assets/MeasurementPropertyPage-BZmvjMiS.js +4 -0
  10. package/assets/assets/{ProjectPage-Dnev2R09.js → ProjectPage-DMIoYBCF.js} +5 -5
  11. package/assets/assets/RunsPage-DtvesLu2.js +1 -0
  12. package/assets/assets/SettingsPage-BjE3d5Ae.js +1 -0
  13. package/assets/assets/SiteHealthSection-D6RLbM2o.js +2 -0
  14. package/assets/assets/{ToneBadge-Bk7cBexZ.js → ToneBadge-DYEbxp5S.js} +1 -1
  15. package/assets/assets/TrafficPage-CHZlfMgd.js +40 -0
  16. package/assets/assets/{TrafficSourceDetailPage-BVAVo-JO.js → TrafficSourceDetailPage-Dp7AYvRP.js} +1 -1
  17. package/assets/assets/{account-context-ChEngAKj.js → account-context-DHWaWJSr.js} +1 -1
  18. package/assets/assets/{card-qOcJFZhl.js → card-im88-x1b.js} +1 -1
  19. package/assets/assets/{extract-error-message-bWEYiDDO.js → extract-error-message-Bq8oNvfF.js} +1 -1
  20. package/assets/assets/{format-helpers-CvOZG1pt.js → format-helpers-DOEct2q8.js} +1 -1
  21. package/assets/assets/index-CgAMnZFS.js +60 -0
  22. package/assets/assets/index-DElT2Fss.css +1 -0
  23. package/assets/assets/{query-client-nsJhXK9R.js → query-client-BN_-qp71.js} +1 -1
  24. package/assets/assets/{react-query-BKjNH2ek.js → react-query-P6OZ-MPl.js} +1 -1
  25. package/assets/assets/{react-sigma_core.esm.min-C8kc2J6I.js → react-sigma_core.esm.min-TGwpCHs4.js} +1 -1
  26. package/assets/assets/{service-DmVT5F26.js → service-CUJkePNp.js} +1 -1
  27. package/assets/assets/{vendor-lucide-CPeGWK5C.js → vendor-lucide-4KkDquAu.js} +1 -1
  28. package/assets/assets/{vendor-markdown-Bdsu1JLE.js → vendor-markdown-9SSeLNHZ.js} +1 -1
  29. package/assets/assets/vendor-radix-BuErWiA2.js +41 -0
  30. package/assets/assets/{vendor-recharts-CFnqWvWF.js → vendor-recharts-qIim36Mt.js} +1 -1
  31. package/assets/assets/{vendor-tanstack-CXaF1vMI.js → vendor-tanstack-pEsPGDvT.js} +1 -1
  32. package/assets/index.html +15 -15
  33. package/dist/{chunk-4M2HLHCH.js → chunk-6A6BD5KS.js} +1 -1
  34. package/dist/{chunk-R75B6PTV.js → chunk-BNGGUL7F.js} +1 -1
  35. package/dist/{chunk-PWHGWWZE.js → chunk-CFGA6OAK.js} +4 -4
  36. package/dist/{cli-commands-W3HV7ZKP.js → cli-commands-JBLV55EA.js} +1 -1
  37. package/dist/cli.js +2 -2
  38. package/dist/{demo-UBMNDBRF.js → demo-F5TRWB6V.js} +1 -1
  39. package/dist/{demo-server-F4M74FVL.js → demo-server-WIVTG6GH.js} +193 -37
  40. package/dist/index.js +1 -1
  41. package/dist/{init-OYSL3DMF.js → init-LABWY7HI.js} +1 -1
  42. package/dist/{serve-O5HEMDJI.js → serve-3WJL5N2Z.js} +1 -1
  43. package/package.json +1 -1
  44. package/assets/assets/MeasurementPropertyPage-CHzsfcb5.js +0 -4
  45. package/assets/assets/RunsPage-uPCDTjPM.js +0 -1
  46. package/assets/assets/SettingsPage-rBvx_O4A.js +0 -1
  47. package/assets/assets/SiteHealthSection-oBg5h5Ge.js +0 -2
  48. package/assets/assets/TrafficPage-BJSxxkbT.js +0 -40
  49. package/assets/assets/index-BIfsFQb8.js +0 -56
  50. package/assets/assets/index-D67dZGOY.css +0 -1
  51. package/assets/assets/vendor-radix-3k2C0Ly9.js +0 -41
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./react-sigma_core.esm.min-C8kc2J6I.js","./rolldown-runtime-XKyaHtl9.js","./vendor-lucide-CPeGWK5C.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{A as r,C as i,D as a,G as o,K as s,L as c,M as l,S as u,W as d,d as f,h as p,it as m,m as h,o as g,q as _,t as ee,y as te}from"./vendor-lucide-CPeGWK5C.js";import{r as v}from"./vendor-markdown-Bdsu1JLE.js";import{b as y,g as ne}from"./vendor-tanstack-CXaF1vMI.js";import{c as b,f as re,i as ie,m as ae,r as oe,s as se,t as ce}from"./vendor-recharts-CFnqWvWF.js";import{Ct as le,Gr as x,Hr as ue,Jr as de,Kr as fe,Lr as pe,On as S,Sn as me,Ur as C,Wr as he,Zr as ge,bi as _e,ei as ve,hi as ye,i as be,pt as w,qr as xe,r as T,t as E,wt as Se,xt as Ce}from"./ToneBadge-Bk7cBexZ.js";import{r as we}from"./account-context-ChEngAKj.js";import{d as Te,o as D}from"./query-client-nsJhXK9R.js";import{At as Ee,Bt as O,Ft as De,Ht as k,It as A,Lt as Oe,Mt as ke,Nt as Ae,Pt as je,Rt as Me,Vt as j,gt as Ne,jt as M,kt as N,st as Pe,zt as Fe}from"./react-query-BKjNH2ek.js";import{f as Ie,h as P,m as F,n as Le,o as Re,r as ze,s as Be,t as I}from"./ChartPrimitives-BgY3tqbD.js";import{t as L}from"./InfoTooltip-COkeQYiP.js";import{t as Ve}from"./card-qOcJFZhl.js";import{I as He,L as Ue,Qt as We,S as Ge,Xt as Ke,cn as qe,d as Je,f as Ye,g as Xe,m as Ze,p as Qe,t as $e,z as et}from"./index-BIfsFQb8.js";var R=t(m(),1),tt=/^www\./i;function nt(e){if(!e)return null;try{return new URL(e).hostname}catch{return null}}function z(e){return e.trim().toLowerCase().replace(tt,``)}function rt(e,t){if(!t)return!1;try{return z(new URL(e).hostname)===z(t)}catch{return!1}}function it(e,t){if(!e)return``;if(!rt(e,t))return e;let n=new URL(e),r=`${n.pathname}${n.search}${n.hash}`;return r===``?`/`:r}function at(e,t){return it(e.url,t)||e.path||`/`}var ot=n(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=te,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?ee(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function ee(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function te(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),t!==`error`&&v(e,i,{once:!0})})}function v(e,t,n){typeof e.on==`function`&&y(e,`error`,t,n)}function y(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),st=ot();function ct(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var B=ct;typeof Object.assign==`function`&&(B=Object.assign);function V(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function H(e){return typeof e==`object`&&!!e}function U(e){let t;for(t in e)return!1;return!0}function W(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function G(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function lt(e){return!(!H(e)||e.attributes&&!Array.isArray(e.attributes))}function ut(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function K(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done)t=null;else break}while(1);return r}}}function dt(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var ft=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},q=class e extends ft{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},J=class e extends ft{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},Y=class e extends ft{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function pt(e,t){this.key=e,this.attributes=t,this.clear()}pt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function mt(e,t){this.key=e,this.attributes=t,this.clear()}mt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function ht(e,t){this.key=e,this.attributes=t,this.clear()}ht.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function gt(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}gt.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},gt.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];a===void 0?(i[r]=this,this.undirected&&n===r||(this.target[t][n]=this)):(a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this)},gt.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},gt.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var _t=0,vt=1,yt=2,bt=3;function xt(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===_t){if(s=e._nodes.get(r),!s)throw new J(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===bt){if(i=``+i,c=e._edges.get(i),!c)throw new J(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new J(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new J(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===vt?c.source:c.target,l=i,u=a}return[s,l,u]}function St(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=xt(this,t,n,e,r,i);return a.attributes[o]}}function Ct(e,t,n){e.prototype[t]=function(e,r){let[i]=xt(this,t,n,e,r);return i.attributes}}function wt(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=xt(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function Tt(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=xt(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function Et(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=xt(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new q(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function Dt(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=xt(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function Ot(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=xt(this,t,n,e,r,i);if(!H(o))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function kt(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=xt(this,t,n,e,r,i);if(!H(o))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return B(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function At(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=xt(this,t,n,e,r,i);if(typeof o!=`function`)throw new q(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var jt=[{name:e=>`get${e}Attribute`,attacher:St},{name:e=>`get${e}Attributes`,attacher:Ct},{name:e=>`has${e}Attribute`,attacher:wt},{name:e=>`set${e}Attribute`,attacher:Tt},{name:e=>`update${e}Attribute`,attacher:Et},{name:e=>`remove${e}Attribute`,attacher:Dt},{name:e=>`replace${e}Attributes`,attacher:Ot},{name:e=>`merge${e}Attributes`,attacher:kt},{name:e=>`update${e}Attributes`,attacher:At}];function Mt(e){jt.forEach(function({name:t,attacher:n}){n(e,t(`Node`),_t),n(e,t(`Source`),vt),n(e,t(`Target`),yt),n(e,t(`Opposite`),bt)})}function Nt(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=V(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function Pt(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=V(this,i,a,n),!r)throw new J(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Ft(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=V(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function It(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=V(this,o,s,n),!a)throw new J(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function Lt(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=V(this,o,s,n),!a)throw new J(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new q(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function Rt(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=V(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function zt(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=V(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!H(r))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function Bt(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=V(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!H(r))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return B(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function Vt(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=V(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new q(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var Ht=[{name:e=>`get${e}Attribute`,attacher:Nt},{name:e=>`get${e}Attributes`,attacher:Pt},{name:e=>`has${e}Attribute`,attacher:Ft},{name:e=>`set${e}Attribute`,attacher:It},{name:e=>`update${e}Attribute`,attacher:Lt},{name:e=>`remove${e}Attribute`,attacher:Rt},{name:e=>`replace${e}Attributes`,attacher:zt},{name:e=>`merge${e}Attributes`,attacher:Bt},{name:e=>`update${e}Attributes`,attacher:Vt}];function Ut(e){Ht.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var Wt=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function Gt(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function Kt(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function qt(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function Jt(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function Yt(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function Xt(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function Zt(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function Qt(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function X(e,t){if(e.size===0)return dt();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function $t(e,t,n,r,i,a){let o=t?Kt:Gt,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function en(e,t,n,r){let i=[];return $t(!1,e,t,n,r,function(e){i.push(e)}),i}function tn(e,t,n){let r=dt();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=K(r,qt(n.in))),t!==`in`&&n.out!==void 0&&(r=K(r,qt(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=K(r,qt(n.undirected))),r}function nn(e,t,n,r,i,a,o){let s=n?Yt:Jt,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function rn(e,t,n,r,i){let a=[];return nn(!1,e,t,n,r,i,function(e){a.push(e)}),a}function an(e,t,n,r){let i=dt();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=K(i,Xt(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=K(i,Xt(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=K(i,Xt(n.undirected,r))),i}function on(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return Zt(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new J(`Graph.${n}: could not find the "${e}" node in the graph.`);return en(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new J(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${n}: could not find the "${t}" target node in the graph.`);return rn(r,this.multi,i,a,t)}throw new q(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function sn(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r===`mixed`||this.type===`mixed`||r===this.type){if(arguments.length===1)return n=e,Qt(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return $t(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new J(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${a}: could not find the "${t}" target node in the graph.`);return nn(!1,r,this.multi,i,o,t,n)}throw new q(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new q(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new q(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function cn(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,Qt(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return $t(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new J(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${a}: could not find the "${t}" target node in the graph.`);return nn(!0,r,this.multi,i,o,t,n)}throw new q(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function ln(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return dt();if(!arguments.length)return X(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return tn(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${a}: could not find the "${t}" target node in the graph.`);return an(r,i,n,t)}throw new q(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function un(e){Wt.forEach(t=>{on(e,t),sn(e,t),cn(e,t),ln(e,t)})}var dn=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function fn(){this.A=null,this.B=null}fn.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},fn.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function pn(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function mn(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return pn(e,null,r,r.undirected,i);if(typeof n==`string`)return pn(e,null,r,r[n],i)}let a=new fn,o;if(t!==`undirected`){if(n!==`out`){if(o=pn(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=pn(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=pn(e,a,r,r.undirected,i),e&&o))return o}function hn(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return mn(!1,e,t,n,function(e){r.push(e)}),r}function gn(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;o=c===t?l:c,e&&e.has(o.key)&&(o=null)}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function _n(e,t,n){if(e!==`mixed`){if(e===`undirected`)return gn(null,n,n.undirected);if(typeof t==`string`)return gn(null,n,n[t])}let r=dt(),i=new fn;return e!==`undirected`&&(t!==`out`&&(r=K(r,gn(i,n,n.in))),t!==`in`&&(r=K(r,gn(i,n,n.out)))),e!==`directed`&&(r=K(r,gn(i,n,n.undirected))),r}function vn(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new J(`Graph.${n}: could not find the "${e}" node in the graph.`);return hn(r===`mixed`?this.type:r,i,t)}}function yn(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);mn(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new q(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function bn(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new J(`Graph.${o}: could not find the "${e}" node in the graph.`);return mn(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function xn(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return dt();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return _n(r===`mixed`?this.type:r,i,t)}}function Sn(e){dn.forEach(t=>{vn(e,t),yn(e,t),bn(e,t),xn(e,t)})}function Cn(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function wn(e,t){let n={key:e};return U(t.attributes)||(n.attributes=B({},t.attributes)),n}function Tn(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return U(n.attributes)||(r.attributes=B({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function En(e){if(!H(e))throw new q(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new q(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!H(e.attributes)||e.attributes===null))throw new q(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function Dn(e){if(!H(e))throw new q(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new q(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new q(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!H(e.attributes)||e.attributes===null))throw new q(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new q(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var On=ut(),kn=new Set([`directed`,`undirected`,`mixed`]),An=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),jn=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],Mn={allowSelfLoops:!0,multi:!1,type:`mixed`};function Nn(e,t,n){if(n&&!H(n))throw new q(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new Y(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function Pn(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function Fn(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new Y(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new Y(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!H(s))throw new q(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new Y(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new J(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new J(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new Y(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new Y(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new gt(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function In(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new Y(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new Y(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new q(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!H(s))throw new q(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new Y(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new Y(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else B(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new Y(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=Pn(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=Pn(e,o,{}),g=!0),f=new gt(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function Ln(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var Z=class e extends st.EventEmitter{constructor(e){if(super(),e=B({},Mn,e),typeof e.multi!=`boolean`)throw new q(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!kn.has(e.type))throw new q(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new q(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?pt:e.type===`directed`?mt:ht;W(this,`NodeDataClass`,t);let n=`geid_`+On()+`_`,r=0;W(this,`_attributes`,{}),W(this,`_nodes`,new Map),W(this,`_edges`,new Map),W(this,`_directedSize`,0),W(this,`_undirectedSize`,0),W(this,`_directedSelfLoopCount`,0),W(this,`_undirectedSelfLoopCount`,0),W(this,`_edgeKeyGenerator`,()=>{let e;do e=n+r++;while(this._edges.has(e));return e}),W(this,`_options`,e),An.forEach(e=>W(this,e,this[e])),G(this,`order`,()=>this._nodes.size),G(this,`size`,()=>this._edges.size),G(this,`directedSize`,()=>this._directedSize),G(this,`undirectedSize`,()=>this._undirectedSize),G(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),G(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),G(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),G(this,`multi`,this._options.multi),G(this,`type`,this._options.type),G(this,`allowSelfLoops`,this._options.allowSelfLoops),G(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new q(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new q(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new q(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new Y(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new J(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new Y(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new J(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new Y(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new J(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new J(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new J(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Nn(this,e,t).key}mergeNode(e,t){if(t&&!H(t))throw new q(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(B(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new q(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do Ln(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do Ln(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do Ln(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=V(this,e,n,this.type),!t)throw new J(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new J(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return Ln(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new Y(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new Y(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=V(this,e,t,`directed`);if(!n)throw new J(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Ln(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new Y(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new Y(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=V(this,e,t,`undirected`);if(!n)throw new J(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Ln(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new q(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!H(e))throw new q(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!H(e))throw new q(`Graph.mergeAttributes: provided attributes are not a plain object.`);return B(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new q(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new q(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!lt(t))throw new q(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new q(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!lt(t))throw new q(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new q(`Graph.forEachAdjacencyEntry: expecting a callback.`);Cn(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new q(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);Cn(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new q(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);Cn(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new q(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);Cn(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new q(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new q(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new q(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new q(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new q(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new q(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new q(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new q(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=wn(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=Tn(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!H(t))throw new q(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!H(t.attributes))throw new q(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new q(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],En(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new q(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],Dn(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(B({},this._options,t));return n.replaceAttributes(B({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=B({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new Y(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new Y(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Y(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,Fn(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,B({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!An.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,W(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(Z.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=Z.prototype.inspect),jn.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?Fn:In;e.generateKey?Z.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:Z.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),Mt(Z),Ut(Z),un(Z),Sn(Z);var Rn=class extends Z{constructor(e){let t=B({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new q(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new q(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},zn=class extends Z{constructor(e){let t=B({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new q(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new q(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Bn=class extends Z{constructor(e){let t=B({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new q(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},Vn=class extends Z{constructor(e){let t=B({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new q(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new q(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Hn=class extends Z{constructor(e){let t=B({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new q(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new q(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function Un(e){e.from=function(t,n){let r=new e(B({},t.options,n));return r.import(t),r}}Un(Z),Un(Rn),Un(zn),Un(Bn),Un(Vn),Un(Hn),Z.Graph=Z,Z.DirectedGraph=Rn,Z.UndirectedGraph=zn,Z.MultiGraph=Bn,Z.MultiDirectedGraph=Vn,Z.MultiUndirectedGraph=Hn,Z.InvalidArgumentsGraphError=q,Z.NotFoundGraphError=J,Z.UsageGraphError=Y;var Wn={eligible:{property:`--chart-site-health-eligible`,fallback:`#56b4e9`},hidden:{property:`--chart-site-health-hidden`,fallback:`#e69f00`},resource:{property:`--chart-site-health-resource`,fallback:`#d4d4d8`},redirect:{property:`--chart-site-health-redirect`,fallback:`#9aa7b8`},failed:{property:`--chart-site-health-failed`,fallback:`#d55e00`},unchecked:{property:`--chart-site-health-unchecked`,fallback:`#a1a1aa`}},Gn={property:`--chart-neutral-text-dim`,fallback:`#71717a`},Kn=2.5,qn=200,Jn=3,Yn=1.6;function Xn(e){let t=qn/Math.max(qn,e);return Math.max(Jn,9*t**.25)}function Zn(e){return Xn(e)*Yn}var Qn={eligible:Wn.eligible,hidden:Wn.hidden,resource:Wn.resource,redirect:Wn.redirect,failed:Wn.failed,unchecked:Wn.unchecked,dimmedNode:{property:`--chart-neutral-text-dim`,fallback:`#71717a`},edge:Gn,edgeDimmed:{property:`--chart-neutral-text-faint`,fallback:`#52525b`},edgeActive:{property:`--chart-neutral-text`,fallback:`#a1a1aa`},label:{property:`--chart-tooltip-label`,fallback:`#e4e4e7`},background:{property:`--chart-tooltip-bg`,fallback:`#18181b`}},$n=/^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i,er=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/;function tr(e){return $n.test(e)||er.test(e)}var nr=50,rr=.75,ir=[{maxRatio:.2,budget:1/0},{maxRatio:.45,budget:60},{maxRatio:rr,budget:24}];function ar(e){for(let t of ir)if(e<=t.maxRatio)return t.budget;return 1}function or(e){return Math.max(0,Math.min(1,(e.linkScoreNormalized??0)/100))}function sr(e){return e.healthState?e.healthState:de(e)}function cr(e){switch(e){case`eligible`:return`Indexable`;case`hidden`:return`Hidden`;case`resource`:return`Not a page`;case`redirect`:return`Moved`;case`failed`:return`Broken`;case`unchecked`:return`Not checked`}}function lr(e){switch(e){case`eligible`:return`Indexable`;case`hidden`:return`Hidden or points elsewhere`;case`resource`:return`Not a page`;case`redirect`:return`Moved`;case`failed`:return`Broken`;case`unchecked`:return`Not checked`}}function ur(e){switch(e){case`eligible`:return`AI and search engines are allowed to index this page`;case`hidden`:return`This page tells them not to index it, or points them to another page`;case`resource`:return`A file rather than a page, such as a text file or a PDF. Answer engines can still read it`;case`redirect`:return`This address sends visitors to another page`;case`failed`:return`This page could not be loaded`;case`unchecked`:return`This page was found but not checked`}}function dr(e){switch(e){case`eligible`:return`●`;case`hidden`:return`◆`;case`resource`:return`▪`;case`redirect`:return`↗`;case`failed`:return`×`;case`unchecked`:return`○`}}function fr(e,t){return!!t&&e.nodeKey===t}function pr(e,t=!1,n=1){let r=Xn(n),i=Kn+Math.sqrt(or(e))*(r-Kn);return t?Math.max(Zn(n),i):i}function mr(e,t){switch(e){case`eligible`:return t.eligible;case`hidden`:return t.hidden;case`resource`:return t.resource;case`redirect`:return t.redirect;case`failed`:return t.failed;case`unchecked`:return t.unchecked}}function hr(e){return .35+Math.min(1.65,Math.log2(Math.max(1,e)+1)*.28)}function gr(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function _r(e,t,n,r=null){let i=new Vn({allowSelfLoops:!0}),a=new Map;for(let t of e)a.has(t.nodeKey)||a.set(t.nodeKey,t);for(let e of[...a.values()].sort((e,t)=>_e(e.nodeKey,t.nodeKey))){if(!gr(e))continue;let t=sr(e),o=mr(t,n),s=dr(t),c=fr(e,r);i.addNode(e.nodeKey,{x:e.x,y:e.y,size:pr(e,c,a.size),color:o,baseColor:o,label:`${s} ${e.path||`/`}`,nodeKey:e.nodeKey,url:e.url,path:e.path,depth:e.depth,status:t,glyph:s,labelVisibility:c||e.depth===0||e.path.trim()===`/`?`visible`:`auto`,zIndex:c?2:+(e.depth===0),isRoot:c})}let o=new Set;for(let e of[...t].sort((e,t)=>_e(e.edgeKey,t.edgeKey)))!o.has(e.edgeKey)&&e.targetNodeKey&&i.hasNode(e.sourceNodeKey)&&i.hasNode(e.targetNodeKey)&&(o.add(e.edgeKey),i.addDirectedEdgeWithKey(e.edgeKey,e.sourceNodeKey,e.targetNodeKey,{size:hr(e.occurrences),color:n.edge,baseColor:n.edge,followable:e.followable,occurrences:e.occurrences,isTemplate:e.isTemplate===!0,type:`line`,zIndex:0}));return{graph:i,layoutAvailable:e.length===0||i.order>0,omittedNodes:Math.max(0,e.length-i.order),omittedEdges:Math.max(0,t.length-i.size)}}function vr(e,t,n=nr){let r=t.trim().toLocaleLowerCase(),i=Math.max(0,Math.min(nr,Math.floor(n)));return[...e].sort((e,t)=>_e(e.path||e.url,t.path||t.url)||_e(e.nodeKey,t.nodeKey)).filter(e=>gr(e)?!r||`${e.path}\n${e.url}\n${e.nodeKey}`.toLocaleLowerCase().includes(r):!1).slice(0,i)}function yr(e,t,n,r,i=!0){let a=t&&e.hasNode(t)?t:null,o=typeof n==`function`?n:()=>n,s=e.nodes().sort((t,n)=>{let r=e.getNodeAttributes(t),i=e.getNodeAttributes(n);return Number(i.isRoot)-Number(r.isRoot)||i.size-r.size||(r.depth??2**53-1)-(i.depth??2**53-1)||_e(r.path,i.path)||_e(t,n)}),c=new Map(s.map((e,t)=>[e,t])),l=new Set(a?e.neighbors(a).filter(e=>e!==a).sort((e,t)=>(c.get(e)??0)-(c.get(t)??0)).slice(0,8):[]);return{nodeReducer:(t,n)=>{let i={x:n.x,y:n.y,size:n.size,color:n.color,label:n.label,labelVisibility:n.labelVisibility,zIndex:n.zIndex},s=o(),u=s>rr;if(n.isRoot)return t===a?{...i,size:n.size*1.35,labelVisibility:`visible`,zIndex:3}:{...i,labelVisibility:`visible`};if(a)return t===a?{...i,size:n.size*1.35,labelVisibility:`visible`,zIndex:3}:e.areNeighbors(t,a)?u?l.has(t)?{...i,labelVisibility:`auto`}:{...i,labelVisibility:`auto`,label:``}:i:{...i,color:r.dimmedNode,labelVisibility:`auto`,label:``,zIndex:0};let d=ar(s);return d===1/0?i:(c.get(t)??2**53-1)<d?{...i,labelVisibility:`visible`}:{...i,labelVisibility:`auto`,label:``}},edgeReducer:(t,n)=>{let s={size:n.size,color:n.color,zIndex:n.zIndex};if(n.isTemplate&&!i)return{...s,visibility:`hidden`};let c=o()>rr,[l,u]=e.extremities(t);return a&&(l===a||u===a)?{...s,color:r.edgeActive,size:Math.max(1.4,n.size),zIndex:2}:c?{...s,visibility:`hidden`}:a?{...s,color:r.edgeDimmed,size:Math.min(.45,n.size),zIndex:0}:s}}}var Q=v(),br={"layout-failed":{heading:`Map could not be built`,detail:`The map could not be created for this scan. Run a new scan to try again.`},"no-crawl":{heading:`No map yet`,detail:`This scan has no map yet. Run a new scan to create one.`},"legacy-snapshot":{heading:`No map yet`,detail:`This scan has no map yet. Run a new scan to create one.`},"details-unavailable":{heading:`No map yet`,detail:`This scan has no map yet. Run a new scan to create one.`},"empty-crawl":{heading:`No pages to map`,detail:`This scan found no pages to put on a map. Run a new scan to try again.`}};function xr(e){return(e&&br[e])??br[`no-crawl`]}var Sr=class extends R.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`[SiteGraphSigma] the map failed to render`,e,t.componentStack),me({kind:`render`,error:e,component:`site-graph`})}componentDidUpdate(e){this.state.failed&&e.resetToken!==this.props.resetToken&&this.setState({failed:!1})}render(){return this.state.failed?this.props.fallback:this.props.children}},Cr=220;function wr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:Cr}function Tr(e,t,n=`${t}s`){return`${e.toLocaleString()} ${e===1?t:n}`}function Er(e,t,n){let r=window.getComputedStyle(e).getPropertyValue(t).trim();if(r&&!r.includes(`var(`)&&tr(r))return r;let i=document.createElement(`span`);i.style.position=`absolute`,i.style.visibility=`hidden`,i.style.color=`var(${t})`,e.appendChild(i);let a=window.getComputedStyle(i).color.trim();return i.remove(),a&&!a.includes(`var(`)&&tr(a)?a:n}function Dr(e){let t=t=>{let n=Qn[t];return Er(e,n.property,n.fallback)};return{eligible:t(`eligible`),hidden:t(`hidden`),resource:t(`resource`),redirect:t(`redirect`),failed:t(`failed`),unchecked:t(`unchecked`),dimmedNode:t(`dimmedNode`),edge:t(`edge`),edgeDimmed:t(`edgeDimmed`),edgeActive:t(`edgeActive`),label:t(`label`),background:t(`background`)}}function Or(){if(typeof document>`u`)return!1;try{return!!document.createElement(`canvas`).getContext(`webgl2`)}catch{return!1}}function kr({onOpenInventory:e}){return(0,Q.jsx)(`div`,{className:`flex h-full min-h-80 items-center justify-center px-6 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-md`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-heading`,children:`Interactive map unavailable`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`This browser could not start WebGL. The page inventory remains available for the complete crawl.`}),e&&(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-4`,onClick:e,children:`Open page inventory`})]})})}function Ar({onRetry:e}){return(0,Q.jsx)(`div`,{className:`flex h-full min-h-80 items-center justify-center px-6 text-center`,role:`alert`,children:(0,Q.jsxs)(`div`,{className:`max-w-md`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-heading`,children:`The map could not be drawn`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`Something went wrong while drawing this map. The page inventory below is unaffected.`}),(0,Q.jsx)(T,{variant:`secondary`,size:`sm`,className:`mt-4`,onClick:e,children:`Try again`})]})})}function jr({setReducers:e,reactSigma:t,graph:n,theme:r,selectedNodeKey:i,showTemplateLinks:a,onSelectNodeKey:o,onHoverNode:s,onCameraReady:c}){let{useSigma:l,useRegisterEvents:u,useCamera:d}=t,f=l(),p=u(),{zoomIn:m,zoomOut:h,reset:g,gotoNode:_}=d(),[ee,te]=(0,R.useState)(null),v=ee??i,y=(0,R.useRef)(null),ne=(0,R.useRef)({overview:!0,budget:NaN});return(0,R.useEffect)(()=>()=>{y.current!==null&&cancelAnimationFrame(y.current)},[]),(0,R.useEffect)(()=>{let e=wr();return c({zoomIn:()=>m({duration:e}),zoomOut:()=>h({duration:e}),reset:()=>g({duration:e}),gotoNode:t=>_(t,{duration:e})}),()=>c(null)},[_,c,g,m,h]),(0,R.useEffect)(()=>{p({enterNode:({node:e,event:t})=>{te(e),s({nodeKey:e,left:Number.isFinite(t.x)?t.x+14:20,top:Number.isFinite(t.y)?t.y+14:20})},leaveNode:()=>{te(null),s(null)},clickNode:({node:e})=>o(e),clickStage:()=>s(null),updated:()=>{y.current===null&&(y.current=requestAnimationFrame(()=>{y.current=null;let e=f.getCamera().getState().ratio>rr,t=ar(f.getCamera().getState().ratio);(e!==ne.current.overview||t!==ne.current.budget)&&(ne.current={overview:e,budget:t},f.refresh())}))}})},[s,o,p,f]),(0,R.useEffect)(()=>{if(f.getGraph()!==n)return;e(yr(n,v,()=>f.getCamera().getState().ratio,r,a));let t=f.getCamera().getState().ratio;ne.current={overview:t>rr,budget:ar(t)},f.refresh()},[v,n,a,f,r,e]),null}function Mr({nodes:e,edges:t,layoutState:n=`ready`,layoutUnavailableReason:i,rootNodeKey:o=null,showTemplateLinks:s=!0,selectedNodeKey:c,onSelectNode:l,onOpenInventory:d,ariaLabel:f,className:p}){let m=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useRef)(null),ee=(0,R.useId)(),te=(0,R.useId)(),v=(0,R.useId)(),[y,ne]=(0,R.useState)(null),[b,re]=(0,R.useState)(null),[ie,ae]=(0,R.useState)(`checking`),[oe,se]=(0,R.useState)(!1),[ce,le]=(0,R.useState)(null),[x,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(``),[pe,S]=(0,R.useState)(!1),[me,C]=(0,R.useState)(0),[ge,_e]=(0,R.useState)(``),[ve,ye]=(0,R.useState)(0),w=(0,R.useRef)(null),xe=(0,R.useDeferredValue)(de),E=c===void 0?ce:c,Se=(0,R.useMemo)(()=>new Map(e.map(e=>[e.nodeKey,e])),[e]),Ce=(0,R.useMemo)(()=>nt(o?Se.get(o)?.url:null),[Se,o]),we=(0,R.useCallback)(e=>at(e,Ce),[Ce]),Te=E?Se.get(E)??null:null,D=x?Se.get(x.nodeKey)??null:null,Ee=(0,R.useMemo)(()=>vr(e,xe),[xe,e]),O=e.some(e=>Number.isFinite(e.x)&&Number.isFinite(e.y)),De=(0,R.useMemo)(()=>y?_r(e,t,y,o):null,[t,e,o,y]),k=(0,R.useMemo)(()=>{if(!y||!De)return null;let e=yr(De.graph,null,1,y,!1);return{options:{nodeReducer:(t,n,r)=>e.nodeReducer(t,r),edgeReducer:(t,n,r)=>e.edgeReducer(t,r),settings:{allowInvalidContainer:!0,enableCameraPanning:!0,enableCameraZooming:!0,enableCameraRotation:!1,enableEdgeEvents:!1,hideEdgesOnMove:!0,hideLabelsOnMove:!0,itemSizesReference:`screen`,labelDensity:.07,labelGridCellSize:140,labelRenderedSizeThreshold:8,maxCameraRatio:12,minCameraRatio:.04,minEdgeThickness:.35,renderEdgeLabels:!1,renderLabels:!0,stagePadding:42},styles:{nodes:{x:{attribute:`x`},y:{attribute:`y`},size:{attribute:`size`},label:{attribute:`label`},depth:{whenState:`isHovered`,then:`topNodes`,else:`nodes`},visibility:`visible`,backdropVisibility:{whenState:`isHovered`,then:`visible`,else:`hidden`},color:{attribute:`color`,defaultValue:y.unchecked},labelColor:y.label,labelFont:`600 Geist Variable, Geist, sans-serif`,labelSize:13,labelPosition:`right`,backdropColor:y.background,backdropBorderColor:y.edgeActive,backdropBorderWidth:1.5,backdropPadding:3,backdropCornerRadius:5,backdropLabelPadding:8},edges:{size:{attribute:`size`},depth:`edges`,visibility:`visible`,color:{attribute:`color`,defaultValue:y.edge},path:`straight`}}},setReducers:t=>{e=t}}},[De,y]);(0,R.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>ne(Dr(e));if(t(),typeof MutationObserver>`u`)return;let n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`,`style`]}),()=>n.disconnect()},[]),(0,R.useEffect)(()=>{e.length===0||n===`unavailable`||!O?ae(`checking`):ae(Or()?`ready`:`unavailable`)},[O,n,e.length]),(0,R.useEffect)(()=>{if(ie!==`ready`){re(null);return}let e=!0;return $e(()=>import(`./react-sigma_core.esm.min-C8kc2J6I.js`).then(t=>{e&&re(t)}),__vite__mapDeps([0,1,2]),import.meta.url).catch(()=>{e&&ae(`unavailable`)}),()=>{e=!1}},[ie]),(0,R.useEffect)(()=>{C(0)},[xe]);let A=(0,R.useCallback)(e=>{_.current=e,se(!!e)},[]),Oe=(0,R.useCallback)(e=>{ue(e)},[]),ke=(0,R.useCallback)((e,t)=>{let n=Se.get(e);n&&(c===void 0&&le(e),l?.(n),t&&_.current?.gotoNode(e),_e(`Focused ${we(n)}`))},[Se,l,we,c]),Ae=(0,R.useCallback)(e=>{ke(e,!1)},[ke]);(0,R.useEffect)(()=>{!oe||!c||!Se.has(c)?c||(w.current=null):w.current!==c&&(_.current?.gotoNode(c),w.current=c)},[oe,Se,c]);let je=e=>{ke(e.nodeKey,!0),fe(we(e)),S(!1)},Me=()=>{window.setTimeout(()=>{document.activeElement!==g.current&&S(!1)},0)},j=`Interactive site map showing ${Tr(e.length,`page`)} and ${Tr(t.length,`internal link`)}`,Ne=e=>`${te}-${e.replaceAll(/[^\w-]/g,`-`)}`,M=xr(i);if(n===`unavailable`)return(0,Q.jsx)(`section`,{ref:m,role:`group`,"aria-label":f??j,className:be(`flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center`,p),children:(0,Q.jsxs)(`div`,{className:`max-w-md`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-heading`,children:M.heading}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:M.detail}),d&&(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-4`,onClick:d,children:`Open page inventory`})]})});if(e.length===0)return(0,Q.jsx)(`section`,{ref:m,role:`group`,"aria-label":f??j,className:be(`flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center`,p),children:(0,Q.jsxs)(`div`,{className:`max-w-md`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-secondary`,children:`No page graph is available for this scan.`}),d&&(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-4`,onClick:d,children:`Open page inventory`})]})});if(!O)return(0,Q.jsx)(`section`,{ref:m,role:`group`,"aria-label":f??j,className:be(`flex min-h-80 items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center`,p),children:(0,Q.jsxs)(`div`,{className:`max-w-md`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-heading`,children:M.heading}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:M.detail}),d&&(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-4`,onClick:d,children:`Open page inventory`})]})});let N=Ee.at(me),Pe=(0,Q.jsx)(Ar,{onRetry:()=>ye(e=>e+1)}),Fe=b?.SigmaContainer;return(0,Q.jsxs)(`section`,{ref:m,role:`group`,"aria-label":f??j,"aria-describedby":v,className:be(`flex h-[clamp(460px,62vh,680px)] min-h-[460px] flex-col overflow-hidden rounded-lg border border-default bg-surface-inset`,p),children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-subtle bg-bg-elevated/70 px-3 py-2`,children:[(0,Q.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:`Focus a page in the site map`}),(0,Q.jsxs)(`div`,{className:`relative min-w-56 max-w-lg flex-1`,children:[(0,Q.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted`,"aria-hidden":`true`}),(0,Q.jsx)(`input`,{id:ee,ref:g,role:`combobox`,type:`search`,autoComplete:`off`,"aria-label":`Focus a page in the site map`,"aria-autocomplete":`list`,"aria-controls":te,"aria-expanded":pe,"aria-activedescendant":pe&&N?Ne(N.nodeKey):void 0,value:de,placeholder:Te?`Focused: ${we(Te)}`:`Find a page`,className:`h-10 w-full rounded-md border border-base bg-bg py-2 pl-9 pr-3 text-sm text-primary placeholder-mono-600 outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,onFocus:()=>S(!0),onBlur:Me,onChange:e=>{fe(e.target.value),S(!0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),S(!0),C(e=>Math.max(0,Math.min(Ee.length-1,e+1)))):e.key===`ArrowUp`?(e.preventDefault(),C(e=>Math.max(0,e-1))):e.key===`Enter`&&pe&&N?(e.preventDefault(),je(N)):e.key===`Escape`&&S(!1)}}),pe&&(0,Q.jsxs)(`div`,{className:`absolute left-0 right-0 top-[calc(100%+0.25rem)] z-30 overflow-hidden rounded-md border border-base bg-bg shadow-lg`,children:[(0,Q.jsx)(`div`,{id:te,role:`listbox`,"aria-label":`Matching pages`,className:`max-h-72 overflow-auto py-1`,children:Ee.length>0?Ee.map((e,t)=>{let n=sr(e);return(0,Q.jsxs)(`button`,{id:Ne(e.nodeKey),type:`button`,role:`option`,"aria-selected":t===me,tabIndex:-1,className:be(`flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-left text-sm outline-none`,t===me?`bg-surface-active text-primary`:`text-secondary hover:bg-surface-hover hover:text-primary`),onPointerDown:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>C(t),onClick:()=>je(e),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:we(e)}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[13px] text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono font-semibold`,style:{color:`var(${Wn[n].property})`},"aria-hidden":`true`,children:dr(n)}),(0,Q.jsx)(`span`,{title:ur(n),children:cr(n)})]})]},e.nodeKey)}):(0,Q.jsx)(`p`,{className:`px-3 py-4 text-sm text-secondary`,children:`No rendered pages match.`})}),Ee.length===50&&(0,Q.jsx)(`p`,{className:`border-t border-subtle px-3 py-2 text-[13px] text-muted`,children:`First 50 matches. Refine the search or use the full page inventory.`})]})]}),(0,Q.jsxs)(`span`,{className:`text-[13px] tabular-nums text-muted`,children:[Tr(e.length,`page`),` · `,Tr(t.length,`link`)]})]}),(0,Q.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:ie===`unavailable`?(0,Q.jsx)(kr,{onOpenInventory:d}):ie===`checking`||!y||!De||!k||!b||!Fe?(0,Q.jsx)(`div`,{className:`flex h-full min-h-80 items-center justify-center px-6 text-center`,role:`status`,children:(0,Q.jsx)(`p`,{className:`text-sm text-secondary`,children:`Preparing the interactive site map...`})}):(0,Q.jsxs)(Sr,{fallback:Pe,resetToken:ve,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0`,children:(0,Q.jsx)(Fe,{graph:De.graph,className:`relative size-full bg-bg [&_.sigma-container]:size-full`,style:{width:`100%`,height:`100%`,background:y.background},options:k.options,children:(0,Q.jsx)(jr,{setReducers:k.setReducers,reactSigma:b,graph:De.graph,theme:y,selectedNodeKey:E,showTemplateLinks:s,onSelectNodeKey:Ae,onHoverNode:Oe,onCameraReady:A})})}),(0,Q.jsxs)(`div`,{className:`absolute right-3 top-3 z-20 flex flex-col overflow-hidden rounded-md border border-base bg-bg shadow-lg`,children:[(0,Q.jsx)(T,{type:`button`,variant:`ghost`,size:`icon`,className:`rounded-none border-b border-subtle`,"aria-label":`Zoom in`,disabled:!oe,onClick:()=>_.current?.zoomIn(),children:(0,Q.jsx)(u,{className:`size-4`,"aria-hidden":`true`})}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,size:`icon`,className:`rounded-none border-b border-subtle`,"aria-label":`Zoom out`,disabled:!oe,onClick:()=>_.current?.zoomOut(),children:(0,Q.jsx)(a,{className:`size-4`,"aria-hidden":`true`})}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,size:`icon`,className:`rounded-none`,"aria-label":`Fit site map`,disabled:!oe,onClick:()=>_.current?.reset(),children:(0,Q.jsx)(r,{className:`size-4`,"aria-hidden":`true`})})]}),D&&x&&(0,Q.jsxs)(`div`,{role:`tooltip`,className:`pointer-events-none absolute z-20 max-w-64 rounded-md border border-base bg-bg/95 px-3 py-2 shadow-lg`,style:{left:x.left,top:x.top},children:[(0,Q.jsx)(`p`,{className:`truncate font-mono text-[13px] font-medium text-heading`,children:we(D)}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] font-medium text-heading`,children:cr(sr(D))}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-[13px] text-secondary`,children:ur(sr(D))}),D.depth!=null&&(0,Q.jsxs)(`p`,{className:`mt-1 text-[13px] text-secondary`,children:[Tr(D.depth,`click`),` from home`]}),D.auditScore!=null&&(0,Q.jsxs)(`p`,{className:`mt-1 text-[13px] tabular-nums text-heading`,children:[`Score `,Math.round(D.auditScore),`/100`]})]})]})}),(0,Q.jsxs)(`div`,{"aria-label":`Site map legend`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-subtle bg-bg-elevated/50 px-3 py-2 text-[13px] text-secondary`,children:[he.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:ur(e),children:[(0,Q.jsx)(`span`,{className:`w-3 text-center font-mono text-[15px] font-semibold leading-none`,style:{color:`var(${Wn[e].property})`},"aria-hidden":`true`,children:dr(e)}),lr(e)]},e)),(0,Q.jsx)(`span`,{className:`ml-auto`,children:`Bigger = more linked`}),De&&(De.omittedNodes>0||De.omittedEdges>0)&&(0,Q.jsx)(`span`,{className:`text-caution`,children:`Some records lacked valid layout data.`})]}),(0,Q.jsx)(`p`,{id:v,className:`sr-only`,children:`The WebGL map supports pointer, wheel, and touch navigation. Use the page search to focus a rendered page. Use the full page inventory for an accessible list of every crawled page and its links.`}),(0,Q.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:ge})]})}var Nr={"geographic-signals":`Checks whether pages say where your business operates: your address, service areas, map coordinates, and location details that search engines can read. Useful for businesses serving specific places. Off by default; enabling it adds this check to the health score.`,"agent-skill-exposure":`Checks whether AI agents can understand your forms, discover actions such as site search, and find links to tools or APIs. Reads page information only; it does not submit forms or run actions. Included in the health score by default.`};function Pr(e,t){return`Worth ${pe(e,ye.percent)} of the ${t} score`}function Fr(e){return e>=70?`positive`:e>=40?`caution`:`negative`}function Ir(e){return e>=70?`pass`:e>=40?`partial`:`fail`}function Lr(e){return e===`pass`?`positive`:e===`partial`?`caution`:`negative`}function Rr(e){return e===`pass`?`Pass`:e===`partial`?`Partial`:`Fail`}function zr({audit:e,isLoading:t,error:n,onRetry:r}){return(0,Q.jsxs)(`section`,{className:`border-t border-default pt-5`,"aria-labelledby":`site-health-page-audit-heading`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`h3`,{id:`site-health-page-audit-heading`,className:`text-base font-semibold text-heading`,children:`Findings and fixes for this page`})}),t?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-secondary`,role:`status`,children:`Loading findings...`}):n?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-y border-negative bg-negative-soft px-4 py-3`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-negative`,children:`Findings could not be loaded.`}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,onClick:r,children:`Try again`})]}):e?e.state===`no-crawl`?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-secondary`,children:`No Site Health scan is available.`}):e.state===`details-unavailable`?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-secondary`,children:`This scan saved its summary, but not the findings for each page.`}):e.state===`not-found`?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-secondary`,children:`This page is not present in the selected scan.`}):e.state===`not-audited`?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-secondary`,children:`This page was found, but it was not scored.`}):(0,Q.jsx)(Br,{audit:e}):(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-secondary`,children:`No findings are available for this page.`})]})}function Br({audit:e}){let t=e.factors.filter(e=>e.applicable!==!1&&(e.status!==`pass`||e.findings.some(e=>e.type===`missing`||e.type===`timeout`||e.type===`unreachable`)));return(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Q.jsxs)(`span`,{"aria-label":`Score ${Math.round(e.auditScore)} out of 100`,className:`text-2xl font-semibold tabular-nums text-heading`,children:[Math.round(e.auditScore),(0,Q.jsx)(`span`,{className:`text-sm text-muted`,children:`/100`})]}),(0,Q.jsx)(E,{tone:Fr(e.auditScore),children:Rr(Ir(e.auditScore))})]}),e.evidenceState===`scores-only`&&(0,Q.jsx)(`p`,{className:`mt-3 border border-caution bg-caution-soft px-3 py-2 text-sm text-caution`,children:`This older scan saved only the scores, not the findings or fixes.`}),e.criticalDefects.length>0&&(0,Q.jsxs)(`section`,{className:`mt-5`,"aria-labelledby":`site-health-critical-defects-heading`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h4`,{id:`site-health-critical-defects-heading`,className:`text-sm font-semibold text-heading`,children:`Problems outside the score`}),(0,Q.jsx)(E,{tone:e.criticalDefects.some(e=>e.severity===`critical`)?`negative`:`caution`,children:e.criticalDefects.length}),(0,Q.jsx)(`span`,{className:`text-xs text-muted`,children:`Not counted in the score`})]}),(0,Q.jsx)(`ul`,{className:`mt-2 divide-y divide-default border-y border-default`,children:e.criticalDefects.map(e=>(0,Q.jsxs)(`li`,{className:`py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-heading`,children:e.detail}),(0,Q.jsx)(E,{tone:e.severity===`critical`?`negative`:`caution`,children:e.severity===`critical`?`Critical`:`Warning`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-sm text-secondary`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-heading`,children:`Fix:`}),` `,e.recommendation]})]},e.id))})]}),t.length>0?(0,Q.jsx)(`div`,{className:`mt-5 divide-y divide-default border-y border-default`,children:t.map(t=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsxs)(`details`,{className:`group min-w-0 flex-1 py-1`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 rounded-sm px-1 py-2 outline-none marker:hidden focus-visible:ring-2 focus-visible:ring-mono-400 [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-heading`,children:[(0,Q.jsx)(d,{className:`size-4 shrink-0 text-muted transition-transform group-open:rotate-90`,"aria-hidden":`true`}),t.name]}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-sm tabular-nums text-heading`,children:[Math.round(t.score),`/100`]}),(0,Q.jsx)(E,{tone:Lr(t.status),children:Rr(t.status)})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 px-1 pb-4 pt-1 md:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h5`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Evidence`}),t.findings.length>0?(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm text-secondary`,children:t.findings.map((e,t)=>(0,Q.jsx)(`li`,{children:e.message},`${e.code}:${t}`))}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:e.evidenceState===`scores-only`?`This scan did not save the findings here.`:`Nothing to report here.`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h5`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Recommended fix`}),t.recommendations.length>0?(0,Q.jsx)(`ol`,{className:`mt-2 list-decimal space-y-1.5 pl-5 text-sm text-secondary marker:text-muted`,children:t.recommendations.map(e=>(0,Q.jsx)(`li`,{children:e},e))}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:e.evidenceState===`scores-only`?`This scan did not save a fix here.`:`No fix suggested here.`}),typeof t.sharePct==`number`?(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted`,children:Pr(t.sharePct,`page`)}):null]})]})]}),Nr[t.id]&&(0,Q.jsx)(`div`,{className:`flex min-h-14 items-center`,children:(0,Q.jsx)(L,{text:Nr[t.id],placement:`bottom`})})]},t.id))}):e.criticalDefects.length===0&&e.evidenceState===`complete`?(0,Q.jsx)(`p`,{className:`mt-4 border-y border-positive bg-positive-soft px-4 py-3 text-sm text-positive`,children:`Nothing needs attention on this page.`}):e.criticalDefects.length===0?(0,Q.jsx)(`p`,{className:`mt-4 border-y border-default px-4 py-3 text-sm text-secondary`,children:`This scan saved only the score. Run a new scan to see findings.`}):null]})}function Vr(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function Hr(e){let t=e;try{t=decodeURIComponent(e.replace(/\+/g,` `))}catch{}let n=``,r=e.indexOf(`?`);return r>=0&&new URLSearchParams(e.slice(r+1)).forEach((e,t)=>{n+=` ${t} ${e}`}),`${e} ${t}${n}`}function Ur(e,t=36,n=18){let r=[...e];return r.length<=t+n+1?e:`${r.slice(0,t).join(``)}…${r.slice(-n).join(``)}`}function Wr({value:e,headLength:t,tailLength:n,className:r,title:i}){let a=Ur(e,t,n);return(0,Q.jsx)(`span`,{className:r,title:i??e,children:a===e?e:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:e}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:a})]})})}function Gr({rows:e,getSearchText:t,pageSize:n=25}){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(1),s=(0,R.useMemo)(()=>Vr(r),[r]),c=(0,R.useMemo)(()=>s.length===0||!t?e:e.filter(e=>{let n=t(e).toLocaleLowerCase();return s.every(e=>n.includes(e))}),[t,e,s]),l=Math.max(1,Math.ceil(c.length/n)),u=Math.min(Math.max(1,a),l),d=(u-1)*n,f=(0,R.useMemo)(()=>c.slice(d,d+n),[c,n,d]);return{query:r,setQuery:(0,R.useCallback)(e=>{i(e),o(1)},[]),page:u,setPage:(0,R.useCallback)(e=>{o(Math.max(1,e))},[]),rows:f,filteredRows:c,totalRows:c.length,totalPages:l,pageSize:n,rangeStart:c.length===0?0:d+1,rangeEnd:d+f.length,hasQuery:r.trim().length>0}}function Kr({value:e,onChange:t,label:n,placeholder:r=`Filter rows`,className:i}){return(0,Q.jsxs)(`div`,{className:`relative ${i??``}`,children:[(0,Q.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted`}),(0,Q.jsx)(`input`,{type:`search`,value:e,onChange:e=>{S(e.target.value),t(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&S(e.currentTarget.value,!0)},"aria-label":n,placeholder:r,autoComplete:`off`,spellCheck:!1,className:`h-9 w-full rounded-md border border-default bg-surface/50 pl-9 pr-9 text-sm text-strong placeholder:text-muted outline-none transition focus:border-mono-500 focus:ring-1 focus:ring-mono-500 [&::-webkit-search-cancel-button]:appearance-none`}),e.trim().length>0?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":`Clear ${n.toLocaleLowerCase()}`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded text-muted transition-colors hover:bg-surface-hover hover:text-strong focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-mono-500`,children:(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function qr({page:e,pageSize:t=25,visibleRows:n,totalRows:r,hasNextPage:i,onPageChange:a,itemLabel:s=`rows`,className:c,disabled:l=!1}){if(n===0)return null;let u=(e-1)*t+1,f=u+n-1,p=r===void 0?void 0:Math.max(1,Math.ceil(r/t)),m=i??(p!==void 0&&e<p),h=e>1||m;return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-xs text-secondary ${c??``}`,children:[(0,Q.jsxs)(`p`,{className:`tabular-nums`,children:[u.toLocaleString(`en-US`),` to `,f.toLocaleString(`en-US`),r===void 0?`${m?`+`:``} ${s}`:` of ${r.toLocaleString(`en-US`)} ${s}`]}),h?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e-1),disabled:l||e<=1,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:`size-3.5`}),`Previous`]}),(0,Q.jsx)(`span`,{className:`tabular-nums`,children:p===void 0?`Page ${e}`:`Page ${e} of ${p}`}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e+1),disabled:l||!m,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[`Next`,(0,Q.jsx)(d,{"aria-hidden":`true`,className:`size-3.5`})]})]}):null]})}var Jr=`Not recorded by this scan`,Yr=100,Xr=12,Zr=[];function Qr(e){return Hr(e.url)}function $r(e){return e>=70?`positive`:e>=40?`caution`:`negative`}function ei(e){return e>=70?`text-positive-400`:e>=40?`text-caution-400`:`text-negative-400`}function ti(e){return e===x.pass?`positive`:e===x.partial?`caution`:`negative`}var ni={[x.pass]:`Pass`,[x.partial]:`Partial`,[x.fail]:`Fail`},ri=`Score is the average across audited pages. Status reflects the worst page: fail if any page scores below 40, partial if any page scores 40–69, otherwise pass. Share is how much of the site score the factor controls; the shares add up to 100%, and a dash means the scan did not record them.`;function ii(e){return e>=70?`Pass`:e>=40?`Partial`:`Fail`}function ai(e){return F(P(String(e)))}function oi(e){return Ie(P(String(e)))}function si({projectName:e,projectId:t,runId:n,integrated:r=!1,compactCopy:a=!1,afterSummary:o,unavailableFooter:c}){let{isAdmin:u}=we(),f=Ce(ve[`site-audit`])&&!u,[m,h]=(0,R.useState)(!1),[_,ee]=(0,R.useState)(null),[v,ne]=(0,R.useState)(null),x=n===void 0?v:n,[ue,de]=(0,R.useState)(!1),fe=(0,R.useRef)(null),S=y(A({client:w,path:{name:e},...x?{query:{runId:x}}:{}})),me=y({...k({client:w,path:{name:e},query:{limit:30}}),enabled:!r}),C=y(Oe({client:w,path:{name:e},query:{limit:Yr,sort:`score-asc`,...x?{runId:x}:{}}})),he=y({...Ne({client:w,path:{name:e},query:{kind:ve[`site-audit`],limit:10}}),enabled:!r,refetchOnWindowFocus:`always`,refetchInterval:e=>e.state.data?.some(e=>e.status===`queued`||e.status===`running`)?3e3:1e4}),ge=Ge(),_e=(0,R.useSyncExternalStore)(We,Ke,Ke),be=Object.values(_e.runs).find(e=>e.kind===ve[`site-audit`]&&e.projectId===t),xe=he.data??[],Se=xe.find(e=>e.status===`queued`||e.status===`running`),D=xe.at(-1),O=ge.isPending||!!be||!!Se,De=ge.isPending?`starting`:Se?.status??be?.lastAnnouncedStatus,ke=(0,R.useCallback)(async()=>{let e=await Promise.all([S.refetch(),C.refetch(),...r?[]:[me.refetch()]]),t=e.find(e=>e.error);if(t?.error)throw t.error;return e[0]},[r,C.refetch,S.refetch,me.refetch]);(0,R.useEffect)(()=>{r||x||!D||D.status!==`completed`&&D.status!==`partial`||S.data?.runId!==D.id&&fe.current!==D.id&&(fe.current=D.id,ke().catch(t=>{Te({title:`Technical AEO auto-refresh failed`,detail:t instanceof Error?t.message:`Could not load the completed audit.`,tone:`negative`,dedupeKey:`technical-aeo:auto-refresh:${e}`,dedupeMode:`replace`})}))},[x,r,D?.id,D?.status,e,ke,S.data?.runId]);let Ae=async()=>{de(!0);try{let t=await ke();Te({title:`Technical AEO refreshed`,detail:O?`The audit is still running. This view will refresh again when it finishes.`:t.data?.hasData?`Latest score is ${t.data.aggregateScore}/100 from ${t.data.pagesAudited} audited page${t.data.pagesAudited===1?``:`s`}.`:`No audit data yet. Run an audit to crawl the sitemap.`,tone:t.data?.hasData?`positive`:`caution`,dedupeKey:`technical-aeo:refresh:${e}`,dedupeMode:`replace`})}catch(t){Te({title:`Technical AEO refresh failed`,detail:t instanceof Error?t.message:`Could not reload technical audit data.`,tone:`negative`,dedupeKey:`technical-aeo:refresh:${e}`,dedupeMode:`replace`})}finally{de(!1)}},je=()=>{(!Ce(ve[`site-audit`])||u)&&ge.mutate({projectName:e,projectId:t})},Me=De===`running`?`Audit running`:De===`queued`?`Audit queued`:`Starting audit`,j=S.data,M=C.data?.pages??Zr,N=a?M.find(e=>e.status===`success`&&e.overallScore<70)??M.find(e=>e.status===`success`):void 0,Pe=!!(N&&N.overallScore<70),Fe=y({...Ee({client:w,path:{name:e},query:{...x?{runId:x}:{},url:N?.url??``}}),enabled:a&&!!N}),Ie=(j?.pagesErrored??0)>0,P=m&&Ie,F=Gr({rows:(0,R.useMemo)(()=>P?M.filter(e=>e.status===`error`):M,[M,P]),getSearchText:Qr}),qe=j?j.pagesAudited>M.length:!1;if((0,R.useEffect)(()=>{h(!1),ee(null)},[a,x,r]),S.isLoading)return(0,Q.jsxs)(`div`,{className:`flex min-h-40 items-center justify-center gap-2 text-sm text-secondary ${r?``:`mt-6`}`,role:`status`,children:[(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading page health...`]});if(S.error)return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-4 rounded-lg border border-negative bg-negative-soft px-5 py-5 sm:flex-row sm:items-center sm:justify-between ${r?``:`mt-6`}`,role:`alert`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,Q.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-negative`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{children:[r?(0,Q.jsx)(`h3`,{className:`font-semibold text-negative`,children:`Page health could not load`}):(0,Q.jsx)(`h2`,{className:`font-semibold text-negative`,children:`Page health could not load`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`The saved audit could not be read. Try loading it again.`})]})]}),(0,Q.jsxs)(T,{type:`button`,variant:`secondary`,size:`sm`,className:`shrink-0`,onClick:()=>void Ae(),disabled:ue,children:[(0,Q.jsx)(te,{className:`size-4 ${ue?`motion-safe:animate-spin`:``}`,"aria-hidden":`true`}),ue?`Trying again...`:`Try again`]})]}),c]});if(!j||!j.hasData)return r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-default bg-surface-subtle px-5 py-7 text-center`,children:[(0,Q.jsx)(p,{className:`mx-auto size-7 text-muted`,"aria-hidden":`true`}),(0,Q.jsx)(`h2`,{className:`mt-3 text-base font-semibold text-heading`,children:`Page health unavailable`}),(0,Q.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-secondary`,children:f?Ue:`Run a new Site Health scan to calculate page-level technical findings.`})]}),c]}):(0,Q.jsxs)(Ve,{className:`surface-card mt-6 p-8 text-center`,children:[(0,Q.jsx)(p,{className:`mx-auto mb-3 h-8 w-8 text-muted`,"aria-hidden":`true`}),(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-heading`,children:`No Technical AEO audit yet`}),(0,Q.jsx)(`p`,{className:`supporting-copy mx-auto mt-2 max-w-md`,children:`A technical AEO audit crawls your sitemap and scores every page for structured data, AI-readable content, crawler access, freshness, and more, then rolls it up into one site score.`}),!le()&&!f&&(0,Q.jsx)(`div`,{className:`mt-5 flex items-center justify-center gap-3`,children:(0,Q.jsxs)(He,{type:`button`,onClick:je,disabled:O,children:[O?(0,Q.jsx)(l,{className:`mr-1.5 h-4 w-4 motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Q.jsx)(i,{className:`mr-1.5 h-4 w-4`,"aria-hidden":`true`}),O?Me:`Run first audit`]})}),O?(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted`,role:`status`,"aria-live":`polite`,children:`The dashboard will refresh automatically when the audit finishes.`}):null]});let Je=j.deltaScore==null?null:`${j.deltaScore>=0?`+`:``}${j.deltaScore} vs previous`,Ye=j.trend===`up`?`positive`:j.trend===`down`?`negative`:`neutral`,Xe=me.data?.points??[],Ze=Xe.map(e=>({runId:e.runId,date:e.auditedAt,score:e.aggregateScore})),Qe=n===void 0&&v!==null,$e=M.filter(e=>e.status===`success`),et=j.factors.filter(e=>e.pagesPartial+e.pagesFailing>0).length,tt=j.runStatus===`partial`,nt=j.crossCuttingIssues.some(e=>e.topRecommendations.length>0);function z(e){let t=[];for(let n of $e){let r=n.factors.find(t=>t.id===e);r&&r.score<70&&t.push({url:n.url,score:r.score})}return t.sort((e,t)=>e.score-t.score)}return(0,Q.jsxs)(`div`,{className:r?``:`mt-6`,children:[r?(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-default pb-5 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-secondary`,children:tt?`Score so far`:`Site score`}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{"aria-label":tt?`Score so far ${j.aggregateScore} out of 100, from a scan that did not cover the whole site`:`Site score ${j.aggregateScore} out of 100`,className:`inline-flex items-baseline gap-1 font-mono tabular-nums ${ei(j.aggregateScore)}`,children:[(0,Q.jsx)(`span`,{className:`text-3xl font-semibold`,children:j.aggregateScore}),(0,Q.jsx)(`span`,{className:`text-sm text-muted`,children:`/100`})]}),(0,Q.jsx)(E,{tone:$r(j.aggregateScore),children:ii(j.aggregateScore)}),tt?(0,Q.jsx)(E,{tone:`caution`,children:`Part of the site`}):null,Je?(0,Q.jsx)(E,{tone:Ye,children:Je}):null]})]}),(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm tabular-nums text-secondary`,children:[(0,Q.jsxs)(`span`,{children:[j.pagesAudited,` page`,j.pagesAudited===1?``:`s`,` checked`]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-faint`,children:`·`}),(0,Q.jsxs)(`span`,{children:[et,` check`,et===1?``:`s`,` with pages below pass`]}),j.pagesErrored>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-faint`,children:`·`}),(0,Q.jsxs)(`span`,{className:`text-negative`,children:[j.pagesErrored,` crawl error`,j.pagesErrored===1?``:`s`]})]}):null]})]}):(0,Q.jsxs)(`section`,{className:`surface-card flex flex-wrap items-start justify-between gap-6 rounded-lg border border-default bg-surface p-6`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:Qe?`Technical AEO history`:`Technical AEO`}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-baseline gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-4xl font-semibold tabular-nums ${ei(j.aggregateScore)}`,children:j.aggregateScore}),(0,Q.jsx)(`span`,{className:`text-lg text-muted`,children:`/ 100`}),(0,Q.jsx)(E,{tone:$r(j.aggregateScore),children:ii(j.aggregateScore)}),Je?(0,Q.jsx)(E,{tone:Ye,children:Je}):null,O?(0,Q.jsx)(E,{tone:`neutral`,children:Me}):null]}),(0,Q.jsxs)(`p`,{className:`supporting-copy mt-2 tabular-nums`,children:[j.pagesDiscovered,` URL`,j.pagesDiscovered===1?``:`s`,` in sitemap · `,j.pagesAudited,` audited · `,j.pagesSkipped,` skipped · `,j.pagesErrored,` errored`]}),(0,Q.jsxs)(`p`,{className:`mt-1 flex flex-wrap items-center gap-x-1.5 text-xs text-muted`,children:[(0,Q.jsx)(`span`,{className:`text-faint`,children:`Sitemap:`}),(0,Q.jsx)(`a`,{href:j.sitemapUrl??`#`,target:`_blank`,rel:`noreferrer`,className:`max-w-[22rem] truncate text-secondary underline decoration-mono-700 underline-offset-2 hover:text-strong`,children:j.sitemapUrl}),(0,Q.jsx)(L,{text:"Every audit re-reads this sitemap, so pages you add or remove are picked up on the next run. Discovered/audited counts and the score reflect the sitemap at the time of the latest run. Override it with `canonry technical-aeo run <project> --sitemap-url <url>`."})]}),j.auditedAt?(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-faint`,children:[`Audited `,new Date(j.auditedAt).toLocaleString()]}):null,O?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted`,role:`status`,"aria-live":`polite`,children:`Results refresh automatically when this audit finishes.`}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[n===void 0&&Xe.length>1?(0,Q.jsxs)(`select`,{"aria-label":`View a Technical AEO audit`,value:v??``,onChange:e=>ne(e.target.value||null),className:`min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,Q.jsx)(`option`,{value:``,children:`Latest Technical AEO audit`}),[...Xe].reverse().slice(1).map(e=>(0,Q.jsxs)(`option`,{value:e.runId,children:[new Date(e.auditedAt).toLocaleDateString(),` · `,e.aggregateScore,`/100`]},e.runId))]}):null,(0,Q.jsxs)(T,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void Ae(),disabled:ue,children:[(0,Q.jsx)(te,{className:`mr-1.5 h-4 w-4 ${ue?`motion-safe:animate-spin`:``}`,"aria-hidden":`true`}),ue?`Refreshing…`:`Refresh`]}),!le()&&!f&&(0,Q.jsxs)(He,{type:`button`,size:`sm`,onClick:je,disabled:O,children:[O?(0,Q.jsx)(l,{className:`mr-1.5 h-4 w-4 motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Q.jsx)(i,{className:`mr-1.5 h-4 w-4`,"aria-hidden":`true`}),O?Me:`Re-run audit`]})]})]}),o,!r&&Ze.length>=2?(0,Q.jsxs)(`section`,{className:`page-section-divider`,children:[(0,Q.jsxs)(`div`,{className:`section-head`,children:[(0,Q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Trend`}),(0,Q.jsx)(`h2`,{children:`Site score over time`})]}),(0,Q.jsxs)(`div`,{className:`mt-3 h-56`,children:[(0,Q.jsxs)(`p`,{className:`sr-only`,children:[`Technical AEO scores range from `,Math.min(...Ze.map(e=>e.score)),` to `,Math.max(...Ze.map(e=>e.score)),` across `,Ze.length,` audits. Use the audit selector to inspect a previous scorecard.`]}),(0,Q.jsx)(`div`,{className:`h-full`,"aria-hidden":`true`,children:(0,Q.jsx)(ae,{width:`100%`,height:`100%`,children:(0,Q.jsxs)(ce,{data:Ze,margin:{top:8,right:8,bottom:0,left:0},children:[(0,Q.jsx)(b,{stroke:ze,vertical:!1}),(0,Q.jsx)(ie,{dataKey:`date`,tick:Le,tickLine:!1,axisLine:{stroke:I},tickFormatter:ai,minTickGap:24}),(0,Q.jsx)(oe,{domain:[0,100],ticks:[0,25,50,75,100],tick:Le,tickLine:!1,axisLine:!1,width:32}),(0,Q.jsx)(re,{...Be,cursor:{stroke:I,strokeWidth:1},labelFormatter:oi,formatter:e=>[`${e}/100`,`Site score`]}),(0,Q.jsx)(se,{type:`monotone`,dataKey:`score`,name:`score`,stroke:Re.positive,strokeWidth:2.5,dot:{r:2.5,fill:Re.positive,strokeWidth:0},isAnimationActive:!1})]})})})]})]}):null,(0,Q.jsxs)(`section`,{className:r?`pt-5`:`page-section-divider`,children:[r?(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-heading`,children:a?`Checks`:`Technical findings`}),(0,Q.jsx)(L,{text:ri})]}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-secondary`,children:a?nt?`Open a check to see affected pages and recommended fixes.`:N?Pe?`Open a check to see affected pages. Page-level evidence for the first page to fix appears below.`:`Open a check to see affected pages. Page-level evidence for one audited page appears below.`:`Open a check to see affected pages and score details.`:nt?`Select a check to see affected pages and recommended fixes.`:`Select a check to see affected pages and score details.`})]}):(0,Q.jsxs)(`div`,{className:`section-head`,children:[(0,Q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Scorecard`}),(0,Q.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5`,children:[`Ranking factors`,(0,Q.jsx)(L,{text:ri})]})]}),(0,Q.jsx)(`div`,{className:`evidence-table-wrap mt-3`,children:(0,Q.jsxs)(`table`,{className:`evidence-table ${r?`min-w-[42rem]`:``}`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{children:r?`Technical check`:`Factor`}),r?null:(0,Q.jsx)(`th`,{className:`text-right`,children:`Share`}),(0,Q.jsx)(`th`,{className:`text-right`,children:r?`Score`:`Avg`}),(0,Q.jsx)(`th`,{children:`Status`}),(0,Q.jsx)(`th`,{children:r?`Pages affected`:`Pass / Partial / Fail`})]})}),(0,Q.jsx)(`tbody`,{children:j.factors.map(e=>{let t=_===e.id,n=j.crossCuttingIssues.find(t=>t.factorId===e.id),i=t?z(e.id):[],a=e.pagesPartial+e.pagesFailing,o=e.pagesPassing+a,c=!!n?.topRecommendations.length,u=c&&a>0;return(0,Q.jsxs)(R.Fragment,{children:[(0,Q.jsxs)(`tr`,{className:t?`bg-surface-subtle`:void 0,children:[(0,Q.jsx)(`td`,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-2 text-left font-medium text-strong outline-none hover:text-primary focus-visible:text-primary focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-mono-400`,"aria-expanded":t,onClick:()=>ee(t?null:e.id),children:[t?(0,Q.jsx)(s,{className:`size-4 shrink-0 text-muted`,"aria-hidden":`true`}):(0,Q.jsx)(d,{className:`size-4 shrink-0 text-muted`,"aria-hidden":`true`}),e.name]}),Nr[e.id]&&(0,Q.jsx)(L,{text:Nr[e.id],placement:`bottom`})]})}),r?null:(0,Q.jsx)(`td`,{className:`text-right tabular-nums text-muted`,children:typeof e.sharePct==`number`?pe(e.sharePct,ye.percent):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:pe(null)}),(0,Q.jsx)(`span`,{className:`sr-only`,children:Jr})]})}),(0,Q.jsxs)(`td`,{className:`text-right font-mono tabular-nums text-strong`,children:[e.avgScore,r?(0,Q.jsx)(`span`,{className:`text-muted`,children:`/100`}):null]}),(0,Q.jsx)(`td`,{children:(0,Q.jsx)(E,{tone:ti(e.status),children:ni[e.status]})}),r?(0,Q.jsxs)(`td`,{className:`tabular-nums ${a>0?`text-strong`:`text-muted`}`,children:[a,` of `,o]}):(0,Q.jsxs)(`td`,{className:`tabular-nums text-secondary`,children:[(0,Q.jsx)(`span`,{className:`text-positive-400`,children:e.pagesPassing}),` / `,(0,Q.jsx)(`span`,{className:`text-caution-400`,children:e.pagesPartial}),` / `,(0,Q.jsx)(`span`,{className:`text-negative-400`,children:e.pagesFailing})]})]}),t?(0,Q.jsx)(`tr`,{className:`bg-surface-subtle`,children:(0,Q.jsx)(`td`,{colSpan:r?4:5,className:`px-4 pb-5 pt-0`,children:(0,Q.jsxs)(`div`,{className:`grid gap-5 border-t border-subtle pt-4 ${u?`lg:grid-cols-2`:``}`,children:[c&&n?(0,Q.jsxs)(`section`,{"aria-labelledby":`technical-finding-${e.id}-fixes`,children:[(0,Q.jsx)(`h4`,{id:`technical-finding-${e.id}-fixes`,className:`text-sm font-semibold text-heading`,children:`Recommended fixes`}),(0,Q.jsx)(`ol`,{className:`mt-2 list-decimal space-y-1.5 pl-5 marker:text-muted`,children:n.topRecommendations.map((e,t)=>(0,Q.jsx)(`li`,{className:`pl-1 text-sm text-secondary`,children:e},t))}),r&&typeof e.sharePct==`number`?(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted`,children:Pr(e.sharePct,`site`)}):null]}):a===0?(0,Q.jsx)(`p`,{className:`text-sm text-secondary`,children:`Every audited page passes this check.`}):null,a>0?(0,Q.jsxs)(`section`,{"aria-labelledby":`technical-finding-${e.id}-pages`,children:[(0,Q.jsxs)(`h4`,{id:`technical-finding-${e.id}-pages`,className:`text-sm font-semibold text-heading`,children:[`Affected pages (`,a,`)`]}),r&&C.isLoading?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-secondary`,role:`status`,children:[(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading affected pages...`]}):r&&C.error?(0,Q.jsxs)(`div`,{className:`mt-3`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-negative`,children:`Affected pages could not load`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`Try the page-level audit read again.`}),(0,Q.jsxs)(T,{type:`button`,variant:`secondary`,size:`sm`,className:`mt-3`,onClick:()=>void C.refetch(),disabled:C.isFetching,children:[C.isFetching?(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),C.isFetching?`Retrying affected pages...`:`Retry affected pages`]})]}):i.length>0?(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.slice(0,Xr).map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`w-8 shrink-0 text-right font-mono tabular-nums ${ei(e.score)}`,children:e.score}),(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 truncate text-link outline-none hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400`,title:e.url,children:e.url})]},e.url))}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Page details are not available in the loaded audit sample.`}),i.length>Xr?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-muted`,children:[`+ `,i.length-Xr,` more below pass`]}):null,qe&&(!r||!C.isLoading&&!C.error)?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-muted`,children:[`Showing the worst `,M.length,` audited pages.`]}):null]}):null]})})}):null]},e.id)})})]})})]}),a&&N?(0,Q.jsxs)(`section`,{className:`border-t border-default pt-5`,"aria-labelledby":`onboarding-page-evidence-heading`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col justify-between gap-3 sm:flex-row sm:items-start`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{id:`onboarding-page-evidence-heading`,className:`text-base font-semibold text-heading`,children:Pe?`First page to fix`:`Example audited page`}),(0,Q.jsx)(`a`,{href:N.url,target:`_blank`,rel:`noreferrer`,className:`mt-1 block max-w-2xl truncate font-mono text-sm text-link outline-none hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400`,title:N.url,children:N.url})]}),(0,Q.jsxs)(E,{tone:$r(N.overallScore),children:[Math.round(N.overallScore),`/100`]})]}),(0,Q.jsx)(zr,{audit:Fe.data,isLoading:Fe.isLoading,error:Fe.error,onRetry:()=>{Fe.refetch()}})]}):null,!r&&j.crossCuttingIssues.length>0?(0,Q.jsxs)(`section`,{className:`page-section-divider`,children:[(0,Q.jsxs)(`div`,{className:`section-head`,children:[(0,Q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Opportunities`}),(0,Q.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5`,children:[`Prioritized fixes`,(0,Q.jsx)(L,{text:`Factors scoring below pass across the most pages, ranked by site-wide impact. Fixing one of these typically lifts many pages at once.`})]})]}),(0,Q.jsx)(`div`,{className:`mt-3 divide-y divide-mono-800/60 overflow-hidden rounded-lg border border-default`,children:j.crossCuttingIssues.map(e=>(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-heading`,children:e.factorName}),(0,Q.jsx)(E,{tone:$r(e.avgScore),children:ii(e.avgScore)}),(0,Q.jsxs)(`span`,{className:`text-xs tabular-nums text-muted`,children:[`avg `,e.avgScore,` · affects `,e.affectedPages,` of `,e.totalPages,` pages (`,pe(e.affectedPct,ye.percent),`)`]})]}),e.topRecommendations.length>0?(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.topRecommendations.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2 text-sm text-secondary`,children:[(0,Q.jsx)(`span`,{className:`select-none text-faint`,children:`→`}),(0,Q.jsx)(`span`,{children:e})]},t))}):null]},e.factorId))})]}):null,r?null:(0,Q.jsxs)(`section`,{className:`page-section-divider`,children:[(0,Q.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`eyebrow eyebrow-soft`,children:`Pages`}),(0,Q.jsx)(`h2`,{children:`Per-page breakdown`})]}),Ie?(0,Q.jsxs)(`div`,{className:`segmented`,role:`group`,"aria-label":`Filter pages`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{h(!1),F.setPage(1)},"aria-pressed":!P,className:`segmented-option min-h-11 tabular-nums ${P?``:`segmented-option-active`}`,children:[`All `,j.pagesAudited]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{h(!0),F.setPage(1)},"aria-pressed":P,className:`segmented-option min-h-11 tabular-nums ${P?`segmented-option-active text-negative`:``}`,children:[`Errors `,j.pagesErrored]})]}):null]}),M.length>0?(0,Q.jsx)(Kr,{value:F.query,onChange:F.setQuery,label:`Filter audited page URLs`,placeholder:`Filter page URL or query parameters`,className:`mt-3 max-w-md`}):null,F.totalRows===0?(0,Q.jsx)(`p`,{className:`supporting-copy mt-3`,children:F.hasQuery?`No pages match this filter.`:`No pages recorded.`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`evidence-table-wrap mt-3`,children:(0,Q.jsxs)(`table`,{className:`evidence-table`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{className:`text-right`,children:`Score`}),(0,Q.jsx)(`th`,{children:`Status`}),(0,Q.jsx)(`th`,{className:`w-full`,children:`URL`})]})}),(0,Q.jsx)(`tbody`,{children:F.rows.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`text-right tabular-nums`,children:e.status===`error`?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-negative-400`,children:[(0,Q.jsx)(g,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),`err`]}):(0,Q.jsx)(`span`,{className:ei(e.overallScore),children:e.overallScore})}),(0,Q.jsx)(`td`,{children:e.status===`error`?(0,Q.jsx)(E,{tone:`negative`,children:`Error`}):(0,Q.jsx)(E,{tone:$r(e.overallScore),children:ii(e.overallScore)})}),(0,Q.jsx)(`td`,{className:`w-full max-w-0`,children:(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`block truncate text-neutral hover:text-heading`,title:e.status===`error`?e.error??e.url:e.url,children:(0,Q.jsx)(Wr,{value:e.url,headLength:54,tailLength:20,title:e.status===`error`?e.error??e.url:e.url})})})]},e.url))})]})}),(0,Q.jsx)(qr,{page:F.page,pageSize:F.pageSize,visibleRows:F.rows.length,totalRows:F.totalRows,onPageChange:F.setPage,itemLabel:F.hasQuery?`matches`:`rows`}),qe?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-faint`,children:[`Showing the worst `,M.length,` of `,j.pagesAudited,` audited pages.`]}):null]})]})]})}var ci=e({LivePageHealthFindings:()=>Na,PAGE_INTERNAL_LINKS_HELP:()=>Zi,SiteHealthSection:()=>Fa,emptyLinkCopy:()=>oa}),li=[{id:`map`,label:`Map`},{id:`inventory`,label:`Pages`},{id:`technical`,label:`Page health`}],ui={map:`Explore how pages, site sections, and internal links fit together.`,inventory:`Review discovered pages and the links that shape their visibility.`,technical:`Prioritize audit findings and inspect the pages that need work.`},di=[{id:`all`,label:`All`,healthState:void 0},{id:`hidden`,label:`Hidden pages`,healthState:xe.hidden}],fi={[fe.metaRobotsNoindex]:`Hidden by meta robots tag`,[fe.xRobotsNoindex]:`Hidden by X-Robots-Tag header`,[fe.robotsDisallow]:`Blocked by robots.txt`,[fe.redirectTerminal]:`Redirects to another page`,[fe.canonicalToOther]:`Points to another page as canonical`,[fe.notHtmlOrUnavailable]:`Not an HTML page, so it was not scored`},pi=new Map(Object.entries(fi));function mi(e){return pi.get(e)??e}var hi=20,gi=200,_i=100,vi=100,yi=50,bi=C,xi=ue,Si=2e4,Ci=3,wi=new Intl.NumberFormat,Ti=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,year:`numeric`}),Ei={eligible:`positive`,hidden:`caution`,resource:`neutral`,redirect:`neutral`,failed:`negative`,unchecked:`neutral`};function Di(e){if(!e)return`Date unavailable`;let t=new Date(e);return Number.isNaN(t.getTime())?`Date unavailable`:Ti.format(t)}function Oi(e){return e.replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ki(e){let t=sr(e);return{label:cr(t),tone:Ei[t]}}function Ai(e){return e==null?`Not scored`:pe(e,ye.percent)}function ji(e){return e.auditScore==null?`Not checked`:`${Math.round(e.auditScore)}/100`}function $(e){return e==null?`Not available`:wi.format(e)}var Mi={clicksFromHome:`How many clicks it takes to reach this page from the home page, following links.`,linksIn:`How many other pages link to this page.`,linksOut:`How many other pages this page links to.`,linkImportance:`How much link value flows to this page, based on how many pages link to it and how important those pages are. Shown relative to the highest page on this site, which is 100%.`,technicalScore:`How well this page is set up for AI and search engines to read, from 0 to 100. Open a page to see what it is marked down for.`,linkTimes:`How many times this link appears on the page it comes from.`,pagesFound:`How many pages this scan discovered, whether or not it could load them.`,pagesChecked:`How many of the pages it found this scan actually loaded.`,internalLinks:`How many links between pages on this site the scan recorded.`},Ni=new Set([`clicksFromHome`,`linkImportance`,`internalLinks`,`pagesFound`,`pagesChecked`]);function Pi(e,t){let n=Mi[e];return Ni.has(e)?`${n} This always counts every link, including menu and footer.`:e===`technicalScore`||e===`linkTimes`?n:t?`${n} Right now this counts only links written in your page text. Menu and footer links are hidden.`:`${n} This counts every link, including menu and footer.`}function Fi(e,t){return`${wi.format(e)} ${t}${e===1?``:`s`}`}function Ii(e,t){if(!e||!t)return null;try{let n=new URL(e),r=new URL(t),i=e=>e.hostname.toLowerCase().replace(/\.$/,``).replace(/^www\./,``);return i(n)===i(r)?null:{requested:n.host,effective:r.host}}catch{return null}}function Li(e){return e===`completed`?`positive`:e===`partial`||e===`queued`||e===`running`?`caution`:e===`failed`||e===`cancelled`?`negative`:`neutral`}var Ri=`Latest scan`,zi=`Shows the most complete scan from the latest day with results. Choose a dated entry to view another scan.`;function Bi(e){let t=Di(e.finishedAt??e.startedAt??e.createdAt),n=e.hasCrawlData?``:` · Score only`;return`${t} · ${Oi(e.status)}${n}`}var Vi=new Map(Object.entries({complete:`This scan finished on its own.`,unknown:`This scan stopped before it checked every page it found.`,"max-pages":`This scan stopped at the page limit, so some pages were not checked.`,"max-edges":`This scan stopped at the link limit, so some links are missing.`,"max-fetches":`This scan stopped after checking as many pages as it could.`,"max-duration":`This scan ran out of time, so some pages were not checked.`,"max-bytes":`This scan stopped at the data limit, so some pages were not checked.`,"max-page-bytes":`This scan skipped a page that was too large to read.`,"max-depth":`This scan stopped at the depth limit, so deeper pages were not checked.`,"max-links-per-page":`This scan stopped reading links on pages that had too many.`,"max-query-variants":`This scan stopped at the limit for pages that differ only by a query string.`,"max-sitemap-fanout":`This scan stopped at the sitemap limit, so some sitemaps were not read.`,"max-sitemap-urls":`This scan stopped at the sitemap page limit, so some pages were not found.`,"root-host-redirect":`The site moved to another address during this scan.`})),Hi=Ye,Ui=[{value:null,label:`Default (10 clicks)`},{value:1,label:`1 click from the home page`},{value:2,label:`2 clicks`},{value:3,label:`3 clicks`},{value:5,label:`5 clicks`},{value:20,label:`20 clicks`},{value:50,label:`50 clicks`},{value:100,label:`100 clicks (maximum)`}],Wi={"max-pages":`Raise the page budget in Scan settings.`,"max-edges":`Raise the page budget in Scan settings.`,"max-fetches":`Raise the page budget in Scan settings.`,"max-duration":`Try a smaller scan in Scan settings.`,"max-depth":`Raise the crawl depth in Scan settings.`};function Gi(e,t=!1){if(!e)return null;let n=Wi[e]??null;return n&&t?`${n.replace(/ in Scan settings\.$/,``)} in Site Health's Scan settings after setup.`:n}function Ki(e){return e?Vi.get(e)??`This scan stopped early: ${e}.`:`This scan stopped before it checked every page it found.`}var qi={applied:`This scan told menu and footer links apart by how often the same link repeats across pages. It cannot spot a link written into the page text when its wording matches the menu. Run a new scan to read the page layout instead.`,"applied-placement":`This scan read where each link sits in the page, so links in the page text are separated from the menu, header, and footer even when they use the same wording.`,"applied-placement-with-ubiquity":`This scan read where each link sits in the page. Some pages mark out no menu or main area, so those links fall back to how often the link repeats across pages, which can miss a link written into the page text.`,"applied-placement-partial":`This scan read where each link sits in the page. Some pages mark out no menu or main area, and this scan found fewer than 15 pages, so nothing could tell those links apart. They are counted as links in your page text, which is what a link no rule marked as menu, header, or footer means here.`,"unavailable-too-few-pages":`This scan found fewer than 15 pages and did not read where each link sits in the page. On a site that small every link is on most pages, so menu and footer links cannot be told apart from the rest.`,"unavailable-legacy-scan":`This scan ran before menu and footer links were separated. Run a new scan to split them out.`},Ji=new Map(Object.entries(qi));function Yi(e){return e===null?``:Ji.get(e)??qi[`unavailable-legacy-scan`]}var Xi=`Scroll to zoom. Click a page to inspect it.`,Zi=`Observed links to and from this page in the selected scan.`,Qi=`Page positions on this map were set before menu and footer links were separated. Run a new scan to update them.`;function $i(e){if(e.filterUnavailable)return`All ${Fi(e.totalEdgeCount,`link`)} shown.`;let t=`${wi.format(e.contentEdgeCount)} link${e.contentEdgeCount===1?``:`s`} in your page text`,n=wi.format(e.templateEdgeCount);return e.showTemplateLinks?`${t}, ${n} menu and footer.`:`${t}. ${n} menu and footer link${e.templateEdgeCount===1?``:`s`} hidden.`}var ea=`Menu, header, and footer links repeat on every page, so they say nothing about which pages relate to each other. Links written in your page text do.`;function ta(e,t){let n=[ea,Yi(e)];return t.staleLayout&&n.push(Qi),n.filter(Boolean).join(` `)}function na(e,t,n){if(e===`disabled`)return{label:`Broken links: not checked`,tone:`neutral`};let r=n??0,i=r>0?`, ${wi.format(r)} unchecked`:``;return e===`complete`?t?{label:`Broken links: ${wi.format(t)} found${i}`,tone:`negative`}:r>0?{label:`Broken links: none found, ${wi.format(r)} unchecked`,tone:`caution`}:{label:`Broken links: none found`,tone:`positive`}:e===`partial`?{label:`Broken links: ${wi.format(t??0)} found so far${i}`,tone:`caution`}:{label:`Broken links: not checked`,tone:`neutral`}}function ra(e){return e.showTemplateLinks||!e.known?{value:$(e.total),hiddenNote:null,filtered:!1}:{filtered:!0,value:e.truncated?`${$(e.visible)}+`:$(e.visible),hiddenNote:e.hidden===0?null:e.truncated?`At least ${$(e.hidden)} menu and footer hidden`:`${$(e.hidden)} menu and footer hidden`}}function ia({label:e,value:t,hiddenNote:n,help:r}){return(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-1 text-xs text-muted`,children:[e,(0,Q.jsx)(L,{text:r})]}),(0,Q.jsx)(`dd`,{className:`mt-1 text-sm font-medium tabular-nums text-heading`,children:t}),n&&(0,Q.jsx)(`dd`,{className:`mt-0.5 text-xs text-muted`,children:n})]})}function aa({page:e,inbound:t,outbound:n}){return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default sm:grid-cols-4 sm:divide-y-0`,children:[(0,Q.jsx)(ia,{label:`Clicks from home`,value:String(e.depth??`Not reached`),help:Pi(`clicksFromHome`,!1)}),(0,Q.jsx)(ia,{label:`Links in`,value:t.value,hiddenNote:t.hiddenNote,help:Pi(`linksIn`,t.filtered)}),(0,Q.jsx)(ia,{label:`Links out`,value:n.value,hiddenNote:n.hiddenNote,help:Pi(`linksOut`,n.filtered)}),(0,Q.jsx)(ia,{label:`Link importance`,value:Ai(e.linkScoreNormalized),help:Pi(`linkImportance`,!1)})]})})}function oa(e,t,n){return t===0?e===`inbound`?`Nothing links to this page.`:`This page links to nothing.`:`${e===`inbound`?`No links in the page text point here.`:`No links in the page text lead away from here.`} ${n?`At least ${$(t)} menu and footer links hidden.`:`${Fi(t,`menu and footer link`)} hidden.`}`}function sa({label:e,metric:t}){return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e,(0,Q.jsx)(L,{text:Pi(t,!1)})]})}function ca({direction:e,edges:t,truncated:n,rootHost:r,hiddenTemplateCount:i}){let a=e===`inbound`?`Links in`:`Links out`;return(0,Q.jsxs)(`section`,{className:`min-w-0`,"aria-labelledby":`site-health-${e}-heading`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`h4`,{id:`site-health-${e}-heading`,className:`text-sm font-medium text-heading`,children:[a,` (`,$(t.length),`)`]}),n&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted`,children:[`First `,vi]})]}),t.length===0?(0,Q.jsx)(`p`,{className:`rounded-lg border border-subtle bg-surface-subtle px-3 py-4 text-sm text-secondary`,children:oa(e,i,n)}):(0,Q.jsx)(`div`,{className:`evidence-table-wrap max-h-64 overflow-auto`,children:(0,Q.jsxs)(`table`,{className:`evidence-table site-health-table min-w-[420px]`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{scope:`col`,children:`Page`}),(0,Q.jsx)(`th`,{scope:`col`,children:`Anchor text`}),(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(sa,{label:`Times`,metric:`linkTimes`})})]})}),(0,Q.jsx)(`tbody`,{children:t.map(t=>{let n=e===`inbound`?t.sourceUrl:t.targetUrl;return(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`max-w-64 truncate font-mono`,title:n,children:it(n,r)}),(0,Q.jsx)(`td`,{className:`max-w-52 truncate`,title:t.anchors.join(`, `)||void 0,children:t.anchors.join(`, `)||`No anchor text`}),(0,Q.jsx)(`td`,{className:`tabular-nums`,children:$(t.occurrences)})]},t.edgeKey)})})]})})]})}function la(e){return e&&`indexabilityReasons`in e?e.indexabilityReasons:[]}function ua({page:e,isLoading:t,error:n,inbound:r,outbound:i,inboundTruncated:a,outboundTruncated:o,audit:s,auditLoading:u,auditError:d,onRetryAudit:f,rootHost:p,reasonSource:m,reasonsState:h,onRetryReasons:g,showTemplateLinks:_}){if(!e)return(0,Q.jsxs)(`section`,{className:`border-t border-default pt-5`,"aria-label":`Selected page details`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-medium text-heading`,children:`Page links`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`Select a page to inspect its internal links and crawl signals.`})]});let ee=ki(e),te=la(m??e),v=_?r:r.filter(e=>!e.isTemplate),y=_?i:i.filter(e=>!e.isTemplate),ne=!t&&!n,b=r.length-v.length,re=i.length-y.length,ie=ra({total:e.inboundUniqueEdges,visible:v.length,hidden:b,truncated:a,showTemplateLinks:_,known:ne}),ae=ra({total:e.outboundUniqueEdges,visible:y.length,hidden:re,truncated:o,showTemplateLinks:_,known:ne});return(0,Q.jsxs)(`section`,{className:`border-t border-default pt-5`,"aria-labelledby":`site-health-page-inspector-title`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col justify-between gap-3 sm:flex-row sm:items-start`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h3`,{id:`site-health-page-inspector-title`,className:`break-words font-mono text-base font-semibold text-heading`,children:e.path}),(0,Q.jsx)(E,{tone:ee.tone,children:ee.label})]}),(0,Q.jsx)(`p`,{className:`mt-1 break-all text-sm text-secondary`,children:e.url}),h===`loading`?(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,role:`status`,children:`Loading page details...`}):h===`error`?(0,Q.jsxs)(`p`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-negative`,role:`alert`,children:[`Page details could not be loaded, so any reason this page is hidden is unknown.`,(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,onClick:g,children:`Try again`})]}):te.length>0?(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-secondary`,"aria-label":`Why this page is hidden`,children:te.map(e=>(0,Q.jsx)(`li`,{children:mi(e)},e))}):null]}),(0,Q.jsx)(T,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[`Open page `,(0,Q.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`})]})})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(zr,{audit:s,isLoading:u,error:d,onRetry:f})}),(0,Q.jsxs)(`section`,{className:`mt-5 border-t border-default pt-5`,"aria-labelledby":`site-health-page-links-heading`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`h3`,{id:`site-health-page-links-heading`,className:`text-base font-semibold text-heading`,children:`Internal links`}),(0,Q.jsx)(L,{text:Zi})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(aa,{page:e,inbound:ie,outbound:ae})}),(0,Q.jsx)(`div`,{className:`mt-5`,children:t?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-secondary`,children:[(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading page links...`]}):n?(0,Q.jsx)(`p`,{className:`rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative`,role:`alert`,children:`Page links could not be loaded.`}):(0,Q.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,Q.jsx)(ca,{direction:`inbound`,edges:v,truncated:a,rootHost:p,hiddenTemplateCount:b}),(0,Q.jsx)(ca,{direction:`outbound`,edges:y,truncated:o,rootHost:p,hiddenTemplateCount:re})]})})]})]})}function da({pages:e,total:t,selectedNodeKey:n,onSelect:r,hasNextPage:i,isFetchingNextPage:a,onLoadMore:o,filter:s,onFilterChange:c,filterUnavailable:u}){let[d,f]=(0,R.useState)(``),p=d.trim().toLowerCase(),m=(0,R.useMemo)(()=>p?e.filter(e=>`${e.path} ${e.url}`.toLowerCase().includes(p)):e,[p,e]),g=p.length>0&&(i||e.length<t);return(0,Q.jsxs)(`section`,{"aria-labelledby":`site-health-inventory-heading`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-col justify-between gap-3 sm:flex-row sm:items-end`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{id:`site-health-inventory-heading`,className:`text-base font-semibold text-heading`,children:`Pages`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:s===`all`?`Showing ${$(e.length)} of ${$(t)} pages found.`:`Showing ${$(e.length)} of ${$(t)} hidden pages.`})]}),(0,Q.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`Search loaded pages`}),(0,Q.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted`,"aria-hidden":`true`}),(0,Q.jsx)(`input`,{type:`search`,value:d,onChange:e=>f(e.target.value),placeholder:`Search loaded pages`,className:`h-9 w-full rounded-md border border-base bg-bg pl-9 pr-3 text-sm text-primary outline-none placeholder-mono-600 focus:border-strong focus:ring-2 focus:ring-mono-600`})]})]}),(0,Q.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2`,role:`group`,"aria-label":`Filter pages`,children:di.map(e=>(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":s===e.id,onClick:()=>c(e.id),className:`filter-chip ${s===e.id?`filter-chip-active`:``}`,children:e.label},e.id))}),(0,Q.jsx)(`div`,{className:`evidence-table-wrap`,children:(0,Q.jsxs)(`table`,{className:`evidence-table site-health-table min-w-[800px]`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{scope:`col`,children:`Page`}),(0,Q.jsx)(`th`,{scope:`col`,title:ur(`eligible`),children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(sa,{label:`Clicks from home`,metric:`clicksFromHome`})}),(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(sa,{label:`Links in`,metric:`linksIn`})}),(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(sa,{label:`Links out`,metric:`linksOut`})}),(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(sa,{label:`Link importance`,metric:`linkImportance`})}),(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(sa,{label:`Score`,metric:`technicalScore`})})]})}),(0,Q.jsx)(`tbody`,{children:m.map(e=>{let t=ki(e);return(0,Q.jsxs)(`tr`,{className:n===e.nodeKey?`bg-surface-active`:void 0,children:[(0,Q.jsx)(`td`,{className:`max-w-80`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(e.nodeKey),className:`block max-w-full truncate rounded-sm font-mono text-sm font-medium text-link outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,title:e.url,children:e.path})}),(0,Q.jsx)(`td`,{title:ur(sr(e)),children:(0,Q.jsx)(E,{tone:t.tone,children:t.label})}),(0,Q.jsx)(`td`,{className:`tabular-nums`,children:e.depth??`Not reached`}),(0,Q.jsx)(`td`,{className:`tabular-nums`,children:$(e.inboundUniqueEdges)}),(0,Q.jsx)(`td`,{className:`tabular-nums`,children:$(e.outboundUniqueEdges)}),(0,Q.jsx)(`td`,{className:`tabular-nums`,children:Ai(e.linkScoreNormalized)}),(0,Q.jsx)(`td`,{className:`tabular-nums`,children:ji(e)})]},e.nodeKey)})})]})}),m.length===0&&(0,Q.jsx)(`p`,{className:`border-x border-b border-default px-4 py-8 text-center text-sm text-secondary`,children:p.length===0?u?`This scan cannot be filtered. Run a new scan to filter its pages.`:s===`hidden`?`No hidden pages were found in this scan.`:`No pages are available.`:g?`No matches in the ${$(e.length)} loaded pages. Load more pages to continue searching.`:`No pages match this search.`}),i&&(0,Q.jsx)(`div`,{className:`flex justify-center border-x border-b border-default px-4 py-3`,children:(0,Q.jsxs)(T,{variant:`secondary`,size:`sm`,disabled:a,onClick:o,children:[a&&(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),a?`Loading more pages`:`Load more pages`]})})]})}function fa({projectName:e,runId:t,section:n,onSelect:r}){let[i,a]=(0,R.useState)(!1),o=n.pageCount-+!!n.hasPage>0;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-1 px-2 py-1`,children:[o?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`${i?`Collapse`:`Expand`} ${n.path}`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-muted outline-none hover:bg-surface-hover hover:text-heading focus-visible:ring-2 focus-visible:ring-mono-400`,children:i?(0,Q.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}):(0,Q.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(`span`,{className:`block size-8 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(n.path),className:`min-w-0 flex-1 break-all rounded-sm py-2 text-left font-mono text-sm text-heading outline-none hover:text-link focus-visible:ring-2 focus-visible:ring-mono-400`,children:n.path}),(0,Q.jsx)(`span`,{className:`shrink-0 px-2 font-mono text-xs text-muted`,children:$(n.pageCount)})]}),i&&(0,Q.jsx)(`div`,{className:`ml-6 border-l border-default pl-1`,children:(0,Q.jsx)(ma,{projectName:e,runId:t,parentPath:n.path,onSelect:r})})]})}function pa({page:e,onSelect:t}){return(0,Q.jsx)(`li`,{className:`bg-surface-subtle`,children:(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-1 px-2 py-1`,children:[(0,Q.jsx)(`span`,{className:`block size-8 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t(e.nodeKey),className:`min-w-0 flex-1 break-all rounded-sm py-2 text-left font-mono text-sm font-semibold text-heading outline-none hover:text-link focus-visible:ring-2 focus-visible:ring-mono-400`,children:e.path||`/`}),(0,Q.jsx)(`span`,{className:`shrink-0 px-2 font-mono text-xs text-muted`,children:$(1)})]})})}function ma({projectName:e,runId:t,parentPath:n,onSelect:r,rootPage:i,onSelectRootPage:a}){let o={client:w,path:{name:e},query:{runId:t,parentPath:n,limit:_i}},s=ne({...j(o),initialPageParam:o,getNextPageParam:e=>e.nextCursor?{path:o.path,query:{...o.query,cursor:e.nextCursor}}:void 0}),c=s.data?.pages.flatMap(e=>e.children)??[];return s.isLoading?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-sm text-secondary`,role:`status`,children:[(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),` Loading sections...`]}):s.error?(0,Q.jsx)(`p`,{className:`px-3 py-4 text-sm text-negative`,role:`alert`,children:`Site sections could not be loaded.`}):c.length===0&&!i?(0,Q.jsx)(`p`,{className:`px-3 py-4 text-sm text-secondary`,children:`No nested sections were found.`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`ul`,{className:`divide-y divide-default`,children:[i&&a&&(0,Q.jsx)(pa,{page:i,onSelect:a}),c.map(n=>(0,Q.jsx)(fa,{projectName:e,runId:t,section:n,onSelect:r},n.path))]}),s.hasNextPage&&(0,Q.jsx)(`div`,{className:`px-3 py-2`,children:(0,Q.jsx)(T,{variant:`ghost`,size:`sm`,disabled:s.isFetchingNextPage,onClick:()=>void s.fetchNextPage(),children:s.isFetchingNextPage?`Loading more sections`:`Load more sections`})})]})}function ha(){return(0,Q.jsx)(`div`,{role:`status`,className:`flex min-h-[420px] items-center justify-center rounded-lg border border-default bg-surface-inset px-6 text-center lg:min-h-[520px]`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(l,{className:`mx-auto size-5 motion-safe:animate-spin text-muted`,"aria-hidden":`true`}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-heading`,children:`Preparing the interactive site map`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`Page and link data is ready for the graph renderer.`})]})})}function ga(e){return e===`discovering`?`Discovering pages`:e===`checking`?`Checking pages`:e===`arranging-map`?`Arranging map`:e===`queued`?`Waiting to start`:`Preparing scan`}var _a=3;function va(e){return e===`checking`?1:e===`arranging-map`?2:0}function ya({phase:e,pagesChecked:t,pageLimit:n,finalStep:r}){let i=va(e),a=i===1&&t!==null&&n?Math.min(1,t/n):null,o=[`Find pages`,i===1&&t!==null?`Check pages · ${$(t)}${n?` of up to ${$(n)}`:``}`:`Check pages`,r];return(0,Q.jsxs)(`div`,{className:`mt-4`,role:`progressbar`,"aria-label":`Scan progress`,"aria-valuemin":0,"aria-valuemax":_a,"aria-valuenow":i+(a??0),"aria-valuetext":o[i],children:[(0,Q.jsx)(`div`,{className:`grid grid-cols-[1fr_2fr_1fr] gap-1.5`,"aria-hidden":`true`,children:o.map((e,t)=>(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-inset`,children:t<i?(0,Q.jsx)(`div`,{className:`h-full w-full rounded-full bg-positive-400`}):t===i&&a!==null?(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-positive-400 transition-[width] duration-500`,style:{width:`${Math.max(4,a*100)}%`}}):t===i?(0,Q.jsx)(`div`,{className:`h-full w-full rounded-full bg-positive-400/40 motion-safe:animate-pulse`}):null},e))}),(0,Q.jsx)(`div`,{className:`mt-2 grid grid-cols-[1fr_2fr_1fr] gap-1.5 text-sm`,"aria-hidden":`true`,children:o.map((e,t)=>(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate ${t===i?`font-medium text-heading`:t<i?`text-secondary`:`text-muted`}`,children:[t<i?(0,Q.jsx)(_,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):null,(0,Q.jsx)(`span`,{className:`truncate`,children:e})]},e))})]})}function ba(e){return e!==`completed`&&e!==`partial`&&e!==`failed`&&e!==`cancelled`}function xa(e){return e===`queued`||e===`discovering`||e===`checking`||e===`arranging-map`}function Sa(e){return e===`completed`||e===`partial`||e===`failed`||e===`cancelled`}function Ca(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.code==`string`)return t.code;if(t.error&&typeof t.error==`object`){let e=t.error;return typeof e.code==`string`?e.code:null}return null}function wa(e){if(!e)return null;let t=Date.parse(e);return!Number.isFinite(t)||t>Date.now()?null:t+Si}function Ta({active:e,runId:t,createdAt:n}){let r=wa(n),[i,a]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(!e||!t||r==null){a(null);return}let n=r-Date.now();if(n<=0){a({runId:t,deadline:r});return}a(null);let i=window.setTimeout(()=>a({runId:t,deadline:r}),n);return()=>window.clearTimeout(i)},[e,r,t]),e&&t!=null&&r!=null&&(Date.now()>=r||i?.runId===t&&i.deadline===r)}function Ea({onContinueOnboarding:e,onSkipOnboarding:t}){return(0,Q.jsxs)(`section`,{"aria-labelledby":`site-health-continuation-heading`,className:`mt-5 flex flex-col gap-3 border-t border-default pt-5 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{id:`site-health-continuation-heading`,className:`text-base font-semibold text-heading`,children:`Continue while Site Health finishes`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`Canonry will finish this scan locally. Saved results will appear in Site Health.`})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsx)(T,{type:`button`,onClick:e,children:`Set up AI Visibility`}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,onClick:t,children:`Skip for now`})]})]})}function Da({view:e,tabbed:t=!0,children:n}){return(0,Q.jsx)(`div`,{id:t?`site-health-${e}-panel`:void 0,role:t?`tabpanel`:void 0,"aria-labelledby":t?`site-health-${e}-tab`:void 0,className:`min-w-0`,children:n})}function Oa({status:e,progress:t,progressError:n,onRetryProgress:r,pageHealthDestination:i=!1,firstLook:a=!1,boundedPageLimit:o,livePageHealthPreview:s,livePageHealthError:c=!1,livePageHealthRunId:l=null,continuation:u}){let d=t?.attempt??null,f=t?.phase??e,p=f===`arranging-map`;return(0,Q.jsxs)(`section`,{"aria-label":`Current scan progress`,className:`rounded-lg border border-default bg-surface-subtle px-5 py-6`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-6 items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-heading`,children:p&&i?`Preparing page health`:p?`Preparing site map`:a?`Checking your site`:`Scanning site`}),a?(0,Q.jsx)(L,{text:o?`A quick scan to find your first fixes. Reads up to ${o} pages, or stops sooner at the time limit, so results come back fast. You can run a larger scan from Site Health later.`:`A quick scan to find your first fixes. Stops at its page budget or the time limit, so results come back fast. You can run a larger scan from Site Health later.`}):null]}),(0,Q.jsx)(`p`,{"aria-atomic":`true`,"aria-label":`Current scan progress`,"aria-live":`polite`,role:`status`,className:`sr-only`,children:i?p?`Finalizing page health. The scan is complete and its findings are being published.`:`${ga(f)}. Page health appears after the scan finishes.`:p?`Arranging map. The scan is complete and its map is being published.`:`${ga(f)}. The map appears after the scan finishes.`}),(0,Q.jsx)(ya,{phase:f,pagesChecked:d?.pagesFetched??null,pageLimit:o??null,finalStep:i?`Build report`:`Build map`}),(0,Q.jsxs)(`dl`,{"aria-label":`Live scan counters`,className:`mt-5 grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default bg-surface-subtle sm:grid-cols-4 sm:divide-y-0`,children:[(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`dt`,{className:`text-sm text-secondary`,children:`Pages found`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono text-lg font-semibold tabular-nums text-heading`,children:d?$(d.pagesDiscovered):`—`})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`dt`,{className:`text-sm text-secondary`,children:`Pages checked`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono text-lg font-semibold tabular-nums text-heading`,children:d?$(d.pagesFetched):`—`})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`dt`,{className:`text-sm text-secondary`,children:`Links found`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono text-lg font-semibold tabular-nums text-heading`,children:d?$(d.edgesDiscovered):`—`})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`dt`,{className:`text-sm text-secondary`,children:`Pages failed`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono text-lg font-semibold tabular-nums text-heading`,children:d?$(d.pagesErrored):`—`})]})]}),n&&(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3 text-sm text-secondary`,children:[(0,Q.jsx)(`span`,{children:p?i?`Page health publishing status could not load.`:`Map publishing status could not load.`:`Live scan counts could not load. The scan is still running.`}),r&&(0,Q.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,onClick:r,children:`Retry progress`})]}),i?(0,Q.jsx)(Na,{runId:l,preview:s,error:c}):null,u]})}function ka(){return Array.from({length:Ci},()=>null)}function Aa(e,t){return e===t||e!=null&&t!=null&&e.nodeKey===t.nodeKey&&e.url===t.url&&e.auditScore===t.auditScore&&e.checksNeedingAttention===t.checksNeedingAttention}function ja(e,t){return e.length===t.length&&e.every((e,n)=>Aa(e,t[n]??null))}function Ma(e,t){let n=[...e];for(let e of t){let t=n.findIndex(t=>t?.nodeKey===e.nodeKey);if(t>=0){n[t]=e;continue}let r=n.findIndex(e=>e==null);if(r<0)break;n[r]=e}return n}function Na({runId:e,preview:t,error:n=!1}){let[r,i]=(0,R.useState)(()=>({runId:e,slots:ka()})),a=t?.state===`terminal`,o=a||r.runId!==e?ka():r.slots;(0,R.useEffect)(()=>{i(n=>{let r=n.runId===e?n.slots:ka(),i=a?ka():Ma(r,t?.examples??[]);return n.runId===e&&ja(n.slots,i)?n:{runId:e,slots:i}})},[t?.examples,e,a]);let s=t?.pagesAudited??0,c=o.some(e=>e!=null);return(0,Q.jsxs)(`section`,{"aria-labelledby":`live-page-health-findings-heading`,className:`mt-5 border-t border-default pt-5`,children:[(0,Q.jsx)(`h3`,{id:`live-page-health-findings-heading`,className:`text-base font-semibold text-heading`,children:`Findings so far`}),(0,Q.jsxs)(`div`,{className:`relative mt-1 min-h-[5.25rem] text-sm text-secondary sm:min-h-[3.5rem]`,children:[(0,Q.jsxs)(`p`,{children:[`Based on `,wi.format(s),` audited pages. Results may change until the scan finishes.`]}),(0,Q.jsx)(`p`,{className:be(`absolute bottom-0 text-caution`,n?`visible`:`invisible`),children:`Live findings paused. The scan is still running.`})]}),(0,Q.jsx)(`ul`,{"aria-label":`Live Page Health findings`,className:`mt-3 grid h-[10.5rem] grid-rows-3 divide-y divide-default overflow-hidden rounded-lg border border-default bg-surface-subtle`,children:o.map((e,t)=>{let n=e==null&&t===0&&!c;return(0,Q.jsx)(`li`,{"aria-hidden":e==null&&!n||void 0,"data-testid":`live-page-health-slot`,className:`grid h-14 min-h-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-4 sm:gap-4`,children:e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-strong`,title:e.url,children:e.url}),(0,Q.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap text-sm tabular-nums text-secondary`,children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`sm:hidden`,children:[wi.format(e.checksNeedingAttention),` checks`]}),(0,Q.jsxs)(`span`,{className:`hidden sm:inline`,children:[wi.format(e.checksNeedingAttention),` checks need attention`]}),(0,Q.jsxs)(`span`,{className:`sr-only sm:hidden`,children:[wi.format(e.checksNeedingAttention),` checks need attention`]})]})]}):n?(0,Q.jsx)(`span`,{className:`text-sm text-secondary`,children:`Checks that need attention will appear here.`}):null},`live-page-health-slot-${t}`)})})]})}function Pa({phase:e,progress:t,onRunAgain:n,pageHealthDestination:r=!1}){let i=e===`cancelled`,a=t?.error??t?.attempt?.error;return(0,Q.jsxs)(`section`,{"aria-label":`Site scan recovery`,role:`alert`,className:`rounded-lg border border-negative bg-negative-soft px-5 py-6`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-negative`,children:i?`Scan cancelled`:`Scan failed`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:r?i?`The scan was cancelled before Canonry could publish page health results.`:`The scan did not complete, so page health results are unavailable.`:i?`The scan was cancelled before Canonry could publish a site map.`:`The scan did not complete, so there is no site map for this run.`}),a&&(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-negative`,children:a}),n&&(0,Q.jsx)(T,{type:`button`,className:`mt-4`,onClick:n,children:`Run scan again`})]})}function Fa({projectName:e,projectId:t,initialRunId:n,onReleaseInitialRun:r,showOnboardingActions:a=!1,onContinueOnboarding:o,onSkipOnboarding:s}){let c=(0,R.useId)(),[u,d]=(0,R.useState)(`map`),p=(0,R.useRef)([]),[m,h]=(0,R.useState)(()=>n??null),[_,ee]=(0,R.useState)(null),te=(0,R.useRef)(n),[v,b]=(0,R.useState)(null),[re,ie]=(0,R.useState)(!1),[ae,oe]=(0,R.useState)(!1),[se,ce]=(0,R.useState)(!0),[x,ue]=(0,R.useState)(null),[de,fe]=(0,R.useState)(null),[pe,S]=(0,R.useState)(!1),[me,C]=(0,R.useState)(`all`),[he,_e]=(0,R.useState)(!1),ye=le(),{isAdmin:xe}=we(),Te=Se(),k=(Te||Ce(ve[`site-audit`]))&&!xe,A=a&&!ye,Oe=Ge(),j=!A&&!ye&&!k,Ne=y({...Pe({client:w,path:{name:e}}),enabled:j,staleTime:D});(0,R.useEffect)(()=>{let e=te.current;e!==n&&(te.current=n,h(t=>n??(t===e?null:t)),b(null))},[n]);let Ie=y({...O({client:w,path:{name:e},query:{limit:hi}}),refetchOnWindowFocus:`always`,refetchInterval:e=>e.state.data?.scans.some(e=>e.status===`queued`||e.status===`running`)?3e3:15e3}),P=Ie.data?.scans??[],F=P.find(e=>e.status===`queued`||e.status===`running`),Le=P.find(e=>e.status===`completed`||e.status===`partial`),Re=A?Oe.data?.runId??null:null,ze=A?null:Oe.data?.runId??null,Be=ze&&ze!==_&&P.some(e=>e.runId===ze&&(e.status===`completed`||e.status===`partial`))?ze:null,I=m??(A?Re??F?.runId??Le?.runId:Be??Ie.data?.preferredRunId??Le?.runId??F?.runId)??null,Ve=F?.runId===I?F:null,We=I?P.find(e=>e.runId===I):void 0,Ke=!!(n&&I===n),Ye=!!(Re&&I===Re),$e=Ye&&!We,tt=Ve?.runId??(Ke||$e?I:null),z=y({...Fe({client:w,path:{name:e,runId:tt??``}}),enabled:!!tt,refetchInterval:e=>ba(e.state.data?.phase)?3e3:!1,refetchIntervalInBackground:!0});(0,R.useEffect)(()=>{Ke&&z.isError&&Ca(z.error)===`NOT_FOUND`&&(h(null),b(null),r?.())},[z.error,z.isError,Ke,r]);let rt=xa(z.data?.phase),it=Sa(z.data?.phase)?null:Ve,at=!!(tt&&z.isPending),ot=!(!Ke&&!Ye||We||!z.isError),st=!!(A&&tt&&(it?.runId===tt||rt)),ct=y({...Me({client:w,path:{name:e,runId:tt??``}}),enabled:st,refetchInterval:e=>e.state.data?.state!==`terminal`&&3e3,refetchIntervalInBackground:!0}),B=!!(it||rt||at||ot),V=z.data?.phase===`failed`||z.data?.phase===`cancelled`?z.data.phase:(Ke||Ye)&&(We?.status===`failed`||We?.status===`cancelled`)?We.status:null,H=y({...N({client:w,path:{name:e},...I?{query:{runId:I}}:{}}),enabled:!B}),U=H.data,W=I??U?.runId??null,G=!!(W&&U?.hasCrawlData&&U.detailsAvailable),lt=G&&!A,ut=W?{runId:W}:{},K=y({...je({client:w,path:{name:e},query:{...ut,maxNodes:bi,maxEdges:xi}}),enabled:lt&&!B}),dt=di.find(e=>e.id===me)?.healthState,ft={client:w,path:{name:e},query:{...ut,...dt?{healthState:dt}:{},limit:gi,sort:`path`}},q=ne({...M(ft),enabled:lt,initialPageParam:ft,getNextPageParam:e=>e.nextCursor?{path:ft.path,query:{...ft.query,cursor:e.nextCursor}}:void 0}),J=lt&&(U?.deadLinks.state===`complete`||U?.deadLinks.state===`partial`),Y=y({...Ae({client:w,path:{name:e},query:{...ut,limit:yi}}),enabled:J}),pt=K.data?.nodes??[],mt=K.data?.layout.state===`ready`?K.data.totalEdges:null,ht=K.data?.edges??[],gt=(0,R.useMemo)(()=>ht.filter(e=>e.isTemplate).length,[ht]),_t=ht.length-gt,vt=K.data?.templateDetection??null,yt=vt===null||!ge(vt),bt=(0,R.useMemo)(()=>he||yt?ht:ht.filter(e=>!e.isTemplate),[ht,he,yt]),xt=K.data?.layout.state===`ready`&&!K.data.layout.templateLinksExcluded,St=(0,R.useMemo)(()=>q.data?.pages.flatMap(e=>e.pages)??[],[q.data]),Ct=q.data?.pages[0]?.total??St.length,wt=(0,R.useMemo)(()=>St.find(e=>e.nodeKey===v)??null,[St,v]),Tt=!!(G&&v&&!wt),Et=y({...ke({client:w,path:{name:e},query:{...ut,...dt?{healthState:dt}:{},nodeKey:v??void 0,limit:1}}),enabled:Tt}),Dt=wt??Et.data?.pages[0]??null,Ot=!!(v&&dt&&Tt&&Et.isSuccess&&Et.data.healthStateFilter===`applied`&&Et.data.pages.length===0);(0,R.useEffect)(()=>{Ot&&b(null)},[Ot]);let kt=(0,R.useMemo)(()=>Ot?null:pt.find(e=>e.nodeKey===v)??Dt,[pt,Dt,v,Ot]),At=kt?.nodeKey??null;qe(e,{view:`site-health`,page:{...W?{runId:W}:{},...At?{nodeKey:At}:{}}});let jt=kt?Dt?`ready`:Et.isError?`error`:Tt&&Et.isLoading?`loading`:`ready`:`idle`,Mt=y({...De({client:w,path:{name:e},query:{...ut,nodeKey:At??void 0,limit:vi}}),enabled:lt&&!!At}),Nt=y({...Ee({client:w,path:{name:e},query:{...ut,nodeKey:At??void 0}}),enabled:lt&&!!At}),Pt=(0,R.useMemo)(()=>{let e=P.filter(e=>e.status===`completed`||e.status===`partial`),t=m?P.find(e=>e.runId===m):void 0;return t&&!e.some(e=>e.runId===t.runId)?[t,...e]:e},[P,m]),Ft=P[0]?.status??null,It=W?We:void 0,Lt=it?it.status:rt?z.data?.status??null:V??U?.runStatus??It?.status??null,Rt=Lt===`running`?`Scan running`:Lt===`queued`?`Scan queued`:Lt===`partial`?`Partial scan`:Lt===`completed`?`Complete`:Lt===`failed`?`Scan failed`:Lt===`cancelled`?`Scan cancelled`:`No scan`,zt=Y.data,Bt=zt&&`found`in zt?zt:U?.deadLinks&&`found`in U.deadLinks?U.deadLinks:void 0,Vt=na(zt?.state??U?.deadLinks?.state??`unavailable`,Bt?.found,Bt?.unverified),Ht=Ii(U?.requestedRootUrl??null,U?.rootUrl??null),Ut=nt(U?.rootUrl??null),Wt=K.data?.rootNodeKey??null,Gt=y({...ke({client:w,path:{name:e},query:{...ut,nodeKey:Wt??void 0,limit:1}}),enabled:!!(G&&Wt)}),Kt=(0,R.useMemo)(()=>pt.find(e=>e.nodeKey===Wt)??Gt.data?.pages[0]??null,[pt,Wt,Gt.data]),qt=F&&F.runId!==I?F:null,Jt=Oe.isPending||!!it||!!qt||rt||at,Yt=B||A&&Oe.isPending,Xt=We?.status===`queued`||We?.status===`running`,Zt=Ta({active:A&&Yt&&!!(o&&s)&&!!(Xt||tt===I&&rt),runId:I,createdAt:We?.createdAt}),Qt=!(!U?.hasCrawlData||Yt||V),X=A?Qt?`technical`:`map`:u,$t=X===`technical`?`map`:X,en=e=>{h(e||null),ee(ze),b(null)},tn=()=>{(!Te&&!Ce(ve[`site-audit`])||xe)&&(h(null),b(null),n&&r?.(),A&&S(!0),Oe.mutate({projectName:e,projectId:t,body:{checkDeadLinks:A||re,...ae?{includeGeo:!0}:{},...se?{}:{includeAgentSkills:!1},...A?{maxPages:100}:x===null?{}:{maxPages:x},...A||de===null?{}:{maxDepth:de}}}))},nn=e=>{let t=pt.find(t=>t.path===e||t.path.startsWith(`${e}/`));t&&b(t.nodeKey)},rn=e=>d(e),an=(e,t)=>{let n=null;e.key===`ArrowRight`||e.key===`ArrowDown`?n=(t+1)%li.length:e.key===`ArrowLeft`||e.key===`ArrowUp`?n=(t-1+li.length)%li.length:e.key===`Home`?n=0:e.key===`End`&&(n=li.length-1),n!=null&&(e.preventDefault(),rn(li[n].id),p.current[n]?.focus())};return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[A?(0,Q.jsx)(Xe,{current:Qt?`fixes`:`site`}):null,!A&&(0,Q.jsxs)(`header`,{className:`flex flex-col justify-between gap-4 lg:flex-row lg:items-start`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-heading`,children:`Site Health`}),(0,Q.jsx)(L,{text:ui[X]}),(0,Q.jsx)(E,{tone:Li(Lt),children:Rt}),It&&(0,Q.jsx)(`span`,{className:`text-xs text-muted`,children:Di(It.finishedAt??It.startedAt)})]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1 text-xs text-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:c,children:`Scan history`}),(0,Q.jsx)(L,{text:zi,placement:`bottom`})]}),(0,Q.jsxs)(`select`,{id:c,"aria-label":`View a Site Health scan`,value:m??Be??``,onChange:e=>en(e.target.value),className:`h-9 min-w-48 rounded-md border border-base bg-bg px-3 text-sm text-primary outline-none focus:border-strong focus:ring-2 focus:ring-mono-600`,children:[(0,Q.jsx)(`option`,{value:``,children:Ri}),Pt.map(e=>(0,Q.jsx)(`option`,{value:e.runId,children:Bi(e)},e.runId))]})]}),!ye&&!k&&(0,Q.jsxs)(`div`,{className:`flex items-end gap-2 pt-5`,children:[(0,Q.jsxs)(`details`,{className:`group relative`,children:[(0,Q.jsxs)(`summary`,{className:`flex h-9 cursor-pointer list-none items-center gap-2 rounded-md border border-base bg-bg px-3 text-sm font-medium text-heading outline-none hover:bg-bg-elevated focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,Q.jsx)(f,{className:`size-4`,"aria-hidden":`true`}),`Scan settings`]}),(0,Q.jsxs)(`div`,{className:`absolute left-0 z-20 mt-2 w-72 rounded-lg border border-strong bg-bg-elevated p-4 shadow-[0_12px_32px_var(--color-shadow-panel)] sm:left-auto sm:right-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm text-heading`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[`Check dead links`,(0,Q.jsx)(L,{text:`Adds dead-link analysis to this scan. Slower on a large site.`})]}),(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`Check dead links`,checked:re,disabled:Jt,onChange:e=>ie(e.target.checked),className:`size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400`})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 text-sm text-heading`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[`Geographic signals`,(0,Q.jsx)(L,{text:Nr[`geographic-signals`],placement:`bottom`})]}),(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`Geographic signals`,checked:ae,disabled:Jt,onChange:e=>oe(e.target.checked),className:`size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400`})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 text-sm text-heading`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[`Agent integrations`,(0,Q.jsx)(L,{text:Nr[`agent-skill-exposure`],placement:`bottom`})]}),(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`Agent integrations`,checked:se,disabled:Jt,onChange:e=>ce(e.target.checked),className:`size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400`})]}),(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium text-heading`,children:[`Page budget`,(0,Q.jsx)(L,{text:Je,placement:`bottom`})]}),(0,Q.jsxs)(`select`,{"aria-label":`Page budget`,value:x===null?``:String(x),disabled:Jt,onChange:e=>ue(e.target.value===``?null:Number(e.target.value)),className:`mt-1 h-9 w-full rounded-md border border-base bg-bg px-2 text-sm text-primary outline-none focus:border-strong focus:ring-2 focus:ring-mono-600`,children:[(0,Q.jsx)(`option`,{value:``,children:Ze(Ne.data)}),[...Qe(Ne.data)?[Qe(Ne.data)]:[],...Hi].map(e=>(0,Q.jsx)(`option`,{value:String(e.value),children:e.label},e.value))]})]}),(0,Q.jsxs)(`div`,{className:`mt-3`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium text-heading`,children:[`Crawl depth`,(0,Q.jsx)(L,{text:`How far from the home page to follow links. A smaller scan is what fixes a scan that ran out of time.`})]}),(0,Q.jsx)(`select`,{"aria-label":`Crawl depth`,value:de===null?``:String(de),disabled:Jt,onChange:e=>fe(e.target.value===``?null:Number(e.target.value)),className:`mt-1 h-9 w-full rounded-md border border-base bg-bg px-2 text-sm text-primary outline-none focus:border-strong focus:ring-2 focus:ring-mono-600`,children:Ui.map(e=>(0,Q.jsx)(`option`,{value:e.value===null?``:String(e.value),children:e.label},String(e.value)))})]})]})]}),(0,Q.jsxs)(He,{onClick:tn,disabled:Jt,children:[Jt?(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Q.jsx)(i,{className:`size-4`,"aria-hidden":`true`}),F?.status===`running`?`Scan running`:F?.status===`queued`?`Scan queued`:`Run scan`]})]})]})]}),k&&(0,Q.jsx)(et,{projectName:e,kind:ve[`site-audit`],loadSchedule:!Te}),U?.hasCrawlData&&X!==`technical`&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-y divide-default rounded-lg border border-default bg-surface-subtle sm:grid-cols-4 sm:divide-y-0`,children:[(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted`,children:[`Pages found`,(0,Q.jsx)(L,{text:Pi(`pagesFound`,!1)})]}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums text-heading`,children:$(U.counts.pagesDiscovered)})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted`,children:[`Pages checked`,(0,Q.jsx)(L,{text:Pi(`pagesChecked`,!1)})]}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums text-heading`,children:$(U.counts.pagesFetched)})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-muted`,title:ur(`eligible`),children:`Indexable`}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums text-heading`,children:$(U.counts.pagesEligible)})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted`,children:[`Internal links`,(0,Q.jsx)(L,{text:Pi(`internalLinks`,!1)})]}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums text-heading`,children:$(mt)})]})]}),!A&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-default`,children:[(0,Q.jsx)(`div`,{role:`tablist`,"aria-label":`Site Health views`,"aria-orientation":`horizontal`,className:`flex min-w-0 gap-5`,children:li.map((e,t)=>(0,Q.jsx)(`button`,{type:`button`,role:`tab`,id:`site-health-${e.id}-tab`,"aria-selected":X===e.id,"aria-controls":`site-health-${e.id}-panel`,tabIndex:X===e.id?0:-1,ref:e=>{p.current[t]=e},onClick:()=>rn(e.id),onKeyDown:e=>an(e,t),className:`min-h-11 border-b-2 px-0.5 text-sm font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-mono-400 disabled:cursor-not-allowed disabled:opacity-50 ${X===e.id?`border-strong text-heading`:`border-transparent text-secondary hover:border-base hover:text-primary`}`,children:e.label},e.id))}),U?.hasCrawlData&&X!==`technical`&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pb-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-muted`,children:`Dead-link check`}),(0,Q.jsx)(E,{tone:Vt.tone,children:Vt.label})]})]}),!m&&F&&!it&&(0,Q.jsx)(`div`,{className:`rounded-lg border border-caution bg-caution-soft px-4 py-3 text-sm text-caution`,role:`status`,children:`A newer scan is running. The latest published result remains available until it finishes.`}),Ht&&(0,Q.jsxs)(`div`,{className:`rounded-lg border border-base bg-surface-subtle px-4 py-3 text-sm text-secondary`,role:`status`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-heading`,children:`Site address changed during this scan.`}),` `,`The scan started at `,(0,Q.jsx)(`span`,{className:`font-mono text-primary`,children:Ht.requested}),` and continued at`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-primary`,children:Ht.effective}),`.`,` `,A?`Page health uses the new address.`:`The map and inventory use the new address.`]}),U?.hasCrawlData&&!U.complete&&(0,Q.jsxs)(`div`,{className:`rounded-lg border border-caution bg-caution-soft px-4 py-3 text-sm text-caution`,role:`status`,children:[Ki(U.termination),` `,!ye&&!k?Gi(U.termination,A):null]}),!F&&Ft===`failed`&&!m&&(0,Q.jsxs)(`div`,{className:`flex gap-3 rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative`,role:`alert`,children:[(0,Q.jsx)(g,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:`The latest scan failed. The previous completed results remain available.`})]}),V?(0,Q.jsx)(Da,{view:$t,tabbed:!A,children:(0,Q.jsx)(Pa,{phase:V,progress:z.data,onRunAgain:k?void 0:tn,pageHealthDestination:A})}):Yt?(0,Q.jsx)(Da,{view:$t,tabbed:!A,children:(0,Q.jsx)(Oa,{status:z.data?.phase??(it?.status===`running`?`running`:`queued`),progress:z.data,progressError:z.isError,onRetryProgress:()=>{z.refetch()},pageHealthDestination:A,firstLook:A,boundedPageLimit:A&&pe?100:void 0,livePageHealthPreview:ct.data,livePageHealthError:ct.isError,livePageHealthRunId:tt,continuation:Zt?(0,Q.jsx)(Ea,{onContinueOnboarding:o,onSkipOnboarding:s}):null})}):X===`technical`?(0,Q.jsxs)(`div`,{id:`site-health-technical-panel`,role:A?void 0:`tabpanel`,"aria-labelledby":A?void 0:`site-health-technical-tab`,className:`min-w-0 space-y-6`,children:[A?(0,Q.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-heading`,children:`Page health`}):null,(0,Q.jsx)(si,{projectName:e,projectId:t,runId:W,integrated:!0,compactCopy:A,afterSummary:A&&Qt?(0,Q.jsxs)(`section`,{"aria-labelledby":`ai-visibility-next-heading`,className:`flex flex-col gap-3 border-b border-default py-5 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{id:`ai-visibility-next-heading`,className:`text-base font-semibold text-heading`,children:`Next: Set up AI Visibility`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`See whether answer engines mention your brand and cite your pages.`})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsx)(T,{type:`button`,onClick:o,children:`Set up AI Visibility`}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,onClick:s,children:`Skip for now`})]})]}):void 0,unavailableFooter:A&&Qt&&!k?(0,Q.jsx)(`section`,{"aria-label":`Page health recovery`,className:`mt-4`,children:(0,Q.jsx)(T,{type:`button`,disabled:Jt,onClick:()=>{d(`map`),tn()},children:`Run site audit again`})}):void 0})]}):H.isLoading?(0,Q.jsx)(Da,{view:X,tabbed:!A,children:(0,Q.jsxs)(`div`,{className:`flex min-h-72 items-center justify-center gap-2 text-sm text-secondary`,role:`status`,children:[(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading site health...`]})}):H.error?(0,Q.jsx)(Da,{view:X,tabbed:!A,children:(0,Q.jsxs)(`section`,{className:`rounded-lg border border-negative bg-negative-soft px-5 py-6`,role:`alert`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-negative`,children:`Site Health could not load`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-negative`,children:`Try loading the crawl again.`}),(0,Q.jsx)(T,{variant:`secondary`,size:`sm`,className:`mt-4`,onClick:()=>void H.refetch(),children:`Try again`})]})}):U?.hasCrawlData?U.detailsAvailable?X===`inventory`?(0,Q.jsxs)(`div`,{id:`site-health-inventory-panel`,role:`tabpanel`,"aria-labelledby":`site-health-inventory-tab`,className:`space-y-5`,children:[q.isLoading?(0,Q.jsxs)(`div`,{className:`flex min-h-56 items-center justify-center gap-2 text-sm text-secondary`,role:`status`,children:[(0,Q.jsx)(l,{className:`size-4 motion-safe:animate-spin`,"aria-hidden":`true`}),`Loading page inventory...`]}):q.error?(0,Q.jsx)(`p`,{className:`rounded-lg border border-negative bg-negative-soft px-4 py-3 text-sm text-negative`,role:`alert`,children:`The page inventory could not be loaded.`}):(0,Q.jsx)(da,{pages:St,total:Ct,filterUnavailable:q.data?.pages[0]?.healthStateFilter===`unavailable-legacy-scan`,selectedNodeKey:At,onSelect:b,hasNextPage:!!q.hasNextPage,isFetchingNextPage:q.isFetchingNextPage,onLoadMore:()=>void q.fetchNextPage(),filter:me,onFilterChange:C}),(0,Q.jsx)(ua,{page:kt,isLoading:Mt.isLoading&&!!kt,error:Mt.error,inbound:Mt.data?.inbound??[],outbound:Mt.data?.outbound??[],inboundTruncated:Mt.data?.inboundTruncated??!1,outboundTruncated:Mt.data?.outboundTruncated??!1,audit:Nt.data,auditLoading:Nt.isLoading&&!!kt,auditError:Nt.error,onRetryAudit:()=>{Nt.refetch()},rootHost:Ut,reasonSource:Dt,reasonsState:jt,onRetryReasons:()=>{Et.refetch()},showTemplateLinks:he||yt})]}):(0,Q.jsxs)(`div`,{id:`site-health-map-panel`,role:`tabpanel`,"aria-labelledby":`site-health-map-tab`,className:`space-y-5`,children:[(0,Q.jsxs)(`section`,{"aria-labelledby":`site-map-heading`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-col justify-between gap-2 sm:flex-row sm:items-end`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`h2`,{id:`site-map-heading`,className:`text-base font-semibold text-heading`,children:`Site map`}),(0,Q.jsx)(L,{text:Xi})]})}),K.data?.sampled&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Showing `,$(K.data.nodes.length),` of `,$(K.data.totalNodes),` pages`,` · `,$(K.data.edges.length),` of `,$(K.data.totalEdges),` links`]})]}),K.data?.layout.state===`ready`&&ht.length>0&&(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-col gap-1.5 rounded-lg border border-default bg-surface-subtle px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-secondary`,"data-testid":`site-map-link-counts`,children:[$i({filterUnavailable:yt,showTemplateLinks:he,contentEdgeCount:_t,templateEdgeCount:gt,totalEdgeCount:ht.length}),(0,Q.jsx)(L,{text:ta(vt,{staleLayout:xt&&!yt})})]}),(0,Q.jsxs)(`label`,{className:be(`flex shrink-0 items-center gap-2 text-sm`,yt?`cursor-not-allowed text-muted`:`cursor-pointer text-heading`),title:yt?Yi(vt):`Menu and footer links are drawn on top. Pages do not move, because the map was laid out from the links in your page text.`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:he&&!yt,disabled:yt,onChange:e=>_e(e.target.checked),className:`size-4 rounded border-base accent-mono-200 focus:ring-2 focus:ring-mono-400`}),`Show menu and footer links`]})]}),(0,Q.jsxs)(`div`,{id:`site-health-map-explorer`,className:`grid gap-4 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`aside`,{className:`rounded-lg border border-default bg-surface-subtle`,"aria-labelledby":`site-sections-heading`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-default px-4 py-3`,children:[(0,Q.jsx)(`h3`,{id:`site-sections-heading`,className:`text-sm font-semibold text-heading`,children:`Site sections`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Folders in this scan`})]}),(0,Q.jsx)(`div`,{className:`max-h-[468px] overflow-auto`,children:W&&(0,Q.jsx)(ma,{projectName:e,runId:W,parentPath:`/`,onSelect:nn,rootPage:Kt,onSelectRootPage:b})})]}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:K.isLoading?(0,Q.jsx)(ha,{}):K.error?(0,Q.jsx)(`div`,{className:`flex min-h-[420px] items-center justify-center rounded-lg border border-negative bg-negative-soft px-6 text-center lg:min-h-[520px]`,role:`alert`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-negative`,children:`The interactive map could not be loaded.`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`The page inventory and technical findings remain available.`}),(0,Q.jsx)(T,{variant:`secondary`,size:`sm`,className:`mt-4`,onClick:()=>d(`inventory`),children:`Open page inventory`})]})}):(0,Q.jsx)(Mr,{nodes:K.data?.nodes??[],edges:ht,showTemplateLinks:he||yt,layoutState:K.data?.layout.state??`unavailable`,layoutUnavailableReason:K.data?.layout.state===`unavailable`?K.data.layout.reason:null,rootNodeKey:K.data?.rootNodeKey??null,selectedNodeKey:At,onSelectNode:e=>b(e.nodeKey),onOpenInventory:()=>d(`inventory`),ariaLabel:`Interactive site map showing ${$(K.data?.nodes.length??0)} pages and ${$(bt.length)} internal links`})})]})]}),(0,Q.jsx)(ua,{page:kt,isLoading:Mt.isLoading&&!!kt,error:Mt.error,inbound:Mt.data?.inbound??[],outbound:Mt.data?.outbound??[],inboundTruncated:Mt.data?.inboundTruncated??!1,outboundTruncated:Mt.data?.outboundTruncated??!1,audit:Nt.data,auditLoading:Nt.isLoading&&!!kt,auditError:Nt.error,onRetryAudit:()=>{Nt.refetch()},rootHost:Ut,reasonSource:Dt,reasonsState:jt,onRetryReasons:()=>{Et.refetch()},showTemplateLinks:he||yt})]}):(0,Q.jsx)(Da,{view:X,tabbed:!A,children:(0,Q.jsxs)(`section`,{className:`rounded-lg border border-caution bg-caution-soft px-5 py-6`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-caution`,children:A?`Page health results unavailable`:`Page details unavailable`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-caution`,children:k&&A?`This scan did not publish page-level results.`:A?`This scan did not publish page-level results. Run it again to continue setup.`:`Summary metrics are preserved for this scan, but its page graph cannot be opened.`}),A&&!k?(0,Q.jsx)(T,{type:`button`,size:`sm`,className:`mt-4`,onClick:tn,children:`Run scan again`}):null]})}):(0,Q.jsx)(Da,{view:X,tabbed:!A,children:(0,Q.jsxs)(`section`,{className:`rounded-lg border border-default bg-surface-subtle px-5 py-8 text-center`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-heading`,children:A?`Page health results unavailable`:`Full-site map not available`}),(0,Q.jsx)(`p`,{className:`mx-auto mt-2 max-w-xl text-sm text-secondary`,children:k?Ue:A?`This scan did not produce page health results. Run it again to continue setup.`:U?.legacyAuditAvailable?`Existing page health results are preserved. Run a new scan to build the page and internal-link map.`:ye?`A full-site scan has not been run for this project.`:`Run a scan to discover pages, site sections, and internal links.`}),(U?.legacyAuditAvailable||A)&&(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:[U?.legacyAuditAvailable&&!A&&(0,Q.jsx)(T,{variant:`secondary`,size:`sm`,onClick:()=>d(`technical`),children:`View page health`}),A&&!k&&(0,Q.jsx)(T,{type:`button`,size:`sm`,onClick:tn,children:`Run scan again`})]})]})})]})}export{Wr as a,Z as c,Kr as i,ot as l,ci as n,Hr as o,qr as r,Gr as s,Fa as t};
@@ -1,40 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,L as n,S as r,V as i,X as a,a as o,it as s,nt as c,q as l,tt as u,u as d,z as f}from"./vendor-lucide-CPeGWK5C.js";import{r as p}from"./vendor-markdown-Bdsu1JLE.js";import{b as m,d as h,u as g,x as _}from"./vendor-tanstack-CXaF1vMI.js";import{Ct as v,dn as ee,pt as y,r as b,t as te}from"./ToneBadge-Bk7cBexZ.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as x}from"./query-client-nsJhXK9R.js";import{Jt as S,Wt as re}from"./react-query-BKjNH2ek.js";import{t as C}from"./InfoTooltip-COkeQYiP.js";import{t as w}from"./card-qOcJFZhl.js";import{ct as T,ln as E,lt as D,ot as O,st as ie,ut as k,w as ae}from"./index-BIfsFQb8.js";import{a as oe,i as se,l as ce,n as A,o as le,r as ue}from"./extract-error-message-bWEYiDDO.js";var j=e(s(),1),M=p();function de({open:e,onOpenChange:t,projectName:n}){let[r,i]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&i(`pick`)},[e]);let a=()=>{t(!1),i(`pick`)};return(0,M.jsx)(O,{open:e,onOpenChange:e=>{e?t(!0):a()},children:(0,M.jsx)(ie,{children:r===`pick`?(0,M.jsx)(pe,{onPick:i}):r===`cloudflare`?(0,M.jsx)(Q,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`wordpress`?(0,M.jsx)(L,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`vercel`?(0,M.jsx)(z,{projectName:n,onBack:()=>i(`pick`),onClose:a}):(0,M.jsx)(R,{projectName:n,onBack:()=>i(`pick`),onClose:a})})})}var fe=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:d},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:t},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:o},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:i}];function pe({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(D,{children:[(0,M.jsx)(k,{children:`Connect a traffic source`}),(0,M.jsx)(T,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:fe.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-[13px] text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-[13px] text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(D,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-sm text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(c,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(k,{children:e}),(0,M.jsx)(T,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(A(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${A(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(X,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-sm font-medium text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`font-mono text-[13px]`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-xs text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(b,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(b,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=le(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(C,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:me(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Z,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=se(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(C,{text:K(`service-account private key`)})]}),guide:ge(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 font-mono text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-sm text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=oe(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(C,{text:K(`access token`)})]}),guide:he(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-sm font-medium text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-[13px] leading-5 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function me(e,t){let n=E(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
2
-
3
- Follow the WordPress section of the Canonry docs: ${H}#connecting-a-wordpress-source
4
-
5
- 1. Ask me for the site URL and a WordPress admin username.
6
- 2. Walk me through installing the Canonry Traffic Logger plugin: download ${G}, then upload and activate it under Plugins → Add New → Upload Plugin. If you have shell or WP-CLI access to the site, you may install it yourself after I approve.
7
- 3. Have me create an Application Password under Users → Profile → Application Passwords.
8
- 4. Ask whether the site uses a page cache or CDN. If it does, tell me exactly which AI user agents to exclude from it, using the list in the docs.
9
- 5. Give me the exact command to connect: cnry traffic connect wordpress ${n} --url <site-url> --username <user> --app-password '<app-password>'
10
- 6. After it connects, run cnry traffic sources ${n} --format json and cnry doctor --project ${n} --check 'traffic.source.*' --format json, and tell me in plain words whether events are arriving.
11
-
12
- ${q}`}}function he(e){let t=E(e);return{docsUrl:`${H}#connecting-a-vercel-source`,steps:[{title:`Create a Vercel access token`,detail:`Give it access to the team that owns the project. Tokens can expire, so pick a long lifetime.`,link:{label:`Open Vercel tokens`,href:`https://vercel.com/account/tokens`}},{title:`Find the project ID and team ID`,detail:`Both are in the project’s Settings → General, or in .vercel/project.json (projectId and orgId) after vercel link.`}],agentRequest:`Help me connect my Vercel project to the Canonry project "${e}" for server-side traffic.
13
-
14
- Follow the Vercel section of the Canonry docs: ${H}#connecting-a-vercel-source
15
-
16
- 1. Find the Vercel project ID and team ID. If this repo is linked, read projectId and orgId from .vercel/project.json. Otherwise ask me.
17
- 2. Have me create an access token at https://vercel.com/account/tokens, scoped to that team, and save it to a file only I can read.
18
- 3. Connect with: cnry traffic connect vercel ${t} --project-id <prj_...> --team-id <team_...> --token-file <path>
19
- 4. Confirm the source with cnry traffic sources ${t} --format json and cnry doctor --project ${t} --check 'traffic.source.*' --format json. Vercel keeps about 14 days of request logs, so tell me before starting any history backfill.
20
-
21
- ${q}`}}function ge(e,t){let n=E(e),r=t.trim(),i=`https://console.cloud.google.com/iam-admin/serviceaccounts${r?`?project=${encodeURIComponent(r)}`:``}`;return{docsUrl:`${H}#connecting-a-cloud-run-source`,steps:[{title:`Create a service account in the Google Cloud project`,detail:`Grant it the Logs Viewer role (roles/logging.viewer). Nothing broader is needed.`,link:{label:`Open service accounts`,href:i}},{title:`Create a JSON key for it`,detail:`Keys → Add key → Create new key → JSON. Upload the file below.`}],agentRequest:`Help me connect my Cloud Run service to the Canonry project "${e}" for server-side traffic.
22
-
23
- Follow the Cloud Run section of the Canonry docs: ${H}#connecting-a-cloud-run-source
24
-
25
- 1. Ask me for the Google Cloud project ID and, if there is more than one, the Cloud Run service name and region.
26
- 2. If gcloud is installed and signed in, propose the exact commands to create a service account with only roles/logging.viewer and download a JSON key, and run them after I approve. Otherwise walk me through it in the Cloud Console.
27
- 3. Connect with: cnry traffic connect cloud-run ${n} --gcp-project <project-id> --service-account-key <path/to/key.json> (add --service and --location to narrow it).
28
- 4. Confirm with cnry doctor --project ${n} --check 'traffic.source.*' --format json and tell me in plain words whether logs are readable.
29
-
30
- ${q}`}}function _e(e){let t=E(e);return{docsUrl:U,steps:[{title:`Check your request volume first`,detail:`The Worker runs on every request to your zone. A busy site can pass the Workers free allowance of 100,000 requests a day.`,link:{label:`How to size it`,href:`${U}#before-you-start-size-the-request-volume`}},{title:`Find your zone ID and account ID`,detail:`Both are on the zone’s Overview page in the Cloudflare dashboard, under API.`,link:{label:`Open Cloudflare`,href:`https://dash.cloudflare.com/`}},{title:`Run the connect command where Canonry runs`,detail:`cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id>`}],agentRequest:`Help me connect my Cloudflare zone to the Canonry project "${e}" for server-side traffic.
31
-
32
- Follow the Canonry Cloudflare guide: ${U}
33
-
34
- 1. Before anything else, estimate the zone's daily request volume with me, as the guide's "size the request volume" section shows, and tell me whether it fits the Workers plan I am on.
35
- 2. Ask me for the zone ID and account ID, and whether I want direct push or Queue pull. Recommend one and say why.
36
- 3. Run cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id> (plus the flags for the mode I chose). It writes the Worker and its config without deploying. Show me what it wrote.
37
- 4. Deploy only after I approve, and attach the route with Fail open exactly as the guide says.
38
- 5. Smoke-check with cnry traffic events ${t} --source <source-id> --format json and tell me whether events are arriving.
39
-
40
- ${q}`}}function Y({request:e,docsUrl:t}){let[r,i]=(0,j.useState)(!1),o=async()=>{try{await navigator.clipboard.writeText(e),i(!0),window.setTimeout(()=>i(!1),1800)}catch{x({tone:`negative`,title:`Could not copy the setup request`,detail:`Follow the steps below, or open the setup guide instead.`})}};return(0,M.jsxs)(`section`,{"aria-labelledby":`traffic-agent-heading`,className:`rounded-lg border border-default bg-surface px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,M.jsx)(a,{className:`size-4 text-positive`,"aria-hidden":`true`}),(0,M.jsx)(`h3`,{id:`traffic-agent-heading`,className:`flex-1 text-sm font-medium text-heading`,children:`Have your agent set this up`}),(0,M.jsxs)(b,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{o()},children:[r?(0,M.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`}):(0,M.jsx)(f,{className:`size-3.5`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{"aria-live":`polite`,children:r?`Copied`:`Copy setup request`})]})]}),(0,M.jsxs)(`p`,{className:`mt-1.5 text-[13px] text-secondary`,children:[`Paste it into Claude Code, Codex, or any agent with a terminal. It follows the`,` `,(0,M.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`text-link underline-offset-4 hover:underline`,children:[`setup guide`,(0,M.jsx)(n,{className:`ml-0.5 inline size-3`,"aria-hidden":`true`})]}),` `,`and never asks you to paste secrets into the chat.`]})]})}function X({steps:e,heading:t=`Or do it yourself`}){return(0,M.jsxs)(`section`,{"aria-labelledby":`traffic-steps-heading`,children:[(0,M.jsx)(`h3`,{id:`traffic-steps-heading`,className:`text-sm font-medium text-heading`,children:t}),(0,M.jsx)(`ol`,{className:`mt-3 flex flex-col gap-3`,children:e.map((e,t)=>(0,M.jsxs)(`li`,{className:`flex gap-3`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 shrink-0 items-center justify-center rounded-full border border-default bg-surface-subtle text-xs font-semibold tabular-nums text-secondary`,children:t+1}),(0,M.jsxs)(`div`,{className:`min-w-0 pt-0.5`,children:[(0,M.jsx)(`p`,{className:`text-sm text-heading`,children:e.title}),e.detail?(0,M.jsx)(`p`,{className:`mt-0.5 text-[13px] text-secondary ${e.detail.startsWith(`cnry `)?`break-all font-mono`:``}`,children:e.detail}):null,e.link?(0,M.jsxs)(`a`,{href:e.link.href,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-[13px] font-medium text-link underline-offset-4 hover:underline`,children:[e.link.label,(0,M.jsx)(n,{className:`size-3`,"aria-hidden":`true`})]}):null]})]},e.title))})]})}function Z({children:e}){return(0,M.jsxs)(`details`,{className:`group`,children:[(0,M.jsxs)(`summary`,{className:`cursor-pointer list-none text-sm font-medium text-secondary hover:text-heading`,children:[(0,M.jsx)(`span`,{className:`group-open:hidden`,children:`Show more options`}),(0,M.jsx)(`span`,{className:`hidden group-open:inline`,children:`Hide more options`})]}),(0,M.jsx)(`div`,{className:`mt-4 flex flex-col gap-5`,children:e})]})}function Q({projectName:e,onBack:t,onClose:r}){let i=_e(e);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:`Connect a Cloudflare zone`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`A small Worker on your zone reports AI crawler visits. It is set up from the terminal.`,(0,M.jsx)(C,{text:`Setting it up deploys a Worker to your Cloudflare account, so it runs from the Canonry CLI on the machine where Canonry runs, never from the browser.`})]}),onBack:t}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:i.agentRequest,docsUrl:i.docsUrl}),(0,M.jsx)(X,{steps:i.steps})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(b,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Close`}),(0,M.jsx)(b,{type:`button`,size:`sm`,asChild:!0,children:(0,M.jsxs)(`a`,{href:i.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Open the setup guide`,(0,M.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`})]})})]})]})]})}function ve(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function $(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function ye(){let[e,t]=(0,j.useState)(``),[n,i]=(0,j.useState)(!1),a=m(S({client:y})).data??[],o=(0,j.useMemo)(()=>e||(a[0]?.name??``),[e,a]),s=ce(o||null),c=s.data?.sources??[];return(0,M.jsxs)(`div`,{className:`page-container`,children:[(0,M.jsxs)(`div`,{className:`page-header`,children:[(0,M.jsxs)(`div`,{className:`page-header-left`,children:[(0,M.jsx)(`h1`,{className:`page-title`,children:`Traffic sources`}),(0,M.jsx)(`p`,{className:`page-subtitle`,children:`AI crawler hits and referral sessions from your server logs.`})]}),!v()&&(0,M.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:(0,M.jsxs)(b,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(!0),disabled:!o,children:[(0,M.jsx)(r,{className:`size-3.5`}),`Connect a source`]})})]}),(0,M.jsxs)(`section`,{children:[a.length>1&&(0,M.jsxs)(`label`,{className:`mb-4 flex w-fit items-center gap-2 text-sm font-medium text-secondary`,htmlFor:`traffic-project`,children:[`Project`,(0,M.jsx)(`select`,{id:`traffic-project`,className:`h-8 min-w-44 rounded-md border border-base bg-bg px-2 text-sm text-heading outline-none transition focus:border-mono-500 focus:ring-1 focus:ring-mono-500`,value:o,onChange:e=>t(e.target.value),children:a.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.displayName??e.name},e.id))})]}),o?s.isLoading?(0,M.jsx)(w,{className:`p-6 text-center text-sm text-muted`,children:`Loading sources…`}):c.length===0?(0,M.jsxs)(w,{className:`p-8 text-center`,children:[(0,M.jsxs)(`p`,{className:`text-sm text-neutral`,children:[`No traffic sources connected for `,o,`.`]}),!v()&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`mt-1 text-sm text-secondary`,children:`Connect a source to start collecting traffic.`}),(0,M.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center justify-center gap-2`,children:(0,M.jsxs)(b,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(!0),children:[(0,M.jsx)(r,{className:`size-3.5`}),`Connect a source`]})})]})]}):(0,M.jsx)(be,{projectName:o,sources:c}):(0,M.jsx)(w,{className:`p-6 text-center text-sm text-muted`,children:`No projects yet.`})]}),!v()&&(0,M.jsx)(de,{open:n,onOpenChange:i,projectName:o})]})}function be({projectName:e,sources:t}){let n=h(),r=_({queries:t.map(t=>({...re({client:y,path:{name:e,id:t.id}}),staleTime:3e4}))}),i=t.map((e,t)=>({source:e,detail:r[t]?.data,isLoading:r[t]?.isLoading??!1}));return(0,M.jsx)(`div`,{className:`rounded-xl border border-default bg-surface overflow-hidden`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{className:`bg-bg-elevated/50 text-[10px] font-semibold uppercase tracking-wider text-muted`,children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Source`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Status`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Last sync`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Content crawls`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Infra crawls`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`AI fetches`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`AI referrals`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`})]})}),(0,M.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:i.map(({source:t,detail:r,isLoading:i})=>(0,M.jsxs)(`tr`,{className:`cursor-pointer transition-colors hover:bg-bg-elevated/40 focus-within:bg-bg-elevated/40`,onClick:r=>{ae(r)&&n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id}})},children:[(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(g,{to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id},className:`font-medium text-heading hover:underline`,children:t.displayName})}),(0,M.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,M.jsx)(te,{tone:ue(t.status),children:t.status}),t.lastError?(0,M.jsx)(`p`,{className:`mt-1 max-w-[18rem] truncate text-sm text-negative-400`,title:t.lastError,children:t.lastError}):null]}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-neutral`,children:ve(t.lastSyncedAt)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,title:r?`${r.totals24h.crawlerHits.toLocaleString(`en-US`)} total crawler hits`:void 0,children:i?`—`:$(r?.totals24h.crawlerContentHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-muted`,children:i?`—`:$(r?.totals24h.crawlerInfraHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,children:i?`—`:$(r?.totals24h.aiUserFetchHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,children:i?`—`:$(r?.totals24h.aiReferralLandedHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsxs)(g,{to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id},className:`inline-flex items-center gap-1 text-sm text-secondary hover:text-heading`,children:[`View`,(0,M.jsx)(u,{className:`size-3.5`})]})})]},t.id))})]})})}export{ye as TrafficPage};