react-semaphor 0.1.348 → 0.1.350

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 (60) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +46 -45
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +3 -3
  5. package/dist/chunks/{braces-Ccvdip75.js → braces-CBMh5wmd.js} +1 -1
  6. package/dist/chunks/{braces-DDHkbW1c.js → braces-Cc86y9Ov.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-AVORk8vl.js → calendar-preferences-dialog-BAEeX-ug.js} +3 -3
  8. package/dist/chunks/{calendar-preferences-dialog-CaeYg4gz.js → calendar-preferences-dialog-C8flqOjZ.js} +1 -1
  9. package/dist/chunks/{chevrons-up-down-B9fTSds9.js → chevrons-up-down-CUZL1zaU.js} +1 -1
  10. package/dist/chunks/{chevrons-up-down-pV0i9ptS.js → chevrons-up-down-fg3WME_w.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-GmwoVZDA.js → dashboard-briefing-launcher--zBBsBWm.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-B7hc62UJ.js → dashboard-briefing-launcher-DU9x-97H.js} +4 -4
  13. package/dist/chunks/{dashboard-controls-DOwo-4PX.js → dashboard-controls-BwMjIqjP.js} +129 -119
  14. package/dist/chunks/dashboard-controls-CMShL7m9.js +57 -0
  15. package/dist/chunks/{dashboard-json-Bjge3tEx.js → dashboard-json-CHKC0bf-.js} +1 -1
  16. package/dist/chunks/{dashboard-json-CqWAmaOX.js → dashboard-json-kD_jszqF.js} +2 -2
  17. package/dist/chunks/{edit-dashboard-visual-NXdSdqQS.js → edit-dashboard-visual-C1RUXsWi.js} +6 -6
  18. package/dist/chunks/{edit-dashboard-visual-biDU5oky.js → edit-dashboard-visual-C1vIFm6H.js} +1 -1
  19. package/dist/chunks/{index-DhuiooCy.js → index-BJLPtQeK.js} +36385 -36071
  20. package/dist/chunks/index-D2ai-cZQ.js +1410 -0
  21. package/dist/chunks/{palette-BMXS-AcI.js → palette-C1k347Tb.js} +1 -1
  22. package/dist/chunks/{palette-DKecBucs.js → palette-DP6TXUD8.js} +1 -1
  23. package/dist/chunks/{resource-management-panel-DIt7NxsX.js → resource-management-panel-UkMvz7Cp.js} +3 -3
  24. package/dist/chunks/{resource-management-panel-MHam0keE.js → resource-management-panel-f4Od7wCB.js} +1 -1
  25. package/dist/chunks/source-identity-C-xaeE_I.js +1 -0
  26. package/dist/chunks/source-identity-qAmkNtEK.js +49 -0
  27. package/dist/chunks/{switch-CP7SmEIZ.js → switch-21kU-tcj.js} +2 -2
  28. package/dist/chunks/{switch-DYRgERrC.js → switch-C0S63HAv.js} +1 -1
  29. package/dist/chunks/{use-create-flow-overlay-state-DS5aPcKd.js → use-create-flow-overlay-state-C49F2KdU.js} +1 -1
  30. package/dist/chunks/{use-create-flow-overlay-state-p_i0aUhH.js → use-create-flow-overlay-state-jpQ2BxKF.js} +3 -3
  31. package/dist/chunks/{use-visual-utils-EazVs86Z.js → use-visual-utils-CiN4zNkZ.js} +1 -1
  32. package/dist/chunks/{use-visual-utils-PfpWtYcR.js → use-visual-utils-D8Pe1PSH.js} +2 -2
  33. package/dist/chunks/{validators-C2eI8fHy.js → validators-B-NiYgGc.js} +178 -224
  34. package/dist/chunks/validators-DlEfynH8.js +1 -0
  35. package/dist/dashboard/index.cjs +1 -1
  36. package/dist/dashboard/index.js +1 -1
  37. package/dist/dashboard-assistant/index.cjs +1 -0
  38. package/dist/dashboard-assistant/index.js +12 -0
  39. package/dist/dashboard-authoring/index.cjs +3 -3
  40. package/dist/dashboard-authoring/index.js +16 -15
  41. package/dist/data-app-builder/index.cjs +1 -1
  42. package/dist/data-app-builder/index.js +1 -1
  43. package/dist/data-app-sdk/index.cjs +1 -1
  44. package/dist/data-app-sdk/index.js +32 -31
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.js +7 -7
  47. package/dist/style.css +1 -1
  48. package/dist/surfboard/index.cjs +1 -1
  49. package/dist/surfboard/index.js +2 -2
  50. package/dist/types/dashboard-assistant.d.ts +1030 -0
  51. package/dist/types/dashboard-authoring.d.ts +1 -1
  52. package/dist/types/dashboard.d.ts +1 -1
  53. package/dist/types/main.d.ts +1 -1
  54. package/dist/types/shared.d.ts +1 -1
  55. package/dist/types/surfboard.d.ts +1 -1
  56. package/dist/types/types.d.ts +1 -1
  57. package/package.json +6 -1
  58. package/dist/chunks/dashboard-controls-Bthl3kl3.js +0 -52
  59. package/dist/chunks/index-D7U5s9Uk.js +0 -1425
  60. package/dist/chunks/validators-BNvNf_tO.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/validators-BNvNf_tO.js"),t=require("../chunks/catalog-field-grounding-Du6mKDcF.js");function d(e,a={}){const i=o(e),s={connectionId:a.connectionId,connectionType:e,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:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:a.connectionId,connectionType:e,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 c(e){const a=o(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function u(e){return e.capabilities.prefixLevels.every(a=>!!l(e.source,a))}function m(e){const a=e.quoteIdentifier??p;return e.capabilities.prefixLevels.map(i=>l(e.source,i)).filter(i=>!!i).map(i=>a(i,e.capabilities.dialect)).join(".")}function l(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function p(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function o(e){if(typeof e!="string")return"";const a=[];for(const i of e.trim().toLowerCase())b(i)&&a.push(i);return a.join("")}function b(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},f={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{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",source:n,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{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,metrics:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMetric:{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.parseSemaphorIsoTimeWindowBoundary=r.parseSemaphorIsoTimeWindowBoundary;exports.preferSemaphorFieldRefMetadata=r.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=r.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=r.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=r.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=r.semaphorSourcesReferToSameDataset;exports.validateSemaphorAnalyticsIntent=r.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=r.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=r.validateSemaphorDashboardIntent;exports.validateSemaphorOperationIntent=r.validateSemaphorOperationIntent;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=f;exports.buildSemaphorQualifiedSourcePath=m;exports.getSemaphorConnectionCapabilities=d;exports.normalizeSemaphorDialect=c;exports.semaphorSourceHasRequiredCoordinates=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/validators-DlEfynH8.js"),t=require("../chunks/catalog-field-grounding-Du6mKDcF.js"),l=require("../chunks/source-identity-C-xaeE_I.js");function c(e,a={}){const i=d(e),r={connectionId:a.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...r,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...r,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...r,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...r,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...r,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...r,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...r,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:r}function u(e){const a=d(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function m(e){return e.capabilities.prefixLevels.every(a=>!!o(e.source,a))}function p(e){const a=e.quoteIdentifier??b;return e.capabilities.prefixLevels.map(i=>o(e.source,i)).filter(i=>!!i).map(i=>a(i,e.capabilities.dialect)).join(".")}function o(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function b(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function d(e){if(typeof e!="string")return"";const a=[];for(const i of e.trim().toLowerCase())f(i)&&a.push(i);return a.join("")}function f(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const s={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},h={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:s,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:s,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:s,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",source:s,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:s,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{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:s,metrics:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMetric:{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.parseSemaphorIsoTimeWindowBoundary=n.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=n.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=n.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=n.validateSemaphorDashboardIntent;exports.validateSemaphorOperationIntent=n.validateSemaphorOperationIntent;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.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=h;exports.buildSemaphorQualifiedSourcePath=p;exports.getSemaphorConnectionCapabilities=c;exports.normalizeSemaphorDialect=u;exports.semaphorSourceHasRequiredCoordinates=m;
@@ -1,7 +1,8 @@
1
- import { p as v, g as h, e as g, f as y, s as k, d as C, v as I, b as S, c as T, a as q } from "../chunks/validators-C2eI8fHy.js";
2
- import { j as _, a as A, g as R, c as L, h as D, f as x, i as M, e as N, d as w, b as O, n as E } from "../chunks/catalog-field-grounding-DoEBOXQd.js";
1
+ import { p as v, v as h, b as g, c as y, a as k } from "../chunks/validators-B-NiYgGc.js";
2
+ import { j as I, a as S, g as T, c as q, h as F, f as _, i as A, e as R, d as L, b as D, n as x } from "../chunks/catalog-field-grounding-DoEBOXQd.js";
3
+ import { c as N, p as w, s as O, a as E, b as P } from "../chunks/source-identity-qAmkNtEK.js";
3
4
  function d(e, a = {}) {
4
- const r = n(e), i = {
5
+ const r = n(e), t = {
5
6
  connectionId: a.connectionId,
6
7
  connectionType: e,
7
8
  path: ["database", "schema", "table"],
@@ -15,24 +16,24 @@ function d(e, a = {}) {
15
16
  supportsFilterClause: !0
16
17
  };
17
18
  return r.includes("postgres") ? {
18
- ...i,
19
+ ...t,
19
20
  prefixLevels: ["schema", "table"],
20
21
  dialect: "postgres"
21
22
  } : r.includes("mysql") ? {
22
- ...i,
23
+ ...t,
23
24
  prefixLevels: ["database", "table"],
24
25
  dialect: "mysql",
25
26
  supportsFilterClause: !1
26
27
  } : r.includes("mssql") || r.includes("sqlserver") ? {
27
- ...i,
28
+ ...t,
28
29
  dialect: "mssql",
29
30
  supportsFilterClause: !1
30
31
  } : r.includes("redshift") ? {
31
- ...i,
32
+ ...t,
32
33
  prefixLevels: ["schema", "table"],
33
34
  dialect: "redshift"
34
35
  } : r.includes("snowflake") ? {
35
- ...i,
36
+ ...t,
36
37
  dialect: "snowflake"
37
38
  } : r.includes("clickhouse") ? {
38
39
  connectionId: a.connectionId,
@@ -66,7 +67,7 @@ function d(e, a = {}) {
66
67
  dialect: "postgres",
67
68
  supportsFilterClause: !0
68
69
  } : r === "s3tables" ? {
69
- ...i,
70
+ ...t,
70
71
  labels: {
71
72
  database: "Database",
72
73
  schema: "Namespace",
@@ -74,7 +75,7 @@ function d(e, a = {}) {
74
75
  },
75
76
  dialect: "duckdb"
76
77
  } : r === "bigquery" ? {
77
- ...i,
78
+ ...t,
78
79
  labels: {
79
80
  database: "Project",
80
81
  schema: "Dataset",
@@ -83,7 +84,7 @@ function d(e, a = {}) {
83
84
  prefixLevels: ["schema", "table"],
84
85
  dialect: "bigquery",
85
86
  supportsFilterClause: !1
86
- } : i;
87
+ } : t;
87
88
  }
88
89
  function c(e) {
89
90
  const a = n(e);
@@ -108,17 +109,17 @@ function c(e) {
108
109
  }
109
110
  function u(e) {
110
111
  return e.capabilities.prefixLevels.every(
111
- (a) => !!t(e.source, a)
112
+ (a) => !!s(e.source, a)
112
113
  );
113
114
  }
114
115
  function m(e) {
115
- const a = e.quoteIdentifier ?? l;
116
- return e.capabilities.prefixLevels.map((r) => t(e.source, r)).filter((r) => !!r).map((r) => a(r, e.capabilities.dialect)).join(".");
116
+ const a = e.quoteIdentifier ?? o;
117
+ return e.capabilities.prefixLevels.map((r) => s(e.source, r)).filter((r) => !!r).map((r) => a(r, e.capabilities.dialect)).join(".");
117
118
  }
118
- function t(e, a) {
119
+ function s(e, a) {
119
120
  return a === "database" ? e.databaseName : a === "schema" ? e.schemaName : e.tableName;
120
121
  }
121
- function l(e, a) {
122
+ function o(e, a) {
122
123
  return a === "mysql" || a === "bigquery" || a === "clickhouse" || a === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : a === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
123
124
  }
124
125
  function n(e) {
@@ -126,14 +127,14 @@ function n(e) {
126
127
  return "";
127
128
  const a = [];
128
129
  for (const r of e.trim().toLowerCase())
129
- o(r) && a.push(r);
130
+ l(r) && a.push(r);
130
131
  return a.join("");
131
132
  }
132
- function o(e) {
133
+ function l(e) {
133
134
  const a = e.charCodeAt(0);
134
135
  return a >= 48 && a <= 57 || a >= 97 && a <= 122;
135
136
  }
136
- const s = {
137
+ const i = {
137
138
  kind: "semantic",
138
139
  domainId: "domain_sales",
139
140
  datasetName: "orders",
@@ -145,7 +146,7 @@ const s = {
145
146
  kind: "metric",
146
147
  id: "revenue-kpi",
147
148
  label: "Revenue",
148
- source: s,
149
+ source: i,
149
150
  metrics: [{ name: "revenue", role: "measure" }],
150
151
  primaryMetric: { name: "revenue", role: "measure" },
151
152
  comparison: { kind: "previous_period" },
@@ -156,7 +157,7 @@ const s = {
156
157
  kind: "records",
157
158
  id: "revenue-trend",
158
159
  label: "Revenue trend",
159
- source: s,
160
+ source: i,
160
161
  fields: [
161
162
  { name: "order_date", role: "date", dataType: "date", label: "Order Date" },
162
163
  { name: "revenue", role: "measure", dataType: "number" }
@@ -170,7 +171,7 @@ const s = {
170
171
  kind: "records",
171
172
  id: "top-customers",
172
173
  label: "Top customers",
173
- source: s,
174
+ source: i,
174
175
  fields: [
175
176
  { name: "customer_name", role: "dimension", dataType: "string" },
176
177
  { name: "segment", role: "dimension", dataType: "string" },
@@ -184,7 +185,7 @@ const s = {
184
185
  kind: "inputOptions",
185
186
  id: "region-options",
186
187
  label: "Region options",
187
- source: s,
188
+ source: i,
188
189
  field: { name: "region", role: "dimension", dataType: "string" },
189
190
  limit: 100
190
191
  },
@@ -193,7 +194,7 @@ const s = {
193
194
  kind: "metric",
194
195
  id: "revenue-previous-period",
195
196
  label: "Revenue previous period comparison",
196
- source: s,
197
+ source: i,
197
198
  metrics: [{ name: "revenue", role: "measure" }],
198
199
  primaryMetric: { name: "revenue", role: "measure" },
199
200
  dateField: { name: "order_date", role: "date", dataType: "date" },
@@ -206,7 +207,7 @@ const s = {
206
207
  kind: "metric",
207
208
  id: "inbound-supplier-concentration",
208
209
  label: "Inbound supplier concentration",
209
- source: s,
210
+ source: i,
210
211
  metrics: [
211
212
  { name: "net_tons", role: "measure" },
212
213
  { name: "ticket_value", role: "measure" }
@@ -245,29 +246,29 @@ const s = {
245
246
  };
246
247
  export {
247
248
  p as SEMAPHOR_ANALYTICS_INTENT_FIXTURES,
248
- _ as buildAnalyticsCatalogFieldSummary,
249
+ I as buildAnalyticsCatalogFieldSummary,
249
250
  m as buildSemaphorQualifiedSourcePath,
250
- A as getAnalyticsCatalogFieldCandidates,
251
- R as getAnalyticsCatalogFieldName,
251
+ S as getAnalyticsCatalogFieldCandidates,
252
+ T as getAnalyticsCatalogFieldName,
252
253
  d as getSemaphorConnectionCapabilities,
253
- L as isAnalyticsCatalogDateField,
254
- D as isAnalyticsCatalogDimensionField,
255
- x as isAnalyticsCatalogMetricField,
256
- M as isAnalyticsDateLikeDataType,
257
- N as isAnalyticsMetricIdentifierField,
258
- w as isAnalyticsTechnicalIdentifierField,
259
- O as normalizeAnalyticsCatalogDataType,
260
- E as normalizeAnalyticsCatalogName,
254
+ q as isAnalyticsCatalogDateField,
255
+ F as isAnalyticsCatalogDimensionField,
256
+ _ as isAnalyticsCatalogMetricField,
257
+ A as isAnalyticsDateLikeDataType,
258
+ R as isAnalyticsMetricIdentifierField,
259
+ L as isAnalyticsTechnicalIdentifierField,
260
+ D as normalizeAnalyticsCatalogDataType,
261
+ x as normalizeAnalyticsCatalogName,
261
262
  c as normalizeSemaphorDialect,
262
263
  v as parseSemaphorIsoTimeWindowBoundary,
263
- h as preferSemaphorFieldRefMetadata,
264
- g as preferSemaphorSourceMetadata,
265
- y as semaphorFieldRefsMatch,
264
+ N as preferSemaphorFieldRefMetadata,
265
+ w as preferSemaphorSourceMetadata,
266
+ O as semaphorFieldRefsMatch,
266
267
  u as semaphorSourceHasRequiredCoordinates,
267
- k as semaphorSourceIdentityKey,
268
- C as semaphorSourcesReferToSameDataset,
269
- I as validateSemaphorAnalyticsIntent,
270
- S as validateSemaphorAnalyticsRecoveryPlan,
271
- T as validateSemaphorDashboardIntent,
272
- q as validateSemaphorOperationIntent
268
+ E as semaphorSourceIdentityKey,
269
+ P as semaphorSourcesReferToSameDataset,
270
+ h as validateSemaphorAnalyticsIntent,
271
+ g as validateSemaphorAnalyticsRecoveryPlan,
272
+ y as validateSemaphorDashboardIntent,
273
+ k as validateSemaphorOperationIntent
273
274
  };
@@ -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-DYRgERrC.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");const V=require("../chunks/palette-BMXS-AcI.js"),ge=require("../chunks/braces-DDHkbW1c.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-C0S63HAv.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");const V=require("../chunks/palette-C1k347Tb.js"),ge=require("../chunks/braces-Cc86y9Ov.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,10 +1,10 @@
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 $, a as K, P as ge, b as be, B as C, d as fe, U as De, C as Ie, R as me, f as le, S as Je, X as je, J as se, e as Le, T as $e, K as _e, M, N as Ve, O as G, Q as Ue, V as Me, W as Ge, Y as We, L as E, Z as Q, _ as ee, $ as re, a0 as he, a1 as oe, a2 as ae, a3 as xe, a4 as ye, a5 as ke, a6 as ve, a7 as Ce, a8 as He } from "../chunks/switch-CP7SmEIZ.js";
3
+ import { c as $, a as K, P as ge, b as be, B as C, d as fe, U as De, C as Ie, R as me, f as le, S as Je, X as je, J as se, e as Le, T as $e, K as _e, M, N as Ve, O as G, Q as Ue, V as Me, W as Ge, Y as We, L as E, Z as Q, _ as ee, $ as re, a0 as he, a1 as oe, a2 as ae, a3 as xe, a4 as ye, a5 as ke, a6 as ve, a7 as Ce, a8 as He } from "../chunks/switch-21kU-tcj.js";
4
4
  import { r as Ye, v as Xe, A as Ze, a as qe, p as Ke } from "../chunks/index-CJdxSyQq.js";
5
5
  import "../chunks/index-CuHybtft.js";
6
- import { P as W } from "../chunks/palette-DKecBucs.js";
7
- import { B as Qe } from "../chunks/braces-Ccvdip75.js";
6
+ import { P as W } from "../chunks/palette-DP6TXUD8.js";
7
+ import { B as Qe } from "../chunks/braces-CBMh5wmd.js";
8
8
  /**
9
9
  * @license lucide-react v0.453.0 - ISC
10
10
  *
@@ -1,4 +1,4 @@
1
- import { c as a } from "./switch-CP7SmEIZ.js";
1
+ import { c as a } from "./switch-21kU-tcj.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./switch-DYRgERrC.js");/**
1
+ "use strict";const e=require("./switch-C0S63HAv.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 { jsx as r, jsxs as s, Fragment as X } from "react/jsx-runtime";
2
2
  import ee, { useState as h, useCallback as F, useEffect as ae, useMemo as H } from "react";
3
- import { u as re, c as te, d as se, e as ne, f as le, g as oe, R as W, h as O, C as ie, i as ce, j as de, k as ue, l as _, m as R, n as me, o as fe, p as N } from "./index-DhuiooCy.js";
4
- import { a as S, L as G, P as he, b as pe, B as j, d as ge, e as V, f as ve } from "./switch-CP7SmEIZ.js";
3
+ import { u as re, c as te, d as se, e as ne, f as le, g as oe, R as W, h as O, C as ie, i as ce, j as de, k as ue, l as _, m as R, n as me, o as fe, p as N } from "./index-BJLPtQeK.js";
4
+ import { a as S, L as G, P as he, b as pe, B as j, d as ge, e as V, f as ve } from "./switch-21kU-tcj.js";
5
5
  import "./index-CuHybtft.js";
6
- import { C as be } from "./chevrons-up-down-pV0i9ptS.js";
6
+ import { C as be } from "./chevrons-up-down-fg3WME_w.js";
7
7
  function we(n = {}) {
8
8
  var C, A, E, L;
9
9
  const { authToken: c, tokenProps: e } = re(), p = n.enabled ?? !0, d = (c == null ? void 0 : c.accessToken) ?? null, u = (e == null ? void 0 : e.apiServiceUrl) ?? null, [I, k] = h(!1), [y, b] = h(!1), [m, g] = h(!1), [T, o] = h(null), [v, w] = h(null), P = v || {
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-D7U5s9Uk.js"),i=require("./switch-DYRgERrC.js");require("./index-BxM99sFL.js");const G=require("./chevrons-up-down-B9fTSds9.js");function W(n={}){var y,P,z,A;const{authToken:d,tokenProps:a}=t.useSemaphorContext(),x=n.enabled??!0,m=(d==null?void 0:d.accessToken)??null,f=(a==null?void 0:a.apiServiceUrl)??null,[L,C]=l.useState(!1),[j,b]=l.useState(!1),[h,g]=l.useState(!1),[N,c]=l.useState(null),[v,S]=l.useState(null),k=v||{tz:((P=(y=a==null?void 0:a.params)==null?void 0:y.calendarContext)==null?void 0:P.tz)||null,weekStart:((A=(z=a==null?void 0:a.params)==null?void 0:z.calendarContext)==null?void 0:A.weekStart)??null},p=l.useCallback(async()=>{if(!(!x||!m||!f)){C(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to fetch preferences")}const r=await o.json();S({tz:r.tz,weekStart:r.weekStart,source:r.source,isInherited:r.isInherited,userHasPrefs:r.userHasPrefs,inherited:r.inherited})}catch(o){const r=o instanceof Error?o.message:"Unknown error";c(r)}finally{C(!1)}}},[m,f,x]);l.useEffect(()=>{x&&p()},[x,p]);const T=l.useCallback(async o=>{if(!m||!f)return c("Not authenticated"),!1;b(!0),c(null);try{const r=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify(o)});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error||"Failed to update preferences")}return await p(),!0}catch(r){const u=r instanceof Error?r.message:"Unknown error";return c(u),!1}finally{b(!1)}},[m,f,p]),w=l.useCallback(async()=>{if(!m||!f)return c("Not authenticated"),!1;g(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to clear preferences")}const r=await o.text();if(r)try{const u=JSON.parse(r);return S({tz:u.tz,weekStart:u.weekStart,source:u.source,isInherited:u.isInherited??!0,userHasPrefs:!1,inherited:u.inherited}),!0}catch{}return await p(),!0}catch(o){const r=o instanceof Error?o.message:"Unknown error";return c(r),!1}finally{g(!1)}},[m,f,p]);return{preferences:k,isLoading:L,isSaving:j,isClearing:h,error:N,updatePreferences:T,clearPreferences:w,refetch:p}}const E=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const n=Intl;if(n.supportedValuesOf)return n.supportedValuesOf("timeZone")}catch{}return E.map(n=>n.value)}function q(n){switch(n){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function O(n){const d=E.find(a=>a.value===n);return d?d.label:n}function V(n){const d=M.find(a=>a.value===n);return d?d.label:String(n)}function Z({open:n,onOpenChange:d}){var D,U,F;const{preferences:a,isLoading:x,isSaving:m,isClearing:f,updatePreferences:L,clearPreferences:C}=W({enabled:n}),j=a.tz||((D=a.inherited)==null?void 0:D.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,b=a.weekStart??((U=a.inherited)==null?void 0:U.weekStart)??1,[h,g]=l.useState(!a.userHasPrefs),[N,c]=l.useState(!1),[v,S]=l.useState(j),[k,p]=l.useState(b),[T,w]=l.useState(!1),y=l.useMemo(()=>_(),[]),P=l.useMemo(()=>y.filter(s=>!E.some(R=>R.value===s)),[y]),z=l.useMemo(()=>O(v),[v]),A=a.inherited?O(a.inherited.tz):"UTC",o=a.inherited?V(a.inherited.weekStart):"Monday",r=q((F=a.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!n){c(!1);return}N||(a.userHasPrefs!==void 0&&g(!a.userHasPrefs),S(j),p(b))},[n,N,a.userHasPrefs,j,b]);const u=async()=>{if(x){t.ue.error("Preferences are still loading. Please try again.");return}h?await C()?(t.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again."):await L({tz:v,weekStart:k})?(t.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again.")},$=()=>{d(!1)},I=m||f,B=I||x;return e.jsx(t.Dialog,{open:n,onOpenChange:d,children:e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(t.RadioGroup,{value:h?"defaults":"custom",onValueChange:s=>{c(!0),g(s==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",h&&"bg-muted/50"),onClick:()=>{c(!0),g(!0)},children:[e.jsx(t.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",r," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",o]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!h&&"bg-muted/50"),onClick:()=>{c(!0),g(!1)},children:[e.jsx(t.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:i.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",h&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Timezone"}),e.jsxs(i.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(i.PopoverTrigger,{asChild:!0,children:e.jsxs(i.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:h,children:[e.jsx("span",{className:"truncate",children:z}),e.jsx(G.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(i.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(t.Command,{className:"overflow-visible",children:[e.jsx(t.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(t.CommandList,{children:[e.jsx(t.CommandEmpty,{children:"No timezone found."}),e.jsx(t.CommandGroup,{heading:"Common",children:E.map(s=>e.jsxs(t.CommandItem,{value:`${s.value} ${s.label}`,onSelect:()=>{c(!0),S(s.value),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:s.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.value})]},s.value))}),e.jsx(t.CommandSeparator,{}),e.jsx(t.CommandGroup,{heading:"All timezones",children:P.map(s=>e.jsxs(t.CommandItem,{value:s,onSelect:()=>{c(!0),S(s),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s?"opacity-100":"opacity-0")}),s]},s))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Week starts on"}),e.jsx(t.RadioGroup,{value:String(k),onValueChange:s=>{c(!0),p(Number(s))},className:"flex gap-4",disabled:h,children:M.map(s=>e.jsxs("label",{htmlFor:`week-start-${s.value}`,className:i.cn("flex cursor-pointer items-center gap-2 text-[13px]",h&&"cursor-not-allowed"),children:[e.jsx(t.RadioGroupItem,{value:String(s.value),id:`week-start-${s.value}`,disabled:h}),s.label]},s.value))})]})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(i.Button,{variant:"outline",size:"xs",onClick:$,disabled:I,children:"Cancel"}),e.jsx(i.Button,{size:"xs",onClick:u,disabled:B,children:I?e.jsxs(e.Fragment,{children:[e.jsx(i.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}exports.CalendarPreferencesDialog=Z;
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-D2ai-cZQ.js"),i=require("./switch-C0S63HAv.js");require("./index-BxM99sFL.js");const G=require("./chevrons-up-down-CUZL1zaU.js");function W(n={}){var y,P,z,A;const{authToken:d,tokenProps:a}=t.useSemaphorContext(),x=n.enabled??!0,m=(d==null?void 0:d.accessToken)??null,f=(a==null?void 0:a.apiServiceUrl)??null,[L,C]=l.useState(!1),[j,b]=l.useState(!1),[h,g]=l.useState(!1),[N,c]=l.useState(null),[v,S]=l.useState(null),k=v||{tz:((P=(y=a==null?void 0:a.params)==null?void 0:y.calendarContext)==null?void 0:P.tz)||null,weekStart:((A=(z=a==null?void 0:a.params)==null?void 0:z.calendarContext)==null?void 0:A.weekStart)??null},p=l.useCallback(async()=>{if(!(!x||!m||!f)){C(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to fetch preferences")}const r=await o.json();S({tz:r.tz,weekStart:r.weekStart,source:r.source,isInherited:r.isInherited,userHasPrefs:r.userHasPrefs,inherited:r.inherited})}catch(o){const r=o instanceof Error?o.message:"Unknown error";c(r)}finally{C(!1)}}},[m,f,x]);l.useEffect(()=>{x&&p()},[x,p]);const T=l.useCallback(async o=>{if(!m||!f)return c("Not authenticated"),!1;b(!0),c(null);try{const r=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify(o)});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error||"Failed to update preferences")}return await p(),!0}catch(r){const u=r instanceof Error?r.message:"Unknown error";return c(u),!1}finally{b(!1)}},[m,f,p]),w=l.useCallback(async()=>{if(!m||!f)return c("Not authenticated"),!1;g(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to clear preferences")}const r=await o.text();if(r)try{const u=JSON.parse(r);return S({tz:u.tz,weekStart:u.weekStart,source:u.source,isInherited:u.isInherited??!0,userHasPrefs:!1,inherited:u.inherited}),!0}catch{}return await p(),!0}catch(o){const r=o instanceof Error?o.message:"Unknown error";return c(r),!1}finally{g(!1)}},[m,f,p]);return{preferences:k,isLoading:L,isSaving:j,isClearing:h,error:N,updatePreferences:T,clearPreferences:w,refetch:p}}const E=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const n=Intl;if(n.supportedValuesOf)return n.supportedValuesOf("timeZone")}catch{}return E.map(n=>n.value)}function q(n){switch(n){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function O(n){const d=E.find(a=>a.value===n);return d?d.label:n}function V(n){const d=M.find(a=>a.value===n);return d?d.label:String(n)}function Z({open:n,onOpenChange:d}){var D,U,F;const{preferences:a,isLoading:x,isSaving:m,isClearing:f,updatePreferences:L,clearPreferences:C}=W({enabled:n}),j=a.tz||((D=a.inherited)==null?void 0:D.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,b=a.weekStart??((U=a.inherited)==null?void 0:U.weekStart)??1,[h,g]=l.useState(!a.userHasPrefs),[N,c]=l.useState(!1),[v,S]=l.useState(j),[k,p]=l.useState(b),[T,w]=l.useState(!1),y=l.useMemo(()=>_(),[]),P=l.useMemo(()=>y.filter(s=>!E.some(R=>R.value===s)),[y]),z=l.useMemo(()=>O(v),[v]),A=a.inherited?O(a.inherited.tz):"UTC",o=a.inherited?V(a.inherited.weekStart):"Monday",r=q((F=a.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!n){c(!1);return}N||(a.userHasPrefs!==void 0&&g(!a.userHasPrefs),S(j),p(b))},[n,N,a.userHasPrefs,j,b]);const u=async()=>{if(x){t.ue.error("Preferences are still loading. Please try again.");return}h?await C()?(t.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again."):await L({tz:v,weekStart:k})?(t.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again.")},$=()=>{d(!1)},I=m||f,B=I||x;return e.jsx(t.Dialog,{open:n,onOpenChange:d,children:e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(t.RadioGroup,{value:h?"defaults":"custom",onValueChange:s=>{c(!0),g(s==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",h&&"bg-muted/50"),onClick:()=>{c(!0),g(!0)},children:[e.jsx(t.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",r," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",o]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!h&&"bg-muted/50"),onClick:()=>{c(!0),g(!1)},children:[e.jsx(t.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:i.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",h&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Timezone"}),e.jsxs(i.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(i.PopoverTrigger,{asChild:!0,children:e.jsxs(i.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:h,children:[e.jsx("span",{className:"truncate",children:z}),e.jsx(G.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(i.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(t.Command,{className:"overflow-visible",children:[e.jsx(t.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(t.CommandList,{children:[e.jsx(t.CommandEmpty,{children:"No timezone found."}),e.jsx(t.CommandGroup,{heading:"Common",children:E.map(s=>e.jsxs(t.CommandItem,{value:`${s.value} ${s.label}`,onSelect:()=>{c(!0),S(s.value),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:s.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.value})]},s.value))}),e.jsx(t.CommandSeparator,{}),e.jsx(t.CommandGroup,{heading:"All timezones",children:P.map(s=>e.jsxs(t.CommandItem,{value:s,onSelect:()=>{c(!0),S(s),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s?"opacity-100":"opacity-0")}),s]},s))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Week starts on"}),e.jsx(t.RadioGroup,{value:String(k),onValueChange:s=>{c(!0),p(Number(s))},className:"flex gap-4",disabled:h,children:M.map(s=>e.jsxs("label",{htmlFor:`week-start-${s.value}`,className:i.cn("flex cursor-pointer items-center gap-2 text-[13px]",h&&"cursor-not-allowed"),children:[e.jsx(t.RadioGroupItem,{value:String(s.value),id:`week-start-${s.value}`,disabled:h}),s.label]},s.value))})]})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(i.Button,{variant:"outline",size:"xs",onClick:$,disabled:I,children:"Cancel"}),e.jsx(i.Button,{size:"xs",onClick:u,disabled:B,children:I?e.jsxs(e.Fragment,{children:[e.jsx(i.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}exports.CalendarPreferencesDialog=Z;
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./switch-DYRgERrC.js");/**
1
+ "use strict";const e=require("./switch-C0S63HAv.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { c as o } from "./switch-CP7SmEIZ.js";
1
+ import { c as o } from "./switch-21kU-tcj.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("react/jsx-runtime"),a=require("./switch-DYRgERrC.js"),l=require("./index-D7U5s9Uk.js"),le=require("./use-create-flow-overlay-state-DS5aPcKd.js"),h=require("react"),bn=require("./use-visual-utils-EazVs86Z.js");require("./index-BxM99sFL.js");const $s=require("./date-formatter-B4EBSe9C.js");require("./index-DRlMUglg.js");require("react-dom/client");require("react-dom");/**
1
+ "use strict";const e=require("react/jsx-runtime"),a=require("./switch-C0S63HAv.js"),l=require("./index-D2ai-cZQ.js"),le=require("./use-create-flow-overlay-state-C49F2KdU.js"),h=require("react"),bn=require("./use-visual-utils-CiN4zNkZ.js");require("./index-BxM99sFL.js");const $s=require("./date-formatter-B4EBSe9C.js");require("./index-DRlMUglg.js");require("react-dom/client");require("react-dom");/**
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 { jsx as t, jsxs as s, Fragment as se } from "react/jsx-runtime";
2
- import { c as Ie, L as wn, a2 as io, B as ge, f as ne, G as ct, u as H, E as bt, aK as Fr, aa as ba, g as ze, e as Ke, H as xa, a as v, J as Fn, X as Ce, P as Re, b as tt, d as nt, aL as lo, aM as co, aI as ya, aN as va, a3 as Qe, a4 as Ye, a5 as Xe, a6 as Ze, a7 as he, V as uo, aO as Na, aP as wa, a0 as et, T as mo, K as ho, M as Pr, aQ as po } from "./switch-CP7SmEIZ.js";
3
- import { c as ut, d as mt, e as ht, f as pt, g as ft, bc as fo, o as Ca, ag as go, ah as bo, av as ka, bP as xo, p as fe, aw as Cn, y as yo, aN as Pn, aO as Mn, aQ as Bn, aR as je, aV as Sa, aI as Kt, bQ as vo, bR as No, b0 as On, b1 as Vn, b2 as $n, b3 as Un, b4 as _n, b5 as jn, b6 as zn, u as It, $ as ot, aa as Kn, a6 as Aa, a7 as Hn, a0 as Ea, a5 as wo, ac as Co, bK as ko, bS as So, aK as Ao, a8 as Mr, x as Vt, a2 as Eo, bT as Io, bU as Do, bV as To, bW as Lo, bX as Ro, bY as Fo, bZ as Po, b_ as Mo, b$ as Ia, c0 as Bo, c1 as Oo, c2 as Vo, c3 as $o, c4 as Uo, c5 as gt, c6 as _o, bJ as Da, ax as Ta, c7 as jo, c8 as zo, c9 as Ko, ca as Ho, cb as qo, cc as Wo, cd as Go, ce as La, cf as Jo, cg as Qo, ch as Ra, ci as Fa, cj as Pa, ck as Yo, cl as Xo, b9 as Ma, by as Zo, bv as ei, cm as ti, aW as ni, cn as Ba, co as ri, cp as ai, aX as Br, cq as si, cr as oi, cs as kn, ct as ii, cu as li, cv as Oa, cw as qn, cx as di, cy as ci, cz as ui, cA as Va, cB as Dt, cC as $a, az as Sn, b7 as Ua, cD as mi, cE as hi, ay as An, cF as pi, cG as _a, cH as fi, cI as gi, cJ as bi, cK as xi, cL as yi, cM as vi, cN as Ni, cO as wi } from "./index-DhuiooCy.js";
4
- import { V as Ci, E as Or, a as Vr, b as ki, c as Si, L as Ai, d as Ei, C as Ii, u as ja, e as za, f as Di, R as Ti, S as Li } from "./use-create-flow-overlay-state-p_i0aUhH.js";
2
+ import { c as Ie, L as wn, a2 as io, B as ge, f as ne, G as ct, u as H, E as bt, aK as Fr, aa as ba, g as ze, e as Ke, H as xa, a as v, J as Fn, X as Ce, P as Re, b as tt, d as nt, aL as lo, aM as co, aI as ya, aN as va, a3 as Qe, a4 as Ye, a5 as Xe, a6 as Ze, a7 as he, V as uo, aO as Na, aP as wa, a0 as et, T as mo, K as ho, M as Pr, aQ as po } from "./switch-21kU-tcj.js";
3
+ import { c as ut, d as mt, e as ht, f as pt, g as ft, bc as fo, o as Ca, ag as go, ah as bo, av as ka, bO as xo, p as fe, aw as Cn, y as yo, aN as Pn, aO as Mn, aQ as Bn, aR as je, aV as Sa, aI as Kt, bP as vo, bQ as No, b0 as On, b1 as Vn, b2 as $n, b3 as Un, b4 as _n, b5 as jn, b6 as zn, u as It, $ as ot, aa as Kn, a6 as Aa, a7 as Hn, a0 as Ea, a5 as wo, ac as Co, bJ as ko, bR as So, aK as Ao, a8 as Mr, x as Vt, a2 as Eo, bS as Io, bT as Do, bU as To, bV as Lo, bW as Ro, bX as Fo, bY as Po, bZ as Mo, b_ as Ia, b$ as Bo, c0 as Oo, c1 as Vo, c2 as $o, c3 as Uo, c4 as gt, c5 as _o, bI as Da, ax as Ta, c6 as jo, c7 as zo, c8 as Ko, c9 as Ho, ca as qo, cb as Wo, cc as Go, cd as La, ce as Jo, cf as Qo, cg as Ra, ch as Fa, ci as Pa, cj as Yo, ck as Xo, b9 as Ma, by as Zo, bv as ei, cl as ti, aW as ni, cm as Ba, cn as ri, co as ai, aX as Br, cp as si, cq as oi, cr as kn, cs as ii, ct as li, cu as Oa, cv as qn, cw as di, cx as ci, cy as ui, cz as Va, cA as Dt, cB as $a, az as Sn, b7 as Ua, cC as mi, cD as hi, ay as An, cE as pi, cF as _a, cG as fi, cH as gi, cI as bi, cJ as xi, cK as yi, cL as vi, cM as Ni, cN as wi } from "./index-BJLPtQeK.js";
4
+ import { V as Ci, E as Or, a as Vr, b as ki, c as Si, L as Ai, d as Ei, C as Ii, u as ja, e as za, f as Di, R as Ti, S as Li } from "./use-create-flow-overlay-state-jpQ2BxKF.js";
5
5
  import Ri, { useState as A, useContext as Fi, useRef as Ee, useCallback as pe, useEffect as ue, useMemo as O } from "react";
6
- import { u as Ka } from "./use-visual-utils-PfpWtYcR.js";
6
+ import { u as Ka } from "./use-visual-utils-D8Pe1PSH.js";
7
7
  import "./index-CuHybtft.js";
8
8
  import { l as $r } from "./date-formatter-CzcPZx39.js";
9
9
  import "./index-CJdxSyQq.js";