@ainyc/canonry 4.192.0 → 4.192.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/assets/assets/{AuditHistoryPanel-C7MwfCl9.js → AuditHistoryPanel-Cobvw7cD.js} +1 -1
  2. package/assets/assets/{BacklinksPage-1Nq1zbRk.js → BacklinksPage-BKxZl1Or.js} +1 -1
  3. package/assets/assets/{HistoryPage-BNACyEiz.js → HistoryPage-CtXevdXo.js} +1 -1
  4. package/assets/assets/MeasurementPropertyPage-Dr7jyMQx.js +1 -0
  5. package/assets/assets/ProjectPage-DSgwSrNA.js +8 -0
  6. package/assets/assets/{RunRow-DINPo5ES.js → RunRow-5gcg6hPl.js} +1 -1
  7. package/assets/assets/{RunsPage-BFuDLm7p.js → RunsPage-D-6s-70o.js} +1 -1
  8. package/assets/assets/{SettingsPage-CkqmyTSK.js → SettingsPage-DiIoLm4A.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-DzFKj9lX.js → SiteHealthSection-CSS8dE7I.js} +3 -3
  10. package/assets/assets/{TrafficPage-CkIGVLET.js → TrafficPage-CTDy_HNO.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-CTmn_FmZ.js → TrafficSourceDetailPage-CldL3bHd.js} +1 -1
  12. package/assets/assets/{extract-error-message-CC2kxd3e.js → extract-error-message-B2HJayiT.js} +1 -1
  13. package/assets/assets/{index-CCPMPGar.js → index-C-CHPojU.js} +19 -19
  14. package/assets/assets/index-CjEprBri.css +1 -0
  15. package/assets/assets/{react-sigma_core.esm.min-DkpQa1sf.js → react-sigma_core.esm.min-DVwmfuwH.js} +1 -1
  16. package/assets/assets/v2-overview-adapter-CqskEPzK.js +1 -0
  17. package/assets/index.html +2 -2
  18. package/dist/{chunk-BULKBROE.js → chunk-QRNKMGVD.js} +25 -1
  19. package/dist/{chunk-32Q2NZ4S.js → chunk-S5QNBQ72.js} +2 -2
  20. package/dist/{chunk-JOSSB4QC.js → chunk-T4OO575U.js} +4 -4
  21. package/dist/{chunk-FTKZAOFD.js → chunk-T6GRXUOE.js} +84 -27
  22. package/dist/{chunk-36RKISAI.js → chunk-V4ZLHKOG.js} +1 -1
  23. package/dist/cli.js +5 -5
  24. package/dist/index.js +4 -4
  25. package/dist/{intelligence-service-MEQ5VX5L.js → intelligence-service-QYRQHSJH.js} +2 -2
  26. package/dist/mcp.js +3 -3
  27. package/package.json +12 -12
  28. package/assets/assets/MeasurementPropertyPage-BqjpIYAw.js +0 -1
  29. package/assets/assets/ProjectPage-BhBzznlv.js +0 -8
  30. package/assets/assets/index-BtTEcbcB.css +0 -1
  31. package/assets/assets/v2-overview-adapter-COMP5UGt.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as o,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{y as M,B as A}from"./index-C-CHPojU.js";import{M as $}from"./vendor-markdown-B-Oq2NYq.js";const H="Sources",y={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function N({headingLevel:e}){return n=>{const r=[],s=i=>{i.type==="heading"&&i.depth&&r.push(i),i.children?.forEach(s)};s(n);const l=r.reduce((i,u)=>Math.min(i,u.depth),6);for(const i of r){const u=i.depth-l;i.depth=Math.min(6,e+u),i.data={...i.data,hProperties:{...i.data?.hProperties,"data-answer-heading-level":u+1}}}}}function R({answer:e}){const[n,r]=C.useState("idle"),s=C.useRef(!1),l=async()=>{if(!s.current){s.current=!0,r("copying");try{await navigator.clipboard.writeText(e),r("copied")}catch{r("failed")}finally{s.current=!1}}};return o.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[o.jsx(A,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":n==="copying","aria-busy":n==="copying",onClick:()=>{l()},children:n==="copying"?y.copying:y.copy}),o.jsx("span",{role:"status",className:"text-sm text-secondary",children:n==="copied"?y.copied:n==="failed"?y.failed:""})]})}function L({children:e,headingLevel:n=4,copyable:r=!1}){return o.jsxs("div",{className:"answer-markdown",children:[o.jsx($,{remarkPlugins:[[N,{headingLevel:n}]],components:{p:({children:s})=>o.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:s}),ul:({children:s})=>o.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:s}),ol:({children:s,start:l})=>o.jsx("ol",{start:l,className:"mb-3 ml-5 list-decimal space-y-1",children:s}),pre:({children:s})=>o.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:s}),a:({children:s,href:l})=>{const i=M(l);return i?o.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:s}):o.jsx("span",{children:s})},img:({alt:s})=>o.jsx("span",{children:s})},children:e}),r&&e.trim()?o.jsx(R,{answer:e},e):null]})}function F(e){const n=e[0];return n?e.every(r=>r.mode===n.mode&&r.scope.kind===n.scope.kind&&r.scope.key===n.scope.key&&r.queryClass===n.queryClass&&r.measurement.displayedRunId===n.measurement.displayedRunId):!0}function p(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}}function I(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function T(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function _(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function k(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function j(e,n,r){const s=new Map;if(!n)return s;const l=new Map(e.usageEdges.map(a=>[k(a),a.targetKey])),i=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),u=new Map(e.usageEdges.map(a=>[k(a),i.get(`${a.targetKey}:${a.queryId}`)]));for(const a of n.evidence){if(r&&u.get(a.usageEdgeId)!==r)continue;const c=l.get(a.usageEdgeId);if(!c)continue;const m=s.get(c)??[];m.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:T(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:_(a.classification),historical:a.historical||a.bridged}),s.set(c,m)}return s}function B(e){if(e.flags>0)return{label:"Review",tone:"caution"};const n=[e.mentionCoverage,e.citationCoverage].filter(r=>r.state==="unavailable").map(r=>r.reason);return n.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:n.includes("plan_v1")?{label:"Update setup",tone:"caution"}:n.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:n.includes("no_population")?{label:"No queries",tone:"neutral"}:n.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function O(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 U(e){if(!e)return"";const n=new Date(e);return Number.isFinite(n.getTime())?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function q(e){const n=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${n} flagged ${n===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 W({overview:e,activePlan:n,report:r,reportState:s=r?"ready":"loading",sort:l}){if(n.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 i=n.plan,u=new Map(i.targets.map(t=>[t.stableKey,t])),a=new Map(i.querySnapshots.map(t=>[t.queryId,t.queryText])),c=new Map;for(const t of i.assignments){if(e.queryClass!=="all"&&t.queryClass!==e.queryClass)continue;const d=a.get(t.queryId);if(!d)continue;const g=c.get(t.targetKey)??new Set;g.add(d),c.set(t.targetKey,g)}const m=r?.revision===n.revision&&r.run?.id===e.measurement.displayedRunId?r:null,K=e.measurement.displayedRunId===void 0||m?"ready":s==="error"||r!=null?"error":"loading",S=j(i,m,e.queryClass==="all"?void 0:e.queryClass),h=new Map;for(const t of i.groups)for(const d of t.targetKeys)h.has(d)||h.set(d,t.label);const x=e.properties.items.map(t=>{const d=u.get(t.targetKey),g=S.get(t.targetKey)??[];return{id:t.targetKey,name:t.label,mentionCoverage:p(t.mentionCoverage),citationCoverage:p(t.citationCoverage),status:B(t),providers:t.providers?.map(f=>({provider:f.provider,mentionCoverage:p(f.mentionCoverage),citationCoverage:p(f.citationCoverage)})),market:h.get(t.targetKey),assignedQueries:[...c.get(t.targetKey)??[]],urls:d?.urlMatchers.map(I)??[],evidence:g,evidenceState:K,historical:g.some(f=>f.historical)}}),b=e.namedShareOfVoice?.entries.map(t=>({name:t.label,coverage:{numerator:t.credits,denominator:e.namedShareOfVoice.denominator}})),E=e.properties.items.flatMap(t=>t.flags>0?[{id:`property:${t.targetKey}`,property:t.label,summary:`${t.flags} ${t.flags===1?"result needs":"results need"} review.`,tone:"caution",count:t.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:O(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:U(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:p(e.metrics.propertiesMentioned),mentionCoverage:p(e.metrics.mentionCoverage),citationCoverage:p(e.metrics.citationCoverage)},properties:x,...b?{shareOfVoice:b}:{}},propertyTotal:e.properties.totalEstimate??x.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...l?{sort:l}:{}},availableGroups:i.groups.map(t=>({id:t.stableKey,label:t.label})),...q(e)?{nextActionText:q(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:E}}export{L as A,H as a,F as b,W as c,I as m};
package/assets/index.html CHANGED
@@ -12,14 +12,14 @@
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-CCPMPGar.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-C-CHPojU.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">
19
19
  <link rel="modulepreload" crossorigin href="./assets/vendor-lucide-CW2qe0uH.js">
20
20
  <link rel="modulepreload" crossorigin href="./assets/vendor-markdown-B-Oq2NYq.js">
21
21
  <link rel="modulepreload" crossorigin href="./assets/vendor-yaml-GWJz5H2G.js">
22
- <link rel="stylesheet" crossorigin href="./assets/index-BtTEcbcB.css">
22
+ <link rel="stylesheet" crossorigin href="./assets/index-CjEprBri.css">
23
23
  </head>
24
24
  <body>
25
25
  <div id="root"></div>
@@ -3952,6 +3952,8 @@ var measurementV2ReportingScopeSchema = z6.object({
3952
3952
  stableKey: measurementV2StableKeySchema,
3953
3953
  label: z6.string().trim().min(1),
3954
3954
  kind: z6.literal("market"),
3955
+ /** Explicit navigation association; never inferred from labels or shared properties. */
3956
+ groupKey: measurementV2StableKeySchema.optional(),
3955
3957
  usageEdges: z6.array(measurementV2UsageEdgeSchema)
3956
3958
  }).strict();
3957
3959
  function measurementV2UsageEdgeKey(edge) {
@@ -4014,6 +4016,12 @@ var measurementPlanV2Schema = z6.object({
4014
4016
  });
4015
4017
  }
4016
4018
  reportingScopeKeys.add(scope.stableKey);
4019
+ if (scope.groupKey !== void 0) {
4020
+ const group = plan.groups.find((group2) => group2.stableKey === scope.groupKey);
4021
+ if (!group || scope.usageEdges.some((edge) => !group.targetKeys.includes(edge.targetKey))) {
4022
+ ctx.addIssue({ code: z6.ZodIssueCode.custom, path: ["reportingScopes", scopeIndex, "groupKey"], message: "A market must link to an existing group containing all its assigned properties." });
4023
+ }
4024
+ }
4017
4025
  const memberKeys = /* @__PURE__ */ new Set();
4018
4026
  scope.usageEdges.forEach((edge, edgeIndex) => {
4019
4027
  const key = measurementV2UsageEdgeKey(edge);
@@ -6127,6 +6135,8 @@ var visibilityReportRequestShape = {
6127
6135
  queryClass: visibilityReportQueryClassSchema.default("non-brand"),
6128
6136
  scope: visibilityReportScopeKindSchema.default("project"),
6129
6137
  scopeKey: nonBlankIdSchema.optional(),
6138
+ /** Exact frozen market refinement for a project, group, or Property selection. */
6139
+ marketKey: nonBlankIdSchema.optional(),
6130
6140
  provider: nonBlankIdSchema.optional(),
6131
6141
  /** Exact stored served-model identity. Null/absent model evidence never matches this filter. */
6132
6142
  model: nonBlankIdSchema.optional(),
@@ -6160,6 +6170,13 @@ var visibilityReportRequestSchema = z15.object(visibilityReportRequestShape).str
6160
6170
  message: "scopeKey is not valid for project scope"
6161
6171
  });
6162
6172
  }
6173
+ if (value.scope === "market" && value.marketKey !== void 0) {
6174
+ ctx.addIssue({
6175
+ code: z15.ZodIssueCode.custom,
6176
+ path: ["marketKey"],
6177
+ message: "marketKey is not valid for market scope"
6178
+ });
6179
+ }
6163
6180
  if (value.from !== void 0 && value.to !== void 0 && value.from > value.to) {
6164
6181
  ctx.addIssue({
6165
6182
  code: z15.ZodIssueCode.custom,
@@ -6218,7 +6235,9 @@ var visibilityReportScopeOptionSchema = z15.object({
6218
6235
  kind: visibilityReportScopeKindSchema,
6219
6236
  targetCount: z15.number().int().nonnegative(),
6220
6237
  /** Group and Property membership is frozen and explicit; groups have zero or one id. */
6221
- parentGroupIds: z15.array(nonBlankIdSchema).optional()
6238
+ parentGroupIds: z15.array(nonBlankIdSchema).optional(),
6239
+ /** Explicit frozen market links; absent for scopes without market metadata. */
6240
+ marketKeys: z15.array(nonBlankIdSchema).optional()
6222
6241
  }).strict();
6223
6242
  var visibilityReportModelOptionSchema = z15.object({
6224
6243
  provider: nonBlankIdSchema,
@@ -6278,6 +6297,8 @@ var visibilityReportQueryRowSchema = z15.object({
6278
6297
  model: z15.string().nullable(),
6279
6298
  location: z15.string().nullable(),
6280
6299
  targetKeys: z15.array(nonBlankIdSchema),
6300
+ /** Frozen market memberships for standalone Property query grouping. */
6301
+ marketKeys: z15.array(nonBlankIdSchema).optional(),
6281
6302
  answerCount: z15.number().int().nonnegative(),
6282
6303
  mentionCoverage: visibilityReportRateSchema,
6283
6304
  citationCoverage: visibilityReportRateSchema
@@ -6361,6 +6382,8 @@ var visibilityReportSelectionSchema = z15.object({
6361
6382
  mode: visibilityReportResolvedModeSchema,
6362
6383
  queryClass: visibilityReportQueryClassSchema,
6363
6384
  scope: visibilityReportScopeOptionSchema,
6385
+ /** Selected frozen market refinement, omitted when reading the full scope. */
6386
+ market: visibilityReportScopeOptionSchema.optional(),
6364
6387
  provider: z15.string().nullable(),
6365
6388
  model: z15.string().nullable(),
6366
6389
  location: visibilityReportLocationSelectionSchema,
@@ -6511,6 +6534,7 @@ var queryTrackingGroupSchema = z16.object({
6511
6534
  }).strict();
6512
6535
  var queryTrackingMarketSchema = z16.object({
6513
6536
  stableKey: measurementV2StableKeySchema,
6537
+ groupKey: measurementV2StableKeySchema.optional(),
6514
6538
  label: z16.string().trim().min(1),
6515
6539
  usageEdges: z16.array(measurementV2UsageEdgeSchema)
6516
6540
  }).strict();
@@ -5,11 +5,11 @@ import {
5
5
  installSkills,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-36RKISAI.js";
8
+ } from "./chunk-V4ZLHKOG.js";
9
9
  import {
10
10
  SKILL_MANIFEST_FILENAME,
11
11
  SkillsClients
12
- } from "./chunk-BULKBROE.js";
12
+ } from "./chunk-QRNKMGVD.js";
13
13
 
14
14
  // src/skills-autosync.ts
15
15
  import fs from "fs";
@@ -14,7 +14,7 @@ import {
14
14
  loadConfig,
15
15
  loadConfigRaw,
16
16
  saveConfigPatch
17
- } from "./chunk-36RKISAI.js";
17
+ } from "./chunk-V4ZLHKOG.js";
18
18
  import {
19
19
  CC_CACHE_DIR,
20
20
  DUCKDB_SPEC,
@@ -162,7 +162,7 @@ import {
162
162
  siteCrawlSnapshots,
163
163
  toAlertView,
164
164
  usageCounters
165
- } from "./chunk-FTKZAOFD.js";
165
+ } from "./chunk-T6GRXUOE.js";
166
166
  import {
167
167
  AGENT_MEMORY_VALUE_MAX_BYTES,
168
168
  AGENT_PROVIDER_IDS,
@@ -305,7 +305,7 @@ import {
305
305
  validationError,
306
306
  winnabilityClassLabel,
307
307
  withRetry
308
- } from "./chunk-BULKBROE.js";
308
+ } from "./chunk-QRNKMGVD.js";
309
309
 
310
310
  // src/telemetry.ts
311
311
  import crypto from "crypto";
@@ -12041,7 +12041,7 @@ function readStoredGroundingSources(rawResponse) {
12041
12041
  return result;
12042
12042
  }
12043
12043
  async function backfillInsightsCommand(project, opts) {
12044
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-MEQ5VX5L.js");
12044
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-QYRQHSJH.js");
12045
12045
  const config = loadConfig();
12046
12046
  const db = createClient(config.database);
12047
12047
  migrate(db);
@@ -689,7 +689,7 @@ import {
689
689
  wordpressSchemaDeployResultDtoSchema,
690
690
  wordpressSchemaStatusResultDtoSchema,
691
691
  wordpressStatusDtoSchema
692
- } from "./chunk-BULKBROE.js";
692
+ } from "./chunk-QRNKMGVD.js";
693
693
 
694
694
  // src/intelligence-service.ts
695
695
  import { eq as eq67, desc as desc29, asc as asc12, and as and57, ne as ne10, or as or15, inArray as inArray25, gte as gte18, lte as lte15, isNull as isNull12, sql as sql26, exists } from "drizzle-orm";
@@ -18021,6 +18021,12 @@ function diffCompiledPlans(active, candidate, activeRevision) {
18021
18021
  };
18022
18022
  }
18023
18023
  function plansAreLabelOnlyVariants(active, candidate) {
18024
+ const marketSurface = (scope) => {
18025
+ const { groupKey: _groupKey, ...population } = scope;
18026
+ return JSON.stringify(canonicalJsonValue({ ...population, label: "" }));
18027
+ };
18028
+ const nextMarkets = new Map((canonicalMeasurementPlanV2(candidate).reportingScopes ?? []).map((scope) => [scope.stableKey, marketSurface(scope)]));
18029
+ if ((canonicalMeasurementPlanV2(active).reportingScopes ?? []).some((scope) => nextMarkets.get(scope.stableKey) !== marketSurface(scope))) return false;
18024
18030
  const surface = (plan) => {
18025
18031
  const doc = canonicalMeasurementPlanV2(plan);
18026
18032
  const stripped = {
@@ -18028,6 +18034,7 @@ function plansAreLabelOnlyVariants(active, candidate) {
18028
18034
  // The checksum includes labels and navigation parents. Neutralize it
18029
18035
  // with those display fields; all measurement semantics stay in the comparison.
18030
18036
  compiledChecksum: "",
18037
+ reportingScopes: [],
18031
18038
  targets: doc.targets.map((target) => ({ ...target, label: "" })),
18032
18039
  groups: doc.groups.map(({ parentGroupKey: _parentGroupKey, ...group }) => ({
18033
18040
  // Parentage changes navigation only. It changes the frozen document and
@@ -18457,6 +18464,10 @@ function upsertGroup(authoring, body) {
18457
18464
  }
18458
18465
  function upsertMarket(authoring, body) {
18459
18466
  const { market } = parseBody(measurementDraftUpsertMarketRequestSchema, body, "upsert-market");
18467
+ if (market.groupKey !== void 0) {
18468
+ const group = authoring.groups.find((group2) => group2.stableKey === market.groupKey);
18469
+ if (!group || market.usageEdges.some((edge) => !group.targetKeys.includes(edge.targetKey))) throw validationError("A market must link to an existing group containing all its assigned properties.");
18470
+ }
18460
18471
  const included = new Set(authoring.targets.filter((target) => target.status === "included").map((target) => target.stableKey));
18461
18472
  const frozen = new Set(authoring.assignments.flatMap((assignment) => (assignment.executionContexts ?? []).filter((context) => context.executionNodeKey !== void 0).map((context) => measurementV2UsageEdgeKey({ targetKey: assignment.targetKey, queryId: assignment.queryId, executionNodeKey: context.executionNodeKey }))));
18462
18473
  const seen2 = /* @__PURE__ */ new Set();
@@ -22225,35 +22236,43 @@ function rate(values, expected, unknownReason = "evidence-incomplete") {
22225
22236
  function scopeResolution(definition, selection) {
22226
22237
  const project = definition.scopeOptions.find((option2) => option2.kind === "project");
22227
22238
  if (!project) throw new VisibilityReportScopeError("Frozen definition has no project scope.");
22239
+ let option = project;
22240
+ let edgeIds;
22228
22241
  if (selection.scope === "project") {
22229
- return { option: project, edgeIds: new Set(definition.edges.map((edge) => edge.id)) };
22230
- }
22231
- const key = selection.scopeKey;
22232
- if (!key) throw new VisibilityReportScopeError(`${selection.scope} scope requires a scope key.`);
22233
- const option = definition.scopeOptions.find((candidate) => candidate.kind === selection.scope && candidate.id === key);
22234
- if (!option) throw new VisibilityReportScopeError(`${selection.scope} scope "${key}" is not in this frozen definition.`);
22235
- if (selection.scope === "property") {
22236
- return {
22237
- option,
22238
- edgeIds: new Set(definition.edges.filter((edge) => edge.targetKey === key).map((edge) => edge.id))
22239
- };
22242
+ edgeIds = new Set(definition.edges.map((edge) => edge.id));
22243
+ } else {
22244
+ const key = selection.scopeKey;
22245
+ if (!key) throw new VisibilityReportScopeError(`${selection.scope} scope requires a scope key.`);
22246
+ const scoped = definition.scopeOptions.find((candidate) => candidate.kind === selection.scope && candidate.id === key);
22247
+ if (!scoped) throw new VisibilityReportScopeError(`${selection.scope} scope "${key}" is not in this frozen definition.`);
22248
+ option = scoped;
22249
+ if (selection.scope === "property") {
22250
+ edgeIds = new Set(definition.edges.filter((edge) => edge.targetKey === key).map((edge) => edge.id));
22251
+ } else if (selection.scope === "group") {
22252
+ const group = definition.groups.find((candidate) => candidate.id === key);
22253
+ if (!group) throw new VisibilityReportScopeError(`Group "${key}" is not in this frozen definition.`);
22254
+ const targetKeys = new Set(group.targetKeys);
22255
+ edgeIds = new Set(definition.edges.filter((edge) => targetKeys.has(edge.targetKey)).map((edge) => edge.id));
22256
+ } else {
22257
+ edgeIds = new Set(definition.edges.filter((edge) => edge.marketKeys.includes(key)).map((edge) => edge.id));
22258
+ }
22240
22259
  }
22241
- if (selection.scope === "group") {
22242
- const group = definition.groups.find((candidate) => candidate.id === key);
22243
- if (!group) throw new VisibilityReportScopeError(`Group "${key}" is not in this frozen definition.`);
22244
- const targetKeys = new Set(group.targetKeys);
22245
- return {
22246
- option,
22247
- edgeIds: new Set(definition.edges.filter((edge) => targetKeys.has(edge.targetKey)).map((edge) => edge.id))
22248
- };
22260
+ if (selection.scope === "market" && selection.marketKey !== void 0) {
22261
+ throw new VisibilityReportScopeError("marketKey is not valid for market scope.");
22249
22262
  }
22263
+ const marketKey = selection.scope === "market" ? selection.scopeKey : selection.marketKey;
22264
+ if (marketKey === void 0) return { option, edgeIds };
22265
+ const market = definition.scopeOptions.find((candidate) => candidate.kind === "market" && candidate.id === marketKey);
22266
+ if (!market) throw new VisibilityReportScopeError(`Market "${marketKey}" is not in this frozen definition.`);
22250
22267
  return {
22251
22268
  option,
22252
- edgeIds: new Set(definition.edges.filter((edge) => edge.marketKeys.includes(key)).map((edge) => edge.id))
22269
+ market,
22270
+ edgeIds: new Set(definition.edges.filter((edge) => edgeIds.has(edge.id) && edge.marketKeys.includes(marketKey)).map((edge) => edge.id))
22253
22271
  };
22254
22272
  }
22255
22273
  function scopeTargetKeys(definition, selection) {
22256
22274
  const resolution = scopeResolution(definition, selection);
22275
+ if (resolution.market !== void 0) return [...new Set(definition.edges.filter((edge) => resolution.edgeIds.has(edge.id)).map((edge) => edge.targetKey))].sort(compareText14);
22257
22276
  if (selection.scope === "project") return definition.targets.map((target) => target.id).sort(compareText14);
22258
22277
  if (selection.scope === "property") return [resolution.option.id];
22259
22278
  if (selection.scope === "group") {
@@ -22439,11 +22458,15 @@ function queryRows(candidates, definition, selection) {
22439
22458
  model: first.observation?.model ?? null,
22440
22459
  location: first.slot.location,
22441
22460
  targetKeys: selectedTargetKeys(rows),
22461
+ ...(() => {
22462
+ const marketKeys = [...new Set(rows.flatMap((row) => row.edges.flatMap((edge) => edge.marketKeys)))].sort(compareText14);
22463
+ return marketKeys.length === 0 ? {} : { marketKeys };
22464
+ })(),
22442
22465
  answerCount: value.answerCount,
22443
22466
  mentionCoverage: value.mentionCoverage,
22444
22467
  citationCoverage: value.citationCoverage
22445
22468
  };
22446
- }).sort((left, right) => compareText14(normalizeText3(left.query), normalizeText3(right.query)) || compareText14(left.provider, right.provider) || compareText14(left.model ?? "", right.model ?? "") || compareText14(left.location ?? "", right.location ?? "") || compareText14(left.queryKey, right.queryKey));
22469
+ }).sort((left, right) => (selection.scope === "property" && selection.marketKey === void 0 ? compareText14((left.marketKeys ?? []).join("\0"), (right.marketKeys ?? []).join("\0")) : 0) || compareText14(normalizeText3(left.query), normalizeText3(right.query)) || compareText14(left.provider, right.provider) || compareText14(left.model ?? "", right.model ?? "") || compareText14(left.location ?? "", right.location ?? "") || compareText14(left.queryKey, right.queryKey));
22447
22470
  }
22448
22471
  function evidenceRows(candidates, definition, selection) {
22449
22472
  if (selection.queryKey === void 0 && selection.queryId === void 0) return [];
@@ -22578,6 +22601,7 @@ function page2(rows, keyOf, kind, queryClass, input, run) {
22578
22601
  queryClass,
22579
22602
  scope: input.selection.scope,
22580
22603
  scopeKey: input.selection.scopeKey ?? null,
22604
+ marketKey: input.selection.marketKey ?? null,
22581
22605
  provider: input.selection.provider ?? null,
22582
22606
  model: input.selection.model ?? null,
22583
22607
  location: input.selection.location,
@@ -22668,7 +22692,8 @@ function buildVisibilityReport(input) {
22668
22692
  const runs2 = input.runs.filter((run) => !run.probe && inTime(run, input.selection)).sort((left, right) => compareText14(left.createdAt, right.createdAt) || compareText14(left.id, right.id));
22669
22693
  const selectedRun = input.selection.runId === void 0 ? input.preferredRunId === void 0 ? runs2.at(-1) : runs2.find((run) => run.id === input.preferredRunId) : runs2.find((run) => run.id === input.selection.runId);
22670
22694
  const definition = selectedRun?.definition ?? input.activeDefinition;
22671
- const selectedScope = scopeResolution(definition, input.selection).option;
22695
+ const selectedResolution = scopeResolution(definition, input.selection);
22696
+ const selectedScope = selectedResolution.option;
22672
22697
  const populationTargetKeys = scopeTargetKeys(definition, input.selection);
22673
22698
  const classes = selectedClasses(input.selection.queryClass);
22674
22699
  const runCandidates = /* @__PURE__ */ new Map();
@@ -22723,6 +22748,7 @@ function buildVisibilityReport(input) {
22723
22748
  mode: input.mode,
22724
22749
  queryClass: input.selection.queryClass,
22725
22750
  scope: selectedScope,
22751
+ ...selectedResolution.market === void 0 ? {} : { market: selectedResolution.market },
22726
22752
  provider: input.selection.provider ?? null,
22727
22753
  model: input.selection.model ?? null,
22728
22754
  location: input.selection.location,
@@ -22906,16 +22932,47 @@ function v2Definition(plan, revision, manifest, run) {
22906
22932
  for (const group of plan.groups) {
22907
22933
  for (const targetKey of group.targetKeys) groupKeysForTarget.get(targetKey)?.push(group.stableKey);
22908
22934
  }
22935
+ const marketKeysForGroup = /* @__PURE__ */ new Map();
22936
+ const marketKeysForTarget = new Map(plan.targets.map((target) => [target.stableKey, []]));
22937
+ for (const market of plan.reportingScopes ?? []) {
22938
+ if (market.groupKey !== void 0) {
22939
+ const keys = marketKeysForGroup.get(market.groupKey) ?? [];
22940
+ keys.push(market.stableKey);
22941
+ marketKeysForGroup.set(market.groupKey, keys);
22942
+ }
22943
+ for (const edge of market.usageEdges) marketKeysForTarget.get(edge.targetKey)?.push(market.stableKey);
22944
+ }
22909
22945
  const scopeOptions = [
22910
22946
  { id: "project", label: "Project", kind: "project", targetCount: plan.targets.length },
22911
- ...plan.groups.map((group) => ({ id: group.stableKey, label: group.label, kind: "group", targetCount: group.targetKeys.length, ...group.parentGroupKey === void 0 ? {} : { parentGroupIds: [group.parentGroupKey] } })),
22947
+ ...plan.groups.map((group) => {
22948
+ const marketKeys = [...new Set(marketKeysForGroup.get(group.stableKey) ?? [])].sort();
22949
+ return {
22950
+ id: group.stableKey,
22951
+ label: group.label,
22952
+ kind: "group",
22953
+ targetCount: group.targetKeys.length,
22954
+ ...group.parentGroupKey === void 0 ? {} : { parentGroupIds: [group.parentGroupKey] },
22955
+ ...marketKeys.length === 0 ? {} : { marketKeys }
22956
+ };
22957
+ }),
22912
22958
  ...plan.reportingScopes?.map((market) => ({
22913
22959
  id: market.stableKey,
22914
22960
  label: market.label,
22915
22961
  kind: "market",
22916
- targetCount: new Set(market.usageEdges.map((edge) => edge.targetKey)).size
22962
+ targetCount: new Set(market.usageEdges.map((edge) => edge.targetKey)).size,
22963
+ ...market.groupKey === void 0 ? {} : { parentGroupIds: [market.groupKey] }
22917
22964
  })) ?? [],
22918
- ...plan.targets.map((target) => ({ id: target.stableKey, label: target.label, kind: "property", targetCount: 1, parentGroupIds: [...new Set(groupKeysForTarget.get(target.stableKey) ?? [])].sort() }))
22965
+ ...plan.targets.map((target) => {
22966
+ const marketKeys = [...new Set(marketKeysForTarget.get(target.stableKey) ?? [])].sort();
22967
+ return {
22968
+ id: target.stableKey,
22969
+ label: target.label,
22970
+ kind: "property",
22971
+ targetCount: 1,
22972
+ parentGroupIds: [...new Set(groupKeysForTarget.get(target.stableKey) ?? [])].sort(),
22973
+ ...marketKeys.length === 0 ? {} : { marketKeys }
22974
+ };
22975
+ })
22919
22976
  ];
22920
22977
  return {
22921
22978
  revision,
@@ -23899,7 +23956,7 @@ function workspaceDto(db, state, opts) {
23899
23956
  targetKeys: group.targetKeys,
23900
23957
  ...group.parentGroupKey ? { parentGroupKey: group.parentGroupKey } : {}
23901
23958
  })) ?? [],
23902
- markets: plan?.reportingScopes?.map((scope) => ({ stableKey: scope.stableKey, label: scope.label, usageEdges: scope.usageEdges })) ?? [],
23959
+ markets: plan?.reportingScopes?.map((scope) => ({ stableKey: scope.stableKey, label: scope.label, usageEdges: scope.usageEdges, ...scope.groupKey ? { groupKey: scope.groupKey } : {} })) ?? [],
23903
23960
  tracked: trackedRows(db, state, rows, plan, opts),
23904
23961
  savedSources: savedSources(db, state.project.id)
23905
23962
  });
@@ -104,7 +104,7 @@ import {
104
104
  trafficEventKindSchema,
105
105
  trafficSeriesGranularitySchema,
106
106
  visibilityReportRequestSchema
107
- } from "./chunk-BULKBROE.js";
107
+ } from "./chunk-QRNKMGVD.js";
108
108
 
109
109
  // src/cli-error.ts
110
110
  function isMachineFormat(format) {
package/dist/cli.js CHANGED
@@ -28,11 +28,11 @@ import {
28
28
  trackCliCommandFinished,
29
29
  trackEvent,
30
30
  waitForServerRuntimeStartup
31
- } from "./chunk-JOSSB4QC.js";
31
+ } from "./chunk-T4OO575U.js";
32
32
  import {
33
33
  autoSyncSkills,
34
34
  formatAutoSyncNotice
35
- } from "./chunk-32Q2NZ4S.js";
35
+ } from "./chunk-S5QNBQ72.js";
36
36
  import {
37
37
  CliError,
38
38
  EXIT_SYSTEM_ERROR,
@@ -58,7 +58,7 @@ import {
58
58
  saveConfigPatch,
59
59
  systemError,
60
60
  usageError
61
- } from "./chunk-36RKISAI.js";
61
+ } from "./chunk-V4ZLHKOG.js";
62
62
  import {
63
63
  CLOUDFLARE_WORKER_BINDINGS,
64
64
  CLOUDFLARE_WORKER_GENERATED_MARKER,
@@ -72,7 +72,7 @@ import {
72
72
  projects,
73
73
  queries,
74
74
  renderReportHtml
75
- } from "./chunk-FTKZAOFD.js";
75
+ } from "./chunk-T6GRXUOE.js";
76
76
  import {
77
77
  AdsDeliverySnapshotStatuses,
78
78
  AdsHistoricalCampaignRollupStatuses,
@@ -148,7 +148,7 @@ import {
148
148
  shareOfVoiceReason,
149
149
  visibilityReportRequestSchema,
150
150
  winnabilityClassSchema
151
- } from "./chunk-BULKBROE.js";
151
+ } from "./chunk-QRNKMGVD.js";
152
152
 
153
153
  // src/cli.ts
154
154
  import { pathToFileURL } from "url";
package/dist/index.js CHANGED
@@ -3,12 +3,12 @@ import {
3
3
  createGoogleMarketingCredentialStore,
4
4
  createGoogleMarketingRuntime,
5
5
  createServer
6
- } from "./chunk-JOSSB4QC.js";
6
+ } from "./chunk-T4OO575U.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-36RKISAI.js";
10
- import "./chunk-FTKZAOFD.js";
11
- import "./chunk-BULKBROE.js";
9
+ } from "./chunk-V4ZLHKOG.js";
10
+ import "./chunk-T6GRXUOE.js";
11
+ import "./chunk-QRNKMGVD.js";
12
12
  export {
13
13
  GoogleMarketingRuntimeError,
14
14
  createGoogleMarketingCredentialStore,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IntelligenceService
3
- } from "./chunk-FTKZAOFD.js";
4
- import "./chunk-BULKBROE.js";
3
+ } from "./chunk-T6GRXUOE.js";
4
+ import "./chunk-QRNKMGVD.js";
5
5
  export {
6
6
  IntelligenceService
7
7
  };
package/dist/mcp.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  autoSyncSkills
3
- } from "./chunk-32Q2NZ4S.js";
3
+ } from "./chunk-S5QNBQ72.js";
4
4
  import {
5
5
  createApiClient,
6
6
  createCanonryMcpServer
7
- } from "./chunk-36RKISAI.js";
7
+ } from "./chunk-V4ZLHKOG.js";
8
8
  import {
9
9
  isReadOnlyKey
10
- } from "./chunk-BULKBROE.js";
10
+ } from "./chunk-QRNKMGVD.js";
11
11
 
12
12
  // src/mcp/cli.ts
13
13
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainyc/canonry",
3
- "version": "4.192.0",
3
+ "version": "4.192.2",
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
  "license": "FSL-1.1-ALv2",
@@ -70,32 +70,32 @@
70
70
  "@types/node-cron": "^3.0.11",
71
71
  "tsup": "^8.5.1",
72
72
  "tsx": "^4.19.0",
73
- "@ainyc/canonry-api-client": "0.0.0",
74
73
  "@ainyc/canonry-web": "0.0.0",
74
+ "@ainyc/canonry-api-client": "0.0.0",
75
75
  "@ainyc/canonry-api-routes": "0.0.0",
76
- "@ainyc/canonry-contracts": "0.0.0",
77
76
  "@ainyc/canonry-config": "0.0.0",
77
+ "@ainyc/canonry-contracts": "0.0.0",
78
78
  "@ainyc/canonry-db": "0.0.0",
79
79
  "@ainyc/canonry-integration-bing": "0.0.0",
80
- "@ainyc/canonry-integration-cloud-run": "0.0.0",
81
- "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
82
80
  "@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
81
+ "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
82
+ "@ainyc/canonry-integration-cloud-run": "0.0.0",
83
83
  "@ainyc/canonry-integration-commoncrawl": "0.0.0",
84
84
  "@ainyc/canonry-integration-google": "0.0.0",
85
- "@ainyc/canonry-integration-google-business-profile": "0.0.0",
85
+ "@ainyc/canonry-integration-google-ads": "0.0.0",
86
86
  "@ainyc/canonry-integration-google-places": "0.0.0",
87
+ "@ainyc/canonry-integration-google-business-profile": "0.0.0",
87
88
  "@ainyc/canonry-integration-google-tag-manager": "0.0.0",
88
89
  "@ainyc/canonry-integration-openai-ads": "0.0.0",
89
- "@ainyc/canonry-integration-google-ads": "0.0.0",
90
90
  "@ainyc/canonry-integration-traffic": "0.0.0",
91
- "@ainyc/canonry-integration-wordpress": "0.0.0",
92
91
  "@ainyc/canonry-intelligence": "0.0.0",
93
- "@ainyc/canonry-provider-cdp": "0.0.0",
94
92
  "@ainyc/canonry-provider-claude": "0.0.0",
95
- "@ainyc/canonry-provider-perplexity": "0.0.0",
96
- "@ainyc/canonry-provider-openai": "0.0.0",
93
+ "@ainyc/canonry-integration-wordpress": "0.0.0",
94
+ "@ainyc/canonry-provider-gemini": "0.0.0",
97
95
  "@ainyc/canonry-provider-local": "0.0.0",
98
- "@ainyc/canonry-provider-gemini": "0.0.0"
96
+ "@ainyc/canonry-provider-openai": "0.0.0",
97
+ "@ainyc/canonry-provider-perplexity": "0.0.0",
98
+ "@ainyc/canonry-provider-cdp": "0.0.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "pnpm run build:cli && pnpm run build:web",
@@ -1 +0,0 @@
1
- import{D as le,r as w,u as E,C as de,j as e,L as A}from"./vendor-tanstack-ZXXkndVj.js";import{v as ce,cC as he,dM as me,i as L,dN as xe,cK as pe,cl as ue,B as j,T as N,aw as z,ax as D,I as P,dO as je,dP as ye,dQ as be}from"./index-CCPMPGar.js";import{j as ve,o as ge}from"./ChartPrimitives-Bxa_vFmq.js";import{m as Ne}from"./v2-overview-adapter-COMP5UGt.js";import{I as fe}from"./vendor-lucide-CW2qe0uH.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-markdown-B-Oq2NYq.js";import"./vendor-yaml-GWJz5H2G.js";const W=50,h={branded:{headline:"When they know your name",technical:"Branded queries"},"non-brand":{headline:"When they don't",technical:"Non-brand queries"}},we={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",not_applicable:"Not applicable for this Property"},H={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"}},G={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 Pe(s){return[...s].sort((t,a)=>+(a.classification==="assigned")-+(t.classification==="assigned"))}function Ce(s){return`${s.expectedSlotId}:${s.usageEdgeId}`}function Ee({row:s}){return s.mentioned===null?e.jsxs("span",{className:"inline-flex flex-col items-start gap-0.5",children:[e.jsx(N,{tone:"neutral",children:"Not measured"}),e.jsx("span",{className:"text-xs text-muted",children:"No mention signal for this Property"})]}):e.jsx(N,{tone:s.mentioned?"positive":"neutral",children:s.mentioned?"Mentioned":"Not mentioned"})}const Le="—";function Me({row:s}){return s.cited===null?e.jsxs("span",{className:"inline-flex flex-col items-start gap-0.5",children:[e.jsx(N,{tone:"neutral",children:"Not measured"}),e.jsx("span",{className:"text-xs text-muted",children:"Sources were not fully captured"})]}):e.jsx(N,{tone:s.cited?"positive":"neutral",children:s.cited?"Cited":"Not cited"})}function Re({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.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:Pe(s.sources).map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(N,{tone:G[t.classification].tone,children:G[t.classification].label})}),e.jsx("td",{className:"break-all text-secondary",children:t.sourceUrl})]},t.sourceUrl))})]})})}function Se({project:s,targetKey:t,row:a}){const n=E({...be({client:L,path:{name:s},query:{targetKey:t,resultId:a.observationId}})});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 o=n.data?.answer;return o==null||o.trim()===""?e.jsx("p",{className:"py-2 text-sm text-secondary",children:"This answer was measured, but its text was not stored."}):e.jsxs("div",{className:"py-2",children:[e.jsxs("h4",{className:"mb-1 text-xs font-medium tracking-wide text-muted uppercase",children:["What ",a.provider," answered"]}),e.jsx("p",{className:"max-h-64 overflow-y-auto whitespace-pre-wrap text-sm leading-relaxed text-secondary",children:o})]})}function k(s){return we[s.reason]??"Not measured"}function T({metric:s,emphasis:t=!1}){if(s.state==="unavailable")return e.jsxs("span",{className:"inline-flex flex-col gap-0.5",children:[e.jsx("span",{className:t?"text-lg font-semibold text-secondary":"text-sm font-medium text-secondary",children:"Not measured"}),e.jsx("span",{className:"text-sm text-secondary",children:k(s)})]});const a=`${Math.round(s.value*100)}%`,n=s.numerator===void 0||s.denominator===void 0?null:`${s.numerator} of ${s.denominator}`;return e.jsxs("span",{className:"inline-flex flex-col gap-0.5 tabular-nums",children:[e.jsx("span",{className:t?"text-lg font-semibold text-heading":"text-sm font-medium text-primary",children:a}),n?e.jsx("span",{className:"text-xs text-muted",children:n}):null]})}function Y(s,t,a){return je({client:L,path:{name:s},query:{scope:"property",targetKey:t,queryClass:a}})}function Z(s){return s?.properties.items.at(0)}function Ae({measuredAt:s,unmeasuredReason:t,queryClass:a}){const n=s===void 0?null:s===null?"No completed sweep yet":`Measured ${ve(ge(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?` · ${h[a].technical.toLocaleLowerCase()} only`:""]})}function Te({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(P,{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(j,{asChild:!0,type:"button",size:"sm",variant:"outline",children:e.jsx(A,{to:"/projects/$projectName",params:{projectName:s},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 S({label:s,metric:t,failed:a=!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:a?"Unavailable":"…"}),a?e.jsx("div",{}):e.jsx("div",{className:"aeo-hero-row-bar","aria-hidden":"true"}),e.jsx("p",{className:"aeo-hero-row-detail",children:a?"Could not be loaded":"Loading"})]});if(t.state==="unavailable"){const m=k(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:m==="Not measured"?"":m})]})}const n=Math.round(t.value*100),o=t.numerator===void 0||t.denominator===void 0?null:`${t.numerator} of ${t.denominator}`;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:[n,e.jsx("span",{className:"text-faint",children:"%"})]}),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:`${n}%`}})}),e.jsx("p",{className:"aeo-hero-row-detail tabular-nums",children:o??""})]})}function ke({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(S,{label:"Mentioned",metric:t?.mentionCoverage,failed:n}),e.jsx(S,{label:"Cited",metric:t?.citationCoverage,failed:n})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Branded · already named"}),e.jsx(S,{label:"Mentioned",metric:s?.mentionCoverage,failed:a}),e.jsx(S,{label:"Cited",metric:s?.citationCoverage,failed:a})]})]})]})}function qe({branded:s,nonBrand:t,brandedError:a,nonBrandError:n,onRetry:o}){const m=[{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(P,{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:m.map(({queryClass:r,row:l,isError:y})=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("span",{className:"block font-medium text-heading",children:h[r].headline}),e.jsx("span",{className:"mt-0.5 block text-xs text-muted",children:h[r].technical}),l&&y?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(j,{type:"button",size:"sm",variant:"ghost",className:"h-11 px-3 text-sm md:h-11",onClick:()=>o(r),children:["Retry ",h[r].technical.toLocaleLowerCase()]})]}):null]}),l?e.jsxs(e.Fragment,{children:[e.jsx("td",{children:e.jsx(T,{metric:l.mentionCoverage,emphasis:!0})}),e.jsx("td",{children:e.jsx(T,{metric:l.citationCoverage,emphasis:!0})})]}):y?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 ",h[r].technical.toLocaleLowerCase(),"."]}),e.jsxs(j,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>o(r),children:["Retry ",h[r].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…"})})]})]},r))})]})})]})}function Be({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(P,{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 ",h[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 ",h[t].technical.toLocaleLowerCase()," for this Property.",s.mentionCoverage.state==="unavailable"?` ${k(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(T,{metric:n.mentionCoverage})}),e.jsx("td",{children:e.jsx(T,{metric:n.citationCoverage})})]},n.provider))})]})})]})}function Ue(s){const t=s.questions.join(" · ");return s.questionsTruncated?`${t} +${s.questionTotal-s.questions.length} more`:t}function Ie({project:s,targetKey:t,queryClass:a}){const n=E({...ye({client:L,path:{name:s},query:{targetKey:t,queryClass:a}})});if(n.isPending||n.isError)return null;const o=n.data?.competitors??[],m=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(P,{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."})]})}),o.length>0?e.jsxs("p",{className:"supporting-copy",children:[n.data?.total??o.length," named"]}):null]}),o.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:o.map(r=>e.jsxs("tr",{children:[e.jsx("td",{className:"text-strong",children:r.name}),e.jsx("td",{className:"tabular-nums text-secondary",children:r.occurrences}),e.jsxs("td",{className:"text-secondary",children:[r.providers.join(", "),r.providersTruncated?` +${r.providerTotal-r.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:r.questionTotal}),e.jsx(P,{text:Ue(r)})]})})]},r.name))})]})}),m?.state==="available"?e.jsxs("p",{className:"supporting-copy mt-2",children:[m.targetMissResults," of ",m.answeredResults," answers to ",h[a].technical.toLocaleLowerCase()," did not name this Property."]}):null]})]})}function $e({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:[h[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 ",h[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 _e({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(P,{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))})]})})]})}function Ye(){const{projectName:s,targetKey:t}=le({strict:!1}),[a,n]=w.useState("non-brand"),[o,m]=w.useState(new Set),r=s??"",l=t??"",y=!!r&&!!l,{canWrite:q}=ce(),C=E({...he({client:L,path:{name:r}}),enabled:y}),b=E({...Y(r,l,"branded"),enabled:y}),v=E({...Y(r,l,"non-brand"),enabled:y}),B=Z(b.data),U=Z(v.data),x=a==="branded"?b.data:v.data,f=a==="branded"?B:U,O=(a==="branded"?b.isError:v.isError)&&f===void 0,Q=x?.measurement.displayedRunId,J=f?.mentionCoverage.state==="unavailable"?k(f.mentionCoverage):void 0,X=x===void 0?void 0:x.measurement.completedAt??null,M={client:L,path:{name:r},query:{targetKey:l,queryClass:a,shape:me.answers,limit:W,...Q?{runId:Q}:{}}},d=de({...xe(M),enabled:y&&x!==void 0,initialPageParam:M,getNextPageParam:i=>i.answers?.nextCursor?{path:M.path,query:{...M.query,cursor:i.answers.nextCursor}}:void 0}),I=C.data?.active??null,p=I?.plan.schemaVersion===2?I.plan:null,ee=I!==null&&p===null,R=p?.targets.find(i=>i.stableKey===l)??null,se=w.useMemo(()=>{if(!p)return[];const i=new Map(p.querySnapshots.map(c=>[c.queryId,c.queryText]));return[...new Set(p.assignments.filter(c=>c.targetKey===l&&c.queryClass===a).flatMap(c=>{const u=i.get(c.queryId);return u===void 0?[]:[u]}))].sort((c,u)=>c.localeCompare(u))},[p,l,a]),te=w.useMemo(()=>R?.urlMatchers.map(Ne)??[],[R]),ae=w.useMemo(()=>p?.groups.filter(i=>i.targetKeys.includes(l))??[],[p,l]),g=w.useMemo(()=>(d.data?.pages??[]).flatMap(u=>u.answers?.items??[]),[d.data]),V=d.data?.pages[0]?.answers?.totalEstimate??g.length,ne=(d.data?.pages??[]).length>0&&(d.data?.pages??[]).every(i=>i.answers===void 0),re=d.data?.pages[0]?.measurement.state,$=e.jsxs(A,{to:"/projects/$projectName",params:{projectName:r},className:"inline-flex items-center gap-1 text-xs text-muted hover:text-strong",children:[e.jsx(fe,{className:"size-3.5","aria-hidden":"true"}),"Back to measurement overview"]});if(!y)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(!pe("portfolio",ue()?.projectTabs))return e.jsx("div",{className:"page-container",children:e.jsx("p",{className:"text-sm text-muted",children:"This view is not available here."})});if(C.isPending&&!C.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 ie=C.isError&&C.data===void 0,F=b.isError&&b.data===void 0,K=v.isError&&v.data===void 0;return ie||F&&K?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(j,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>{C.refetch(),b.refetch(),v.refetch()},children:"Try again"})]}):!p||!R?e.jsxs("div",{className:"page-container space-y-3",children:[$,e.jsx("p",{role:"status",className:"text-sm text-secondary",children:p?"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(j,{asChild:!0,type:"button",variant:"outline",className:"h-11 px-4 text-sm md:h-11",children:e.jsx(A,{to:"/projects/$projectName/portfolio",params:{projectName:r},children:q?ee?"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:R.label}),e.jsxs("p",{className:"page-subtitle",children:["Property in ",r]})]}),e.jsxs("div",{className:"page-header-right",children:[x?e.jsx(N,{tone:H[x.measurement.state].tone,children:H[x.measurement.state].label}):null,f&&f.flags>0?e.jsxs(N,{tone:"caution",children:[f.flags," flagged"]}):null]})]}),e.jsx(ke,{branded:B,nonBrand:U,brandedFailed:F,nonBrandFailed:K}),e.jsx(qe,{branded:B,nonBrand:U,brandedError:b.isError,nonBrandError:v.isError,onRetry:i=>{i==="branded"?b.refetch():v.refetch()}}),x&&(x.measurement.state==="not_measured"||x.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:D()?z:q?"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(j,{asChild:!0,type:"button",className:"h-11 px-4 text-sm md:h-11",children:e.jsx(A,{to:"/projects/$projectName",params:{projectName:r},children:q?"Go to measurement overview":"View measurement overview"})})]}):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:a,onChange:i=>n(i.target.value==="branded"?"branded":"non-brand"),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:h["non-brand"].technical}),e.jsx("option",{value:"branded",children:h.branded.technical})]})]}),e.jsx(Ae,{measuredAt:X,unmeasuredReason:J,queryClass:a})]}),e.jsx(Be,{row:f,queryClass:a,isError:O}),e.jsx(Ie,{project:r,targetKey:l,queryClass:a}),e.jsx($e,{questions:se,queryClass:a}),e.jsx(_e,{urls:te}),e.jsx(Te,{project:r,groups:ae}),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(P,{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."})]})}),g.length>0?e.jsxs("p",{className:"supporting-copy",children:[g.length," of ",V]}):null]}),O?e.jsxs("p",{className:"text-sm text-secondary",children:["Evidence for ",h[a].technical.toLocaleLowerCase()," is unavailable. Retry that query type above."]}):d.isPending&&g.length===0?e.jsx("p",{className:"text-sm text-secondary",children:"Loading evidence…"}):d.isError&&g.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(j,{type:"button",size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",onClick:()=>{d.refetch()},children:"Retry evidence"})]}):re==="not_measured"?e.jsx("p",{className:"text-sm text-secondary",children:D()?z:"Not measured yet. Run a measurement to collect the answers for this Property."}):ne?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."}):g.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:"overflow-x-auto rounded-md border border-default",children:e.jsxs("table",{className:"evidence-table min-w-[720px]",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:g.map(i=>{const c=Ce(i),u=o.has(c);return e.jsxs(w.Fragment,{children:[e.jsxs("tr",{children:[e.jsxs("td",{className:"text-secondary",children:[e.jsx("span",{className:"block",children:i.queryText}),e.jsx("span",{className:"mt-1 block text-xs text-muted",children:[i.provider,i.location].filter(Boolean).join(" · ")}),i.historical||i.bridged?e.jsx("span",{className:"mt-1 flex",children:e.jsx(N,{tone:"caution",children:"Historical"})}):null]}),e.jsx("td",{children:e.jsx(Ee,{row:i})}),e.jsx("td",{children:e.jsx(Me,{row:i})}),e.jsx("td",{className:"tabular-nums text-secondary",children:i.cited===null?Le:i.sources.length}),e.jsx("td",{className:"text-right",children:e.jsx(j,{type:"button",size:"sm",variant:"ghost","aria-expanded":u,onClick:()=>m(oe=>{const _=new Set(oe);return _.delete(c)||_.add(c),_}),children:u?`Hide the answer for ${i.queryText}`:`Read the answer for ${i.queryText}`})})]}),u?e.jsx("tr",{children:e.jsxs("td",{colSpan:5,className:"bg-surface-subtle px-4",children:[e.jsx(Se,{project:r,targetKey:l,row:i}),e.jsx(Re,{row:i})]})}):null]},c)})})]})}),d.hasNextPage?e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-secondary",children:[e.jsxs("span",{children:["Showing ",g.length," of ",V]}),d.isFetchNextPageError?e.jsx("span",{role:"alert",children:"Could not load more evidence."}):null,e.jsx(j,{size:"sm",variant:"outline",className:"h-11 px-4 text-sm md:h-11",disabled:d.isFetchingNextPage,onClick:()=>{d.fetchNextPage()},children:d.isFetchingNextPage?"Loading…":d.isFetchNextPageError?"Retry more evidence":`Show ${W} more`})]}):null]})]})]})}export{Ye as MeasurementPropertyPage};