@canonry/canonry 7.20.1 → 7.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/assets/assets/{AuditHistoryPanel-DVtz1ZuT.js → AuditHistoryPanel-BYZCeO6t.js} +1 -1
  2. package/assets/assets/{BacklinksPage-Tvt0-ppX.js → BacklinksPage-D-RyML4G.js} +1 -1
  3. package/assets/assets/{ChartPrimitives-CYlrwLJs.js → ChartPrimitives-CZ4wVBJL.js} +1 -1
  4. package/assets/assets/{HistoryPage-DqXwPH3k.js → HistoryPage-BfoWx1N3.js} +1 -1
  5. package/assets/assets/MeasurementPropertyPage-BPrHuw9O.js +4 -0
  6. package/assets/assets/ProjectPage-FEw-Mzmu.js +8 -0
  7. package/assets/assets/{RunsPage-Io7ZFw4-.js → RunsPage-D_ZVq2Ea.js} +1 -1
  8. package/assets/assets/{SettingsPage-BPYxgchP.js → SettingsPage-BRLmnDV9.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-CwffU3tv.js → SiteHealthSection-DxsZelde.js} +3 -3
  10. package/assets/assets/{TrafficPage-DIm60m1J.js → TrafficPage-BTewozzO.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-DWT1Ip5P.js → TrafficSourceDetailPage-CNGg4LvA.js} +1 -1
  12. package/assets/assets/{extract-error-message-BVYchXhT.js → extract-error-message-W9-nsUzb.js} +1 -1
  13. package/assets/assets/{index-DrQLR1jE.js → index-Bhgc-ydO.js} +2 -2
  14. package/assets/assets/{react-sigma_core.esm.min-f31sqfAC.js → react-sigma_core.esm.min-CvOFaKnp.js} +1 -1
  15. package/assets/assets/{v2-overview-adapter-By0930UY.js → v2-overview-adapter-BgCyNPPW.js} +1 -1
  16. package/assets/index.html +1 -1
  17. package/dist/{chunk-CIPWGVX6.js → chunk-BI2DDLU2.js} +1 -1
  18. package/dist/cli.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/package.json +7 -7
  21. package/assets/assets/MeasurementPropertyPage-CsbfFEjB.js +0 -4
  22. package/assets/assets/ProjectPage-Cyvt96AV.js +0 -8
@@ -1 +1 @@
1
- import{r as C,j as i}from"./vendor-tanstack-ZXXkndVj.js";import{$ as de,e8 as pe,B as me,aJ as W,e9 as m,ea as fe,eb as ge,ec as he,ed as ye,ee as be,ef as xe,eg as ke,eh as Ae,ei as Pe,ej as je,ek as Ne,el as Ce,em as ve,en as Me,eo as Ie,ep as Be,eq as $e,er as Se,es as De,et as we,eu as Ke,ev as Ee,y as f,b5 as Ve}from"./index-DrQLR1jE.js";import{M as Re}from"./vendor-markdown-B4giJcws.js";import{C as Te,$ as qe,g as ne}from"./vendor-lucide-Y6jANGfG.js";const tt="Sources",_={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function _e({previewLength:e,highlight:t}){return r=>{if(e!==void 0&&Number.isFinite(e)){let l=Math.max(0,Math.floor(e));const d={field:"value",omitted:!1},p=s=>{if(s.type==="definition")return!0;if(s.children)return s.children=s.children.filter(p),s.children.length>0;const a=s.type==="image"||s.type==="imageReference"?"alt":"value",h=s[a];if(h===void 0)return l>0;const k=Array.from(h);if(k.length===0)return l>0;if(l===0)return d.omitted=!0,!1;const v=k.length>l,j=k.slice(0,l);if(v&&!/\s/.test(k[l])){let y=j.length-1;for(;y>=0&&!/\s/.test(j[y]);)y--;y>=0&&y>l-40&&(j.length=y)}return d.omitted||=v,s[a]=j.join(""),l=v?0:l-j.length,j.length===0?!1:(d.lastNode=s,d.field=a,!0)};p(r),d.omitted&&(d.lastNode?d.lastNode[d.field]=`${d.lastNode[d.field].trimEnd()}…`:r.children?.push({type:"paragraph",children:[{type:"text",value:"…"}]}))}if(t){const l=d=>{["link","linkReference","code","inlineCode"].includes(d.type)||(d.type==="text"&&(d.data={...d.data,hName:"span"}),d.children?.forEach(l))};l(r)}}}function Ge({headingLevel:e}){return t=>{const r=[],l=p=>{p.type==="heading"&&p.depth&&r.push(p),p.children?.forEach(l)};l(t);const d=r.reduce((p,s)=>Math.min(p,s.depth),6);for(const p of r){const s=p.depth-d;p.depth=Math.min(6,e+s),p.data={...p.data,hProperties:{...p.data?.hProperties,"data-answer-heading-level":s+1}}}}}function Oe({answer:e}){const[t,r]=C.useState("idle"),l=C.useRef(!1),d=async()=>{if(!l.current){l.current=!0,r("copying");try{await navigator.clipboard.writeText(e),r("copied")}catch{r("failed")}finally{l.current=!1}}};return i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[i.jsx(me,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":t==="copying","aria-busy":t==="copying",onClick:()=>{d()},children:t==="copying"?_.copying:_.copy}),i.jsx("span",{role:"status",className:"text-sm text-secondary",children:t==="copied"?_.copied:t==="failed"?_.failed:""})]})}const nt=C.memo(function({children:t,headingLevel:r=4,copyable:l=!1,highlightGroups:d,previewLength:p}){return i.jsxs("div",{className:"answer-markdown",children:[i.jsx(Re,{remarkPlugins:[[Ge,{headingLevel:r}],[_e,{previewLength:p,highlight:!!d?.length}]],components:{p:({children:s})=>i.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:s}),ul:({children:s})=>i.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:s}),ol:({children:s,start:a})=>i.jsx("ol",{start:a,className:"mb-3 ml-5 list-decimal space-y-1",children:s}),pre:({children:s})=>i.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:s}),span:({children:s})=>i.jsx("span",{children:typeof s=="string"&&d?s.split(/(https?:\/\/[^\s<>]+)/i).map((a,h)=>h%2?a:i.jsx(C.Fragment,{children:pe(a,d)},h)):s}),a:({children:s,href:a})=>{const h=de(a);return h?i.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:s}):i.jsx("span",{children:s})},img:({alt:s})=>i.jsx("span",{children:s})},children:t}),l&&t.trim()?i.jsx(Oe,{answer:t},t):null]})}),re="min-h-11 w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",H="flex min-h-11 w-full items-center justify-between gap-3 rounded px-2 text-left text-sm text-primary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",K=e=>e.kind==="project"?"Whole site":e.label,E={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},Le=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,se=e=>`${e} ${e===1?"property":"properties"}`;function rt({options:e,selected:t,onSelect:r,marketKey:l,label:d="Measurement scope",labelVisibility:p="visible",allowGroupSelect:s=!0}){const a=[...e].sort((n,u)=>n.label.localeCompare(u.label,void 0,{numeric:!0})||n.id.localeCompare(u.id)),[h,k]=C.useState(""),[v,j]=C.useState([]),[y,I]=C.useState(!1),N=C.useRef(null),B=C.useRef(null),o=C.useId(),x=a.filter(n=>n.kind==="group"),b=new Map(x.map(n=>[n.id,n])),c=b.get(v.at(-1)??""),Y=b.get(v.at(-2)??""),P=h.trim().toLocaleLowerCase(),le=x.filter(n=>!n.parentGroupIds?.some(u=>b.has(u))),G=a.filter(n=>n.kind==="property"),O=n=>(n.parentGroupIds??[]).map(u=>b.get(u)?.label).filter(Boolean).join(" · "),V=n=>`${K(n)} ${O(n)}`.toLocaleLowerCase().includes(P),z=n=>{const u=[...n.parentGroupIds??[]],g=new Set;for(;u.length;){const M=u.pop();if(M===c?.id)return!0;g.has(M)||(g.add(M),u.push(...b.get(M)?.parentGroupIds??[]))}return!1},S=(y?[]:c?x.filter(n=>P?z(n):n.parentGroupIds?.includes(c.id)):P?x:le).filter(V),D=a.find(n=>n.kind==="market"&&n.id===(l??(t.kind==="market"?t.id:void 0))),Q=c&&D&&(c.marketKeys?.includes(D.id)||D.parentGroupIds?.includes(c.id))?D.id:void 0,L=s?Q??Le(c):void 0,U=(c?G.filter(n=>n.parentGroupIds?.includes(c.id)&&(!L||n.marketKeys?.includes(L))):P||y||x.length===0?G:[]).filter(V),J=a.filter(n=>n.kind!=="market"||y||!s&&!c&&!P&&x.length>0||s&&c?.marketKeys?.length===1&&!P?!1:(c?P?z(n):n.parentGroupIds?.includes(c.id):P||!n.parentGroupIds?.some(g=>b.has(g)))&&V(n)),Z=c||y?[]:a.filter(n=>n.kind==="project"&&V(n));C.useEffect(()=>{const n=u=>{N.current?.open&&u.target instanceof Node&&!N.current.contains(u.target)&&(N.current.open=!1)};return document.addEventListener("pointerdown",n),()=>document.removeEventListener("pointerdown",n)},[]);const ce=n=>{N.current&&(N.current.open=!1,N.current.querySelector("summary")?.focus());const u=s?n.kind==="property"?L:n.kind==="group"&&n.id===c?.id?Q:void 0:void 0;u?r(n,u):r(n)},R=n=>{const u=[];let g=b.get(n.parentGroupIds?.[0]??"");for(;g&&!u.includes(g.id)&&g.id!==n.id;)u.unshift(g.id),g=b.get(g.parentGroupIds?.[0]??"");return[...u,n.id]},ue=()=>{const n=t.kind==="group"?b.get(t.id):void 0,u=b.get(D?.parentGroupIds?.[0]??""),g=(t.parentGroupIds??[]).flatMap(w=>{const q=b.get(w);return q?[R(q)]:[]}),M=g.find(w=>w.at(-1)===c?.id)??g.sort((w,q)=>q.length-w.length)[0]??[],te=u?R(u):t.marketKeys?.length?[]:M;j(n?R(n):te),I(t.kind==="property"&&te.length===0&&x.length>0),k("")},X=n=>{j(R(n)),I(!1),k(""),B.current?.focus()},T=(n,u=K(n))=>i.jsxs("div",{className:"flex items-stretch",children:[i.jsxs("button",{type:"button",className:H,"aria-label":n.kind==="group"&&!s?E.browse(K(n)):E.select(K(n)),"aria-current":t.kind===n.kind&&t.id===n.id?"true":void 0,onClick:()=>n.kind==="group"&&!s?X(n):ce(n),children:[i.jsxs("span",{className:"min-w-0 break-words",children:[u,P&&O(n)?i.jsx("span",{className:"block text-[13px] text-secondary",children:O(n)}):null]}),i.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:n.kind==="market"?s?"Query context":"Market":n.kind==="property"?"Property":se(n.targetCount)})]}),s&&n.kind==="group"&&n.id!==c?.id&&a.some(g=>g.parentGroupIds?.includes(n.id))?i.jsx("button",{type:"button","aria-label":E.browse(n.label),title:`Browse ${n.label}`,className:"flex min-h-11 min-w-11 items-center justify-center rounded text-secondary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onClick:()=>X(n),children:i.jsx(ne,{size:18,"aria-hidden":"true"})}):null]},`${n.kind}:${n.id}`),F=(n,u)=>u.length>0?i.jsxs("section",{"aria-label":n,className:"mt-2",children:[i.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:n}),u.map(g=>T(g))]}):null,ee=(n,u,g)=>u.length>0?i.jsxs("details",{open:g,className:"mt-2 border-y border-default",children:[i.jsxs("summary",{className:"min-h-11 cursor-pointer px-2 py-3 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[n," (",u.length,")"]}),u.map(M=>T(M))]},`${c?.id??"root"}:${n}`):null;return i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{id:`${o}-label`,className:p==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:d}),i.jsxs("details",{ref:N,className:"relative",onToggle:n=>{n.target===n.currentTarget&&n.currentTarget.open&&B.current?.focus()},onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),n.currentTarget.open=!1,n.currentTarget.querySelector("summary")?.focus())},children:[i.jsxs("summary",{id:`${o}-value`,"aria-labelledby":`${o}-label ${o}-value`,className:`${re} visibility-scope-trigger`,onClick:()=>{N.current?.open||ue()},children:[`${K(t)}${t.kind==="group"?` · ${se(t.targetCount)}`:t.kind==="property"?` · ${a.find(n=>n.kind==="market"&&n.id===l)?.label??(t.marketKeys?.length?E.allMarkets:"Property")}`:t.kind==="market"?" · Market":""}`,i.jsx(Te,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),i.jsxs("div",{className:"visibility-scope-menu",children:[c||y?i.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[i.jsx("button",{type:"button",className:H,"aria-label":`Back to ${Y?.label??"all groups"}`,onClick:()=>{j(v.slice(0,-1)),I(!1),k(""),B.current?.focus()},children:i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(qe,{size:16,"aria-hidden":"true"}),Y?.label??"All groups"]})}),i.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:c?.label??"All properties"})]}):null,i.jsx("input",{ref:B,type:"search","aria-label":"Search scopes",className:re,placeholder:c?"Search within this group":y?"Search properties":"Search groups or properties",value:h,onChange:n=>k(n.target.value)}),i.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[s&&c&&!P?T(c,"All properties in this group"):null,Z.map(n=>T(n)),c&&!P?ee("Subgroups",S,!0):F(c?"Subgroups":"Groups",S),P?F("Properties",U):ee(c&&S.length>0?"All properties":"Properties",U,!c||S.length===0),F("Markets",J),!c&&!y&&!P&&x.length>0&&G.length>0?i.jsxs("button",{type:"button",className:`${H} mt-2 border-t border-default`,"aria-label":E.browseAll,onClick:()=>{I(!0),B.current?.focus()},children:[i.jsx("span",{children:"All properties"}),i.jsx(ne,{size:18,"aria-hidden":"true"})]}):null,P&&S.length+U.length+J.length+Z.length===0?i.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function oe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`web-${Date.now()}-${Math.random().toString(36).slice(2)}`}function A(e){return{"If-Match":e,"Idempotency-Key":oe()}}function st(e){return e instanceof W&&(e.statusCode===404||e.statusCode===409||e.statusCode===412)}function at(e,t){return e instanceof W?t:(e instanceof Error?e.message.trim():"")||t}function it(e){const t="Could not calculate assignment impact.";if(!(e instanceof W)||e.code!=="VALIDATION_ERROR")return t;const r=e.message.trim();return e.details?.displayToOperator===!0&&r?r:t}const ot={loadSetup:e=>m(()=>Ee({client:f,path:{name:e}})),loadDraft:e=>m(()=>Ke({client:f,path:{name:e}})),createDraft:(e,t)=>m(()=>we({client:f,path:{name:e},headers:{"Idempotency-Key":oe()},body:{expectedActiveRevision:t}})),importSitemap:(e,t,r)=>m(()=>De({client:f,path:{name:e},headers:A(t),body:r})),applySitemapSelection:(e,t,r,l)=>m(()=>Se({client:f,path:{name:e},headers:A(t),body:{selections:r,selectedTargetKeys:l}})),previewAssignments:(e,t)=>m(()=>$e({client:f,path:{name:e},body:t})),applyAssignments:(e,t,r)=>m(()=>Be({client:f,path:{name:e},headers:A(t),body:r})),replaceAssignments:(e,t,r)=>m(()=>Ie({client:f,path:{name:e},headers:A(t),body:r})),applyPairedAssignments:(e,t,r)=>m(()=>Me({client:f,path:{name:e},headers:A(t),body:{pairs:r}})),removeAssignment:(e,t,r,l)=>m(()=>ve({client:f,path:{name:e},headers:A(t),body:{targetKeys:r,queryId:l}})),excludeTarget:(e,t,r)=>m(()=>Ce({client:f,path:{name:e},headers:A(t),body:{targetKey:r,cleanup:"assignments-and-group-memberships"}})),upsertTarget:(e,t,r)=>m(()=>Ne({client:f,path:{name:e},headers:A(t),body:{target:r}})),upsertGroup:(e,t,r)=>m(()=>je({client:f,path:{name:e},headers:A(t),body:{group:r}})),removeGroup:(e,t,r)=>m(()=>Pe({client:f,path:{name:e},headers:A(t),body:{groupKey:r}})),upsertCompetitor:(e,t,r)=>m(()=>Ae({client:f,path:{name:e},headers:A(t),body:r})),removeCompetitor:(e,t,r,l)=>m(()=>ke({client:f,path:{name:e},headers:A(t),body:{groupKey:r,competitorKey:l}})),previewGroupMembership:(e,t)=>m(()=>xe({client:f,path:{name:e},body:t})),applyGroupMembership:(e,t,r)=>m(()=>be({client:f,path:{name:e},headers:A(t),body:r})),compilePreview:e=>m(()=>ye({client:f,path:{name:e}})),diffPreview:e=>m(()=>he({client:f,path:{name:e}})),publish:(e,t,r)=>m(()=>ge({client:f,path:{name:e},headers:A(t),body:r})),discard:(e,t)=>m(()=>fe({client:f,path:{name:e},headers:A(t)}))};function lt(e){const t=e[0];return t?e.every(r=>r.mode===t.mode&&r.scope.kind===t.scope.kind&&r.scope.key===t.scope.key&&r.queryClass===t.queryClass&&r.measurement.displayedRunId===t.measurement.displayedRunId):!0}function $(e){return e.state==="unavailable"?{numerator:null,denominator:null,reason:e.reason}:e.numerator===void 0||e.denominator===void 0||e.denominator<=0?{numerator:null,denominator:null,reason:"not_applicable"}:{numerator:e.numerator,denominator:e.denominator,...e.unattributed===void 0?{}:{unattributed:e.unattributed},...e.unchecked===void 0?{}:{unchecked:e.unchecked}}}function Ue(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function Fe(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function He(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function ae(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function We(e,t,r){const l=new Map;if(!t)return l;const d=new Map(e.usageEdges.map(a=>[ae(a),a.targetKey])),p=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),s=new Map(e.usageEdges.map(a=>[ae(a),p.get(`${a.targetKey}:${a.queryId}`)]));for(const a of t.evidence){if(r&&s.get(a.usageEdgeId)!==r)continue;const h=d.get(a.usageEdgeId);if(!h)continue;const k=l.get(h)??[];k.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:Fe(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:He(a.classification),historical:a.historical||a.bridged}),l.set(h,k)}return l}function Ye(e){if(e.flags>0)return{label:"Review",tone:"caution"};const t=[e.mentionCoverage,e.citationCoverage].filter(r=>r.state==="unavailable").map(r=>r.reason);return t.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:t.includes("plan_v1")?{label:"Update setup",tone:"caution"}:t.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:t.includes("identity_ambiguous")?{label:Ve.ambiguous,tone:"caution"}:t.includes("no_population")?{label:"No queries",tone:"neutral"}:t.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function ze(e){return e==="complete"?{label:"Complete",tone:"positive"}:e==="partial"?{label:"Partial",tone:"caution"}:e==="queued"?{label:"Queued",tone:"neutral"}:e==="running"?{label:"Running",tone:"neutral"}:e==="failed"?{label:"Failed",tone:"negative"}:{label:"Not measured",tone:"neutral"}}function Qe(e){if(!e)return"";const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function ie(e){const t=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${t} flagged ${t===1?"result needs":"results need"} review.`;if(e.nextAction.kind==="complete_setup")return"Finish setup.";if(e.nextAction.kind==="republish_setup")return"Setup update required.";if(e.nextAction.kind==="run_measurement")return"Ready to measure."}function ct({overview:e,activePlan:t,report:r,reportState:l=r?"ready":"loading",sort:d}){if(t.plan.schemaVersion!==2||e.mode!=="active-v2")throw new Error("The current overview requires an active version-two setup.");if(e.scope.kind!=="all"&&e.scope.kind!=="group")throw new Error("The current overview requires an All Properties or group scope.");const p=t.plan,s=new Map(p.targets.map(o=>[o.stableKey,o])),a=new Map(p.querySnapshots.map(o=>[o.queryId,o.queryText])),h=new Map;for(const o of p.assignments){if(e.queryClass!=="all"&&o.queryClass!==e.queryClass)continue;const x=a.get(o.queryId);if(!x)continue;const b=h.get(o.targetKey)??new Set;b.add(x),h.set(o.targetKey,b)}const k=r?.revision===t.revision&&r.run?.id===e.measurement.displayedRunId?r:null,v=e.measurement.displayedRunId===void 0||k?"ready":l==="error"||r!=null?"error":"loading",j=We(p,k,e.queryClass==="all"?void 0:e.queryClass),y=new Map;for(const o of p.groups)for(const x of o.targetKeys)y.has(x)||y.set(x,o.label);const I=e.properties.items.map(o=>{const x=s.get(o.targetKey),b=j.get(o.targetKey)??[];return{id:o.targetKey,name:o.label,mentionCoverage:$(o.mentionCoverage),citationCoverage:$(o.citationCoverage),status:Ye(o),providers:o.providers?.map(c=>({provider:c.provider,mentionCoverage:$(c.mentionCoverage),citationCoverage:$(c.citationCoverage)})),market:y.get(o.targetKey),assignedQueries:[...h.get(o.targetKey)??[]],urls:x?.urlMatchers.map(Ue)??[],evidence:b,evidenceState:v,historical:b.some(c=>c.historical)}}),N=e.namedShareOfVoice?.entries.map(o=>({name:o.label,coverage:{numerator:o.credits,denominator:e.namedShareOfVoice.denominator}})),B=e.properties.items.flatMap(o=>o.flags>0?[{id:`property:${o.targetKey}`,property:o.label,summary:`${o.flags} ${o.flags===1?"result needs":"results need"} review.`,tone:"caution",count:o.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:ze(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:Qe(e.measurement.completedAt),includesBridgedHistory:e.measurement.includesHistoricalData===!0},currentView:{scope:e.scope.kind==="group"?{kind:"group",...e.scope.key?{key:e.scope.key}:{}}:{kind:"all"},queryClass:e.queryClass,aggregate:{metrics:{propertiesMentioned:$(e.metrics.propertiesMentioned),mentionCoverage:$(e.metrics.mentionCoverage),citationCoverage:$(e.metrics.citationCoverage)},properties:I,...N?{shareOfVoice:N}:{}},propertyTotal:e.properties.totalEstimate??I.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...d?{sort:d}:{}},availableGroups:p.groups.map(o=>({id:o.stableKey,label:o.label})),...ie(e)?{nextActionText:ie(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:B}}export{nt as A,E as M,rt as V,tt as a,ot as b,it as c,lt as d,ct as e,st as i,Ue as m,at as s};
1
+ import{r as C,j as i}from"./vendor-tanstack-ZXXkndVj.js";import{$ as de,e8 as pe,B as me,aJ as W,e9 as m,ea as fe,eb as ge,ec as he,ed as ye,ee as be,ef as xe,eg as ke,eh as Ae,ei as Pe,ej as je,ek as Ne,el as Ce,em as ve,en as Me,eo as Ie,ep as Be,eq as $e,er as Se,es as De,et as we,eu as Ke,ev as Ee,y as f,b5 as Ve}from"./index-Bhgc-ydO.js";import{M as Re}from"./vendor-markdown-B4giJcws.js";import{C as Te,$ as qe,g as ne}from"./vendor-lucide-Y6jANGfG.js";const tt="Sources",_={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function _e({previewLength:e,highlight:t}){return r=>{if(e!==void 0&&Number.isFinite(e)){let l=Math.max(0,Math.floor(e));const d={field:"value",omitted:!1},p=s=>{if(s.type==="definition")return!0;if(s.children)return s.children=s.children.filter(p),s.children.length>0;const a=s.type==="image"||s.type==="imageReference"?"alt":"value",h=s[a];if(h===void 0)return l>0;const k=Array.from(h);if(k.length===0)return l>0;if(l===0)return d.omitted=!0,!1;const v=k.length>l,j=k.slice(0,l);if(v&&!/\s/.test(k[l])){let y=j.length-1;for(;y>=0&&!/\s/.test(j[y]);)y--;y>=0&&y>l-40&&(j.length=y)}return d.omitted||=v,s[a]=j.join(""),l=v?0:l-j.length,j.length===0?!1:(d.lastNode=s,d.field=a,!0)};p(r),d.omitted&&(d.lastNode?d.lastNode[d.field]=`${d.lastNode[d.field].trimEnd()}…`:r.children?.push({type:"paragraph",children:[{type:"text",value:"…"}]}))}if(t){const l=d=>{["link","linkReference","code","inlineCode"].includes(d.type)||(d.type==="text"&&(d.data={...d.data,hName:"span"}),d.children?.forEach(l))};l(r)}}}function Ge({headingLevel:e}){return t=>{const r=[],l=p=>{p.type==="heading"&&p.depth&&r.push(p),p.children?.forEach(l)};l(t);const d=r.reduce((p,s)=>Math.min(p,s.depth),6);for(const p of r){const s=p.depth-d;p.depth=Math.min(6,e+s),p.data={...p.data,hProperties:{...p.data?.hProperties,"data-answer-heading-level":s+1}}}}}function Oe({answer:e}){const[t,r]=C.useState("idle"),l=C.useRef(!1),d=async()=>{if(!l.current){l.current=!0,r("copying");try{await navigator.clipboard.writeText(e),r("copied")}catch{r("failed")}finally{l.current=!1}}};return i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[i.jsx(me,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":t==="copying","aria-busy":t==="copying",onClick:()=>{d()},children:t==="copying"?_.copying:_.copy}),i.jsx("span",{role:"status",className:"text-sm text-secondary",children:t==="copied"?_.copied:t==="failed"?_.failed:""})]})}const nt=C.memo(function({children:t,headingLevel:r=4,copyable:l=!1,highlightGroups:d,previewLength:p}){return i.jsxs("div",{className:"answer-markdown",children:[i.jsx(Re,{remarkPlugins:[[Ge,{headingLevel:r}],[_e,{previewLength:p,highlight:!!d?.length}]],components:{p:({children:s})=>i.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:s}),ul:({children:s})=>i.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:s}),ol:({children:s,start:a})=>i.jsx("ol",{start:a,className:"mb-3 ml-5 list-decimal space-y-1",children:s}),pre:({children:s})=>i.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:s}),span:({children:s})=>i.jsx("span",{children:typeof s=="string"&&d?s.split(/(https?:\/\/[^\s<>]+)/i).map((a,h)=>h%2?a:i.jsx(C.Fragment,{children:pe(a,d)},h)):s}),a:({children:s,href:a})=>{const h=de(a);return h?i.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:s}):i.jsx("span",{children:s})},img:({alt:s})=>i.jsx("span",{children:s})},children:t}),l&&t.trim()?i.jsx(Oe,{answer:t},t):null]})}),re="min-h-11 w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",H="flex min-h-11 w-full items-center justify-between gap-3 rounded px-2 text-left text-sm text-primary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",K=e=>e.kind==="project"?"Whole site":e.label,E={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},Le=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,se=e=>`${e} ${e===1?"property":"properties"}`;function rt({options:e,selected:t,onSelect:r,marketKey:l,label:d="Measurement scope",labelVisibility:p="visible",allowGroupSelect:s=!0}){const a=[...e].sort((n,u)=>n.label.localeCompare(u.label,void 0,{numeric:!0})||n.id.localeCompare(u.id)),[h,k]=C.useState(""),[v,j]=C.useState([]),[y,I]=C.useState(!1),N=C.useRef(null),B=C.useRef(null),o=C.useId(),x=a.filter(n=>n.kind==="group"),b=new Map(x.map(n=>[n.id,n])),c=b.get(v.at(-1)??""),Y=b.get(v.at(-2)??""),P=h.trim().toLocaleLowerCase(),le=x.filter(n=>!n.parentGroupIds?.some(u=>b.has(u))),G=a.filter(n=>n.kind==="property"),O=n=>(n.parentGroupIds??[]).map(u=>b.get(u)?.label).filter(Boolean).join(" · "),V=n=>`${K(n)} ${O(n)}`.toLocaleLowerCase().includes(P),z=n=>{const u=[...n.parentGroupIds??[]],g=new Set;for(;u.length;){const M=u.pop();if(M===c?.id)return!0;g.has(M)||(g.add(M),u.push(...b.get(M)?.parentGroupIds??[]))}return!1},S=(y?[]:c?x.filter(n=>P?z(n):n.parentGroupIds?.includes(c.id)):P?x:le).filter(V),D=a.find(n=>n.kind==="market"&&n.id===(l??(t.kind==="market"?t.id:void 0))),Q=c&&D&&(c.marketKeys?.includes(D.id)||D.parentGroupIds?.includes(c.id))?D.id:void 0,L=s?Q??Le(c):void 0,U=(c?G.filter(n=>n.parentGroupIds?.includes(c.id)&&(!L||n.marketKeys?.includes(L))):P||y||x.length===0?G:[]).filter(V),J=a.filter(n=>n.kind!=="market"||y||!s&&!c&&!P&&x.length>0||s&&c?.marketKeys?.length===1&&!P?!1:(c?P?z(n):n.parentGroupIds?.includes(c.id):P||!n.parentGroupIds?.some(g=>b.has(g)))&&V(n)),Z=c||y?[]:a.filter(n=>n.kind==="project"&&V(n));C.useEffect(()=>{const n=u=>{N.current?.open&&u.target instanceof Node&&!N.current.contains(u.target)&&(N.current.open=!1)};return document.addEventListener("pointerdown",n),()=>document.removeEventListener("pointerdown",n)},[]);const ce=n=>{N.current&&(N.current.open=!1,N.current.querySelector("summary")?.focus());const u=s?n.kind==="property"?L:n.kind==="group"&&n.id===c?.id?Q:void 0:void 0;u?r(n,u):r(n)},R=n=>{const u=[];let g=b.get(n.parentGroupIds?.[0]??"");for(;g&&!u.includes(g.id)&&g.id!==n.id;)u.unshift(g.id),g=b.get(g.parentGroupIds?.[0]??"");return[...u,n.id]},ue=()=>{const n=t.kind==="group"?b.get(t.id):void 0,u=b.get(D?.parentGroupIds?.[0]??""),g=(t.parentGroupIds??[]).flatMap(w=>{const q=b.get(w);return q?[R(q)]:[]}),M=g.find(w=>w.at(-1)===c?.id)??g.sort((w,q)=>q.length-w.length)[0]??[],te=u?R(u):t.marketKeys?.length?[]:M;j(n?R(n):te),I(t.kind==="property"&&te.length===0&&x.length>0),k("")},X=n=>{j(R(n)),I(!1),k(""),B.current?.focus()},T=(n,u=K(n))=>i.jsxs("div",{className:"flex items-stretch",children:[i.jsxs("button",{type:"button",className:H,"aria-label":n.kind==="group"&&!s?E.browse(K(n)):E.select(K(n)),"aria-current":t.kind===n.kind&&t.id===n.id?"true":void 0,onClick:()=>n.kind==="group"&&!s?X(n):ce(n),children:[i.jsxs("span",{className:"min-w-0 break-words",children:[u,P&&O(n)?i.jsx("span",{className:"block text-[13px] text-secondary",children:O(n)}):null]}),i.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:n.kind==="market"?s?"Query context":"Market":n.kind==="property"?"Property":se(n.targetCount)})]}),s&&n.kind==="group"&&n.id!==c?.id&&a.some(g=>g.parentGroupIds?.includes(n.id))?i.jsx("button",{type:"button","aria-label":E.browse(n.label),title:`Browse ${n.label}`,className:"flex min-h-11 min-w-11 items-center justify-center rounded text-secondary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onClick:()=>X(n),children:i.jsx(ne,{size:18,"aria-hidden":"true"})}):null]},`${n.kind}:${n.id}`),F=(n,u)=>u.length>0?i.jsxs("section",{"aria-label":n,className:"mt-2",children:[i.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:n}),u.map(g=>T(g))]}):null,ee=(n,u,g)=>u.length>0?i.jsxs("details",{open:g,className:"mt-2 border-y border-default",children:[i.jsxs("summary",{className:"min-h-11 cursor-pointer px-2 py-3 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[n," (",u.length,")"]}),u.map(M=>T(M))]},`${c?.id??"root"}:${n}`):null;return i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{id:`${o}-label`,className:p==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:d}),i.jsxs("details",{ref:N,className:"relative",onToggle:n=>{n.target===n.currentTarget&&n.currentTarget.open&&B.current?.focus()},onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),n.currentTarget.open=!1,n.currentTarget.querySelector("summary")?.focus())},children:[i.jsxs("summary",{id:`${o}-value`,"aria-labelledby":`${o}-label ${o}-value`,className:`${re} visibility-scope-trigger`,onClick:()=>{N.current?.open||ue()},children:[`${K(t)}${t.kind==="group"?` · ${se(t.targetCount)}`:t.kind==="property"?` · ${a.find(n=>n.kind==="market"&&n.id===l)?.label??(t.marketKeys?.length?E.allMarkets:"Property")}`:t.kind==="market"?" · Market":""}`,i.jsx(Te,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),i.jsxs("div",{className:"visibility-scope-menu",children:[c||y?i.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[i.jsx("button",{type:"button",className:H,"aria-label":`Back to ${Y?.label??"all groups"}`,onClick:()=>{j(v.slice(0,-1)),I(!1),k(""),B.current?.focus()},children:i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(qe,{size:16,"aria-hidden":"true"}),Y?.label??"All groups"]})}),i.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:c?.label??"All properties"})]}):null,i.jsx("input",{ref:B,type:"search","aria-label":"Search scopes",className:re,placeholder:c?"Search within this group":y?"Search properties":"Search groups or properties",value:h,onChange:n=>k(n.target.value)}),i.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[s&&c&&!P?T(c,"All properties in this group"):null,Z.map(n=>T(n)),c&&!P?ee("Subgroups",S,!0):F(c?"Subgroups":"Groups",S),P?F("Properties",U):ee(c&&S.length>0?"All properties":"Properties",U,!c||S.length===0),F("Markets",J),!c&&!y&&!P&&x.length>0&&G.length>0?i.jsxs("button",{type:"button",className:`${H} mt-2 border-t border-default`,"aria-label":E.browseAll,onClick:()=>{I(!0),B.current?.focus()},children:[i.jsx("span",{children:"All properties"}),i.jsx(ne,{size:18,"aria-hidden":"true"})]}):null,P&&S.length+U.length+J.length+Z.length===0?i.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function oe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`web-${Date.now()}-${Math.random().toString(36).slice(2)}`}function A(e){return{"If-Match":e,"Idempotency-Key":oe()}}function st(e){return e instanceof W&&(e.statusCode===404||e.statusCode===409||e.statusCode===412)}function at(e,t){return e instanceof W?t:(e instanceof Error?e.message.trim():"")||t}function it(e){const t="Could not calculate assignment impact.";if(!(e instanceof W)||e.code!=="VALIDATION_ERROR")return t;const r=e.message.trim();return e.details?.displayToOperator===!0&&r?r:t}const ot={loadSetup:e=>m(()=>Ee({client:f,path:{name:e}})),loadDraft:e=>m(()=>Ke({client:f,path:{name:e}})),createDraft:(e,t)=>m(()=>we({client:f,path:{name:e},headers:{"Idempotency-Key":oe()},body:{expectedActiveRevision:t}})),importSitemap:(e,t,r)=>m(()=>De({client:f,path:{name:e},headers:A(t),body:r})),applySitemapSelection:(e,t,r,l)=>m(()=>Se({client:f,path:{name:e},headers:A(t),body:{selections:r,selectedTargetKeys:l}})),previewAssignments:(e,t)=>m(()=>$e({client:f,path:{name:e},body:t})),applyAssignments:(e,t,r)=>m(()=>Be({client:f,path:{name:e},headers:A(t),body:r})),replaceAssignments:(e,t,r)=>m(()=>Ie({client:f,path:{name:e},headers:A(t),body:r})),applyPairedAssignments:(e,t,r)=>m(()=>Me({client:f,path:{name:e},headers:A(t),body:{pairs:r}})),removeAssignment:(e,t,r,l)=>m(()=>ve({client:f,path:{name:e},headers:A(t),body:{targetKeys:r,queryId:l}})),excludeTarget:(e,t,r)=>m(()=>Ce({client:f,path:{name:e},headers:A(t),body:{targetKey:r,cleanup:"assignments-and-group-memberships"}})),upsertTarget:(e,t,r)=>m(()=>Ne({client:f,path:{name:e},headers:A(t),body:{target:r}})),upsertGroup:(e,t,r)=>m(()=>je({client:f,path:{name:e},headers:A(t),body:{group:r}})),removeGroup:(e,t,r)=>m(()=>Pe({client:f,path:{name:e},headers:A(t),body:{groupKey:r}})),upsertCompetitor:(e,t,r)=>m(()=>Ae({client:f,path:{name:e},headers:A(t),body:r})),removeCompetitor:(e,t,r,l)=>m(()=>ke({client:f,path:{name:e},headers:A(t),body:{groupKey:r,competitorKey:l}})),previewGroupMembership:(e,t)=>m(()=>xe({client:f,path:{name:e},body:t})),applyGroupMembership:(e,t,r)=>m(()=>be({client:f,path:{name:e},headers:A(t),body:r})),compilePreview:e=>m(()=>ye({client:f,path:{name:e}})),diffPreview:e=>m(()=>he({client:f,path:{name:e}})),publish:(e,t,r)=>m(()=>ge({client:f,path:{name:e},headers:A(t),body:r})),discard:(e,t)=>m(()=>fe({client:f,path:{name:e},headers:A(t)}))};function lt(e){const t=e[0];return t?e.every(r=>r.mode===t.mode&&r.scope.kind===t.scope.kind&&r.scope.key===t.scope.key&&r.queryClass===t.queryClass&&r.measurement.displayedRunId===t.measurement.displayedRunId):!0}function $(e){return e.state==="unavailable"?{numerator:null,denominator:null,reason:e.reason}:e.numerator===void 0||e.denominator===void 0||e.denominator<=0?{numerator:null,denominator:null,reason:"not_applicable"}:{numerator:e.numerator,denominator:e.denominator,...e.unattributed===void 0?{}:{unattributed:e.unattributed},...e.unchecked===void 0?{}:{unchecked:e.unchecked}}}function Ue(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function Fe(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function He(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function ae(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function We(e,t,r){const l=new Map;if(!t)return l;const d=new Map(e.usageEdges.map(a=>[ae(a),a.targetKey])),p=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),s=new Map(e.usageEdges.map(a=>[ae(a),p.get(`${a.targetKey}:${a.queryId}`)]));for(const a of t.evidence){if(r&&s.get(a.usageEdgeId)!==r)continue;const h=d.get(a.usageEdgeId);if(!h)continue;const k=l.get(h)??[];k.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:Fe(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:He(a.classification),historical:a.historical||a.bridged}),l.set(h,k)}return l}function Ye(e){if(e.flags>0)return{label:"Review",tone:"caution"};const t=[e.mentionCoverage,e.citationCoverage].filter(r=>r.state==="unavailable").map(r=>r.reason);return t.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:t.includes("plan_v1")?{label:"Update setup",tone:"caution"}:t.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:t.includes("identity_ambiguous")?{label:Ve.ambiguous,tone:"caution"}:t.includes("no_population")?{label:"No queries",tone:"neutral"}:t.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function ze(e){return e==="complete"?{label:"Complete",tone:"positive"}:e==="partial"?{label:"Partial",tone:"caution"}:e==="queued"?{label:"Queued",tone:"neutral"}:e==="running"?{label:"Running",tone:"neutral"}:e==="failed"?{label:"Failed",tone:"negative"}:{label:"Not measured",tone:"neutral"}}function Qe(e){if(!e)return"";const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function ie(e){const t=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${t} flagged ${t===1?"result needs":"results need"} review.`;if(e.nextAction.kind==="complete_setup")return"Finish setup.";if(e.nextAction.kind==="republish_setup")return"Setup update required.";if(e.nextAction.kind==="run_measurement")return"Ready to measure."}function ct({overview:e,activePlan:t,report:r,reportState:l=r?"ready":"loading",sort:d}){if(t.plan.schemaVersion!==2||e.mode!=="active-v2")throw new Error("The current overview requires an active version-two setup.");if(e.scope.kind!=="all"&&e.scope.kind!=="group")throw new Error("The current overview requires an All Properties or group scope.");const p=t.plan,s=new Map(p.targets.map(o=>[o.stableKey,o])),a=new Map(p.querySnapshots.map(o=>[o.queryId,o.queryText])),h=new Map;for(const o of p.assignments){if(e.queryClass!=="all"&&o.queryClass!==e.queryClass)continue;const x=a.get(o.queryId);if(!x)continue;const b=h.get(o.targetKey)??new Set;b.add(x),h.set(o.targetKey,b)}const k=r?.revision===t.revision&&r.run?.id===e.measurement.displayedRunId?r:null,v=e.measurement.displayedRunId===void 0||k?"ready":l==="error"||r!=null?"error":"loading",j=We(p,k,e.queryClass==="all"?void 0:e.queryClass),y=new Map;for(const o of p.groups)for(const x of o.targetKeys)y.has(x)||y.set(x,o.label);const I=e.properties.items.map(o=>{const x=s.get(o.targetKey),b=j.get(o.targetKey)??[];return{id:o.targetKey,name:o.label,mentionCoverage:$(o.mentionCoverage),citationCoverage:$(o.citationCoverage),status:Ye(o),providers:o.providers?.map(c=>({provider:c.provider,mentionCoverage:$(c.mentionCoverage),citationCoverage:$(c.citationCoverage)})),market:y.get(o.targetKey),assignedQueries:[...h.get(o.targetKey)??[]],urls:x?.urlMatchers.map(Ue)??[],evidence:b,evidenceState:v,historical:b.some(c=>c.historical)}}),N=e.namedShareOfVoice?.entries.map(o=>({name:o.label,coverage:{numerator:o.credits,denominator:e.namedShareOfVoice.denominator}})),B=e.properties.items.flatMap(o=>o.flags>0?[{id:`property:${o.targetKey}`,property:o.label,summary:`${o.flags} ${o.flags===1?"result needs":"results need"} review.`,tone:"caution",count:o.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:ze(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:Qe(e.measurement.completedAt),includesBridgedHistory:e.measurement.includesHistoricalData===!0},currentView:{scope:e.scope.kind==="group"?{kind:"group",...e.scope.key?{key:e.scope.key}:{}}:{kind:"all"},queryClass:e.queryClass,aggregate:{metrics:{propertiesMentioned:$(e.metrics.propertiesMentioned),mentionCoverage:$(e.metrics.mentionCoverage),citationCoverage:$(e.metrics.citationCoverage)},properties:I,...N?{shareOfVoice:N}:{}},propertyTotal:e.properties.totalEstimate??I.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...d?{sort:d}:{}},availableGroups:p.groups.map(o=>({id:o.stableKey,label:o.label})),...ie(e)?{nextActionText:ie(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:B}}export{nt as A,E as M,rt as V,tt as a,ot as b,it as c,lt as d,ct as e,st as i,Ue as m,at as s};
package/assets/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-DrQLR1jE.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-Bhgc-ydO.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-ZXXkndVj.js">
17
17
  <link rel="modulepreload" crossorigin href="./assets/vendor-radix-twS1M3FF.js">
18
18
  <link rel="modulepreload" crossorigin href="./assets/vendor-recharts-D-cUuLZo.js">
@@ -8052,7 +8052,7 @@ function nonBlank(value) {
8052
8052
  return trimmed ? trimmed : void 0;
8053
8053
  }
8054
8054
  function resolveBuildCommit(env = process.env) {
8055
- const embedded = true ? "29f2d7cd1ba516a39c9321b0399aaa3b5311ef46" : void 0;
8055
+ const embedded = true ? "862ea148ee505a28998c70dd5739cdeb18fb4273" : void 0;
8056
8056
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
8057
8057
  }
8058
8058
  function resolveInstanceIdentity(env = process.env) {
package/dist/cli.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  trackCliCommandFinished,
36
36
  trackEvent,
37
37
  waitForServerRuntimeStartup
38
- } from "./chunk-CIPWGVX6.js";
38
+ } from "./chunk-BI2DDLU2.js";
39
39
  import {
40
40
  autoSyncSkills,
41
41
  formatAutoSyncNotice
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createGoogleMarketingCredentialStore,
4
4
  createGoogleMarketingRuntime,
5
5
  createServer
6
- } from "./chunk-CIPWGVX6.js";
6
+ } from "./chunk-BI2DDLU2.js";
7
7
  import {
8
8
  loadConfig
9
9
  } from "./chunk-NDQOCFJQ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonry/canonry",
3
- "version": "7.20.1",
3
+ "version": "7.21.0",
4
4
  "type": "module",
5
5
  "description": "Self-hosted AI visibility (AEO) platform: track how ChatGPT, Claude, Gemini, and Perplexity cite your domain, join it with Search Console, GA4, server-side traffic, and paid media, and fix what you find through agent tools (CLI, REST, MCP). Local SQLite.",
6
6
  "keywords": [
@@ -91,27 +91,27 @@
91
91
  "@ainyc/canonry-contracts": "0.0.0",
92
92
  "@ainyc/canonry-db": "0.0.0",
93
93
  "@ainyc/canonry-config": "0.0.0",
94
- "@ainyc/canonry-integration-cloud-run": "0.0.0",
95
94
  "@ainyc/canonry-integration-bing": "0.0.0",
95
+ "@ainyc/canonry-integration-cloud-run": "0.0.0",
96
96
  "@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
97
97
  "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
98
98
  "@ainyc/canonry-integration-commoncrawl": "0.0.0",
99
- "@ainyc/canonry-integration-google-business-profile": "0.0.0",
99
+ "@ainyc/canonry-integration-google": "0.0.0",
100
100
  "@ainyc/canonry-integration-google-ads": "0.0.0",
101
101
  "@ainyc/canonry-integration-google-places": "0.0.0",
102
+ "@ainyc/canonry-integration-google-business-profile": "0.0.0",
102
103
  "@ainyc/canonry-integration-google-tag-manager": "0.0.0",
103
104
  "@ainyc/canonry-integration-traffic": "0.0.0",
104
- "@ainyc/canonry-integration-openai-ads": "0.0.0",
105
105
  "@ainyc/canonry-integration-wordpress": "0.0.0",
106
- "@ainyc/canonry-integration-google": "0.0.0",
107
- "@ainyc/canonry-provider-claude": "0.0.0",
106
+ "@ainyc/canonry-integration-openai-ads": "0.0.0",
108
107
  "@ainyc/canonry-intelligence": "0.0.0",
108
+ "@ainyc/canonry-provider-claude": "0.0.0",
109
109
  "@ainyc/canonry-provider-cdp": "0.0.0",
110
110
  "@ainyc/canonry-provider-gemini": "0.0.0",
111
+ "@ainyc/canonry-provider-muse": "0.0.0",
111
112
  "@ainyc/canonry-provider-local": "0.0.0",
112
113
  "@ainyc/canonry-provider-openai": "0.0.0",
113
114
  "@ainyc/canonry-provider-perplexity": "0.0.0",
114
- "@ainyc/canonry-provider-muse": "0.0.0",
115
115
  "@ainyc/canonry-integration-typesafe": "0.0.0"
116
116
  },
117
117
  "scripts": {
@@ -1,4 +0,0 @@
1
- import{r as p,u as G,o as Ue,j as e,L as Z,D as Ke,k as Qe,l as Ve,C as Me}from"./vendor-tanstack-ZXXkndVj.js";import{dY as De,dZ as He,d_ as We,d$ as ze,e0 as Ge,X as Te,e1 as Ye,b9 as Ze,y as V,cM as Xe,I,B as w,aB as Je,cv as es,cT as ss,co as ts,cm as as,cH as ns,cC as pe,e2 as rs,e3 as Le,e4 as Re,T as Q,aS as ye,aT as be,cZ as oe,e5 as is,bX as os,e6 as ls,e7 as ds,k as $e,s as cs,f as ke,b7 as Ie}from"./index-DrQLR1jE.js";import{j as hs,o as ms}from"./ChartPrimitives-CYlrwLJs.js";import{i as us,b as xs,m as ps,a as Be,M as fs,A as gs}from"./v2-overview-adapter-By0930UY.js";import{Z as js}from"./vendor-lucide-Y6jANGfG.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";function ys(s){return s.normalize("NFKC").toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]}function ve(s){return ys(s).join("\0")}function bs(s,t){const a=ve(s);return t.map(ve).filter(Boolean).some(n=>n!==a&&`\0${a}\0`.includes(`\0${n}\0`))}const _e=Ge,X={short:"target-name-short",withoutBrand:"target-name-without-brand",qualifiedWithoutName:"target-qualified-name-without-name"};function vs(s){const t=De(s.brandNames),a=t.length>0?He(t):null,n=[];return s.aliases.forEach((i,u)=>{i.trim()&&(We(i).length<_e?n.push({code:X.short,field:"aliases",index:u,value:i}):a!==null&&!ze(a,i)&&n.push({code:X.withoutBrand,field:"aliases",index:u,value:i}))}),s.identityAliases?.forEach((i,u)=>{i.trim()&&(bs(i,s.aliases)||n.push({code:X.qualifiedWithoutName,field:"identityAliases",index:u,value:i}))}),n}function Ns(s){switch(s.code){case X.short:return`"${s.value.trim()}" is too short to match safely. A name needs at least ${_e} letters or numbers, or it can match unrelated words in an answer.`;case X.withoutBrand:return`"${s.value.trim()}" does not include your brand name, so answers about other places with this name can count for this property.`;case X.qualifiedWithoutName:return`"${s.value.trim()}" must include one of this property's names plus more words, such as a street or city. Publishing is refused until it does.`}}const x={heading:"Names that count as this Property",help:"An answer mentions this Property when its text contains one of these names as whole words. Source titles and source links never count, but a link in the answer whose text is one of these names does. Qualified names are longer forms, such as the name with its street or city, for a name that other places share.",names:"Names",qualifiedNames:"Qualified names",noNames:"No names are set, so answers can cite this Property but never mention it.",edit:"Edit names",save:"Save to draft",saving:"Saving…",cancel:"Cancel",namesHint:"One name per line.",qualifiedHint:"One per line. Each must include one of the names above plus more words, such as a street or city.",qualifiedNote:"With qualified names set, an answer that uses only a plain name counts as a mention only when it also cites this Property’s own page. Otherwise it is left out as not tied to one property.",draftOnly:"Saving changes the draft only. Nothing is measured differently until the setup is published.",saved:"Saved to the draft. Publish the setup to start using these names.",pending:"Name changes are saved in the draft and not published yet.",review:"Review and publish",noChanges:"No changes to save.",staleDraft:"The draft is based on an older published setup. Open measurement setup to restart it before editing names.",missingFromDraft:"This Property is not included in the current draft. Open measurement setup to review it.",conflict:"The draft changed in another session. The latest names are loaded; review them and save again.",failed:"Could not save these names. Try again."};function Ne(s){return[...new Set(s.split(`
2
- `).map(t=>t.trim()).filter(Boolean))]}function we(s,t){return s.length===t.length&&s.every((a,n)=>a===t[n])}function te(s,t){return we(s.aliases,t.aliases)&&we(s.identityAliases??[],t.identityAliases??[])}function ws(s,t,a){const{identityAliases:n,...i}=s;return a.length>0?{...i,aliases:t,identityAliases:a}:{...i,aliases:t}}function Pe({label:s,names:t}){return e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium text-heading",children:s}),e.jsx("ul",{className:"space-y-1",children:t.map(a=>e.jsx("li",{className:"text-sm text-secondary",children:a},a))})]})}function Ce({id:s,issues:t}){return t.length===0?null:e.jsx("ul",{id:s,className:"mt-2 space-y-1","aria-label":"Name warnings",children:t.map(a=>e.jsx("li",{className:"text-sm text-caution",children:Ns(a)},`${a.field}:${a.index}`))})}function Ps({projectName:s,targetKey:t,published:a,activeRevision:n,publishedBrandNames:i,service:u=xs}){const{canWrite:h}=Te(),r=p.useId(),l=G({...Ye({client:V,path:{name:s}}),enabled:h}),B=G({...Ze({client:V,path:{name:s}}),enabled:h}),S=l.data?.draft?.authoring.targets.find(d=>d.stableKey===t),q=a.identityAliases??[],F=S!==void 0&&l.data?.draft?.baseActiveRevision===n&&!te(S,a),L=!l.isFetching&&!B.isPending,m=B.data,A=p.useMemo(()=>m?Xe(m):i,[m,i]),[P,R]=p.useState(!1),[c,y]=p.useState(""),[M,D]=p.useState(""),[J,v]=p.useState(a),[C,k]=p.useState(null),_=`${s}\0${t}`,[H,he]=p.useState(_);H!==_&&(he(_),R(!1),y(""),D(""),v(a),k(null));const ee=p.useRef(_);ee.current=_;const O=p.useMemo(()=>Ne(c),[c]),g=p.useMemo(()=>Ne(M),[M]),W=p.useMemo(()=>vs({aliases:O,identityAliases:g,brandNames:A}),[O,g,A]),j=W.filter(d=>d.field==="aliases"),ae=W.filter(d=>d.field==="identityAliases");function U(d){y(d.aliases.join(`
3
- `)),D((d.identityAliases??[]).join(`
4
- `)),v({aliases:[...d.aliases],identityAliases:[...d.identityAliases??[]]})}function ne(d){return d.draft?d.draft.authoring.targets.find(E=>E.stableKey===t)??null:a}function me(){U(F?S:a),k(null),R(!0)}function se(d){d&&U(d),k({tone:"negative",text:x.conflict,review:!1})}const z=Ue({mutationFn:async d=>{let E=await u.loadDraft(s);if(!E.draft){if(te(d.names,a))return{outcome:"unchanged"};if(!te(d.base,a))return{outcome:"conflict",latest:a};await u.createDraft(s,n),E=await u.loadDraft(s)}const K=E.draft;if(!K||!E.etag)throw new Error(x.failed);if(K.baseActiveRevision!==n)return{outcome:"stale"};const $=K.authoring.targets.find(ue=>ue.stableKey===t);return!$||$.status!=="included"?{outcome:"missing"}:te(d.names,$)?{outcome:"unchanged"}:te(d.base,$)?(await u.upsertTarget(s,E.etag,ws($,d.names.aliases,d.names.identityAliases)),{outcome:"saved"}):{outcome:"conflict",latest:$}},meta:{skipGlobalErrorToast:!0},onSuccess:(d,E)=>{if(E.openFor===ee.current)switch(d.outcome){case"saved":R(!1),k({tone:"positive",text:x.saved,review:!0});return;case"unchanged":R(!1),k({tone:"positive",text:x.noChanges,review:!1});return;case"stale":k({tone:"negative",text:x.staleDraft,review:!0});return;case"missing":k({tone:"negative",text:x.missingFromDraft,review:!0});return;case"conflict":se(d.latest),l.refetch();return}},onError:(d,E)=>{if(E.openFor===ee.current){if(us(d)){se(null),l.refetch().then(K=>{K.isSuccess&&se(ne(K.data))});return}k({tone:"negative",text:x.failed,review:!1})}}}),re=e.jsx(Z,{to:"/projects/$projectName/portfolio",params:{projectName:s},className:"text-link underline-offset-2 hover:underline",children:x.review}),T=a.aliases.length+q.length;return e.jsxs("section",{"aria-labelledby":"property-names",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("h2",{id:"property-names",className:"text-base font-semibold text-heading",children:x.heading}),e.jsx(I,{text:x.help})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("p",{className:"supporting-copy",children:[T," ",T===1?"name":"names"]}),h&&!P?e.jsx(w,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",disabled:!L,onClick:me,children:x.edit}):null]})]}),C?e.jsxs("p",{role:C.tone==="negative"?"alert":"status",className:`mb-3 text-sm ${C.tone==="negative"?"text-negative":"text-positive"}`,children:[C.text,C.review?e.jsxs(e.Fragment,{children:[" ",re]}):null]}):F&&!P?e.jsxs("p",{role:"status",className:"mb-3 text-sm text-caution",children:[x.pending," ",re]}):null,P?e.jsxs("form",{className:"space-y-4","aria-label":"Edit names",onSubmit:d=>{d.preventDefault(),!z.isPending&&z.mutate({names:{aliases:O,identityAliases:g},base:J,openFor:_})},children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:`${r}-names`,className:"block text-sm font-medium text-heading",children:x.names}),e.jsx("p",{id:`${r}-names-hint`,className:"text-sm text-secondary",children:x.namesHint}),e.jsx("textarea",{id:`${r}-names`,className:"mt-1 min-h-24 w-full rounded-md border border-strong bg-transparent px-3 py-2 text-sm text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400","aria-describedby":`${r}-names-hint${j.length?` ${r}-names-issues`:""}`,value:c,onChange:d=>y(d.target.value)}),e.jsx(Ce,{id:`${r}-names-issues`,issues:j}),O.length===0?e.jsx("p",{className:"mt-2 text-sm text-caution",children:x.noNames}):null]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:`${r}-qualified`,className:"block text-sm font-medium text-heading",children:x.qualifiedNames}),e.jsx("p",{id:`${r}-qualified-hint`,className:"text-sm text-secondary",children:x.qualifiedHint}),e.jsx("textarea",{id:`${r}-qualified`,className:"mt-1 min-h-20 w-full rounded-md border border-strong bg-transparent px-3 py-2 text-sm text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400","aria-describedby":`${r}-qualified-hint ${r}-qualified-note${ae.length?` ${r}-qualified-issues`:""}`,value:M,onChange:d=>D(d.target.value)}),e.jsx(Ce,{id:`${r}-qualified-issues`,issues:ae}),e.jsx("p",{id:`${r}-qualified-note`,className:"mt-2 max-w-3xl text-sm text-secondary",children:x.qualifiedNote})]}),e.jsx("p",{className:"text-sm text-secondary",children:x.draftOnly}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(Je,{type:"submit",className:"h-11 px-4 text-sm md:h-11",disabled:z.isPending,children:z.isPending?x.saving:x.save}),e.jsx(w,{type:"button",variant:"ghost",className:"h-11 px-4 text-sm md:h-11",disabled:z.isPending,onClick:()=>{R(!1),k(null)},children:x.cancel})]})]}):T===0?e.jsx("p",{className:"text-sm text-secondary",children:x.noNames}):e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.aliases.length>0?e.jsx(Pe,{label:x.names,names:a.aliases}):null,q.length>0?e.jsx(Pe,{label:x.qualifiedNames,names:q}):null]})]})}const le=50,b={branded:{headline:"When they know your name",technical:"Branded queries"},"non-brand":{headline:"When they don't",technical:"Non-brand queries"}},Cs={plan_v1:"Setup update required",no_completed_run:"No completed measurement yet",no_population:"No queries of this type are assigned",evidence_incomplete:"Source evidence is incomplete",identity_ambiguous:os,not_applicable:"Not applicable for this Property"},Ee={complete:{label:"Measured",tone:"positive"},partial:{label:"Partly measured",tone:"caution"},running:{label:"Measuring now",tone:"neutral"},queued:{label:"Measurement queued",tone:"neutral"},failed:{label:"Measurement failed",tone:"negative"},not_measured:{label:"Not measured",tone:"neutral"}},Se={assigned:{label:"Matches this Property",tone:"positive"},sibling:{label:"Matches another Property",tone:"caution"},ownedUnmapped:{label:"Site URL not in a Property",tone:"caution"},external:{label:"External URL",tone:"neutral"},ambiguous:{label:"Matches multiple Properties",tone:"caution"},invalid:{label:"Invalid URL",tone:"negative"}};function Es(s){return[...s].sort((t,a)=>+(a.classification==="assigned")-+(t.classification==="assigned"))}function Ss(s){return`${s.expectedSlotId}:${s.usageEdgeId}`}function qs({row:s}){return s.mentioned===null?e.jsxs("span",{className:"inline-flex flex-col items-start gap-0.5",children:[e.jsx(Q,{tone:"neutral",children:"Not measured"}),e.jsx("span",{className:"text-xs text-muted",children:"No mention signal for this Property"})]}):e.jsx(Q,{tone:s.mentioned?"positive":"neutral",children:s.mentioned?"Mentioned":"Not mentioned"})}const As="—";function Ms({row:s}){return s.cited===null?e.jsxs("span",{className:"inline-flex flex-col items-start gap-0.5",children:[e.jsx(Q,{tone:"neutral",children:"Not measured"}),e.jsx("span",{className:"text-xs text-muted",children:"Sources were not fully captured"})]}):e.jsx(Q,{tone:s.cited?"positive":"neutral",children:s.cited?"Cited":"Not cited"})}function Ts({row:s}){return s.cited===null&&s.sources.length===0?e.jsx("p",{className:"py-2 text-sm text-secondary",children:"The sources for this answer were not fully captured, so none can be shown."}):s.sources.length===0?e.jsx("p",{className:"py-2 text-sm text-secondary",children:"This answer returned no source URLs at all."}):e.jsxs("details",{className:"mt-2","data-answer-sources":!0,children:[e.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-sm text-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[Be," (",s.sources.length,")"]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"evidence-table min-w-[420px]",children:[e.jsxs("caption",{className:"sr-only",children:["Source URLs for ",s.queryText]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Match"}),e.jsx("th",{children:"URL"})]})}),e.jsx("tbody",{children:Es(s.sources).map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(Q,{tone:Se[t.classification].tone,children:Se[t.classification].label})}),e.jsx("td",{children:e.jsx($e,{url:t.sourceUrl})})]},t.sourceUrl))})]})})]})}function Oe({project:s,targetKey:t,resultId:a}){const n=G({...ds({client:V,path:{name:s},query:{targetKey:t,resultId:a}})});if(n.isPending)return e.jsx("p",{className:"py-2 text-sm text-secondary",role:"status","aria-live":"polite",children:"Loading the answer…"});if(n.isError)return e.jsx("p",{className:"py-2 text-sm text-secondary",role:"alert",children:"Could not load this answer."});const i=n.data?.answer;return i==null||i.trim()===""?e.jsx("p",{className:"py-2 text-sm text-secondary",children:"This answer was measured, but its text was not stored."}):e.jsx("div",{className:"py-2",children:e.jsx(gs,{headingLevel:4,copyable:!0,children:i})})}function ce(s){return Cs[s.reason]??"Not measured"}function de({metric:s,signal:t,emphasis:a=!1}){if(s.state==="unavailable")return e.jsxs("span",{className:"inline-flex flex-col gap-0.5",children:[e.jsx("span",{className:a?"text-lg font-semibold text-secondary":"text-sm font-medium text-secondary",children:"Not measured"}),e.jsx("span",{className:"text-sm text-secondary",children:ce(s)})]});const n=ke(s.value),i=s.numerator===void 0||s.denominator===void 0?null:`${s.numerator} of ${s.denominator}`,u=Ie(s,t);return e.jsxs("span",{className:"inline-flex flex-col gap-0.5 tabular-nums",children:[e.jsx("span",{className:a?"text-lg font-semibold text-heading":"text-sm font-medium text-primary",children:n}),i?e.jsx("span",{className:"text-xs text-muted",children:i}):null,u?e.jsx("span",{className:"text-xs text-muted",children:u}):null]})}function qe(s,t,a){return is({client:V,path:{name:s},query:{scope:"property",targetKey:t,queryClass:a}})}function Ae(s){return s?.properties.items.at(0)}function Ls({measuredAt:s,unmeasuredReason:t,queryClass:a}){const n=s===void 0?null:s===null?"No completed sweep yet":`Measured ${hs(ms(s))}`;return n===null&&t===void 0?null:e.jsxs("p",{className:"supporting-copy",children:[[n,t].filter(Boolean).join(" · "),n!==null&&t===void 0?` · ${b[a].technical.toLocaleLowerCase()} only`:""]})}function Rs({project:s,groups:t}){return t.length===0?null:e.jsxs("section",{"aria-labelledby":"property-market",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Competitive comparison"}),e.jsxs("h2",{id:"property-market",className:"text-base font-semibold text-heading",children:["Measured at the market level",e.jsx(I,{text:"Competitors are attached to a market rather than to a single Property, because one building has nobody to be compared against. Share of voice and competitor pressure are reported for the market this Property sits in."})]})]}),e.jsx(w,{asChild:!0,type:"button",size:"sm",variant:"outline",children:e.jsx(Z,{to:"/projects/$projectName",params:{projectName:s},search:a=>pe(oe(a),{measurementScope:"project"}),children:"Open measurement overview"})})]}),e.jsx("ul",{className:"flex flex-wrap gap-2",children:t.map(a=>e.jsxs("li",{className:"rounded-md border border-default px-3 py-1.5 text-sm text-strong",children:[a.label,e.jsxs("span",{className:"ml-2 text-xs text-muted",children:[a.competitors.length," ",a.competitors.length===1?"competitor":"competitors"]})]},a.stableKey))})]})}function ie({label:s,metric:t,signal:a,failed:n=!1}){if(t===void 0)return e.jsxs("div",{className:"aeo-hero-row",children:[e.jsx("p",{className:"aeo-hero-row-label",children:s}),e.jsx("p",{className:"aeo-hero-row-value text-base font-semibold text-secondary",children:n?"Unavailable":"…"}),n?e.jsx("div",{}):e.jsx("div",{className:"aeo-hero-row-bar","aria-hidden":"true"}),e.jsx("p",{className:"aeo-hero-row-detail",children:n?"Could not be loaded":"Loading"})]});if(t.state==="unavailable"){const l=ce(t);return e.jsxs("div",{className:"aeo-hero-row",children:[e.jsx("p",{className:"aeo-hero-row-label",children:s}),e.jsx("p",{className:"aeo-hero-row-value text-base font-semibold text-secondary",children:"Not measured"}),e.jsx("div",{}),e.jsx("p",{className:"aeo-hero-row-detail",children:l==="Not measured"?"":l})]})}const{figure:i,sign:u}=cs(ke(t.value)),h=t.numerator===void 0||t.denominator===void 0?null:`${t.numerator} of ${t.denominator}`,r=Ie(t,a);return e.jsxs("div",{className:"aeo-hero-row",children:[e.jsx("p",{className:"aeo-hero-row-label",children:s}),e.jsxs("p",{className:"aeo-hero-row-value text-heading",children:[i,u?e.jsx("span",{className:"text-faint",children:u}):null]}),e.jsx("div",{className:"aeo-hero-row-bar","aria-hidden":"true",children:e.jsx("div",{className:"metric-card-bar-fill progress-fill-neutral",style:{width:`${t.value*100}%`}})}),e.jsxs("p",{className:"aeo-hero-row-detail tabular-nums",children:[h??"",r?e.jsx("span",{className:"block",children:r}):null]})]})}function $s({branded:s,nonBrand:t,brandedFailed:a=!1,nonBrandFailed:n=!1}){return e.jsxs("section",{"aria-labelledby":"property-coverage-hero",children:[e.jsx("h2",{id:"property-coverage-hero",className:"sr-only",children:"Coverage for this Property"}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Non-brand · the demand to earn"}),e.jsx(ie,{label:"Mentioned",metric:t?.mentionCoverage,signal:"mentioned",failed:n}),e.jsx(ie,{label:"Cited",metric:t?.citationCoverage,signal:"cited",failed:n})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Branded · already named"}),e.jsx(ie,{label:"Mentioned",metric:s?.mentionCoverage,signal:"mentioned",failed:a}),e.jsx(ie,{label:"Cited",metric:s?.citationCoverage,signal:"cited",failed:a})]})]})]})}function ks({branded:s,nonBrand:t,brandedError:a,nonBrandError:n,onRetry:i}){const u=[{queryClass:"branded",row:s,isError:a},{queryClass:"non-brand",row:t,isError:n}];return e.jsxs("section",{"aria-labelledby":"property-brand-contrast",children:[e.jsx("div",{className:"section-head section-head-inline",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"The gap"}),e.jsxs("h2",{id:"property-brand-contrast",className:"text-base font-semibold text-heading",children:["Named versus not named",e.jsx(I,{text:"Branded queries already contain your name, so an answer engine has an easy path back to you. Non-brand queries describe the need instead, and that is the demand you have to earn. Each row is measured only over the queries assigned to this Property in that class; a class with no assigned query reads Not measured rather than 0%."})]})]})}),e.jsx("div",{className:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[560px]",children:[e.jsx("caption",{className:"sr-only",children:"Mention and citation coverage for this Property, split by query class"}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Query type"}),e.jsx("th",{children:"Mentioned in the answer"}),e.jsx("th",{children:"Cited as a source"})]})}),e.jsx("tbody",{children:u.map(({queryClass:h,row:r,isError:l})=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("span",{className:"block font-medium text-heading",children:b[h].headline}),e.jsx("span",{className:"mt-0.5 block text-xs text-muted",children:b[h].technical}),r&&l?e.jsxs("span",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm text-caution",children:[e.jsx("span",{role:"status",children:"Refresh failed."}),e.jsxs(w,{type:"button",size:"sm",variant:"ghost",className:"h-11 px-3 text-sm md:h-11",onClick:()=>i(h),children:["Retry ",b[h].technical.toLocaleLowerCase()]})]}):null]}),r?e.jsxs(e.Fragment,{children:[e.jsx("td",{children:e.jsx(de,{metric:r.mentionCoverage,signal:"mentioned",emphasis:!0})}),e.jsx("td",{children:e.jsx(de,{metric:r.citationCoverage,signal:"cited",emphasis:!0})})]}):l?e.jsx("td",{colSpan:2,children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-secondary",children:[e.jsxs("span",{role:"alert",children:["Could not load ",b[h].technical.toLocaleLowerCase(),"."]}),e.jsxs(w,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>i(h),children:["Retry ",b[h].technical.toLocaleLowerCase()]})]})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{children:e.jsx("span",{className:"text-sm text-secondary",children:"Loading…"})}),e.jsx("td",{children:e.jsx("span",{className:"text-sm text-secondary",children:"Loading…"})})]})]},h))})]})})]})}function Is({row:s,queryClass:t,isError:a}){return e.jsxs("section",{"aria-labelledby":"property-providers",className:"page-section-divider",children:[e.jsx("div",{className:"section-head section-head-inline",children:e.jsx("div",{children:e.jsxs("h2",{id:"property-providers",className:"text-base font-semibold text-heading",children:["Which engines answer for this Property",e.jsx(I,{text:"Each row is measured over the queries that engine actually answered for this Property, so the rows are a split of the same population rather than parts that add up to the Property total. An engine that answered nothing for this Property is absent instead of shown at 0%."})]})})}),s===void 0&&a?e.jsxs("p",{className:"text-sm text-secondary",children:["Details for ",b[t].technical.toLocaleLowerCase()," are unavailable. Retry that query type above."]}):s===void 0?e.jsx("p",{className:"text-sm text-secondary",children:"Loading…"}):s.providers.length===0?e.jsxs("p",{className:"text-sm text-secondary",children:["No answer engine has measured ",b[t].technical.toLocaleLowerCase()," for this Property.",s.mentionCoverage.state==="unavailable"?` ${ce(s.mentionCoverage)}.`:""]}):e.jsx("div",{className:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[520px]",children:[e.jsx("caption",{className:"sr-only",children:"Per-engine mention and citation coverage"}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Engine"}),e.jsx("th",{children:"Mentioned"}),e.jsx("th",{children:"Cited"})]})}),e.jsx("tbody",{children:s.providers.map(n=>e.jsxs("tr",{children:[e.jsx("td",{className:"font-medium text-heading",children:n.provider}),e.jsx("td",{children:e.jsx(de,{metric:n.mentionCoverage,signal:"mentioned"})}),e.jsx("td",{children:e.jsx(de,{metric:n.citationCoverage,signal:"cited"})})]},n.provider))})]})})]})}function Bs(s){const t=s.questions.join(" · ");return s.questionsTruncated?`${t} +${s.questionTotal-s.questions.length} more`:t}function _s({project:s,targetKey:t,queryClass:a}){const n=G({...ls({client:V,path:{name:s},query:{targetKey:t,queryClass:a}})});if(n.isPending||n.isError)return null;const i=n.data?.competitors??[],u=n.data?.basis;return e.jsxs("section",{"aria-labelledby":"property-named-instead",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsx("div",{children:e.jsxs("h2",{id:"property-named-instead",className:"text-base font-semibold text-heading",children:["Named instead of this Property",e.jsx(I,{text:"Counted from the answers that did not name this Property, so a name here is one an engine recommended in its place. Occurrences count answers, not positions: an engine naming the same rival in two answers counts twice, and one naming it twice in a single answer counts once."})]})}),i.length>0?e.jsxs("p",{className:"supporting-copy",children:[n.data?.total??i.length," named"]}):null]}),i.length===0?e.jsx("p",{className:"text-sm text-secondary",children:"No rival was named in the answers this Property missed. Nothing to compete with here yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[420px]",children:[e.jsx("caption",{className:"sr-only",children:"Names the engines gave instead of this Property"}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Named"}),e.jsx("th",{children:"Answers"}),e.jsx("th",{children:"Engines"}),e.jsx("th",{children:"Queries"})]})}),e.jsx("tbody",{children:i.map(h=>e.jsxs("tr",{children:[e.jsx("td",{className:"text-strong",children:h.name}),e.jsx("td",{className:"tabular-nums text-secondary",children:h.occurrences}),e.jsxs("td",{className:"text-secondary",children:[h.providers.join(", "),h.providersTruncated?` +${h.providerTotal-h.providers.length}`:""]}),e.jsx("td",{className:"text-right",children:e.jsxs("span",{className:"inline-flex items-center justify-end gap-1",children:[e.jsx("span",{className:"tabular-nums text-secondary",children:h.questionTotal}),e.jsx(I,{text:Bs(h)})]})})]},h.name))})]})}),u?.state==="available"?e.jsxs("p",{className:"supporting-copy mt-2",children:[u.targetMissResults," of ",u.answeredResults," answers to ",b[a].technical.toLocaleLowerCase()," did not name this Property."]}):null]})]})}function Os({questions:s,queryClass:t}){return e.jsxs("section",{"aria-labelledby":"property-questions",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsx("div",{children:e.jsxs("h2",{id:"property-questions",className:"text-base font-semibold text-heading",children:[b[t].technical," assigned to this Property"]})}),e.jsxs("p",{className:"supporting-copy",children:[s.length," assigned"]})]}),s.length===0?e.jsxs("p",{className:"text-sm text-secondary",children:["No ",b[t].technical.toLocaleLowerCase()," are assigned. Add one in advanced measurement setup to measure this class."]}):e.jsx("div",{className:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[420px]",children:[e.jsx("caption",{className:"sr-only",children:"Queries assigned to this Property"}),e.jsx("thead",{children:e.jsx("tr",{children:e.jsx("th",{children:"Query"})})}),e.jsx("tbody",{children:s.map(a=>e.jsx("tr",{children:e.jsx("td",{className:"text-secondary",children:a})},a))})]})})]})}function Fs({urls:s}){return e.jsxs("section",{"aria-labelledby":"property-urls",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsx("div",{children:e.jsxs("h2",{id:"property-urls",className:"text-base font-semibold text-heading",children:["URLs that count as this Property",e.jsx(I,{text:"A cited source URL is credited to this Property when it matches one of these. The most specific matcher wins, so a URL covered by two Properties at the same specificity is flagged for review instead of being credited to either."})]})}),e.jsxs("p",{className:"supporting-copy",children:[s.length," configured"]})]}),s.length===0?e.jsx("p",{className:"text-sm text-secondary",children:"No URLs are configured for this Property."}):e.jsx("div",{className:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[420px]",children:[e.jsx("caption",{className:"sr-only",children:"URL matchers configured for this Property"}),e.jsx("thead",{children:e.jsx("tr",{children:e.jsx("th",{children:"URL"})})}),e.jsx("tbody",{children:s.map(t=>e.jsx("tr",{children:e.jsx("td",{className:"break-all text-secondary",children:t})},t))})]})})]})}const Y={heading:"Cited on other queries",help:"Answers to queries assigned to other properties that still cited one of this Property’s own pages. This Property was not measured on those queries, so these answers are not in its Mentioned or Cited rates.",notCounted:"not in this Property’s rates",empty:"No answer to a query assigned elsewhere cited this Property’s pages in the displayed measurement.",loadError:"Citations from other queries could not be loaded.",partlySaved:"Sources partly saved"};function Us({project:s,targetKey:t,queryClass:a,runId:n,targetLabels:i}){const[u,h]=p.useState(new Set),r={client:V,path:{name:s},query:{targetKey:t,queryClass:a,shape:Le["other-queries"],limit:le,...n?{runId:n}:{}}},l=Me({...Re(r),initialPageParam:r,getNextPageParam:m=>m.otherQueries?.nextCursor?{path:r.path,query:{...r.query,cursor:m.otherQueries.nextCursor}}:void 0}),B=l.data?.pages??[];if(B[0]?.measurement.state==="not_measured")return null;const S=B.flatMap(m=>m.otherQueries?.items??[]),q=B[0]?.otherQueries?.totalEstimate??S.length,F=m=>`${m.expectedSlotId}:${m.queryClass}`,L=b[a].technical.toLocaleLowerCase();return e.jsxs("section",{"aria-labelledby":"property-other-queries",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("h2",{id:"property-other-queries",className:"text-base font-semibold text-heading",children:Y.heading}),e.jsx(I,{text:Y.help})]}),l.data?e.jsxs("p",{className:"supporting-copy",children:[q," ",q===1?"answer":"answers"," · ",L," · ",Y.notCounted]}):null]}),l.isPending?e.jsx("p",{className:"text-sm text-secondary",children:"Loading…"}):l.isError&&S.length===0?e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-secondary",children:[e.jsx("span",{role:"alert",children:Y.loadError}),e.jsx(w,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>{l.refetch()},children:"Retry"})]}):S.length===0?e.jsx("p",{className:"text-sm text-secondary",children:Y.empty}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[640px]",children:[e.jsx("caption",{className:"sr-only",children:"Answers to other properties’ queries that cited this Property’s pages"}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Query"}),e.jsx("th",{children:"Assigned to"}),e.jsx("th",{children:"Pages cited"}),e.jsx("th",{children:e.jsx("span",{className:"sr-only",children:"Answer"})})]})}),e.jsx("tbody",{children:S.map(m=>{const A=F(m),P=u.has(A),R=`property-other-query-${encodeURIComponent(A)}`;return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{children:[e.jsxs("td",{className:"text-secondary",children:[e.jsx("span",{className:"block text-sm font-medium text-heading",children:m.queryText}),e.jsx("span",{className:"mt-1 block text-xs text-muted",children:[m.provider,m.location].filter(Boolean).join(" · ")})]}),e.jsx("td",{children:e.jsx("ul",{className:"space-y-1",children:m.assignedTargetKeys.map(c=>e.jsx("li",{children:e.jsx(Z,{to:"/projects/$projectName/properties/$targetKey",params:{projectName:s,targetKey:c},search:oe,className:"text-sm text-link hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:i.get(c)??c})},c))})}),e.jsxs("td",{children:[e.jsx("ul",{className:"space-y-1",children:m.sources.map(c=>e.jsx("li",{className:"min-w-0",children:e.jsx($e,{url:c.sourceUrl})},c.sourceUrl))}),m.sourcesTruncated?e.jsxs("span",{className:"mt-1 block text-xs text-muted",children:[m.sourceCount," pages in total"]}):null,m.evidenceComplete?null:e.jsx("span",{className:"mt-1 block text-xs text-muted",children:Y.partlySaved})]}),e.jsx("td",{className:"text-right",children:e.jsx(w,{type:"button",size:"sm",variant:"ghost",className:"h-auto min-h-11 max-w-full whitespace-normal py-2 text-left md:h-auto","aria-expanded":P,"aria-label":P?`Hide the answer for ${m.queryText}`:`Read the answer for ${m.queryText}`,"aria-controls":P?R:void 0,onClick:()=>h(c=>{const y=new Set(c);return y.delete(A)||y.add(A),y}),children:P?"Hide answer":"Read answer"})})]}),P?e.jsx("tr",{children:e.jsx("td",{id:R,colSpan:4,className:"bg-surface-subtle px-4",children:e.jsx(Oe,{project:s,targetKey:m.assignedTargetKeys[0],resultId:m.observationId})})}):null]},A)})})]})}),l.hasNextPage?e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-secondary",children:[e.jsxs("span",{children:["Showing ",S.length," of ",q]}),e.jsx(w,{size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",disabled:l.isFetchingNextPage,onClick:()=>{l.fetchNextPage()},children:l.isFetchingNextPage?"Loading…":`Show ${le} more`})]}):null]})]})}function Ks(s,t){const a=[s.marketKey?t??"the selected market":null,s.provider?`the ${s.provider} answer engine`:null,s.model?`the ${s.model} model`:null,s.location?`location ${s.location}`:null,s.from||s.to?"a date range":null,s.measurementRunId?"a saved sweep":null].filter(n=>n!==null);return a.length===0?null:`AI Visibility is filtered to ${a.join(", ")}. This page shows the latest measurement for ${fs.allMarkets.toLocaleLowerCase()} and answer engines.`}function Xs(){const{projectName:s,targetKey:t}=Ke({strict:!1}),a=Qe(),n=Ve({strict:!1}),i=p.useMemo(()=>es(n),[n]),[u,h]=p.useState(new Set),r=s??"",l=t??"",B=!!r&&!!l,S=p.useMemo(()=>ss("portfolio",ts(as())),[]),q=B&&S,{canWrite:F}=Te(),L=G({...ns({client:V,path:{name:r}}),enabled:q}),m=L.data?.active?.plan,A=m?.schemaVersion===2?m:null,P=i.queryClass==="branded"||i.queryClass==="non-brand"?i.queryClass:null,R=o=>A?.assignments.some(f=>f.targetKey===l&&f.queryClass===o)??!1,c=P??(!R("non-brand")&&R("branded")?"branded":"non-brand");p.useEffect(()=>{!A||P||a({to:".",replace:!0,search:o=>pe(o,{queryClass:c})})},[A,P,c,a]);const y=G({...qe(r,l,"branded"),enabled:q}),M=G({...qe(r,l,"non-brand"),enabled:q}),D=Ae(y.data),J=Ae(M.data),v=c==="branded"?y.data:M.data,C=c==="branded"?D:J,_=(c==="branded"?y.isError:M.isError)&&C===void 0,H=v?.measurement.displayedRunId;rs(r,{view:"property",selection:{mode:"advanced",scope:"property",scopeKey:l,queryClass:c,limit:10,...H?{runId:H}:{}}});const he=C?.mentionCoverage.state==="unavailable"?ce(C.mentionCoverage):void 0,ee=v===void 0?void 0:v.measurement.completedAt??null,O={client:V,path:{name:r},query:{targetKey:l,queryClass:c,shape:Le.answers,limit:le,...H?{runId:H}:{}}},g=Me({...Re(O),enabled:q&&v!==void 0,initialPageParam:O,getNextPageParam:o=>o.answers?.nextCursor?{path:O.path,query:{...O.query,cursor:o.answers.nextCursor}}:void 0}),W=L.data?.active??null,j=W?.plan.schemaVersion===2?W.plan:null,ae=W!==null&&j===null,U=j?.targets.find(o=>o.stableKey===l)??null,ne=Ks(i,j?.reportingScopes?.find(o=>o.stableKey===i.marketKey)?.label),me=p.useMemo(()=>{if(!j)return[];const o=new Map(j.querySnapshots.map(f=>[f.queryId,f.queryText]));return[...new Set(j.assignments.filter(f=>f.targetKey===l&&f.queryClass===c).flatMap(f=>{const N=o.get(f.queryId);return N===void 0?[]:[N]}))].sort((f,N)=>f.localeCompare(N))},[j,l,c]),se=p.useMemo(()=>U?.urlMatchers.map(ps)??[],[U]),z=p.useMemo(()=>new Map((j?.targets??[]).map(o=>[o.stableKey,o.label])),[j]),re=p.useMemo(()=>j?.groups.filter(o=>o.targetKeys.includes(l))??[],[j,l]),T=p.useMemo(()=>(g.data?.pages??[]).flatMap(N=>N.answers?.items??[]),[g.data]),d=g.data?.pages[0]?.answers?.totalEstimate??T.length,E=(g.data?.pages??[]).length>0&&(g.data?.pages??[]).every(o=>o.answers===void 0),K=g.data?.pages[0]?.measurement.state,$=e.jsxs(Z,{to:"/projects/$projectName",params:{projectName:r},search:oe,className:"inline-flex items-center gap-1 text-xs text-muted hover:text-strong",children:[e.jsx(js,{className:"size-3.5","aria-hidden":"true"}),"Back to AI Visibility"]});if(!B)return e.jsx("div",{className:"page-container",children:e.jsx("p",{className:"text-sm text-muted",children:"Missing project name or Property key in URL."})});if(!S)return e.jsxs("div",{className:"page-container space-y-3",children:[$,e.jsx("p",{className:"text-sm text-muted",children:"This view is not available here."})]});if(L.isPending&&!L.isError)return e.jsx("div",{className:"page-container",children:e.jsxs("div",{role:"status","aria-live":"polite",children:[e.jsx("span",{className:"sr-only",children:"Loading Property"}),e.jsx("div",{className:"h-32 animate-pulse rounded-md bg-surface-subtle","aria-hidden":"true"})]})});const ue=L.isError&&L.data===void 0,fe=y.isError&&y.data===void 0,ge=M.isError&&M.data===void 0;return ue||fe&&ge?e.jsxs("div",{className:"page-container space-y-3",children:[$,e.jsx("p",{role:"alert",className:"text-sm text-negative",children:"Could not load this Property."}),e.jsx(w,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>{L.refetch(),y.refetch(),M.refetch()},children:"Try again"})]}):!j||!U?e.jsxs("div",{className:"page-container space-y-3",children:[$,e.jsx("p",{role:"status",className:"text-sm text-secondary",children:j?"This Property is not in the published setup. It may have been renamed or removed.":"A Property page needs a published advanced measurement setup. Republish setup from the project Portfolio tab."}),e.jsx(w,{asChild:!0,type:"button",variant:"outline",className:"h-11 px-4 text-sm md:h-11",children:e.jsx(Z,{to:"/projects/$projectName/portfolio",params:{projectName:r},children:F?ae?"Republish setup":"Open measurement setup":"View measurement setup"})})]}):e.jsxs("div",{className:"page-container space-y-8",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{className:"page-header-left",children:[$,e.jsx("h1",{className:"page-title mt-2",children:U.label}),e.jsxs("p",{className:"page-subtitle",children:["Property in ",r,ne?e.jsxs(e.Fragment,{children:[" · Filters not applied ",e.jsx(I,{text:ne})]}):null]})]}),e.jsxs("div",{className:"page-header-right",children:[v?e.jsx(Q,{tone:Ee[v.measurement.state].tone,children:Ee[v.measurement.state].label}):null,C&&C.flags>0?e.jsxs(Q,{tone:"caution",children:[C.flags," flagged"]}):null]})]}),e.jsx($s,{branded:D,nonBrand:J,brandedFailed:fe,nonBrandFailed:ge}),e.jsx(ks,{branded:D,nonBrand:J,brandedError:y.isError,nonBrandError:M.isError,onRetry:o=>{o==="branded"?y.refetch():M.refetch()}}),v&&(v.measurement.state==="not_measured"||v.nextAction.kind==="run_measurement")?e.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3 border-y border-default py-4","aria-label":"Measurement next step",children:[e.jsx("p",{className:"text-sm text-secondary",children:be()?ye:F?"Run a measurement from the project overview to collect this Property’s coverage and source evidence.":"This Property needs a new measurement before coverage and source evidence are available."}),e.jsx(w,{asChild:!0,type:"button",className:"h-11 px-4 text-sm md:h-11",children:e.jsx(Z,{to:"/projects/$projectName",params:{projectName:r},search:oe,children:F?"Go to AI Visibility":"View AI Visibility"})})]}):null,e.jsxs("div",{className:"flex flex-wrap items-end gap-4 border-y border-default py-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:"property-query-class",className:"block text-sm font-medium text-heading",children:"Query type"}),e.jsxs("select",{id:"property-query-class",value:c,onChange:o=>{const f=o.target.value==="branded"?"branded":"non-brand";a({to:".",search:N=>pe(N,{queryClass:f})})},className:"h-11 rounded-md border border-default bg-surface px-3 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-mono-400",children:[e.jsx("option",{value:"non-brand",children:b["non-brand"].technical}),e.jsx("option",{value:"branded",children:b.branded.technical})]})]}),e.jsx(Ls,{measuredAt:ee,unmeasuredReason:he,queryClass:c})]}),e.jsx(Is,{row:C,queryClass:c,isError:_}),e.jsx(_s,{project:r,targetKey:l,queryClass:c}),e.jsx(Os,{questions:me,queryClass:c}),e.jsx(Ps,{projectName:r,targetKey:l,published:U,activeRevision:W.revision,publishedBrandNames:j.identities.projectBrand.names}),e.jsx(Fs,{urls:se}),e.jsx(Rs,{project:r,groups:re}),e.jsxs("section",{"aria-labelledby":"property-evidence",className:"page-section-divider",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsx("div",{children:e.jsxs("h2",{id:"property-evidence",className:"text-base font-semibold text-heading",children:["Answers the engines gave",e.jsx(I,{text:"One row per answer an engine gave for the queries assigned to this Property in the displayed measurement. Mentioned and cited are independent: an answer can name this Property without linking it, or link it without naming it. Answers that did neither are listed first, because those are what a gap is made of. Where the answer text was not stored the mention reads Not measured, never a zero. Open a row to read what the engine actually said, followed by the source URLs it returned, this Property's own first. The answer is where a miss becomes actionable: a query this Property was not named in may still have named a sibling building."})]})}),T.length>0?e.jsxs("p",{className:"supporting-copy",children:[T.length," of ",d]}):null]}),_?e.jsxs("p",{className:"text-sm text-secondary",children:["Evidence for ",b[c].technical.toLocaleLowerCase()," is unavailable. Retry that query type above."]}):g.isPending&&T.length===0?e.jsx("p",{className:"text-sm text-secondary",children:"Loading evidence…"}):g.isError&&T.length===0?e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-secondary",children:[e.jsx("span",{role:"alert",children:"Evidence could not be loaded."}),e.jsx(w,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>{g.refetch()},children:"Retry evidence"})]}):K==="not_measured"?e.jsx("p",{className:"text-sm text-secondary",children:be()?ye:"Not measured yet. Run a measurement to collect the answers for this Property."}):E?e.jsx("p",{role:"alert",className:"text-sm text-caution",children:"This measurement was returned in an older format, so the answers cannot be shown here. The numbers above are unaffected."}):T.length===0?e.jsx("p",{className:"text-sm text-secondary",children:"No answers matched this Property in the displayed measurement."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"property-answer-table-container overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table property-evidence-table",children:[e.jsx("caption",{className:"sr-only",children:"Answers measured for this Property"}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Query"}),e.jsx("th",{children:"Mentioned in the answer"}),e.jsx("th",{children:"Cited as a source"}),e.jsx("th",{children:"Sources"}),e.jsx("th",{children:e.jsx("span",{className:"sr-only",children:"Sources detail"})})]})}),e.jsx("tbody",{children:T.map(o=>{const f=Ss(o),N=u.has(f),je=`property-answer-${encodeURIComponent(f)}`;return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{className:"property-answer-summary",children:[e.jsxs("td",{className:"text-secondary",children:[e.jsx("h3",{className:"text-sm font-medium text-heading",children:o.queryText}),e.jsx("span",{className:"mt-1 block text-xs text-muted",children:[o.provider,o.location].filter(Boolean).join(" · ")}),o.historical||o.bridged?e.jsx("span",{className:"mt-1 flex",children:e.jsx(Q,{tone:"caution",children:"Historical"})}):null]}),e.jsxs("td",{children:[e.jsx("span",{className:"property-evidence-mobile-label","aria-hidden":"true",children:"Mentioned"}),e.jsx(qs,{row:o})]}),e.jsxs("td",{children:[e.jsx("span",{className:"property-evidence-mobile-label","aria-hidden":"true",children:"Cited"}),e.jsx(Ms,{row:o})]}),e.jsxs("td",{className:"tabular-nums text-secondary",children:[e.jsx("span",{className:"property-evidence-mobile-label","aria-hidden":"true",children:Be}),o.cited===null?As:o.sources.length]}),e.jsx("td",{className:"text-right",children:e.jsx(w,{type:"button",size:"sm",variant:"ghost",className:"h-auto min-h-11 max-w-full whitespace-normal py-2 text-left md:h-auto","aria-expanded":N,"aria-label":N?`Hide the answer for ${o.queryText}`:`Read the answer for ${o.queryText}`,"aria-controls":N?je:void 0,onClick:()=>h(Fe=>{const xe=new Set(Fe);return xe.delete(f)||xe.add(f),xe}),children:N?"Hide answer":"Read answer"})})]}),N?e.jsx("tr",{className:"property-answer-detail",children:e.jsxs("td",{id:je,colSpan:5,className:"bg-surface-subtle px-4",children:[e.jsx(Oe,{project:r,targetKey:l,resultId:o.observationId}),e.jsx(Ts,{row:o})]})}):null]},f)})})]})}),g.hasNextPage?e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-secondary",children:[e.jsxs("span",{children:["Showing ",T.length," of ",d]}),g.isFetchNextPageError?e.jsx("span",{role:"alert",children:"Could not load more evidence."}):null,e.jsx(w,{size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",disabled:g.isFetchingNextPage,onClick:()=>{g.fetchNextPage()},children:g.isFetchingNextPage?"Loading…":g.isFetchNextPageError?"Retry more evidence":`Show ${le} more`})]}):null]})]}),v?e.jsx(Us,{project:r,targetKey:l,queryClass:c,runId:H,targetLabels:z}):null]})}export{Se as EVIDENCE_LABELS,Xs as MeasurementPropertyPage,Y as OTHER_QUERIES_COPY};