@ainyc/canonry 4.46.0 → 4.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/agent-workspace/skills/aero/SKILL.md +5 -3
- package/assets/agent-workspace/skills/canonry/SKILL.md +55 -12
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +48 -12
- package/assets/agent-workspace/skills/canonry/references/server-side-traffic.md +32 -0
- package/assets/assets/{index-BVHV03Fk.css → index-BDMNXVHa.css} +1 -1
- package/assets/assets/{index-CFKPcvOe.js → index-CJWNAoK4.js} +2 -2
- package/assets/index.html +2 -2
- package/dist/{chunk-G2HQOLPK.js → chunk-IYUI74JP.js} +42 -32
- package/dist/{chunk-TBADB57G.js → chunk-K2TOOQ4F.js} +11 -7
- package/dist/{chunk-Q7XFJO2V.js → chunk-MM3A2CJK.js} +2 -2
- package/dist/{chunk-GRFMZ7PD.js → chunk-PRNO52YC.js} +1 -1
- package/dist/cli.js +5 -5
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-YFBVWCK2.js → intelligence-service-R3KDVKIB.js} +2 -2
- package/dist/mcp.js +2 -2
- package/package.json +8 -8
|
@@ -94,7 +94,7 @@ ${JSON.stringify(r.raw,null,2)}`):t.push(i)}return t.length>0?t.join(`
|
|
|
94
94
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
95
95
|
|
|
96
96
|
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Iae="DialogDescriptionWarning",Lae=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${j$(Iae).contentName}}.`;return x.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},N$=u$,k$=h$,Uk=p$,qk=m$,Fk=y$,C$=x$,A$=w$;const E$=N$,$ae=k$,O$=x.forwardRef(({className:e,...t},n)=>s.jsx(Uk,{ref:n,className:ea("fixed inset-0 z-50 bg-black/70 backdrop-blur-sm",e),...t}));O$.displayName=Uk.displayName;const Bae=400,Uae=1200,qae=720,Hk=x.forwardRef(({className:e,children:t,...n},r)=>{const[i,a]=x.useState(qae),l=x.useRef(!1),c=x.useRef(0),d=x.useRef(0),f=x.useCallback(y=>{l.current=!0,c.current=y.clientX,d.current=i,y.target.setPointerCapture(y.pointerId),y.preventDefault()},[i]),p=x.useCallback(y=>{if(!l.current)return;const v=c.current-y.clientX,w=Math.min(Uae,Math.max(Bae,d.current+v));a(w)},[]),m=x.useCallback(()=>{l.current=!1},[]);return s.jsxs($ae,{children:[s.jsx(O$,{}),s.jsxs(qk,{ref:r,className:ea("fixed z-50 flex flex-col bg-zinc-950 px-5 py-4 shadow-2xl overflow-hidden","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-t-2xl max-md:border-t","md:inset-y-0 md:right-0 md:h-full md:border-l","border-zinc-800",e),style:{width:`min(${i}px, 100vw)`},...n,children:[s.jsx("div",{className:"absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-zinc-700/50 active:bg-zinc-600/50 transition-colors max-md:hidden",onPointerDown:f,onPointerMove:p,onPointerUp:m}),t,s.jsxs(A$,{className:"absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-900 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",children:[s.jsx(wc,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});Hk.displayName=qk.displayName;const Kk=({className:e,...t})=>s.jsx("div",{className:ea("flex flex-col gap-1.5 pr-10",e),...t}),Hv=x.forwardRef(({className:e,...t},n)=>s.jsx(Fk,{ref:n,className:ea("text-lg font-medium text-zinc-50",e),...t}));Hv.displayName=Fk.displayName;const Kv=x.forwardRef(({className:e,...t},n)=>s.jsx(C$,{ref:n,className:ea("text-sm text-zinc-500",e),...t}));Kv.displayName=C$.displayName;function Fae({title:e,subtitle:t,children:n,open:r,onClose:i}){return s.jsx(E$,{open:r,onOpenChange:a=>a?void 0:i(),children:s.jsxs(Hk,{children:[s.jsxs(Kk,{className:"drawer-head",children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:t}),s.jsx(Hv,{id:"drawer-title",children:e}),s.jsx(Kv,{className:"sr-only",children:t})]}),s.jsx("div",{className:"drawer-body",children:n})]})})}function Wn({text:e}){const[t,n]=x.useState(null),r=x.useRef(null),i=x.useCallback(()=>{if(!r.current)return;const l=r.current.getBoundingClientRect();n({top:l.top,left:l.left+l.width/2})},[]),a=x.useCallback(()=>n(null),[]);return s.jsxs("span",{className:"info-tooltip-wrapper",onMouseEnter:i,onMouseLeave:a,onFocus:i,onBlur:a,children:[s.jsxs("svg",{ref:r,className:"info-tooltip-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M8 7v4M8 5.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),t!==null&&bc.createPortal(s.jsx("span",{role:"tooltip",style:{position:"fixed",top:t.top,left:t.left,transform:"translateX(-50%) translateY(calc(-100% - 8px))",zIndex:9999,pointerEvents:"none",width:"14rem",padding:"0.5rem 0.75rem",fontSize:"11px",fontWeight:400,textTransform:"none",letterSpacing:"normal",lineHeight:"1rem",color:"#d4d4d8",backgroundColor:"#18181b",border:"1px solid rgba(63, 63, 70, 0.6)",borderRadius:"0.5rem",boxShadow:"0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1)"},children:e}),document.body)]})}const Hae=/[\s\-_]+/;function Kae(e){const t=e.split(Hae).filter(Boolean);return t.length===0?null:t.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("[\\s\\-_]*")}function w1(e,t){const n=Gae(t),r=e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(f=>f.startsWith("**")&&f.endsWith("**")?{type:"bold",value:f.slice(2,-2)}:{type:"text",value:f}),i=n.flatMap(f=>f.terms).filter(f=>f.trim().length>1);if(i.length===0)return r.map((f,p)=>f.type==="bold"?qi.createElement("strong",{key:`b-${p}`,className:"text-zinc-200 font-semibold"},f.value):f.value).filter(Boolean);const l=[...i].sort((f,p)=>p.length-f.length).map(Kae).filter(f=>!!f);if(l.length===0)return r.map((f,p)=>f.type==="bold"?qi.createElement("strong",{key:`b-${p}`,className:"text-zinc-200 font-semibold"},f.value):f.value).filter(Boolean);const c=new RegExp(`(${l.join("|")})`,"gi"),d=new Map;for(const f of n)for(const p of f.terms){const m=hy(p);m&&!d.has(m)&&d.set(m,f.className)}return r.flatMap((f,p)=>f.value.split(c).map((y,v)=>{if(!y)return null;if(v%2===1){const b=d.get(hy(y))??"answer-highlight";return f.type==="bold"?qi.createElement("mark",{key:`hl-${p}-${v}`,className:b},qi.createElement("strong",{className:"text-zinc-200 font-semibold"},y)):qi.createElement("mark",{key:`hl-${p}-${v}`,className:b},y)}return f.type==="bold"?qi.createElement("strong",{key:`b-${p}-${v}`,className:"text-zinc-200 font-semibold"},y):y})).filter(Boolean)}function Gae(e){return e.length===0?[]:typeof e[0]=="string"?[{terms:e,className:"answer-highlight"}]:e}function Fw(e,t){switch(e){case"new":return"First observation";case"emerging":return"First mention";case"lost":return"Lost since last run";default:return t==="mentioned"||t==="visible"?"Mentioned in latest run":t==="pending"?"Awaiting first run":"Not mentioned in latest run"}}function Vae({evidence:e,project:t,onClose:n}){const[r,i]=x.useState(!1),[a,l]=x.useState("mentions"),[c,d]=x.useState(-1),[f,p]=x.useState(null),[m,y]=x.useState(!1),[v,w]=x.useState({}),b=ote(t.project),j=new Set(b.map(uy)),k=e.runHistory,E=k.length>1,[A,C]=x.useState(null),_=x.useRef(!1);x.useEffect(()=>{if(_.current||e.answerSnippet&&(e.visibilityState!=null||e.answerMentioned!=null))return;const V=k.at(-1);V&&(_.current=!0,Ko(V.runId).then(re=>{const ee=re.snapshots.find(Ee=>Ee.query===e.query&&Ee.provider===e.provider);ee&&C({citationState:ee.citationState,answerMentioned:ee.answerMentioned,visibilityState:ee.visibilityState,visibilityTransition:V.visibilityTransition,provider:ee.provider,model:ee.model??e.model,answerSnippet:ee.answerText??e.answerSnippet,citedDomains:ee.citedDomains??e.citedDomains,competitorDomains:ee.competitorOverlap??e.competitorDomains,recommendedCompetitors:ee.recommendedCompetitors??e.recommendedCompetitors??[],matchedTerms:ee.matchedTerms??e.matchedTerms??[],groundingSources:ee.groundingSources??e.groundingSources,evidenceUrls:[],changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary})}).catch(()=>{}))},[e,k]);const O=c>=0&&f!==null,z=O?f:A||{citationState:e.citationState,answerMentioned:e.answerMentioned,visibilityState:e.visibilityState,visibilityTransition:k.at(-1)?.visibilityTransition,provider:e.provider,model:e.model,answerSnippet:e.answerSnippet,citedDomains:e.citedDomains,competitorDomains:e.competitorDomains,recommendedCompetitors:e.recommendedCompetitors??[],matchedTerms:e.matchedTerms??[],groundingSources:e.groundingSources,evidenceUrls:e.evidenceUrls,changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary},R=z.visibilityState==="pending"||z.citationState==="pending",$=R?!1:z.visibilityState!=null?z.visibilityState==="visible":z.answerMentioned!=null?z.answerMentioned:z.citationState===Eh.cited||z.citationState==="emerging",F=z.answerMentioned!=null||z.visibilityState!=null||z.recommendedCompetitors.length>0,M=z.citedDomains.length>0||z.groundingSources.length>0||z.evidenceUrls.length>0,U=t.project.displayName||t.project.name,K=[...b.map(uy),U,U.split(" ").slice(0,2).join(" "),...z.matchedTerms].filter(V=>V.trim().length>2),Z=[...z.competitorDomains.flatMap(V=>{const re=n3(V);return re.length>=4?[re]:[]}),...z.recommendedCompetitors].filter(V=>V.trim().length>2),Y=[{terms:K,className:"answer-highlight-brand"},...Z.length>0?[{terms:Z,className:"answer-highlight-competitor"}]:[]],H=R?"pending":z.visibilityTransition==="lost"?"lost":$?"mentioned":"not-mentioned",X=x.useRef(0),ue=x.useCallback(async V=>{const re=++X.current;if(V===-1||V===k.length-1){d(-1),p(null),i(!1);return}d(V),i(!1);const ee=k[V],Ee=`${ee.runId}::${e.query}::${e.provider}`;if(v[Ee]){p(v[Ee]);return}y(!0);try{const Te=await Ko(ee.runId);if(re!==X.current)return;const ne=Te.snapshots.find(je=>je.query===e.query&&je.provider===e.provider)??Te.snapshots.find(je=>je.query===e.query),he=ne?{citationState:ne.citationState,answerMentioned:ne.answerMentioned,visibilityState:ne.visibilityState,visibilityTransition:ee.visibilityTransition,provider:ne.provider,model:ne.model??null,answerSnippet:ne.answerText??"",citedDomains:ne.citedDomains,competitorDomains:ne.competitorOverlap,recommendedCompetitors:ne.recommendedCompetitors??[],matchedTerms:ne.matchedTerms??[],groundingSources:ne.groundingSources,evidenceUrls:[],changeLabel:Fw(ee.mentionTransition??ee.visibilityTransition,ee.mentionState??ee.visibilityState),summary:""}:{citationState:ee.citationState,answerMentioned:ee.answerMentioned,visibilityState:ee.visibilityState,visibilityTransition:ee.visibilityTransition,provider:e.provider,model:ee.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],groundingSources:[],evidenceUrls:[],changeLabel:Fw(ee.mentionTransition??ee.visibilityTransition,ee.mentionState??ee.visibilityState),summary:"Snapshot data not available for this run."};w(je=>({...je,[Ee]:he})),p(he)}catch{if(re!==X.current)return;p({citationState:ee.citationState,answerMentioned:ee.answerMentioned,visibilityState:ee.visibilityState,visibilityTransition:ee.visibilityTransition,provider:e.provider,model:ee.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],groundingSources:[],evidenceUrls:[],changeLabel:Fw(ee.mentionTransition??ee.visibilityTransition,ee.mentionState??ee.visibilityState),summary:"Failed to load historical run data."})}finally{re===X.current&&y(!1)}},[k,e.query,e.provider,v]),L=(O||e.historyScope!=="provider")&&z.model?`${z.provider} (${z.model}) · ${z.changeLabel.toLowerCase()}`:`${z.provider} · ${z.changeLabel.toLowerCase()}`,q=!O&&e.historyScope==="provider"?[e.model?`Current model: ${e.model}`:null,e.modelsSeen&&e.modelsSeen.length>1?`History spans ${e.modelsSeen.length} models`:null].filter(Boolean).join(" · "):"",I=$?{label:"Mentioned in answer",title:"Your brand or domain is mentioned in this answer",meta:L}:z.visibilityTransition==="lost"?{label:"Mention lost",title:"Your brand no longer appears in this answer",meta:L}:R?{label:"Pending",title:"Awaiting first run",meta:"No provider data yet"}:{label:"Not mentioned in answer",title:"Your brand or domain was not mentioned in this answer",meta:L},D=()=>{if(!z.answerSnippet)return null;const V=z.answerSnippet.split(`
|
|
97
|
-
`),re=[];let ee=[],Ee=0;const Te=()=>{if(ee.length===0)return;const ne=ee.join(" ").trim();ne&&re.push(s.jsx("p",{className:re.length>0?"mt-2.5":"",children:w1(ne,Y)},Ee++)),ee=[]};for(const ne of V){const he=ne.trim();if(/^[-\u2013\u2014]{3,}$/.test(he)){Te(),re.push(s.jsx("hr",{className:"border-zinc-800/60 my-3"},Ee++));continue}const je=he.match(/^(#{1,3})\s+(.+)$/);if(je){Te();const me=je[1].length,et=je[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s#]+/u,"").trim()||je[2],Ie=me===1?"text-[13px] font-semibold text-zinc-100 mt-4 mb-1":me===2?"text-xs font-semibold text-zinc-200 mt-3 mb-0.5":"text-xs font-medium text-zinc-300 mt-2";re.push(s.jsx("p",{className:Ie,children:w1(et,Y)},Ee++));continue}if(he===""){Te();continue}ee.push(he)}return Te(),re};return s.jsx(N$,{open:!0,onOpenChange:V=>{V||n()},children:s.jsxs(k$,{children:[s.jsx(Uk,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"}),s.jsxs(qk,{className:"evidence-modal","aria-describedby":void 0,children:[s.jsxs("div",{className:"evidence-modal-header",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"eyebrow eyebrow-soft",children:[t.project.name," ","·"," ",z.provider||"All providers"]}),s.jsx(Fk,{className:"text-lg font-semibold text-zinc-50 truncate",children:e.query})]}),s.jsxs(A$,{className:"inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-800 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 shrink-0",children:[s.jsx(wc,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]}),E&&s.jsxs("div",{className:"evidence-modal-timeline",children:[s.jsx("p",{className:"drawer-section-label mb-1.5",children:"Run history"}),s.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1",children:k.map((V,re)=>{const ee=c===-1&&re===k.length-1||c===re,Ee=V.visibilityState??(V.answerMentioned?"visible":"not-visible"),Te=V.visibilityTransition??Ee,ne=Ee==="visible"?"bg-emerald-400":Te==="emerging"?"bg-amber-400":Te==="lost"?"bg-rose-400":"bg-zinc-600",je=new Date(V.createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),me=!!(V.model&&re>0&&k[re-1]?.model&&k[re-1].model!==V.model);return s.jsxs("button",{type:"button",className:`evidence-run-dot ${ee?"evidence-run-dot--selected":""}`,onClick:()=>ue(re===k.length-1?-1:re),"aria-label":[`Run ${je}: ${Ee}`,V.model?`model ${V.model}`:null,me?"model changed":null].filter(Boolean).join(" — "),"aria-pressed":ee,children:[s.jsx("span",{className:`size-2 rounded-full ${ne} ${me?"ring-1 ring-amber-300/80 ring-offset-2 ring-offset-zinc-950":""}`,"aria-hidden":"true"}),s.jsx("span",{className:"text-[10px] text-zinc-500",children:je})]},re)})}),c>=0&&c<k.length&&s.jsxs("p",{className:"text-[11px] text-zinc-500 mt-1",children:["Viewing run from ",new Date(k[c].createdAt).toLocaleString()," ","—"," ",s.jsx("span",{className:"capitalize",children:k[c].visibilityState??(k[c].answerMentioned?"visible":"not-visible")}),s.jsxs("button",{type:"button",className:"text-zinc-400 hover:text-zinc-200 ml-2",onClick:()=>ue(-1),children:["←"," Back to latest"]})]}),!O&&(e.modelTransitions?.length??0)>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.modelTransitions.map(V=>s.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-1 text-[10px] text-amber-100",children:`${V.fromModel??"unknown"} -> ${V.toModel??"unknown"} on ${new Date(V.createdAt).toLocaleDateString()}`},`${V.runId}:${V.toModel??"unknown"}`))})]}),s.jsxs("div",{className:"evidence-modal-body",children:[m&&s.jsxs("div",{className:"md:col-span-2 flex items-center justify-center py-12 text-zinc-500 text-sm",children:["Loading historical run data","…"]}),!m&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"evidence-modal-main",children:[s.jsxs("div",{className:`evidence-position-hero evidence-position-hero--${H}`,children:[s.jsx("p",{className:`evidence-position-label evidence-position-label--${H}`,children:I.label}),s.jsx("p",{className:`evidence-position-title evidence-position-title--${H}`,children:I.title}),s.jsx("p",{className:"evidence-position-meta",children:I.meta}),q&&s.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:q})]}),z.answerSnippet&&s.jsxs("div",{children:[s.jsx("p",{className:"drawer-section-label",children:"What the AI said"}),s.jsx("div",{className:`answer-snippet-block ${r?"evidence-answer-expanded":"evidence-answer-collapsed"}`,children:D()}),z.answerSnippet.length>280&&s.jsx("button",{type:"button",className:"mt-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",onClick:()=>i(!r),children:r?"↑ Collapse":"↓ Show full answer"})]}),!z.answerSnippet&&!m&&s.jsx("div",{className:"rounded-lg border border-zinc-800/40 bg-zinc-900/20 px-4 py-8 text-center text-zinc-600 text-sm",children:"No answer text recorded for this run"}),!O&&e.relatedTechnicalSignals.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"drawer-section-label",children:$?"Why you're visible":"What to fix"}),s.jsx("div",{className:"action-items-list",children:e.relatedTechnicalSignals.map((V,re)=>s.jsxs("div",{className:"action-item",children:[s.jsx("svg",{className:`action-item-icon ${$?"text-emerald-400":"text-amber-400"}`,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:$?s.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M8 5v3.5M8 10.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),s.jsx("span",{className:"action-item-text",children:V})]},re))})]}),z.summary&&s.jsx("p",{className:"text-xs text-zinc-600 border-t border-zinc-800/40 pt-3 mt-1",children:z.summary})]}),s.jsxs("div",{className:"evidence-modal-sidebar",children:[(F||M)&&s.jsxs("div",{className:"sidebar-tabs",children:[s.jsx("button",{className:`sidebar-tab ${a==="mentions"?"sidebar-tab--active":""}`,onClick:()=>l("mentions"),type:"button",title:"Canonry's answer-level visibility assessment and any company names extracted from the answer text.",children:"Mentions"}),s.jsx("button",{className:`sidebar-tab ${a==="sources"?"sidebar-tab--active":""}`,onClick:()=>l("sources"),type:"button",title:"Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.",children:"Sources"})]}),a==="mentions"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsx("span",{children:"Mention in answer"}),s.jsx(Wn,{text:"Canonry scans the AI answer for your owned domains and project name. This is independent from grounding or citation sources."})]}),s.jsxs("div",{className:`mention-status mention-status--${$?"mentioned":"not-mentioned"}`,children:[s.jsx("span",{className:"mention-status-icon",children:R?"…":$?"✓":"—"}),s.jsx("span",{className:"mention-status-label",children:R?"Pending":$?"Mentioned":"Not mentioned"})]}),z.matchedTerms.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Matched in answer"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:z.matchedTerms.map(V=>s.jsx("span",{className:"mention-chip mention-chip--brand",children:V},V))})]}),!R&&!$&&z.matchedTerms.length===0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Searched for"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.map(V=>s.jsx("span",{className:"mention-chip mention-chip--muted",children:V},V))}),s.jsx("p",{className:"text-[11px] text-zinc-600 mt-1.5",children:"None of these appear in the answer text."})]})]}),(z.recommendedCompetitors.length>0||z.competitorDomains.length>0)&&s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsx("span",{children:"Competitors in answer"}),s.jsx(Wn,{text:"Competitors detected in the answer text or cited source links. Includes both tracked competitors and names extracted by Canonry."})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{const V=z.competitorDomains.map(Ee=>Ee.replace(/^www\./,"")),re=new Set(V.map(Ee=>hy(Ee.replace(/\.[^.]+$/,""))));return[...z.recommendedCompetitors.filter(Ee=>!re.has(hy(Ee))),...V].map(Ee=>s.jsx("span",{className:"mention-chip mention-chip--competitor",children:Ee},Ee))})()})]})]}),a==="sources"&&s.jsxs(s.Fragment,{children:[z.citedDomains.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsx("span",{children:"Domains from source links"}),s.jsx(Wn,{text:"These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them."})]}),s.jsx("div",{className:"citation-leaderboard",children:z.citedDomains.map((V,re)=>{const ee=V.toLowerCase().replace(/^www\./,""),Ee=j.has(ee),Te=!Ee&&z.competitorDomains.some(he=>he.toLowerCase().replace(/^www\./,"")===ee),ne=Ee?"you":Te?"competitor":"other";return s.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${ne}`,children:[s.jsxs("span",{className:"citation-leaderboard-rank",children:["#",re+1]}),s.jsx("span",{className:"citation-leaderboard-domain",children:V}),Ee&&s.jsx("span",{className:"citation-leaderboard-tag",children:"You"}),Te&&s.jsx("span",{className:"citation-leaderboard-tag",children:"Competitor"})]},V)})})]}),z.groundingSources.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsxs("span",{children:["Grounding source links (",z.groundingSources.length,")"]}),s.jsx(Wn,{text:"Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility."})]}),s.jsx("ul",{className:"grid gap-0.5",children:z.groundingSources.map((V,re)=>s.jsx("li",{className:"truncate text-sm",children:s.jsx("a",{href:V.uri,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:V.title||V.uri})},re))})]}),z.evidenceUrls.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"drawer-section-label",children:"Evidence URLs"}),s.jsx("ul",{className:"grid gap-1",children:z.evidenceUrls.map(V=>s.jsx("li",{className:"truncate text-sm",children:s.jsx("a",{href:V,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:V})},V))})]}),z.citedDomains.length===0&&z.groundingSources.length===0&&z.evidenceUrls.length===0&&s.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No source data ",O?"for this run":"yet"]})]}),!F&&!M&&s.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No answer visibility data ",O?"for this run":"yet"]})]})]})]})]})]})})}function ha(e){const t=new Date("2026-02-20");return e.map((n,r)=>({runId:`run_mock_${r+1}`,citationState:n,createdAt:new Date(t.getTime()+r*2*24*60*60*1e3).toISOString()}))}const Hw=[{id:"project_citypoint",name:"Citypoint Dental NYC",canonicalDomain:"citypointdental.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["local intent","priority"],labels:{},locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_harbor",name:"Harbor Legal Group",canonicalDomain:"harborlegal.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["lead gen"],labels:{},locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_northstar",name:"Northstar Orthopedics",canonicalDomain:"northstarortho.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["multi-location"],labels:{},locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1}];function Gv(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??"manual",createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel}}const Qae=Gv({id:"run_citypoint_visibility_20260308",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T12:15:00.000Z",startedAt:"Mar 8, 12:15 PM",duration:"6m 12s",statusDetail:"18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.",summary:"Citation losses on emergency-intent prompts",triggerLabel:"Scheduled"}),Yae=Gv({id:"run_citypoint_queued_20260309",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"queued",createdAt:"2026-03-09T08:05:00.000Z",startedAt:"Mar 9, 8:05 AM",duration:"Waiting for slot",statusDetail:"Ready to enqueue after the next provider rate window clears.",summary:"Queued follow-up after local ranking movement",triggerLabel:"Manual"}),Wae=Gv({id:"run_harbor_visibility_20260308",projectId:"project_harbor",projectName:"Harbor Legal Group",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T11:05:00.000Z",startedAt:"Mar 8, 11:05 AM",duration:"5m 07s",statusDetail:"12 tracked queries checked; local-intent visibility held steady across branded prompts.",summary:"Branded prompts remain stable",triggerLabel:"Scheduled"}),Zae=Gv({id:"run_northstar_visibility_20260308",projectId:"project_northstar",projectName:"Northstar Orthopedics",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"running",createdAt:"2026-03-08T13:40:00.000Z",startedAt:"Mar 8, 1:40 PM",duration:"3m 10s",statusDetail:"Provider responses still in flight for 9 multi-location prompts.",summary:"Mid-run on treatment-location prompts",triggerLabel:"Manual"}),Xae=[{id:"evidence_citypoint_emergency_gemini",query:"emergency dentist brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"lost",changeLabel:"Lost since Mar 5",answerSnippet:"For urgent dental care in Brooklyn, Downtown Smiles and Harbor Dental are now cited first for emergency availability and same-day booking.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:["https://downtownsmiles.com/emergency-dentist-brooklyn","https://harbordental.com/same-day-emergency-care"],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing on the emergency service page","llms.txt not found during latest site audit","Location pages link weakly into the emergency care hub"],summary:"AI answers now cite two competitors while your emergency page is no longer grounded.",runHistory:ha(["cited","cited","cited","cited","cited","cited","cited","not-cited","not-cited"])},{id:"evidence_citypoint_emergency_openai",query:"emergency dentist brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"Cited for 6 runs",answerSnippet:"Citypoint Dental is listed as a top emergency dentist in Brooklyn for same-day appointments and walk-in availability.",citedDomains:["citypointdental.com","downtownsmiles.com"],evidenceUrls:["https://citypointdental.com/emergency-dentist-brooklyn"],competitorDomains:["downtownsmiles.com"],groundingSources:[],relatedTechnicalSignals:["Emergency page indexed with structured data"],summary:"OpenAI cites your emergency page consistently alongside one competitor.",runHistory:ha(["not-cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_emergency_claude",query:"emergency dentist brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"Based on the search results, top-rated emergency dental practices in Brooklyn include Downtown Smiles and Harbor Dental.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:[],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing","llms.txt not found"],summary:"Claude does not cite your domain for this emergency query.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_invisalign_openai",query:"best invisalign dentist downtown brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"emerging",changeLabel:"First citation in 7 days",answerSnippet:"Citypoint Dental appears as an emerging recommendation for Invisalign in Downtown Brooklyn, supported by recent before-and-after case pages.",citedDomains:["citypointdental.com","clearlineortho.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn","https://citypointdental.com/case-studies/invisalign-open-bite"],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["Structured data now present on two case-study pages","Internal links from service pages to case studies improved crawl depth"],summary:"Fresh case-study content is starting to earn citations on Invisalign prompts.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","cited"])},{id:"evidence_citypoint_invisalign_gemini",query:"best invisalign dentist downtown brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"cited",changeLabel:"Cited for 8 runs",answerSnippet:"Citypoint Dental in Downtown Brooklyn is highlighted for its Invisalign expertise and patient outcomes.",citedDomains:["citypointdental.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn"],competitorDomains:[],groundingSources:[],relatedTechnicalSignals:["Case study pages well-indexed"],summary:"Gemini consistently cites your Invisalign page with no competitor overlap.",runHistory:ha(["cited","cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_invisalign_claude",query:"best invisalign dentist downtown brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For Invisalign in Downtown Brooklyn, Clear Line Ortho and Brooklyn Smiles are frequently recommended for their experienced orthodontists.",citedDomains:["clearlineortho.com","brooklynsmiles.com"],evidenceUrls:[],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["No before/after schema on case study pages"],summary:"Claude does not surface your Invisalign content despite strong page quality.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_claude",query:"pediatric dentist brooklyn heights",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 4 runs",answerSnippet:"Answers cite neighborhood-specific pediatric practices with stronger family-focused FAQ content and clearer insurance details.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:["https://brightkidsdental.com/pediatric-dentist-brooklyn-heights","https://parkpediatricdental.com/insurance"],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric service page exists for Brooklyn Heights","Insurance content is buried three clicks deep"],summary:"Coverage gap is content-driven, not purely technical.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_gemini",query:"pediatric dentist brooklyn heights",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For pediatric dentistry in Brooklyn Heights, Bright Kids Dental and Park Pediatric Dental are cited for family-friendly care.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:[],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric page for Brooklyn Heights"],summary:"Gemini does not surface your domain for pediatric queries in this area.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_openai",query:"pediatric dentist brooklyn heights",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"First citation this month",answerSnippet:"Citypoint Dental is mentioned as offering pediatric services in Brooklyn, though specialized pediatric-only practices are also highlighted.",citedDomains:["citypointdental.com","brightkidsdental.com"],evidenceUrls:["https://citypointdental.com/family-dentistry"],competitorDomains:["brightkidsdental.com"],groundingSources:[],relatedTechnicalSignals:["Family dentistry page recently updated"],summary:"OpenAI recently started citing your family dentistry page for this query.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","cited"])}];Hw[0],Hw[1],ha(["cited","cited","cited","cited","cited"]),Hw[2],2/7,3/7,ha(["not-cited","not-cited","not-cited","cited"]);function Jae(e,t){return e.projects.find(n=>n.project.id===t)}function ese(e,t){return e.runs.find(n=>n.id===t)}function tse(e,t){for(const n of e.projects){const r=n.visibilityEvidence.find(i=>i.id===t);if(r)return{project:n,evidence:r}}}const nse={regression:"negative",gain:"positive",opportunity:"caution","first-citation":"positive","provider-pickup":"positive","persistent-gap":"caution","competitor-gained":"negative","competitor-lost":"neutral"},rse={opportunity:"write","persistent-gap":"write","competitor-gained":"write","competitor-lost":"write",regression:"investigate",gain:"monitor","first-citation":"monitor","provider-pickup":"monitor"},ise={regression:"lost",gain:"emerging",opportunity:"not-cited","first-citation":"emerging","provider-pickup":"emerging","persistent-gap":"not-cited","competitor-gained":"cited","competitor-lost":"not-cited"},ase={regression:"Regression",gain:"Gain",opportunity:"Opportunity","first-citation":"First citation","provider-pickup":"Pickup","persistent-gap":"Gap","competitor-gained":"Competitor","competitor-lost":"Competitor"};function sse(e){return{id:e.id,tone:nse[e.type],title:e.title,detail:e.cause?.details??e.cause?.cause??"",actionLabel:e.recommendation?.action??ase[e.type],actionGroup:rse[e.type],affectedPhrases:[{query:e.query,evidenceId:"",provider:e.provider,citationState:ise[e.type]}]}}function ose(e){return e.filter(t=>!t.dismissed).map(sse)}function z$(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],aliases:e.aliases??[],country:e.country,language:e.language,tags:e.tags,labels:e.labels,locations:e.locations??[],defaultLocation:e.defaultLocation??null,autoExtractBacklinks:e.autoExtractBacklinks??!1,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function GT(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return e}}function lse(e,t){if(!e)return"Waiting";if(!t)return"Running";const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return"<1s";const r=Math.floor(n/1e3);if(r<60)return`${r}s`;const i=Math.floor(r/60),a=r%60;return`${i}m ${a}s`}function _$(e){switch(e){case vt["answer-visibility"]:return"Answer visibility sweep";case vt["gsc-sync"]:return"GSC sync";case vt["inspect-sitemap"]:return"Sitemap inspection";case vt["ga-sync"]:return"GA sync";case vt["traffic-sync"]:return"Traffic sync";case vt["bing-inspect"]:return"Bing URL inspection";case vt["bing-inspect-sitemap"]:return"Bing sitemap inspection";case vt["site-audit"]:return"Site audit";case vt["backlink-extract"]:return"Backlink extract";case vt["aeo-discover-seed"]:return"Discovery (seed phase)";case vt["aeo-discover-probe"]:return"Discovery (probe phase)"}}function cse(e){return e===uh.manual?"Manual":e===uh.scheduled?"Scheduled":e===uh["config-apply"]?"Config apply":e}function Gk(e,t){return{id:e.id,projectId:e.projectId,projectName:t,kind:e.kind,kindLabel:_$(e.kind),status:e.status,trigger:e.trigger??"manual",location:e.location??null,createdAt:e.createdAt,startedAt:e.startedAt?GT(e.startedAt):GT(e.createdAt),duration:lse(e.startedAt,e.finishedAt),statusDetail:e.error?T$(e.error):use(e),summary:dse(e),triggerLabel:cse(e.trigger)}}function T$(e){const t=Nk(e);return t.length>200?t.slice(0,200)+"…":t}function use(e){switch(e.status){case xr.queued:return"Waiting for execution slot.";case xr.running:return"Provider queries in progress.";case xr.completed:return"All queries checked.";case xr.partial:return"Run completed with some queries skipped.";case xr.failed:return e.error?T$(e.error):"Run failed.";case xr.cancelled:return"Run was cancelled.";default:return""}}function dse(e){const t=_$(e.kind);switch(e.status){case xr.queued:return`${t} queued`;case xr.running:return`${t} in progress`;case xr.completed:return`${t} completed`;case xr.partial:return`${t} partially completed`;case xr.failed:return`${t} failed`;case xr.cancelled:return`${t} cancelled`;default:return e.status}}function fse(e,t,n,r){const i=[];let a=0;const l=new Set;if(n.length>0){const c=n.flatMap(w=>w.snapshots),d=new Map;for(const w of c)if(w.query){const b=`${w.query}::${w.provider}::${w.location??""}`;d.set(b,w)}const f=new Set(c.map(w=>w.location??null));f.size===0&&f.add(null);const p=new Set(c.map(w=>w.provider)),m=new Set(t.flatMap(w=>Object.keys(w.providerRuns??{}))),y=[...new Set([...p,...m])].sort(),v=y.length>0?y:["gemini"];for(const w of t){if(w.runs.length===0)continue;l.add(w.query);const b=w.runs.at(-1),j=b?.transition??"not-cited";for(const k of v){const E=[...f].filter(_=>d.has(`${w.query}::${k}::${_??""}`)),A=(w.providerRuns?.[k]?.length??0)>0,C=E.length>0?E:A?[null]:[];for(const _ of C){const O=_??"",z=d.get(`${w.query}::${k}::${O}`),R=z?.model??null,$=R?`${k}:${R}`:null,F=w.providerRuns?.[k],M=$?w.modelRuns?.[$]:void 0,U=he=>he?.filter(je=>(je.location??null)===_),K=E.length>0?U(F):F,Z=E.length>0?U(M):M,Y=(K?.length?K:null)??(Z?.length?Z:null),H=K?.length?"provider":Z?.length?"model":"query",X=Y?Y.at(-1).transition:j,ue=Y?Y.at(-1).visibilityTransition??(Y.at(-1).visibilityState==="visible"?"visible":"not-visible"):b?.visibilityTransition??(b?.visibilityState==="visible"?"visible":"not-visible"),xe=Y?.at(-1)?.citationState,L=Y?.at(-1)?.visibilityState,q=z?X==="lost"?"lost":X==="emerging"?"emerging":z.citationState===Eh.cited?"cited":"not-cited":xe===Eh.cited?"cited":"not-cited",I=z?.visibilityState??(L==="visible"?"visible":L==="pending"?"pending":"not-visible"),D=VT(Y||w.runs),V=QT(Y||w.runs),re=hse(w,k),ee=(Y??w.runs).map(he=>({runId:he.runId,citationState:he.citationState,createdAt:he.createdAt,model:re.get(he.runId)??null,answerMentioned:he.answerMentioned,visibilityState:he.visibilityState,visibilityTransition:he.visibilityTransition,mentionState:he.mentionState,mentionTransition:he.mentionTransition})),Ee=pse(ee),Te=H==="provider"&&Ee.length<=1?"model":H,ne=mse(ee);i.push({id:`evidence_${e}_${a++}`,query:w.query,provider:z?.provider??k,model:z?.model??null,location:z?.location??_,citationState:q,answerMentioned:z?.answerMentioned,visibilityState:I,visibilityChangeLabel:YT(ue,V,{positive:"visible",negative:"not visible",first:"first visibility"}),changeLabel:YT(X,D),answerSnippet:z?.answerText??"",citedDomains:z?.citedDomains??[],evidenceUrls:[],competitorDomains:z?.competitorOverlap??[],recommendedCompetitors:z?.recommendedCompetitors??[],matchedTerms:z?.matchedTerms??[],relatedTechnicalSignals:[],groundingSources:z?.groundingSources??[],summary:gse(I,ue,w.query),runHistory:ee,historyScope:Te,modelsSeen:Ee,modelTransitions:ne})}}}}for(const c of r)l.has(c.query)||i.push({id:`evidence_${e}_${a++}`,query:c.query,provider:"",model:null,location:null,citationState:"pending",visibilityState:"pending",visibilityChangeLabel:"Awaiting first run",changeLabel:"Awaiting first run",answerSnippet:"",citedDomains:[],evidenceUrls:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],relatedTechnicalSignals:[],groundingSources:[],summary:`"${c.query}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:"query",modelsSeen:[],modelTransitions:[]});return i}function hse(e,t){const n=new Map,r=`${t}:`;for(const[i,a]of Object.entries(e.modelRuns??{})){if(!i.startsWith(r))continue;const l=i.slice(r.length),c=l==="unknown"?null:l;for(const d of a)n.set(d.runId,c)}return n}function pse(e){const t=new Set;for(const n of e)n.model&&t.add(n.model);return[...t]}function mse(e){const t=[];let n=null;for(const r of e){const i=r.model??null;i!==n&&n!==null&&t.push({runId:r.runId,createdAt:r.createdAt,fromModel:n,toModel:i}),n=i}return t}function VT(e){if(e.length===0)return 0;const t=e[e.length-1].citationState;let n=0;for(let r=e.length-1;r>=0&&e[r].citationState===t;r--)n++;return n}function QT(e){if(e.length===0)return 0;const t=e[e.length-1].visibilityState??"not-visible";let n=0;for(let r=e.length-1;r>=0&&(e[r].visibilityState??"not-visible")===t;r--)n++;return n}function YT(e,t,n){const r={positive:n?.positive??"cited",negative:n?.negative??"not cited",first:n?.first??"first citation"};switch(e){case"new":return"First observation";case"cited":case"visible":return t<=1?`${Lf(r.positive)} in latest run`:`${Lf(r.positive)} for ${t} runs`;case"lost":return"Lost since last run";case"emerging":return Lf(r.first);case"not-cited":case"not-visible":return t<=1?`${Lf(r.negative)} in latest run`:`${Lf(r.negative)} across ${t} runs`;default:return e}}function Lf(e){return e.charAt(0).toUpperCase()+e.slice(1)}function gse(e,t,n){switch(t){case"lost":return`Mention was lost for "${n}". Your brand no longer appeared in the latest answer.`;case"emerging":return`Your brand started appearing in AI answers for "${n}".`}switch(e){case"visible":return`Your brand or domain is mentioned in AI answers for "${n}".`;case"pending":return`"${n}" has been added but no run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${n}".`}}function yse(e){const t=z$(e.project),n=fse(t.name,e.timeline,e.latestRunDetails,e.queries),i=[...e.runs].sort((a,l)=>l.createdAt.localeCompare(a.createdAt)).map(a=>Gk(a,e.project.displayName||e.project.name));return e.overview?vse(t,e.overview,n,i):xse(t,n,i)}function vse(e,t,n,r){const i=ose(t.topInsights);for(const a of t.attentionItems)a.id.startsWith("insight_")||i.push({id:a.id,tone:a.tone,title:a.title,detail:a.detail,actionLabel:a.actionLabel,actionGroup:"investigate",affectedPhrases:[]});return{project:e,dateRangeLabel:t.dateRangeLabel,contextLabel:t.contextLabel,mentionSummary:t.scores.mention,visibilitySummary:t.scores.visibility,mentionShareSummary:t.scores.mentionShare,queryCounts:{cited:t.queryCounts.citedQueries,total:t.queryCounts.totalQueries},gapQueries:t.scores.gapQueries,mentionGaps:t.scores.mentionGaps,indexCoverage:t.scores.indexCoverage,providerScores:t.providerScores,competitorPressure:t.scores.competitorPressure,runStatus:t.scores.runStatus,movementSummary:t.movementSummary,insights:i,visibilityEvidence:n,competitors:t.competitors.map(a=>({id:a.id,domain:a.domain,citationCount:a.citationCount,totalQueries:a.totalQueries,pressureLabel:a.pressureLabel,citedQueries:a.citedQueries,movement:"",notes:""})),recentRuns:r.slice(0,5),suggestedQueries:t.suggestedQueries}}function xse(e,t,n){const r={label:"",value:"No data",delta:"Loading…",tone:"neutral",description:"",tooltip:"",trend:[]};return{project:e,dateRangeLabel:"All time",contextLabel:`${e.country} / ${e.language.toUpperCase()}`,mentionSummary:{...r,label:"Mention Coverage"},visibilitySummary:{...r,label:"Citation Coverage"},mentionShareSummary:{...r,label:"Mention Share",breakdown:{projectMentionSnapshots:0,competitorMentionSnapshots:0,perCompetitor:[],snapshotsWithAnswerText:0,snapshotsTotal:0}},queryCounts:{cited:0,total:0},gapQueries:{...r,label:"Citation Gaps"},mentionGaps:{...r,label:"Mention Gaps"},indexCoverage:{...r,label:"Index Coverage"},providerScores:[],competitorPressure:{...r,label:"Competitor Pressure"},runStatus:{...r,label:"Run Status"},movementSummary:{gained:0,lost:0,tone:"neutral",hasPreviousRun:!1},insights:[],visibilityEvidence:t,competitors:[],recentRuns:n.slice(0,5),suggestedQueries:{rows:[],totalCandidates:0,skippedAlreadyTracked:0}}}function bse(e){const t=z$(e.project),n=[...e.runs].sort((y,v)=>v.createdAt.localeCompare(y.createdAt)),r=n.find(y=>y.kind===vt["answer-visibility"])??n[0],i=e.project.displayName||e.project.name,a=r?Gk(r,i):wse(e.project.id,i),l=e.overview;if(!l)return{project:t,visibilityScore:0,visibilityDelta:"No data",visibilityTone:"neutral",lastRun:a,insight:"No runs completed yet.",trend:[],competitorPressureLabel:"None"};const c=l.scores.visibility,d=c.progress??0,f=l.queryCounts.citedQueries,p=l.queryCounts.totalQueries,m=l.providers.length;return{project:t,visibilityScore:d,visibilityDelta:p>0?`${f} of ${p} queries`:"No data",visibilityTone:c.tone,providerCoverage:c.providerCoverage,lastRun:a,insight:p>0?`${f} of ${p} queries mentioned across ${m} provider${m===1?"":"s"}.`:"No runs completed yet.",trend:[],competitorPressureLabel:l.scores.competitorPressure.value}}function wse(e,t){return{id:"none",projectId:e,projectName:t,kind:vt["answer-visibility"],kindLabel:"No runs yet",status:xr.queued,trigger:uh.manual,createdAt:"",startedAt:"",duration:"",statusDetail:"",summary:"No runs yet",triggerLabel:""}}function Sse(e,t){const n=[],r=[],i=[];for(const l of e){r.push(yse(l)),i.push(bse(l));const c=[...l.runs].sort((d,f)=>f.createdAt.localeCompare(d.createdAt));for(const d of c)n.push(Gk(d,l.project.displayName||l.project.name))}n.sort((l,c)=>c.createdAt.localeCompare(l.createdAt));const a=e.length>0;return{portfolioOverview:{projects:i,attentionItems:a?jse(r):[{id:"attention_setup",tone:"neutral",title:"No projects yet",detail:"Create your first project using the setup wizard, CLI, or API.",actionLabel:"Open setup",href:"/setup"}],recentRuns:n.slice(0,5),systemHealth:[{id:"api",label:"API",tone:"positive",detail:"Connected",meta:"Real-time data"},{id:"provider",label:"Gemini",tone:"positive",detail:"Configured",meta:"Provider active"}],lastUpdatedAt:new Date().toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),...a?{}:{emptyState:{title:"No projects yet",detail:"Canonry becomes useful after one project, a small query set, and one competitor list are in place.",ctaLabel:"Launch setup",ctaHref:"/setup"}}},projects:r,runs:n,setup:{healthChecks:[{id:"api",label:"API reachable",detail:"API is responding.",state:"ready",guidance:"Required for project creation and run history."},{id:"provider",label:"Provider configured",detail:"Gemini key is configured.",state:"ready",guidance:"Required for answer-visibility sweeps."}],projectDraft:{name:"",canonicalDomain:"",country:"US",language:"en"},queryImportState:{mode:"paste",queryCount:0,preview:[]},competitorDraft:{domains:[],notes:"Use the CLI to add competitors."},launchState:{enabled:a,ctaLabel:a?"Trigger run":"Create a project first",summary:a?"Ready to run.":"Create a project first to launch a run."}},settings:{providerStatuses:(t?.providers??[]).map(l=>({name:l.name,displayName:l.displayName,keyUrl:l.keyUrl,modelHint:l.modelHint,model:l.model,state:l.configured?"ready":"needs-config",detail:l.configured?"Provider is configured.":"API key is missing.",quota:l.quota})),google:{state:t?.google?.configured?"ready":"needs-config",detail:t?.google?.configured?"Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.":"Google OAuth client ID and client secret are not configured yet."},bing:{state:t?.bing?.configured?"ready":"needs-config",detail:t?.bing?.configured?"Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.":"Bing Webmaster Tools API key is not configured yet."},selfHostNotes:["Configuration is stored in ~/.canonry/config.yaml.","The local config file is the source of truth for authentication credentials.","Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.","Database is SQLite at ~/.canonry/data.db.","API key was auto-generated during canonry init."],bootstrapNote:"Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config."}}}function jse(e){const t=[];for(const n of e){const r=n.visibilityEvidence.filter(a=>a.citationState==="lost");r.length>0&&t.push({id:`attention_${n.project.id}_lost`,tone:"negative",title:`${n.project.displayName||n.project.name} lost citations`,detail:`${r.length} quer${r.length>1?"ies":"y"} lost citation.`,actionLabel:"Open project",href:`/projects/${n.project.id}`});const i=n.recentRuns.filter(a=>a.status===xr.running||a.status===xr.queued);i.length>0&&t.push({id:`attention_${n.project.id}_active`,tone:"neutral",title:`${n.project.displayName||n.project.name} has active runs`,detail:`${i.length} run${i.length>1?"s":""} in progress.`,actionLabel:"View runs",href:"/runs"})}return t.length===0&&t.push({id:"attention_stable",tone:"positive",title:"All projects stable",detail:"No citation losses or active runs to flag.",actionLabel:"View portfolio",href:"/"}),t}const _e={projects:{all:["projects"],detail:(e,t)=>["projects",e,t],queries:e=>["projects",e,"queries"],competitors:e=>["projects",e,"competitors"],timeline:(e,t)=>["projects",e,"timeline",t]},runs:{all:["runs"],detail:e=>["runs",e]},settings:["settings"],health:["health"],gsc:{project:e=>["gsc",e],connections:e=>["gsc",e,"connections"],properties:e=>["gsc",e,"properties"],performance:(e,t)=>["gsc",e,"performance",t],performanceDaily:(e,t)=>["gsc",e,"performance-daily",t],inspections:(e,t)=>["gsc",e,"inspections",t],deindexed:e=>["gsc",e,"deindexed"],coverage:e=>["gsc",e,"coverage"],coverageHistory:e=>["gsc",e,"coverage-history"],sitemaps:e=>["gsc",e,"sitemaps"]},bing:{project:e=>["bing",e],status:e=>["bing",e,"status"],coverage:e=>["bing",e,"coverage"],inspections:e=>["bing",e,"inspections"],performance:e=>["bing",e,"performance"],sites:e=>["bing",e,"sites"]},schedule:e=>["schedule",e],notifications:e=>["notifications",e],agent:{providers:e=>["agent",e,"providers"]},discovery:{project:e=>["discovery",e],sessions:e=>["discovery",e,"sessions"],session:(e,t)=>["discovery",e,"sessions",t],promotePreview:(e,t)=>["discovery",e,"sessions",t,"promote-preview"]},citationVisibility:e=>["citation-visibility",e],report:e=>["report",e],traffic:{project:e=>["traffic",e],status:e=>["traffic",e,"status"],summary:(e,t)=>["traffic",e,"summary",t],aiHistory:(e,t)=>["traffic",e,"ai-history",t],sessionHistory:(e,t)=>["traffic",e,"session-history",t],socialHistory:(e,t)=>["traffic",e,"social-history",t]},serverTraffic:{all:["server-traffic"],project:e=>["server-traffic",e],sources:e=>["server-traffic",e,"sources"],status:e=>["server-traffic",e,"status"],sourceDetail:(e,t)=>["server-traffic",e,"sources",t],events:(e,t)=>["server-traffic",e,"events",t]}},P$=x.createContext(null);P$.Provider;function tp(){return x.useContext(P$)}function kc(e){const n=tp()?.dashboard??null,r=Bn({queryKey:_e.projects.all,queryFn:zv,enabled:!n}),i=Bn({queryKey:_e.runs.all,queryFn:Z5,enabled:!n,staleTime:u1,refetchInterval:w=>w.state.data?.some(k=>k.status==="running"||k.status==="queued")?3e3:u1}),a=Bn({queryKey:_e.settings,queryFn:()=>dk().catch(()=>null),enabled:!n}),l=r.data??[],c=i.data??[],d=C5({queries:l.map(w=>{const b=c.filter(O=>O.projectId===w.id),j=b.filter(O=>(O.status==="completed"||O.status==="partial")&&O.kind==="answer-visibility").sort((O,z)=>z.createdAt.localeCompare(O.createdAt)),k=j[0]?.createdAt??null,E=k?j.filter(O=>O.createdAt===k).map(O=>O.id):[],A=j.find(O=>O.createdAt!==k)?.createdAt??null,C=A?j.filter(O=>O.createdAt===A).map(O=>O.id):[],_=[...E].sort().join(",");return{queryKey:_e.projects.detail(w.id,_||void 0),queryFn:async()=>{const[O,z,R,$,F,M,U,K,Z]=await Promise.all([OV(w.name).catch(()=>[]),X5(w.name).catch(()=>[]),J5(w.name).catch(()=>[]),E.length?Promise.all(E.map(Y=>Ko(Y).catch(()=>null))).then(Y=>Y.filter(H=>H!=null)):Promise.resolve([]),C.length?Promise.all(C.map(Y=>Ko(Y).catch(()=>null))).then(Y=>Y.filter(H=>H!=null)):Promise.resolve([]),fk(w.name).catch(()=>null),hk(w.name).catch(()=>null),UQ(w.name).catch(()=>null),zV(w.name).catch(()=>null)]);return{project:w,runs:b,queries:O,competitors:z,timeline:R,latestRunDetails:$,previousRunDetails:F,gscCoverage:M,bingCoverage:U,dbInsights:K,overview:Z}},enabled:!n&&r.isSuccess&&i.isSuccess,staleTime:f4}})}),f=d.every(w=>w.isSuccess),p=x.useMemo(()=>{if(n)return n;if(!r.data||!i.data||l.length>0&&!f)return null;const w=d.map(b=>b.data?{...b.data,runs:c.filter(j=>j.projectId===b.data.project.id)}:null).filter(b=>b!=null);return Sse(w,a.data??null)},[n,r.data,i.data,a.data,f,d,l.length,c]),m=!n&&(r.isError||i.isError),y=!n&&!p&&!m,v=x.useCallback(async()=>{await Promise.all([r.refetch(),i.refetch(),a.refetch()])},[r.refetch,i.refetch,a.refetch]);return{dashboard:p,isLoading:y,isError:m,refetch:v}}async function Nse(){const e=await HQ("/health","API"),t=e.state==="ok"?{label:"Worker",state:"ok",detail:"In-process job runner"}:{label:"Worker",state:e.state,detail:`Depends on API health check · ${e.detail}`,statusCode:e.statusCode,hint:e.hint?`Worker status is inferred from API health in this deployment mode. ${e.hint}`:"Worker status is inferred from API health in this deployment mode."};return{apiStatus:e,workerStatus:t}}function Vv(e,t){return Bn({queryKey:_e.health,queryFn:Nse,enabled:e,refetchInterval:15e3,initialData:t})}function kse(e){return Bn({queryKey:_e.runs.detail(e??""),queryFn:()=>Ko(e),enabled:!!e,refetchInterval:t=>{const n=t.state.data?.status;return n==="running"||n==="queued"?3e3:!1}})}function jd(){const e=Jo(),t=Ov({strict:!1}),n=oi({select:d=>d.location.pathname}),r=t.runId??null,i=t.evidenceId??null;return{runId:r,evidenceId:i,openRun:d=>e({to:n,from:ci.to,search:f=>({...f,runId:d,evidenceId:void 0})}),openEvidence:d=>e({to:n,from:ci.to,search:f=>({...f,evidenceId:d,runId:void 0})}),closeDrawer:()=>e({to:n,from:ci.to,search:d=>({...d,runId:void 0,evidenceId:void 0})})}}const Cse={negative:"toast-card-negative",caution:"toast-card-caution",positive:"toast-card-positive",neutral:"toast-card-neutral"};function Ase(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function Ese(){const e=x.useSyncExternalStore(oY,K2,K2),t=Jo(),{openRun:n}=jd(),r=x.useCallback(a=>{c1(a)},[]),i=x.useCallback(a=>{a.cta&&(a.cta.intent==="open-run-drawer"?n(a.cta.runId):t({to:"/runs"}),c1(a.id))},[t,n]);return e.length===0?null:s.jsx("div",{className:"toast-viewport","aria-label":"Notifications",children:e.map(a=>s.jsxs("section",{role:a.tone==="negative"?"alert":"status","aria-live":a.tone==="negative"?"assertive":"polite","data-state":a.state,className:`toast-card ${Cse[a.tone]}`,children:[s.jsxs("div",{className:"toast-copy",children:[s.jsx("p",{className:"toast-title",children:a.title}),a.detail?s.jsx("p",{className:"toast-detail",children:a.detail}):null,a.cta?s.jsx("button",{type:"button",className:"toast-action",onClick:()=>i(a),"aria-label":Ase(a),children:a.cta.label}):null]}),s.jsx("button",{type:"button",onClick:()=>r(a.id),className:"toast-dismiss","aria-label":"Dismiss",children:s.jsx(wc,{className:"size-3.5"})})]},a.id))})}function Ose(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const zse=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_se=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tse={};function WT(e,t){return(Tse.jsx?_se:zse).test(e)}const Pse=/[ \t\n\f\r]/g;function Rse(e){return typeof e=="object"?e.type==="text"?ZT(e.value):!1:ZT(e)}function ZT(e){return e.replace(Pse,"")===""}let np=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};np.prototype.normal={};np.prototype.property={};np.prototype.space=void 0;function R$(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new np(n,r,t)}function S1(e){return e.toLowerCase()}class di{constructor(t,n){this.attribute=n,this.property=t}}di.prototype.attribute="";di.prototype.booleanish=!1;di.prototype.boolean=!1;di.prototype.commaOrSpaceSeparated=!1;di.prototype.commaSeparated=!1;di.prototype.defined=!1;di.prototype.mustUseProperty=!1;di.prototype.number=!1;di.prototype.overloadedBoolean=!1;di.prototype.property="";di.prototype.spaceSeparated=!1;di.prototype.space=void 0;let Dse=0;const gt=Cc(),$n=Cc(),j1=Cc(),Oe=Cc(),Xt=Cc(),Gu=Cc(),wi=Cc();function Cc(){return 2**++Dse}const N1=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:$n,commaOrSpaceSeparated:wi,commaSeparated:Gu,number:Oe,overloadedBoolean:j1,spaceSeparated:Xt},Symbol.toStringTag,{value:"Module"})),Kw=Object.keys(N1);class Vk extends di{constructor(t,n,r,i){let a=-1;if(super(t,n),XT(this,"space",i),typeof r=="number")for(;++a<Kw.length;){const l=Kw[a];XT(this,Kw[a],(r&N1[l])===N1[l])}}}Vk.prototype.defined=!0;function XT(e,t,n){n&&(e[t]=n)}function Nd(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new Vk(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[S1(r)]=r,n[S1(a.attribute)]=r}return new np(t,n,e.space)}const D$=Nd({properties:{ariaActiveDescendant:null,ariaAtomic:$n,ariaAutoComplete:null,ariaBusy:$n,ariaChecked:$n,ariaColCount:Oe,ariaColIndex:Oe,ariaColSpan:Oe,ariaControls:Xt,ariaCurrent:null,ariaDescribedBy:Xt,ariaDetails:null,ariaDisabled:$n,ariaDropEffect:Xt,ariaErrorMessage:null,ariaExpanded:$n,ariaFlowTo:Xt,ariaGrabbed:$n,ariaHasPopup:null,ariaHidden:$n,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xt,ariaLevel:Oe,ariaLive:null,ariaModal:$n,ariaMultiLine:$n,ariaMultiSelectable:$n,ariaOrientation:null,ariaOwns:Xt,ariaPlaceholder:null,ariaPosInSet:Oe,ariaPressed:$n,ariaReadOnly:$n,ariaRelevant:null,ariaRequired:$n,ariaRoleDescription:Xt,ariaRowCount:Oe,ariaRowIndex:Oe,ariaRowSpan:Oe,ariaSelected:$n,ariaSetSize:Oe,ariaSort:null,ariaValueMax:Oe,ariaValueMin:Oe,ariaValueNow:Oe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function M$(e,t){return t in e?e[t]:t}function I$(e,t){return M$(e,t.toLowerCase())}const Mse=Nd({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Gu,acceptCharset:Xt,accessKey:Xt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Xt,autoFocus:gt,autoPlay:gt,blocking:Xt,capture:null,charSet:null,checked:gt,cite:null,className:Xt,cols:Oe,colSpan:null,content:null,contentEditable:$n,controls:gt,controlsList:Xt,coords:Oe|Gu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:j1,draggable:$n,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Xt,height:Oe,hidden:j1,high:Oe,href:null,hrefLang:null,htmlFor:Xt,httpEquiv:Xt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Xt,itemRef:Xt,itemScope:gt,itemType:Xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:Oe,manifest:null,max:null,maxLength:Oe,media:null,method:null,min:null,minLength:Oe,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:Oe,pattern:null,ping:Xt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Xt,required:gt,reversed:gt,rows:Oe,rowSpan:Oe,sandbox:Xt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:Oe,sizes:null,slot:null,span:Oe,spellCheck:$n,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Oe,step:null,style:null,tabIndex:Oe,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:$n,width:Oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xt,axis:null,background:null,bgColor:null,border:Oe,borderColor:null,bottomMargin:Oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:Oe,leftMargin:Oe,link:null,longDesc:null,lowSrc:null,marginHeight:Oe,marginWidth:Oe,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:Oe,rules:null,scheme:null,scrolling:$n,standby:null,summary:null,text:null,topMargin:Oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:Oe,security:null,unselectable:null},space:"html",transform:I$}),Ise=Nd({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:wi,accentHeight:Oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Oe,amplitude:Oe,arabicForm:null,ascent:Oe,attributeName:null,attributeType:null,azimuth:Oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Oe,by:null,calcMode:null,capHeight:Oe,className:Xt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Oe,diffuseConstant:Oe,direction:null,display:null,dur:null,divisor:Oe,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Oe,enableBackground:null,end:null,event:null,exponent:Oe,externalResourcesRequired:null,fill:null,fillOpacity:Oe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Gu,g2:Gu,glyphName:Gu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Oe,horizOriginX:Oe,horizOriginY:Oe,id:null,ideographic:Oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Oe,k:Oe,k1:Oe,k2:Oe,k3:Oe,k4:Oe,kernelMatrix:wi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Oe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Oe,overlineThickness:Oe,paintOrder:null,panose1:null,path:null,pathLength:Oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Oe,pointsAtY:Oe,pointsAtZ:Oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wi,rev:wi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wi,requiredFeatures:wi,requiredFonts:wi,requiredFormats:wi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Oe,specularExponent:Oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Oe,strikethroughThickness:Oe,string:null,stroke:null,strokeDashArray:wi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Oe,strokeOpacity:Oe,strokeWidth:null,style:null,surfaceScale:Oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wi,tabIndex:Oe,tableValues:null,target:null,targetX:Oe,targetY:Oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Oe,underlineThickness:Oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Oe,values:null,vAlphabetic:Oe,vMathematical:Oe,vectorEffect:null,vHanging:Oe,vIdeographic:Oe,version:null,vertAdvY:Oe,vertOriginX:Oe,vertOriginY:Oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:M$}),L$=Nd({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$$=Nd({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:I$}),B$=Nd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Lse={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$se=/[A-Z]/g,JT=/-[a-z]/g,Bse=/^data[-\w.:]+$/i;function Use(e,t){const n=S1(t);let r=t,i=di;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Bse.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(JT,Fse);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!JT.test(a)){let l=a.replace($se,qse);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Vk}return new i(r,t)}function qse(e){return"-"+e.toLowerCase()}function Fse(e){return e.charAt(1).toUpperCase()}const Hse=R$([D$,Mse,L$,$$,B$],"html"),Qk=R$([D$,Ise,L$,$$,B$],"svg");function Kse(e){return e.join(" ").trim()}var xu={},Gw,eP;function Gse(){if(eP)return Gw;eP=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
97
|
+
`),re=[];let ee=[],Ee=0;const Te=()=>{if(ee.length===0)return;const ne=ee.join(" ").trim();ne&&re.push(s.jsx("p",{className:re.length>0?"mt-2.5":"",children:w1(ne,Y)},Ee++)),ee=[]};for(const ne of V){const he=ne.trim();if(/^[-\u2013\u2014]{3,}$/.test(he)){Te(),re.push(s.jsx("hr",{className:"border-zinc-800/60 my-3"},Ee++));continue}const je=he.match(/^(#{1,3})\s+(\S.*)$/);if(je){Te();const me=je[1].length,et=je[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s]+/u,"").trim()||je[2],Ie=me===1?"text-[13px] font-semibold text-zinc-100 mt-4 mb-1":me===2?"text-xs font-semibold text-zinc-200 mt-3 mb-0.5":"text-xs font-medium text-zinc-300 mt-2";re.push(s.jsx("p",{className:Ie,children:w1(et,Y)},Ee++));continue}if(he===""){Te();continue}ee.push(he)}return Te(),re};return s.jsx(N$,{open:!0,onOpenChange:V=>{V||n()},children:s.jsxs(k$,{children:[s.jsx(Uk,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"}),s.jsxs(qk,{className:"evidence-modal","aria-describedby":void 0,children:[s.jsxs("div",{className:"evidence-modal-header",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"eyebrow eyebrow-soft",children:[t.project.name," ","·"," ",z.provider||"All providers"]}),s.jsx(Fk,{className:"text-lg font-semibold text-zinc-50 truncate",children:e.query})]}),s.jsxs(A$,{className:"inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-800 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 shrink-0",children:[s.jsx(wc,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]}),E&&s.jsxs("div",{className:"evidence-modal-timeline",children:[s.jsx("p",{className:"drawer-section-label mb-1.5",children:"Run history"}),s.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1",children:k.map((V,re)=>{const ee=c===-1&&re===k.length-1||c===re,Ee=V.visibilityState??(V.answerMentioned?"visible":"not-visible"),Te=V.visibilityTransition??Ee,ne=Ee==="visible"?"bg-emerald-400":Te==="emerging"?"bg-amber-400":Te==="lost"?"bg-rose-400":"bg-zinc-600",je=new Date(V.createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),me=!!(V.model&&re>0&&k[re-1]?.model&&k[re-1].model!==V.model);return s.jsxs("button",{type:"button",className:`evidence-run-dot ${ee?"evidence-run-dot--selected":""}`,onClick:()=>ue(re===k.length-1?-1:re),"aria-label":[`Run ${je}: ${Ee}`,V.model?`model ${V.model}`:null,me?"model changed":null].filter(Boolean).join(" — "),"aria-pressed":ee,children:[s.jsx("span",{className:`size-2 rounded-full ${ne} ${me?"ring-1 ring-amber-300/80 ring-offset-2 ring-offset-zinc-950":""}`,"aria-hidden":"true"}),s.jsx("span",{className:"text-[10px] text-zinc-500",children:je})]},re)})}),c>=0&&c<k.length&&s.jsxs("p",{className:"text-[11px] text-zinc-500 mt-1",children:["Viewing run from ",new Date(k[c].createdAt).toLocaleString()," ","—"," ",s.jsx("span",{className:"capitalize",children:k[c].visibilityState??(k[c].answerMentioned?"visible":"not-visible")}),s.jsxs("button",{type:"button",className:"text-zinc-400 hover:text-zinc-200 ml-2",onClick:()=>ue(-1),children:["←"," Back to latest"]})]}),!O&&(e.modelTransitions?.length??0)>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.modelTransitions.map(V=>s.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-1 text-[10px] text-amber-100",children:`${V.fromModel??"unknown"} -> ${V.toModel??"unknown"} on ${new Date(V.createdAt).toLocaleDateString()}`},`${V.runId}:${V.toModel??"unknown"}`))})]}),s.jsxs("div",{className:"evidence-modal-body",children:[m&&s.jsxs("div",{className:"md:col-span-2 flex items-center justify-center py-12 text-zinc-500 text-sm",children:["Loading historical run data","…"]}),!m&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"evidence-modal-main",children:[s.jsxs("div",{className:`evidence-position-hero evidence-position-hero--${H}`,children:[s.jsx("p",{className:`evidence-position-label evidence-position-label--${H}`,children:I.label}),s.jsx("p",{className:`evidence-position-title evidence-position-title--${H}`,children:I.title}),s.jsx("p",{className:"evidence-position-meta",children:I.meta}),q&&s.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:q})]}),z.answerSnippet&&s.jsxs("div",{children:[s.jsx("p",{className:"drawer-section-label",children:"What the AI said"}),s.jsx("div",{className:`answer-snippet-block ${r?"evidence-answer-expanded":"evidence-answer-collapsed"}`,children:D()}),z.answerSnippet.length>280&&s.jsx("button",{type:"button",className:"mt-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",onClick:()=>i(!r),children:r?"↑ Collapse":"↓ Show full answer"})]}),!z.answerSnippet&&!m&&s.jsx("div",{className:"rounded-lg border border-zinc-800/40 bg-zinc-900/20 px-4 py-8 text-center text-zinc-600 text-sm",children:"No answer text recorded for this run"}),!O&&e.relatedTechnicalSignals.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"drawer-section-label",children:$?"Why you're visible":"What to fix"}),s.jsx("div",{className:"action-items-list",children:e.relatedTechnicalSignals.map((V,re)=>s.jsxs("div",{className:"action-item",children:[s.jsx("svg",{className:`action-item-icon ${$?"text-emerald-400":"text-amber-400"}`,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:$?s.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M8 5v3.5M8 10.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),s.jsx("span",{className:"action-item-text",children:V})]},re))})]}),z.summary&&s.jsx("p",{className:"text-xs text-zinc-600 border-t border-zinc-800/40 pt-3 mt-1",children:z.summary})]}),s.jsxs("div",{className:"evidence-modal-sidebar",children:[(F||M)&&s.jsxs("div",{className:"sidebar-tabs",children:[s.jsx("button",{className:`sidebar-tab ${a==="mentions"?"sidebar-tab--active":""}`,onClick:()=>l("mentions"),type:"button",title:"Canonry's answer-level visibility assessment and any company names extracted from the answer text.",children:"Mentions"}),s.jsx("button",{className:`sidebar-tab ${a==="sources"?"sidebar-tab--active":""}`,onClick:()=>l("sources"),type:"button",title:"Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.",children:"Sources"})]}),a==="mentions"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsx("span",{children:"Mention in answer"}),s.jsx(Wn,{text:"Canonry scans the AI answer for your owned domains and project name. This is independent from grounding or citation sources."})]}),s.jsxs("div",{className:`mention-status mention-status--${$?"mentioned":"not-mentioned"}`,children:[s.jsx("span",{className:"mention-status-icon",children:R?"…":$?"✓":"—"}),s.jsx("span",{className:"mention-status-label",children:R?"Pending":$?"Mentioned":"Not mentioned"})]}),z.matchedTerms.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Matched in answer"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:z.matchedTerms.map(V=>s.jsx("span",{className:"mention-chip mention-chip--brand",children:V},V))})]}),!R&&!$&&z.matchedTerms.length===0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1.5",children:"Searched for"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.map(V=>s.jsx("span",{className:"mention-chip mention-chip--muted",children:V},V))}),s.jsx("p",{className:"text-[11px] text-zinc-600 mt-1.5",children:"None of these appear in the answer text."})]})]}),(z.recommendedCompetitors.length>0||z.competitorDomains.length>0)&&s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsx("span",{children:"Competitors in answer"}),s.jsx(Wn,{text:"Competitors detected in the answer text or cited source links. Includes both tracked competitors and names extracted by Canonry."})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{const V=z.competitorDomains.map(Ee=>Ee.replace(/^www\./,"")),re=new Set(V.map(Ee=>hy(Ee.replace(/\.[^.]+$/,""))));return[...z.recommendedCompetitors.filter(Ee=>!re.has(hy(Ee))),...V].map(Ee=>s.jsx("span",{className:"mention-chip mention-chip--competitor",children:Ee},Ee))})()})]})]}),a==="sources"&&s.jsxs(s.Fragment,{children:[z.citedDomains.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsx("span",{children:"Domains from source links"}),s.jsx(Wn,{text:"These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them."})]}),s.jsx("div",{className:"citation-leaderboard",children:z.citedDomains.map((V,re)=>{const ee=V.toLowerCase().replace(/^www\./,""),Ee=j.has(ee),Te=!Ee&&z.competitorDomains.some(he=>he.toLowerCase().replace(/^www\./,"")===ee),ne=Ee?"you":Te?"competitor":"other";return s.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${ne}`,children:[s.jsxs("span",{className:"citation-leaderboard-rank",children:["#",re+1]}),s.jsx("span",{className:"citation-leaderboard-domain",children:V}),Ee&&s.jsx("span",{className:"citation-leaderboard-tag",children:"You"}),Te&&s.jsx("span",{className:"citation-leaderboard-tag",children:"Competitor"})]},V)})})]}),z.groundingSources.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"drawer-section-label flex items-center",children:[s.jsxs("span",{children:["Grounding source links (",z.groundingSources.length,")"]}),s.jsx(Wn,{text:"Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility."})]}),s.jsx("ul",{className:"grid gap-0.5",children:z.groundingSources.map((V,re)=>s.jsx("li",{className:"truncate text-sm",children:s.jsx("a",{href:V.uri,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:V.title||V.uri})},re))})]}),z.evidenceUrls.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"drawer-section-label",children:"Evidence URLs"}),s.jsx("ul",{className:"grid gap-1",children:z.evidenceUrls.map(V=>s.jsx("li",{className:"truncate text-sm",children:s.jsx("a",{href:V,target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:V})},V))})]}),z.citedDomains.length===0&&z.groundingSources.length===0&&z.evidenceUrls.length===0&&s.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No source data ",O?"for this run":"yet"]})]}),!F&&!M&&s.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No answer visibility data ",O?"for this run":"yet"]})]})]})]})]})]})})}function ha(e){const t=new Date("2026-02-20");return e.map((n,r)=>({runId:`run_mock_${r+1}`,citationState:n,createdAt:new Date(t.getTime()+r*2*24*60*60*1e3).toISOString()}))}const Hw=[{id:"project_citypoint",name:"Citypoint Dental NYC",canonicalDomain:"citypointdental.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["local intent","priority"],labels:{},locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_harbor",name:"Harbor Legal Group",canonicalDomain:"harborlegal.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["lead gen"],labels:{},locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1},{id:"project_northstar",name:"Northstar Orthopedics",canonicalDomain:"northstarortho.com",ownedDomains:[],aliases:[],country:"US",language:"en",tags:["multi-location"],labels:{},locations:[],defaultLocation:null,autoExtractBacklinks:!1,configSource:"cli",configRevision:1}];function Gv(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??"manual",createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel}}const Qae=Gv({id:"run_citypoint_visibility_20260308",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T12:15:00.000Z",startedAt:"Mar 8, 12:15 PM",duration:"6m 12s",statusDetail:"18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.",summary:"Citation losses on emergency-intent prompts",triggerLabel:"Scheduled"}),Yae=Gv({id:"run_citypoint_queued_20260309",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"queued",createdAt:"2026-03-09T08:05:00.000Z",startedAt:"Mar 9, 8:05 AM",duration:"Waiting for slot",statusDetail:"Ready to enqueue after the next provider rate window clears.",summary:"Queued follow-up after local ranking movement",triggerLabel:"Manual"}),Wae=Gv({id:"run_harbor_visibility_20260308",projectId:"project_harbor",projectName:"Harbor Legal Group",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T11:05:00.000Z",startedAt:"Mar 8, 11:05 AM",duration:"5m 07s",statusDetail:"12 tracked queries checked; local-intent visibility held steady across branded prompts.",summary:"Branded prompts remain stable",triggerLabel:"Scheduled"}),Zae=Gv({id:"run_northstar_visibility_20260308",projectId:"project_northstar",projectName:"Northstar Orthopedics",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"running",createdAt:"2026-03-08T13:40:00.000Z",startedAt:"Mar 8, 1:40 PM",duration:"3m 10s",statusDetail:"Provider responses still in flight for 9 multi-location prompts.",summary:"Mid-run on treatment-location prompts",triggerLabel:"Manual"}),Xae=[{id:"evidence_citypoint_emergency_gemini",query:"emergency dentist brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"lost",changeLabel:"Lost since Mar 5",answerSnippet:"For urgent dental care in Brooklyn, Downtown Smiles and Harbor Dental are now cited first for emergency availability and same-day booking.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:["https://downtownsmiles.com/emergency-dentist-brooklyn","https://harbordental.com/same-day-emergency-care"],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing on the emergency service page","llms.txt not found during latest site audit","Location pages link weakly into the emergency care hub"],summary:"AI answers now cite two competitors while your emergency page is no longer grounded.",runHistory:ha(["cited","cited","cited","cited","cited","cited","cited","not-cited","not-cited"])},{id:"evidence_citypoint_emergency_openai",query:"emergency dentist brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"Cited for 6 runs",answerSnippet:"Citypoint Dental is listed as a top emergency dentist in Brooklyn for same-day appointments and walk-in availability.",citedDomains:["citypointdental.com","downtownsmiles.com"],evidenceUrls:["https://citypointdental.com/emergency-dentist-brooklyn"],competitorDomains:["downtownsmiles.com"],groundingSources:[],relatedTechnicalSignals:["Emergency page indexed with structured data"],summary:"OpenAI cites your emergency page consistently alongside one competitor.",runHistory:ha(["not-cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_emergency_claude",query:"emergency dentist brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"Based on the search results, top-rated emergency dental practices in Brooklyn include Downtown Smiles and Harbor Dental.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:[],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing","llms.txt not found"],summary:"Claude does not cite your domain for this emergency query.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_invisalign_openai",query:"best invisalign dentist downtown brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"emerging",changeLabel:"First citation in 7 days",answerSnippet:"Citypoint Dental appears as an emerging recommendation for Invisalign in Downtown Brooklyn, supported by recent before-and-after case pages.",citedDomains:["citypointdental.com","clearlineortho.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn","https://citypointdental.com/case-studies/invisalign-open-bite"],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["Structured data now present on two case-study pages","Internal links from service pages to case studies improved crawl depth"],summary:"Fresh case-study content is starting to earn citations on Invisalign prompts.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","cited"])},{id:"evidence_citypoint_invisalign_gemini",query:"best invisalign dentist downtown brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"cited",changeLabel:"Cited for 8 runs",answerSnippet:"Citypoint Dental in Downtown Brooklyn is highlighted for its Invisalign expertise and patient outcomes.",citedDomains:["citypointdental.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn"],competitorDomains:[],groundingSources:[],relatedTechnicalSignals:["Case study pages well-indexed"],summary:"Gemini consistently cites your Invisalign page with no competitor overlap.",runHistory:ha(["cited","cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_invisalign_claude",query:"best invisalign dentist downtown brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For Invisalign in Downtown Brooklyn, Clear Line Ortho and Brooklyn Smiles are frequently recommended for their experienced orthodontists.",citedDomains:["clearlineortho.com","brooklynsmiles.com"],evidenceUrls:[],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["No before/after schema on case study pages"],summary:"Claude does not surface your Invisalign content despite strong page quality.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_claude",query:"pediatric dentist brooklyn heights",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 4 runs",answerSnippet:"Answers cite neighborhood-specific pediatric practices with stronger family-focused FAQ content and clearer insurance details.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:["https://brightkidsdental.com/pediatric-dentist-brooklyn-heights","https://parkpediatricdental.com/insurance"],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric service page exists for Brooklyn Heights","Insurance content is buried three clicks deep"],summary:"Coverage gap is content-driven, not purely technical.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_gemini",query:"pediatric dentist brooklyn heights",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For pediatric dentistry in Brooklyn Heights, Bright Kids Dental and Park Pediatric Dental are cited for family-friendly care.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:[],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric page for Brooklyn Heights"],summary:"Gemini does not surface your domain for pediatric queries in this area.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_openai",query:"pediatric dentist brooklyn heights",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"First citation this month",answerSnippet:"Citypoint Dental is mentioned as offering pediatric services in Brooklyn, though specialized pediatric-only practices are also highlighted.",citedDomains:["citypointdental.com","brightkidsdental.com"],evidenceUrls:["https://citypointdental.com/family-dentistry"],competitorDomains:["brightkidsdental.com"],groundingSources:[],relatedTechnicalSignals:["Family dentistry page recently updated"],summary:"OpenAI recently started citing your family dentistry page for this query.",runHistory:ha(["not-cited","not-cited","not-cited","not-cited","not-cited","cited"])}];Hw[0],Hw[1],ha(["cited","cited","cited","cited","cited"]),Hw[2],2/7,3/7,ha(["not-cited","not-cited","not-cited","cited"]);function Jae(e,t){return e.projects.find(n=>n.project.id===t)}function ese(e,t){return e.runs.find(n=>n.id===t)}function tse(e,t){for(const n of e.projects){const r=n.visibilityEvidence.find(i=>i.id===t);if(r)return{project:n,evidence:r}}}const nse={regression:"negative",gain:"positive",opportunity:"caution","first-citation":"positive","provider-pickup":"positive","persistent-gap":"caution","competitor-gained":"negative","competitor-lost":"neutral"},rse={opportunity:"write","persistent-gap":"write","competitor-gained":"write","competitor-lost":"write",regression:"investigate",gain:"monitor","first-citation":"monitor","provider-pickup":"monitor"},ise={regression:"lost",gain:"emerging",opportunity:"not-cited","first-citation":"emerging","provider-pickup":"emerging","persistent-gap":"not-cited","competitor-gained":"cited","competitor-lost":"not-cited"},ase={regression:"Regression",gain:"Gain",opportunity:"Opportunity","first-citation":"First citation","provider-pickup":"Pickup","persistent-gap":"Gap","competitor-gained":"Competitor","competitor-lost":"Competitor"};function sse(e){return{id:e.id,tone:nse[e.type],title:e.title,detail:e.cause?.details??e.cause?.cause??"",actionLabel:e.recommendation?.action??ase[e.type],actionGroup:rse[e.type],affectedPhrases:[{query:e.query,evidenceId:"",provider:e.provider,citationState:ise[e.type]}]}}function ose(e){return e.filter(t=>!t.dismissed).map(sse)}function z$(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],aliases:e.aliases??[],country:e.country,language:e.language,tags:e.tags,labels:e.labels,locations:e.locations??[],defaultLocation:e.defaultLocation??null,autoExtractBacklinks:e.autoExtractBacklinks??!1,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function GT(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return e}}function lse(e,t){if(!e)return"Waiting";if(!t)return"Running";const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return"<1s";const r=Math.floor(n/1e3);if(r<60)return`${r}s`;const i=Math.floor(r/60),a=r%60;return`${i}m ${a}s`}function _$(e){switch(e){case vt["answer-visibility"]:return"Answer visibility sweep";case vt["gsc-sync"]:return"GSC sync";case vt["inspect-sitemap"]:return"Sitemap inspection";case vt["ga-sync"]:return"GA sync";case vt["traffic-sync"]:return"Traffic sync";case vt["bing-inspect"]:return"Bing URL inspection";case vt["bing-inspect-sitemap"]:return"Bing sitemap inspection";case vt["site-audit"]:return"Site audit";case vt["backlink-extract"]:return"Backlink extract";case vt["aeo-discover-seed"]:return"Discovery (seed phase)";case vt["aeo-discover-probe"]:return"Discovery (probe phase)"}}function cse(e){return e===uh.manual?"Manual":e===uh.scheduled?"Scheduled":e===uh["config-apply"]?"Config apply":e}function Gk(e,t){return{id:e.id,projectId:e.projectId,projectName:t,kind:e.kind,kindLabel:_$(e.kind),status:e.status,trigger:e.trigger??"manual",location:e.location??null,createdAt:e.createdAt,startedAt:e.startedAt?GT(e.startedAt):GT(e.createdAt),duration:lse(e.startedAt,e.finishedAt),statusDetail:e.error?T$(e.error):use(e),summary:dse(e),triggerLabel:cse(e.trigger)}}function T$(e){const t=Nk(e);return t.length>200?t.slice(0,200)+"…":t}function use(e){switch(e.status){case xr.queued:return"Waiting for execution slot.";case xr.running:return"Provider queries in progress.";case xr.completed:return"All queries checked.";case xr.partial:return"Run completed with some queries skipped.";case xr.failed:return e.error?T$(e.error):"Run failed.";case xr.cancelled:return"Run was cancelled.";default:return""}}function dse(e){const t=_$(e.kind);switch(e.status){case xr.queued:return`${t} queued`;case xr.running:return`${t} in progress`;case xr.completed:return`${t} completed`;case xr.partial:return`${t} partially completed`;case xr.failed:return`${t} failed`;case xr.cancelled:return`${t} cancelled`;default:return e.status}}function fse(e,t,n,r){const i=[];let a=0;const l=new Set;if(n.length>0){const c=n.flatMap(w=>w.snapshots),d=new Map;for(const w of c)if(w.query){const b=`${w.query}::${w.provider}::${w.location??""}`;d.set(b,w)}const f=new Set(c.map(w=>w.location??null));f.size===0&&f.add(null);const p=new Set(c.map(w=>w.provider)),m=new Set(t.flatMap(w=>Object.keys(w.providerRuns??{}))),y=[...new Set([...p,...m])].sort(),v=y.length>0?y:["gemini"];for(const w of t){if(w.runs.length===0)continue;l.add(w.query);const b=w.runs.at(-1),j=b?.transition??"not-cited";for(const k of v){const E=[...f].filter(_=>d.has(`${w.query}::${k}::${_??""}`)),A=(w.providerRuns?.[k]?.length??0)>0,C=E.length>0?E:A?[null]:[];for(const _ of C){const O=_??"",z=d.get(`${w.query}::${k}::${O}`),R=z?.model??null,$=R?`${k}:${R}`:null,F=w.providerRuns?.[k],M=$?w.modelRuns?.[$]:void 0,U=he=>he?.filter(je=>(je.location??null)===_),K=E.length>0?U(F):F,Z=E.length>0?U(M):M,Y=(K?.length?K:null)??(Z?.length?Z:null),H=K?.length?"provider":Z?.length?"model":"query",X=Y?Y.at(-1).transition:j,ue=Y?Y.at(-1).visibilityTransition??(Y.at(-1).visibilityState==="visible"?"visible":"not-visible"):b?.visibilityTransition??(b?.visibilityState==="visible"?"visible":"not-visible"),xe=Y?.at(-1)?.citationState,L=Y?.at(-1)?.visibilityState,q=z?X==="lost"?"lost":X==="emerging"?"emerging":z.citationState===Eh.cited?"cited":"not-cited":xe===Eh.cited?"cited":"not-cited",I=z?.visibilityState??(L==="visible"?"visible":L==="pending"?"pending":"not-visible"),D=VT(Y||w.runs),V=QT(Y||w.runs),re=hse(w,k),ee=(Y??w.runs).map(he=>({runId:he.runId,citationState:he.citationState,createdAt:he.createdAt,model:re.get(he.runId)??null,answerMentioned:he.answerMentioned,visibilityState:he.visibilityState,visibilityTransition:he.visibilityTransition,mentionState:he.mentionState,mentionTransition:he.mentionTransition})),Ee=pse(ee),Te=H==="provider"&&Ee.length<=1?"model":H,ne=mse(ee);i.push({id:`evidence_${e}_${a++}`,query:w.query,provider:z?.provider??k,model:z?.model??null,location:z?.location??_,citationState:q,answerMentioned:z?.answerMentioned,visibilityState:I,visibilityChangeLabel:YT(ue,V,{positive:"visible",negative:"not visible",first:"first visibility"}),changeLabel:YT(X,D),answerSnippet:z?.answerText??"",citedDomains:z?.citedDomains??[],evidenceUrls:[],competitorDomains:z?.competitorOverlap??[],recommendedCompetitors:z?.recommendedCompetitors??[],matchedTerms:z?.matchedTerms??[],relatedTechnicalSignals:[],groundingSources:z?.groundingSources??[],summary:gse(I,ue,w.query),runHistory:ee,historyScope:Te,modelsSeen:Ee,modelTransitions:ne})}}}}for(const c of r)l.has(c.query)||i.push({id:`evidence_${e}_${a++}`,query:c.query,provider:"",model:null,location:null,citationState:"pending",visibilityState:"pending",visibilityChangeLabel:"Awaiting first run",changeLabel:"Awaiting first run",answerSnippet:"",citedDomains:[],evidenceUrls:[],competitorDomains:[],recommendedCompetitors:[],matchedTerms:[],relatedTechnicalSignals:[],groundingSources:[],summary:`"${c.query}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:"query",modelsSeen:[],modelTransitions:[]});return i}function hse(e,t){const n=new Map,r=`${t}:`;for(const[i,a]of Object.entries(e.modelRuns??{})){if(!i.startsWith(r))continue;const l=i.slice(r.length),c=l==="unknown"?null:l;for(const d of a)n.set(d.runId,c)}return n}function pse(e){const t=new Set;for(const n of e)n.model&&t.add(n.model);return[...t]}function mse(e){const t=[];let n=null;for(const r of e){const i=r.model??null;i!==n&&n!==null&&t.push({runId:r.runId,createdAt:r.createdAt,fromModel:n,toModel:i}),n=i}return t}function VT(e){if(e.length===0)return 0;const t=e[e.length-1].citationState;let n=0;for(let r=e.length-1;r>=0&&e[r].citationState===t;r--)n++;return n}function QT(e){if(e.length===0)return 0;const t=e[e.length-1].visibilityState??"not-visible";let n=0;for(let r=e.length-1;r>=0&&(e[r].visibilityState??"not-visible")===t;r--)n++;return n}function YT(e,t,n){const r={positive:n?.positive??"cited",negative:n?.negative??"not cited",first:n?.first??"first citation"};switch(e){case"new":return"First observation";case"cited":case"visible":return t<=1?`${Lf(r.positive)} in latest run`:`${Lf(r.positive)} for ${t} runs`;case"lost":return"Lost since last run";case"emerging":return Lf(r.first);case"not-cited":case"not-visible":return t<=1?`${Lf(r.negative)} in latest run`:`${Lf(r.negative)} across ${t} runs`;default:return e}}function Lf(e){return e.charAt(0).toUpperCase()+e.slice(1)}function gse(e,t,n){switch(t){case"lost":return`Mention was lost for "${n}". Your brand no longer appeared in the latest answer.`;case"emerging":return`Your brand started appearing in AI answers for "${n}".`}switch(e){case"visible":return`Your brand or domain is mentioned in AI answers for "${n}".`;case"pending":return`"${n}" has been added but no run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${n}".`}}function yse(e){const t=z$(e.project),n=fse(t.name,e.timeline,e.latestRunDetails,e.queries),i=[...e.runs].sort((a,l)=>l.createdAt.localeCompare(a.createdAt)).map(a=>Gk(a,e.project.displayName||e.project.name));return e.overview?vse(t,e.overview,n,i):xse(t,n,i)}function vse(e,t,n,r){const i=ose(t.topInsights);for(const a of t.attentionItems)a.id.startsWith("insight_")||i.push({id:a.id,tone:a.tone,title:a.title,detail:a.detail,actionLabel:a.actionLabel,actionGroup:"investigate",affectedPhrases:[]});return{project:e,dateRangeLabel:t.dateRangeLabel,contextLabel:t.contextLabel,mentionSummary:t.scores.mention,visibilitySummary:t.scores.visibility,mentionShareSummary:t.scores.mentionShare,queryCounts:{cited:t.queryCounts.citedQueries,total:t.queryCounts.totalQueries},gapQueries:t.scores.gapQueries,mentionGaps:t.scores.mentionGaps,indexCoverage:t.scores.indexCoverage,providerScores:t.providerScores,competitorPressure:t.scores.competitorPressure,runStatus:t.scores.runStatus,movementSummary:t.movementSummary,insights:i,visibilityEvidence:n,competitors:t.competitors.map(a=>({id:a.id,domain:a.domain,citationCount:a.citationCount,totalQueries:a.totalQueries,pressureLabel:a.pressureLabel,citedQueries:a.citedQueries,movement:"",notes:""})),recentRuns:r.slice(0,5),suggestedQueries:t.suggestedQueries}}function xse(e,t,n){const r={label:"",value:"No data",delta:"Loading…",tone:"neutral",description:"",tooltip:"",trend:[]};return{project:e,dateRangeLabel:"All time",contextLabel:`${e.country} / ${e.language.toUpperCase()}`,mentionSummary:{...r,label:"Mention Coverage"},visibilitySummary:{...r,label:"Citation Coverage"},mentionShareSummary:{...r,label:"Mention Share",breakdown:{projectMentionSnapshots:0,competitorMentionSnapshots:0,perCompetitor:[],snapshotsWithAnswerText:0,snapshotsTotal:0}},queryCounts:{cited:0,total:0},gapQueries:{...r,label:"Citation Gaps"},mentionGaps:{...r,label:"Mention Gaps"},indexCoverage:{...r,label:"Index Coverage"},providerScores:[],competitorPressure:{...r,label:"Competitor Pressure"},runStatus:{...r,label:"Run Status"},movementSummary:{gained:0,lost:0,tone:"neutral",hasPreviousRun:!1},insights:[],visibilityEvidence:t,competitors:[],recentRuns:n.slice(0,5),suggestedQueries:{rows:[],totalCandidates:0,skippedAlreadyTracked:0}}}function bse(e){const t=z$(e.project),n=[...e.runs].sort((y,v)=>v.createdAt.localeCompare(y.createdAt)),r=n.find(y=>y.kind===vt["answer-visibility"])??n[0],i=e.project.displayName||e.project.name,a=r?Gk(r,i):wse(e.project.id,i),l=e.overview;if(!l)return{project:t,visibilityScore:0,visibilityDelta:"No data",visibilityTone:"neutral",lastRun:a,insight:"No runs completed yet.",trend:[],competitorPressureLabel:"None"};const c=l.scores.visibility,d=c.progress??0,f=l.queryCounts.citedQueries,p=l.queryCounts.totalQueries,m=l.providers.length;return{project:t,visibilityScore:d,visibilityDelta:p>0?`${f} of ${p} queries`:"No data",visibilityTone:c.tone,providerCoverage:c.providerCoverage,lastRun:a,insight:p>0?`${f} of ${p} queries mentioned across ${m} provider${m===1?"":"s"}.`:"No runs completed yet.",trend:[],competitorPressureLabel:l.scores.competitorPressure.value}}function wse(e,t){return{id:"none",projectId:e,projectName:t,kind:vt["answer-visibility"],kindLabel:"No runs yet",status:xr.queued,trigger:uh.manual,createdAt:"",startedAt:"",duration:"",statusDetail:"",summary:"No runs yet",triggerLabel:""}}function Sse(e,t){const n=[],r=[],i=[];for(const l of e){r.push(yse(l)),i.push(bse(l));const c=[...l.runs].sort((d,f)=>f.createdAt.localeCompare(d.createdAt));for(const d of c)n.push(Gk(d,l.project.displayName||l.project.name))}n.sort((l,c)=>c.createdAt.localeCompare(l.createdAt));const a=e.length>0;return{portfolioOverview:{projects:i,attentionItems:a?jse(r):[{id:"attention_setup",tone:"neutral",title:"No projects yet",detail:"Create your first project using the setup wizard, CLI, or API.",actionLabel:"Open setup",href:"/setup"}],recentRuns:n.slice(0,5),systemHealth:[{id:"api",label:"API",tone:"positive",detail:"Connected",meta:"Real-time data"},{id:"provider",label:"Gemini",tone:"positive",detail:"Configured",meta:"Provider active"}],lastUpdatedAt:new Date().toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),...a?{}:{emptyState:{title:"No projects yet",detail:"Canonry becomes useful after one project, a small query set, and one competitor list are in place.",ctaLabel:"Launch setup",ctaHref:"/setup"}}},projects:r,runs:n,setup:{healthChecks:[{id:"api",label:"API reachable",detail:"API is responding.",state:"ready",guidance:"Required for project creation and run history."},{id:"provider",label:"Provider configured",detail:"Gemini key is configured.",state:"ready",guidance:"Required for answer-visibility sweeps."}],projectDraft:{name:"",canonicalDomain:"",country:"US",language:"en"},queryImportState:{mode:"paste",queryCount:0,preview:[]},competitorDraft:{domains:[],notes:"Use the CLI to add competitors."},launchState:{enabled:a,ctaLabel:a?"Trigger run":"Create a project first",summary:a?"Ready to run.":"Create a project first to launch a run."}},settings:{providerStatuses:(t?.providers??[]).map(l=>({name:l.name,displayName:l.displayName,keyUrl:l.keyUrl,modelHint:l.modelHint,model:l.model,state:l.configured?"ready":"needs-config",detail:l.configured?"Provider is configured.":"API key is missing.",quota:l.quota})),google:{state:t?.google?.configured?"ready":"needs-config",detail:t?.google?.configured?"Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.":"Google OAuth client ID and client secret are not configured yet."},bing:{state:t?.bing?.configured?"ready":"needs-config",detail:t?.bing?.configured?"Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.":"Bing Webmaster Tools API key is not configured yet."},selfHostNotes:["Configuration is stored in ~/.canonry/config.yaml.","The local config file is the source of truth for authentication credentials.","Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.","Database is SQLite at ~/.canonry/data.db.","API key was auto-generated during canonry init."],bootstrapNote:"Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config."}}}function jse(e){const t=[];for(const n of e){const r=n.visibilityEvidence.filter(a=>a.citationState==="lost");r.length>0&&t.push({id:`attention_${n.project.id}_lost`,tone:"negative",title:`${n.project.displayName||n.project.name} lost citations`,detail:`${r.length} quer${r.length>1?"ies":"y"} lost citation.`,actionLabel:"Open project",href:`/projects/${n.project.id}`});const i=n.recentRuns.filter(a=>a.status===xr.running||a.status===xr.queued);i.length>0&&t.push({id:`attention_${n.project.id}_active`,tone:"neutral",title:`${n.project.displayName||n.project.name} has active runs`,detail:`${i.length} run${i.length>1?"s":""} in progress.`,actionLabel:"View runs",href:"/runs"})}return t.length===0&&t.push({id:"attention_stable",tone:"positive",title:"All projects stable",detail:"No citation losses or active runs to flag.",actionLabel:"View portfolio",href:"/"}),t}const _e={projects:{all:["projects"],detail:(e,t)=>["projects",e,t],queries:e=>["projects",e,"queries"],competitors:e=>["projects",e,"competitors"],timeline:(e,t)=>["projects",e,"timeline",t]},runs:{all:["runs"],detail:e=>["runs",e]},settings:["settings"],health:["health"],gsc:{project:e=>["gsc",e],connections:e=>["gsc",e,"connections"],properties:e=>["gsc",e,"properties"],performance:(e,t)=>["gsc",e,"performance",t],performanceDaily:(e,t)=>["gsc",e,"performance-daily",t],inspections:(e,t)=>["gsc",e,"inspections",t],deindexed:e=>["gsc",e,"deindexed"],coverage:e=>["gsc",e,"coverage"],coverageHistory:e=>["gsc",e,"coverage-history"],sitemaps:e=>["gsc",e,"sitemaps"]},bing:{project:e=>["bing",e],status:e=>["bing",e,"status"],coverage:e=>["bing",e,"coverage"],inspections:e=>["bing",e,"inspections"],performance:e=>["bing",e,"performance"],sites:e=>["bing",e,"sites"]},schedule:e=>["schedule",e],notifications:e=>["notifications",e],agent:{providers:e=>["agent",e,"providers"]},discovery:{project:e=>["discovery",e],sessions:e=>["discovery",e,"sessions"],session:(e,t)=>["discovery",e,"sessions",t],promotePreview:(e,t)=>["discovery",e,"sessions",t,"promote-preview"]},citationVisibility:e=>["citation-visibility",e],report:e=>["report",e],traffic:{project:e=>["traffic",e],status:e=>["traffic",e,"status"],summary:(e,t)=>["traffic",e,"summary",t],aiHistory:(e,t)=>["traffic",e,"ai-history",t],sessionHistory:(e,t)=>["traffic",e,"session-history",t],socialHistory:(e,t)=>["traffic",e,"social-history",t]},serverTraffic:{all:["server-traffic"],project:e=>["server-traffic",e],sources:e=>["server-traffic",e,"sources"],status:e=>["server-traffic",e,"status"],sourceDetail:(e,t)=>["server-traffic",e,"sources",t],events:(e,t)=>["server-traffic",e,"events",t]}},P$=x.createContext(null);P$.Provider;function tp(){return x.useContext(P$)}function kc(e){const n=tp()?.dashboard??null,r=Bn({queryKey:_e.projects.all,queryFn:zv,enabled:!n}),i=Bn({queryKey:_e.runs.all,queryFn:Z5,enabled:!n,staleTime:u1,refetchInterval:w=>w.state.data?.some(k=>k.status==="running"||k.status==="queued")?3e3:u1}),a=Bn({queryKey:_e.settings,queryFn:()=>dk().catch(()=>null),enabled:!n}),l=r.data??[],c=i.data??[],d=C5({queries:l.map(w=>{const b=c.filter(O=>O.projectId===w.id),j=b.filter(O=>(O.status==="completed"||O.status==="partial")&&O.kind==="answer-visibility").sort((O,z)=>z.createdAt.localeCompare(O.createdAt)),k=j[0]?.createdAt??null,E=k?j.filter(O=>O.createdAt===k).map(O=>O.id):[],A=j.find(O=>O.createdAt!==k)?.createdAt??null,C=A?j.filter(O=>O.createdAt===A).map(O=>O.id):[],_=[...E].sort().join(",");return{queryKey:_e.projects.detail(w.id,_||void 0),queryFn:async()=>{const[O,z,R,$,F,M,U,K,Z]=await Promise.all([OV(w.name).catch(()=>[]),X5(w.name).catch(()=>[]),J5(w.name).catch(()=>[]),E.length?Promise.all(E.map(Y=>Ko(Y).catch(()=>null))).then(Y=>Y.filter(H=>H!=null)):Promise.resolve([]),C.length?Promise.all(C.map(Y=>Ko(Y).catch(()=>null))).then(Y=>Y.filter(H=>H!=null)):Promise.resolve([]),fk(w.name).catch(()=>null),hk(w.name).catch(()=>null),UQ(w.name).catch(()=>null),zV(w.name).catch(()=>null)]);return{project:w,runs:b,queries:O,competitors:z,timeline:R,latestRunDetails:$,previousRunDetails:F,gscCoverage:M,bingCoverage:U,dbInsights:K,overview:Z}},enabled:!n&&r.isSuccess&&i.isSuccess,staleTime:f4}})}),f=d.every(w=>w.isSuccess),p=x.useMemo(()=>{if(n)return n;if(!r.data||!i.data||l.length>0&&!f)return null;const w=d.map(b=>b.data?{...b.data,runs:c.filter(j=>j.projectId===b.data.project.id)}:null).filter(b=>b!=null);return Sse(w,a.data??null)},[n,r.data,i.data,a.data,f,d,l.length,c]),m=!n&&(r.isError||i.isError),y=!n&&!p&&!m,v=x.useCallback(async()=>{await Promise.all([r.refetch(),i.refetch(),a.refetch()])},[r.refetch,i.refetch,a.refetch]);return{dashboard:p,isLoading:y,isError:m,refetch:v}}async function Nse(){const e=await HQ("/health","API"),t=e.state==="ok"?{label:"Worker",state:"ok",detail:"In-process job runner"}:{label:"Worker",state:e.state,detail:`Depends on API health check · ${e.detail}`,statusCode:e.statusCode,hint:e.hint?`Worker status is inferred from API health in this deployment mode. ${e.hint}`:"Worker status is inferred from API health in this deployment mode."};return{apiStatus:e,workerStatus:t}}function Vv(e,t){return Bn({queryKey:_e.health,queryFn:Nse,enabled:e,refetchInterval:15e3,initialData:t})}function kse(e){return Bn({queryKey:_e.runs.detail(e??""),queryFn:()=>Ko(e),enabled:!!e,refetchInterval:t=>{const n=t.state.data?.status;return n==="running"||n==="queued"?3e3:!1}})}function jd(){const e=Jo(),t=Ov({strict:!1}),n=oi({select:d=>d.location.pathname}),r=t.runId??null,i=t.evidenceId??null;return{runId:r,evidenceId:i,openRun:d=>e({to:n,from:ci.to,search:f=>({...f,runId:d,evidenceId:void 0})}),openEvidence:d=>e({to:n,from:ci.to,search:f=>({...f,evidenceId:d,runId:void 0})}),closeDrawer:()=>e({to:n,from:ci.to,search:d=>({...d,runId:void 0,evidenceId:void 0})})}}const Cse={negative:"toast-card-negative",caution:"toast-card-caution",positive:"toast-card-positive",neutral:"toast-card-neutral"};function Ase(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function Ese(){const e=x.useSyncExternalStore(oY,K2,K2),t=Jo(),{openRun:n}=jd(),r=x.useCallback(a=>{c1(a)},[]),i=x.useCallback(a=>{a.cta&&(a.cta.intent==="open-run-drawer"?n(a.cta.runId):t({to:"/runs"}),c1(a.id))},[t,n]);return e.length===0?null:s.jsx("div",{className:"toast-viewport","aria-label":"Notifications",children:e.map(a=>s.jsxs("section",{role:a.tone==="negative"?"alert":"status","aria-live":a.tone==="negative"?"assertive":"polite","data-state":a.state,className:`toast-card ${Cse[a.tone]}`,children:[s.jsxs("div",{className:"toast-copy",children:[s.jsx("p",{className:"toast-title",children:a.title}),a.detail?s.jsx("p",{className:"toast-detail",children:a.detail}):null,a.cta?s.jsx("button",{type:"button",className:"toast-action",onClick:()=>i(a),"aria-label":Ase(a),children:a.cta.label}):null]}),s.jsx("button",{type:"button",onClick:()=>r(a.id),className:"toast-dismiss","aria-label":"Dismiss",children:s.jsx(wc,{className:"size-3.5"})})]},a.id))})}function Ose(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const zse=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_se=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tse={};function WT(e,t){return(Tse.jsx?_se:zse).test(e)}const Pse=/[ \t\n\f\r]/g;function Rse(e){return typeof e=="object"?e.type==="text"?ZT(e.value):!1:ZT(e)}function ZT(e){return e.replace(Pse,"")===""}let np=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};np.prototype.normal={};np.prototype.property={};np.prototype.space=void 0;function R$(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new np(n,r,t)}function S1(e){return e.toLowerCase()}class di{constructor(t,n){this.attribute=n,this.property=t}}di.prototype.attribute="";di.prototype.booleanish=!1;di.prototype.boolean=!1;di.prototype.commaOrSpaceSeparated=!1;di.prototype.commaSeparated=!1;di.prototype.defined=!1;di.prototype.mustUseProperty=!1;di.prototype.number=!1;di.prototype.overloadedBoolean=!1;di.prototype.property="";di.prototype.spaceSeparated=!1;di.prototype.space=void 0;let Dse=0;const gt=Cc(),$n=Cc(),j1=Cc(),Oe=Cc(),Xt=Cc(),Gu=Cc(),wi=Cc();function Cc(){return 2**++Dse}const N1=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:$n,commaOrSpaceSeparated:wi,commaSeparated:Gu,number:Oe,overloadedBoolean:j1,spaceSeparated:Xt},Symbol.toStringTag,{value:"Module"})),Kw=Object.keys(N1);class Vk extends di{constructor(t,n,r,i){let a=-1;if(super(t,n),XT(this,"space",i),typeof r=="number")for(;++a<Kw.length;){const l=Kw[a];XT(this,Kw[a],(r&N1[l])===N1[l])}}}Vk.prototype.defined=!0;function XT(e,t,n){n&&(e[t]=n)}function Nd(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new Vk(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[S1(r)]=r,n[S1(a.attribute)]=r}return new np(t,n,e.space)}const D$=Nd({properties:{ariaActiveDescendant:null,ariaAtomic:$n,ariaAutoComplete:null,ariaBusy:$n,ariaChecked:$n,ariaColCount:Oe,ariaColIndex:Oe,ariaColSpan:Oe,ariaControls:Xt,ariaCurrent:null,ariaDescribedBy:Xt,ariaDetails:null,ariaDisabled:$n,ariaDropEffect:Xt,ariaErrorMessage:null,ariaExpanded:$n,ariaFlowTo:Xt,ariaGrabbed:$n,ariaHasPopup:null,ariaHidden:$n,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xt,ariaLevel:Oe,ariaLive:null,ariaModal:$n,ariaMultiLine:$n,ariaMultiSelectable:$n,ariaOrientation:null,ariaOwns:Xt,ariaPlaceholder:null,ariaPosInSet:Oe,ariaPressed:$n,ariaReadOnly:$n,ariaRelevant:null,ariaRequired:$n,ariaRoleDescription:Xt,ariaRowCount:Oe,ariaRowIndex:Oe,ariaRowSpan:Oe,ariaSelected:$n,ariaSetSize:Oe,ariaSort:null,ariaValueMax:Oe,ariaValueMin:Oe,ariaValueNow:Oe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function M$(e,t){return t in e?e[t]:t}function I$(e,t){return M$(e,t.toLowerCase())}const Mse=Nd({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Gu,acceptCharset:Xt,accessKey:Xt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Xt,autoFocus:gt,autoPlay:gt,blocking:Xt,capture:null,charSet:null,checked:gt,cite:null,className:Xt,cols:Oe,colSpan:null,content:null,contentEditable:$n,controls:gt,controlsList:Xt,coords:Oe|Gu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:j1,draggable:$n,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Xt,height:Oe,hidden:j1,high:Oe,href:null,hrefLang:null,htmlFor:Xt,httpEquiv:Xt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Xt,itemRef:Xt,itemScope:gt,itemType:Xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:Oe,manifest:null,max:null,maxLength:Oe,media:null,method:null,min:null,minLength:Oe,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:Oe,pattern:null,ping:Xt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Xt,required:gt,reversed:gt,rows:Oe,rowSpan:Oe,sandbox:Xt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:Oe,sizes:null,slot:null,span:Oe,spellCheck:$n,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Oe,step:null,style:null,tabIndex:Oe,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:$n,width:Oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xt,axis:null,background:null,bgColor:null,border:Oe,borderColor:null,bottomMargin:Oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:Oe,leftMargin:Oe,link:null,longDesc:null,lowSrc:null,marginHeight:Oe,marginWidth:Oe,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:Oe,rules:null,scheme:null,scrolling:$n,standby:null,summary:null,text:null,topMargin:Oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:Oe,security:null,unselectable:null},space:"html",transform:I$}),Ise=Nd({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:wi,accentHeight:Oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Oe,amplitude:Oe,arabicForm:null,ascent:Oe,attributeName:null,attributeType:null,azimuth:Oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Oe,by:null,calcMode:null,capHeight:Oe,className:Xt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Oe,diffuseConstant:Oe,direction:null,display:null,dur:null,divisor:Oe,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Oe,enableBackground:null,end:null,event:null,exponent:Oe,externalResourcesRequired:null,fill:null,fillOpacity:Oe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Gu,g2:Gu,glyphName:Gu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Oe,horizOriginX:Oe,horizOriginY:Oe,id:null,ideographic:Oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Oe,k:Oe,k1:Oe,k2:Oe,k3:Oe,k4:Oe,kernelMatrix:wi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Oe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Oe,overlineThickness:Oe,paintOrder:null,panose1:null,path:null,pathLength:Oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Oe,pointsAtY:Oe,pointsAtZ:Oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wi,rev:wi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wi,requiredFeatures:wi,requiredFonts:wi,requiredFormats:wi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Oe,specularExponent:Oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Oe,strikethroughThickness:Oe,string:null,stroke:null,strokeDashArray:wi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Oe,strokeOpacity:Oe,strokeWidth:null,style:null,surfaceScale:Oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wi,tabIndex:Oe,tableValues:null,target:null,targetX:Oe,targetY:Oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Oe,underlineThickness:Oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Oe,values:null,vAlphabetic:Oe,vMathematical:Oe,vectorEffect:null,vHanging:Oe,vIdeographic:Oe,version:null,vertAdvY:Oe,vertOriginX:Oe,vertOriginY:Oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:M$}),L$=Nd({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$$=Nd({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:I$}),B$=Nd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Lse={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$se=/[A-Z]/g,JT=/-[a-z]/g,Bse=/^data[-\w.:]+$/i;function Use(e,t){const n=S1(t);let r=t,i=di;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Bse.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(JT,Fse);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!JT.test(a)){let l=a.replace($se,qse);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Vk}return new i(r,t)}function qse(e){return"-"+e.toLowerCase()}function Fse(e){return e.charAt(1).toUpperCase()}const Hse=R$([D$,Mse,L$,$$,B$],"html"),Qk=R$([D$,Ise,L$,$$,B$],"svg");function Kse(e){return e.join(" ").trim()}var xu={},Gw,eP;function Gse(){if(eP)return Gw;eP=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
98
98
|
`,f="/",p="*",m="",y="comment",v="declaration";function w(j,k){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];k=k||{};var E=1,A=1;function C(Z){var Y=Z.match(t);Y&&(E+=Y.length);var H=Z.lastIndexOf(d);A=~H?Z.length-H:A+Z.length}function _(){var Z={line:E,column:A};return function(Y){return Y.position=new O(Z),$(),Y}}function O(Z){this.start=Z,this.end={line:E,column:A},this.source=k.source}O.prototype.content=j;function z(Z){var Y=new Error(k.source+":"+E+":"+A+": "+Z);if(Y.reason=Z,Y.filename=k.source,Y.line=E,Y.column=A,Y.source=j,!k.silent)throw Y}function R(Z){var Y=Z.exec(j);if(Y){var H=Y[0];return C(H),j=j.slice(H.length),Y}}function $(){R(n)}function F(Z){var Y;for(Z=Z||[];Y=M();)Y!==!1&&Z.push(Y);return Z}function M(){var Z=_();if(!(f!=j.charAt(0)||p!=j.charAt(1))){for(var Y=2;m!=j.charAt(Y)&&(p!=j.charAt(Y)||f!=j.charAt(Y+1));)++Y;if(Y+=2,m===j.charAt(Y-1))return z("End of comment missing");var H=j.slice(2,Y-2);return A+=2,C(H),j=j.slice(Y),A+=2,Z({type:y,comment:H})}}function U(){var Z=_(),Y=R(r);if(Y){if(M(),!R(i))return z("property missing ':'");var H=R(a),X=Z({type:v,property:b(Y[0].replace(e,m)),value:H?b(H[0].replace(e,m)):m});return R(l),X}}function K(){var Z=[];F(Z);for(var Y;Y=U();)Y!==!1&&(Z.push(Y),F(Z));return Z}return $(),K()}function b(j){return j?j.replace(c,m):m}return Gw=w,Gw}var tP;function Vse(){if(tP)return xu;tP=1;var e=xu&&xu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xu,"__esModule",{value:!0}),xu.default=n;const t=e(Gse());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),c=typeof i=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;c?i(f,p,d):p&&(a=a||{},a[f]=p)}),a}return xu}var $f={},nP;function Qse(){if(nP)return $f;nP=1,Object.defineProperty($f,"__esModule",{value:!0}),$f.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(f){return!f||n.test(f)||e.test(f)},l=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),a(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(i,c):f=f.replace(r,c),f.replace(t,l))};return $f.camelCase=d,$f}var Bf,rP;function Yse(){if(rP)return Bf;rP=1;var e=Bf&&Bf.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(Vse()),n=Qse();function r(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(c,d){c&&d&&(l[(0,n.camelCase)(c,a)]=d)}),l}return r.default=r,Bf=r,Bf}var Wse=Yse();const Zse=wa(Wse),U$=q$("end"),Yk=q$("start");function q$(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Xse(e){const t=Yk(e),n=U$(e);if(t&&n)return{start:t,end:n}}function dh(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?iP(e.position):"start"in e||"end"in e?iP(e):"line"in e||"column"in e?k1(e):""}function k1(e){return aP(e&&e.line)+":"+aP(e&&e.column)}function iP(e){return k1(e&&e.start)+"-"+k1(e&&e.end)}function aP(e){return e&&typeof e=="number"?e:1}class Or extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=dh(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Or.prototype.file="";Or.prototype.name="";Or.prototype.reason="";Or.prototype.message="";Or.prototype.stack="";Or.prototype.column=void 0;Or.prototype.line=void 0;Or.prototype.ancestors=void 0;Or.prototype.cause=void 0;Or.prototype.fatal=void 0;Or.prototype.place=void 0;Or.prototype.ruleId=void 0;Or.prototype.source=void 0;const Wk={}.hasOwnProperty,Jse=new Map,eoe=/[A-Z]/g,toe=new Set(["table","tbody","thead","tfoot","tr"]),noe=new Set(["td","th"]),F$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function roe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=doe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=uoe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Qk:Hse,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=H$(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function H$(e,t,n){if(t.type==="element")return ioe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return aoe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ooe(e,t,n);if(t.type==="mdxjsEsm")return soe(e,t);if(t.type==="root")return loe(e,t,n);if(t.type==="text")return coe(e,t)}function ioe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Qk,e.schema=i),e.ancestors.push(t);const a=G$(e,t.tagName,!1),l=foe(e,t);let c=Xk(e,t);return toe.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Rse(d):!0})),K$(e,l,a,t),Zk(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function aoe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_h(e,t.position)}function soe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_h(e,t.position)}function ooe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Qk,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:G$(e,t.name,!0),l=hoe(e,t),c=Xk(e,t);return K$(e,l,a,t),Zk(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function loe(e,t,n){const r={};return Zk(r,Xk(e,t)),e.create(t,e.Fragment,r,n)}function coe(e,t){return t.value}function K$(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Zk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function uoe(e,t,n){return r;function r(i,a,l,c){const f=Array.isArray(l.children)?n:t;return c?f(a,l,c):f(a,l)}}function doe(e,t){return n;function n(r,i,a,l){const c=Array.isArray(a.children),d=Yk(r);return t(i,a,l,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function foe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Wk.call(t.properties,i)){const a=poe(e,i,t.properties[i]);if(a){const[l,c]=a;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&noe.has(t.tagName)?r=c:n[l]=c}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function hoe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else _h(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,a=e.evaluater.evaluateExpression(c.expression)}else _h(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Xk(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Jse;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const f=i.get(d)||0;l=d+"-"+f,i.set(d,f+1)}}const c=H$(e,a,l);c!==void 0&&n.push(c)}return n}function poe(e,t,n){const r=Use(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ose(n):Kse(n)),r.property==="style"){let i=typeof n=="object"?n:moe(e,String(n));return e.stylePropertyNameCase==="css"&&(i=goe(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Lse[r.property]||r.property:r.attribute,n]}}function moe(e,t){try{return Zse(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Or("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=F$+"#cannot-parse-style-attribute",i}}function G$(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,l;for(;++a<i.length;){const c=WT(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(a&&c.type==="Literal"),optional:!1}:c}r=l}else r=WT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Wk.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);_h(e)}function _h(e,t){const n=new Or("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=F$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function goe(e){const t={};let n;for(n in e)Wk.call(e,n)&&(t[yoe(n)]=e[n]);return t}function yoe(e){let t=e.replace(eoe,voe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function voe(e){return"-"+e.toLowerCase()}const Vw={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},xoe={};function boe(e,t){const n=xoe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return V$(e,r,i)}function V$(e,t,n){if(woe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return sP(e.children,t,n)}return Array.isArray(e)?sP(e,t,n):""}function sP(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=V$(e[i],t,n);return r.join("")}function woe(e){return!!(e&&typeof e=="object")}const oP=document.createElement("i");function Jk(e){const t="&"+e+";";oP.innerHTML=t;const n=oP.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Fa(e,t,n,r){const i=e.length;let a=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Fi(e,t){return e.length>0?(Fa(e,e.length,0,t),e):t}const lP={}.hasOwnProperty;function Soe(e){const t={};let n=-1;for(;++n<e.length;)joe(t,e[n]);return t}function joe(e,t){let n;for(n in t){const i=(lP.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){lP.call(i,l)||(i[l]=[]);const c=a[l];Noe(i[l],Array.isArray(c)?c:c?[c]:[])}}}function Noe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Fa(e,0,0,r)}function Q$(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Vu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ia=rl(/[A-Za-z]/),ji=rl(/[\dA-Za-z]/),koe=rl(/[#-'*+\--9=?A-Z^-~]/);function C1(e){return e!==null&&(e<32||e===127)}const A1=rl(/\d/),Coe=rl(/[\dA-Fa-f]/),Aoe=rl(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function li(e){return e!==null&&(e<0||e===32)}function It(e){return e===-2||e===-1||e===32}const Eoe=rl(new RegExp("\\p{P}|\\p{S}","u")),Ooe=rl(/\s/);function rl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function kd(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&ji(e.charCodeAt(n+1))&&ji(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(l=String.fromCharCode(a,c),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function en(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(d){return It(d)?(e.enter(n),c(d)):t(d)}function c(d){return It(d)&&a++<i?(e.consume(d),c):(e.exit(n),t(d))}}const zoe={tokenize:_oe};function _oe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),en(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),a(c)}function a(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return at(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),l)}}const Toe={tokenize:Poe},cP={tokenize:Roe};function Poe(e){const t=this,n=[];let r=0,i,a,l;return c;function c(A){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,d,f)(A)}return f(A)}function d(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const C=t.events.length;let _=C,O;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){O=t.events[_][1].end;break}k(r);let z=C;for(;z<t.events.length;)t.events[z][1].end={...O},z++;return Fa(t.events,_+1,0,t.events.slice(C)),t.events.length=z,f(A)}return c(A)}function f(A){if(r===n.length){if(!i)return y(A);if(i.currentConstruct&&i.currentConstruct.concrete)return w(A);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(cP,p,m)(A)}function p(A){return i&&E(),k(r),y(A)}function m(A){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,w(A)}function y(A){return t.containerState={},e.attempt(cP,v,w)(A)}function v(A){return r++,n.push([t.currentConstruct,t.containerState]),y(A)}function w(A){if(A===null){i&&E(),k(0),e.consume(A);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),b(A)}function b(A){if(A===null){j(e.exit("chunkFlow"),!0),k(0),e.consume(A);return}return at(A)?(e.consume(A),j(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(A),b)}function j(A,C){const _=t.sliceStream(A);if(C&&_.push(null),A.previous=a,a&&(a.next=A),a=A,i.defineSkip(A.start),i.write(_),t.parser.lazy[A.start.line]){let O=i.events.length;for(;O--;)if(i.events[O][1].start.offset<l&&(!i.events[O][1].end||i.events[O][1].end.offset>l))return;const z=t.events.length;let R=z,$,F;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if($){F=t.events[R][1].end;break}$=!0}for(k(r),O=z;O<t.events.length;)t.events[O][1].end={...F},O++;Fa(t.events,R+1,0,t.events.slice(z)),t.events.length=O}}function k(A){let C=n.length;for(;C-- >A;){const _=n[C];t.containerState=_[1],_[0].exit.call(t,e)}n.length=A}function E(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Roe(e,t,n){return en(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function uP(e){if(e===null||li(e)||Ooe(e))return 1;if(Eoe(e))return 2}function eC(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const E1={name:"attention",resolveAll:Doe,tokenize:Moe};function Doe(e,t){let n=-1,r,i,a,l,c,d,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},y={...e[n][1].start};dP(m,-d),dP(y,d),l={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},a={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Fi(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Fi(f,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),f=Fi(f,eC(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Fi(f,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=Fi(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Fa(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Moe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=uP(r);let a;return l;function l(d){return a=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===a)return e.consume(d),c;const f=e.exit("attentionSequence"),p=uP(d),m=!p||p===2&&i||n.includes(d),y=!i||i===2&&p||n.includes(r);return f._open=!!(a===42?m:m&&(i||!y)),f._close=!!(a===42?y:y&&(p||!m)),t(d)}}function dP(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ioe={name:"autolink",tokenize:Loe};function Loe(e,t,n){let r=0;return i;function i(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(v){return Ia(v)?(e.consume(v),l):v===64?n(v):f(v)}function l(v){return v===43||v===45||v===46||ji(v)?(r=1,c(v)):f(v)}function c(v){return v===58?(e.consume(v),r=0,d):(v===43||v===45||v===46||ji(v))&&r++<32?(e.consume(v),c):(r=0,f(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||C1(v)?n(v):(e.consume(v),d)}function f(v){return v===64?(e.consume(v),p):koe(v)?(e.consume(v),f):n(v)}function p(v){return ji(v)?m(v):n(v)}function m(v){return v===46?(e.consume(v),r=0,p):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):y(v)}function y(v){if((v===45||ji(v))&&r++<63){const w=v===45?y:m;return e.consume(v),w}return n(v)}}const Qv={partial:!0,tokenize:$oe};function $oe(e,t,n){return r;function r(a){return It(a)?en(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||at(a)?t(a):n(a)}}const Y$={continuation:{tokenize:Uoe},exit:qoe,name:"blockQuote",tokenize:Boe};function Boe(e,t,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return It(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function Uoe(e,t,n){const r=this;return i;function i(l){return It(l)?en(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(Y$,t,n)(l)}}function qoe(e){e.exit("blockQuote")}const W$={name:"characterEscape",tokenize:Foe};function Foe(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Aoe(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Z$={name:"characterReference",tokenize:Hoe};function Hoe(e,t,n){const r=this;let i=0,a,l;return c;function c(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),a=31,l=ji,p(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=Coe,p):(e.enter("characterReferenceValue"),a=7,l=A1,p(m))}function p(m){if(m===59&&i){const y=e.exit("characterReferenceValue");return l===ji&&!Jk(r.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(m)&&i++<a?(e.consume(m),p):n(m)}}const fP={partial:!0,tokenize:Goe},hP={concrete:!0,name:"codeFenced",tokenize:Koe};function Koe(e,t,n){const r=this,i={partial:!0,tokenize:_};let a=0,l=0,c;return d;function d(O){return f(O)}function f(O){const z=r.events[r.events.length-1];return a=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,c=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===c?(l++,e.consume(O),p):l<3?n(O):(e.exit("codeFencedFenceSequence"),It(O)?en(e,m,"whitespace")(O):m(O))}function m(O){return O===null||at(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(fP,b,C)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(O))}function y(O){return O===null||at(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(O)):It(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),en(e,v,"whitespace")(O)):O===96&&O===c?n(O):(e.consume(O),y)}function v(O){return O===null||at(O)?m(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(O))}function w(O){return O===null||at(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(O)):O===96&&O===c?n(O):(e.consume(O),w)}function b(O){return e.attempt(i,C,j)(O)}function j(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),k}function k(O){return a>0&&It(O)?en(e,E,"linePrefix",a+1)(O):E(O)}function E(O){return O===null||at(O)?e.check(fP,b,C)(O):(e.enter("codeFlowValue"),A(O))}function A(O){return O===null||at(O)?(e.exit("codeFlowValue"),E(O)):(e.consume(O),A)}function C(O){return e.exit("codeFenced"),t(O)}function _(O,z,R){let $=0;return F;function F(Y){return O.enter("lineEnding"),O.consume(Y),O.exit("lineEnding"),M}function M(Y){return O.enter("codeFencedFence"),It(Y)?en(O,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):U(Y)}function U(Y){return Y===c?(O.enter("codeFencedFenceSequence"),K(Y)):R(Y)}function K(Y){return Y===c?($++,O.consume(Y),K):$>=l?(O.exit("codeFencedFenceSequence"),It(Y)?en(O,Z,"whitespace")(Y):Z(Y)):R(Y)}function Z(Y){return Y===null||at(Y)?(O.exit("codeFencedFence"),z(Y)):R(Y)}}}function Goe(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Qw={name:"codeIndented",tokenize:Qoe},Voe={partial:!0,tokenize:Yoe};function Qoe(e,t,n){const r=this;return i;function i(f){return e.enter("codeIndented"),en(e,a,"linePrefix",5)(f)}function a(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?d(f):at(f)?e.attempt(Voe,l,d)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||at(f)?(e.exit("codeFlowValue"),l(f)):(e.consume(f),c)}function d(f){return e.exit("codeIndented"),t(f)}}function Yoe(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):at(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):en(e,a,"linePrefix",5)(l)}function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):at(l)?i(l):n(l)}}const Woe={name:"codeText",previous:Xoe,resolve:Zoe,tokenize:Joe};function Zoe(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Xoe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Joe(e,t,n){let r=0,i,a;return l;function l(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),r++,c):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(a=e.enter("codeTextSequence"),i=0,p(m)):at(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||at(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),f)}function p(m){return m===96?(e.consume(m),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(a.type="codeTextData",f(m))}}class ele{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Uf(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Uf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Uf(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Uf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Uf(this.left,n.reverse())}}}function Uf(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function X$(e){const t={};let n=-1,r,i,a,l,c,d,f;const p=new ele(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,tle(p,n)),n=t[n],f=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(l=p.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return Fa(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function tle(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,d=[],f={};let p,m,y=-1,v=n,w=0,b=0;const j=[b];for(;v;){for(;e.get(++i)[1]!==v;);a.push(i),v._tokenizer||(p=r.sliceStream(v),v.next||p.push(null),m&&l.defineSkip(v.start),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),m=v,v=v.next}for(v=n;++y<c.length;)c[y][0]==="exit"&&c[y-1][0]==="enter"&&c[y][1].type===c[y-1][1].type&&c[y][1].start.line!==c[y][1].end.line&&(b=y+1,j.push(b),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(l.events=[],v?(v._tokenizer=void 0,v.previous=void 0):j.pop(),y=j.length;y--;){const k=c.slice(j[y],j[y+1]),E=a.pop();d.push([E,E+k.length-1]),e.splice(E,2,k)}for(d.reverse(),y=-1;++y<d.length;)f[w+d[y][0]]=w+d[y][1],w+=d[y][1]-d[y][0]-1;return f}const nle={resolve:ile,tokenize:ale},rle={partial:!0,tokenize:sle};function ile(e){return X$(e),e}function ale(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?a(c):at(c)?e.check(rle,l,a)(c):(e.consume(c),i)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function sle(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),en(e,a,"linePrefix")}function a(l){if(l===null||at(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function J$(e,t,n,r,i,a,l,c,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return m;function m(k){return k===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(k),e.exit(a),y):k===null||k===32||k===41||C1(k)?n(k):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),b(k))}function y(k){return k===62?(e.enter(a),e.consume(k),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===62?(e.exit("chunkString"),e.exit(c),y(k)):k===null||k===60||at(k)?n(k):(e.consume(k),k===92?w:v)}function w(k){return k===60||k===62||k===92?(e.consume(k),v):v(k)}function b(k){return!p&&(k===null||k===41||li(k))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(r),t(k)):p<f&&k===40?(e.consume(k),p++,b):k===41?(e.consume(k),p--,b):k===null||k===32||k===40||C1(k)?n(k):(e.consume(k),k===92?j:b)}function j(k){return k===40||k===41||k===92?(e.consume(k),b):b(k)}}function eB(e,t,n,r,i,a){const l=this;let c=0,d;return f;function f(v){return e.enter(r),e.enter(i),e.consume(v),e.exit(i),e.enter(a),p}function p(v){return c>999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(e.exit(a),e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):at(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===null||v===91||v===93||at(v)||c++>999?(e.exit("chunkString"),p(v)):(e.consume(v),d||(d=!It(v)),v===92?y:m)}function y(v){return v===91||v===92||v===93?(e.consume(v),c++,m):m(v)}}function tB(e,t,n,r,i,a){let l;return c;function c(y){return y===34||y===39||y===40?(e.enter(r),e.enter(i),e.consume(y),e.exit(i),l=y===40?41:y,d):n(y)}function d(y){return y===l?(e.enter(i),e.consume(y),e.exit(i),e.exit(r),t):(e.enter(a),f(y))}function f(y){return y===l?(e.exit(a),d(l)):y===null?n(y):at(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),en(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===l||y===null||at(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?m:p)}function m(y){return y===l||y===92?(e.consume(y),p):p(y)}}function fh(e,t){let n;return r;function r(i){return at(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):It(i)?en(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ole={name:"definition",tokenize:cle},lle={partial:!0,tokenize:ule};function cle(e,t,n){const r=this;let i;return a;function a(v){return e.enter("definition"),l(v)}function l(v){return eB.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return i=Vu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):n(v)}function d(v){return li(v)?fh(e,f)(v):f(v)}function f(v){return J$(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(lle,m,m)(v)}function m(v){return It(v)?en(e,y,"whitespace")(v):y(v)}function y(v){return v===null||at(v)?(e.exit("definition"),r.parser.defined.push(i),t(v)):n(v)}}function ule(e,t,n){return r;function r(c){return li(c)?fh(e,i)(c):n(c)}function i(c){return tB(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return It(c)?en(e,l,"whitespace")(c):l(c)}function l(c){return c===null||at(c)?t(c):n(c)}}const dle={name:"hardBreakEscape",tokenize:fle};function fle(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return at(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const hle={name:"headingAtx",resolve:ple,tokenize:mle};function ple(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Fa(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function mle(e,t,n){let r=0;return i;function i(p){return e.enter("atxHeading"),a(p)}function a(p){return e.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(e.consume(p),l):p===null||li(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||at(p)?(e.exit("atxHeading"),t(p)):It(p)?en(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||li(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const gle=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],pP=["pre","script","style","textarea"],yle={concrete:!0,name:"htmlFlow",resolveTo:ble,tokenize:wle},vle={partial:!0,tokenize:jle},xle={partial:!0,tokenize:Sle};function ble(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function wle(e,t,n){const r=this;let i,a,l,c,d;return f;function f(D){return p(D)}function p(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),m}function m(D){return D===33?(e.consume(D),y):D===47?(e.consume(D),a=!0,b):D===63?(e.consume(D),i=3,r.interrupt?t:L):Ia(D)?(e.consume(D),l=String.fromCharCode(D),j):n(D)}function y(D){return D===45?(e.consume(D),i=2,v):D===91?(e.consume(D),i=5,c=0,w):Ia(D)?(e.consume(D),i=4,r.interrupt?t:L):n(D)}function v(D){return D===45?(e.consume(D),r.interrupt?t:L):n(D)}function w(D){const V="CDATA[";return D===V.charCodeAt(c++)?(e.consume(D),c===V.length?r.interrupt?t:U:w):n(D)}function b(D){return Ia(D)?(e.consume(D),l=String.fromCharCode(D),j):n(D)}function j(D){if(D===null||D===47||D===62||li(D)){const V=D===47,re=l.toLowerCase();return!V&&!a&&pP.includes(re)?(i=1,r.interrupt?t(D):U(D)):gle.includes(l.toLowerCase())?(i=6,V?(e.consume(D),k):r.interrupt?t(D):U(D)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):a?E(D):A(D))}return D===45||ji(D)?(e.consume(D),l+=String.fromCharCode(D),j):n(D)}function k(D){return D===62?(e.consume(D),r.interrupt?t:U):n(D)}function E(D){return It(D)?(e.consume(D),E):F(D)}function A(D){return D===47?(e.consume(D),F):D===58||D===95||Ia(D)?(e.consume(D),C):It(D)?(e.consume(D),A):F(D)}function C(D){return D===45||D===46||D===58||D===95||ji(D)?(e.consume(D),C):_(D)}function _(D){return D===61?(e.consume(D),O):It(D)?(e.consume(D),_):A(D)}function O(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),d=D,z):It(D)?(e.consume(D),O):R(D)}function z(D){return D===d?(e.consume(D),d=null,$):D===null||at(D)?n(D):(e.consume(D),z)}function R(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||li(D)?_(D):(e.consume(D),R)}function $(D){return D===47||D===62||It(D)?A(D):n(D)}function F(D){return D===62?(e.consume(D),M):n(D)}function M(D){return D===null||at(D)?U(D):It(D)?(e.consume(D),M):n(D)}function U(D){return D===45&&i===2?(e.consume(D),H):D===60&&i===1?(e.consume(D),X):D===62&&i===4?(e.consume(D),q):D===63&&i===3?(e.consume(D),L):D===93&&i===5?(e.consume(D),xe):at(D)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(vle,I,K)(D)):D===null||at(D)?(e.exit("htmlFlowData"),K(D)):(e.consume(D),U)}function K(D){return e.check(xle,Z,I)(D)}function Z(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Y}function Y(D){return D===null||at(D)?K(D):(e.enter("htmlFlowData"),U(D))}function H(D){return D===45?(e.consume(D),L):U(D)}function X(D){return D===47?(e.consume(D),l="",ue):U(D)}function ue(D){if(D===62){const V=l.toLowerCase();return pP.includes(V)?(e.consume(D),q):U(D)}return Ia(D)&&l.length<8?(e.consume(D),l+=String.fromCharCode(D),ue):U(D)}function xe(D){return D===93?(e.consume(D),L):U(D)}function L(D){return D===62?(e.consume(D),q):D===45&&i===2?(e.consume(D),L):U(D)}function q(D){return D===null||at(D)?(e.exit("htmlFlowData"),I(D)):(e.consume(D),q)}function I(D){return e.exit("htmlFlow"),t(D)}}function Sle(e,t,n){const r=this;return i;function i(l){return at(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function jle(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Qv,t,n)}}const Nle={name:"htmlText",tokenize:kle};function kle(e,t,n){const r=this;let i,a,l;return c;function c(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),_):L===63?(e.consume(L),A):Ia(L)?(e.consume(L),R):n(L)}function f(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),a=0,w):Ia(L)?(e.consume(L),E):n(L)}function p(L){return L===45?(e.consume(L),v):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),y):at(L)?(l=m,X(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),v):m(L)}function v(L){return L===62?H(L):L===45?y(L):m(L)}function w(L){const q="CDATA[";return L===q.charCodeAt(a++)?(e.consume(L),a===q.length?b:w):n(L)}function b(L){return L===null?n(L):L===93?(e.consume(L),j):at(L)?(l=b,X(L)):(e.consume(L),b)}function j(L){return L===93?(e.consume(L),k):b(L)}function k(L){return L===62?H(L):L===93?(e.consume(L),k):b(L)}function E(L){return L===null||L===62?H(L):at(L)?(l=E,X(L)):(e.consume(L),E)}function A(L){return L===null?n(L):L===63?(e.consume(L),C):at(L)?(l=A,X(L)):(e.consume(L),A)}function C(L){return L===62?H(L):A(L)}function _(L){return Ia(L)?(e.consume(L),O):n(L)}function O(L){return L===45||ji(L)?(e.consume(L),O):z(L)}function z(L){return at(L)?(l=z,X(L)):It(L)?(e.consume(L),z):H(L)}function R(L){return L===45||ji(L)?(e.consume(L),R):L===47||L===62||li(L)?$(L):n(L)}function $(L){return L===47?(e.consume(L),H):L===58||L===95||Ia(L)?(e.consume(L),F):at(L)?(l=$,X(L)):It(L)?(e.consume(L),$):H(L)}function F(L){return L===45||L===46||L===58||L===95||ji(L)?(e.consume(L),F):M(L)}function M(L){return L===61?(e.consume(L),U):at(L)?(l=M,X(L)):It(L)?(e.consume(L),M):$(L)}function U(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),i=L,K):at(L)?(l=U,X(L)):It(L)?(e.consume(L),U):(e.consume(L),Z)}function K(L){return L===i?(e.consume(L),i=void 0,Y):L===null?n(L):at(L)?(l=K,X(L)):(e.consume(L),K)}function Z(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||li(L)?$(L):(e.consume(L),Z)}function Y(L){return L===47||L===62||li(L)?$(L):n(L)}function H(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),ue}function ue(L){return It(L)?en(e,xe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):xe(L)}function xe(L){return e.enter("htmlTextData"),l(L)}}const tC={name:"labelEnd",resolveAll:Ole,resolveTo:zle,tokenize:_le},Cle={tokenize:Tle},Ale={tokenize:Ple},Ele={tokenize:Rle};function Ole(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Fa(e,0,e.length,n),e}function zle(e,t){let n=e.length,r=0,i,a,l,c;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const d={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},p={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",d,t],["enter",f,t]],c=Fi(c,e.slice(a+1,a+r+3)),c=Fi(c,[["enter",p,t]]),c=Fi(c,eC(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),c=Fi(c,[["exit",p,t],e[l-2],e[l-1],["exit",f,t]]),c=Fi(c,e.slice(l+1)),c=Fi(c,[["exit",d,t]]),Fa(e,a,e.length,c),e}function _le(e,t,n){const r=this;let i=r.events.length,a,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return c;function c(y){return a?a._inactive?m(y):(l=r.parser.defined.includes(Vu(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),d):n(y)}function d(y){return y===40?e.attempt(Cle,p,l?p:m)(y):y===91?e.attempt(Ale,p,l?f:m)(y):l?p(y):m(y)}function f(y){return e.attempt(Ele,p,m)(y)}function p(y){return t(y)}function m(y){return a._balanced=!0,n(y)}}function Tle(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),i}function i(m){return li(m)?fh(e,a)(m):a(m)}function a(m){return m===41?p(m):J$(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return li(m)?fh(e,d)(m):p(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?tB(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function f(m){return li(m)?fh(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function Ple(e,t,n){const r=this;return i;function i(c){return eB.call(r,e,a,l,"reference","referenceMarker","referenceString")(c)}function a(c){return r.parser.defined.includes(Vu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function Rle(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const Dle={name:"labelStartImage",resolveAll:tC.resolveAll,tokenize:Mle};function Mle(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const Ile={name:"labelStartLink",resolveAll:tC.resolveAll,tokenize:Lle};function Lle(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Yw={name:"lineEnding",tokenize:$le};function $le(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),en(e,t,"linePrefix")}}const Lg={name:"thematicBreak",tokenize:Ble};function Ble(e,t,n){let r=0,i;return a;function a(f){return e.enter("thematicBreak"),l(f)}function l(f){return i=f,c(f)}function c(f){return f===i?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||at(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===i?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),It(f)?en(e,c,"whitespace")(f):c(f))}}const ni={continuation:{tokenize:Hle},exit:Gle,name:"list",tokenize:Fle},Ule={partial:!0,tokenize:Vle},qle={partial:!0,tokenize:Kle};function Fle(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(v){const w=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:A1(v)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Lg,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return n(v)}function d(v){return A1(v)&&++l<10?(e.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(Qv,r.interrupt?n:p,e.attempt(Ule,y,m))}function p(v){return r.containerState.initialBlankLine=!0,a++,y(v)}function m(v){return It(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):n(v)}function y(v){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function Hle(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Qv,i,a);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,en(e,t,"listItemIndent",r.containerState.size+1)(c)}function a(c){return r.containerState.furtherBlankLines||!It(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(qle,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,en(e,e.attempt(ni,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function Kle(e,t,n){const r=this;return en(e,i,"listItemIndent",r.containerState.size+1);function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function Gle(e){e.exit(this.containerState.type)}function Vle(e,t,n){const r=this;return en(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=r.events[r.events.length-1];return!It(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const mP={name:"setextUnderline",resolveTo:Qle,tokenize:Yle};function Qle(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function Yle(e,t,n){const r=this;let i;return a;function a(f){let p=r.events.length,m;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){m=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),i=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===i?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),It(f)?en(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||at(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const Wle={tokenize:Zle};function Zle(e){const t=this,n=e.attempt(Qv,r,e.attempt(this.parser.constructs.flowInitial,i,en(e,e.attempt(this.parser.constructs.flow,i,e.attempt(nle,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Xle={resolveAll:rB()},Jle=nB("string"),ece=nB("text");function nB(e){return{resolveAll:rB(e==="text"?tce:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,l,c);return l;function l(p){return f(p)?a(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),a(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const m=i[p];let y=-1;if(m)for(;++y<m.length;){const v=m[y];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function rB(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function tce(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,l=-1,c=0,d;for(;a--;){const f=i[a];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)d=!0,c++;else if(f!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const nce={42:ni,43:ni,45:ni,48:ni,49:ni,50:ni,51:ni,52:ni,53:ni,54:ni,55:ni,56:ni,57:ni,62:Y$},rce={91:ole},ice={[-2]:Qw,[-1]:Qw,32:Qw},ace={35:hle,42:Lg,45:[mP,Lg],60:yle,61:mP,95:Lg,96:hP,126:hP},sce={38:Z$,92:W$},oce={[-5]:Yw,[-4]:Yw,[-3]:Yw,33:Dle,38:Z$,42:E1,60:[Ioe,Nle],91:Ile,92:[dle,W$],93:tC,95:E1,96:Woe},lce={null:[E1,Xle]},cce={null:[42,95]},uce={null:[]},dce=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:cce,contentInitial:rce,disable:uce,document:nce,flow:ace,flowInitial:ice,insideSpan:lce,string:sce,text:oce},Symbol.toStringTag,{value:"Module"}));function fce(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let l=[],c=[];const d={attempt:z(_),check:z(O),consume:E,enter:A,exit:C,interrupt:z(O,{interrupt:!0})},f={code:null,containerState:{},defineSkip:b,events:[],now:w,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:m};let p=t.tokenize.call(f,d);return t.resolveAll&&a.push(t),f;function m(M){return l=Fi(l,M),j(),l[l.length-1]!==null?[]:(R(t,0),f.events=eC(a,f.events,f),f.events)}function y(M,U){return pce(v(M),U)}function v(M){return hce(l,M)}function w(){const{_bufferIndex:M,_index:U,line:K,column:Z,offset:Y}=r;return{_bufferIndex:M,_index:U,line:K,column:Z,offset:Y}}function b(M){i[M.line]=M.column,F()}function j(){let M;for(;r._index<l.length;){const U=l[r._index];if(typeof U=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<U.length;)k(U.charCodeAt(r._bufferIndex));else k(U)}}function k(M){p=p(M)}function E(M){at(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,F()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=M}function A(M,U){const K=U||{};return K.type=M,K.start=w(),f.events.push(["enter",K,f]),c.push(K),K}function C(M){const U=c.pop();return U.end=w(),f.events.push(["exit",U,f]),U}function _(M,U){R(M,U.from)}function O(M,U){U.restore()}function z(M,U){return K;function K(Z,Y,H){let X,ue,xe,L;return Array.isArray(Z)?I(Z):"tokenize"in Z?I([Z]):q(Z);function q(ee){return Ee;function Ee(Te){const ne=Te!==null&&ee[Te],he=Te!==null&&ee.null,je=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(he)?he:he?[he]:[]];return I(je)(Te)}}function I(ee){return X=ee,ue=0,ee.length===0?H:D(ee[ue])}function D(ee){return Ee;function Ee(Te){return L=$(),xe=ee,ee.partial||(f.currentConstruct=ee),ee.name&&f.parser.constructs.disable.null.includes(ee.name)?re():ee.tokenize.call(U?Object.assign(Object.create(f),U):f,d,V,re)(Te)}}function V(ee){return M(xe,L),Y}function re(ee){return L.restore(),++ue<X.length?D(X[ue]):H}}}function R(M,U){M.resolveAll&&!a.includes(M)&&a.push(M),M.resolve&&Fa(f.events,U,f.events.length-U,M.resolve(f.events.slice(U),f)),M.resolveTo&&(f.events=M.resolveTo(f.events,f))}function $(){const M=w(),U=f.previous,K=f.currentConstruct,Z=f.events.length,Y=Array.from(c);return{from:Z,restore:H};function H(){r=M,f.previous=U,f.currentConstruct=K,f.events.length=Z,c=Y,F()}}function F(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function hce(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,a)];else{if(l=e.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function pce(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
|
|
99
99
|
`;break}case-3:{l=`\r
|
|
100
100
|
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(a)}i=a===-2,r.push(l)}return r.join("")}function mce(e){const r={constructs:Soe([dce,...(e||{}).extensions||[]]),content:i(zoe),defined:[],document:i(Toe),flow:i(Wle),lazy:{},string:i(Jle),text:i(ece)};return r;function i(a){return l;function l(c){return fce(r,a,c)}}}function gce(e){for(;!X$(e););return e}const gP=/[\0\t\n\r]/g;function yce(){let e=1,t="",n=!0,r;return i;function i(a,l,c){const d=[];let f,p,m,y,v;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,t="",n&&(a.charCodeAt(0)===65279&&m++,n=void 0);m<a.length;){if(gP.lastIndex=m,f=gP.exec(a),y=f&&f.index!==void 0?f.index:a.length,v=a.charCodeAt(y),!f){t=a.slice(m);break}if(v===10&&m===y&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),m<y&&(d.push(a.slice(m,y)),e+=y-m),v){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}m=y+1}return c&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const vce=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xce(e){return e.replace(vce,bce)}function bce(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Q$(n.slice(a?2:1),a?16:10)}return Jk(n)||e}const iB={}.hasOwnProperty;function wce(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Sce(n)(gce(mce(n).document().write(yce()(e,t,!0))))}function Sce(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Re),autolinkProtocol:$,autolinkEmail:$,atxHeading:a(We),blockQuote:a(he),characterEscape:$,characterReference:$,codeFenced:a(je),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(je,l),codeText:a(me,l),codeTextData:$,data:$,codeFlowValue:$,definition:a(et),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(Ie),hardBreakEscape:a(tt),hardBreakTrailing:a(tt),htmlFlow:a(Yt,l),htmlFlowData:$,htmlText:a(Yt,l),htmlTextData:$,image:a(Se),label:l,link:a(Re),listItem:a(ln),listItemValue:y,listOrdered:a($t,m),listUnordered:a($t),paragraph:a(cn),reference:D,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(We),strong:a(Pr),thematicBreak:a(yt)},exit:{atxHeading:d(),atxHeadingSequence:_,autolink:d(),autolinkEmail:ne,autolinkProtocol:Te,blockQuote:d(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ee,characterReference:Ee,codeFenced:d(j),codeFencedFence:b,codeFencedFenceInfo:v,codeFencedFenceMeta:w,codeFlowValue:F,codeIndented:d(k),codeText:d(Y),codeTextData:F,data:F,definition:d(),definitionDestinationString:C,definitionLabelString:E,definitionTitleString:A,emphasis:d(),hardBreakEscape:d(U),hardBreakTrailing:d(U),htmlFlow:d(K),htmlFlowData:F,htmlText:d(Z),htmlTextData:F,image:d(X),label:xe,labelText:ue,lineEnding:M,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:V,resourceDestinationString:L,resourceTitleString:q,resource:I,setextHeading:d(R),setextHeadingLineSequence:z,setextHeadingText:O,strong:d(),thematicBreak:d()}};aB(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(de){let Ne={type:"root",children:[]};const Ue={stack:[Ne],tokenStack:[],config:t,enter:c,exit:f,buffer:l,resume:p,data:n},rt=[];let ot=-1;for(;++ot<de.length;)if(de[ot][1].type==="listOrdered"||de[ot][1].type==="listUnordered")if(de[ot][0]==="enter")rt.push(ot);else{const pn=rt.pop();ot=i(de,pn,ot)}for(ot=-1;++ot<de.length;){const pn=t[de[ot][0]];iB.call(pn,de[ot][1].type)&&pn[de[ot][1].type].call(Object.assign({sliceSerialize:de[ot][2].sliceSerialize},Ue),de[ot][1])}if(Ue.tokenStack.length>0){const pn=Ue.tokenStack[Ue.tokenStack.length-1];(pn[1]||yP).call(Ue,void 0,pn[0])}for(Ne.position={start:jo(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:jo(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},ot=-1;++ot<t.transforms.length;)Ne=t.transforms[ot](Ne)||Ne;return Ne}function i(de,Ne,Ue){let rt=Ne-1,ot=-1,pn=!1,Hn,ae,Fe,Ve;for(;++rt<=Ue;){const nt=de[rt];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?ot++:ot--,Ve=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(Hn&&!Ve&&!ot&&!Fe&&(Fe=rt),Ve=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ve=void 0}if(!ot&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||ot===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(Hn){let ht=rt;for(ae=void 0;ht--;){const bn=de[ht];if(bn[1].type==="lineEnding"||bn[1].type==="lineEndingBlank"){if(bn[0]==="exit")continue;ae&&(de[ae][1].type="lineEndingBlank",pn=!0),bn[1].type="lineEnding",ae=ht}else if(!(bn[1].type==="linePrefix"||bn[1].type==="blockQuotePrefix"||bn[1].type==="blockQuotePrefixWhitespace"||bn[1].type==="blockQuoteMarker"||bn[1].type==="listItemIndent"))break}Fe&&(!ae||Fe<ae)&&(Hn._spread=!0),Hn.end=Object.assign({},ae?de[ae][1].start:nt[1].end),de.splice(ae||rt,0,["exit",Hn,nt[2]]),rt++,Ue++}if(nt[1].type==="listItemPrefix"){const ht={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};Hn=ht,de.splice(rt,0,["enter",ht,nt[2]]),rt++,Ue++,Fe=void 0,Ve=!0}}}return de[Ne][1]._spread=pn,Ue}function a(de,Ne){return Ue;function Ue(rt){c.call(this,de(rt),rt),Ne&&Ne.call(this,rt)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(de,Ne,Ue){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([Ne,Ue||void 0]),de.position={start:jo(Ne.start),end:void 0}}function d(de){return Ne;function Ne(Ue){de&&de.call(this,Ue),f.call(this,Ue)}}function f(de,Ne){const Ue=this.stack.pop(),rt=this.tokenStack.pop();if(rt)rt[0].type!==de.type&&(Ne?Ne.call(this,de,rt[0]):(rt[1]||yP).call(this,de,rt[0]));else throw new Error("Cannot close `"+de.type+"` ("+dh({start:de.start,end:de.end})+"): it’s not open");Ue.position.end=jo(de.end)}function p(){return boe(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(de){if(this.data.expectingFirstListItemValue){const Ne=this.stack[this.stack.length-2];Ne.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function v(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.lang=de}function w(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.meta=de}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=de.replace(/(\r?\n|\r)$/g,"")}function E(de){const Ne=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=Ne,Ue.identifier=Vu(this.sliceSerialize(de)).toLowerCase()}function A(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.title=de}function C(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.url=de}function _(de){const Ne=this.stack[this.stack.length-1];if(!Ne.depth){const Ue=this.sliceSerialize(de).length;Ne.depth=Ue}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function z(de){const Ne=this.stack[this.stack.length-1];Ne.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function $(de){const Ue=this.stack[this.stack.length-1].children;let rt=Ue[Ue.length-1];(!rt||rt.type!=="text")&&(rt=Ht(),rt.position={start:jo(de.start),end:void 0},Ue.push(rt)),this.stack.push(rt)}function F(de){const Ne=this.stack.pop();Ne.value+=this.sliceSerialize(de),Ne.position.end=jo(de.end)}function M(de){const Ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=Ne.children[Ne.children.length-1];Ue.position.end=jo(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ne.type)&&($.call(this,de),F.call(this,de))}function U(){this.data.atHardBreak=!0}function K(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=de}function Z(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=de}function Y(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=de}function H(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=Ne,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function X(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=Ne,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function ue(de){const Ne=this.sliceSerialize(de),Ue=this.stack[this.stack.length-2];Ue.label=xce(Ne),Ue.identifier=Vu(Ne).toLowerCase()}function xe(){const de=this.stack[this.stack.length-1],Ne=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const rt=de.children;Ue.children=rt}else Ue.alt=Ne}function L(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.url=de}function q(){const de=this.resume(),Ne=this.stack[this.stack.length-1];Ne.title=de}function I(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function V(de){const Ne=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=Ne,Ue.identifier=Vu(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function re(de){this.data.characterReferenceType=de.type}function ee(de){const Ne=this.sliceSerialize(de),Ue=this.data.characterReferenceType;let rt;Ue?(rt=Q$(Ne,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):rt=Jk(Ne);const ot=this.stack[this.stack.length-1];ot.value+=rt}function Ee(de){const Ne=this.stack.pop();Ne.position.end=jo(de.end)}function Te(de){F.call(this,de);const Ne=this.stack[this.stack.length-1];Ne.url=this.sliceSerialize(de)}function ne(de){F.call(this,de);const Ne=this.stack[this.stack.length-1];Ne.url="mailto:"+this.sliceSerialize(de)}function he(){return{type:"blockquote",children:[]}}function je(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function et(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function We(){return{type:"heading",depth:0,children:[]}}function tt(){return{type:"break"}}function Yt(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function Re(){return{type:"link",title:null,url:"",children:[]}}function $t(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function ln(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function cn(){return{type:"paragraph",children:[]}}function Pr(){return{type:"strong",children:[]}}function Ht(){return{type:"text",value:""}}function yt(){return{type:"thematicBreak"}}}function jo(e){return{line:e.line,column:e.column,offset:e.offset}}function aB(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?aB(e,r):jce(e,r)}}function jce(e,t){let n;for(n in t)if(iB.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function yP(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+dh({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+dh({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+dh({start:t.start,end:t.end})+") is still open")}function Nce(e){const t=this;t.parser=n;function n(r){return wce(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function kce(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Cce(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -113,7 +113,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
113
113
|
`)){if(!k.startsWith("data:"))continue;const E=k.slice(5).trim();if(E)try{l(JSON.parse(E))}catch{}}b=m.indexOf(`
|
|
114
114
|
|
|
115
115
|
`)}}}finally{a?.removeEventListener("abort",y);try{f.releaseLock()}catch{}}}function mB(e){return!e||e.role!=="assistant"?"":e.content.filter(t=>t.type==="text").map(t=>t.text).join("")}const Jue=[{label:"Status",prompt:"Quick status overview for this project — latest runs, current health, anything unusual."},{label:"Top insights",prompt:"Walk me through the 3 most severe active insights and what to do about each."},{label:"Last failed run",prompt:"If the latest run failed, dig into it and tell me what went wrong plus how to fix it."},{label:"Schedule",prompt:"What is the current sweep schedule, and is it appropriate given recent volatility?"}],ede=[{command:"/status",label:"Status",hint:"Latest runs, health, anything unusual",prompt:"Quick status overview for this project — latest runs, current health, anything unusual."},{command:"/insights",label:"Top insights",hint:"Walk through the most severe active insights",prompt:"Walk me through the 3 most severe active insights and what to do about each."},{command:"/last-run",label:"Last run",hint:"Summarize the latest sweep",prompt:"Summarize the latest run for this project — provider mix, visibility changes, and anything that moved."},{command:"/last-failed",label:"Last failed run",hint:"Diagnose the most recent failure",prompt:"If the latest run failed, dig into it and tell me what went wrong plus how to fix it."},{command:"/run-sweep",label:"Run sweep now",hint:"Trigger a new visibility sweep",prompt:"Run a new answer-visibility sweep for this project now and tell me when it lands."},{command:"/schedule",label:"Schedule",hint:"Review the sweep schedule",prompt:"What is the current sweep schedule, and is it appropriate given recent volatility?"},{command:"/queries",label:"Queries",hint:"List tracked queries",prompt:"List the tracked queries for this project and flag any that are obvious duplicates or underperformers."},{command:"/competitors",label:"Competitors",hint:"List tracked competitors",prompt:"List this project's tracked competitors and call out which ones are showing up in answer citations."},{command:"/clear",label:"Clear conversation",hint:"Wipe transcript and start fresh",action:"clear"}],eg=e=>`canonry:aero:provider:${e}`,DP=e=>`canonry:aero:scope:${e}`;function tde({projectName:e}){const[t,n]=x.useState(!1),[r,i]=x.useState(!1),[a,l]=x.useState([]),[c,d]=x.useState(""),[f,p]=x.useState(!1),[m,y]=x.useState([]),[v,w]=x.useState(""),[b,j]=x.useState(null),[k,E]=x.useState(()=>typeof window>"u"?null:window.localStorage.getItem(eg(e))??null),[A,C]=x.useState(()=>typeof window>"u"?"read-only":window.localStorage.getItem(DP(e))==="all"?"all":"read-only"),_=x.useRef(null),O=x.useRef(null),z=x.useRef(null),[R,$]=x.useState(0),F=x.useMemo(()=>{const I=c.trimStart();if(!I.startsWith("/"))return[];if(/\s/.test(I))return[];const D=I.toLowerCase();return ede.filter(V=>V.command.startsWith(D)||V.label.toLowerCase().includes(D.slice(1)))},[c]);x.useEffect(()=>{$(I=>F.length===0?0:Math.min(I,F.length-1))},[F.length]);const M=Bn({queryKey:_e.agent.providers(e),queryFn:()=>Wue(e),enabled:t,staleTime:6e4}),U=x.useMemo(()=>{const I=M.data?.providers??[];if(k){const V=I.find(re=>re.id===k&&re.configured);if(V)return V}const D=M.data?.defaultProvider;return D?I.find(V=>V.id===D)??null:null},[k,M.data]);x.useEffect(()=>{if(!M.data||!k)return;M.data.providers.find(D=>D.id===k&&D.configured)||(E(null),window.localStorage.removeItem(eg(e)))},[M.data,k,e]);const K=x.useCallback(I=>{E(I),!(typeof window>"u")&&(I?window.localStorage.setItem(eg(e),I):window.localStorage.removeItem(eg(e)))},[e]),Z=x.useCallback(()=>{C(I=>{const D=I==="all"?"read-only":"all";return typeof window<"u"&&window.localStorage.setItem(DP(e),D),D})},[e]);x.useEffect(()=>{if(!t)return;const I=D=>{D.key==="Escape"&&(r?i(!1):n(!1))};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[t,r]),x.useEffect(()=>{if(!t)return;let I=!1;j(null);const D=()=>{I||f||RP(e).then(ee=>{I||l(ee.messages)}).catch(ee=>{I||j(ee instanceof Error?ee.message:"Failed to load transcript")})};D();const re=window.setInterval(D,15e3);return()=>{I=!0,window.clearInterval(re)}},[t,e,f]),x.useEffect(()=>()=>{_.current?.abort()},[e]),x.useEffect(()=>{const I=O.current;I&&(I.scrollTop=I.scrollHeight)},[a,v,m]);async function Y(I){const D=I.trim();if(!D||f)return;j(null),d(""),p(!0),w(""),y([]);const V={role:"user",content:D,timestamp:Date.now()};l(ee=>[...ee,V]);const re=new AbortController;_.current=re;try{await Xue({project:e,prompt:D,provider:k??void 0,scope:A,signal:re.signal,onEvent:H});const ee=await RP(e);l(ee.messages)}catch(ee){ee.name!=="AbortError"&&j(ee instanceof Error?ee.message:"Prompt failed")}finally{p(!1),w(""),_.current=null}}function H(I){switch(I.type){case"message_update":w(mB(I.message));break;case"message_end":I.message.role==="assistant"&&w("");break;case"tool_execution_start":y(D=>[...D,{id:I.toolCallId,name:I.toolName,args:I.args,startedAt:Date.now()}]);break;case"tool_execution_end":y(D=>D.map(V=>V.id===I.toolCallId?{...V,endedAt:Date.now(),isError:I.isError,result:I.result}:V));break;case"error":j(I.message);break}}async function X(){_.current?.abort();try{await Zue(e),l([]),j(null)}catch(I){j(I instanceof Error?I.message:"Reset failed")}}const ue=a.length===0,xe=t&&r?"pointer-events-auto fixed inset-0 z-40 flex items-stretch justify-center bg-zinc-950/70 p-4 sm:p-8 backdrop-blur-sm":"pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-center p-3",L=r?"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden rounded-2xl border border-zinc-800/80 bg-zinc-950/95 shadow-2xl":"pointer-events-auto w-full max-w-3xl",q=r?"flex-1 overflow-y-auto px-6 py-5 text-sm text-zinc-200":"max-h-[40vh] min-h-[120px] overflow-y-auto px-4 py-3 text-sm text-zinc-200";return s.jsx("div",{className:xe,onClick:I=>{r&&I.target===I.currentTarget&&i(!1)},children:s.jsx("div",{className:L,children:t?s.jsxs("div",{className:r?"flex h-full flex-col":"flex flex-col overflow-hidden rounded-2xl border border-zinc-800/80 bg-zinc-950/95 shadow-xl backdrop-blur",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-zinc-800/70 px-4 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(V2,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium text-zinc-100",children:"Aero"}),s.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:f?"working…":e})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(nde,{providers:M.data?.providers??[],active:U,override:k,onPick:K,disabled:f}),s.jsx("button",{type:"button",onClick:X,className:"rounded-md p-1.5 text-zinc-500 transition hover:bg-zinc-800/60 hover:text-zinc-200","aria-label":"Reset conversation",title:"Reset conversation",children:s.jsx(x4,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("button",{type:"button",onClick:()=>i(I=>!I),className:"rounded-md p-1.5 text-zinc-500 transition hover:bg-zinc-800/60 hover:text-zinc-200","aria-label":r?"Collapse":"Expand",title:r?"Collapse":"Expand",children:r?s.jsx(ZY,{className:"h-3.5 w-3.5","aria-hidden":"true"}):s.jsx(VY,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("button",{type:"button",onClick:()=>{i(!1),n(!1)},className:"rounded-md p-1.5 text-zinc-500 transition hover:bg-zinc-800/60 hover:text-zinc-200","aria-label":"Close Aero",children:s.jsx(wc,{className:"h-4 w-4","aria-hidden":"true"})})]})]}),s.jsxs("div",{ref:O,className:q,children:[b&&s.jsx("div",{className:"mb-2 rounded-md border border-rose-700/40 bg-rose-950/40 px-3 py-2 text-xs text-rose-200",children:b}),ue&&!f&&s.jsxs("div",{className:"flex flex-col gap-3 py-2",children:[s.jsxs("p",{className:"text-xs text-zinc-500",children:["Ask anything about ",s.jsx("span",{className:"text-zinc-300",children:e}),", or start with:"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:Jue.map(I=>s.jsx("button",{type:"button",onClick:()=>Y(I.prompt),className:"rounded-full border border-zinc-800 bg-zinc-900/70 px-3 py-1 text-xs text-zinc-300 transition hover:border-zinc-700 hover:bg-zinc-800/70 hover:text-zinc-100",children:I.label},I.label))})]}),ode(a,e,k,A),m.length>0&&s.jsx("div",{className:"mt-3 space-y-1.5",children:m.map(I=>s.jsx(gB,{trail:I},I.id))}),f&&v&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"mb-0.5 text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),s.jsx(yB,{content:v})]}),f&&!v&&m.every(I=>I.endedAt!==void 0)&&s.jsx(dde,{})]}),s.jsx(rde,{projectName:e,activeProvider:U,scope:A,onToggleScope:Z,disabled:f}),s.jsxs("div",{className:"relative",children:[F.length>0&&s.jsx(ide,{matches:F,selectedIndex:R,onHover:$,onPick:I=>{d(""),z.current?.focus(),I.action==="clear"?X():Y(I.prompt)}}),s.jsxs("form",{className:"flex items-end gap-2 border-t border-zinc-800/70 bg-zinc-950/80 px-3 py-2.5",onSubmit:I=>{if(I.preventDefault(),F.length>0){const D=F[R];d(""),D.action==="clear"?X():Y(D.prompt);return}Y(c)},children:[s.jsx("textarea",{ref:z,value:c,onChange:I=>d(I.target.value),onKeyDown:I=>{if(F.length>0){if(I.key==="ArrowDown"){I.preventDefault(),$(D=>(D+1)%F.length);return}if(I.key==="ArrowUp"){I.preventDefault(),$(D=>(D-1+F.length)%F.length);return}if(I.key==="Tab"){I.preventDefault();const D=F[R];d(`${D.command} `);return}if(I.key==="Escape"){I.preventDefault(),d("");return}}if(I.key==="Enter"&&!I.shiftKey)if(I.preventDefault(),F.length>0){const D=F[R];d(""),D.action==="clear"?X():Y(D.prompt)}else Y(c)},placeholder:"Ask Aero, or / for commands…",disabled:f,rows:r?3:1,className:"flex-1 resize-none bg-transparent text-sm text-zinc-100 placeholder:text-zinc-600 focus:outline-none disabled:opacity-60"}),s.jsx("button",{type:"submit",disabled:f||!c.trim(),className:"inline-flex h-7 w-7 items-center justify-center rounded-md bg-emerald-500 text-zinc-950 transition hover:bg-emerald-400 disabled:opacity-40","aria-label":"Send",children:s.jsx(xY,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]}):s.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex w-full items-center justify-between rounded-full border border-zinc-800/80 bg-zinc-950/95 px-4 py-2 text-left text-sm text-zinc-400 shadow-lg backdrop-blur transition hover:border-zinc-700 hover:bg-zinc-900/90 hover:text-zinc-200",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(V2,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"}),"Ask Aero about ",e,"…"]}),s.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-600",children:"Enter"})]})})})}function nde({providers:e,active:t,override:n,onPick:r,disabled:i}){const[a,l]=x.useState(!1),c=x.useRef(null);if(x.useEffect(()=>{if(!a)return;const p=y=>{c.current?.contains(y.target)||l(!1)},m=y=>{y.key==="Escape"&&l(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",m)}},[a]),e.length===0)return null;const d=t?.label.replace(/\s+\(.+\)$/,"")??"No provider",f=t?.defaultModel;return s.jsxs("div",{ref:c,className:"relative",children:[s.jsxs("button",{type:"button",onClick:()=>l(p=>!p),disabled:i,className:"flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-zinc-400 transition hover:bg-zinc-800/60 hover:text-zinc-200 disabled:opacity-50","aria-label":"Switch agent model","aria-haspopup":"listbox","aria-expanded":a,title:t?`${t.label} · ${t.defaultModel}`:"Pick a provider",children:[s.jsx("span",{className:"font-medium text-zinc-200",children:d}),f&&s.jsx("span",{className:"hidden font-mono text-[10px] text-zinc-500 sm:inline",children:f}),s.jsx(NY,{className:"h-3 w-3","aria-hidden":"true"})]}),a&&s.jsxs("div",{role:"listbox",className:"absolute right-0 top-full z-50 mt-1 w-64 overflow-hidden rounded-lg border border-zinc-800 bg-zinc-950 shadow-xl",children:[s.jsx("div",{className:"border-b border-zinc-800/60 px-3 py-2 text-[10px] uppercase tracking-wider text-zinc-500",children:"Aero provider"}),s.jsx("ul",{className:"max-h-72 overflow-y-auto py-1",children:e.map(p=>{const m=t?.id===p.id,y=n===p.id;return s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":m,disabled:!p.configured,onClick:()=>{p.configured&&(r(y?null:p.id),l(!1))},className:"flex w-full items-start gap-2 px-3 py-2 text-left text-xs transition enabled:hover:bg-zinc-900 disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx("span",{className:"mt-0.5 flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:m?s.jsx(p4,{className:"h-3 w-3 text-emerald-400","aria-hidden":"true"}):null}),s.jsxs("span",{className:"flex-1",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"font-medium text-zinc-100",children:p.label}),y&&s.jsx("span",{className:"rounded-full border border-emerald-800/60 bg-emerald-950/60 px-1.5 text-[9px] uppercase tracking-wider text-emerald-300",children:"Pinned"}),!p.configured&&s.jsx("span",{className:"rounded-full border border-zinc-800 px-1.5 text-[9px] uppercase tracking-wider text-zinc-500",children:"Key missing"})]}),s.jsx("span",{className:"mt-0.5 block font-mono text-[10px] text-zinc-500",children:p.defaultModel}),p.keySource==="env"&&s.jsx("span",{className:"mt-0.5 block text-[10px] text-zinc-600",children:"via env var"}),!p.configured&&s.jsxs("span",{className:"mt-0.5 block text-[10px] text-zinc-600",children:["Add key in config.yaml or export"," ",s.jsx("code",{className:"font-mono text-zinc-400",children:ade(p.id)})]})]})]})},p.id)})}),n&&s.jsx("button",{type:"button",onClick:()=>{r(null),l(!1)},className:"w-full border-t border-zinc-800/60 px-3 py-2 text-left text-[11px] text-zinc-400 transition hover:bg-zinc-900 hover:text-zinc-100",children:"Reset to auto-detected default"})]})]})}function rde({projectName:e,activeProvider:t,scope:n,onToggleScope:r,disabled:i}){const a=t?.label.replace(/\s+\(.+\)$/,"")??null,l=n==="all";return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-zinc-800/70 bg-zinc-950/80 px-3 pt-2",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-800 bg-zinc-900/70 px-2 py-0.5 text-[10px] text-zinc-400",children:[s.jsx("span",{className:"text-zinc-600",children:"project"}),s.jsx("span",{className:"font-medium text-zinc-200",children:e})]}),a&&s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-800 bg-zinc-900/70 px-2 py-0.5 text-[10px] text-zinc-400",children:[s.jsx("span",{className:"text-zinc-600",children:"model"}),s.jsx("span",{className:"font-medium text-zinc-200",children:a})]}),s.jsxs("button",{type:"button",onClick:r,disabled:i,className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] transition disabled:opacity-50 ${l?"border-amber-800/60 bg-amber-950/40 text-amber-300 hover:border-amber-700 hover:text-amber-200":"border-zinc-800 bg-zinc-900/70 text-zinc-400 hover:border-zinc-700 hover:text-zinc-200"}`,title:l?"Aero can invoke write tools (run sweep, dismiss insight, etc). Click to restrict.":"Aero is restricted to read-only tools. Click to allow writes.",children:[s.jsx("span",{className:l?"text-amber-500":"text-zinc-600",children:"scope"}),s.jsx("span",{className:"font-medium",children:l?"all tools":"read-only"})]})]})}function ide({matches:e,selectedIndex:t,onHover:n,onPick:r}){return s.jsxs("div",{className:"absolute inset-x-3 bottom-full mb-2 overflow-hidden rounded-lg border border-zinc-800 bg-zinc-950/98 shadow-2xl",children:[s.jsx("div",{className:"border-b border-zinc-800/60 px-3 py-1.5 text-[10px] uppercase tracking-wider text-zinc-500",children:"Commands"}),s.jsx("ul",{role:"listbox",className:"max-h-72 overflow-y-auto py-1",children:e.map((i,a)=>{const l=a===t;return s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":l,onMouseEnter:()=>n(a),onClick:()=>r(i),className:`flex w-full items-center gap-3 px-3 py-1.5 text-left text-xs transition ${l?"bg-zinc-900 text-zinc-100":"text-zinc-300 hover:bg-zinc-900/60"}`,children:[s.jsx("span",{className:"font-mono text-[11px] text-emerald-400",children:i.command}),s.jsx("span",{className:"font-medium",children:i.label}),s.jsx("span",{className:"ml-auto text-[10px] text-zinc-500",children:i.hint})]})},i.command)})}),s.jsxs("div",{className:"border-t border-zinc-800/60 px-3 py-1.5 text-[10px] text-zinc-600",children:[s.jsx("span",{className:"mr-3",children:"↑↓ to select"}),s.jsx("span",{className:"mr-3",children:"Enter to run"}),s.jsx("span",{children:"Tab to autocomplete"})]})]})}function ade(e){switch(e){case"claude":return"ANTHROPIC_API_KEY";case"openai":return"OPENAI_API_KEY";case"gemini":return"GOOGLE_API_KEY";case"zai":return"ZAI_API_KEY"}}function sde(e,t){const n=e.timestamp??0;return`${e.role}:${n}:${t}`}function ode(e,t,n,r){const i=[];for(let a=0;a<e.length;a++){const l=e[a],c=sde(l,a);if(l.role==="user"){const d=typeof l.content=="string"?l.content:JSON.stringify(l.content);if(d.startsWith("[system]"))continue;i.push(s.jsx(lde,{text:d,projectName:t,providerOverride:n,scope:r},c));continue}if(l.role==="assistant"){const d=new Map;let f=a+1;for(;f<e.length&&e[f].role==="toolResult";){const y=e[f];d.set(y.toolCallId,y),f++}const p=ude(l,d,l.timestamp??0),m=mB(l);i.push(s.jsxs(x.Fragment,{children:[p.length>0&&s.jsx("div",{className:"mt-3 space-y-1.5",children:p.map(y=>s.jsx(gB,{trail:y},y.id))}),m.trim()&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"mb-0.5 text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),s.jsx(yB,{content:m})]})]},c)),a=f-1;continue}}return i}function lde({text:e,projectName:t,providerOverride:n,scope:r}){const[i,a]=x.useState(!1),l=x.useMemo(()=>cde(t,e,n,r),[t,e,n,r]);async function c(){try{await navigator.clipboard.writeText(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{}}return s.jsxs("div",{className:"group relative mt-3 rounded-md bg-zinc-900/60 px-3 py-2 text-zinc-200",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:"You"}),s.jsx("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1 rounded border border-zinc-800/70 bg-zinc-950/60 px-1.5 py-0.5 text-[10px] text-zinc-400 opacity-0 transition hover:border-zinc-700 hover:text-zinc-100 group-hover:opacity-100 focus:opacity-100","aria-label":"Copy as CLI command",title:l,children:i?s.jsxs(s.Fragment,{children:[s.jsx(p4,{className:"h-2.5 w-2.5 text-emerald-400","aria-hidden":"true"}),"Copied"]}):s.jsxs(s.Fragment,{children:[s.jsx(PY,{className:"h-2.5 w-2.5","aria-hidden":"true"}),"Copy as CLI"]})})]}),s.jsx("div",{className:"whitespace-pre-wrap",children:e})]})}function cde(e,t,n,r){const i=["canonry","agent","ask",MP(e),MP(t)];return n&&i.push("--provider",n),r==="read-only"&&i.push("--scope","read-only"),i.join(" ")}function MP(e){return`'${e.replace(/'/g,"'\\''")}'`}function ude(e,t,n){const r=[];for(const i of e.content){if(i.type!=="toolCall")continue;const a=i,l=t.get(a.id);r.push({id:a.id,name:a.name,args:a.arguments,startedAt:n,endedAt:l?.timestamp,isError:l?.isError,result:l?.content})}return r}function gB({trail:e}){const[t,n]=x.useState(!1),r=e.endedAt===void 0,i=!r&&e.isError===!0,a=e.endedAt!=null?e.endedAt-e.startedAt:null,l=a==null||a<0?null:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`,c=i?"border-rose-800/50":r?"border-emerald-800/50":"border-zinc-800/70",d=i?"bg-rose-950/20":r?"bg-emerald-950/20":"bg-zinc-900/40";return s.jsxs("div",{className:`rounded-md border ${c} ${d} font-mono`,children:[s.jsxs("button",{type:"button",onClick:()=>n(f=>!f),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left","aria-expanded":t,children:[s.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:r?s.jsx(v4,{className:"h-3 w-3 animate-spin text-emerald-400","aria-hidden":"true"}):i?s.jsx(sy,{className:"h-3 w-3 text-rose-400","aria-hidden":"true"}):s.jsx(bW,{className:"h-3 w-3 text-zinc-500","aria-hidden":"true"})}),s.jsx("span",{className:"text-[11px] font-semibold text-zinc-100",children:e.name}),s.jsxs("span",{className:"ml-auto flex items-center gap-2 text-[10px] text-zinc-500",children:[r?s.jsx("span",{className:"text-emerald-400",children:"running…"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:i?"failed":"ok"}),l&&s.jsx("span",{children:l})]}),s.jsx(ep,{className:`h-3 w-3 transition-transform ${t?"rotate-90":""}`,"aria-hidden":"true"})]})]}),t&&s.jsxs("div",{className:"border-t border-zinc-800/60 px-2.5 py-2 text-[11px] text-zinc-400",children:[s.jsx("div",{className:"mb-1 text-[9px] uppercase tracking-wider text-zinc-600",children:"Args"}),s.jsx("pre",{className:"mb-2 overflow-x-auto whitespace-pre-wrap break-all text-[10px] text-zinc-300",children:IP(e.args)}),!r&&e.result!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-1 text-[9px] uppercase tracking-wider text-zinc-600",children:i?"Error":"Result"}),s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[10px] text-zinc-300",children:IP(e.result)})]})]})]})}function IP(e){try{const t=typeof e=="string"?e:JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}
|
|
116
|
-
… (${t.length-2e3} more chars)`:t}catch{return String(e)}}function yB({content:e}){return s.jsx("div",{className:"aero-markdown text-zinc-100",children:s.jsx(Hue,{components:{h1:t=>s.jsx("h1",{...t,className:"mt-3 mb-2 text-base font-semibold text-zinc-50"}),h2:t=>s.jsx("h2",{...t,className:"mt-3 mb-2 text-sm font-semibold text-zinc-50"}),h3:t=>s.jsx("h3",{...t,className:"mt-3 mb-1.5 text-sm font-semibold text-zinc-100"}),h4:t=>s.jsx("h4",{...t,className:"mt-2 mb-1 text-xs font-semibold uppercase tracking-wide text-zinc-300"}),p:t=>s.jsx("p",{...t,className:"mb-2 leading-relaxed"}),ul:t=>s.jsx("ul",{...t,className:"mb-2 ml-4 list-disc space-y-1"}),ol:t=>s.jsx("ol",{...t,className:"mb-2 ml-4 list-decimal space-y-1"}),li:t=>s.jsx("li",{...t,className:"marker:text-zinc-600"}),strong:t=>s.jsx("strong",{...t,className:"font-semibold text-zinc-50"}),em:t=>s.jsx("em",{...t,className:"text-zinc-200"}),code:({children:t,...n})=>s.jsx("code",{...n,className:"rounded bg-zinc-800/70 px-1 py-0.5 font-mono text-[12px] text-emerald-200",children:t}),pre:t=>s.jsx("pre",{...t,className:"mb-2 overflow-x-auto rounded-md border border-zinc-800 bg-zinc-900/70 p-3 font-mono text-xs text-zinc-200"}),a:t=>s.jsx("a",{...t,className:"text-emerald-400 underline decoration-emerald-700 hover:decoration-emerald-400",target:"_blank",rel:"noopener noreferrer"}),table:t=>s.jsx("div",{className:"mb-2 overflow-x-auto",children:s.jsx("table",{...t,className:"w-full border-collapse text-xs"})}),thead:t=>s.jsx("thead",{...t,className:"border-b border-zinc-800"}),th:t=>s.jsx("th",{...t,className:"px-2 py-1 text-left font-semibold text-zinc-300"}),tr:t=>s.jsx("tr",{...t,className:"border-b border-zinc-900"}),td:t=>s.jsx("td",{...t,className:"px-2 py-1 text-zinc-200"}),blockquote:t=>s.jsx("blockquote",{...t,className:"mb-2 border-l-2 border-zinc-700 pl-3 italic text-zinc-400"}),hr:()=>s.jsx("hr",{className:"my-3 border-zinc-800"})},children:e})})}function dde(){return s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),s.jsxs("div",{className:"flex items-center gap-1","aria-label":"Aero is thinking",children:[s.jsx("span",{className:"aero-dot h-1.5 w-1.5 rounded-full bg-emerald-400/80"}),s.jsx("span",{className:"aero-dot aero-dot-2 h-1.5 w-1.5 rounded-full bg-emerald-400/60"}),s.jsx("span",{className:"aero-dot aero-dot-3 h-1.5 w-1.5 rounded-full bg-emerald-400/40"})]})]})}function fde(){const e=V5(),t=/^\/projects\/([^/]+)/.exec(e.pathname),n=t?decodeURIComponent(t[1]):null,r=Bn({queryKey:_e.projects.all,queryFn:zv,enabled:n!==null,staleTime:6e4});if(!n)return null;const i=r.data??[],a=i.find(l=>l.id===n)??i.find(l=>l.name===n);return a?s.jsx(tde,{projectName:a.name},a.name):null}function Jv(e,t,n){switch(e.invalidateQueries({queryKey:_e.runs.all}),e.invalidateQueries({queryKey:_e.projects.all}),t){case vt["answer-visibility"]:case vt["site-audit"]:case vt["backlink-extract"]:return;case vt["gsc-sync"]:case vt["inspect-sitemap"]:e.invalidateQueries({queryKey:_e.gsc.project(n)});return;case vt["ga-sync"]:e.invalidateQueries({queryKey:_e.traffic.project(n)});return;case vt["traffic-sync"]:e.invalidateQueries({queryKey:_e.traffic.project(n)}),e.invalidateQueries({queryKey:_e.serverTraffic.project(n)});return;case vt["bing-inspect"]:case vt["bing-inspect-sitemap"]:e.invalidateQueries({queryKey:_e.bing.project(n)});return;case vt["aeo-discover-seed"]:case vt["aeo-discover-probe"]:return;default:return t}}const LP=[{label:"GitHub",href:"https://github.com/AINYC/canonry",Icon:BY},{label:"Docs",href:"https://github.com/AINYC/canonry/tree/main/docs",Icon:wY},{label:"Changelog",href:"https://github.com/AINYC/canonry/releases",Icon:LY}],$P=e=>({label:e,state:"checking",detail:"Checking service health"}),hde={apiStatus:$P("API"),workerStatus:$P("Worker")};function pde(e){switch(e){case vt["answer-visibility"]:return"Visibility sweep";case vt["gsc-sync"]:return"GSC sync";case vt["inspect-sitemap"]:return"Sitemap inspection";case vt["ga-sync"]:return"GA sync";case vt["traffic-sync"]:return"Traffic sync";case vt["bing-inspect"]:return"Bing URL inspection";case vt["bing-inspect-sitemap"]:return"Bing sitemap inspection";case vt["site-audit"]:return"Site audit";case vt["backlink-extract"]:return"Backlink extract";case vt["aeo-discover-seed"]:return"Discovery (seed phase)";case vt["aeo-discover-probe"]:return"Discovery (probe phase)"}}function mde(e){return e==="completed"?"positive":e==="partial"?"caution":"negative"}function gde(e){const t=pde(e.kind);return e.status==="completed"?`${t} completed`:e.status==="partial"?`${t} completed with partial results`:e.status==="cancelled"?`${t} cancelled`:`${t} failed`}function yde(e,t){return e.error?`${t}: ${Nk(e.error)}`:e.location?`${t} · ${e.location}`:t}function vde(e,t,n){if(t)return t;const r=n.find(i=>i.id===e);return r?.displayName||r?.name||e}function xde(e,t){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,t>0?`${t} skipped at queue time`:null].filter(Boolean).join(", ")}function bde(e){return e.failed>0||e.cancelled>0?"negative":e.partial>0?"caution":"positive"}function wde(){const e=Fn(),t=x.useSyncExternalStore(nre,sc,sc),n=Object.keys(t.runs).length>0||Object.keys(t.batches).length>0,r=Bn({queryKey:_e.runs.all,queryFn:Z5,enabled:n,staleTime:u1,refetchInterval:3e3}),i=Bn({queryKey:_e.projects.all,queryFn:zv,enabled:n}),a=x.useRef({}),l=x.useCallback(()=>{r.refetch()},[r.refetch]);return x.useEffect(()=>{n&&l()},[n,l]),x.useEffect(()=>{if(!n||typeof window>"u")return;const c=()=>{document.visibilityState==="visible"&&l()};return window.addEventListener("focus",l),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",l),document.removeEventListener("visibilitychange",c)}},[n,l]),x.useEffect(()=>{const c=r.data??[],d=i.data??[],f=Object.fromEntries(c.map(m=>[m.id,m])),p=Object.fromEntries(c.map(m=>[m.id,m.status]));for(const m of Object.values(t.runs)){const y=f[m.runId];if(!y||!Rk(y.status)||(a.current[y.id]??m.lastAnnouncedStatus)===y.status)continue;const w=d.find(j=>j.id===y.projectId);if(w&&Jv(e,y.kind,w.name),m.sourceAction==="run-all"){jT(y.id);continue}const b=vde(y.projectId,m.projectLabel,d);ct({title:gde(y),detail:yde(y,b),tone:mde(y.status),dedupeKey:`run:${y.id}`,dedupeMode:"replace",cta:{label:"View run",intent:"open-run-drawer",runId:y.id}}),jT(y.id)}for(const m of Object.values(t.batches)){const y=are(m.runIds,f);y.finished&&(ct({title:"Run-all batch finished",detail:xde(y,m.skippedCount),tone:bde(y),dedupeKey:`batch:${m.batchId}`,dedupeMode:"replace",cta:{label:"View runs",intent:"go-to-runs"}}),ire(m.batchId))}a.current=p},[i.data,r.data,t,e]),null}function Sde(){const e=tp(),{dashboard:t,isLoading:n,refetch:r}=kc(),l=Vv(!e,e?.health).data??e?.health??hde,c=V5(),{runId:d,evidenceId:f,closeDrawer:p}=jd(),[m,y]=x.useState(!1),[v,w]=x.useState(()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem("canonry:dismissedUpdateVersion")}catch{return null}}),[b]=x.useState(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("force-update")),j=b?{current:l.apiStatus.version??"0.0.0",latest:b,url:"https://www.npmjs.com/package/@ainyc/canonry",upgradeCommand:"npm install -g @ainyc/canonry"}:l.apiStatus.updateAvailable,k=j&&j.latest!==v,E=()=>{if(j){try{window.localStorage.setItem("canonry:dismissedUpdateVersion",j.latest)}catch{}w(j.latest)}},A=kse(d),C=A.data??null,_=A.isLoading;x.useEffect(()=>{C&&C.status!=="running"&&C.status!=="queued"&&r()},[C?.status,r]),x.useEffect(()=>{y(!1)},[c.pathname]),x.useEffect(()=>{if(typeof window>"u"||!d&&!f)return;const M=U=>{U.key==="Escape"&&p()};return window.addEventListener("keydown",M),()=>{window.removeEventListener("keydown",M)}},[d,f,p]);const O=t??e?.dashboard??null,z=c.pathname==="/setup"&&O!==null&&O.portfolioOverview.projects.length===0,R=d&&O?ese(O,d):void 0,$=f&&O?tse(O,f):void 0,F=(()=>{const M=c.pathname;if(M==="/")return"Portfolio";if(M==="/projects")return"Projects";if(M==="/runs")return"Runs";if(M==="/settings")return"Settings";if(M==="/setup")return"Setup";if(M==="/backlinks")return"Backlinks";if(M==="/traffic"||M.startsWith("/traffic/"))return"Server traffic";if(M.startsWith("/projects/")){const K=M.split("/").filter(Boolean)[1];if(K&&O){const Z=O.projects.find(Y=>Y.project.id===K);if(Z)return Z.project.name}return"Project"}return"Not found"})();return s.jsxs("div",{className:`app-shell ${z?"app-shell-focus":""}`,children:[s.jsx("a",{className:"skip-link",href:"#content",children:"Skip to content"}),!z&&s.jsxs("aside",{className:"sidebar","aria-label":"Primary navigation",children:[s.jsx("div",{className:"sidebar-brand",children:s.jsx(PT,{version:l.apiStatus.version,updateAvailable:k?j:null,onDismissUpdate:E})}),s.jsxs("nav",{className:"sidebar-nav",children:[s.jsxs(Ot,{to:"/",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(FY,{className:"sidebar-icon"}),s.jsx("span",{children:"Overview"})]}),s.jsxs(Ot,{to:"/projects",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[s.jsx(g4,{className:"sidebar-icon"}),s.jsx("span",{children:"Projects"})]}),s.jsxs(Ot,{to:"/runs",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(Nh,{className:"sidebar-icon"}),s.jsx("span",{children:"Runs"})]}),s.jsxs(Ot,{to:"/traffic",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[s.jsx(rW,{className:"sidebar-icon"}),s.jsx("span",{children:"Server traffic"})]}),s.jsxs(Ot,{to:"/backlinks",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(y4,{className:"sidebar-icon"}),s.jsx("span",{children:"Backlinks"})]}),s.jsxs(Ot,{to:"/settings",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(cW,{className:"sidebar-icon"}),s.jsx("span",{children:"Settings"})]}),n?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"sidebar-section-title",children:"Projects"}),[1,2,3].map(M=>s.jsxs("div",{className:"sidebar-skeleton-item",children:[s.jsx("span",{className:"skeleton-circle size-2"}),s.jsx("span",{className:"skeleton-text flex-1",style:{width:`${50+M*15}%`}})]},M))]}):O&&O.projects.length>0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"sidebar-section-title",children:"Projects"}),O.projects.map(M=>{const U=M.visibilitySummary.tone;return s.jsxs(Ot,{to:"/projects/$projectId",params:{projectId:M.project.id},className:"sidebar-project",activeProps:{className:"sidebar-project sidebar-project-active"},children:[s.jsx("span",{className:`sidebar-dot sidebar-dot-${U}`}),s.jsx("span",{children:M.project.displayName||M.project.name})]},M.project.id)})]}):n?null:s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"sidebar-section-title",children:"Resources"}),s.jsxs(Ot,{to:"/setup",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(sW,{className:"sidebar-icon"}),s.jsx("span",{children:"Setup"})]})]})]}),s.jsx("div",{className:"sidebar-footer",children:LP.map(({label:M,href:U,Icon:K})=>s.jsx("a",{className:"sidebar-footer-icon",href:U,target:"_blank",rel:"noopener noreferrer",title:M,"aria-label":M,children:s.jsx(K,{className:"size-4"})},U))})]}),s.jsxs("div",{className:"main-area",children:[s.jsxs("header",{className:"topbar",children:[s.jsxs("div",{className:"topbar-left",children:[s.jsx("div",{className:"topbar-brand-mobile",children:s.jsx(PT,{compact:!0})}),s.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[s.jsx(Ot,{to:"/",children:"Home"}),s.jsx(ep,{className:"breadcrumb-sep size-3"}),s.jsx("span",{className:"breadcrumb-current",children:F})]})]}),s.jsxs("div",{className:"topbar-actions",children:[s.jsxs("div",{className:"health-pill-row",children:[s.jsxs("span",{className:`health-pill health-pill-${l.apiStatus.state}`,title:Qo(l.apiStatus),children:["API ",l.apiStatus.state==="ok"?"ok":l.apiStatus.state]}),s.jsxs("span",{className:`health-pill health-pill-${l.workerStatus.state}`,title:Qo(l.workerStatus),children:["Worker ",l.workerStatus.state==="ok"?"ok":l.workerStatus.state]})]}),s.jsxs(pe,{className:"nav-toggle",variant:"secondary",size:"icon",type:"button","aria-expanded":m,"aria-controls":"mobile-nav",onClick:()=>y(M=>!M),children:[s.jsx(YY,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Open navigation"})]})]})]}),s.jsxs("div",{id:"mobile-nav",className:`mobile-nav ${m?"mobile-nav-open":""}`,children:[s.jsxs(pe,{className:"mobile-nav-close",variant:"ghost",size:"icon",type:"button",onClick:()=>y(!1),children:[s.jsx(wc,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Close navigation"})]}),s.jsx(Ot,{to:"/",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Overview"}),s.jsx(Ot,{to:"/projects",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Projects"}),s.jsx(Ot,{to:"/runs",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Runs"}),s.jsx(Ot,{to:"/traffic",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Server traffic"}),s.jsx(Ot,{to:"/settings",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Settings"}),O&&O.projects.length>0?s.jsxs("div",{className:"mobile-nav-section",children:[s.jsx("p",{className:"mobile-nav-section-title",children:"Projects"}),O.projects.map(M=>s.jsx(Ot,{to:"/projects/$projectId",params:{projectId:M.project.id},className:"mobile-nav-link",children:M.project.name},M.project.id))]}):null]}),s.jsx("main",{id:"content",className:"page-shell",children:n&&!e?s.jsxs("div",{className:"page-skeleton",children:[s.jsxs("div",{className:"page-skeleton-header",children:[s.jsx("div",{className:"skeleton-text h-6 w-40"}),s.jsx("div",{className:"skeleton-text-sm w-72"})]}),s.jsx("div",{className:"page-skeleton-grid",children:[1,2,3].map(M=>s.jsxs("div",{className:"page-skeleton-card",children:[s.jsx("div",{className:"skeleton-text w-24"}),s.jsx("div",{className:"skeleton-text w-full"}),s.jsx("div",{className:"skeleton-text-sm w-3/4"})]},M))}),s.jsx("div",{className:"page-skeleton-grid",style:{gridTemplateColumns:"1fr 1fr"},children:[1,2].map(M=>s.jsxs("div",{className:"page-skeleton-card",children:[s.jsx("div",{className:"skeleton-text w-20"}),s.jsx("div",{className:"space-y-2",children:[1,2,3].map(U=>s.jsx("div",{className:"skeleton-text-sm w-full"},U))})]},M))})]}):s.jsx(ck,{})}),s.jsxs("footer",{className:"footer",children:[s.jsxs("span",{className:"footer-brand",children:[s.jsx("span",{children:s.jsx("a",{href:"https://canonry.ai",children:"Canonry"})}),l.apiStatus.version&&l.apiStatus.version!=="unknown"?s.jsxs("span",{className:"footer-version",children:["v",l.apiStatus.version]}):null]}),s.jsx("div",{className:"footer-links",children:LP.map(({label:M,href:U,Icon:K})=>s.jsx("a",{href:U,target:"_blank",rel:"noopener noreferrer",title:M,"aria-label":M,className:"footer-icon",children:s.jsx(K,{className:"size-3.5"})},U))})]})]}),R?s.jsxs(Fae,{open:R!==void 0,title:R.summary,subtitle:`${R.projectName} · ${R.kindLabel}`,onClose:p,children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[s.jsx(Bv,{status:R.status}),s.jsx("span",{className:"text-zinc-400",children:R.startedAt}),s.jsx("span",{className:"text-zinc-500",children:R.duration}),s.jsx("span",{className:"text-zinc-600",children:R.triggerLabel})]}),R.status==="failed"&&R.statusDetail&&s.jsx("p",{className:"text-sm text-rose-300/80 mt-2",children:R.statusDetail}),s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-2",children:"Activity Log"}),_?s.jsx("p",{className:"text-sm text-zinc-500",children:"Loading run details..."}):C&&C.snapshots.length>0?s.jsxs("div",{className:"space-y-2",children:[C.snapshots.map(M=>s.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 p-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200 truncate",children:M.query??"Unknown query"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(oc,{provider:M.provider}),s.jsx(G3,{variant:M.citationState===Eh.cited?"success":"neutral",children:M.citationState})]})]}),M.model&&s.jsx("p",{className:"text-[11px] text-zinc-500 font-mono",children:M.model}),M.citedDomains.length>0&&s.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[s.jsx("span",{className:"text-zinc-400",children:"Sources:"})," ",M.citedDomains.join(", ")]}),M.competitorOverlap.length>0&&s.jsxs("p",{className:"text-xs text-rose-400/80 mt-0.5",children:["Competitor cited: ",M.competitorOverlap.join(", ")]}),M.groundingSources&&M.groundingSources.length>0&&s.jsxs("details",{className:"mt-2",children:[s.jsxs("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:[M.groundingSources.length," grounding source",M.groundingSources.length!==1?"s":""]}),s.jsx("ul",{className:"mt-1 space-y-0.5",children:M.groundingSources.map((U,K)=>s.jsx("li",{className:"text-xs text-zinc-500 truncate",children:s.jsx("a",{href:U.uri,target:"_blank",rel:"noopener noreferrer",className:"hover:text-zinc-300",children:U.title||U.uri})},K))})]}),M.answerText&&s.jsxs("details",{className:"mt-1",children:[s.jsx("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:"Answer preview"}),s.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed whitespace-pre-wrap",children:M.answerText})]})]},M.id)),C.status==="running"&&s.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Running remaining queries..."]})]}):C&&C.status==="running"?s.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Waiting for first query result..."]}):C&&C.status==="queued"?s.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-zinc-500 animate-pulse"}),"Run queued, waiting for execution slot..."]}):C&&C.error?s.jsxs("div",{className:"rounded-lg border border-rose-800/40 bg-rose-950/20 p-3",children:[s.jsx("p",{className:"text-sm font-medium text-rose-300 mb-2",children:"Run failed"}),s.jsx("pre",{className:"text-xs text-rose-300/80 whitespace-pre-wrap break-words max-h-48 overflow-y-auto font-mono leading-5",children:Fne(C.error)})]}):s.jsx("p",{className:"text-sm text-zinc-500",children:"No snapshot data available."})]})]}):null,$?s.jsx(Vae,{evidence:$.evidence,project:$.project,onClose:p}):null,s.jsx(wde,{}),s.jsx(Ese,{}),s.jsx(fde,{})]})}class jde extends x.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary]",t,n.componentStack)}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?s.jsx("div",{className:"page-container",children:s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-20 text-center",children:[s.jsx("div",{className:"rounded-full bg-rose-950/40 p-3",children:s.jsx(sy,{className:"size-6 text-rose-400"})}),s.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Something went wrong"}),s.jsx("p",{className:"text-sm text-zinc-400 max-w-md",children:this.state.error.message||"An unexpected error occurred while rendering this page."}),s.jsxs("div",{className:"flex gap-3 mt-2",children:[s.jsxs(pe,{variant:"secondary",size:"sm",onClick:this.handleReset,children:[s.jsx(x4,{className:"size-3.5 mr-1.5"}),"Try again"]}),s.jsx(pe,{variant:"secondary",size:"sm",onClick:()=>{const t=window.__CANONRY_CONFIG__?.basePath?.replace(/\/$/,"")??"";window.location.href=t||"/"},children:"Go home"})]})]})}):this.props.children}}const Pe=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ea("rounded-xl border border-zinc-800 bg-zinc-950/75 shadow-[0_0_0_1px_rgba(255,255,255,0.01)] backdrop-blur",e),...t}));Pe.displayName="Card";const T1=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ea("flex flex-col gap-1.5 p-5",e),...t}));T1.displayName="CardHeader";const P1=x.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ea("font-medium tracking-tight text-zinc-50",e),...t}));P1.displayName="CardTitle";const R1=x.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ea("text-sm text-zinc-500",e),...t}));R1.displayName="CardDescription";const $g=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ea("p-5 pt-0",e),...t}));$g.displayName="CardContent";function Nde({points:e,tone:t}){const n=x.useId();if(e.length===0)return null;const r=42,i=132,a=5,l=Math.min(...e),d=Math.max(...e)-l||1,f=i-a*2,p=r-a*2,m=e.map((y,v)=>{const w=a+v/Math.max(e.length-1,1)*f,b=a+(1-(y-l)/d)*p;return`${w},${b}`}).join(" ");return s.jsxs("svg",{className:`sparkline sparkline-${t}`,viewBox:`0 0 ${i} ${r}`,"aria-hidden":"true",children:[s.jsx("defs",{children:s.jsx("clipPath",{id:n,children:s.jsx("rect",{x:a,y:a,width:f,height:p,rx:"8"})})}),s.jsx("line",{className:"sparkline-guide",x1:a,x2:i-a,y1:r-a,y2:r-a}),s.jsx("polyline",{clipPath:`url(#${n})`,points:m,vectorEffect:"non-scaling-stroke"})]})}function kde({project:e}){return s.jsxs(Ot,{to:"/projects/$projectId",params:{projectId:e.project.id},className:"project-row cursor-pointer",children:[s.jsxs("div",{className:"project-row-primary",children:[s.jsxs("div",{children:[s.jsx("p",{className:"project-name",children:e.project.name}),s.jsx("p",{className:"project-domain",children:e.project.canonicalDomain})]}),s.jsx("p",{className:"project-insight",children:e.insight})]}),s.jsx("div",{className:"project-row-stat",children:s.jsxs("div",{className:"metric-inline-block",children:[s.jsx("p",{className:"metric-inline-label",children:"Answer Visibility"}),s.jsx("p",{className:`metric-inline-value ${e.visibilityTone==="caution"?"text-amber-400":""}`,children:e.visibilityScore}),s.jsx("p",{className:"metric-inline-delta",children:e.visibilityDelta}),e.providerCoverage&&s.jsx("p",{className:"text-[10px] font-medium text-amber-400/80",children:e.providerCoverage})]})}),s.jsx("div",{className:"project-row-stat",children:s.jsxs("div",{className:"metric-inline-block",children:[s.jsx("p",{className:"metric-inline-label",children:"Competitor Pressure"}),s.jsx("p",{className:"metric-inline-value",children:e.competitorPressureLabel}),s.jsxs("p",{className:"metric-inline-delta",children:[e.lastRun.kindLabel," · ",Iv(e.lastRun.status)]})]})}),s.jsx("div",{className:"project-row-chart",children:s.jsx(Nde,{points:e.trend,tone:k3(e.lastRun.status)})}),s.jsx("span",{className:"project-row-link",children:s.jsx(ep,{className:"h-4 w-4 text-zinc-500"})})]})}function Cde(){const e=tp(),{dashboard:t,isLoading:n}=kc(),r=t??e?.dashboard;if(!r||n)return s.jsxs("div",{className:"page-skeleton",children:[s.jsxs("div",{className:"page-skeleton-header",children:[s.jsx("div",{className:"skeleton-text h-6 w-32"}),s.jsx("div",{className:"skeleton-text-sm w-64"})]}),s.jsx("div",{className:"space-y-3",children:[1,2,3].map(p=>s.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-4 flex items-center gap-4",children:[s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"skeleton-text w-36"}),s.jsx("div",{className:"skeleton-text-sm w-48"})]}),s.jsx("div",{className:"skeleton-text w-16"}),s.jsx("div",{className:"skeleton-text w-16"}),s.jsx("div",{className:"skeleton h-8 w-20 rounded"})]},p))})]});const i=r.portfolioOverview,c=Vv(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},d=Yne(i.systemHealth,c,r.settings),{openRun:f}=jd();return s.jsxs("div",{className:"page-container",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-left",children:[s.jsx("h1",{className:"page-title",children:"Portfolio"}),s.jsx("p",{className:"page-subtitle",children:"Visibility and execution state across all projects"})]}),s.jsx("div",{className:"page-header-right",children:s.jsx("p",{className:"text-[11px] text-zinc-600",children:i.lastUpdatedAt})})]}),i.projects.length>0?s.jsx("div",{className:"project-list project-list-scrollable",children:i.projects.map(p=>s.jsx(kde,{project:p},p.project.id))}):s.jsxs(Pe,{className:"surface-card empty-card",children:[s.jsx("h3",{children:i.emptyState?.title??"No projects yet"}),s.jsx("p",{className:"supporting-copy",children:i.emptyState?.detail}),s.jsx(pe,{size:"sm",asChild:!0,children:s.jsx(Ot,{to:i.emptyState?.ctaHref==="/setup"||!i.emptyState?.ctaHref?"/setup":"/",children:i.emptyState?.ctaLabel??"Launch setup"})})]}),s.jsxs("div",{className:"overview-secondary-grid",children:[i.attentionItems.length>0&&s.jsxs("section",{className:"overview-secondary-section",children:[s.jsx("div",{className:"section-head section-head-inline",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Needs attention"}),s.jsx("h2",{className:"section-title-sm",children:"What changed"})]})}),s.jsx("div",{className:"attention-list attention-list-scrollable",children:i.attentionItems.map(p=>s.jsxs(Ot,{to:p.href,className:`attention-item attention-item-${p.tone}`,children:[s.jsxs("div",{children:[s.jsx("p",{className:"attention-title",children:p.title}),s.jsx("p",{className:"attention-detail",children:p.detail})]}),s.jsx("span",{className:"attention-action",children:p.actionLabel})]},p.id))})]}),s.jsxs("section",{className:"overview-secondary-section",children:[s.jsx("div",{className:"section-head section-head-inline",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Recent runs"}),s.jsx("h2",{className:"section-title-sm",children:"Activity"})]})}),s.jsx("div",{className:"compact-stack compact-stack-scrollable",children:i.recentRuns.length>0?i.recentRuns.map(p=>s.jsxs("button",{className:"compact-run",type:"button",onClick:()=>f(p.id),children:[s.jsxs("div",{children:[s.jsx("p",{className:"compact-run-title",children:p.projectName}),s.jsx("p",{className:"compact-run-detail",children:p.summary})]}),s.jsx(Bv,{status:p.status})]},p.id)):s.jsx("p",{className:"supporting-copy",children:"Run history appears here after the first launch."})})]})]}),s.jsxs("section",{className:"page-section",children:[s.jsx("div",{className:"section-head section-head-inline",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"System health"}),s.jsx("h2",{className:"section-title-sm",children:"Infrastructure"})]})}),s.jsx("div",{className:"health-grid",children:d.map(p=>s.jsxs(Pe,{className:"surface-card compact-card",children:[s.jsxs("div",{className:"section-head",children:[s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:p.label}),s.jsx("h3",{children:p.detail})]}),s.jsx(st,{tone:p.tone,title:p.id==="api"?Qo(c.apiStatus):p.id==="worker"?Qo(c.workerStatus):void 0,children:p.label})]}),s.jsx("p",{className:"supporting-copy",children:p.meta})]},p.id))})]})]})}const oC=Symbol.for("yaml.alias"),D1=Symbol.for("yaml.document"),qo=Symbol.for("yaml.map"),vB=Symbol.for("yaml.pair"),Ha=Symbol.for("yaml.scalar"),Cd=Symbol.for("yaml.seq"),Yi=Symbol.for("yaml.node.type"),Ac=e=>!!e&&typeof e=="object"&&e[Yi]===oC,e0=e=>!!e&&typeof e=="object"&&e[Yi]===D1,ip=e=>!!e&&typeof e=="object"&&e[Yi]===qo,Tn=e=>!!e&&typeof e=="object"&&e[Yi]===vB,tn=e=>!!e&&typeof e=="object"&&e[Yi]===Ha,ap=e=>!!e&&typeof e=="object"&&e[Yi]===Cd;function On(e){if(e&&typeof e=="object")switch(e[Yi]){case qo:case Cd:return!0}return!1}function zn(e){if(e&&typeof e=="object")switch(e[Yi]){case oC:case qo:case Ha:case Cd:return!0}return!1}const xB=e=>(tn(e)||On(e))&&!!e.anchor,Rl=Symbol("break visit"),Ade=Symbol("skip children"),ph=Symbol("remove node");function Ad(e,t){const n=Ede(t);e0(e)?Mu(null,e.contents,n,Object.freeze([e]))===ph&&(e.contents=null):Mu(null,e,n,Object.freeze([]))}Ad.BREAK=Rl;Ad.SKIP=Ade;Ad.REMOVE=ph;function Mu(e,t,n,r){const i=Ode(e,t,n,r);if(zn(i)||Tn(i))return zde(e,r,i),Mu(e,i,n,r);if(typeof i!="symbol"){if(On(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){const l=Mu(a,t.items[a],n,r);if(typeof l=="number")a=l-1;else{if(l===Rl)return Rl;l===ph&&(t.items.splice(a,1),a-=1)}}}else if(Tn(t)){r=Object.freeze(r.concat(t));const a=Mu("key",t.key,n,r);if(a===Rl)return Rl;a===ph&&(t.key=null);const l=Mu("value",t.value,n,r);if(l===Rl)return Rl;l===ph&&(t.value=null)}}return i}function Ede(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ode(e,t,n,r){if(typeof n=="function")return n(e,t,r);if(ip(t))return n.Map?.(e,t,r);if(ap(t))return n.Seq?.(e,t,r);if(Tn(t))return n.Pair?.(e,t,r);if(tn(t))return n.Scalar?.(e,t,r);if(Ac(t))return n.Alias?.(e,t,r)}function zde(e,t,n){const r=t[t.length-1];if(On(r))r.items[e]=n;else if(Tn(r))e==="key"?r.key=n:r.value=n;else if(e0(r))r.contents=n;else{const i=Ac(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const _de={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Tde=e=>e.replace(/[!,[\]{}]/g,t=>_de[t]);class $r{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},$r.defaultYaml,t),this.tags=Object.assign({},$r.defaultTags,n)}clone(){const t=new $r(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new $r(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:$r.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},$r.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:$r.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},$r.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[a,l]=r;return this.tags[a]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const l=/^\d+\.\d+$/.test(a);return n(6,`Unsupported YAML version ${a}`,l),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const l=t.slice(2,-1);return l==="!"||l==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),l)}const[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const a=this.tags[r];if(a)try{return a+decodeURIComponent(i)}catch(l){return n(String(l)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+Tde(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let i;if(t&&r.length>0&&zn(t.contents)){const a={};Ad(t.contents,(l,c)=>{zn(c)&&c.tag&&(a[c.tag]=!0)}),i=Object.keys(a)}else i=[];for(const[a,l]of r)a==="!!"&&l==="tag:yaml.org,2002:"||(!t||i.some(c=>c.startsWith(l)))&&n.push(`%TAG ${a} ${l}`);return n.join(`
|
|
116
|
+
… (${t.length-2e3} more chars)`:t}catch{return String(e)}}function yB({content:e}){return s.jsx("div",{className:"aero-markdown text-zinc-100",children:s.jsx(Hue,{components:{h1:t=>s.jsx("h1",{...t,className:"mt-3 mb-2 text-base font-semibold text-zinc-50"}),h2:t=>s.jsx("h2",{...t,className:"mt-3 mb-2 text-sm font-semibold text-zinc-50"}),h3:t=>s.jsx("h3",{...t,className:"mt-3 mb-1.5 text-sm font-semibold text-zinc-100"}),h4:t=>s.jsx("h4",{...t,className:"mt-2 mb-1 text-xs font-semibold uppercase tracking-wide text-zinc-300"}),p:t=>s.jsx("p",{...t,className:"mb-2 leading-relaxed"}),ul:t=>s.jsx("ul",{...t,className:"mb-2 ml-4 list-disc space-y-1"}),ol:t=>s.jsx("ol",{...t,className:"mb-2 ml-4 list-decimal space-y-1"}),li:t=>s.jsx("li",{...t,className:"marker:text-zinc-600"}),strong:t=>s.jsx("strong",{...t,className:"font-semibold text-zinc-50"}),em:t=>s.jsx("em",{...t,className:"text-zinc-200"}),code:({children:t,...n})=>s.jsx("code",{...n,className:"rounded bg-zinc-800/70 px-1 py-0.5 font-mono text-[12px] text-emerald-200",children:t}),pre:t=>s.jsx("pre",{...t,className:"mb-2 overflow-x-auto rounded-md border border-zinc-800 bg-zinc-900/70 p-3 font-mono text-xs text-zinc-200"}),a:t=>s.jsx("a",{...t,className:"text-emerald-400 underline decoration-emerald-700 hover:decoration-emerald-400",target:"_blank",rel:"noopener noreferrer"}),table:t=>s.jsx("div",{className:"mb-2 overflow-x-auto",children:s.jsx("table",{...t,className:"w-full border-collapse text-xs"})}),thead:t=>s.jsx("thead",{...t,className:"border-b border-zinc-800"}),th:t=>s.jsx("th",{...t,className:"px-2 py-1 text-left font-semibold text-zinc-300"}),tr:t=>s.jsx("tr",{...t,className:"border-b border-zinc-900"}),td:t=>s.jsx("td",{...t,className:"px-2 py-1 text-zinc-200"}),blockquote:t=>s.jsx("blockquote",{...t,className:"mb-2 border-l-2 border-zinc-700 pl-3 italic text-zinc-400"}),hr:()=>s.jsx("hr",{className:"my-3 border-zinc-800"})},children:e})})}function dde(){return s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-400",children:"Aero"}),s.jsxs("div",{className:"flex items-center gap-1","aria-label":"Aero is thinking",children:[s.jsx("span",{className:"aero-dot h-1.5 w-1.5 rounded-full bg-emerald-400/80"}),s.jsx("span",{className:"aero-dot aero-dot-2 h-1.5 w-1.5 rounded-full bg-emerald-400/60"}),s.jsx("span",{className:"aero-dot aero-dot-3 h-1.5 w-1.5 rounded-full bg-emerald-400/40"})]})]})}function fde(){const e=V5(),t=/^\/projects\/([^/]+)/.exec(e.pathname),n=t?decodeURIComponent(t[1]):null,r=Bn({queryKey:_e.projects.all,queryFn:zv,enabled:n!==null,staleTime:6e4});if(!n)return null;const i=r.data??[],a=i.find(l=>l.id===n)??i.find(l=>l.name===n);return a?s.jsx(tde,{projectName:a.name},a.name):null}function Jv(e,t,n){switch(e.invalidateQueries({queryKey:_e.runs.all}),e.invalidateQueries({queryKey:_e.projects.all}),t){case vt["answer-visibility"]:case vt["site-audit"]:case vt["backlink-extract"]:return;case vt["gsc-sync"]:case vt["inspect-sitemap"]:e.invalidateQueries({queryKey:_e.gsc.project(n)});return;case vt["ga-sync"]:e.invalidateQueries({queryKey:_e.traffic.project(n)});return;case vt["traffic-sync"]:e.invalidateQueries({queryKey:_e.traffic.project(n)}),e.invalidateQueries({queryKey:_e.serverTraffic.project(n)});return;case vt["bing-inspect"]:case vt["bing-inspect-sitemap"]:e.invalidateQueries({queryKey:_e.bing.project(n)});return;case vt["aeo-discover-seed"]:case vt["aeo-discover-probe"]:return;default:return t}}const LP=[{label:"GitHub",href:"https://github.com/AINYC/canonry",Icon:BY},{label:"Docs",href:"https://github.com/AINYC/canonry/tree/main/docs",Icon:wY},{label:"Changelog",href:"https://github.com/AINYC/canonry/releases",Icon:LY}],$P=e=>({label:e,state:"checking",detail:"Checking service health"}),hde={apiStatus:$P("API"),workerStatus:$P("Worker")};function pde(e){switch(e){case vt["answer-visibility"]:return"Visibility sweep";case vt["gsc-sync"]:return"GSC sync";case vt["inspect-sitemap"]:return"Sitemap inspection";case vt["ga-sync"]:return"GA sync";case vt["traffic-sync"]:return"Traffic sync";case vt["bing-inspect"]:return"Bing URL inspection";case vt["bing-inspect-sitemap"]:return"Bing sitemap inspection";case vt["site-audit"]:return"Site audit";case vt["backlink-extract"]:return"Backlink extract";case vt["aeo-discover-seed"]:return"Discovery (seed phase)";case vt["aeo-discover-probe"]:return"Discovery (probe phase)"}}function mde(e){return e==="completed"?"positive":e==="partial"?"caution":"negative"}function gde(e){const t=pde(e.kind);return e.status==="completed"?`${t} completed`:e.status==="partial"?`${t} completed with partial results`:e.status==="cancelled"?`${t} cancelled`:`${t} failed`}function yde(e,t){return e.error?`${t}: ${Nk(e.error)}`:e.location?`${t} · ${e.location}`:t}function vde(e,t,n){if(t)return t;const r=n.find(i=>i.id===e);return r?.displayName||r?.name||e}function xde(e,t){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,t>0?`${t} skipped at queue time`:null].filter(Boolean).join(", ")}function bde(e){return e.failed>0||e.cancelled>0?"negative":e.partial>0?"caution":"positive"}function wde(){const e=Fn(),t=x.useSyncExternalStore(nre,sc,sc),n=Object.keys(t.runs).length>0||Object.keys(t.batches).length>0,r=Bn({queryKey:_e.runs.all,queryFn:Z5,enabled:n,staleTime:u1,refetchInterval:3e3}),i=Bn({queryKey:_e.projects.all,queryFn:zv,enabled:n}),a=x.useRef({}),l=x.useCallback(()=>{r.refetch()},[r.refetch]);return x.useEffect(()=>{n&&l()},[n,l]),x.useEffect(()=>{if(!n||typeof window>"u")return;const c=()=>{document.visibilityState==="visible"&&l()};return window.addEventListener("focus",l),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",l),document.removeEventListener("visibilitychange",c)}},[n,l]),x.useEffect(()=>{const c=r.data??[],d=i.data??[],f=Object.fromEntries(c.map(m=>[m.id,m])),p=Object.fromEntries(c.map(m=>[m.id,m.status]));for(const m of Object.values(t.runs)){const y=f[m.runId];if(!y||!Rk(y.status)||(a.current[y.id]??m.lastAnnouncedStatus)===y.status)continue;const w=d.find(j=>j.id===y.projectId);if(w&&Jv(e,y.kind,w.name),m.sourceAction==="run-all"){jT(y.id);continue}const b=vde(y.projectId,m.projectLabel,d);ct({title:gde(y),detail:yde(y,b),tone:mde(y.status),dedupeKey:`run:${y.id}`,dedupeMode:"replace",cta:{label:"View run",intent:"open-run-drawer",runId:y.id}}),jT(y.id)}for(const m of Object.values(t.batches)){const y=are(m.runIds,f);y.finished&&(ct({title:"Run-all batch finished",detail:xde(y,m.skippedCount),tone:bde(y),dedupeKey:`batch:${m.batchId}`,dedupeMode:"replace",cta:{label:"View runs",intent:"go-to-runs"}}),ire(m.batchId))}a.current=p},[i.data,r.data,t,e]),null}function Sde(){const e=tp(),{dashboard:t,isLoading:n,refetch:r}=kc(),l=Vv(!e,e?.health).data??e?.health??hde,c=V5(),{runId:d,evidenceId:f,closeDrawer:p}=jd(),[m,y]=x.useState(!1),[v,w]=x.useState(()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem("canonry:dismissedUpdateVersion")}catch{return null}}),[b]=x.useState(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("force-update")),j=b?{current:l.apiStatus.version??"0.0.0",latest:b,url:"https://www.npmjs.com/package/@ainyc/canonry",upgradeCommand:"npm install -g @ainyc/canonry"}:l.apiStatus.updateAvailable,k=j&&j.latest!==v,E=()=>{if(j){try{window.localStorage.setItem("canonry:dismissedUpdateVersion",j.latest)}catch{}w(j.latest)}},A=kse(d),C=A.data??null,_=A.isLoading;x.useEffect(()=>{C&&C.status!=="running"&&C.status!=="queued"&&r()},[C?.status,r]),x.useEffect(()=>{y(!1)},[c.pathname]),x.useEffect(()=>{if(typeof window>"u"||!d&&!f)return;const M=U=>{U.key==="Escape"&&p()};return window.addEventListener("keydown",M),()=>{window.removeEventListener("keydown",M)}},[d,f,p]);const O=t??e?.dashboard??null,z=c.pathname==="/setup"&&O!==null&&O.portfolioOverview.projects.length===0,R=d&&O?ese(O,d):void 0,$=f&&O?tse(O,f):void 0,F=(()=>{const M=c.pathname;if(M==="/")return"Portfolio";if(M==="/projects")return"Projects";if(M==="/runs")return"Runs";if(M==="/settings")return"Settings";if(M==="/setup")return"Setup";if(M==="/backlinks")return"Backlinks";if(M==="/traffic"||M.startsWith("/traffic/"))return"Server traffic";if(M.startsWith("/projects/")){const K=M.split("/").filter(Boolean)[1];if(K&&O){const Z=O.projects.find(Y=>Y.project.id===K);if(Z)return Z.project.name}return"Project"}return"Not found"})();return s.jsxs("div",{className:`app-shell ${z?"app-shell-focus":""}`,children:[s.jsx("a",{className:"skip-link",href:"#content",children:"Skip to content"}),!z&&s.jsxs("aside",{className:"sidebar","aria-label":"Primary navigation",children:[s.jsx("div",{className:"sidebar-brand",children:s.jsx(PT,{version:l.apiStatus.version,updateAvailable:k?j:null,onDismissUpdate:E})}),s.jsxs("nav",{className:"sidebar-nav",children:[s.jsxs(Ot,{to:"/",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(FY,{className:"sidebar-icon"}),s.jsx("span",{children:"Overview"})]}),s.jsxs(Ot,{to:"/projects",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[s.jsx(g4,{className:"sidebar-icon"}),s.jsx("span",{children:"Projects"})]}),s.jsxs(Ot,{to:"/runs",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(Nh,{className:"sidebar-icon"}),s.jsx("span",{children:"Runs"})]}),s.jsxs(Ot,{to:"/traffic",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[s.jsx(rW,{className:"sidebar-icon"}),s.jsx("span",{children:"Server traffic"})]}),s.jsxs(Ot,{to:"/backlinks",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(y4,{className:"sidebar-icon"}),s.jsx("span",{children:"Backlinks"})]}),s.jsxs(Ot,{to:"/settings",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(cW,{className:"sidebar-icon"}),s.jsx("span",{children:"Settings"})]}),n?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"sidebar-section-title",children:"Projects"}),[1,2,3].map(M=>s.jsxs("div",{className:"sidebar-skeleton-item",children:[s.jsx("span",{className:"skeleton-circle size-2"}),s.jsx("span",{className:"skeleton-text flex-1",style:{width:`${50+M*15}%`}})]},M))]}):O&&O.projects.length>0?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"sidebar-section-title",children:"Projects"}),O.projects.map(M=>{const U=M.visibilitySummary.tone;return s.jsxs(Ot,{to:"/projects/$projectId",params:{projectId:M.project.id},className:"sidebar-project",activeProps:{className:"sidebar-project sidebar-project-active"},children:[s.jsx("span",{className:`sidebar-dot sidebar-dot-${U}`}),s.jsx("span",{children:M.project.displayName||M.project.name})]},M.project.id)})]}):n?null:s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"sidebar-section-title",children:"Resources"}),s.jsxs(Ot,{to:"/setup",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[s.jsx(sW,{className:"sidebar-icon"}),s.jsx("span",{children:"Setup"})]})]})]}),s.jsx("div",{className:"sidebar-footer",children:LP.map(({label:M,href:U,Icon:K})=>s.jsx("a",{className:"sidebar-footer-icon",href:U,target:"_blank",rel:"noopener noreferrer",title:M,"aria-label":M,children:s.jsx(K,{className:"size-4"})},U))})]}),s.jsxs("div",{className:"main-area",children:[s.jsxs("header",{className:"topbar",children:[s.jsxs("div",{className:"topbar-left",children:[s.jsx("div",{className:"topbar-brand-mobile",children:s.jsx(PT,{compact:!0})}),s.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[s.jsx(Ot,{to:"/",children:"Home"}),s.jsx(ep,{className:"breadcrumb-sep size-3"}),s.jsx("span",{className:"breadcrumb-current",children:F})]})]}),s.jsxs("div",{className:"topbar-actions",children:[s.jsxs("div",{className:"health-pill-row",children:[s.jsxs("span",{className:`health-pill health-pill-${l.apiStatus.state}`,title:Qo(l.apiStatus),children:["API ",l.apiStatus.state==="ok"?"ok":l.apiStatus.state]}),s.jsxs("span",{className:`health-pill health-pill-${l.workerStatus.state}`,title:Qo(l.workerStatus),children:["Worker ",l.workerStatus.state==="ok"?"ok":l.workerStatus.state]})]}),s.jsxs(pe,{className:"nav-toggle",variant:"secondary",size:"icon",type:"button","aria-expanded":m,"aria-controls":"mobile-nav",onClick:()=>y(M=>!M),children:[s.jsx(YY,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Open navigation"})]})]})]}),s.jsxs("div",{id:"mobile-nav",className:`mobile-nav ${m?"mobile-nav-open":""}`,children:[s.jsxs(pe,{className:"mobile-nav-close",variant:"ghost",size:"icon",type:"button",onClick:()=>y(!1),children:[s.jsx(wc,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Close navigation"})]}),s.jsx(Ot,{to:"/",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Overview"}),s.jsx(Ot,{to:"/projects",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Projects"}),s.jsx(Ot,{to:"/runs",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Runs"}),s.jsx(Ot,{to:"/traffic",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Server traffic"}),s.jsx(Ot,{to:"/settings",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Settings"}),O&&O.projects.length>0?s.jsxs("div",{className:"mobile-nav-section",children:[s.jsx("p",{className:"mobile-nav-section-title",children:"Projects"}),O.projects.map(M=>s.jsx(Ot,{to:"/projects/$projectId",params:{projectId:M.project.id},className:"mobile-nav-link",children:M.project.name},M.project.id))]}):null]}),s.jsx("main",{id:"content",className:"page-shell",children:n&&!e?s.jsxs("div",{className:"page-skeleton",children:[s.jsxs("div",{className:"page-skeleton-header",children:[s.jsx("div",{className:"skeleton-text h-6 w-40"}),s.jsx("div",{className:"skeleton-text-sm w-72"})]}),s.jsx("div",{className:"page-skeleton-grid",children:[1,2,3].map(M=>s.jsxs("div",{className:"page-skeleton-card",children:[s.jsx("div",{className:"skeleton-text w-24"}),s.jsx("div",{className:"skeleton-text w-full"}),s.jsx("div",{className:"skeleton-text-sm w-3/4"})]},M))}),s.jsx("div",{className:"page-skeleton-grid",style:{gridTemplateColumns:"1fr 1fr"},children:[1,2].map(M=>s.jsxs("div",{className:"page-skeleton-card",children:[s.jsx("div",{className:"skeleton-text w-20"}),s.jsx("div",{className:"space-y-2",children:[1,2,3].map(U=>s.jsx("div",{className:"skeleton-text-sm w-full"},U))})]},M))})]}):s.jsx(ck,{})}),s.jsxs("footer",{className:"footer",children:[s.jsxs("span",{className:"footer-brand",children:[s.jsx("span",{children:s.jsx("a",{href:"https://canonry.ai",children:"Canonry"})}),l.apiStatus.version&&l.apiStatus.version!=="unknown"?s.jsxs("span",{className:"footer-version",children:["v",l.apiStatus.version]}):null]}),s.jsx("div",{className:"footer-links",children:LP.map(({label:M,href:U,Icon:K})=>s.jsx("a",{href:U,target:"_blank",rel:"noopener noreferrer",title:M,"aria-label":M,className:"footer-icon",children:s.jsx(K,{className:"size-3.5"})},U))})]})]}),R?s.jsxs(Fae,{open:!0,title:R.summary,subtitle:`${R.projectName} · ${R.kindLabel}`,onClose:p,children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[s.jsx(Bv,{status:R.status}),s.jsx("span",{className:"text-zinc-400",children:R.startedAt}),s.jsx("span",{className:"text-zinc-500",children:R.duration}),s.jsx("span",{className:"text-zinc-600",children:R.triggerLabel})]}),R.status==="failed"&&R.statusDetail&&s.jsx("p",{className:"text-sm text-rose-300/80 mt-2",children:R.statusDetail}),s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-2",children:"Activity Log"}),_?s.jsx("p",{className:"text-sm text-zinc-500",children:"Loading run details..."}):C&&C.snapshots.length>0?s.jsxs("div",{className:"space-y-2",children:[C.snapshots.map(M=>s.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 p-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200 truncate",children:M.query??"Unknown query"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(oc,{provider:M.provider}),s.jsx(G3,{variant:M.citationState===Eh.cited?"success":"neutral",children:M.citationState})]})]}),M.model&&s.jsx("p",{className:"text-[11px] text-zinc-500 font-mono",children:M.model}),M.citedDomains.length>0&&s.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[s.jsx("span",{className:"text-zinc-400",children:"Sources:"})," ",M.citedDomains.join(", ")]}),M.competitorOverlap.length>0&&s.jsxs("p",{className:"text-xs text-rose-400/80 mt-0.5",children:["Competitor cited: ",M.competitorOverlap.join(", ")]}),M.groundingSources&&M.groundingSources.length>0&&s.jsxs("details",{className:"mt-2",children:[s.jsxs("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:[M.groundingSources.length," grounding source",M.groundingSources.length!==1?"s":""]}),s.jsx("ul",{className:"mt-1 space-y-0.5",children:M.groundingSources.map((U,K)=>s.jsx("li",{className:"text-xs text-zinc-500 truncate",children:s.jsx("a",{href:U.uri,target:"_blank",rel:"noopener noreferrer",className:"hover:text-zinc-300",children:U.title||U.uri})},K))})]}),M.answerText&&s.jsxs("details",{className:"mt-1",children:[s.jsx("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:"Answer preview"}),s.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed whitespace-pre-wrap",children:M.answerText})]})]},M.id)),C.status==="running"&&s.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Running remaining queries..."]})]}):C&&C.status==="running"?s.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Waiting for first query result..."]}):C&&C.status==="queued"?s.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-zinc-500 animate-pulse"}),"Run queued, waiting for execution slot..."]}):C&&C.error?s.jsxs("div",{className:"rounded-lg border border-rose-800/40 bg-rose-950/20 p-3",children:[s.jsx("p",{className:"text-sm font-medium text-rose-300 mb-2",children:"Run failed"}),s.jsx("pre",{className:"text-xs text-rose-300/80 whitespace-pre-wrap break-words max-h-48 overflow-y-auto font-mono leading-5",children:Fne(C.error)})]}):s.jsx("p",{className:"text-sm text-zinc-500",children:"No snapshot data available."})]})]}):null,$?s.jsx(Vae,{evidence:$.evidence,project:$.project,onClose:p}):null,s.jsx(wde,{}),s.jsx(Ese,{}),s.jsx(fde,{})]})}class jde extends x.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary]",t,n.componentStack)}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?s.jsx("div",{className:"page-container",children:s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-20 text-center",children:[s.jsx("div",{className:"rounded-full bg-rose-950/40 p-3",children:s.jsx(sy,{className:"size-6 text-rose-400"})}),s.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Something went wrong"}),s.jsx("p",{className:"text-sm text-zinc-400 max-w-md",children:this.state.error.message||"An unexpected error occurred while rendering this page."}),s.jsxs("div",{className:"flex gap-3 mt-2",children:[s.jsxs(pe,{variant:"secondary",size:"sm",onClick:this.handleReset,children:[s.jsx(x4,{className:"size-3.5 mr-1.5"}),"Try again"]}),s.jsx(pe,{variant:"secondary",size:"sm",onClick:()=>{const t=window.__CANONRY_CONFIG__?.basePath?.replace(/\/$/,"")??"";window.location.href=t||"/"},children:"Go home"})]})]})}):this.props.children}}const Pe=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ea("rounded-xl border border-zinc-800 bg-zinc-950/75 shadow-[0_0_0_1px_rgba(255,255,255,0.01)] backdrop-blur",e),...t}));Pe.displayName="Card";const T1=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ea("flex flex-col gap-1.5 p-5",e),...t}));T1.displayName="CardHeader";const P1=x.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ea("font-medium tracking-tight text-zinc-50",e),...t}));P1.displayName="CardTitle";const R1=x.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ea("text-sm text-zinc-500",e),...t}));R1.displayName="CardDescription";const $g=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ea("p-5 pt-0",e),...t}));$g.displayName="CardContent";function Nde({points:e,tone:t}){const n=x.useId();if(e.length===0)return null;const r=42,i=132,a=5,l=Math.min(...e),d=Math.max(...e)-l||1,f=i-a*2,p=r-a*2,m=e.map((y,v)=>{const w=a+v/Math.max(e.length-1,1)*f,b=a+(1-(y-l)/d)*p;return`${w},${b}`}).join(" ");return s.jsxs("svg",{className:`sparkline sparkline-${t}`,viewBox:`0 0 ${i} ${r}`,"aria-hidden":"true",children:[s.jsx("defs",{children:s.jsx("clipPath",{id:n,children:s.jsx("rect",{x:a,y:a,width:f,height:p,rx:"8"})})}),s.jsx("line",{className:"sparkline-guide",x1:a,x2:i-a,y1:r-a,y2:r-a}),s.jsx("polyline",{clipPath:`url(#${n})`,points:m,vectorEffect:"non-scaling-stroke"})]})}function kde({project:e}){return s.jsxs(Ot,{to:"/projects/$projectId",params:{projectId:e.project.id},className:"project-row cursor-pointer",children:[s.jsxs("div",{className:"project-row-primary",children:[s.jsxs("div",{children:[s.jsx("p",{className:"project-name",children:e.project.name}),s.jsx("p",{className:"project-domain",children:e.project.canonicalDomain})]}),s.jsx("p",{className:"project-insight",children:e.insight})]}),s.jsx("div",{className:"project-row-stat",children:s.jsxs("div",{className:"metric-inline-block",children:[s.jsx("p",{className:"metric-inline-label",children:"Answer Visibility"}),s.jsx("p",{className:`metric-inline-value ${e.visibilityTone==="caution"?"text-amber-400":""}`,children:e.visibilityScore}),s.jsx("p",{className:"metric-inline-delta",children:e.visibilityDelta}),e.providerCoverage&&s.jsx("p",{className:"text-[10px] font-medium text-amber-400/80",children:e.providerCoverage})]})}),s.jsx("div",{className:"project-row-stat",children:s.jsxs("div",{className:"metric-inline-block",children:[s.jsx("p",{className:"metric-inline-label",children:"Competitor Pressure"}),s.jsx("p",{className:"metric-inline-value",children:e.competitorPressureLabel}),s.jsxs("p",{className:"metric-inline-delta",children:[e.lastRun.kindLabel," · ",Iv(e.lastRun.status)]})]})}),s.jsx("div",{className:"project-row-chart",children:s.jsx(Nde,{points:e.trend,tone:k3(e.lastRun.status)})}),s.jsx("span",{className:"project-row-link",children:s.jsx(ep,{className:"h-4 w-4 text-zinc-500"})})]})}function Cde(){const e=tp(),{dashboard:t,isLoading:n}=kc(),r=t??e?.dashboard;if(!r||n)return s.jsxs("div",{className:"page-skeleton",children:[s.jsxs("div",{className:"page-skeleton-header",children:[s.jsx("div",{className:"skeleton-text h-6 w-32"}),s.jsx("div",{className:"skeleton-text-sm w-64"})]}),s.jsx("div",{className:"space-y-3",children:[1,2,3].map(p=>s.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-4 flex items-center gap-4",children:[s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"skeleton-text w-36"}),s.jsx("div",{className:"skeleton-text-sm w-48"})]}),s.jsx("div",{className:"skeleton-text w-16"}),s.jsx("div",{className:"skeleton-text w-16"}),s.jsx("div",{className:"skeleton h-8 w-20 rounded"})]},p))})]});const i=r.portfolioOverview,c=Vv(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},d=Yne(i.systemHealth,c,r.settings),{openRun:f}=jd();return s.jsxs("div",{className:"page-container",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-left",children:[s.jsx("h1",{className:"page-title",children:"Portfolio"}),s.jsx("p",{className:"page-subtitle",children:"Visibility and execution state across all projects"})]}),s.jsx("div",{className:"page-header-right",children:s.jsx("p",{className:"text-[11px] text-zinc-600",children:i.lastUpdatedAt})})]}),i.projects.length>0?s.jsx("div",{className:"project-list project-list-scrollable",children:i.projects.map(p=>s.jsx(kde,{project:p},p.project.id))}):s.jsxs(Pe,{className:"surface-card empty-card",children:[s.jsx("h3",{children:i.emptyState?.title??"No projects yet"}),s.jsx("p",{className:"supporting-copy",children:i.emptyState?.detail}),s.jsx(pe,{size:"sm",asChild:!0,children:s.jsx(Ot,{to:i.emptyState?.ctaHref==="/setup"||!i.emptyState?.ctaHref?"/setup":"/",children:i.emptyState?.ctaLabel??"Launch setup"})})]}),s.jsxs("div",{className:"overview-secondary-grid",children:[i.attentionItems.length>0&&s.jsxs("section",{className:"overview-secondary-section",children:[s.jsx("div",{className:"section-head section-head-inline",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Needs attention"}),s.jsx("h2",{className:"section-title-sm",children:"What changed"})]})}),s.jsx("div",{className:"attention-list attention-list-scrollable",children:i.attentionItems.map(p=>s.jsxs(Ot,{to:p.href,className:`attention-item attention-item-${p.tone}`,children:[s.jsxs("div",{children:[s.jsx("p",{className:"attention-title",children:p.title}),s.jsx("p",{className:"attention-detail",children:p.detail})]}),s.jsx("span",{className:"attention-action",children:p.actionLabel})]},p.id))})]}),s.jsxs("section",{className:"overview-secondary-section",children:[s.jsx("div",{className:"section-head section-head-inline",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"Recent runs"}),s.jsx("h2",{className:"section-title-sm",children:"Activity"})]})}),s.jsx("div",{className:"compact-stack compact-stack-scrollable",children:i.recentRuns.length>0?i.recentRuns.map(p=>s.jsxs("button",{className:"compact-run",type:"button",onClick:()=>f(p.id),children:[s.jsxs("div",{children:[s.jsx("p",{className:"compact-run-title",children:p.projectName}),s.jsx("p",{className:"compact-run-detail",children:p.summary})]}),s.jsx(Bv,{status:p.status})]},p.id)):s.jsx("p",{className:"supporting-copy",children:"Run history appears here after the first launch."})})]})]}),s.jsxs("section",{className:"page-section",children:[s.jsx("div",{className:"section-head section-head-inline",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:"System health"}),s.jsx("h2",{className:"section-title-sm",children:"Infrastructure"})]})}),s.jsx("div",{className:"health-grid",children:d.map(p=>s.jsxs(Pe,{className:"surface-card compact-card",children:[s.jsxs("div",{className:"section-head",children:[s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow eyebrow-soft",children:p.label}),s.jsx("h3",{children:p.detail})]}),s.jsx(st,{tone:p.tone,title:p.id==="api"?Qo(c.apiStatus):p.id==="worker"?Qo(c.workerStatus):void 0,children:p.label})]}),s.jsx("p",{className:"supporting-copy",children:p.meta})]},p.id))})]})]})}const oC=Symbol.for("yaml.alias"),D1=Symbol.for("yaml.document"),qo=Symbol.for("yaml.map"),vB=Symbol.for("yaml.pair"),Ha=Symbol.for("yaml.scalar"),Cd=Symbol.for("yaml.seq"),Yi=Symbol.for("yaml.node.type"),Ac=e=>!!e&&typeof e=="object"&&e[Yi]===oC,e0=e=>!!e&&typeof e=="object"&&e[Yi]===D1,ip=e=>!!e&&typeof e=="object"&&e[Yi]===qo,Tn=e=>!!e&&typeof e=="object"&&e[Yi]===vB,tn=e=>!!e&&typeof e=="object"&&e[Yi]===Ha,ap=e=>!!e&&typeof e=="object"&&e[Yi]===Cd;function On(e){if(e&&typeof e=="object")switch(e[Yi]){case qo:case Cd:return!0}return!1}function zn(e){if(e&&typeof e=="object")switch(e[Yi]){case oC:case qo:case Ha:case Cd:return!0}return!1}const xB=e=>(tn(e)||On(e))&&!!e.anchor,Rl=Symbol("break visit"),Ade=Symbol("skip children"),ph=Symbol("remove node");function Ad(e,t){const n=Ede(t);e0(e)?Mu(null,e.contents,n,Object.freeze([e]))===ph&&(e.contents=null):Mu(null,e,n,Object.freeze([]))}Ad.BREAK=Rl;Ad.SKIP=Ade;Ad.REMOVE=ph;function Mu(e,t,n,r){const i=Ode(e,t,n,r);if(zn(i)||Tn(i))return zde(e,r,i),Mu(e,i,n,r);if(typeof i!="symbol"){if(On(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){const l=Mu(a,t.items[a],n,r);if(typeof l=="number")a=l-1;else{if(l===Rl)return Rl;l===ph&&(t.items.splice(a,1),a-=1)}}}else if(Tn(t)){r=Object.freeze(r.concat(t));const a=Mu("key",t.key,n,r);if(a===Rl)return Rl;a===ph&&(t.key=null);const l=Mu("value",t.value,n,r);if(l===Rl)return Rl;l===ph&&(t.value=null)}}return i}function Ede(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ode(e,t,n,r){if(typeof n=="function")return n(e,t,r);if(ip(t))return n.Map?.(e,t,r);if(ap(t))return n.Seq?.(e,t,r);if(Tn(t))return n.Pair?.(e,t,r);if(tn(t))return n.Scalar?.(e,t,r);if(Ac(t))return n.Alias?.(e,t,r)}function zde(e,t,n){const r=t[t.length-1];if(On(r))r.items[e]=n;else if(Tn(r))e==="key"?r.key=n:r.value=n;else if(e0(r))r.contents=n;else{const i=Ac(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const _de={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Tde=e=>e.replace(/[!,[\]{}]/g,t=>_de[t]);class $r{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},$r.defaultYaml,t),this.tags=Object.assign({},$r.defaultTags,n)}clone(){const t=new $r(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new $r(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:$r.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},$r.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:$r.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},$r.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[a,l]=r;return this.tags[a]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const l=/^\d+\.\d+$/.test(a);return n(6,`Unsupported YAML version ${a}`,l),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const l=t.slice(2,-1);return l==="!"||l==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),l)}const[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const a=this.tags[r];if(a)try{return a+decodeURIComponent(i)}catch(l){return n(String(l)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+Tde(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let i;if(t&&r.length>0&&zn(t.contents)){const a={};Ad(t.contents,(l,c)=>{zn(c)&&c.tag&&(a[c.tag]=!0)}),i=Object.keys(a)}else i=[];for(const[a,l]of r)a==="!!"&&l==="tag:yaml.org,2002:"||(!t||i.some(c=>c.startsWith(l)))&&n.push(`%TAG ${a} ${l}`);return n.join(`
|
|
117
117
|
`)}}$r.defaultYaml={explicit:!1,version:"1.2"};$r.defaultTags={"!!":"tag:yaml.org,2002:"};function bB(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function wB(e){const t=new Set;return Ad(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function SB(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function Pde(e,t){const n=[],r=new Map;let i=null;return{onAnchor:a=>{n.push(a),i??(i=wB(e));const l=SB(t,i);return i.add(l),l},setAnchors:()=>{for(const a of n){const l=r.get(a);if(typeof l=="object"&&l.anchor&&(tn(l.node)||On(l.node)))l.node.anchor=l.anchor;else{const c=new Error("Failed to resolve repeated object (this should not happen)");throw c.source=a,c}}},sourceObjects:r}}function Iu(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,a=r.length;i<a;++i){const l=r[i],c=Iu(e,r,String(i),l);c===void 0?delete r[i]:c!==l&&(r[i]=c)}else if(r instanceof Map)for(const i of Array.from(r.keys())){const a=r.get(i),l=Iu(e,r,i,a);l===void 0?r.delete(i):l!==a&&r.set(i,l)}else if(r instanceof Set)for(const i of Array.from(r)){const a=Iu(e,r,i,i);a===void 0?r.delete(i):a!==i&&(r.delete(i),r.add(a))}else for(const[i,a]of Object.entries(r)){const l=Iu(e,r,i,a);l===void 0?delete r[i]:l!==a&&(r[i]=l)}return e.call(t,n,r)}function Vi(e,t,n){if(Array.isArray(e))return e.map((r,i)=>Vi(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!xB(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=a=>{r.res=a,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}class lC{constructor(t){Object.defineProperty(this,Yi,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){if(!e0(t))throw new TypeError("A document argument is required");const l={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Vi(this,"",l);if(typeof i=="function")for(const{count:d,res:f}of l.anchors.values())i(f,d);return typeof a=="function"?Iu(a,{"":c},"",c):c}}class cC extends lC{constructor(t){super(oC),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],Ad(t,{Node:(a,l)=>{(Ac(l)||xB(l))&&r.push(l)}}),n&&(n.aliasResolveCache=r));let i;for(const a of r){if(a===this)break;a.anchor===this.source&&(i=a)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:i,maxAliasCount:a}=n,l=this.resolve(i,n);if(!l){const d=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(d)}let c=r.get(l);if(c||(Vi(l,null,n),c=r.get(l)),c?.res===void 0){const d="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(d)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=Bg(i,l,r)),c.count*c.aliasCount>a)){const d="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(d)}return c.res}toString(t,n,r){const i=`*${this.source}`;if(t){if(bB(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${i} `}return i}}function Bg(e,t,n){if(Ac(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(On(t)){let r=0;for(const i of t.items){const a=Bg(e,i,n);a>r&&(r=a)}return r}else if(Tn(t)){const r=Bg(e,t.key,n),i=Bg(e,t.value,n);return Math.max(r,i)}return 1}const jB=e=>!e||typeof e!="function"&&typeof e!="object";class ut extends lC{constructor(t){super(Ha),this.value=t}toJSON(t,n){return n?.keep?this.value:Vi(this.value,t,n)}toString(){return String(this.value)}}ut.BLOCK_FOLDED="BLOCK_FOLDED";ut.BLOCK_LITERAL="BLOCK_LITERAL";ut.PLAIN="PLAIN";ut.QUOTE_DOUBLE="QUOTE_DOUBLE";ut.QUOTE_SINGLE="QUOTE_SINGLE";const Rde="tag:yaml.org,2002:";function Dde(e,t,n){if(t){const r=n.filter(a=>a.tag===t),i=r.find(a=>!a.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>r.identify?.(e)&&!r.format)}function Th(e,t,n){if(e0(e)&&(e=e.contents),zn(e))return e;if(Tn(e)){const m=n.schema[qo].createNode?.(n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:l,sourceObjects:c}=n;let d;if(r&&e&&typeof e=="object"){if(d=c.get(e),d)return d.anchor??(d.anchor=i(e)),new cC(d.anchor);d={anchor:null,node:null},c.set(e,d)}t?.startsWith("!!")&&(t=Rde+t.slice(2));let f=Dde(e,t,l.tags);if(!f){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new ut(e);return d&&(d.node=m),m}f=e instanceof Map?l[qo]:Symbol.iterator in Object(e)?l[Cd]:l[qo]}a&&(a(f),delete n.onTagObj);const p=f?.createNode?f.createNode(n.schema,e,n):typeof f?.nodeClass?.from=="function"?f.nodeClass.from(n.schema,e,n):new ut(e);return t?p.tag=t:f.default||(p.tag=f.tag),d&&(d.node=p),p}function by(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){const a=t[i];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){const l=[];l[a]=r,r=l}else r=new Map([[a,r]])}return Th(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const ih=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class NB extends lC{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>zn(r)||Tn(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(ih(t))this.add(n);else{const[r,...i]=t,a=this.get(r,!0);if(On(a))a.addIn(i,n);else if(a===void 0&&this.schema)this.set(r,by(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const i=this.get(n,!0);if(On(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...i]=t,a=this.get(r,!0);return i.length===0?!n&&tn(a)?a.value:a:On(a)?a.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Tn(n))return!1;const r=n.value;return r==null||t&&tn(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const i=this.get(n,!0);return On(i)?i.hasIn(r):!1}setIn(t,n){const[r,...i]=t;if(i.length===0)this.set(r,n);else{const a=this.get(r,!0);if(On(a))a.setIn(i,n);else if(a===void 0&&this.schema)this.set(r,by(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const Mde=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Cs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const ql=(e,t,n)=>e.endsWith(`
|
|
118
118
|
`)?Cs(n,t):n.includes(`
|
|
119
119
|
`)?`
|