react-semaphor 0.1.420 → 0.1.421

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 (57) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +28 -27
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +2 -2
  5. package/dist/chunks/analyze-result-contract-B5Eeu7vD.js +1 -0
  6. package/dist/chunks/analyze-result-contract-sWcmvBOA.js +2070 -0
  7. package/dist/chunks/{calendar-preferences-dialog-f0Z7Kf-U.js → calendar-preferences-dialog-CscmhyuZ.js} +1 -1
  8. package/dist/chunks/{calendar-preferences-dialog-DIfAbE_y.js → calendar-preferences-dialog-cN3_2C-u.js} +3 -3
  9. package/dist/chunks/{dashboard-briefing-launcher-anh-Jy5v.js → dashboard-briefing-launcher-BYTBNetR.js} +4 -4
  10. package/dist/chunks/{dashboard-briefing-launcher-C3tNkGFG.js → dashboard-briefing-launcher-DmZkzIC3.js} +1 -1
  11. package/dist/chunks/{dashboard-controls-DQxlOxzy.js → dashboard-controls-9DFeKIP4.js} +1 -1
  12. package/dist/chunks/{dashboard-controls-8dCQaPaq.js → dashboard-controls-PhzuaTBj.js} +5 -5
  13. package/dist/chunks/{dashboard-json-i7Ae9KGD.js → dashboard-json-Cxhw2TZc.js} +3 -3
  14. package/dist/chunks/{dashboard-json-B309EInF.js → dashboard-json-DyRHI3mL.js} +1 -1
  15. package/dist/chunks/{edit-dashboard-visual-4HycwBHR.js → edit-dashboard-visual-3_jiBXsu.js} +1 -1
  16. package/dist/chunks/{edit-dashboard-visual-z3IqzYnj.js → edit-dashboard-visual-BigSJ3-x.js} +4 -4
  17. package/dist/chunks/{index-yxKWKFdr.js → index-BKDQw0aK.js} +2 -2
  18. package/dist/chunks/{index-B6DLEXRX.js → index-CH2ZzQo4.js} +5 -5
  19. package/dist/chunks/{switch-D6Ygf3wA.js → switch-CiOjVyVI.js} +1 -1
  20. package/dist/chunks/{switch-COWQU8aK.js → switch-TbCsyhv9.js} +1 -1
  21. package/dist/chunks/{update-policy-BzT2k4n6.js → update-policy-2MZ-Vf7v.js} +211 -187
  22. package/dist/chunks/update-policy-qpyAkOyO.js +3 -0
  23. package/dist/chunks/{use-create-flow-overlay-state-CX0D-6HM.js → use-create-flow-overlay-state-BzcJWNzh.js} +3 -3
  24. package/dist/chunks/{use-create-flow-overlay-state-DENfd7sW.js → use-create-flow-overlay-state-DUQmgb9H.js} +1 -1
  25. package/dist/chunks/{validators-Cxr9qbrR.js → validators-D0pfj3jJ.js} +93 -93
  26. package/dist/chunks/validators-Dj1Y-46V.js +1 -0
  27. package/dist/dashboard/index.cjs +1 -1
  28. package/dist/dashboard/index.js +1 -1
  29. package/dist/dashboard-authoring/index.cjs +1 -1
  30. package/dist/dashboard-authoring/index.js +14 -14
  31. package/dist/data-app-builder/index.cjs +1 -1
  32. package/dist/data-app-builder/index.js +2 -2
  33. package/dist/data-app-codegen/index.cjs +1 -1
  34. package/dist/data-app-codegen/index.js +2 -2
  35. package/dist/data-app-codegen-node/index.cjs +251 -139
  36. package/dist/data-app-codegen-node/index.js +806 -657
  37. package/dist/data-app-sdk/index.cjs +2 -2
  38. package/dist/data-app-sdk/index.js +730 -686
  39. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  40. package/dist/data-app-sdk-adapters/index.js +51 -51
  41. package/dist/data-app-sdk-validation/index.cjs +1 -1
  42. package/dist/data-app-sdk-validation/index.js +2 -2
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +7 -7
  45. package/dist/surfboard/index.cjs +1 -1
  46. package/dist/surfboard/index.js +2 -2
  47. package/dist/types/analytics-protocol.d.ts +12 -5
  48. package/dist/types/dashboard-assistant.d.ts +0 -5
  49. package/dist/types/data-app-codegen-node.d.ts +12 -2
  50. package/dist/types/data-app-codegen.d.ts +12 -2
  51. package/dist/types/data-app-sdk-validation.d.ts +0 -5
  52. package/dist/types/data-app-sdk.d.ts +17 -5
  53. package/package.json +1 -1
  54. package/dist/chunks/analyze-result-contract-DdhEt99q.js +0 -2004
  55. package/dist/chunks/analyze-result-contract-DwRzl7yJ.js +0 -1
  56. package/dist/chunks/update-policy-VloD-0YM.js +0 -3
  57. package/dist/chunks/validators-BMQo93Y0.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../chunks/operators-DrTQsJXv.js"),o=require("../chunks/validators-BMQo93Y0.js"),e=require("../chunks/analyze-result-contract-DwRzl7yJ.js"),t=require("../chunks/catalog-field-grounding-Bnx-3tE0.js");function d(a,r={}){const i=c(a),s={connectionId:r.connectionId,connectionType:a,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...s,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...s,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...s,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...s,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...s,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:r.connectionId,connectionType:a,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...s,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...s,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:s}function u(a){const r=c(a);switch(r){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return r;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function p(a){return a.capabilities.prefixLevels.every(r=>!!m(a.source,r))}function h(a){const r=a.quoteIdentifier??S;return a.capabilities.prefixLevels.map(i=>m(a.source,i)).filter(i=>!!i).map(i=>r(i,a.capabilities.dialect)).join(".")}function m(a,r){return r==="database"?a.databaseName:r==="schema"?a.schemaName:a.tableName}function S(a,r){return r==="mysql"||r==="bigquery"||r==="clickhouse"||r==="duckdb"?`\`${a.replace(/`/g,"``")}\``:r==="mssql"?`[${a.replace(/]/g,"]]")}]`:`"${a.replace(/"/g,'""')}"`}function c(a){if(typeof a!="string")return"";const r=[];for(const i of a.trim().toLowerCase())y(i)&&r.push(i);return r.join("")}function y(a){const r=a.charCodeAt(0);return r>=48&&r<=57||r>=97&&r<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},A={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",inputId:"region",source:n,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=l.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=l.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=o.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=o.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=o.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=o.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=o.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=o.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=o.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=e.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION;exports.getSemaphorAnalyzeResultFieldNames=e.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=e.isSemaphorAnalyzeResultFieldName;exports.isSemaphorDataAppCodegenSummary=e.isSemaphorDataAppCodegenSummary;exports.mergeSemaphorSourcesByIdentity=e.mergeSemaphorSourcesByIdentity;exports.parseSemaphorAnalyzeResult=e.parseSemaphorAnalyzeResult;exports.preferSemaphorFieldRefMetadata=e.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=e.preferSemaphorSourceMetadata;exports.semaphorAnalyticsCoverageSchema=e.semaphorAnalyticsCoverageSchema;exports.semaphorAnalyticsDiagnosticFeedbackSchema=e.semaphorAnalyticsDiagnosticFeedbackSchema;exports.semaphorAnalyticsExecutionResultSchema=e.semaphorAnalyticsExecutionResultSchema;exports.semaphorAnalyticsPopulationSchema=e.semaphorAnalyticsPopulationSchema;exports.semaphorAnalyticsResultSchema=e.semaphorAnalyticsResultSchema;exports.semaphorAnalyticsValidationIssueSchema=e.semaphorAnalyticsValidationIssueSchema;exports.semaphorAnalyticsValidationResultSchema=e.semaphorAnalyticsValidationResultSchema;exports.semaphorAnalyzeResultSchema=e.semaphorAnalyzeResultSchema;exports.semaphorAnalyzeResultShape=e.semaphorAnalyzeResultShape;exports.semaphorDataAppCodegenSummarySchema=e.semaphorDataAppCodegenSummarySchema;exports.semaphorDerivedFieldDefinitionSchema=e.semaphorDerivedFieldDefinitionSchema;exports.semaphorExecutionFieldRefSchema=e.semaphorExecutionFieldRefSchema;exports.semaphorFieldRefSchema=e.semaphorFieldRefSchema;exports.semaphorFieldRefsMatch=e.semaphorFieldRefsMatch;exports.semaphorInputOptionsResultSchema=e.semaphorInputOptionsResultSchema;exports.semaphorMatrixResultSchema=e.semaphorMatrixResultSchema;exports.semaphorMetricMeasureBindingKey=e.semaphorMetricMeasureBindingKey;exports.semaphorMetricResultSchema=e.semaphorMetricResultSchema;exports.semaphorPhysicalSourceRefSchema=e.semaphorPhysicalSourceRefSchema;exports.semaphorRecordsResultSchema=e.semaphorRecordsResultSchema;exports.semaphorRelationshipDiagnosticsSchema=e.semaphorRelationshipDiagnosticsSchema;exports.semaphorResultColumnSchema=e.semaphorResultColumnSchema;exports.semaphorSemanticSourceRefSchema=e.semaphorSemanticSourceRefSchema;exports.semaphorSourceIdentityKey=e.semaphorSourceIdentityKey;exports.semaphorSourceRefSchema=e.semaphorSourceRefSchema;exports.semaphorSourcesReferToSameDataset=e.semaphorSourcesReferToSameDataset;exports.semaphorSqlResultSchema=e.semaphorSqlResultSchema;exports.semaphorSqlSourceRefSchema=e.semaphorSqlSourceRefSchema;exports.validateSemaphorDataAppCodegenSummary=e.validateSemaphorDataAppCodegenSummary;exports.buildAnalyticsCatalogFieldSummary=t.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=t.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=t.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=t.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=t.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=t.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=t.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=t.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=t.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=t.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=t.normalizeAnalyticsCatalogName;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=A;exports.buildSemaphorQualifiedSourcePath=h;exports.getSemaphorConnectionCapabilities=d;exports.normalizeSemaphorDialect=u;exports.semaphorSourceHasRequiredCoordinates=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../chunks/operators-DrTQsJXv.js"),o=require("../chunks/validators-Dj1Y-46V.js"),e=require("../chunks/analyze-result-contract-B5Eeu7vD.js"),t=require("../chunks/catalog-field-grounding-Bnx-3tE0.js");function d(a,r={}){const i=c(a),s={connectionId:r.connectionId,connectionType:a,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...s,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...s,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...s,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...s,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...s,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:r.connectionId,connectionType:a,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...s,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...s,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:s}function u(a){const r=c(a);switch(r){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return r;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function p(a){return a.capabilities.prefixLevels.every(r=>!!m(a.source,r))}function h(a){const r=a.quoteIdentifier??S;return a.capabilities.prefixLevels.map(i=>m(a.source,i)).filter(i=>!!i).map(i=>r(i,a.capabilities.dialect)).join(".")}function m(a,r){return r==="database"?a.databaseName:r==="schema"?a.schemaName:a.tableName}function S(a,r){return r==="mysql"||r==="bigquery"||r==="clickhouse"||r==="duckdb"?`\`${a.replace(/`/g,"``")}\``:r==="mssql"?`[${a.replace(/]/g,"]]")}]`:`"${a.replace(/"/g,'""')}"`}function c(a){if(typeof a!="string")return"";const r=[];for(const i of a.trim().toLowerCase())y(i)&&r.push(i);return r.join("")}function y(a){const r=a.charCodeAt(0);return r>=48&&r<=57||r>=97&&r<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},A={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",inputId:"region",source:n,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=l.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=l.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=o.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=o.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=o.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=o.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=o.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=o.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=o.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=e.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION;exports.getSemaphorAnalyzeResultFieldNames=e.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=e.isSemaphorAnalyzeResultFieldName;exports.isSemaphorDataAppCodegenSummary=e.isSemaphorDataAppCodegenSummary;exports.mergeSemaphorSourcesByIdentity=e.mergeSemaphorSourcesByIdentity;exports.parseSemaphorAnalyzeResult=e.parseSemaphorAnalyzeResult;exports.preferSemaphorFieldRefMetadata=e.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=e.preferSemaphorSourceMetadata;exports.semaphorAnalyticsCoverageSchema=e.semaphorAnalyticsCoverageSchema;exports.semaphorAnalyticsDiagnosticFeedbackSchema=e.semaphorAnalyticsDiagnosticFeedbackSchema;exports.semaphorAnalyticsExecutionResultSchema=e.semaphorAnalyticsExecutionResultSchema;exports.semaphorAnalyticsPopulationSchema=e.semaphorAnalyticsPopulationSchema;exports.semaphorAnalyticsResultSchema=e.semaphorAnalyticsResultSchema;exports.semaphorAnalyticsValidationIssueSchema=e.semaphorAnalyticsValidationIssueSchema;exports.semaphorAnalyticsValidationResultSchema=e.semaphorAnalyticsValidationResultSchema;exports.semaphorAnalyzeResultSchema=e.semaphorAnalyzeResultSchema;exports.semaphorAnalyzeResultShape=e.semaphorAnalyzeResultShape;exports.semaphorDataAppCodegenSummarySchema=e.semaphorDataAppCodegenSummarySchema;exports.semaphorDerivedFieldDefinitionSchema=e.semaphorDerivedFieldDefinitionSchema;exports.semaphorExecutionFieldRefSchema=e.semaphorExecutionFieldRefSchema;exports.semaphorFieldRefSchema=e.semaphorFieldRefSchema;exports.semaphorFieldRefsMatch=e.semaphorFieldRefsMatch;exports.semaphorInputOptionsResultSchema=e.semaphorInputOptionsResultSchema;exports.semaphorMatrixResultSchema=e.semaphorMatrixResultSchema;exports.semaphorMetricAggregate=e.semaphorMetricAggregate;exports.semaphorMetricMeasureBindingKey=e.semaphorMetricMeasureBindingKey;exports.semaphorMetricResultSchema=e.semaphorMetricResultSchema;exports.semaphorPhysicalSourceRefSchema=e.semaphorPhysicalSourceRefSchema;exports.semaphorRecordsResultSchema=e.semaphorRecordsResultSchema;exports.semaphorRelationshipDiagnosticsSchema=e.semaphorRelationshipDiagnosticsSchema;exports.semaphorResultColumnSchema=e.semaphorResultColumnSchema;exports.semaphorSemanticSourceRefSchema=e.semaphorSemanticSourceRefSchema;exports.semaphorSourceIdentityKey=e.semaphorSourceIdentityKey;exports.semaphorSourceRefSchema=e.semaphorSourceRefSchema;exports.semaphorSourcesReferToSameDataset=e.semaphorSourcesReferToSameDataset;exports.semaphorSqlResultSchema=e.semaphorSqlResultSchema;exports.semaphorSqlSourceRefSchema=e.semaphorSqlSourceRefSchema;exports.validateSemaphorDataAppCodegenSummary=e.validateSemaphorDataAppCodegenSummary;exports.buildAnalyticsCatalogFieldSummary=t.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=t.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=t.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=t.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=t.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=t.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=t.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=t.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=t.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=t.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=t.normalizeAnalyticsCatalogName;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=A;exports.buildSemaphorQualifiedSourcePath=h;exports.getSemaphorConnectionCapabilities=d;exports.normalizeSemaphorDialect=u;exports.semaphorSourceHasRequiredCoordinates=p;
@@ -1,7 +1,7 @@
1
1
  import { a as S, n as f } from "../chunks/operators-C8TxpM4C.js";
2
- import { p as g, b as v, d as A, e as R, v as C, c as I, a as T } from "../chunks/validators-Cxr9qbrR.js";
3
- import { d as F, S as k, a as D, g as q, b as M, i as E, K as L, c as O, p as N, J as x, C as P, A as z, D as w, B, y as H, o as G, q as U, F as Y, E as j, G as V, l as K, m as Q, k as $, s as W, u as J, x as X, L as Z, r as ee, f as ae, t as se, z as re, n as ie, e as te, H as ne, j as oe, I as le, w as me, h as de, v as ce } from "../chunks/analyze-result-contract-DdhEt99q.js";
4
- import { j as pe, a as he, g as be, c as Se, h as fe, f as ye, i as ge, e as ve, d as Ae, b as Re, n as Ce } from "../chunks/catalog-field-grounding-CJKAqtiC.js";
2
+ import { p as g, b as v, d as A, e as R, v as C, c as I, a as T } from "../chunks/validators-D0pfj3jJ.js";
3
+ import { e as F, S as k, a as D, g as q, c as M, i as E, L, d as O, p as N, K as x, D as P, B as z, E as w, C as B, z as H, q as G, r as U, G as Y, F as j, H as V, m as K, n as Q, l as $, s as W, w as J, y as X, b as Z, M as ee, t as ae, h as se, u as re, A as ie, o as te, f as ne, I as oe, k as le, J as me, x as de, j as ce, v as ue } from "../chunks/analyze-result-contract-sWcmvBOA.js";
4
+ import { j as he, a as be, g as Se, c as fe, h as ye, f as ge, i as ve, e as Ae, d as Re, b as Ce, n as Ie } from "../chunks/catalog-field-grounding-CJKAqtiC.js";
5
5
  function m(e, a = {}) {
6
6
  const s = n(e), r = {
7
7
  connectionId: a.connectionId,
@@ -252,23 +252,23 @@ export {
252
252
  F as SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT,
253
253
  k as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
254
254
  D as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
255
- pe as buildAnalyticsCatalogFieldSummary,
255
+ he as buildAnalyticsCatalogFieldSummary,
256
256
  u as buildSemaphorQualifiedSourcePath,
257
- he as getAnalyticsCatalogFieldCandidates,
258
- be as getAnalyticsCatalogFieldName,
257
+ be as getAnalyticsCatalogFieldCandidates,
258
+ Se as getAnalyticsCatalogFieldName,
259
259
  q as getSemaphorAnalyzeResultFieldNames,
260
260
  m as getSemaphorConnectionCapabilities,
261
- Se as isAnalyticsCatalogDateField,
262
- fe as isAnalyticsCatalogDimensionField,
263
- ye as isAnalyticsCatalogMetricField,
264
- ge as isAnalyticsDateLikeDataType,
265
- ve as isAnalyticsMetricIdentifierField,
266
- Ae as isAnalyticsTechnicalIdentifierField,
261
+ fe as isAnalyticsCatalogDateField,
262
+ ye as isAnalyticsCatalogDimensionField,
263
+ ge as isAnalyticsCatalogMetricField,
264
+ ve as isAnalyticsDateLikeDataType,
265
+ Ae as isAnalyticsMetricIdentifierField,
266
+ Re as isAnalyticsTechnicalIdentifierField,
267
267
  M as isSemaphorAnalyzeResultFieldName,
268
268
  E as isSemaphorDataAppCodegenSummary,
269
269
  L as mergeSemaphorSourcesByIdentity,
270
- Re as normalizeAnalyticsCatalogDataType,
271
- Ce as normalizeAnalyticsCatalogName,
270
+ Ce as normalizeAnalyticsCatalogDataType,
271
+ Ie as normalizeAnalyticsCatalogName,
272
272
  S as normalizeSemaphorAnalyticsFilterOperator,
273
273
  d as normalizeSemaphorDialect,
274
274
  f as normalizeSemaphorInputOperator,
@@ -292,23 +292,24 @@ export {
292
292
  W as semaphorFieldRefsMatch,
293
293
  J as semaphorInputOptionsResultSchema,
294
294
  X as semaphorMatrixResultSchema,
295
- Z as semaphorMetricMeasureBindingKey,
296
- ee as semaphorMetricResultSchema,
297
- ae as semaphorPhysicalSourceRefSchema,
298
- se as semaphorRecordsResultSchema,
299
- re as semaphorRelationshipDiagnosticsSchema,
300
- ie as semaphorResultColumnSchema,
301
- te as semaphorSemanticSourceRefSchema,
295
+ Z as semaphorMetricAggregate,
296
+ ee as semaphorMetricMeasureBindingKey,
297
+ ae as semaphorMetricResultSchema,
298
+ se as semaphorPhysicalSourceRefSchema,
299
+ re as semaphorRecordsResultSchema,
300
+ ie as semaphorRelationshipDiagnosticsSchema,
301
+ te as semaphorResultColumnSchema,
302
+ ne as semaphorSemanticSourceRefSchema,
302
303
  c as semaphorSourceHasRequiredCoordinates,
303
- ne as semaphorSourceIdentityKey,
304
- oe as semaphorSourceRefSchema,
305
- le as semaphorSourcesReferToSameDataset,
306
- me as semaphorSqlResultSchema,
307
- de as semaphorSqlSourceRefSchema,
304
+ oe as semaphorSourceIdentityKey,
305
+ le as semaphorSourceRefSchema,
306
+ me as semaphorSourcesReferToSameDataset,
307
+ de as semaphorSqlResultSchema,
308
+ ce as semaphorSqlSourceRefSchema,
308
309
  v as validateSemaphorAnalyticsIntent,
309
310
  A as validateSemaphorAnalyticsRecoveryPlan,
310
311
  R as validateSemaphorDashboardIntent,
311
- ce as validateSemaphorDataAppCodegenSummary,
312
+ ue as validateSemaphorDataAppCodegenSummary,
312
313
  C as validateSemaphorDerivedFieldDefinition,
313
314
  I as validateSemaphorOperationIntent,
314
315
  T as validateSemaphorResultCalculation
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-D6Ygf3wA.js"),A=require("../chunks/index-DRlMUglg.js"),J=require("../chunks/x-B6ghREd2.js");require("../chunks/analyze-result-contract-DwRzl7yJ.js");const U=require("../chunks/palette-C4KTXOug.js"),be=require("../chunks/braces-D2tStQjF.js"),fe=require("../chunks/save-C__QggEE.js"),me=require("../chunks/layout-grid-C0OI-MRn.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-CiOjVyVI.js"),A=require("../chunks/index-DRlMUglg.js"),J=require("../chunks/x-B6ghREd2.js");require("../chunks/analyze-result-contract-B5Eeu7vD.js");const U=require("../chunks/palette-C4KTXOug.js"),be=require("../chunks/braces-D2tStQjF.js"),fe=require("../chunks/save-C__QggEE.js"),me=require("../chunks/layout-grid-C0OI-MRn.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,9 +1,9 @@
1
1
  import { jsxs as d, jsx as r, Fragment as ce } from "react/jsx-runtime";
2
2
  import m from "react";
3
- import { c as q, P as ge, a as be, B as C, b as fe, U as De, C as Ie, R as me, e as le, S as se, d as Je, T as je, G as Le, H as U, I as $e, J as M, K as _e, M as Ve, N as Ue, O as Me, L as E, Q as K, V as Q, W as ee, X as he, Y as re, Z as oe, _ as ke, $ as xe, a0 as ye, a1 as ve, a2 as Ce, a3 as Ge } from "../chunks/switch-COWQU8aK.js";
3
+ import { c as q, P as ge, a as be, B as C, b as fe, U as De, C as Ie, R as me, e as le, S as se, d as Je, T as je, G as Le, H as U, I as $e, J as M, K as _e, M as Ve, N as Ue, O as Me, L as E, Q as K, V as Q, W as ee, X as he, Y as re, Z as oe, _ as ke, $ as xe, a0 as ye, a1 as ve, a2 as Ce, a3 as Ge } from "../chunks/switch-TbCsyhv9.js";
4
4
  import { r as We, v as He, A as Xe, a as Ye, p as Ze } from "../chunks/index-CJdxSyQq.js";
5
5
  import { c as ae, X as qe } from "../chunks/x-CXDkqdur.js";
6
- import "../chunks/analyze-result-contract-DdhEt99q.js";
6
+ import "../chunks/analyze-result-contract-sWcmvBOA.js";
7
7
  import { P as G } from "../chunks/palette-Cp1hqZtm.js";
8
8
  import { B as Ke } from "../chunks/braces-8TRlDwDw.js";
9
9
  import { S as Qe } from "../chunks/save-DgMfP0j8.js";
@@ -0,0 +1 @@
1
+ "use strict";const e=require("zod"),Ne="SUM";function j(o){return o?o.kind==="semantic"?[o.kind,o.domainId,o.datasetId?`datasetId:${o.datasetId}`:`datasetName:${o.datasetName}`].join(":"):o.kind==="physical"?[o.kind,o.connectionId,o.databaseName||"",o.schemaName||"",o.tableName].join(":"):[o.kind,o.connectionId,o.dialect||"",o.label||""].join(":"):""}function G(o,i){return!o||!i?o===i:o.kind!==i.kind?!1:o.kind==="semantic"&&i.kind==="semantic"?o.domainId!==i.domainId?!1:o.datasetId&&i.datasetId?o.datasetId===i.datasetId:o.datasetName===i.datasetName:j(o)===j(i)}function U(o,i){return o.kind!=="semantic"||i.kind!=="semantic"?o:{...o,datasetName:o.datasetName||i.datasetName,datasetId:o.datasetId||i.datasetId,label:o.label||i.label,connectionId:o.connectionId||i.connectionId}}function Me(o){const i=[];for(const t of o){const s=i.findIndex(n=>G(n,t));if(s===-1){i.push(t);continue}i[s]=U(i[s],t)}return i}function Ke(o,i){return o.name===i.name&&G(o.source,i.source)}function ue(o){return[o.source?j(o.source):"unknown",H(o),o.name].filter(Boolean).join(":")}function H(o){return Te(o.aggregate||Ne)}function Te(o){return o.trim().toUpperCase()}function De(o,i){return{...o,label:o.label||i.label,role:o.role||i.role,dataType:o.dataType||i.dataType,source:o.source&&i.source?U(o.source,i.source):o.source||i.source}}const F={answerSummary:"string",responseDetail:"responseDetail",mode:"string",comparisonType:"string",executionResult:"executionResult",compiledQuery:"unknown",data:"unknown",resultSets:"record",analysisWarnings:"unknownArray",columns:"unknownArray",records:"recordArray",rowCount:"number",rowLimitExceeded:"boolean",output:"string",querySpec:"unknown",metadata:"record",validation:"validationResult",coverage:"coverage",diagnosticFeedback:"diagnosticFeedback",missingFields:"stringArray",warnings:"unknownArray",comparison:"unknown",population:"population",comparisons:"recordArray",fieldsUsed:"compactExecutionFieldArray",primary:"recordArray",contributors:"recordArray",segments:"recordArray",periodChanges:"recordArray",changes:"recordArray",largestNegativeChanges:"recordArray",largestPositiveChanges:"recordArray",drivers:"recordArray",absoluteDeltaDrivers:"recordArray",largestNegativeDrivers:"recordArray",largestPositiveDrivers:"recordArray",periodRows:"recordArray",sql:"unknown",omitted:"stringArray"},C="semaphor-data-app-codegen-summary/v1",Oe="semaphor-data-app-codegen-summary-validator/v2",Be=new Set(["metric","records","matrix","analysis","sql_fallback"]),Pe=new Set(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]),Ve=new Set(["SUM","COUNT","AVG","MIN","MAX","MEDIAN","DISTINCT"]),Le=new Set(["absolute_delta","largest_negative","largest_positive","positive_and_negative","all"]),de=new Set(["source","id","label","measures","primaryMeasure","dateField","timeGrain","dimensions","comparison","orderBy","filters","relationshipHint","limit","derivedFields"]),Ge=new Set([...de,"analysis","timeWindow","filters","driverMode","includePopulation","calendarContext","chartTitle","chartType"]),Ue=new Set(["source","id","label","fields","dateField","timeGrain","timeWindow","filters","orderBy","relationshipHint","limit","pagination","totals","derivedFields"]),He=new Set(["source","id","label","filters","relationshipHint","rows","columns","values","totals","sort","expansion","layout","displayLimits"]),Qe=new Set(["source","id","label","sql","defaultParameters","pythonCode","fields","limit","pagination","rationale"]),Ye=new Set(["kpi","line_chart","bar_chart","stacked_bar_chart","pie_chart","donut_chart","area_chart","table","matrix","narrative","text_block","custom"]),We=new Set(["missing_measure","missing_dimension","missing_date","missing_relationship","missing_semantic_role","missing_current_app_state","raw_identifier_filter_options","unsupported_change_intent","ambiguous_field_grounding","bounded_intent_unavailable","invalid_bounded_intent_output","latest_snapshot_selector_not_modeled","unsupported_grain","requires_sql_escape_hatch","unsupported_sdk_capability"]);function Ze(o){return Q(o).ok}function Q(o){const i=[];if(!o||typeof o!="object")return{ok:!1,issues:["Summary must be an object."]};const t=o;return t.schemaVersion!==C&&i.push(`schemaVersion must be ${C}.`),(typeof t.title!="string"||!t.title.trim())&&i.push("title is required."),Array.isArray(t.sources)||i.push("sources must be an array."),Array.isArray(t.inputs)||i.push("inputs must be an array."),Array.isArray(t.views)||i.push("views must be an array."),Array.isArray(t.filterContracts)||i.push("filterContracts must be an array."),(!t.implementationChecklist||typeof t.implementationChecklist!="object")&&i.push("implementationChecklist must be an object."),t.implementationChecklist&&typeof t.implementationChecklist=="object"&&i.push(...Xe(t.implementationChecklist)),Array.isArray(t.sources)&&t.sources.forEach((s,n)=>{i.push(...k(s,`sources.${n}`))}),Array.isArray(t.inputs)&&t.inputs.forEach((s,n)=>{i.push(...et(s,`inputs.${n}`))}),Array.isArray(t.views)&&t.views.forEach((s,n)=>{i.push(...tt(s,`views.${n}`))}),Array.isArray(t.filterContracts)&&t.filterContracts.forEach((s,n)=>{i.push(...ct(s,`filterContracts.${n}`))}),t.unsupportedInsights!==void 0&&(Array.isArray(t.unsupportedInsights)?t.unsupportedInsights.forEach((s,n)=>{i.push(...Et(s,`unsupportedInsights.${n}`))}):i.push("unsupportedInsights must be an array.")),i.push(...Je(t)),{ok:i.length===0,issues:i}}function Je(o){const i=Array.isArray(o.unsupportedInsights)&&o.unsupportedInsights.some(u=>{var l;return oe.has((l=a(u))==null?void 0:l.reason)}),t=Array.isArray(o.views)&&o.views.some(u=>{var d;const l=a((d=a(u))==null?void 0:d.computation);return(l==null?void 0:l.kind)==="unsupported"&&oe.has(l.reason)});if(!i&&!t)return[];const s=[],n=a(o.validation);(n==null?void 0:n.status)!=="blocked"&&s.push("validation.status must be blocked when semantic model repair gaps are present.");const r=a(o.nextRequiredTool);return(r==null?void 0:r.name)!=="semaphor_propose_semantic_model_change"&&s.push("nextRequiredTool.name must be semaphor_propose_semantic_model_change when semantic model repair gaps are present."),s}const oe=new Set(["missing_relationship","raw_identifier_filter_options"]);function k(o,i){const t=a(o);return t?t.kind==="semantic"?typeof t.domainId=="string"&&t.domainId.trim()&&typeof t.datasetName=="string"&&t.datasetName.trim()?[]:[`${i} must include sourceKey or a supported source identity.`]:typeof t.sourceKey=="string"&&t.sourceKey.trim()?[]:t.kind==="physical"&&typeof t.tableName=="string"&&t.tableName.trim()&&typeof t.connectionId=="string"&&t.connectionId.trim()?[]:t.kind==="sql"&&typeof t.connectionId=="string"&&t.connectionId.trim()?[]:[`${i} must include sourceKey or a supported source identity.`]:[`${i} must be an object.`]}function Xe(o){const i=a(o);if(!i)return["implementationChecklist must be an object."];const t=[],s=["requiredDevtools","requiredInputOptions","filterScopeByInput","bindingsByView","validationCommands","browserSmokeChecks"];for(const r of s)r in i||t.push(`implementationChecklist.${r} is required.`);const n=a(i.requiredDevtools);return n?typeof n.mountRootDevtools!="boolean"&&t.push("implementationChecklist.requiredDevtools.mountRootDevtools must be a boolean."):t.push("implementationChecklist.requiredDevtools must be an object."),Array.isArray(i.requiredInputOptions)||t.push("implementationChecklist.requiredInputOptions must be an array."),Array.isArray(i.filterScopeByInput)||t.push("implementationChecklist.filterScopeByInput must be an array."),a(i.bindingsByView)||t.push("implementationChecklist.bindingsByView must be an object."),g(i.validationCommands)||t.push("implementationChecklist.validationCommands must be an array of strings."),g(i.browserSmokeChecks)||t.push("implementationChecklist.browserSmokeChecks must be an array of strings."),t}function et(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return(typeof t.id!="string"||!t.id.trim())&&s.push(`${i}.id is required.`),t.fieldRef&&s.push(...c(t.fieldRef,`${i}.fieldRef`)),s.push(...pe(t.optionQuery,`${i}.optionQuery`)),g(t.appliesToViewIds)||s.push(`${i}.appliesToViewIds must be an array of strings.`),t.bindings!==void 0&&!Array.isArray(t.bindings)&&s.push(`${i}.bindings must be an array.`),Array.isArray(t.bindings)&&t.bindings.forEach((n,r)=>{const u=a(n);if(!u){s.push(`${i}.bindings.${r} must be an object.`);return}g(u.appliesToViewIds)||s.push(`${i}.bindings.${r}.appliesToViewIds must be an array of strings.`),s.push(...c(u.fieldRef,`${i}.bindings.${r}.fieldRef`))}),s}function tt(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];if((typeof t.id!="string"||!t.id.trim())&&s.push(`${i}.id is required.`),t.visualSpec!==void 0&&s.push(...kt(t.visualSpec,`${i}.visualSpec`)),t.computation!==void 0&&s.push(...Ct(t.computation,`${i}.computation`)),wt(t))return s.push(...D(t,`${i}`)),t.fields!==void 0&&(Array.isArray(t.fields)?t.fields.forEach((d,b)=>{s.push(...c(d,`${i}.fields.${b}`))}):s.push(`${i}.fields must be an array.`)),t.queryKind!==void 0&&s.push(`${i}.queryKind is not allowed for non-executable views.`),t.sdkBuilder!==void 0&&s.push(`${i}.sdkBuilder is not allowed for non-executable views.`),t.sdkSpec!==void 0&&s.push(`${i}.sdkSpec is not allowed for non-executable views.`),s;if(!Array.isArray(t.fields))return s.push(`${i}.fields must be an array.`),(t.sdkSpec!==void 0||t.sdkBuilder!==void 0)&&s.push(`${i}.fields must be an array for executable views.`),s.push(...D(t,`${i}`)),s;t.fields.forEach((d,b)=>{s.push(...c(d,`${i}.fields.${b}`))}),w(t.queryKind)||s.push(`${i}.queryKind must be a supported codegen query kind.`),t.sdkBuilder!==void 0&&!he(t.sdkBuilder)&&s.push(`${i}.sdkBuilder must be a supported SDK builder.`),t.metricBindingKeys!==void 0&&(Array.isArray(t.metricBindingKeys)?t.metricBindingKeys.some(d=>typeof d!="string"||d.trim().length===0)&&s.push(`${i}.metricBindingKeys must be an array of strings.`):s.push(`${i}.metricBindingKeys must be an array of strings.`));const n=a(t.sdkSpec),r=(n==null?void 0:n.builder)==="semaphor.metric";r&&(!Array.isArray(t.metricBindingKeys)||t.metricBindingKeys.length===0)&&s.push(`${i}.metricBindingKeys is required for metric views.`);const u=it(t);r&&Array.isArray(t.metricBindingKeys)&&u&&JSON.stringify(t.metricBindingKeys)!==JSON.stringify(u)&&s.push(`${i}.metricBindingKeys must match the generated metric field binding keys in order.`);const l=a(t.computation);return(l==null?void 0:l.kind)==="server_query"&&w(t.queryKind)&&w(l.queryKind)&&l.queryKind!==t.queryKind&&s.push(`${i}.computation.queryKind must match queryKind.`),s.push(...pt({value:t.sdkSpec,path:`${i}.sdkSpec`,queryKind:typeof t.queryKind=="string"?t.queryKind:void 0,sdkBuilder:typeof t.sdkBuilder=="string"?t.sdkBuilder:void 0}),...D(t,`${i}`)),s}function it(o){const i=a(o.sdkSpec);if((i==null?void 0:i.builder)!=="semaphor.metric")return;const t=a(i.spec);if(!t)return;const n=[t.primaryMeasure,...Array.isArray(t.measures)?t.measures:[]].map(ot).filter(r=>!!r);return Array.from(new Map(n.map(r=>[r.identity,r.bindingKey])).values())}function ot(o){const i=a(o);if(!i||typeof i.name!="string"||!i.name.trim())return;const t=st(i);return t?{identity:JSON.stringify({source:t,name:i.name,aggregate:ce(i)}),bindingKey:nt(i)}:void 0}function st(o){if(typeof o.sourceKey=="string"&&o.sourceKey.trim())return{sourceKey:o.sourceKey};const i=a(o.source);if(i)return{kind:i.kind,domainId:i.domainId,datasetId:i.datasetId,datasetName:i.datasetName,name:i.name}}function nt(o){return typeof o.sourceKey=="string"&&o.sourceKey.trim()?[o.sourceKey,ce(o),o.name].filter(Boolean).join(":"):ue(o)}function ce(o){return H(o)}function D(o,i){var b;const t=a((b=a(o.visualSpec))==null?void 0:b.tableBehavior),s=a(o.sdkSpec),n=a(s==null?void 0:s.spec),r=typeof(s==null?void 0:s.builder)=="string"?s.builder:void 0,u=r==="semaphor.records"?a(n==null?void 0:n.totals):void 0,l=[];if(!t)return u&&l.push(`${i}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),l;const d=a(t.totals);return d?(d.mode==="server"&&(r!=="semaphor.records"&&l.push(`${i}.visualSpec.tableBehavior.totals.mode server is only supported for semaphor.records views.`),!u||u.mode!=="server"?l.push(`${i}.sdkSpec.spec.totals.mode must be server when tableBehavior.totals.mode is server.`):l.push(...rt({left:d.measures,right:u.measures,leftPath:`${i}.visualSpec.tableBehavior.totals.measures`,rightPath:`${i}.sdkSpec.spec.totals.measures`}))),d.mode!=="server"&&u&&l.push(`${i}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),r==="semaphor.sql"&&d.mode!=="none"&&l.push(`${i}.visualSpec.tableBehavior.totals.mode must be none for semaphor.sql views.`),r==="semaphor.sql"&&a(n==null?void 0:n.totals)&&l.push(`${i}.sdkSpec.spec.totals is not supported for semaphor.sql.`),l):(u&&l.push(`${i}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),l)}function rt({left:o,right:i,leftPath:t,rightPath:s}){if(!Array.isArray(o)||!Array.isArray(i))return[`${s} must match ${t}.`];const n=[];return o.length!==i.length?(n.push(`${s} must match ${t}.`),n):(o.forEach((r,u)=>{at(a(r),a(i[u]))||n.push(`${s}.${u} must match ${t}.${u}.`)}),n)}function at(o,i){return!o||!i?!1:o.name===i.name&&(o.role||"measure")===(i.role||"measure")&&se(o)===se(i)&&lt(o,i)}function se(o){return typeof o.aggregate=="string"?o.aggregate.toUpperCase():"SUM"}function lt(o,i){const t=a(o.source),s=a(i.source);if(ut(t,s))return!1;const n=ne(o),r=ne(i);if(n.size>0||r.size>0){for(const u of n)if(r.has(u))return!0;return!1}return!t||!s||t.kind!==s.kind?!1:t.kind==="semantic"?t.domainId===s.domainId&&t.datasetName===s.datasetName&&(t.datasetId===void 0||s.datasetId===void 0||t.datasetId===s.datasetId):t.kind==="physical"?t.connectionId===s.connectionId&&t.tableName===s.tableName:t.kind==="sql"?t.connectionId===s.connectionId:!1}function ut(o,i){if(!o||!i||o.kind!=="semantic"||i.kind!=="semantic")return!1;const t=typeof o.datasetId=="string"?o.datasetId.trim():"",s=typeof i.datasetId=="string"?i.datasetId.trim():"";return!!(t&&s&&t!==s)}function ne(o){const i=typeof o.sourceKey=="string"?o.sourceKey.trim():"";return i?new Set([i]):dt(a(o.source))}function dt(o){const i=new Set;if(!o)return i;const t=typeof o.sourceKey=="string"?o.sourceKey.trim():"";if(t&&i.add(t),o.kind==="semantic"){const s=typeof o.domainId=="string"?o.domainId:"",n=typeof o.datasetName=="string"?o.datasetName:"",r=typeof o.datasetId=="string"?o.datasetId:"";s&&r&&i.add(`semantic:${s}:datasetId:${r}`),s&&n&&i.add(`semantic:${s}:datasetName:${n}`)}if(o.kind==="physical"){const s=typeof o.connectionId=="string"?o.connectionId:"",n=typeof o.tableName=="string"?o.tableName:"",r=typeof o.databaseName=="string"?o.databaseName:"",u=typeof o.schemaName=="string"?o.schemaName:"";s&&n&&(i.add(["physical",s,r,u,n].join(":")),i.add(`physical:${s}:${n}`))}if(o.kind==="sql"){const s=typeof o.connectionId=="string"?o.connectionId:"",n=typeof o.dialect=="string"?o.dialect:"",r=typeof o.label=="string"?o.label:"";s&&(i.add(["sql",s,n,r].join(":")),i.add(`sql:${s}`))}return i}function ct(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];if(t.fieldRef&&s.push(...c(t.fieldRef,`${i}.fieldRef`)),(typeof t.inputId!="string"||!t.inputId.trim())&&s.push(`${i}.inputId is required.`),s.push(...pe(t.optionQuery,`${i}.optionQuery`)),g(t.appliesToViewIds)||s.push(`${i}.appliesToViewIds must be an array of strings.`),g(t.notAppliedToViewIds)||s.push(`${i}.notAppliedToViewIds must be an array of strings.`),!Array.isArray(t.bindings))s.push(`${i}.bindings must be an array.`);else{const n=g(t.appliesToViewIds)?new Set(t.appliesToViewIds):void 0,r=g(t.notAppliedToViewIds)?new Set(t.notAppliedToViewIds):void 0;t.bindings.forEach((u,l)=>{const d=a(u);if(!d){s.push(`${i}.bindings.${l} must be an object.`);return}typeof d.viewId!="string"||!d.viewId?s.push(`${i}.bindings.${l}.viewId is required.`):(n&&!n.has(d.viewId)&&s.push(`${i}.bindings.${l}.viewId must be included in appliesToViewIds.`),r!=null&&r.has(d.viewId)&&s.push(`${i}.bindings.${l}.viewId must not be listed in notAppliedToViewIds.`)),s.push(...c(d.fieldRef,`${i}.bindings.${l}.fieldRef`))})}return s}function pe(o,i){if(o===void 0)return[];const t=a(o);if(!t)return[`${i} must be an object.`];const s=[...h(t.valueFieldRef,`${i}.valueFieldRef`),...h(t.labelFieldRef,`${i}.labelFieldRef`),...h(t.filterFieldRef,`${i}.filterFieldRef`)];return t.builder!=="semaphor.inputOptions"&&s.push(`${i}.builder must be semaphor.inputOptions.`),typeof t.sourceKey!="string"&&t.source===void 0&&s.push(`${i} must include source or sourceKey.`),t.source!==void 0&&s.push(...k(t.source,`${i}.source`)),a(t.valueFieldRef)||s.push(`${i}.valueFieldRef is required.`),a(t.labelFieldRef)||s.push(`${i}.labelFieldRef is required.`),t.limit!==void 0&&(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<=0)&&s.push(`${i}.limit must be a positive integer.`),s}function pt(o){var n;const i=a(o.value);if(!i)return[`${o.path} is required for executable views.`];const t=[];if(!he(i.builder))return t.push(`${o.path}.builder must be a supported SDK builder.`),t;o.sdkBuilder&&i.builder!==o.sdkBuilder&&t.push(`${o.path}.builder must match sdkBuilder.`),o.queryKind&&w(o.queryKind)&&i.builder!==$t(o.queryKind)&&t.push(`${o.path}.builder must match queryKind.`);const s=a(i.spec);if(!s)return t.push(`${o.path}.spec must be an object.`),t;switch(i.builder){case"semaphor.metric":t.push(...v(s,de,`${o.path}.spec`),..._(s,o.path),...O(s.measures,`${o.path}.spec.measures`),...h(s.primaryMeasure,`${o.path}.spec.primaryMeasure`),...h(s.dateField,`${o.path}.spec.dateField`),...B(s.dimensions,`${o.path}.spec.dimensions`),...P(s.orderBy,`${o.path}.spec.orderBy`),...R(s.filters,`${o.path}.spec.filters`));break;case"semaphor.analysis":t.push(...v(s,Ge,`${o.path}.spec`),..._(s,o.path),...O(s.measures,`${o.path}.spec.measures`),...h(s.primaryMeasure,`${o.path}.spec.primaryMeasure`),...h(s.dateField,`${o.path}.spec.dateField`),...B(s.dimensions,`${o.path}.spec.dimensions`),...P(s.orderBy,`${o.path}.spec.orderBy`),...R(s.filters,`${o.path}.spec.filters`),...gt(s,`${o.path}.spec`));break;case"semaphor.records":t.push(...v(s,Ue,`${o.path}.spec`),..._(s,o.path),...O(s.fields,`${o.path}.spec.fields`),...h(s.dateField,`${o.path}.spec.dateField`),...P(s.orderBy,`${o.path}.spec.orderBy`),...R(s.filters,`${o.path}.spec.filters`),...ht(s.totals,`${o.path}.spec.totals`));break;case"semaphor.matrix":t.push(...v(s,He,`${o.path}.spec`),...ft(s,o.path),...yt(s.rows,`${o.path}.spec.rows`),...bt(s.columns,`${o.path}.spec.columns`),...zt(s.values,`${o.path}.spec.values`),...St(s.sort,`${o.path}.spec.sort`),...R(s.filters,`${o.path}.spec.filters`),...mt(s.displayLimits,`${o.path}.spec.displayLimits`));break;case"semaphor.sql":t.push(...v(s,Qe,`${o.path}.spec`),..._(s,o.path)),((n=a(s.source))==null?void 0:n.kind)!=="sql"&&t.push(`${o.path}.spec.source.kind must be sql.`),(typeof s.sql!="string"||!s.sql.trim())&&t.push(`${o.path}.spec.sql is required.`),t.push(...B(s.fields,`${o.path}.spec.fields`));break}return t}function mt(o,i){if(o===void 0)return[];const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];s.push(...re(t.rows,`${i}.rows`),...re(t.columns,`${i}.columns`));for(const n of Object.keys(t))n==="rows"||n==="columns"||s.push(`${i}.${n} is not supported.`);return s}function re(o,i){if(o===void 0)return[];const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<1)&&s.push(`${i}.limit must be a positive integer.`);for(const n of Object.keys(t))n!=="limit"&&s.push(`${i}.${n} is not supported; matrix display limits are count-only in v1.`);return s}function gt(o,i){const t=[];if(o.driverMode!==void 0&&!Le.has(o.driverMode)&&t.push(`${i}.driverMode must be a supported analysis driver mode.`),o.includePopulation!==void 0&&typeof o.includePopulation!="boolean"&&t.push(`${i}.includePopulation must be a boolean.`),o.calendarContext!==void 0){const s=a(o.calendarContext);if(!s)t.push(`${i}.calendarContext must be an object.`);else{s.tz!==void 0&&typeof s.tz!="string"&&t.push(`${i}.calendarContext.tz must be a string.`),s.weekStart!==void 0&&(typeof s.weekStart!="number"||!Number.isInteger(s.weekStart)||s.weekStart<0||s.weekStart>6)&&t.push(`${i}.calendarContext.weekStart must be an integer between 0 and 6.`);const n=s.anchor;if(n!==void 0&&n!=="now"){const r=a(n);(!r||typeof r.iso!="string"||!r.iso.trim())&&t.push(`${i}.calendarContext.anchor must be now or { iso }.`)}}}return t}function ht(o,i){if(o===void 0)return[];const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return t.mode!=="server"&&s.push(`${i}.mode must be server.`),!Array.isArray(t.measures)||t.measures.length===0?s.push(`${i}.measures must include at least one measure.`):t.measures.forEach((n,r)=>{var u;s.push(...fe(n,`${i}.measures.${r}`)),((u=a(n))==null?void 0:u.role)!=="measure"&&s.push(`${i}.measures.${r}.role must be measure.`)}),s}function v(o,i,t){const s=[];return Object.keys(o).forEach(n=>{i.has(n)||s.push(`${t}.${n} is not supported for this SDK builder.`)}),s}function _(o,i){return a(o.source)?k(o.source,`${i}.spec.source`):[`${i}.spec.source must be an object.`]}function ft(o,i){const t=a(o.source);if(!t)return[`${i}.spec.source must be an object.`];const s=k(o.source,`${i}.spec.source`);return t.kind!=="semantic"&&t.kind!=="physical"&&s.push(`${i}.spec.source.kind must be semantic or physical.`),s}function O(o,i){const t=Y(o,i);return Array.isArray(o)&&o.forEach((s,n)=>{t.push(...c(s,`${i}.${n}`))}),t}function B(o,i){if(o===void 0)return[];if(!Array.isArray(o))return[`${i} must be an array.`];const t=[];return o.forEach((s,n)=>{t.push(...c(s,`${i}.${n}`))}),t}function P(o,i){if(o===void 0)return[];const t=a(o);return t?[...c(t.field,`${i}.field`),...me(t.direction,`${i}.direction`)]:[`${i} must be an object.`]}function yt(o,i){const t=Y(o,i);return Array.isArray(o)&&o.forEach((s,n)=>{const r=a(s);if(!r){t.push(`${i}.${n} must be an object.`);return}t.push(...c(r.field,`${i}.${n}.field`))}),t}function bt(o,i){if(o===void 0)return[];const t=[];return Array.isArray(o)?(o.forEach((s,n)=>{const r=a(s);if(!r){t.push(`${i}.${n} must be an object.`);return}t.push(...c(r.field,`${i}.${n}.field`))}),t):[`${i} must be an array.`]}function zt(o,i){const t=Y(o,i);return Array.isArray(o)&&o.forEach((s,n)=>{const r=a(s);if(!r){t.push(`${i}.${n} must be an object.`);return}t.push(...c(r.field,`${i}.${n}.field`))}),t}function St(o,i){if(o===void 0)return[];if(!Array.isArray(o))return[`${i} must be an array.`];const t=[];return o.forEach((s,n)=>{const r=a(s);if(!r){t.push(`${i}.${n} must be an object.`);return}r.axis!=="row"&&r.axis!=="column"&&t.push(`${i}.${n}.axis must be row or column.`),t.push(...me(r.direction,`${i}.${n}.direction`),...vt(r.by,`${i}.${n}.by`))}),t}function vt(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];switch(t.kind){case"label":return[];case"field":return c(t.field,`${i}.field`);case"value":return typeof t.valueId!="string"||!t.valueId.trim()?[`${i}.valueId is required.`]:[];default:return[`${i}.kind must be label, field, or value.`]}}function me(o,i){return o==="asc"||o==="desc"?[]:[`${i} must be asc or desc.`]}function R(o,i){if(o===void 0)return[];if(!Array.isArray(o))return[`${i} must be an array.`];const t=[];return o.forEach((s,n)=>{const r=a(s);if(!r){t.push(`${i}.${n} must be an object.`);return}t.push(...c(r.field,`${i}.${n}.field`))}),t}function Y(o,i){return!Array.isArray(o)||o.length===0?[`${i} must be a non-empty array.`]:[]}function $t(o){switch(o){case"metric":return"semaphor.metric";case"records":return"semaphor.records";case"matrix":return"semaphor.matrix";case"analysis":return"semaphor.analysis";case"sql_fallback":return"semaphor.sql"}}function wt(o){const i=a(o.computation),t=a(o.visualSpec);return(i==null?void 0:i.kind)==="presentation_only"||(i==null?void 0:i.kind)==="derived"||(i==null?void 0:i.kind)==="unsupported"||o.visual==="text_block"||(t==null?void 0:t.visualType)==="text_block"}function kt(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return Ye.has(t.visualType)||s.push(`${i}.visualType must be a supported visual type.`),t.limit!==void 0&&(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<=0)&&s.push(`${i}.limit must be a positive integer.`),t.tableBehavior!==void 0&&s.push(...It(t.tableBehavior,`${i}.tableBehavior`)),s}function It(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return t.tableMode!=="bounded"&&t.tableMode!=="server_paginated"&&t.tableMode!=="server_windowed"&&s.push(`${i}.tableMode must be a supported table mode.`),s.push(...At(t.height,`${i}.height`),..._t(t.pagination,`${i}.pagination`),...Rt(t.sorting,`${i}.sorting`),...jt(t.totals,`${i}.totals`)),typeof t.serverSideRequired!="boolean"&&s.push(`${i}.serverSideRequired must be a boolean.`),s}function At(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return(typeof t.maxPx!="number"||!Number.isInteger(t.maxPx)||t.maxPx<=0)&&s.push(`${i}.maxPx must be a positive integer.`),t.scroll!=="vertical"&&t.scroll!=="both"&&s.push(`${i}.scroll must be vertical or both.`),typeof t.stickyHeader!="boolean"&&s.push(`${i}.stickyHeader must be a boolean.`),s}function _t(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return t.mode!=="none"&&t.mode!=="server"&&t.mode!=="client_for_bounded_rows"&&s.push(`${i}.mode must be a supported pagination mode.`),t.pageSize!==void 0&&(typeof t.pageSize!="number"||!Number.isInteger(t.pageSize)||t.pageSize<=0)&&s.push(`${i}.pageSize must be a positive integer.`),t.readsFrom!==void 0&&t.readsFrom!=="result.pagination"&&s.push(`${i}.readsFrom must be result.pagination.`),s}function Rt(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return t.mode!=="server"&&t.mode!=="client_for_bounded_rows"&&s.push(`${i}.mode must be a supported sorting mode.`),t.defaultField!==void 0&&(typeof t.defaultField!="string"||!t.defaultField.trim())&&s.push(`${i}.defaultField must be a non-empty string.`),t.defaultDirection!==void 0&&t.defaultDirection!=="asc"&&t.defaultDirection!=="desc"&&s.push(`${i}.defaultDirection must be asc or desc.`),t.resetPageOnChange!==void 0&&typeof t.resetPageOnChange!="boolean"&&s.push(`${i}.resetPageOnChange must be a boolean.`),s}function jt(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return t.mode!=="none"&&t.mode!=="server"&&t.mode!=="local"?(s.push(`${i}.mode must be none, server, or local.`),s):t.mode==="none"?(t.measures!==void 0&&s.push(`${i}.measures is not allowed when mode is none.`),t.label!==void 0&&s.push(`${i}.label is not allowed when mode is none.`),s):t.mode==="server"?(!Array.isArray(t.measures)||t.measures.length===0?s.push(`${i}.measures must include at least one measure when mode is server.`):t.measures.forEach((n,r)=>{var u;s.push(...fe(n,`${i}.measures.${r}`)),((u=a(n))==null?void 0:u.role)!=="measure"&&s.push(`${i}.measures.${r}.role must be measure.`)}),t.label!==void 0&&s.push(`${i}.label is not allowed when mode is server.`),s):(t.mode==="local"&&(t.label!=="Displayed rows"&&t.label!=="Current page"&&s.push(`${i}.label must be Displayed rows or Current page when mode is local.`),t.measures!==void 0&&s.push(`${i}.measures is not allowed when mode is local.`)),s)}function Ct(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];switch(t.kind){case"server_query":w(t.queryKind)||s.push(`${i}.queryKind must be a supported codegen query kind.`),t.queryOwnership!==void 0&&t.queryOwnership!=="view_owned"&&t.queryOwnership!=="shared_query"&&s.push(`${i}.queryOwnership must be view_owned or shared_query.`),t.sourceKeys!==void 0&&!g(t.sourceKeys)&&s.push(`${i}.sourceKeys must be an array of strings.`),t.fieldNames!==void 0&&!g(t.fieldNames)&&s.push(`${i}.fieldNames must be an array of strings.`);break;case"derived":(typeof t.upstreamViewId!="string"||!t.upstreamViewId.trim())&&s.push(`${i}.upstreamViewId is required.`),(typeof t.derivation!="string"||!t.derivation.trim())&&s.push(`${i}.derivation is required.`);break;case"presentation_only":break;case"unsupported":(typeof t.reason!="string"||!t.reason.trim())&&s.push(`${i}.reason is required.`),(typeof t.suggestedModelingFix!="string"||!t.suggestedModelingFix.trim())&&s.push(`${i}.suggestedModelingFix is required.`);break;default:s.push(`${i}.kind must be a supported computation kind.`)}return s}function Et(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];for(const r of["title","requestedQuestion","suggestedModelingFix"])(typeof t[r]!="string"||!t[r].trim())&&s.push(`${i}.${r} is required.`);return We.has(t.reason)||s.push(`${i}.reason must be a supported unsupported insight reason.`),(t.relationshipCandidate!==void 0||t.nextRepairAction!==void 0)&&t.reason!=="missing_relationship"&&s.push(`${i} relationship repair metadata is only valid for missing_relationship unsupported insights.`),t.diagnostic!==void 0&&s.push(...qt(t.diagnostic,`${i}.diagnostic`,t.reason)),t.relationshipCandidate!==void 0&&s.push(...xt(t.relationshipCandidate,`${i}.relationshipCandidate`)),t.nextRepairAction!==void 0&&s.push(...Ft(t.nextRepairAction,`${i}.nextRepairAction`)),s}function qt(o,i,t){const s=a(o);if(!s)return[`${i} must be an object.`];const n=[],r=new Set(["kind","inputId","inputLabel","optionSource","optionField","missingEvidence"]);Object.keys(s).forEach(l=>{r.has(l)||n.push(`${i}.${l} is not supported; raw identifier diagnostics support only kind, inputId, inputLabel, optionSource, optionField, and missingEvidence.`)}),t!=="raw_identifier_filter_options"&&n.push(`${i} is only valid for raw_identifier_filter_options unsupported insights.`),s.kind!=="raw_identifier_filter_options"&&n.push(`${i}.kind must be raw_identifier_filter_options.`);for(const l of["inputId","inputLabel"])(typeof s[l]!="string"||!s[l].trim())&&n.push(`${i}.${l} must be a non-empty string.`);n.push(...L(s.optionSource,`${i}.optionSource`)),n.push(...ge(s.optionField,`${i}.optionField`));const u=new Set(["display_field","relationship_display_path"]);return!Array.isArray(s.missingEvidence)||s.missingEvidence.length===0?n.push(`${i}.missingEvidence must be a non-empty evidence array.`):s.missingEvidence.forEach((l,d)=>{u.has(l)||n.push(`${i}.missingEvidence.${d} must be display_field or relationship_display_path.`)}),n}function Ft(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[],n=new Set(["tool","reason"]);return Object.keys(t).forEach(r=>{n.has(r)||s.push(`${i}.${r} is not supported; repair actions support only tool and reason.`)}),t.tool!=="semaphor_propose_semantic_model_change"&&s.push(`${i}.tool must be semaphor_propose_semantic_model_change.`),t.reason!=="missing_relationship"&&s.push(`${i}.reason must be missing_relationship.`),s}function xt(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[],n=new Set(["source","sourceFields","target","targetFields"]);Object.keys(t).forEach(r=>{n.has(r)||s.push(`${i}.${r} is not supported; relationship candidates support only source, sourceFields, target, and targetFields.`)}),s.push(...L(t.source,`${i}.source`)),s.push(...L(t.target,`${i}.target`));for(const r of["sourceFields","targetFields"]){const u=t[r];if(!Array.isArray(u)||u.length===0){s.push(`${i}.${r} must be a non-empty endpoint field array.`);continue}u.forEach((l,d)=>{s.push(...ge(l,`${i}.${r}.${d}`))})}return s}function ge(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[],n=new Set(["name","label","role","dataType"]);return Object.keys(t).forEach(r=>{n.has(r)||s.push(`${i}.${r} is not supported; relationship candidate fields are scoped by their endpoint and support only name, label, role, and dataType.`)}),(typeof t.name!="string"||!t.name.trim())&&s.push(`${i}.name must be a non-empty string.`),t.role!==void 0&&(typeof t.role!="string"||!["dimension","measure","date","id","unknown"].includes(t.role))&&s.push(`${i}.role must be dimension, measure, date, id, or unknown.`),t.dataType!==void 0&&(typeof t.dataType!="string"||!["string","number","boolean","date","datetime","unknown"].includes(t.dataType))&&s.push(`${i}.dataType must be string, number, boolean, date, datetime, or unknown.`),s}function L(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[],n=new Set(["kind","domainId","datasetName","datasetId","label","sourceKey"]);return Object.keys(t).forEach(r=>{n.has(r)||s.push(`${i}.${r} is not supported; relationship candidate sources support only semantic identity fields.`)}),t.kind!=="semantic"&&s.push(`${i} must use semantic source identity.`),(typeof t.domainId!="string"||!t.domainId.trim()||typeof t.datasetName!="string"||!t.datasetName.trim())&&s.push(`${i} must include semantic domainId and datasetName.`),s}function w(o){return Be.has(o)}function he(o){return Pe.has(o)}function h(o,i){return o===void 0?[]:c(o,i)}function c(o,i){const t=a(o);if(!t)return[`${i} must be an object.`];const s=[];return(typeof t.name!="string"||!t.name.trim())&&s.push(`${i}.name is required.`),!t.source&&typeof t.sourceKey!="string"&&s.push(`${i} must include source or sourceKey.`),t.aggregate!==void 0&&!Ve.has(t.aggregate)&&s.push(`${i}.aggregate must be a supported aggregate function.`),s}function fe(o,i){const t=a(o),s=c(o,i);if(!t||typeof t.sourceKey=="string"&&t.sourceKey.trim())return s;if(t.source!==void 0){const r=k(t.source,`${i}.source`);return r.length===0||s.push(...r),s}return s.includes(`${i} must include source or sourceKey.`)||s.push(`${i} must include source or sourceKey.`),s}function a(o){return o&&typeof o=="object"&&!Array.isArray(o)?o:void 0}function g(o){return Array.isArray(o)&&o.every(i=>typeof i=="string")}const p=e.z.record(e.z.string(),e.z.unknown()),x=e.z.array(p),m=e.z.enum(["SUM","COUNT","AVG","MIN","MAX","MEDIAN","DISTINCT"]),N=e.z.enum(["postgres","mysql","mssql","snowflake","clickhouse","bigquery","redshift","duckdb","sqlite","unknown"]),ye=e.z.enum(["hour","day","week","month","quarter","year"]),M=e.z.enum(["dimension","measure","date","id","unknown"]),K=e.z.enum(["string","number","boolean","date","datetime","unknown"]),$=e.z.union([e.z.number(),e.z.string(),e.z.null()]),V=e.z.enum(["millisecond","second","minute","hour","day"]),be=e.z.union([e.z.object({type:e.z.enum(["number","currency","percent","percentage","scientific"]),locale:e.z.string().optional(),minimumFractionDigits:e.z.number().optional(),maximumFractionDigits:e.z.number().optional(),useGrouping:e.z.boolean().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional(),negativeStyle:e.z.enum(["minus","parentheses"]).optional(),compact:e.z.boolean().optional(),scale:e.z.number().optional(),currency:e.z.string().optional(),percentValueMode:e.z.enum(["fraction","whole"]).optional()}).passthrough(),e.z.object({type:e.z.enum(["date","datetime"]),locale:e.z.string().optional(),pattern:e.z.string().optional(),relative:e.z.boolean().optional(),timezone:e.z.string().optional(),sourceTimezone:e.z.string().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional()}).passthrough(),e.z.object({type:e.z.literal("duration"),inputUnit:V.optional(),outputStyle:e.z.enum(["compact","digital","long"]).optional(),largestUnit:V.optional(),smallestUnit:V.optional(),maxUnits:e.z.number().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional(),negativeStyle:e.z.enum(["minus","parentheses"]).optional()}).passthrough(),e.z.object({type:e.z.literal("string"),prefix:e.z.string().optional(),suffix:e.z.string().optional()}).passthrough()]),Nt=e.z.union([e.z.object({kind:e.z.literal("defaultAggregate")}).passthrough(),e.z.object({kind:e.z.literal("blank")}).passthrough(),e.z.object({kind:e.z.literal("labelOnly"),label:e.z.string().optional()}).passthrough(),e.z.object({kind:e.z.literal("customAggregate"),aggregate:m}).passthrough(),e.z.object({kind:e.z.literal("percentOfParent")}).passthrough(),e.z.object({kind:e.z.literal("percentOfGrandTotal")}).passthrough(),e.z.object({kind:e.z.literal("customExpression"),expressionId:e.z.string()}).passthrough()]);function I(o,i){return e.z.object(o).passthrough().superRefine((t,s)=>{for(const n of i)Object.prototype.hasOwnProperty.call(t,n)||s.addIssue({code:"custom",path:[n],message:`Required field "${n}" is missing.`})})}const W=e.z.object({kind:e.z.literal("semantic"),domainId:e.z.string(),datasetName:e.z.string(),datasetId:e.z.string().optional(),label:e.z.string().optional(),connectionId:e.z.string().optional()}).passthrough(),ze=e.z.object({kind:e.z.literal("physical"),connectionId:e.z.string(),connectionType:e.z.string().optional(),tableName:e.z.string(),databaseName:e.z.string().optional(),schemaName:e.z.string().optional(),label:e.z.string().optional(),dialect:N.optional()}).passthrough(),Se=e.z.object({kind:e.z.literal("sql"),connectionId:e.z.string(),dialect:N.optional(),label:e.z.string().optional()}).passthrough(),z=e.z.union([W,ze,Se]),y=e.z.object({name:e.z.string(),label:e.z.string().optional(),role:M.optional(),dataType:K.optional(),source:z.optional(),aggregate:m.optional()}).passthrough(),Mt=e.z.object({kind:e.z.literal("field"),field:y,aggregate:m.optional()}).passthrough(),Z=e.z.object({kind:e.z.literal("derived_field"),name:e.z.string(),label:e.z.string(),description:e.z.string().optional(),resultRole:M,dataType:K,computeStage:e.z.enum(["row","aggregate"]),expression:e.z.string(),expressionLanguage:e.z.literal("semaphor_sql_template").optional(),inputs:e.z.record(Mt),defaultAggregate:m.optional(),aggregationBehavior:e.z.enum(["additive","non_additive","ratio_of_sums","weighted","pre_aggregated","snapshot"]).optional(),aggregationStrategy:e.z.enum(["default","symmetric_aggregate","aggregate_then_join","weighted"]).optional(),format:be.optional(),tags:e.z.array(e.z.string()).optional()}).passthrough(),T=y.and(e.z.object({derivedField:Z.optional()}).passthrough()),Kt=W,Tt=e.z.object({kind:e.z.literal("physical"),connectionId:e.z.string().optional(),connectionType:e.z.string().optional(),tableName:e.z.string(),databaseName:e.z.string().optional(),schemaName:e.z.string().optional(),label:e.z.string().optional(),dialect:N.optional()}).passthrough(),Dt=e.z.object({kind:e.z.literal("sql"),connectionId:e.z.string().optional(),dialect:N.optional(),label:e.z.string().optional()}).passthrough(),Ot=e.z.union([Kt,Tt,Dt]),Bt=e.z.object({key:e.z.string().optional(),name:e.z.string(),label:e.z.string().optional(),role:M.optional(),dataType:K.optional(),source:Ot.optional(),aggregate:m.optional(),derivedField:e.z.never().optional()}).passthrough(),E=e.z.object({key:e.z.string(),name:e.z.string(),label:e.z.string(),role:M.optional(),dataType:K.optional(),aggregate:m.optional(),source:z.optional(),derivedField:Z.optional()}).passthrough(),ve=e.z.object({code:e.z.string(),message:e.z.string().optional(),invalidField:e.z.string().optional(),fieldRole:e.z.enum(["measure","date","dimension","input","source","sql"]).optional(),validMeasureCandidates:e.z.array(e.z.string()).optional(),validDateCandidates:e.z.array(e.z.string()).optional(),validDimensionCandidates:e.z.array(e.z.string()).optional(),recommendedNextStep:e.z.string()}).passthrough(),q=e.z.object({code:e.z.string(),message:e.z.string(),path:e.z.string().optional(),fieldRole:e.z.enum(["measure","date","dimension","input","source","sql"]).optional(),repairHint:ve.optional()}).passthrough(),J=e.z.object({ok:e.z.boolean(),errors:e.z.array(q),warnings:e.z.array(q),repairHints:e.z.array(ve)}).passthrough(),Pt=e.z.object({page:e.z.number(),pageSize:e.z.number(),pageCount:e.z.number(),totalCount:e.z.number(),hasNextPage:e.z.boolean(),hasPrevPage:e.z.boolean()}).passthrough(),A={intentId:e.z.string().optional(),queryPath:e.z.enum(["query_spec","sql","sql_python"]),warnings:e.z.array(e.z.string()).optional(),rowCount:e.z.number().optional(),rowLimitExceeded:e.z.boolean().optional(),limit:e.z.number().optional(),pagination:Pt.optional()},$e=e.z.object({...A,kind:e.z.literal("metric"),value:$,primaryValue:$,measures:e.z.record($).optional(),missingMeasures:e.z.array(e.z.string()).optional(),comparison:e.z.object({kind:e.z.enum(["previous_period","previous_year","target"]),value:$.optional(),delta:e.z.union([e.z.number(),e.z.null()]).optional(),deltaPercent:e.z.union([e.z.number(),e.z.null()]).optional()}).passthrough().optional(),records:x.optional()}).passthrough(),we=e.z.object({...A,kind:e.z.literal("records"),columns:e.z.array(E),records:x,totals:e.z.object({mode:e.z.literal("server"),scope:e.z.literal("filtered_result"),row:e.z.record(e.z.string(),e.z.unknown()),columns:e.z.array(E).optional()}).passthrough().optional()}).passthrough(),ke=e.z.object({...A,kind:e.z.literal("inputOptions"),options:e.z.array(I({label:e.z.string(),value:e.z.unknown(),count:e.z.number().optional(),disambiguation:e.z.array(e.z.string()).optional()},["value"]))}).passthrough(),Ie=e.z.object({...A,kind:e.z.literal("sql"),columns:e.z.array(E),records:x,sqlShape:e.z.object({statementType:e.z.string().optional(),explicitLimit:e.z.number().optional(),hasPythonCode:e.z.boolean().optional()}).passthrough().optional()}).passthrough(),Vt=e.z.object({enabled:e.z.boolean().optional(),position:e.z.enum(["before","after"]).optional(),label:e.z.string().optional()}).passthrough(),ae=e.z.object({id:e.z.enum(["rows","columns"]),levels:e.z.array(e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),label:e.z.string(),field:y,grain:ye.optional(),subtotal:Vt.optional()}).passthrough()),nodeIds:e.z.array(e.z.string())}).passthrough(),S=I({instanceId:e.z.string(),fieldKey:e.z.string(),value:e.z.unknown(),label:e.z.string()},["value"]),Lt=e.z.union([e.z.object({kind:e.z.literal("label")}).passthrough(),e.z.object({kind:e.z.literal("field"),field:y,aggregate:m.optional()}).passthrough(),e.z.object({kind:e.z.literal("value"),valueId:e.z.string(),rowPath:e.z.array(S).optional(),columnPath:e.z.array(S).optional()}).passthrough()]),Gt=e.z.enum(["present","presentNull","missing","densified"]),Ut=e.z.enum(["value","rowSubtotal","columnSubtotal","subtotalIntersection","rowGrandTotal","columnGrandTotal","matrixGrandTotal"]),Ht=e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),field:y,role:e.z.enum(["row","column","measure","sort","filter"]),label:e.z.string().optional()}).passthrough(),Qt=e.z.union([e.z.object({kind:e.z.literal("additive"),aggregate:m.optional()}).passthrough(),e.z.object({kind:e.z.literal("semiAdditive"),aggregate:m.optional(),grain:ye.optional()}).passthrough(),e.z.object({kind:e.z.literal("nonAdditive"),aggregate:m.optional()}).passthrough(),e.z.object({kind:e.z.literal("ratio"),numeratorMeasureInstanceId:e.z.string().optional(),denominatorMeasureInstanceId:e.z.string().optional()}).passthrough(),e.z.object({kind:e.z.literal("custom"),expressionId:e.z.string().optional()}).passthrough()]),Yt=e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),label:e.z.string(),field:y,aggregate:m.optional(),format:be.optional(),totalBehavior:Nt.optional(),semantics:Qt}).passthrough(),Wt=e.z.object({id:e.z.string(),measureId:e.z.string(),aggregate:m.optional(),label:e.z.string().optional(),source:e.z.enum(["measureDefault","rowSubtotal","columnSubtotal","subtotalIntersection","rowGrandTotal","columnGrandTotal","matrixGrandTotal","custom"]),scope:e.z.object({rowLevelId:e.z.string().optional(),columnLevelId:e.z.string().optional(),rowNodeId:e.z.string().optional(),columnNodeId:e.z.string().optional()}).passthrough().optional()}).passthrough(),Zt=e.z.object({kind:e.z.string(),label:e.z.string().optional(),payload:e.z.record(e.z.string(),e.z.unknown()).optional()}).passthrough(),Jt=I({id:e.z.string(),axis:e.z.enum(["row","column"]),path:e.z.array(S),level:e.z.number(),label:e.z.string(),value:e.z.unknown(),parentId:e.z.string().optional(),hasChildren:e.z.boolean(),isExpanded:e.z.boolean().optional(),isSubtotal:e.z.boolean().optional(),isGrandTotal:e.z.boolean().optional(),subtotalFunction:m.optional(),childCount:e.z.number().optional(),actions:e.z.array(Zt).optional()},["value"]),Xt=e.z.object({rowHeaderLevels:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),fieldInstanceId:e.z.string()}).passthrough()),columnHeaderRows:e.z.array(e.z.object({id:e.z.string(),cells:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),role:e.z.enum(["rowHeader","columnHeader","measureHeader","subtotal","grandTotal"]),colSpan:e.z.number(),rowSpan:e.z.number(),columnPath:e.z.array(S),measureInstanceId:e.z.string().optional()}).passthrough())}).passthrough()),columns:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),columnNodeId:e.z.string().optional(),columnPath:e.z.array(S),measureInstanceId:e.z.string(),role:e.z.enum(["value","columnSubtotal","columnGrandTotal"])}).passthrough())}).passthrough(),ei=I({rowId:e.z.string(),columnId:e.z.string().optional(),measureId:e.z.string(),value:e.z.unknown(),formattedValue:e.z.string().optional(),presence:Gt,role:Ut,calculationId:e.z.string().optional()},["value"]),ti=e.z.object({rows:e.z.boolean().optional(),columns:e.z.boolean().optional(),grandTotal:e.z.union([e.z.boolean(),e.z.object({rows:e.z.boolean().optional(),columns:e.z.boolean().optional()}).passthrough()]).optional()}).passthrough(),ii=I({id:e.z.string(),axis:e.z.enum(["row","column"]),targetInstanceId:e.z.string().optional(),direction:e.z.enum(["asc","desc"]),nulls:e.z.enum(["warehouseDefault","first","last"]).optional(),scope:e.z.enum(["global","withinParent"]).optional(),by:Lt},["by"]),oi=e.z.object({rowOffset:e.z.number().optional(),rowLimit:e.z.number().optional(),columnOffset:e.z.number().optional(),columnLimit:e.z.number().optional(),hasMoreRows:e.z.boolean().optional(),hasMoreColumns:e.z.boolean().optional()}).passthrough(),si=e.z.object({axis:e.z.enum(["row","column"]),path:e.z.array(S),depth:e.z.number().optional()}).passthrough(),ni=e.z.object({rowLazyLoading:e.z.boolean().optional(),columnLazyLoading:e.z.boolean().optional(),expandableRowNodeIds:e.z.array(e.z.string()).optional(),expandableColumnNodeIds:e.z.array(e.z.string()).optional(),nextRequests:e.z.array(si).optional()}).passthrough(),ri=e.z.object({domains:e.z.record(e.z.object({min:e.z.number().optional(),max:e.z.number().optional()}).passthrough()).optional(),rules:e.z.array(e.z.record(e.z.string(),e.z.unknown())).optional()}).passthrough(),Ae=e.z.object({...A,kind:e.z.literal("matrix"),schemaVersion:e.z.literal(1),shape:e.z.enum(["hierarchical","pivot"]),capabilities:e.z.array(e.z.string()),executionMetadata:e.z.record(e.z.string(),e.z.unknown()),fieldsById:e.z.record(e.z.string(),Ht),measuresById:e.z.record(e.z.string(),Yt),calculationsById:e.z.record(e.z.string(),Wt).optional(),axes:e.z.object({rows:ae,columns:ae}).passthrough(),nodesById:e.z.record(e.z.string(),Jt),layout:Xt,cells:e.z.array(ei),totals:ti,sort:e.z.array(ii),formattingContext:ri,pageInfo:oi.optional(),expansion:ni.optional()}).passthrough(),_e=e.z.union([$e,we,ke,Ie,Ae]),Re=e.z.object({status:e.z.enum(["not_required","resolved","missing","ambiguous","fanout_risk","unknown"]),requiredSources:e.z.array(z).optional(),relationshipsUsed:e.z.array(e.z.string()).optional(),missingSources:e.z.array(e.z.string()).optional(),warnings:e.z.array(e.z.string()).optional(),message:e.z.string().optional(),recommendedNextStep:e.z.string().optional(),joinPlanSummary:e.z.object({baseSource:z.optional(),joinedSources:e.z.array(z).optional(),joinCount:e.z.number().optional()}).passthrough().optional(),fanoutRisk:e.z.object({status:e.z.enum(["none","warning","error","unknown"]),message:e.z.string().optional()}).passthrough().optional()}).passthrough(),le=e.z.enum(["ambiguous_fields","empty_result","missing_grounded_fields","missing_relationship","no_grounded_query","partial_result","presentation_incomplete","query_validation_failed","unsafe_join"]),X=e.z.object({version:e.z.literal(1),status:e.z.enum(["answered","partial","blocked"]),summary:e.z.string(),answered:e.z.array(e.z.object({slotId:e.z.string().optional(),queryId:e.z.string().optional(),summary:e.z.string(),evidenceIds:e.z.array(e.z.string()).optional(),fieldsUsed:e.z.array(T).optional()}).passthrough()),blocked:e.z.array(e.z.object({slotId:e.z.string().optional(),queryId:e.z.string().optional(),reasonCode:le,message:e.z.string(),missingFields:e.z.array(e.z.string()).optional(),availableFields:e.z.array(e.z.string()).optional(),ambiguousFields:e.z.array(e.z.string()).optional(),missingRelationships:e.z.array(e.z.string()).optional(),evidenceIds:e.z.array(e.z.string()).optional(),neededFromUser:e.z.array(e.z.string()).optional(),recommendedNextStep:e.z.string().optional()}).passthrough()),semanticModelRecommendations:e.z.array(e.z.object({reasonCode:le,message:e.z.string(),recommendedNextStep:e.z.string().optional()}).passthrough()).optional()}).passthrough(),ee=e.z.object({scope:e.z.literal("filtered_query"),measures:e.z.record($)}).passthrough(),te=e.z.object({answeredObligations:e.z.array(e.z.string()),missingObligations:e.z.array(e.z.string()),warnings:e.z.array(q).optional()}).passthrough(),je=e.z.object({intentId:e.z.string().optional(),queryId:e.z.string().optional(),status:e.z.enum(["answered","partial","failed"]),resultShape:e.z.enum(["metric","records","inputOptions","sql","matrix","period_change","analysis"]).optional(),intent:e.z.unknown().optional(),compiledQuery:e.z.unknown().optional(),fieldsUsed:e.z.array(T).optional(),result:_e.optional(),validation:J,coverage:te.optional(),missingFields:e.z.array(e.z.string()).optional(),warnings:e.z.array(e.z.string()).optional(),relationshipDiagnostics:Re.optional(),diagnosticFeedback:X.optional(),population:ee.optional(),metadata:e.z.record(e.z.string(),e.z.unknown()).optional()}).passthrough();function ai(o){switch(o){case"boolean":return e.z.boolean().optional();case"compactExecutionFieldArray":return e.z.array(Bt).optional();case"coverage":return te.optional();case"diagnosticFeedback":return X.optional();case"executionFieldArray":return e.z.array(T).optional();case"executionResult":return je.optional();case"number":return e.z.number().finite().optional();case"population":return ee.optional();case"record":return p.optional();case"recordArray":return x.optional();case"responseDetail":return e.z.enum(["compact","standard","debug"]).optional();case"string":return e.z.string().optional();case"stringArray":return e.z.array(e.z.string()).optional();case"unknown":return e.z.unknown().optional();case"unknownArray":return e.z.array(e.z.unknown()).optional();case"validationResult":return J.optional()}}const Ce=Object.fromEntries(Object.entries(F).map(([o,i])=>[o,ai(i)])),Ee=e.z.object(Ce).strict(),ie=e.z.object({sourceKey:e.z.string().optional(),kind:e.z.enum(["semantic","physical","sql"]).optional(),domainId:e.z.string().optional(),datasetName:e.z.string().optional(),datasetId:e.z.string().optional(),connectionId:e.z.string().optional(),tableName:e.z.string().optional(),label:e.z.string().optional()}).passthrough(),f=e.z.object({name:e.z.string(),label:e.z.string().optional(),role:e.z.enum(["dimension","measure","date","id","unknown"]).optional(),dataType:e.z.enum(["string","number","boolean","date","datetime","unknown"]).optional(),aggregate:m.optional(),sourceKey:e.z.string().optional(),source:ie.optional()}).passthrough(),qe=e.z.object({id:e.z.string().optional(),builder:e.z.literal("semaphor.inputOptions"),source:ie.optional(),sourceKey:e.z.string().optional(),valueFieldRef:f,labelFieldRef:f,filterFieldRef:f.optional(),population:e.z.unknown().optional(),dependencies:e.z.unknown().optional(),limit:e.z.number().int().positive().optional(),spec:p.optional()}).passthrough(),Fe=e.z.object({appliesToViewIds:e.z.array(e.z.string()).optional(),viewId:e.z.string().optional(),fieldRef:f,relationshipHint:e.z.unknown().optional(),relationshipsUsed:e.z.array(p).optional()}).passthrough(),li=e.z.object({id:e.z.string(),label:e.z.string().optional(),type:e.z.string().optional(),serverSide:e.z.boolean().optional(),fieldRef:f.optional(),optionQuery:qe.optional(),bindings:e.z.array(Fe).optional(),appliesToViewIds:e.z.array(e.z.string()),relationshipHint:e.z.unknown().optional(),relationshipsUsed:e.z.array(p).optional()}).passthrough(),ui=e.z.object({builder:e.z.enum(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]),spec:p,fallbackReason:p.optional()}).passthrough(),di=e.z.object({id:e.z.string(),title:e.z.string().optional(),purpose:e.z.string().optional(),sourcePresentation:e.z.object({sourceKeys:e.z.array(e.z.string()).optional(),sourceLabels:e.z.array(e.z.string()).optional()}).passthrough().optional(),visual:e.z.string().optional(),visualSpec:p.optional(),queryKind:e.z.enum(["metric","records","matrix","analysis","sql_fallback"]).optional(),sdkBuilder:e.z.enum(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]).optional(),sdkSpec:ui.optional(),fields:e.z.array(f).optional(),computation:p.optional(),uxExpectations:e.z.array(e.z.string()).optional(),validation:p.optional()}).passthrough(),ci=e.z.object({inputId:e.z.string(),label:e.z.string().optional(),type:e.z.string().optional(),serverSide:e.z.boolean().optional(),fieldRef:f.optional(),optionQuery:qe.optional(),bindings:e.z.array(Fe),appliesToViewIds:e.z.array(e.z.string()),notAppliedToViewIds:e.z.array(e.z.string())}).passthrough(),pi=e.z.object({schemaVersion:e.z.literal(C),title:e.z.string(),purpose:e.z.string().optional(),userGoal:e.z.string().optional(),nextStep:e.z.string().optional(),sources:e.z.array(ie),inputs:e.z.array(li),views:e.z.array(di),filterContracts:e.z.array(ci),implementationChecklist:e.z.object({schemaVersion:e.z.string().optional(),requiredDevtools:e.z.object({mountRootDevtools:e.z.boolean(),providerDebugBridge:e.z.string().optional(),panelPosition:e.z.string().optional(),forbidden:e.z.array(e.z.string()).optional()}).passthrough(),requiredInputOptions:e.z.array(p),filterScopeByInput:e.z.array(p),bindingsByView:e.z.record(e.z.string(),e.z.array(p)),validationCommands:e.z.array(e.z.string()),browserSmokeChecks:e.z.array(e.z.string())}).passthrough(),nextRequiredTool:e.z.object({name:e.z.string(),reason:e.z.string().optional()}).optional(),unsupportedInsights:e.z.array(e.z.object({title:e.z.string(),requestedQuestion:e.z.string(),reason:e.z.string(),suggestedModelingFix:e.z.string()}).passthrough()).optional(),assumptions:e.z.array(e.z.string()).optional(),validation:p.optional()}).passthrough().superRefine((o,i)=>{const t=Q(o);for(const s of t.issues)i.addIssue({code:e.z.ZodIssueCode.custom,message:s})}),mi=new Set(Object.keys(F));function gi(){return Object.keys(F)}function xe(o){return mi.has(o)}function hi(o){if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Semaphor analyze result must be an object.");const t=Object.keys(o).filter(s=>!xe(s));if(t.length)throw new Error(`Semaphor analyze result contains unsupported top-level field(s): ${t.join(", ")}.`);return Ee.parse(o)}exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=F;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=C;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=Oe;exports.getSemaphorAnalyzeResultFieldNames=gi;exports.isSemaphorAnalyzeResultFieldName=xe;exports.isSemaphorDataAppCodegenSummary=Ze;exports.mergeSemaphorSourcesByIdentity=Me;exports.parseSemaphorAnalyzeResult=hi;exports.preferSemaphorFieldRefMetadata=De;exports.preferSemaphorSourceMetadata=U;exports.semaphorAnalyticsCoverageSchema=te;exports.semaphorAnalyticsDiagnosticFeedbackSchema=X;exports.semaphorAnalyticsExecutionResultSchema=je;exports.semaphorAnalyticsPopulationSchema=ee;exports.semaphorAnalyticsResultSchema=_e;exports.semaphorAnalyticsValidationIssueSchema=q;exports.semaphorAnalyticsValidationResultSchema=J;exports.semaphorAnalyzeResultSchema=Ee;exports.semaphorAnalyzeResultShape=Ce;exports.semaphorDataAppCodegenSummarySchema=pi;exports.semaphorDerivedFieldDefinitionSchema=Z;exports.semaphorExecutionFieldRefSchema=T;exports.semaphorFieldRefSchema=y;exports.semaphorFieldRefsMatch=Ke;exports.semaphorInputOptionsResultSchema=ke;exports.semaphorMatrixResultSchema=Ae;exports.semaphorMetricAggregate=H;exports.semaphorMetricMeasureBindingKey=ue;exports.semaphorMetricResultSchema=$e;exports.semaphorPhysicalSourceRefSchema=ze;exports.semaphorRecordsResultSchema=we;exports.semaphorRelationshipDiagnosticsSchema=Re;exports.semaphorResultColumnSchema=E;exports.semaphorSemanticSourceRefSchema=W;exports.semaphorSourceIdentityKey=j;exports.semaphorSourceRefSchema=z;exports.semaphorSourcesReferToSameDataset=G;exports.semaphorSqlResultSchema=Ie;exports.semaphorSqlSourceRefSchema=Se;exports.validateSemaphorDataAppCodegenSummary=Q;