react-semaphor 0.1.507 → 0.1.509

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 (254) hide show
  1. package/DATA_APP_SDK.md +56 -0
  2. package/dist/analytics-protocol/index.cjs +1 -1
  3. package/dist/analytics-protocol/index.js +194 -172
  4. package/dist/appearance/index.cjs +1 -1
  5. package/dist/appearance/index.js +1 -1
  6. package/dist/appearance-runtime/index.cjs +1 -1
  7. package/dist/appearance-runtime/index.js +1 -1
  8. package/dist/brand-studio/index.cjs +2 -2
  9. package/dist/brand-studio/index.js +279 -250
  10. package/dist/briefings/index.cjs +1 -1
  11. package/dist/briefings/index.js +3 -3
  12. package/dist/chunks/appearance-context-DzqCdhB4.cjs +1 -0
  13. package/dist/chunks/{appearance-context-XviHOhWJ.js → appearance-context-VJdrKi7r.js} +2 -1
  14. package/dist/chunks/{appearance-runtime-provider-D0xVQWnH.js → appearance-runtime-provider-CC4HT2Gi.js} +2 -2
  15. package/dist/chunks/{appearance-runtime-provider-Ca8rxO86.cjs → appearance-runtime-provider-D5pkvgE4.cjs} +1 -1
  16. package/dist/chunks/calculated-field-identity-BiTGmnST.cjs +1 -0
  17. package/dist/chunks/calculated-field-identity-CJL54uFx.js +1373 -0
  18. package/dist/chunks/{constants-NUleP4DY.js → card-config-utils-Bq1enstT.js} +260 -260
  19. package/dist/chunks/card-config-utils-CMO4_zVs.cjs +1 -0
  20. package/dist/chunks/{dashboard-briefing-launcher-DXTpU85p.js → dashboard-briefing-launcher-B5AQu-Vb.js} +12 -12
  21. package/dist/chunks/{dashboard-briefing-launcher-C8nDSDnV.cjs → dashboard-briefing-launcher-BoXFrqq0.cjs} +1 -1
  22. package/dist/chunks/{dashboard-controls-CyL0yimg.js → dashboard-controls-CKKkSXEX.js} +16 -14
  23. package/dist/chunks/dashboard-controls-gUVkQm8o.cjs +52 -0
  24. package/dist/chunks/dashboard-json-B7fSi6_b.cjs +1 -0
  25. package/dist/chunks/{dashboard-json-5Jr3RudV.js → dashboard-json-CAJJquVx.js} +9 -9
  26. package/dist/chunks/edit-dashboard-visual-AZetLUv1.cjs +172 -0
  27. package/dist/chunks/{edit-dashboard-visual-C7X-um9g.js → edit-dashboard-visual-DCnbqRRn.js} +1986 -1990
  28. package/dist/chunks/{editor-action-buttons-CcDm8nA5.cjs → editor-action-buttons-CBQsVYdt.cjs} +2 -2
  29. package/dist/chunks/{editor-action-buttons-C5Wja_J4.js → editor-action-buttons-DDA5JGwO.js} +6 -6
  30. package/dist/chunks/field-aggregations-DUb0NU6c.js +1229 -0
  31. package/dist/chunks/field-aggregations-jSi77h9Z.cjs +1 -0
  32. package/dist/chunks/{field-dependencies-DVl2p1Nm.js → field-dependencies-Cl97kkHy.js} +30 -34
  33. package/dist/chunks/{field-dependencies-r_U0CGQ-.cjs → field-dependencies-DIab72rQ.cjs} +1 -1
  34. package/dist/chunks/{index-BVr4fcCB.js → index-0pdaQ9e1.js} +5 -5
  35. package/dist/chunks/{index-De2QNsqV.js → index-CL2lvhwk.js} +47783 -46019
  36. package/dist/chunks/{index-C9KXfCkC.js → index-CLIro-EG.js} +3 -0
  37. package/dist/chunks/index-Cx3qmRUB.cjs +1 -0
  38. package/dist/chunks/{index-BlYf8gNa.cjs → index-DhlVxvyI.cjs} +1 -1
  39. package/dist/chunks/index-DkEAikW8.cjs +1420 -0
  40. package/dist/chunks/{matrix-card-DACDwdTq.js → matrix-card-CnKQpnsj.js} +1 -1
  41. package/dist/chunks/{matrix-card-CRXcmAjp.cjs → matrix-card-U4c72doZ.cjs} +1 -1
  42. package/dist/chunks/{matrix-control-sources-ClQzIk7E.js → matrix-control-sources-CRRdP03Q.js} +165 -134
  43. package/dist/chunks/matrix-control-sources-FjxGIbqk.cjs +1 -0
  44. package/dist/chunks/{matrix-formatter-7GLTcBuy.cjs → matrix-formatter-CveLJo6S.cjs} +1 -1
  45. package/dist/chunks/{matrix-formatter-xsq7n_e6.js → matrix-formatter-ZVS5QOuq.js} +2 -2
  46. package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +1 -0
  47. package/dist/chunks/matrix-member-presentation-CzGZJd3a.js +182 -0
  48. package/dist/chunks/matrix-operation-contract-DoiWTUbT.cjs +1 -0
  49. package/dist/chunks/matrix-operation-contract-xL8IhFzp.js +1802 -0
  50. package/dist/chunks/{pivot-header-presentation-3wqWChFd.cjs → pivot-header-presentation-Cxz8-06f.cjs} +1 -1
  51. package/dist/chunks/{pivot-header-presentation-D44ODZGn.js → pivot-header-presentation-DVylCBHB.js} +2 -2
  52. package/dist/chunks/{pivot-result-lifecycle-DZ0ZSMoM.cjs → pivot-result-lifecycle-BiERyXnS.cjs} +1 -1
  53. package/dist/chunks/{pivot-result-lifecycle-BSmqVkVG.js → pivot-result-lifecycle-CmjpW7qG.js} +1 -1
  54. package/dist/chunks/{report-preferences-dialog-xADifRXs.js → report-preferences-dialog-Bv2VIOKc.js} +4 -4
  55. package/dist/chunks/report-preferences-dialog-Wg9g9fIj.cjs +1 -0
  56. package/dist/chunks/{search-BHsQIWBV.js → selection-reducer-B94WgZ9V.js} +55 -11
  57. package/dist/chunks/selection-reducer-CGKKsaPa.cjs +26 -0
  58. package/dist/chunks/{semantic-format-BhIL1PXP.cjs → semantic-format-BzH69TRq.cjs} +1 -1
  59. package/dist/chunks/{semantic-format-C3amkGmY.js → semantic-format-CBlRO8Aw.js} +1 -1
  60. package/dist/chunks/{switch-DHGiC0aU.js → switch-CD4uGTZI.js} +7450 -7694
  61. package/dist/chunks/switch-iC1x2dcE.cjs +134 -0
  62. package/dist/chunks/token-types-Ahh5u4iT.cjs +1 -0
  63. package/dist/chunks/token-types-CPde8_LG.js +8 -0
  64. package/dist/chunks/{update-policy-Cc9h57pA.cjs → update-policy-COjFudhl.cjs} +1 -1
  65. package/dist/chunks/{update-policy-eTcz52jO.js → update-policy-D9q1Tz8k.js} +1 -1
  66. package/dist/dashboard/index.cjs +1 -1
  67. package/dist/dashboard/index.js +1 -1
  68. package/dist/dashboard-authoring/index.cjs +3 -3
  69. package/dist/dashboard-authoring/index.js +734 -622
  70. package/dist/data-app-builder/index.cjs +1 -1
  71. package/dist/data-app-builder/index.js +3 -3
  72. package/dist/data-app-codegen/index.cjs +1 -1
  73. package/dist/data-app-codegen/index.js +2 -2
  74. package/dist/data-app-codegen-node/index.cjs +94 -92
  75. package/dist/data-app-codegen-node/index.js +337 -333
  76. package/dist/data-app-sdk/index.cjs +9 -9
  77. package/dist/data-app-sdk/index.js +1091 -969
  78. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  79. package/dist/data-app-sdk-adapters/index.js +104 -96
  80. package/dist/data-app-sdk-validation/index.cjs +1 -1
  81. package/dist/data-app-sdk-validation/index.js +2 -2
  82. package/dist/format-utils/index.cjs +1 -1
  83. package/dist/format-utils/index.js +8 -8
  84. package/dist/index.cjs +1 -1
  85. package/dist/index.js +15 -15
  86. package/dist/style.css +1 -1
  87. package/dist/surfboard/index.cjs +1 -1
  88. package/dist/surfboard/index.js +2 -2
  89. package/dist/types/brand-studio/brand-studio-draft.d.ts +3 -1
  90. package/dist/types/components/dashboard/card-selection-pill.d.ts +5 -0
  91. package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
  92. package/dist/types/components/dashboard/drill-breadcrumb.d.ts +1 -0
  93. package/dist/types/components/dashboard/drill-navigation-controls.d.ts +3 -3
  94. package/dist/types/components/interactions/applied-filters-display.d.ts +6 -1
  95. package/dist/types/components/interactions/click-to-filter-review-dialog.d.ts +21 -0
  96. package/dist/types/components/interactions/dashboard-drill-host.d.ts +13 -0
  97. package/dist/types/components/interactions/filter-badge-tooltip.d.ts +4 -4
  98. package/dist/types/components/interactions/insight-modal.d.ts +4 -14
  99. package/dist/types/components/interactions/insight-viewer.d.ts +7 -19
  100. package/dist/types/components/interactions/interactions-sheet.d.ts +6 -0
  101. package/dist/types/components/interactions/panels/click-to-filter-panel.d.ts +20 -0
  102. package/dist/types/components/interactions/reusable/interaction-selection-popover.d.ts +2 -2
  103. package/dist/types/components/interactions/sheet/action-editor.d.ts +17 -0
  104. package/dist/types/components/interactions/sheet/action-meta.d.ts +45 -0
  105. package/dist/types/components/interactions/sheet/action-picker.d.ts +7 -0
  106. package/dist/types/components/interactions/sheet/click-outcome-preview.d.ts +10 -0
  107. package/dist/types/components/interactions/sheet/interactions-home.d.ts +28 -0
  108. package/dist/types/components/interactions/sheet/sheet-parts.d.ts +37 -0
  109. package/dist/types/components/surfboard/filter/dashboard-filter-mapping-panel.d.ts +28 -1
  110. package/dist/types/components/surfboard/filter/selection-chip.d.ts +11 -0
  111. package/dist/types/components/surfboard/filter/selection-filter-section.d.ts +4 -0
  112. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +3 -0
  113. package/dist/types/components/ui/resizable.d.ts +1 -1
  114. package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +24 -3
  115. package/dist/types/components/visual/matrix-table/matrix-selection-click.d.ts +6 -0
  116. package/dist/types/components/visual/matrix-table/matrix-window-viewer.d.ts +1 -1
  117. package/dist/types/data-app-sdk/adapters.d.ts +3 -2
  118. package/dist/types/data-app-sdk/builders.d.ts +2 -1
  119. package/dist/types/data-app-sdk/contracts.d.ts +44 -2
  120. package/dist/types/data-app-sdk/index.d.ts +1 -0
  121. package/dist/types/data-app-sdk/query-request.d.ts +7 -2
  122. package/dist/types/data-app-sdk/selection.d.ts +2 -0
  123. package/dist/types/index.cjs +1 -1
  124. package/dist/types/index.js +24 -23
  125. package/dist/types/lib/appearance/types.d.ts +3 -1
  126. package/dist/types/lib/briefings/briefing-attachment-model.d.ts +0 -2
  127. package/dist/types/lib/contexts/interactions-popover-context.d.ts +1 -8
  128. package/dist/types/lib/dashboard/click-to-filter-card-references.d.ts +23 -0
  129. package/dist/types/lib/dashboard-inputs/build-normalized-dashboard-inputs.d.ts +16 -2
  130. package/dist/types/lib/dashboard-inputs/build-selection-dashboard-inputs.d.ts +31 -0
  131. package/dist/types/lib/dashboard-inputs/click-to-filter-emitted-fields.d.ts +17 -0
  132. package/dist/types/lib/dashboard-inputs/click-to-filter-mapping-draft.d.ts +99 -0
  133. package/dist/types/lib/dashboard-inputs/click-to-filter-sheet-reach.d.ts +12 -0
  134. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +18 -1
  135. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-candidate-metadata.d.ts +4 -1
  136. package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +10 -0
  137. package/dist/types/lib/dashboard-inputs/dashboard-input-snapshot.d.ts +8 -1
  138. package/dist/types/lib/dashboard-inputs/index.d.ts +1 -0
  139. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +18 -7
  140. package/dist/types/lib/dashboard-inputs/resolve-field-date-comparison-coverage.d.ts +5 -2
  141. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +77 -0
  142. package/dist/types/lib/dashboard-inputs/selection-targets.d.ts +26 -0
  143. package/dist/types/lib/dashboard-inputs/transient-input-context.d.ts +102 -0
  144. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +50 -0
  145. package/dist/types/lib/dashboard-navigation/describe-carried-context.d.ts +11 -0
  146. package/dist/types/lib/dashboard-navigation/index.d.ts +1 -0
  147. package/dist/types/lib/dashboard-navigation/navigation-state.d.ts +120 -0
  148. package/dist/types/lib/dashboard-navigation/run-one-off-drill.d.ts +11 -0
  149. package/dist/types/lib/dashboard-navigation/use-transient-contexts.d.ts +17 -0
  150. package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +48 -0
  151. package/dist/types/lib/dashboard-view-state/drill-path.d.ts +20 -0
  152. package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
  153. package/dist/types/lib/download-pdf.d.ts +0 -3
  154. package/dist/types/lib/formatters/metric-formatting.d.ts +1 -1
  155. package/dist/types/lib/hooks/ai/dashboard-context.d.ts +15 -8
  156. package/dist/types/lib/hooks/chartjs/use-chart-blur.d.ts +10 -2
  157. package/dist/types/lib/hooks/interactions/{use-event-engine.d.ts → use-drill-actions.d.ts} +28 -7
  158. package/dist/types/lib/hooks/selection/use-active-selections.d.ts +15 -0
  159. package/dist/types/lib/hooks/selection/use-click-to-filter-mapping-draft.d.ts +20 -0
  160. package/dist/types/lib/hooks/selection/use-selection-click.d.ts +34 -0
  161. package/dist/types/lib/hooks/selection/use-selection-gestures.d.ts +38 -0
  162. package/dist/types/lib/hooks/selection/use-table-row-selection.d.ts +46 -0
  163. package/dist/types/lib/hooks/use-dashboard-card.d.ts +0 -2
  164. package/dist/types/lib/hooks/use-dashboard-filter-mapping-candidates.d.ts +18 -0
  165. package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +0 -1
  166. package/dist/types/lib/hooks/use-dashboard.d.ts +1 -3
  167. package/dist/types/lib/hooks/use-interactions-popover.d.ts +1 -8
  168. package/dist/types/lib/hooks/use-resolved-card-config.d.ts +6 -0
  169. package/dist/types/lib/interactions/click-outcome.d.ts +25 -0
  170. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +3 -1
  171. package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +1 -1
  172. package/dist/types/lib/interactions/get-click-context-from-table.d.ts +7 -0
  173. package/dist/types/lib/interactions/interaction-utils.d.ts +17 -1
  174. package/dist/types/lib/matrix-table/build-matrix-drill-to-detail.d.ts +15 -0
  175. package/dist/types/lib/matrix-table/matrix-card-interactions.d.ts +14 -3
  176. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +0 -3
  177. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +0 -4
  178. package/dist/types/lib/matrix-table/{use-matrix-selection.d.ts → use-matrix-cell-focus.d.ts} +13 -17
  179. package/dist/types/lib/matrix-table/use-matrix.d.ts +0 -1
  180. package/dist/types/lib/query-context/build-card-query-context.d.ts +19 -8
  181. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -3
  182. package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +12 -4
  183. package/dist/types/lib/query-context/compile-selection-filters.d.ts +5 -0
  184. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +46 -0
  185. package/dist/types/lib/query-context/filter-group-utils.d.ts +3 -0
  186. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +29 -0
  187. package/dist/types/lib/selection/click-to-filter-authoring-support.d.ts +9 -0
  188. package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
  189. package/dist/types/lib/selection/selection-labels.d.ts +3 -0
  190. package/dist/types/lib/selection/selection-notices.d.ts +9 -0
  191. package/dist/types/lib/selection/selection-reducer.d.ts +46 -0
  192. package/dist/types/lib/stores/dashboard-store.d.ts +62 -17
  193. package/dist/types/lib/stores/editor-store.d.ts +1 -2
  194. package/dist/types/lib/stores/index.d.ts +0 -2
  195. package/dist/types/lib/types/common-types.d.ts +60 -6
  196. package/dist/types/lib/types/explorer-types.d.ts +1 -22
  197. package/dist/types/lib/types/interaction-types.d.ts +6 -198
  198. package/dist/types/lib/utils/calculate-context-aware-filters.d.ts +21 -12
  199. package/dist/types/lib/utils/card-utils.d.ts +11 -0
  200. package/dist/types/lib/utils/date-hierarchy-utils.d.ts +3 -1
  201. package/dist/types/lib/utils/drag-and-drop-utils.d.ts +1 -1
  202. package/dist/types/lib/utils/interaction-icons.d.ts +1 -1
  203. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +32 -32
  204. package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
  205. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +100 -0
  206. package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +12 -0
  207. package/dist/types/shared/dashboard-authoring/apply-group-by-override.d.ts +19 -0
  208. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +88 -0
  209. package/dist/types/shared/dashboard-authoring/contracts.d.ts +8 -0
  210. package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
  211. package/dist/types/shared/dashboard-authoring/linked-click-to-filter-overrides.d.ts +32 -0
  212. package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
  213. package/package.json +1 -1
  214. package/src/data-app-sdk/README.md +58 -1
  215. package/dist/chunks/appearance-context-tNjvTJj3.cjs +0 -1
  216. package/dist/chunks/calculated-field-identity-BTpUqfEu.js +0 -1276
  217. package/dist/chunks/calculated-field-identity-rMuXuzEY.cjs +0 -1
  218. package/dist/chunks/constants-vtu7_IUo.cjs +0 -1
  219. package/dist/chunks/dashboard-controls-DlxeddZN.cjs +0 -52
  220. package/dist/chunks/dashboard-json-DhS4yJfc.cjs +0 -1
  221. package/dist/chunks/edit-dashboard-visual-X3OCnivL.cjs +0 -172
  222. package/dist/chunks/field-aggregations-BU_3gHKR.js +0 -957
  223. package/dist/chunks/field-aggregations-CDCamEsQ.cjs +0 -1
  224. package/dist/chunks/index-C8XCKzB6.cjs +0 -1
  225. package/dist/chunks/index-DSa6RSdg.cjs +0 -1417
  226. package/dist/chunks/matrix-control-sources-CeC5EMyq.cjs +0 -1
  227. package/dist/chunks/matrix-member-presentation-E2B4k3ws.cjs +0 -1
  228. package/dist/chunks/matrix-member-presentation-qiHxv67e.js +0 -105
  229. package/dist/chunks/matrix-operation-contract-Cqy4EW2H.js +0 -1638
  230. package/dist/chunks/matrix-operation-contract-D9dLX-Wr.cjs +0 -1
  231. package/dist/chunks/report-preferences-dialog-7Vsc_fsG.cjs +0 -1
  232. package/dist/chunks/search-BqqhaMx9.cjs +0 -26
  233. package/dist/chunks/switch-BytP6QY8.cjs +0 -139
  234. package/dist/types/components/interactions/configuration-popover.d.ts +0 -1
  235. package/dist/types/components/interactions/interaction-card.d.ts +0 -59
  236. package/dist/types/components/interactions/interaction-event-handler.d.ts +0 -11
  237. package/dist/types/components/interactions/interactions-list.d.ts +0 -50
  238. package/dist/types/components/interactions/panels/cross-filter-panel.d.ts +0 -24
  239. package/dist/types/components/interactions/panels/inline-drill-panel.d.ts +0 -24
  240. package/dist/types/components/interactions/selectors/action-selector.d.ts +0 -31
  241. package/dist/types/components/interactions/selectors/trigger-selector.d.ts +0 -38
  242. package/dist/types/components/surfboard/filter/click-filter-section.d.ts +0 -5
  243. package/dist/types/lib/interactions/build-interaction-event.d.ts +0 -25
  244. package/dist/types/lib/interactions/convert-click-filters-to-filter-group.d.ts +0 -10
  245. package/dist/types/lib/interactions/execute-interaction-event.d.ts +0 -80
  246. package/dist/types/lib/interactions/field-utils.d.ts +0 -11
  247. package/dist/types/lib/interactions/handle-chart-click.d.ts +0 -75
  248. package/dist/types/lib/interactions/linked-interaction-utils.d.ts +0 -14
  249. package/dist/types/lib/interactions/source-card-filter-utils.d.ts +0 -9
  250. package/dist/types/lib/matrix-table/matrix-clipboard.d.ts +0 -45
  251. package/dist/types/lib/matrix-table/matrix-selection.d.ts +0 -20
  252. package/dist/types/lib/stores/drill-actions.d.ts +0 -139
  253. package/dist/types/lib/stores/interaction-store.d.ts +0 -113
  254. package/dist/types/lib/stores/pointer-interaction-store.d.ts +0 -18
@@ -1,134 +1,135 @@
1
- import { D as E, a as _e } from "../chunks/matrix-control-sources-ClQzIk7E.js";
2
- import { j as Nt, k as Mt, l as Et, f as $t, h as Lt, i as Bt, C as Pt, c as Vt, e as qt, d as zt, n as jt, o as Ht, t as Gt, u as Ut, x as Wt, g as Kt, w as Qt, m as Xt, b as Yt, r as Jt, q as Zt, y as ea, s as ta, p as aa, v as ra } from "../chunks/matrix-control-sources-ClQzIk7E.js";
3
- import { A as ia, S as oa, f as sa, h as da, j as ca, k as la, l as ua, g as fa, a as pa, b as ha, i as ma, p as ga, d as ba, e as Ia, c as _a, r as ya, s as Ca, t as Da } from "../chunks/field-aggregations-BU_3gHKR.js";
4
- import { q as ye, a_ as G, a$ as Ce, ac as ie, ak as De, af as ve } from "../chunks/validators-BDYzZFgs.js";
5
- import "../chunks/matrix-operation-contract-Cqy4EW2H.js";
6
- import { m as B } from "../chunks/calculated-field-identity-BTpUqfEu.js";
7
- import { x as Sa, D as wa, p as xa, E as Aa, o as Ta, j as Fa, d as ka, k as Oa, t as Ra, e as Na, g as Ma, v as Ea, h as $a, l as La, q as Ba, n as Pa, w as Va, B as qa, r as za, i as ja, a as Ha, b as Ga, y as Ua, z as Wa, f as Ka, s as Qa, A as Xa, u as Ya, C as Ja } from "../chunks/calculated-field-identity-BTpUqfEu.js";
8
- import { n as Se } from "../chunks/operators-B3zZoskU.js";
9
- import { a as er, b as tr, r as ar } from "../chunks/canonical-result-keys-CEQefvdO.js";
10
- import { b as nr, c as ir, g as or, a as sr, m as dr, r as cr } from "../chunks/matrix-definition-RyU0cpLX.js";
11
- import { m as ur, a as fr, r as pr } from "../chunks/matrix-card-DACDwdTq.js";
1
+ import { D as L, a as Ce } from "../chunks/matrix-control-sources-CRRdP03Q.js";
2
+ import { k as Pt, l as Vt, n as zt, h as qt, i as jt, j as Gt, C as Ht, d as Ut, f as Wt, e as Kt, o as Qt, c as Jt, p as Xt, u as Yt, w as Zt, y as ea, g as ta, x as aa, m as ra, b as na, r as ia, s as oa, z as sa, t as da, q as ca, v as la } from "../chunks/matrix-control-sources-CRRdP03Q.js";
3
+ import { c as Se, r as ve } from "../chunks/field-aggregations-DUb0NU6c.js";
4
+ import { A as fa, S as pa, h as ha, j as ma, n as ga, k as ba, l as Ia, m as _a, v as ya, g as Ca, b as Sa, i as va, u as Ta, q as Da, p as ka, e as Fa, f as wa, d as xa, a as Aa, o as Oa, s as Ra, t as Na } from "../chunks/field-aggregations-DUb0NU6c.js";
5
+ import { q as Te, a_ as W, a$ as De, ac as se, ak as ke, af as Fe } from "../chunks/validators-BDYzZFgs.js";
6
+ import "../chunks/matrix-operation-contract-xL8IhFzp.js";
7
+ import { m as P, r as q } from "../chunks/calculated-field-identity-CJL54uFx.js";
8
+ import { E as Ma, D as La, o as $a, q as Ba, K as Pa, s as Va, l as za, i as qa, d as ja, j as Ga, A as Ha, g as Ua, v as Wa, B as Ka, h as Qa, k as Ja, w as Xa, n as Ya, u as Za, C as er, I as tr, y as ar, p as rr, f as nr, a as ir, b as or, F as sr, G as dr, e as cr, x as lr, H as ur, t as fr, z as pr, J as hr } from "../chunks/calculated-field-identity-CJL54uFx.js";
9
+ import { n as we } from "../chunks/operators-B3zZoskU.js";
10
+ import { a as gr, b as br, r as Ir } from "../chunks/canonical-result-keys-CEQefvdO.js";
11
+ import { b as yr, c as Cr, g as Sr, a as vr, m as Tr, r as Dr } from "../chunks/matrix-definition-RyU0cpLX.js";
12
+ import { m as Fr, a as wr, r as xr } from "../chunks/matrix-card-CnKQpnsj.js";
12
13
  function y(e) {
13
14
  return e && typeof e == "object" ? e : null;
14
15
  }
15
- function S(e) {
16
+ function T(e) {
16
17
  return typeof e == "string" ? e : null;
17
18
  }
18
- function we(e) {
19
+ function xe(e) {
19
20
  var t, a, r;
20
21
  return !!(e && typeof e == "object") && (((t = y(e)) == null ? void 0 : t.kind) === "semantic" || ((a = y(e)) == null ? void 0 : a.kind) === "physical" || ((r = y(e)) == null ? void 0 : r.kind) === "sql");
21
22
  }
22
- function k(e) {
23
- return we(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
23
+ function A(e) {
24
+ return xe(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
24
25
  }
25
- function St(e) {
26
- return ye(e);
26
+ function At(e) {
27
+ return Te(e);
27
28
  }
28
- function oe(e, t) {
29
- return G(e, t);
29
+ function de(e, t) {
30
+ return W(e, t);
30
31
  }
31
- function xe(e, t) {
32
- return Ce(e, t);
32
+ function Ae(e, t) {
33
+ return De(e, t);
33
34
  }
34
35
  function $(e) {
35
36
  const t = [];
36
37
  for (const a of e) {
37
38
  const r = t.findIndex(
38
- (o) => oe(o, a)
39
+ (o) => de(o, a)
39
40
  );
40
- r === -1 ? t.push(a) : t[r] = xe(
41
+ r === -1 ? t.push(a) : t[r] = Ae(
41
42
  t[r],
42
43
  a
43
44
  );
44
45
  }
45
46
  return t;
46
47
  }
47
- function wt(e) {
48
+ function Ot(e) {
48
49
  return $(e)[0];
49
50
  }
50
- function z(e, t) {
51
- return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !G(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
51
+ function j(e, t) {
52
+ return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !W(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
52
53
  }
53
- function j(e) {
54
- return k(e) ? e : void 0;
54
+ function G(e) {
55
+ return A(e) ? e : void 0;
55
56
  }
56
- function re(e, t) {
57
+ function ie(e, t) {
57
58
  if (!(e.kind !== "semantic" || e.connectionId))
58
59
  return t.find(
59
- (a) => (a == null ? void 0 : a.kind) === "semantic" && G(e, a) && !!a.connectionId
60
+ (a) => (a == null ? void 0 : a.kind) === "semantic" && W(e, a) && !!a.connectionId
60
61
  );
61
62
  }
62
63
  function v(e, t) {
63
- const a = j(e == null ? void 0 : e.source);
64
- return a ? z(a, t) : void 0;
64
+ const a = G(e == null ? void 0 : e.source);
65
+ return a ? j(a, t) : void 0;
65
66
  }
66
- function Ae({
67
+ function Oe({
67
68
  explicitSource: e,
68
69
  field: t,
69
70
  defaultSource: a,
70
71
  fallbackSources: r
71
72
  }) {
72
- const o = [a, ...r || []], i = j(e), n = i ? z(
73
- i,
74
- re(i, o)
73
+ const o = [a, ...r || []], n = G(e), i = n ? j(
74
+ n,
75
+ ie(n, o)
75
76
  ) : void 0;
76
- if (n)
77
- return n;
77
+ if (i)
78
+ return i;
78
79
  if (e !== void 0)
79
80
  return;
80
- const d = v(t, a), s = d ? z(
81
- d,
82
- re(d, o)
81
+ const s = v(t, a), u = s ? j(
82
+ s,
83
+ ie(s, o)
83
84
  ) : void 0;
84
- if (s)
85
- return s;
85
+ if (u)
86
+ return u;
86
87
  if ((t == null ? void 0 : t.source) === void 0)
87
- return j(a);
88
+ return G(a);
88
89
  }
89
- function xt(e, t) {
90
+ function Rt(e, t) {
90
91
  if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
91
92
  return !1;
92
93
  const a = v(e), r = v(t);
93
- return !a || !r ? !0 : oe(a, r);
94
+ return !a || !r ? !0 : de(a, r);
94
95
  }
95
- function x(e) {
96
+ function F(e) {
96
97
  var t;
97
- return S((t = y(e)) == null ? void 0 : t.kind);
98
+ return T((t = y(e)) == null ? void 0 : t.kind);
98
99
  }
99
- function se(e) {
100
+ function ce(e) {
100
101
  var t, a;
101
- return x(e) !== "semantic" ? null : ((a = S((t = y(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
102
+ return F(e) !== "semantic" ? null : ((a = T((t = y(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
102
103
  }
103
- function Te(e) {
104
+ function Re(e) {
104
105
  var t;
105
- return x(e) !== "semantic" ? null : S((t = y(e)) == null ? void 0 : t.datasetName);
106
+ return F(e) !== "semantic" ? null : T((t = y(e)) == null ? void 0 : t.datasetName);
106
107
  }
107
- function Fe(e) {
108
+ function Ne(e) {
108
109
  var t;
109
- return x(e) !== "semantic" ? null : S((t = y(e)) == null ? void 0 : t.datasetId);
110
+ return F(e) !== "semantic" ? null : T((t = y(e)) == null ? void 0 : t.datasetId);
110
111
  }
111
- function ke(e) {
112
+ function Ee(e) {
112
113
  var t;
113
- return x(e) !== "physical" ? null : S((t = y(e)) == null ? void 0 : t.connectionId);
114
+ return F(e) !== "physical" ? null : T((t = y(e)) == null ? void 0 : t.connectionId);
114
115
  }
115
- function Oe(e) {
116
+ function Me(e) {
116
117
  var t;
117
- return x(e) !== "physical" ? null : S((t = y(e)) == null ? void 0 : t.tableName);
118
+ return F(e) !== "physical" ? null : T((t = y(e)) == null ? void 0 : t.tableName);
118
119
  }
119
- function Re(e) {
120
+ function Le(e) {
120
121
  var t;
121
- return x(e) !== "physical" ? "" : S((t = y(e)) == null ? void 0 : t.databaseName) || "";
122
+ return F(e) !== "physical" ? "" : T((t = y(e)) == null ? void 0 : t.databaseName) || "";
122
123
  }
123
- function Ne(e) {
124
+ function $e(e) {
124
125
  var t;
125
- return x(e) !== "physical" ? "" : S((t = y(e)) == null ? void 0 : t.schemaName) || "";
126
+ return F(e) !== "physical" ? "" : T((t = y(e)) == null ? void 0 : t.schemaName) || "";
126
127
  }
127
- function Me(e) {
128
+ function Be(e) {
128
129
  if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
129
130
  return e.analyticsIntent.source;
130
131
  }
131
- function Ee({
132
+ function Pe({
132
133
  datasets: e,
133
134
  requireAtLeastOne: t
134
135
  }) {
@@ -136,24 +137,24 @@ function Ee({
136
137
  return { ok: !1, issue: "invalid_dataset_count" };
137
138
  if (e.length <= 1)
138
139
  return { ok: !0 };
139
- const a = e.map(se), r = new Set(a.filter(Boolean));
140
+ const a = e.map(ce), r = new Set(a.filter(Boolean));
140
141
  return a.some((o) => !o) || r.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
141
142
  }
142
- function U(e, t) {
143
+ function K(e, t) {
143
144
  if (!t)
144
145
  return !1;
145
146
  if (t.kind === "semantic") {
146
- const a = Fe(e);
147
- return se(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : Te(e) === t.datasetName : !1;
147
+ const a = Ne(e);
148
+ return ce(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : Re(e) === t.datasetName : !1;
148
149
  }
149
- return t.kind === "physical" ? ke(e) === t.connectionId && Oe(e) === t.tableName && Re(e) === (t.databaseName || "") && Ne(e) === (t.schemaName || "") : !1;
150
+ return t.kind === "physical" ? Ee(e) === t.connectionId && Me(e) === t.tableName && Le(e) === (t.databaseName || "") && $e(e) === (t.schemaName || "") : !1;
150
151
  }
151
- function At(e, t) {
152
+ function Nt(e, t) {
152
153
  return e.find(
153
- (a) => U(a, t)
154
+ (a) => K(a, t)
154
155
  );
155
156
  }
156
- function p(e, t, a) {
157
+ function f(e, t, a) {
157
158
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
158
159
  }
159
160
  function N(e) {
@@ -165,19 +166,19 @@ function N(e) {
165
166
  }
166
167
  return null;
167
168
  }
168
- function de({
169
+ function le({
169
170
  card: e,
170
171
  datasets: t,
171
172
  errors: a
172
173
  }) {
173
174
  if (e.type === "text")
174
175
  return;
175
- const r = Me(e);
176
+ const r = Be(e);
176
177
  if (!r) {
177
178
  if (t.length <= 1)
178
179
  return;
179
180
  a.push(
180
- p(
181
+ f(
181
182
  "missing_card_analytics_source",
182
183
  "Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",
183
184
  e.id
@@ -185,68 +186,68 @@ function de({
185
186
  );
186
187
  return;
187
188
  }
188
- t.some((o) => U(o, r)) || a.push(
189
- p(
189
+ t.some((o) => K(o, r)) || a.push(
190
+ f(
190
191
  "invalid_card_analytics_source",
191
192
  "Dashboard cards with an explicit analytics source must use one of the selected datasets.",
192
193
  e.id
193
194
  )
194
195
  );
195
196
  }
196
- function M(e) {
197
+ function E(e) {
197
198
  return e.map((t) => t == null ? void 0 : t.source).filter((t) => !!t);
198
199
  }
199
- function P(e) {
200
+ function V(e) {
200
201
  return Array.isArray(e) ? e.filter(
201
202
  (t) => !!(t && typeof t == "object")
202
203
  ) : [];
203
204
  }
204
- function ne(e) {
205
+ function oe(e) {
205
206
  return Array.isArray(e) ? e.filter(
206
207
  (t) => !!(t && typeof t == "object")
207
208
  ) : [];
208
209
  }
209
- function $e(e) {
210
+ function Ve(e) {
210
211
  var a, r;
211
212
  if (!e)
212
213
  return [];
213
214
  const t = [e.source];
214
215
  return e.kind === "metric" ? t.push(
215
- ...M([
216
- ...P(e.measures),
216
+ ...E([
217
+ ...V(e.measures),
217
218
  e.primaryMeasure,
218
219
  e.dateField,
219
- ...P(e.dimensions),
220
- ...ne(e.filters).map((o) => o.field)
220
+ ...V(e.dimensions),
221
+ ...oe(e.filters).map((o) => o.field)
221
222
  ])
222
223
  ) : e.kind === "records" ? t.push(
223
- ...M([
224
- ...P(e.fields),
224
+ ...E([
225
+ ...V(e.fields),
225
226
  e.dateField,
226
227
  (a = e.orderBy) == null ? void 0 : a.field,
227
- ...ne(e.filters).map((o) => o.field)
228
+ ...oe(e.filters).map((o) => o.field)
228
229
  ])
229
230
  ) : e.kind === "inputOptions" ? (((r = e.population) == null ? void 0 : r.kind) === "related_population" && t.push(e.population.baseSource), t.push(
230
- ...M([
231
+ ...E([
231
232
  e.labelField,
232
233
  e.valueField,
233
234
  e.searchField,
234
235
  ...e.disambiguationFields || []
235
236
  ])
236
- )) : e.kind === "sql" && t.push(...M(e.fields || [])), t;
237
+ )) : e.kind === "sql" && t.push(...E(e.fields || [])), t;
237
238
  }
238
- function ce({
239
+ function ue({
239
240
  card: e,
240
241
  datasets: t,
241
242
  errors: a
242
243
  }) {
243
244
  if (e.type !== "text") {
244
- for (const r of $e(e.analyticsIntent))
245
+ for (const r of Ve(e.analyticsIntent))
245
246
  if (r && !t.some(
246
- (o) => U(o, r)
247
+ (o) => K(o, r)
247
248
  )) {
248
249
  a.push(
249
- p(
250
+ f(
250
251
  "invalid_card_query_source",
251
252
  "Dashboard card query field references must use one of the selected datasets.",
252
253
  e.id
@@ -256,36 +257,36 @@ function ce({
256
257
  }
257
258
  }
258
259
  }
259
- function le({
260
+ function fe({
260
261
  card: e,
261
262
  errors: t
262
263
  }) {
263
264
  if (e.type === "text" || !e.analyticsIntent)
264
265
  return;
265
- const a = ie(e.analyticsIntent);
266
+ const a = se(e.analyticsIntent);
266
267
  if (!a.ok)
267
268
  for (const r of a.errors)
268
269
  t.push(
269
- p(
270
+ f(
270
271
  r.code,
271
272
  r.path ? `${r.path}: ${r.message}` : r.message,
272
273
  e.id
273
274
  )
274
275
  );
275
276
  }
276
- function ue({
277
+ function pe({
277
278
  datasets: e,
278
279
  errors: t,
279
280
  requireAtLeastOne: a
280
281
  }) {
281
- const r = Ee({
282
+ const r = Pe({
282
283
  datasets: e,
283
284
  requireAtLeastOne: a
284
285
  });
285
286
  if (!r.ok) {
286
287
  if (r.issue === "invalid_dataset_count") {
287
288
  t.push(
288
- p(
289
+ f(
289
290
  "invalid_dataset_count",
290
291
  "Dashboard authoring requires at least one selected dataset."
291
292
  )
@@ -293,33 +294,57 @@ function ue({
293
294
  return;
294
295
  }
295
296
  t.push(
296
- p(
297
+ f(
297
298
  "invalid_multi_dataset_scope",
298
299
  "Multi-dataset dashboard authoring is limited to semantic datasets from one domain."
299
300
  )
300
301
  );
301
302
  }
302
303
  }
303
- function fe({
304
+ function he({
304
305
  input: e,
305
306
  errors: t
306
307
  }) {
307
308
  var a;
308
309
  (a = e.filter.sql) != null && a.trim() && t.push(
309
- p(
310
+ f(
310
311
  "generated_filter_sql_out_of_scope",
311
312
  `Generated dashboard filter "${e.label}" must use grounded filter configuration; custom SQL is outside the dashboard-authoring contract.`
312
313
  )
313
314
  );
314
315
  }
315
- function Le(e) {
316
- var f, g;
316
+ function H({
317
+ card: e,
318
+ errors: t
319
+ }) {
320
+ "interactionConfig" in e && t.push(
321
+ f(
322
+ "legacy_card_interactions_unsupported",
323
+ "Dashboard authoring accepts click-to-filter settings only through card.clickToFilter.",
324
+ e.id
325
+ )
326
+ ), e.clickToFilter !== void 0 && !Se.safeParse(e.clickToFilter).success && t.push(
327
+ f(
328
+ "invalid_click_to_filter",
329
+ "Dashboard card clickToFilter settings do not match the canonical schema.",
330
+ e.id
331
+ )
332
+ ), e.respondsToSelections !== void 0 && !ve.safeParse(e.respondsToSelections).success && t.push(
333
+ f(
334
+ "invalid_responds_to_selections",
335
+ "Dashboard card respondsToSelections must be a boolean.",
336
+ e.id
337
+ )
338
+ );
339
+ }
340
+ function ze(e) {
341
+ var p, I;
317
342
  const t = [];
318
343
  if (!e || typeof e != "object")
319
344
  return {
320
345
  ok: !1,
321
346
  errors: [
322
- p(
347
+ f(
323
348
  "invalid_plan",
324
349
  "Dashboard plan must be a structured object."
325
350
  )
@@ -327,84 +352,84 @@ function Le(e) {
327
352
  warnings: []
328
353
  };
329
354
  const a = e, r = [...a.warnings || []];
330
- a.version !== 1 && t.push(p("invalid_version", "Dashboard plan version must be 1.")), (f = a.title) != null && f.trim() || t.push(p("missing_title", "Dashboard plan needs a title."));
331
- const o = Array.isArray(a.datasets) ? a.datasets : [], i = Array.isArray(a.sheets) ? a.sheets : [];
332
- ue({ datasets: o, errors: t, requireAtLeastOne: !0 }), i.length !== 1 && t.push(
333
- p(
355
+ a.version !== 1 && t.push(f("invalid_version", "Dashboard plan version must be 1.")), (p = a.title) != null && p.trim() || t.push(f("missing_title", "Dashboard plan needs a title."));
356
+ const o = Array.isArray(a.datasets) ? a.datasets : [], n = Array.isArray(a.sheets) ? a.sheets : [];
357
+ pe({ datasets: o, errors: t, requireAtLeastOne: !0 }), n.length !== 1 && t.push(
358
+ f(
334
359
  "invalid_sheet_count",
335
360
  "MVP dashboard authoring creates exactly one dashboard sheet."
336
361
  )
337
362
  );
338
- const n = i[0];
339
- n && n.kind !== "dashboard" && t.push(
340
- p("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
363
+ const i = n[0];
364
+ i && i.kind !== "dashboard" && t.push(
365
+ f("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
341
366
  );
342
- const d = (n == null ? void 0 : n.cards) || [];
343
- d.length > E && t.push(
344
- p(
367
+ const s = (i == null ? void 0 : i.cards) || [];
368
+ s.length > L && t.push(
369
+ f(
345
370
  "too_many_cards",
346
- `Generated dashboards can contain at most ${E} cards.`
371
+ `Generated dashboards can contain at most ${L} cards.`
347
372
  )
348
373
  );
349
- const s = N(d.map((l) => l.id));
350
- s && t.push(
351
- p("duplicate_card_id", `Duplicate generated card id: ${s}.`)
352
- );
353
- const u = N(d.map((l) => l.frameId));
374
+ const u = N(s.map((l) => l.id));
354
375
  u && t.push(
355
- p(
376
+ f("duplicate_card_id", `Duplicate generated card id: ${u}.`)
377
+ );
378
+ const d = N(s.map((l) => l.frameId));
379
+ d && t.push(
380
+ f(
356
381
  "duplicate_frame_id",
357
- `Duplicate generated frame id: ${u}.`
382
+ `Duplicate generated frame id: ${d}.`
358
383
  )
359
384
  );
360
- for (const l of d)
361
- (g = l.title) != null && g.trim() || t.push(p("missing_card_title", "Card title is required.", l.id)), l.type === "custom" && t.push(
362
- p(
385
+ for (const l of s)
386
+ (I = l.title) != null && I.trim() || t.push(f("missing_card_title", "Card title is required.", l.id)), l.type === "custom" && t.push(
387
+ f(
363
388
  "custom_visual_out_of_scope",
364
389
  "Whole-dashboard authoring supports built-in visual types only.",
365
390
  l.id
366
391
  )
367
392
  ), l.type !== "text" && !l.analyticsIntent && r.push(
368
- p(
393
+ f(
369
394
  "missing_analytics_intent",
370
395
  "Non-text card has no analytics intent and may be skipped by the app layer.",
371
396
  l.id
372
397
  )
373
- ), de({ card: l, datasets: o, errors: t }), le({ card: l, errors: t }), ce({ card: l, datasets: o, errors: t });
374
- const h = Array.isArray(a.filterInputs) ? a.filterInputs : [], I = h.map((l) => l.id), C = N(I);
375
- C && t.push(
376
- p(
398
+ ), le({ card: l, datasets: o, errors: t }), fe({ card: l, errors: t }), ue({ card: l, datasets: o, errors: t }), H({ card: l, errors: t });
399
+ const h = Array.isArray(a.filterInputs) ? a.filterInputs : [], m = h.map((l) => l.id), S = N(m);
400
+ S && t.push(
401
+ f(
377
402
  "duplicate_input_id",
378
- `Duplicate dashboard input id: ${C}.`
403
+ `Duplicate dashboard input id: ${S}.`
379
404
  )
380
405
  );
381
- const D = h.map((l) => l.variableName).filter(Boolean) || [], _ = N(D);
382
- _ && t.push(
383
- p(
406
+ const b = h.map((l) => l.variableName).filter(Boolean) || [], C = N(b);
407
+ C && t.push(
408
+ f(
384
409
  "duplicate_input_variable",
385
- `Duplicate dashboard input variable name: ${_}.`
410
+ `Duplicate dashboard input variable name: ${C}.`
386
411
  )
387
412
  );
388
413
  for (const l of h)
389
- fe({ input: l, errors: t });
414
+ he({ input: l, errors: t });
390
415
  const c = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
391
416
  for (const l of c)
392
417
  l.scope === "domain" && l.reuseOnly !== !0 && t.push(
393
- p(
418
+ f(
394
419
  "domain_calculated_field_create_out_of_scope",
395
420
  `Creating domain calculated field "${l.name}" is outside MVP.`
396
421
  )
397
422
  );
398
423
  return { ok: t.length === 0, errors: t, warnings: r };
399
424
  }
400
- function Be(e) {
401
- var n;
425
+ function qe(e) {
426
+ var i;
402
427
  const t = [];
403
428
  if (!e || typeof e != "object")
404
429
  return {
405
430
  ok: !1,
406
431
  errors: [
407
- p(
432
+ f(
408
433
  "invalid_change_plan",
409
434
  "Dashboard change plan must be a structured object."
410
435
  )
@@ -413,172 +438,193 @@ function Be(e) {
413
438
  };
414
439
  const a = e, r = [...a.warnings || []];
415
440
  a.version !== 1 && t.push(
416
- p("invalid_version", "Dashboard change plan version must be 1.")
417
- ), (n = a.dashboardId) != null && n.trim() || t.push(
418
- p("missing_dashboard_id", "Dashboard change plan needs a dashboard id.")
441
+ f("invalid_version", "Dashboard change plan version must be 1.")
442
+ ), (i = a.dashboardId) != null && i.trim() || t.push(
443
+ f("missing_dashboard_id", "Dashboard change plan needs a dashboard id.")
419
444
  );
420
- const o = Array.isArray(a.datasets) ? a.datasets : [], i = Array.isArray(a.operations) ? a.operations : [];
421
- ue({ datasets: o, errors: t, requireAtLeastOne: !1 });
422
- for (const d of i) {
423
- if (d.kind === "unsupported") {
445
+ const o = Array.isArray(a.datasets) ? a.datasets : [], n = Array.isArray(a.operations) ? a.operations : [];
446
+ pe({ datasets: o, errors: t, requireAtLeastOne: !1 });
447
+ for (const s of n) {
448
+ if (s.kind === "unsupported") {
424
449
  r.push(
425
- p("unsupported_operation", d.reason || d.requestedAction)
450
+ f("unsupported_operation", s.reason || s.requestedAction)
426
451
  );
427
452
  continue;
428
453
  }
429
- d.kind === "addCard" && d.card.type === "custom" && t.push(
430
- p(
454
+ if (s.kind === "addCard" && s.card.type === "custom" && t.push(
455
+ f(
431
456
  "custom_visual_out_of_scope",
432
457
  "Whole-dashboard authoring supports built-in visual types only.",
433
- d.card.id
458
+ s.card.id
434
459
  )
435
- ), d.kind === "addCard" && (de({
436
- card: d.card,
460
+ ), s.kind === "addCard" && (le({
461
+ card: s.card,
437
462
  datasets: o,
438
463
  errors: t
439
- }), le({
440
- card: d.card,
464
+ }), fe({
465
+ card: s.card,
441
466
  errors: t
442
- }), ce({
443
- card: d.card,
467
+ }), ue({
468
+ card: s.card,
444
469
  datasets: o,
445
470
  errors: t
446
- })), d.kind === "addFilterInput" && fe({ input: d.input, errors: t }), d.kind === "addCalculatedField" && d.field.scope === "domain" && d.field.reuseOnly !== !0 && t.push(
447
- p(
471
+ }), H({ card: s.card, errors: t })), s.kind === "updateCardSelectionSettings") {
472
+ const u = s.card;
473
+ s.card.clickToFilter === void 0 && s.card.respondsToSelections === void 0 && t.push(
474
+ f(
475
+ "empty_card_selection_settings_update",
476
+ "A card selection-settings update must provide clickToFilter or respondsToSelections.",
477
+ s.cardId
478
+ )
479
+ ), H({
480
+ card: {
481
+ id: s.cardId,
482
+ frameId: "",
483
+ title: "",
484
+ type: "table",
485
+ role: "table",
486
+ priority: 0,
487
+ ...u
488
+ },
489
+ errors: t
490
+ });
491
+ }
492
+ s.kind === "addFilterInput" && he({ input: s.input, errors: t }), s.kind === "addCalculatedField" && s.field.scope === "domain" && s.field.reuseOnly !== !0 && t.push(
493
+ f(
448
494
  "domain_calculated_field_create_out_of_scope",
449
- `Creating domain calculated field "${d.field.name}" is outside MVP.`
495
+ `Creating domain calculated field "${s.field.name}" is outside MVP.`
450
496
  )
451
497
  );
452
498
  }
453
499
  return { ok: t.length === 0, errors: t, warnings: r };
454
500
  }
455
- const Pe = {
501
+ const je = {
456
502
  lg: 48,
457
503
  md: 36,
458
504
  sm: 24,
459
505
  xs: 12,
460
506
  xxs: 6
461
507
  };
462
- function Ve(e, t) {
508
+ function Ge(e, t) {
463
509
  let a = 0, r = 0, o = 0;
464
- return e.map((i) => {
465
- const n = Math.min(i.w, t);
466
- a > 0 && a + n > t && (a = 0, r += o, o = 0);
467
- const d = {
468
- i: i.frameId,
510
+ return e.map((n) => {
511
+ const i = Math.min(n.w, t);
512
+ a > 0 && a + i > t && (a = 0, r += o, o = 0);
513
+ const s = {
514
+ i: n.frameId,
469
515
  x: a,
470
516
  y: r,
471
- w: n,
472
- h: i.h,
473
- minW: Math.min(i.minW, t),
474
- minH: i.minH,
517
+ w: i,
518
+ h: n.h,
519
+ minW: Math.min(n.minW, t),
520
+ minH: n.minH,
475
521
  static: !1
476
522
  };
477
- return a += n, o = Math.max(o, i.h), d;
523
+ return a += i, o = Math.max(o, n.h), s;
478
524
  });
479
525
  }
480
- function qe(e) {
481
- const t = [...e].sort((s, u) => s.priority - u.priority), a = t.filter((s) => s.role === "kpi"), r = t.filter((s) => s.role === "chart"), o = t.filter((s) => s.role === "table"), i = t.filter((s) => s.role === "text"), n = i.slice(0, 1), d = i.slice(n.length);
482
- return { kpis: a, introText: n, charts: r, tables: o, supportingText: d };
526
+ function He(e) {
527
+ const t = [...e].sort((u, d) => u.priority - d.priority), a = t.filter((u) => u.role === "kpi"), r = t.filter((u) => u.role === "chart"), o = t.filter((u) => u.role === "table"), n = t.filter((u) => u.role === "text"), i = n.slice(0, 1), s = n.slice(i.length);
528
+ return { kpis: a, introText: i, charts: r, tables: o, supportingText: s };
483
529
  }
484
- function ze(e, t, a) {
530
+ function Ue(e, t, a) {
485
531
  return t === "xxs" || t === "xs" ? a : t === "sm" ? Math.min(12, a) : t === "md" ? e <= 1 || e === 2 ? 18 : 12 : e <= 1 || e === 2 ? 24 : e === 3 ? 16 : 12;
486
532
  }
487
- function je(e, t, a, r) {
533
+ function We(e, t, a, r) {
488
534
  return a === "xxs" || a === "xs" || a === "sm" || a === "md" || t === 1 || t % 2 === 1 && e === 0 ? r : r / 2;
489
535
  }
490
- function He(e) {
491
- const { item: t, band: a, index: r, bandCount: o, breakpoint: i, columns: n } = e;
536
+ function Ke(e) {
537
+ const { item: t, band: a, index: r, bandCount: o, breakpoint: n, columns: i } = e;
492
538
  return a === "kpi" ? {
493
539
  ...t,
494
540
  band: a,
495
- w: ze(o, i, n),
541
+ w: Ue(o, n, i),
496
542
  h: 15,
497
- minW: Math.min(6, n),
543
+ minW: Math.min(6, i),
498
544
  minH: 12
499
545
  } : a === "table" ? {
500
546
  ...t,
501
547
  band: a,
502
- w: n,
503
- h: i === "xxs" || i === "xs" ? 34 : 38,
504
- minW: Math.min(12, n),
548
+ w: i,
549
+ h: n === "xxs" || n === "xs" ? 34 : 38,
550
+ minW: Math.min(12, i),
505
551
  minH: 18
506
552
  } : a === "introText" ? {
507
553
  ...t,
508
554
  band: a,
509
- w: n,
510
- h: i === "xxs" || i === "xs" ? 12 : 10,
511
- minW: Math.min(12, n),
555
+ w: i,
556
+ h: n === "xxs" || n === "xs" ? 12 : 10,
557
+ minW: Math.min(12, i),
512
558
  minH: 8
513
559
  } : a === "supportingText" ? {
514
560
  ...t,
515
561
  band: a,
516
- w: i === "lg" ? n / 2 : n,
517
- h: i === "xxs" || i === "xs" ? 12 : 10,
518
- minW: Math.min(12, n),
562
+ w: n === "lg" ? i / 2 : i,
563
+ h: n === "xxs" || n === "xs" ? 12 : 10,
564
+ minW: Math.min(12, i),
519
565
  minH: 8
520
566
  } : {
521
567
  ...t,
522
568
  band: a,
523
- w: je(r, o, i, n),
524
- h: i === "xxs" || i === "xs" ? 28 : 30,
525
- minW: Math.min(12, n),
569
+ w: We(r, o, n, i),
570
+ h: n === "xxs" || n === "xs" ? 28 : 30,
571
+ minW: Math.min(12, i),
526
572
  minH: 16
527
573
  };
528
574
  }
529
- function T(e, t, a, r) {
575
+ function w(e, t, a, r) {
530
576
  return e.map(
531
- (o, i) => He({
577
+ (o, n) => Ke({
532
578
  item: o,
533
579
  band: t,
534
- index: i,
580
+ index: n,
535
581
  bandCount: e.length,
536
582
  breakpoint: a,
537
583
  columns: r
538
584
  })
539
585
  );
540
586
  }
541
- function W(e) {
542
- const t = qe(e);
587
+ function Q(e) {
588
+ const t = He(e);
543
589
  return Object.fromEntries(
544
- _e.map((a) => {
545
- const r = Pe[a], o = [
546
- ...T(t.introText, "introText", a, r),
547
- ...T(t.kpis, "kpi", a, r),
548
- ...T(t.charts, "chart", a, r),
549
- ...T(t.tables, "table", a, r),
550
- ...T(t.supportingText, "supportingText", a, r)
590
+ Ce.map((a) => {
591
+ const r = je[a], o = [
592
+ ...w(t.introText, "introText", a, r),
593
+ ...w(t.kpis, "kpi", a, r),
594
+ ...w(t.charts, "chart", a, r),
595
+ ...w(t.tables, "table", a, r),
596
+ ...w(t.supportingText, "supportingText", a, r)
551
597
  ];
552
- return [a, Ve(o, r)];
598
+ return [a, Ge(o, r)];
553
599
  })
554
600
  );
555
601
  }
556
- function Ge(e) {
557
- const t = De(e);
602
+ function Qe(e) {
603
+ const t = ke(e);
558
604
  return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
559
605
  }
560
- function Ue(e) {
606
+ function Je(e) {
561
607
  return !!(e && typeof e == "object" && !Array.isArray(e));
562
608
  }
563
- function We(e) {
564
- return Ue(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
609
+ function Xe(e) {
610
+ return Je(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
565
611
  }
566
- function Ke(e) {
612
+ function Ye(e) {
567
613
  return e.filter(
568
614
  (t) => typeof t == "string" || typeof t == "number"
569
615
  );
570
616
  }
571
- function Qe(e) {
617
+ function Ze(e) {
572
618
  return e.filter(
573
619
  (t) => t instanceof Date || typeof t == "string"
574
620
  );
575
621
  }
576
- function K(e, t) {
622
+ function J(e, t) {
577
623
  if (t === void 0)
578
624
  return;
579
- const a = Ge(e.dataType), r = e.operation || "in";
580
- if (We(t))
581
- return B({
625
+ const a = Qe(e.dataType), r = e.operation || "in";
626
+ if (Xe(t))
627
+ return P({
582
628
  definition: e,
583
629
  sourceValue: t,
584
630
  value: {
@@ -592,7 +638,7 @@ function K(e, t) {
592
638
  }
593
639
  });
594
640
  if (r === "is null" || r === "is not null")
595
- return B({
641
+ return P({
596
642
  definition: e,
597
643
  value: {
598
644
  filterId: e.id,
@@ -605,26 +651,26 @@ function K(e, t) {
605
651
  semanticContext: e.semanticContext
606
652
  }
607
653
  });
608
- const o = Array.isArray(t) ? t : [t], i = a === "date" ? Qe(o) : Ke(o);
609
- if (i.length !== 0 && !((r === "between" || r === "not between") && i.length < 2))
610
- return B({
654
+ const o = Array.isArray(t) ? t : [t], n = a === "date" ? Ze(o) : Ye(o);
655
+ if (n.length !== 0 && !((r === "between" || r === "not between") && n.length < 2))
656
+ return P({
611
657
  definition: e,
612
658
  value: {
613
659
  filterId: e.id,
614
660
  name: e.column,
615
661
  operation: r,
616
662
  valueType: a,
617
- values: i,
663
+ values: n,
618
664
  dataType: e.dataType,
619
665
  fieldMeta: e.fieldMeta,
620
666
  semanticContext: e.semanticContext
621
667
  }
622
668
  });
623
669
  }
624
- function pe(e, t, a) {
670
+ function me(e, t, a) {
625
671
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
626
672
  }
627
- function Xe(e, t, a) {
673
+ function et(e, t, a) {
628
674
  const r = (t || []).filter(
629
675
  (o) => o.scope === "card" && o.targetCardId === a
630
676
  ).map((o) => o.field).filter(Boolean);
@@ -636,73 +682,85 @@ function Xe(e, t, a) {
636
682
  ]
637
683
  };
638
684
  }
639
- function H(e, t) {
685
+ function tt(e, t, a) {
686
+ return t.clickToFilter === void 0 && t.respondsToSelections === void 0 ? e : {
687
+ ...e,
688
+ ...t.clickToFilter ? {
689
+ clickToFilter: q(
690
+ t.clickToFilter,
691
+ { cardIds: Object.fromEntries(a) }
692
+ )
693
+ } : {},
694
+ ...t.respondsToSelections !== void 0 ? { respondsToSelections: t.respondsToSelections } : {}
695
+ };
696
+ }
697
+ function U(e, t) {
640
698
  return Array.from(
641
699
  new Set(
642
700
  (e || []).map((a) => t.get(a)).filter((a) => !!a)
643
701
  )
644
702
  );
645
703
  }
646
- function Ye(e, t) {
704
+ function at(e, t) {
647
705
  if ((e == null ? void 0 : e.kind) !== "cards")
648
706
  return e;
649
- const a = H(e.cardIds, t);
707
+ const a = U(e.cardIds, t);
650
708
  return a.length > 0 ? { ...e, cardIds: a } : null;
651
709
  }
652
- function Je(e, t) {
710
+ function rt(e, t) {
653
711
  return !e.applyToCardIds && !e.excludeCardIds ? e : {
654
712
  ...e,
655
713
  ...e.applyToCardIds ? {
656
- applyToCardIds: H(
714
+ applyToCardIds: U(
657
715
  e.applyToCardIds,
658
716
  t
659
717
  )
660
718
  } : {},
661
719
  ...e.excludeCardIds ? {
662
- excludeCardIds: H(
720
+ excludeCardIds: U(
663
721
  e.excludeCardIds,
664
722
  t
665
723
  )
666
724
  } : {}
667
725
  };
668
726
  }
669
- function Ze(e, t) {
727
+ function nt(e, t) {
670
728
  const a = {}, r = [];
671
729
  return {
672
730
  inputs: (e.filterInputs || []).flatMap(
673
- (i, n) => {
674
- const d = Ye(i.scope, t);
675
- if (d === null)
731
+ (n, i) => {
732
+ const s = at(n.scope, t);
733
+ if (s === null)
676
734
  return r.push(
677
- pe(
735
+ me(
678
736
  "filter_input_scope_empty",
679
- `Filter input "${i.label}" was skipped because all scoped cards were skipped during query validation.`
737
+ `Filter input "${n.label}" was skipped because all scoped cards were skipped during query validation.`
680
738
  )
681
739
  ), [];
682
- const s = K(
683
- i.filter,
684
- i.defaultValue
740
+ const u = J(
741
+ n.filter,
742
+ n.defaultValue
685
743
  );
686
- return s && (a.shared ?? (a.shared = {}), a.shared[i.id] = {
744
+ return u && (a.shared ?? (a.shared = {}), a.shared[n.id] = {
687
745
  status: "set",
688
746
  value: {
689
747
  kind: "filter",
690
- filterValue: s
748
+ filterValue: u
691
749
  }
692
750
  }), [
693
751
  {
694
- id: i.id,
752
+ id: n.id,
695
753
  kind: "filter",
696
- label: i.label,
697
- variableName: i.variableName,
698
- scope: d || { kind: "allSheets", sheetKinds: ["dashboard"] },
754
+ label: n.label,
755
+ variableName: n.variableName,
756
+ scope: s || { kind: "allSheets", sheetKinds: ["dashboard"] },
699
757
  runtimeScope: "shared",
700
758
  presentation: {
701
759
  placement: "toolbar",
702
- order: n
760
+ order: i
703
761
  },
704
762
  exports: ["label", "value", "start", "end", "range"],
705
- filter: Je(i.filter, t)
763
+ filter: rt(n.filter, t)
706
764
  }
707
765
  ];
708
766
  }
@@ -711,26 +769,26 @@ function Ze(e, t) {
711
769
  defaultInputValues: a.shared && Object.keys(a.shared).length > 0 ? a : void 0
712
770
  };
713
771
  }
714
- function Tt(e) {
715
- var D, _;
716
- const t = Le(e.plan);
772
+ function Et(e) {
773
+ var b, C;
774
+ const t = ze(e.plan);
717
775
  if (!t.ok)
718
776
  throw new Error(
719
777
  t.errors.map((c) => c.message).join(`
720
778
  `) || "Dashboard plan is invalid."
721
779
  );
722
- const a = e.plan.sheets[0], r = [...t.warnings], o = [], i = new Map(
780
+ const a = e.plan.sheets[0], r = [...t.warnings], o = [], n = new Map(
723
781
  e.cardArtifacts.map((c) => [c.planCardId, c])
724
- ), n = new Map(
782
+ ), i = new Map(
725
783
  e.cardArtifacts.map((c) => [
726
784
  c.planCardId,
727
785
  c.card.id
728
786
  ])
729
- ), d = [];
787
+ ), s = [];
730
788
  for (const c of a.cards) {
731
- const f = i.get(c.id);
732
- if (!f) {
733
- const l = pe(
789
+ const p = n.get(c.id);
790
+ if (!p) {
791
+ const l = me(
734
792
  "missing_card_artifact",
735
793
  `Card "${c.title}" was skipped because no generated artifact was supplied.`,
736
794
  c.id
@@ -738,24 +796,28 @@ function Tt(e) {
738
796
  o.push(l);
739
797
  continue;
740
798
  }
741
- r.push(...f.warnings || []);
742
- const g = Xe(
743
- f.card,
744
- e.plan.calculatedFields,
745
- c.id
799
+ r.push(...p.warnings || []);
800
+ const I = tt(
801
+ et(
802
+ p.card,
803
+ e.plan.calculatedFields,
804
+ c.id
805
+ ),
806
+ c,
807
+ i
746
808
  );
747
- d.push({
809
+ s.push({
748
810
  id: c.frameId,
749
- cards: [g],
750
- activeCardId: g.id
811
+ cards: [I],
812
+ activeCardId: I.id
751
813
  });
752
814
  }
753
- if (d.length === 0)
815
+ if (s.length === 0)
754
816
  throw new Error("Dashboard plan did not produce any persistable cards.");
755
- const { inputs: s, defaultInputValues: u, warnings: h } = Ze(e.plan, n);
817
+ const { inputs: u, defaultInputValues: d, warnings: h } = nt(e.plan, i);
756
818
  r.push(...h);
757
- const I = W(
758
- a.cards.filter((c) => d.some((f) => f.id === c.frameId)).map((c) => ({
819
+ const m = Q(
820
+ a.cards.filter((c) => s.some((p) => p.id === c.frameId)).map((c) => ({
759
821
  frameId: c.frameId,
760
822
  priority: c.priority,
761
823
  role: c.role
@@ -765,100 +827,103 @@ function Tt(e) {
765
827
  id: e.dashboardId,
766
828
  title: e.plan.title,
767
829
  description: e.plan.description || "",
830
+ // A newly created dashboard filters on click. Existing dashboards have no
831
+ // default and stay off until an author turns a card on.
832
+ interactionDefaults: { clickToFilter: "on" },
768
833
  sheets: [
769
834
  {
770
835
  id: a.id,
771
836
  kind: "dashboard",
772
837
  title: a.title,
773
838
  description: a.description,
774
- frames: d,
775
- layouts: I,
776
- calculatedFields: (D = e.plan.calculatedFields) == null ? void 0 : D.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
839
+ frames: s,
840
+ layouts: m,
841
+ calculatedFields: (b = e.plan.calculatedFields) == null ? void 0 : b.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
777
842
  }
778
843
  ],
779
- calculatedFields: (_ = e.plan.calculatedFields) == null ? void 0 : _.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
780
- inputs: s,
781
- ...u ? { defaultInputValues: u } : {}
844
+ calculatedFields: (C = e.plan.calculatedFields) == null ? void 0 : C.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
845
+ inputs: u,
846
+ ...d ? { defaultInputValues: d } : {}
782
847
  }, warnings: r, skippedOperations: o };
783
848
  }
784
- function A(e, t, a) {
849
+ function D(e, t, a) {
785
850
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
786
851
  }
787
- function et(e) {
852
+ function it(e) {
788
853
  return JSON.parse(JSON.stringify(e));
789
854
  }
790
- function tt(e) {
855
+ function ot(e) {
791
856
  var t;
792
857
  return (t = e.sheets) == null ? void 0 : t.find(
793
858
  (a) => (a.kind || "dashboard") === "dashboard"
794
859
  );
795
860
  }
796
- function V(e, t) {
861
+ function M(e, t) {
797
862
  var a;
798
863
  for (const r of e.sheets || [])
799
864
  for (const o of r.frames || []) {
800
- const i = (a = o.cards) == null ? void 0 : a.find((n) => n.id === t);
801
- if (i)
802
- return { sheet: r, frame: o, card: i };
865
+ const n = (a = o.cards) == null ? void 0 : a.find((i) => i.id === t);
866
+ if (n)
867
+ return { sheet: r, frame: o, card: n };
803
868
  }
804
869
  return null;
805
870
  }
806
- function he(e) {
871
+ function ge(e) {
807
872
  var a, r;
808
873
  const t = (r = (a = e.cards) == null ? void 0 : a[0]) == null ? void 0 : r.type;
809
874
  return t === "kpi" ? "kpi" : t === "table" || t === "detailTable" || t === "pivotTable" ? "table" : t === "text" ? "text" : "chart";
810
875
  }
811
- function at(e) {
876
+ function st(e) {
812
877
  var t;
813
878
  return new Map(
814
879
  (((t = e.layouts) == null ? void 0 : t.lg) || []).map((a, r) => [a.i, r])
815
880
  );
816
881
  }
817
- function me(e, t = /* @__PURE__ */ new Map()) {
818
- const a = at(e), r = Math.max(
882
+ function be(e, t = /* @__PURE__ */ new Map()) {
883
+ const a = st(e), r = Math.max(
819
884
  a.size,
820
885
  t.size
821
886
  ), o = (e.frames || []).map(
822
- (i, n) => ({
823
- frameId: i.id,
824
- role: he(i),
825
- priority: t.get(i.id) ?? a.get(i.id) ?? r + n
887
+ (n, i) => ({
888
+ frameId: n.id,
889
+ role: ge(n),
890
+ priority: t.get(n.id) ?? a.get(n.id) ?? r + i
826
891
  })
827
892
  );
828
- e.layouts = W(o);
893
+ e.layouts = Q(o);
829
894
  }
830
- function rt(e) {
895
+ function dt(e) {
831
896
  return Object.values(e.layouts || {}).some((t) => t.length > 0);
832
897
  }
833
- function nt(e, t) {
834
- if (!rt(e)) {
835
- me(e);
898
+ function ct(e, t) {
899
+ if (!dt(e)) {
900
+ be(e);
836
901
  return;
837
902
  }
838
- const a = W([
839
- { frameId: t.id, role: he(t), priority: 0 }
903
+ const a = Q([
904
+ { frameId: t.id, role: ge(t), priority: 0 }
840
905
  ]);
841
906
  e.layouts ?? (e.layouts = {});
842
907
  for (const [r, o] of Object.entries(a)) {
843
- const i = e.layouts[r] || [];
844
- if (i.some((s) => s.i === t.id))
908
+ const n = e.layouts[r] || [];
909
+ if (n.some((u) => u.i === t.id))
845
910
  continue;
846
- const n = o[0];
847
- if (!n)
911
+ const i = o[0];
912
+ if (!i)
848
913
  continue;
849
- const d = i.reduce(
850
- (s, u) => Math.max(s, u.y + u.h),
914
+ const s = n.reduce(
915
+ (u, d) => Math.max(u, d.y + d.h),
851
916
  0
852
917
  );
853
918
  e.layouts[r] = [
854
- ...i,
855
- { ...n, y: d }
919
+ ...n,
920
+ { ...i, y: s }
856
921
  ];
857
922
  }
858
923
  }
859
- function it(e, t) {
924
+ function lt(e, t) {
860
925
  var r;
861
- const a = K(
926
+ const a = J(
862
927
  t.filter,
863
928
  t.defaultValue
864
929
  );
@@ -870,66 +935,82 @@ function it(e, t) {
870
935
  }
871
936
  });
872
937
  }
873
- function Ft(e) {
874
- var d;
875
- const t = Be(e.changePlan);
938
+ function Mt(e) {
939
+ var u;
940
+ const t = qe(e.changePlan);
876
941
  if (!t.ok)
877
942
  throw new Error(
878
- t.errors.map((s) => s.message).join(`
943
+ t.errors.map((d) => d.message).join(`
879
944
  `) || "Dashboard change plan is invalid."
880
945
  );
881
- const a = et(e.dashboard), r = [...t.warnings], o = [], i = new Map(
882
- e.cardArtifacts.map((s) => [s.planCardId, s])
883
- ), n = tt(a);
884
- if (!n)
946
+ const a = it(e.dashboard), r = [...t.warnings], o = [], n = new Map(
947
+ e.cardArtifacts.map((d) => [d.planCardId, d])
948
+ ), i = new Map(
949
+ e.cardArtifacts.map((d) => [
950
+ d.planCardId,
951
+ d.card.id
952
+ ])
953
+ ), s = ot(a);
954
+ if (!s)
885
955
  throw new Error("Dashboard has no editable dashboard sheet.");
886
- n.frames ?? (n.frames = []);
887
- for (const s of e.changePlan.operations)
888
- switch (s.kind) {
956
+ s.frames ?? (s.frames = []);
957
+ for (const d of e.changePlan.operations)
958
+ switch (d.kind) {
889
959
  case "addCard": {
890
- if ((n.frames || []).reduce(
891
- (C, D) => {
892
- var _;
893
- return C + (((_ = D.cards) == null ? void 0 : _.length) || 0);
960
+ if ((s.frames || []).reduce(
961
+ (C, c) => {
962
+ var p;
963
+ return C + (((p = c.cards) == null ? void 0 : p.length) || 0);
894
964
  },
895
965
  0
896
- ) >= E) {
966
+ ) >= L) {
897
967
  o.push(
898
- A(
968
+ D(
899
969
  "generated_card_limit_reached",
900
- `AI refinement is capped at ${E} cards.`,
901
- s.card.id
970
+ `AI refinement is capped at ${L} cards.`,
971
+ d.card.id
902
972
  )
903
973
  );
904
974
  break;
905
975
  }
906
- const h = i.get(s.card.id);
907
- if (!h) {
976
+ const m = n.get(d.card.id);
977
+ if (!m) {
908
978
  o.push(
909
- A(
979
+ D(
910
980
  "missing_card_artifact",
911
- `Card "${s.card.title}" was skipped because no generated artifact was supplied.`,
912
- s.card.id
981
+ `Card "${d.card.title}" was skipped because no generated artifact was supplied.`,
982
+ d.card.id
913
983
  )
914
984
  );
915
985
  break;
916
986
  }
917
- const I = {
918
- id: s.card.frameId,
919
- cards: [h.card],
920
- activeCardId: h.card.id
987
+ const S = {
988
+ ...m.card,
989
+ ...d.card.clickToFilter ? {
990
+ clickToFilter: q(
991
+ d.card.clickToFilter,
992
+ { cardIds: Object.fromEntries(i) }
993
+ )
994
+ } : {},
995
+ ...d.card.respondsToSelections !== void 0 ? {
996
+ respondsToSelections: d.card.respondsToSelections
997
+ } : {}
998
+ }, b = {
999
+ id: d.card.frameId,
1000
+ cards: [S],
1001
+ activeCardId: S.id
921
1002
  };
922
- n.frames.push(I), nt(n, I);
1003
+ s.frames.push(b), ct(s, b);
923
1004
  break;
924
1005
  }
925
1006
  case "addFilterInput": {
926
1007
  a.inputs ?? (a.inputs = []);
927
- const u = {
928
- id: s.input.id,
1008
+ const h = {
1009
+ id: d.input.id,
929
1010
  kind: "filter",
930
- label: s.input.label,
931
- variableName: s.input.variableName,
932
- scope: s.input.scope || {
1011
+ label: d.input.label,
1012
+ variableName: d.input.variableName,
1013
+ scope: d.input.scope || {
933
1014
  kind: "allSheets",
934
1015
  sheetKinds: ["dashboard"]
935
1016
  },
@@ -939,74 +1020,92 @@ function Ft(e) {
939
1020
  order: a.inputs.length
940
1021
  },
941
1022
  exports: ["label", "value", "start", "end", "range"],
942
- filter: s.input.filter
1023
+ filter: d.input.filter
943
1024
  };
944
- a.inputs.push(u), it(a, s.input);
1025
+ a.inputs.push(h), lt(a, d.input);
945
1026
  break;
946
1027
  }
947
1028
  case "addCalculatedField": {
948
- if (s.field.scope === "dashboard" && s.field.field)
949
- a.calculatedFields ?? (a.calculatedFields = []), a.calculatedFields.push(s.field.field);
950
- else if (s.field.scope === "sheet" && s.field.field)
951
- n.calculatedFields ?? (n.calculatedFields = []), n.calculatedFields.push(s.field.field);
952
- else if (s.field.scope === "card" && s.field.field) {
953
- const u = s.field.targetCardId ? V(a, s.field.targetCardId) : null;
954
- u ? ((d = u.card).calculatedFields ?? (d.calculatedFields = []), u.card.calculatedFields.push(s.field.field)) : o.push(
955
- A(
1029
+ if (d.field.scope === "dashboard" && d.field.field)
1030
+ a.calculatedFields ?? (a.calculatedFields = []), a.calculatedFields.push(d.field.field);
1031
+ else if (d.field.scope === "sheet" && d.field.field)
1032
+ s.calculatedFields ?? (s.calculatedFields = []), s.calculatedFields.push(d.field.field);
1033
+ else if (d.field.scope === "card" && d.field.field) {
1034
+ const h = d.field.targetCardId ? M(a, d.field.targetCardId) : null;
1035
+ h ? ((u = h.card).calculatedFields ?? (u.calculatedFields = []), h.card.calculatedFields.push(d.field.field)) : o.push(
1036
+ D(
956
1037
  "missing_calculated_field_target",
957
- `Calculated field "${s.field.name}" needs a valid target card.`
1038
+ `Calculated field "${d.field.name}" needs a valid target card.`
958
1039
  )
959
1040
  );
960
1041
  }
961
1042
  break;
962
1043
  }
963
1044
  case "renameCard": {
964
- const u = V(a, s.cardId);
965
- if (!u) {
1045
+ const h = M(a, d.cardId);
1046
+ if (!h) {
966
1047
  o.push(
967
- A(
1048
+ D(
968
1049
  "card_not_found",
969
- `Card "${s.cardId}" could not be renamed because it was not found.`,
970
- s.cardId
1050
+ `Card "${d.cardId}" could not be renamed because it was not found.`,
1051
+ d.cardId
971
1052
  )
972
1053
  );
973
1054
  break;
974
1055
  }
975
- u.card.title = s.title, s.description !== void 0 && (u.card.description = s.description);
1056
+ h.card.title = d.title, d.description !== void 0 && (h.card.description = d.description);
1057
+ break;
1058
+ }
1059
+ case "updateCardSelectionSettings": {
1060
+ const h = i.get(d.cardId) ?? d.cardId, m = M(a, h);
1061
+ if (!m) {
1062
+ o.push(
1063
+ D(
1064
+ "card_not_found",
1065
+ `Card "${d.cardId}" could not be updated because it was not found.`,
1066
+ d.cardId
1067
+ )
1068
+ );
1069
+ break;
1070
+ }
1071
+ d.card.clickToFilter !== void 0 && (m.card.clickToFilter = q(
1072
+ d.card.clickToFilter,
1073
+ { cardIds: Object.fromEntries(i) }
1074
+ )), d.card.respondsToSelections !== void 0 && (m.card.respondsToSelections = d.card.respondsToSelections);
976
1075
  break;
977
1076
  }
978
1077
  case "reorderCards": {
979
- const u = /* @__PURE__ */ new Map();
980
- for (let h = 0; h < s.cardIds.length; h += 1) {
981
- const I = s.cardIds[h], C = V(a, I);
982
- C && u.set(C.frame.id, h);
1078
+ const h = /* @__PURE__ */ new Map();
1079
+ for (let m = 0; m < d.cardIds.length; m += 1) {
1080
+ const S = d.cardIds[m], b = M(a, S);
1081
+ b && h.set(b.frame.id, m);
983
1082
  }
984
- me(n, u);
1083
+ be(s, h);
985
1084
  break;
986
1085
  }
987
1086
  case "reuseCalculatedField":
988
1087
  r.push(
989
- A(
1088
+ D(
990
1089
  "reused_calculated_field",
991
- `Calculated field "${s.fieldId}" is reused by reference.`
1090
+ `Calculated field "${d.fieldId}" is reused by reference.`
992
1091
  )
993
1092
  );
994
1093
  break;
995
1094
  case "unsupported":
996
1095
  o.push(
997
- A("unsupported_operation", s.reason || s.requestedAction)
1096
+ D("unsupported_operation", d.reason || d.requestedAction)
998
1097
  );
999
1098
  break;
1000
1099
  }
1001
1100
  return { dashboard: a, warnings: r, skippedOperations: o };
1002
1101
  }
1003
- function b(e, t, a) {
1102
+ function _(e, t, a) {
1004
1103
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
1005
1104
  }
1006
- function F(e, t) {
1105
+ function x(e, t) {
1007
1106
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
1008
1107
  }
1009
- function ge(e, t) {
1108
+ function Ie(e, t) {
1010
1109
  if (!t.has(e))
1011
1110
  return t.add(e), e;
1012
1111
  let a = 2, r = `${e}-${a}`;
@@ -1017,22 +1116,22 @@ function ge(e, t) {
1017
1116
  function O(e) {
1018
1117
  return !!(e && typeof e == "object");
1019
1118
  }
1020
- function be(e) {
1119
+ function _e(e) {
1021
1120
  return Array.isArray(e.inputs) ? e.inputs.filter(
1022
1121
  (t) => O(t) && typeof t.id == "string"
1023
1122
  ) : [];
1024
1123
  }
1025
- function Q(e) {
1124
+ function X(e) {
1026
1125
  return Array.isArray(e.sections) ? e.sections.filter(
1027
1126
  (t) => O(t)
1028
1127
  ) : [];
1029
1128
  }
1030
- function X(e) {
1129
+ function Y(e) {
1031
1130
  return Array.isArray(e.views) ? e.views.filter(
1032
1131
  (t) => O(t)
1033
1132
  ) : [];
1034
1133
  }
1035
- function w(e) {
1134
+ function k(e) {
1036
1135
  if (!Array.isArray(e))
1037
1136
  return [];
1038
1137
  const t = [];
@@ -1042,98 +1141,98 @@ function w(e) {
1042
1141
  }
1043
1142
  return t;
1044
1143
  }
1045
- function ot(e) {
1046
- var r, o, i;
1144
+ function ut(e) {
1145
+ var r, o, n;
1047
1146
  if (!e)
1048
1147
  return [];
1049
1148
  const t = [];
1050
- if (k(e.source) && t.push(e.source), e.kind === "metric") {
1051
- t.push(...w(e.measures));
1052
- const n = v(e.dateField);
1053
- n && t.push(n), t.push(...w(e.dimensions)), t.push(
1054
- ...w(
1055
- (r = e.filters) == null ? void 0 : r.map((d) => d.field)
1149
+ if (A(e.source) && t.push(e.source), e.kind === "metric") {
1150
+ t.push(...k(e.measures));
1151
+ const i = v(e.dateField);
1152
+ i && t.push(i), t.push(...k(e.dimensions)), t.push(
1153
+ ...k(
1154
+ (r = e.filters) == null ? void 0 : r.map((s) => s.field)
1056
1155
  )
1057
1156
  );
1058
1157
  } else if (e.kind === "records") {
1059
- const n = v(e.dateField);
1060
- n && t.push(n), t.push(...w(e.fields)), t.push(
1061
- ...w(
1062
- (o = e.filters) == null ? void 0 : o.map((d) => d.field)
1158
+ const i = v(e.dateField);
1159
+ i && t.push(i), t.push(...k(e.fields)), t.push(
1160
+ ...k(
1161
+ (o = e.filters) == null ? void 0 : o.map((s) => s.field)
1063
1162
  )
1064
1163
  );
1065
- } else e.kind === "inputOptions" ? (((i = e.population) == null ? void 0 : i.kind) === "related_population" && k(e.population.baseSource) && t.push(e.population.baseSource), t.push(
1066
- ...w([
1164
+ } else e.kind === "inputOptions" ? (((n = e.population) == null ? void 0 : n.kind) === "related_population" && A(e.population.baseSource) && t.push(e.population.baseSource), t.push(
1165
+ ...k([
1067
1166
  e.labelField,
1068
1167
  e.valueField,
1069
1168
  e.searchField,
1070
1169
  ...e.disambiguationFields || []
1071
- ].filter((n) => !!n))
1072
- )) : e.kind === "sql" && t.push(...w(e.fields));
1170
+ ].filter((i) => !!i))
1171
+ )) : e.kind === "sql" && t.push(...k(e.fields));
1073
1172
  const a = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
1074
- for (const n of a) {
1075
- const d = v(n.field);
1076
- d && t.push(d);
1173
+ for (const i of a) {
1174
+ const s = v(i.field);
1175
+ s && t.push(s);
1077
1176
  }
1078
1177
  return t;
1079
1178
  }
1080
- function st(e) {
1179
+ function ft(e) {
1081
1180
  const t = [];
1082
- for (const a of be(e)) {
1181
+ for (const a of _e(e)) {
1083
1182
  const r = v(a.field);
1084
1183
  r && t.push(r);
1085
1184
  }
1086
- for (const a of Q(e))
1087
- for (const r of X(a))
1088
- t.push(...ot(r.analytics));
1185
+ for (const a of X(e))
1186
+ for (const r of Y(a))
1187
+ t.push(...ut(r.analytics));
1089
1188
  return t;
1090
1189
  }
1091
- function dt(e) {
1190
+ function pt(e) {
1092
1191
  var a;
1093
1192
  const t = [];
1094
- for (const r of Q(e))
1095
- for (const o of X(r))
1096
- k((a = o.analytics) == null ? void 0 : a.source) && t.push(o.analytics.source);
1193
+ for (const r of X(e))
1194
+ for (const o of Y(r))
1195
+ A((a = o.analytics) == null ? void 0 : a.source) && t.push(o.analytics.source);
1097
1196
  return t;
1098
1197
  }
1099
- function ct(e, t) {
1100
- const a = $(e).filter(k);
1198
+ function ht(e, t) {
1199
+ const a = $(e).filter(A);
1101
1200
  if (a.length === 0)
1102
1201
  return t.push(
1103
- b(
1202
+ _(
1104
1203
  "missing_materializable_dataset",
1105
1204
  "No semantic or physical source could be converted into the current dashboard authoring dataset reference."
1106
1205
  )
1107
1206
  ), [];
1108
- const r = a.every((i) => i.kind === "semantic"), o = Array.from(
1207
+ const r = a.every((n) => n.kind === "semantic"), o = Array.from(
1109
1208
  new Set(
1110
- a.filter((i) => i.kind === "semantic").map((i) => i.domainId)
1209
+ a.filter((n) => n.kind === "semantic").map((n) => n.domainId)
1111
1210
  )
1112
1211
  );
1113
1212
  return a.length > 1 && (!r || o.length !== 1) ? (t.push(
1114
- b(
1213
+ _(
1115
1214
  "multiple_datasets_out_of_scope",
1116
1215
  "The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
1117
1216
  )
1118
1217
  ), [a[0]]) : a;
1119
1218
  }
1120
- function lt(e, t) {
1121
- const a = Q(e), r = be(e), o = $(st(e)), i = $(
1122
- dt(e)
1219
+ function mt(e, t) {
1220
+ const a = X(e), r = _e(e), o = $(ft(e)), n = $(
1221
+ pt(e)
1123
1222
  );
1124
1223
  return {
1125
1224
  sections: a,
1126
1225
  inputs: r,
1127
1226
  sources: o,
1128
- primarySources: i,
1129
- defaultSource: i.length === 1 ? i[0] : void 0,
1130
- datasets: ct(o, t)
1227
+ primarySources: n,
1228
+ defaultSource: n.length === 1 ? n[0] : void 0,
1229
+ datasets: ht(o, t)
1131
1230
  };
1132
1231
  }
1133
- function ut(e) {
1134
- return e && ie(e).ok ? e : void 0;
1232
+ function gt(e) {
1233
+ return e && se(e).ok ? e : void 0;
1135
1234
  }
1136
- function ft(e) {
1235
+ function bt(e) {
1137
1236
  var t;
1138
1237
  switch ((t = e.presentation) == null ? void 0 : t.kind) {
1139
1238
  case "kpi":
@@ -1152,12 +1251,12 @@ function ft(e) {
1152
1251
  return null;
1153
1252
  }
1154
1253
  }
1155
- function pt(e) {
1254
+ function It(e) {
1156
1255
  var t, a, r;
1157
1256
  return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((r = e.presentation) == null ? void 0 : r.kind) === "text" ? "text" : "chart";
1158
1257
  }
1159
- function ht(e) {
1160
- const t = Se(e);
1258
+ function _t(e) {
1259
+ const t = we(e);
1161
1260
  switch (t) {
1162
1261
  case "not_in":
1163
1262
  return "not in";
@@ -1171,78 +1270,78 @@ function ht(e) {
1171
1270
  return t || "in";
1172
1271
  }
1173
1272
  }
1174
- function mt(e) {
1273
+ function yt(e) {
1175
1274
  return O(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
1176
1275
  }
1177
- function gt(e) {
1276
+ function Ct(e) {
1178
1277
  if (!(!e || e.kind !== "physical"))
1179
1278
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
1180
1279
  }
1181
- function bt(e, t, a, r, o, i) {
1280
+ function St(e, t, a, r, o, n) {
1182
1281
  if (e.kind !== "filter")
1183
- return i.push(
1184
- b(
1282
+ return n.push(
1283
+ _(
1185
1284
  "control_inputs_deferred",
1186
1285
  `Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
1187
1286
  )
1188
1287
  ), null;
1189
1288
  if (!O(e.field) || typeof e.field.name != "string")
1190
- return i.push(
1191
- b(
1289
+ return n.push(
1290
+ _(
1192
1291
  "filter_requires_field",
1193
1292
  `Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
1194
1293
  )
1195
1294
  ), null;
1196
- const n = Ae({
1295
+ const i = Oe({
1197
1296
  explicitSource: void 0,
1198
1297
  field: e.field,
1199
1298
  defaultSource: t,
1200
1299
  fallbackSources: a
1201
- }), d = (n == null ? void 0 : n.kind) === "semantic" || (n == null ? void 0 : n.kind) === "physical" ? n.connectionId : void 0;
1202
- if (!d)
1203
- return i.push(
1204
- b(
1300
+ }), s = (i == null ? void 0 : i.kind) === "semantic" || (i == null ? void 0 : i.kind) === "physical" ? i.connectionId : void 0;
1301
+ if (!s)
1302
+ return n.push(
1303
+ _(
1205
1304
  "filter_requires_connection_id",
1206
1305
  `Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
1207
1306
  )
1208
1307
  ), null;
1209
1308
  const h = {
1210
- id: `filter-${ge(
1211
- F(e.id, e.field.name),
1309
+ id: `filter-${Ie(
1310
+ x(e.id, e.field.name),
1212
1311
  o
1213
1312
  )}`,
1214
1313
  variableName: e.id,
1215
- connectionId: d,
1314
+ connectionId: s,
1216
1315
  title: e.label,
1217
1316
  column: e.field.name,
1218
- dataType: mt(e),
1219
- qualifiedTableName: gt(n),
1317
+ dataType: yt(e),
1318
+ qualifiedTableName: Ct(i),
1220
1319
  sql: "",
1221
- operation: ht(e.operator),
1320
+ operation: _t(e.operator),
1222
1321
  type: e.multi === !1 ? "single" : "multiple",
1223
1322
  location: "dashboard",
1224
1323
  displayMode: "toolbar",
1225
- fieldMeta: (n == null ? void 0 : n.kind) === "semantic" ? {
1324
+ fieldMeta: (i == null ? void 0 : i.kind) === "semantic" ? {
1226
1325
  name: e.field.name,
1227
1326
  qualifiedFieldName: e.field.name,
1228
1327
  dataType: e.field.dataType,
1229
1328
  role: e.field.role === "measure" ? "metric" : "groupby"
1230
1329
  } : void 0,
1231
- semanticContext: (n == null ? void 0 : n.kind) === "semantic" ? {
1232
- semanticDomainId: n.domainId,
1233
- connectionId: n.connectionId
1234
- } : (n == null ? void 0 : n.kind) === "physical" ? {
1235
- connectionId: n.connectionId,
1236
- connectionType: n.connectionType,
1330
+ semanticContext: (i == null ? void 0 : i.kind) === "semantic" ? {
1331
+ semanticDomainId: i.domainId,
1332
+ connectionId: i.connectionId
1333
+ } : (i == null ? void 0 : i.kind) === "physical" ? {
1334
+ connectionId: i.connectionId,
1335
+ connectionType: i.connectionType,
1237
1336
  selectedEntities: [
1238
1337
  {
1239
1338
  type: "table",
1240
- connectionId: n.connectionId,
1241
- connectionType: n.connectionType,
1242
- dialect: n.dialect,
1243
- database: n.databaseName,
1244
- schema: n.schemaName,
1245
- name: n.tableName
1339
+ connectionId: i.connectionId,
1340
+ connectionType: i.connectionType,
1341
+ dialect: i.dialect,
1342
+ database: i.databaseName,
1343
+ schema: i.schemaName,
1344
+ name: i.tableName
1246
1345
  }
1247
1346
  ]
1248
1347
  } : void 0
@@ -1253,36 +1352,36 @@ function bt(e, t, a, r, o, i) {
1253
1352
  variableName: e.id,
1254
1353
  scope: r,
1255
1354
  filter: h,
1256
- defaultValue: K(
1355
+ defaultValue: J(
1257
1356
  h,
1258
1357
  e.defaultValue
1259
1358
  )
1260
1359
  };
1261
1360
  }
1262
- function q(e) {
1361
+ function z(e) {
1263
1362
  const t = [], a = [];
1264
1363
  for (const r of e.viewIds) {
1265
1364
  const o = e.viewIdToCardId.get(r);
1266
1365
  o ? t.push(o) : a.push(r);
1267
1366
  }
1268
1367
  return a.length > 0 && e.warnings.push(
1269
- b(
1368
+ _(
1270
1369
  "input_scope_view_not_found",
1271
1370
  `Filter "${e.inputLabel}" referenced unknown view ids: ${a.join(", ")}.`
1272
1371
  )
1273
1372
  ), Array.from(new Set(t));
1274
1373
  }
1275
- function It(e) {
1374
+ function vt(e) {
1276
1375
  var r, o;
1277
1376
  if (!e.protocolScope) {
1278
- const i = Array.from(new Set(e.boundCardIds));
1279
- return i.length > 0 && i.length < e.allCardIds.length ? { kind: "cards", cardIds: i } : void 0;
1377
+ const n = Array.from(new Set(e.boundCardIds));
1378
+ return n.length > 0 && n.length < e.allCardIds.length ? { kind: "cards", cardIds: n } : void 0;
1280
1379
  }
1281
1380
  if (e.protocolScope.level === "dashboard") {
1282
1381
  if (!((r = e.protocolScope.excludeViewIds) != null && r.length))
1283
1382
  return;
1284
- const i = new Set(
1285
- q({
1383
+ const n = new Set(
1384
+ z({
1286
1385
  inputLabel: e.inputLabel,
1287
1386
  viewIds: e.protocolScope.excludeViewIds,
1288
1387
  viewIdToCardId: e.viewIdToCardId,
@@ -1291,27 +1390,27 @@ function It(e) {
1291
1390
  );
1292
1391
  return {
1293
1392
  kind: "cards",
1294
- cardIds: e.allCardIds.filter((n) => !i.has(n))
1393
+ cardIds: e.allCardIds.filter((i) => !n.has(i))
1295
1394
  };
1296
1395
  }
1297
1396
  if (e.protocolScope.level === "view") {
1298
- const i = q({
1397
+ const n = z({
1299
1398
  inputLabel: e.inputLabel,
1300
1399
  viewIds: e.protocolScope.viewIds,
1301
1400
  viewIdToCardId: e.viewIdToCardId,
1302
1401
  warnings: e.warnings
1303
1402
  });
1304
- return i.length === 0 ? (e.warnings.push(
1305
- b(
1403
+ return n.length === 0 ? (e.warnings.push(
1404
+ _(
1306
1405
  "input_scope_has_no_materialized_cards",
1307
1406
  `Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
1308
1407
  )
1309
- ), null) : { kind: "cards", cardIds: i };
1408
+ ), null) : { kind: "cards", cardIds: n };
1310
1409
  }
1311
1410
  const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
1312
1411
  if (t.length === 0)
1313
1412
  return e.warnings.push(
1314
- b(
1413
+ _(
1315
1414
  "input_scope_section_not_found",
1316
1415
  `Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`
1317
1416
  )
@@ -1319,7 +1418,7 @@ function It(e) {
1319
1418
  if (!((o = e.protocolScope.excludeViewIds) != null && o.length))
1320
1419
  return { kind: "cards", cardIds: t };
1321
1420
  const a = new Set(
1322
- q({
1421
+ z({
1323
1422
  inputLabel: e.inputLabel,
1324
1423
  viewIds: e.protocolScope.excludeViewIds,
1325
1424
  viewIdToCardId: e.viewIdToCardId,
@@ -1328,211 +1427,224 @@ function It(e) {
1328
1427
  );
1329
1428
  return {
1330
1429
  kind: "cards",
1331
- cardIds: t.filter((i) => !a.has(i))
1430
+ cardIds: t.filter((n) => !a.has(n))
1332
1431
  };
1333
1432
  }
1334
- function kt(e) {
1335
- var D, _, c;
1336
- const t = [], a = ve(e);
1337
- for (const f of a.warnings)
1338
- t.push(b(f.code, f.message));
1339
- for (const f of a.errors)
1340
- t.push(b(f.code, f.message));
1341
- const r = lt(e, t), o = [], i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
1433
+ function Lt(e) {
1434
+ var b, C, c;
1435
+ const t = [], a = Fe(e);
1436
+ for (const p of a.warnings)
1437
+ t.push(_(p.code, p.message));
1438
+ for (const p of a.errors)
1439
+ t.push(_(p.code, p.message));
1440
+ const r = mt(e, t), o = [], n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
1342
1441
  let h = 0;
1343
- for (const [f, g] of r.sections.entries()) {
1344
- const l = typeof g.title == "string" ? g.title : `Section ${f + 1}`, Y = g.id || F(l, `section-${f + 1}`);
1345
- n.set(Y, []);
1346
- for (const [J, m] of X(g).entries()) {
1347
- const Z = ft(m), L = F(
1348
- m.id || `${l}-${m.title || `View ${J + 1}`}`,
1349
- `card-${f + 1}-${J + 1}`
1442
+ for (const [p, I] of r.sections.entries()) {
1443
+ const l = typeof I.title == "string" ? I.title : `Section ${p + 1}`, Z = I.id || x(l, `section-${p + 1}`);
1444
+ i.set(Z, []);
1445
+ for (const [ee, g] of Y(I).entries()) {
1446
+ const te = bt(g), B = x(
1447
+ g.id || `${l}-${g.title || `View ${ee + 1}`}`,
1448
+ `card-${p + 1}-${ee + 1}`
1350
1449
  );
1351
- if (!Z) {
1450
+ if (!te) {
1352
1451
  t.push(
1353
- b(
1452
+ _(
1354
1453
  "unsupported_presentation",
1355
- `Dashboard presentation "${((D = m.presentation) == null ? void 0 : D.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1356
- `card-${L}`
1454
+ `Dashboard presentation "${((b = g.presentation) == null ? void 0 : b.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1455
+ `card-${B}`
1357
1456
  )
1358
1457
  );
1359
1458
  continue;
1360
1459
  }
1361
- if (((_ = m.analytics) == null ? void 0 : _.kind) === "sql") {
1460
+ if (((C = g.analytics) == null ? void 0 : C.kind) === "sql") {
1362
1461
  t.push(
1363
- b(
1462
+ _(
1364
1463
  "sql_intent_deferred",
1365
1464
  "SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",
1366
- `card-${L}`
1465
+ `card-${B}`
1367
1466
  )
1368
1467
  );
1369
1468
  continue;
1370
1469
  }
1371
- const ee = ge(L, s), R = `card-${ee}`;
1372
- m.id && i.set(m.id, R), (c = n.get(Y)) == null || c.push(R);
1373
- const Ie = m.analytics && "inputs" in m.analytics ? m.analytics.inputs : void 0;
1374
- for (const te of Ie || []) {
1375
- const ae = d.get(te.inputId) || [];
1376
- ae.push(R), d.set(te.inputId, ae);
1470
+ const ae = Ie(B, u), R = `card-${ae}`;
1471
+ g.id && n.set(g.id, R), (c = i.get(Z)) == null || c.push(R);
1472
+ const ye = g.analytics && "inputs" in g.analytics ? g.analytics.inputs : void 0;
1473
+ for (const re of ye || []) {
1474
+ const ne = s.get(re.inputId) || [];
1475
+ ne.push(R), s.set(re.inputId, ne);
1377
1476
  }
1378
1477
  o.push({
1379
1478
  id: R,
1380
- frameId: `frame-${ee}`,
1381
- title: m.title,
1382
- description: m.description,
1383
- type: Z,
1384
- role: pt(m),
1479
+ frameId: `frame-${ae}`,
1480
+ title: g.title,
1481
+ description: g.description,
1482
+ type: te,
1483
+ role: It(g),
1385
1484
  priority: h,
1386
1485
  section: l,
1387
- analyticsIntent: ut(m.analytics),
1388
- text: m.text
1486
+ analyticsIntent: gt(g.analytics),
1487
+ text: g.text
1389
1488
  }), h += 1;
1390
1489
  }
1391
1490
  }
1392
- const I = r.inputs.map((f) => {
1393
- const g = It({
1394
- protocolScope: f.scope,
1395
- inputLabel: f.label,
1491
+ const m = r.inputs.map((p) => {
1492
+ const I = vt({
1493
+ protocolScope: p.scope,
1494
+ inputLabel: p.label,
1396
1495
  allCardIds: o.map((l) => l.id),
1397
- boundCardIds: d.get(f.id) || [],
1398
- viewIdToCardId: i,
1399
- sectionIdToCardIds: n,
1496
+ boundCardIds: s.get(p.id) || [],
1497
+ viewIdToCardId: n,
1498
+ sectionIdToCardIds: i,
1400
1499
  warnings: t
1401
1500
  });
1402
- return g === null ? null : bt(
1403
- f,
1501
+ return I === null ? null : St(
1502
+ p,
1404
1503
  r.defaultSource,
1405
1504
  r.sources,
1406
- g,
1407
- u,
1505
+ I,
1506
+ d,
1408
1507
  t
1409
1508
  );
1410
- }).filter((f) => !!f);
1509
+ }).filter((p) => !!p);
1411
1510
  return { plan: {
1412
1511
  version: 1,
1413
- id: `plan-${F(e.title, "dashboard")}`,
1512
+ id: `plan-${x(e.title, "dashboard")}`,
1414
1513
  title: e.title,
1415
1514
  description: e.description,
1416
1515
  datasets: r.datasets,
1417
1516
  sheets: [
1418
1517
  {
1419
- id: `sheet-${F(e.title, "dashboard")}`,
1518
+ id: `sheet-${x(e.title, "dashboard")}`,
1420
1519
  title: e.title,
1421
1520
  description: e.description,
1422
1521
  kind: "dashboard",
1423
1522
  cards: o
1424
1523
  }
1425
1524
  ],
1426
- filterInputs: I.length ? I : void 0,
1525
+ filterInputs: m.length ? m : void 0,
1427
1526
  warnings: t.length ? t : void 0,
1428
- unresolvedRequests: a.ok ? void 0 : a.errors.map((f) => f.message)
1527
+ unresolvedRequests: a.ok ? void 0 : a.errors.map((p) => p.message)
1429
1528
  }, warnings: t };
1430
1529
  }
1431
1530
  export {
1432
- ia as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
1433
- Nt as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
1434
- Mt as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
1435
- Et as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
1436
- $t as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
1437
- Lt as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
1438
- Bt as CONTROL_DEFINITION_INVALID_ERROR_CODE,
1439
- Pt as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
1440
- Vt as CONTROL_REFERENCE_MISSING_ERROR_CODE,
1441
- qt as CONTROL_VALUE_INVALID_ERROR_CODE,
1442
- zt as CONTROL_VALUE_MISSING_ERROR_CODE,
1443
- jt as ControlResolutionError,
1444
- _e as DASHBOARD_AUTHORING_BREAKPOINTS,
1445
- E as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
1446
- Sa as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
1447
- wa as DashboardFilterMappingContractError,
1448
- oa as SEMAPHOR_CARTESIAN_CHART_TYPES,
1449
- xa as applyCardReferenceRemapping,
1450
- Ft as applyDashboardChangePlan,
1451
- Aa as applyOptionDependencyOverride,
1452
- Ht as buildControlDefinitionIndex,
1453
- sa as buildDashboardCardSourceIndex,
1454
- Tt as compileDashboardFromPlan,
1455
- W as compileResponsiveDashboardLayouts,
1456
- Ta as composeCardReferenceRemapping,
1457
- Fa as createDashboardFilterBindingId,
1458
- nr as createMatrixAuthoringDraft,
1459
- ir as createMatrixConfig,
1460
- U as dashboardAuthoringDatasetMatchesSource,
1461
- xt as dashboardAuthoringFieldsReferToSameTarget,
1531
+ fa as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
1532
+ Pt as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
1533
+ Vt as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
1534
+ zt as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
1535
+ qt as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
1536
+ jt as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
1537
+ Gt as CONTROL_DEFINITION_INVALID_ERROR_CODE,
1538
+ Ht as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
1539
+ Ut as CONTROL_REFERENCE_MISSING_ERROR_CODE,
1540
+ Wt as CONTROL_VALUE_INVALID_ERROR_CODE,
1541
+ Kt as CONTROL_VALUE_MISSING_ERROR_CODE,
1542
+ Qt as ControlResolutionError,
1543
+ Ce as DASHBOARD_AUTHORING_BREAKPOINTS,
1544
+ L as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
1545
+ Ma as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
1546
+ La as DashboardFilterMappingContractError,
1547
+ pa as SEMAPHOR_CARTESIAN_CHART_TYPES,
1548
+ $a as applyCardReferenceRemapping,
1549
+ Mt as applyDashboardChangePlan,
1550
+ Jt as applyGroupByOverride,
1551
+ Ba as applyLinkedClickToFilterOverrides,
1552
+ Pa as applyOptionDependencyOverride,
1553
+ Xt as buildControlDefinitionIndex,
1554
+ ha as buildDashboardCardSourceIndex,
1555
+ Va as buildLinkedClickToFilterOverrides,
1556
+ Se as clickToFilterSettingsSchema,
1557
+ Et as compileDashboardFromPlan,
1558
+ Q as compileResponsiveDashboardLayouts,
1559
+ za as composeCardReferenceRemapping,
1560
+ qa as createDashboardFilterBindingId,
1561
+ yr as createMatrixAuthoringDraft,
1562
+ Cr as createMatrixConfig,
1563
+ K as dashboardAuthoringDatasetMatchesSource,
1564
+ Rt as dashboardAuthoringFieldsReferToSameTarget,
1462
1565
  v as dashboardAuthoringSourceFromField,
1463
- St as dashboardAuthoringSourceKey,
1464
- oe as dashboardAuthoringSourcesReferToSameDataset,
1465
- da as dashboardCardFilterSourceInventoryContains,
1466
- ka as dashboardFilterTargetMatchesLogicalValue,
1467
- Oa as dashboardFilterValueTypeForDataType,
1468
- kt as dashboardPlanFromSemaphorDashboardIntent,
1469
- At as findDashboardAuthoringDatasetForSource,
1470
- ca as findDashboardCardExecutableSource,
1471
- la as findDashboardCardPinnedCatalogSource,
1472
- ua as findDashboardSqlPinnedCatalogSource,
1473
- Gt as getCalculatedFieldAggregateOverrides,
1474
- Ra as getCalculatedFieldNamespace,
1475
- Ut as getCalculatedFieldParameters,
1476
- Wt as getCalculatedFieldShelfOverrides,
1477
- Kt as getColumnCatalogFieldId,
1478
- Me as getDashboardAuthoringCardSource,
1479
- Na as getDashboardFilterSubscriptionHint,
1480
- Qt as getDomainCalculatedSelectionOverrides,
1481
- fa as getFieldAggregationOptions,
1482
- Ma as getMatrixBindingTargets,
1483
- or as getMatrixLevelLabel,
1484
- sr as getMatrixMeasureLabel,
1485
- Ea as getStableDomainCalculatedFieldId,
1486
- pa as getTemporalBucketAuthoringOptions,
1487
- ha as getTemporalBucketAuthoringSelection,
1488
- $a as hasDashboardFilterSubscription,
1489
- La as isDashboardFilterOperationCompatible,
1490
- k as isMaterializableDashboardAuthoringSource,
1491
- ma as isSemaphorCartesianChartType,
1492
- we as isSemaphorSourceRef,
1493
- Xt as matrixCatalogSources,
1494
- ur as matrixDefinitionFields,
1495
- fr as matrixDefinitionSources,
1496
- Yt as matrixExecutionSources,
1566
+ At as dashboardAuthoringSourceKey,
1567
+ de as dashboardAuthoringSourcesReferToSameDataset,
1568
+ ma as dashboardCardFilterSourceInventoryContains,
1569
+ ja as dashboardFilterTargetMatchesLogicalValue,
1570
+ Ga as dashboardFilterValueTypeForDataType,
1571
+ Lt as dashboardPlanFromSemaphorDashboardIntent,
1572
+ ga as defaultClickToFilterSettings,
1573
+ Nt as findDashboardAuthoringDatasetForSource,
1574
+ ba as findDashboardCardExecutableSource,
1575
+ Ia as findDashboardCardPinnedCatalogSource,
1576
+ _a as findDashboardSqlPinnedCatalogSource,
1577
+ Yt as getCalculatedFieldAggregateOverrides,
1578
+ Ha as getCalculatedFieldNamespace,
1579
+ Zt as getCalculatedFieldParameters,
1580
+ ea as getCalculatedFieldShelfOverrides,
1581
+ ta as getColumnCatalogFieldId,
1582
+ Be as getDashboardAuthoringCardSource,
1583
+ Ua as getDashboardFilterSubscriptionHint,
1584
+ aa as getDomainCalculatedSelectionOverrides,
1585
+ ya as getFieldAggregationOptions,
1586
+ Wa as getMatrixBindingTargets,
1587
+ Sr as getMatrixLevelLabel,
1588
+ vr as getMatrixMeasureLabel,
1589
+ Ka as getStableDomainCalculatedFieldId,
1590
+ Ca as getTemporalBucketAuthoringOptions,
1591
+ Sa as getTemporalBucketAuthoringSelection,
1592
+ Qa as hasDashboardFilterSubscription,
1593
+ Ja as isDashboardFilterOperationCompatible,
1594
+ A as isMaterializableDashboardAuthoringSource,
1595
+ va as isSemaphorCartesianChartType,
1596
+ xe as isSemaphorSourceRef,
1597
+ Ta as linkedClickToFilterOverridesSchema,
1598
+ ra as matrixCatalogSources,
1599
+ Fr as matrixDefinitionFields,
1600
+ wr as matrixDefinitionSources,
1601
+ na as matrixExecutionSources,
1497
1602
  $ as mergeDashboardAuthoringSources,
1498
- dr as mergeMatrixSorts,
1499
- Ba as moveMatrixLevel,
1500
- Pa as normalizeDashboardInputs,
1501
- xe as preferDashboardAuthoringSourceMetadata,
1502
- wt as preferredDashboardAuthoringSource,
1503
- ga as previewTemporalBucketAuthoringFormat,
1504
- Va as readExactDomainCalculatedFieldReference,
1505
- pr as readMatrixCardConfig,
1506
- qa as rebindDashboardOptionDependencyInputId,
1507
- za as reconcileMatrixSpecStructure,
1508
- ba as reconcileTemporalBucketAuthoringFormat,
1509
- ja as requireNormalizedDashboardInputs,
1510
- Jt as resolveBindingControlValue,
1511
- er as resolveCanonicalDetailResultRawKey,
1512
- tr as resolveCanonicalResultOutputKey,
1513
- ar as resolveCanonicalResultRawKey,
1514
- Ae as resolveDashboardAuthoringSource,
1515
- Ia as resolveDashboardEntitySource,
1516
- Ha as resolveDashboardFilterAutomaticTarget,
1517
- Ga as resolveDashboardFilterInheritedTarget,
1518
- Ua as resolveDashboardOptionDependencies,
1519
- Wa as resolveDashboardOptionPopulation,
1520
- Ka as resolveDashboardSqlFilterTarget,
1521
- Zt as resolveGroupByFieldTarget,
1522
- ea as resolveMatrixControlBindings,
1523
- cr as resolveMatrixDefinition,
1524
- ta as resolveMetricFieldTarget,
1525
- aa as resolveScalarMappedValue,
1526
- _a as resolveTemporalBucketAuthoringFormat,
1527
- ya as resolveTemporalResultOwner,
1528
- Qa as retainMatrixConditionalFormatting,
1529
- Xa as selectDashboardOptionDependencyInputIds,
1530
- Ca as supportsCanonicalDashboardTemporalResult,
1531
- Da as transformComparisonDocument,
1532
- Ya as updateMatrixConfig,
1533
- ra as validateControlValue,
1534
- Ee as validateDashboardAuthoringDatasetScope,
1535
- Be as validateDashboardChangePlan,
1536
- Le as validateDashboardPlan,
1537
- Ja as withDashboardOptionDependencyOverride
1603
+ Tr as mergeMatrixSorts,
1604
+ Xa as moveMatrixLevel,
1605
+ Da as normalizeClickToFilterSettings,
1606
+ Ya as normalizeDashboardInputs,
1607
+ Za as normalizeLegacyLinkedTargetOverrides,
1608
+ Ae as preferDashboardAuthoringSourceMetadata,
1609
+ Ot as preferredDashboardAuthoringSource,
1610
+ ka as previewTemporalBucketAuthoringFormat,
1611
+ er as readExactDomainCalculatedFieldReference,
1612
+ xr as readMatrixCardConfig,
1613
+ tr as rebindDashboardOptionDependencyInputId,
1614
+ ar as reconcileMatrixSpecStructure,
1615
+ Fa as reconcileTemporalBucketAuthoringFormat,
1616
+ q as remapClickToFilterReferences,
1617
+ rr as remapLinkedClickToFilterOverrides,
1618
+ nr as requireNormalizedDashboardInputs,
1619
+ ia as resolveBindingControlValue,
1620
+ gr as resolveCanonicalDetailResultRawKey,
1621
+ br as resolveCanonicalResultOutputKey,
1622
+ Ir as resolveCanonicalResultRawKey,
1623
+ Oe as resolveDashboardAuthoringSource,
1624
+ wa as resolveDashboardEntitySource,
1625
+ ir as resolveDashboardFilterAutomaticTarget,
1626
+ or as resolveDashboardFilterInheritedTarget,
1627
+ sr as resolveDashboardOptionDependencies,
1628
+ dr as resolveDashboardOptionPopulation,
1629
+ cr as resolveDashboardSqlFilterTarget,
1630
+ oa as resolveGroupByFieldTarget,
1631
+ sa as resolveMatrixControlBindings,
1632
+ Dr as resolveMatrixDefinition,
1633
+ da as resolveMetricFieldTarget,
1634
+ ca as resolveScalarMappedValue,
1635
+ xa as resolveTemporalBucketAuthoringFormat,
1636
+ Aa as resolveTemporalResultOwner,
1637
+ ve as respondsToSelectionsSchema,
1638
+ lr as retainMatrixConditionalFormatting,
1639
+ ur as selectDashboardOptionDependencyInputIds,
1640
+ Oa as selectionFieldFromExplorerField,
1641
+ fr as stripInstanceTargetsForLibrarySave,
1642
+ Ra as supportsCanonicalDashboardTemporalResult,
1643
+ Na as transformComparisonDocument,
1644
+ pr as updateMatrixConfig,
1645
+ la as validateControlValue,
1646
+ Pe as validateDashboardAuthoringDatasetScope,
1647
+ qe as validateDashboardChangePlan,
1648
+ ze as validateDashboardPlan,
1649
+ hr as withDashboardOptionDependencyOverride
1538
1650
  };