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,26 +1,26 @@
1
- import { toSemaphorInputSnapshots as Gr, toSemaphorInputBinding as Jr, toSemaphorActiveInputSnapshots as Y, toSemaphorMatrixIntent as Yr, toSemaphorSqlIntent as Xr, toSemaphorInputOptionsIntent as Zr, toSemaphorRecordsIntent as et, toSemaphorAnalysisQueryOptions as rt, toSemaphorAnalysisIntent as tt, toSemaphorMetricIntent as nt, hasSemaphorInputValue as ce, normalizeSemaphorInputOptions as vr, toSemaphorInputSpec as wr } from "../data-app-sdk-adapters/index.js";
2
- import { jsxs as p, Fragment as Sr, jsx as l } from "react/jsx-runtime";
3
- import { createContext as qe, useContext as Q, useState as z, useRef as E, useEffect as B, useMemo as I, Fragment as it, useId as Ir, useCallback as D, useReducer as ot } from "react";
4
- import { q as st, u as at, ac as lt, aW as Ie } from "../chunks/validators-BDYzZFgs.js";
5
- import { l as ho, b0 as bo } from "../chunks/validators-BDYzZFgs.js";
6
- import { u as dt, N as ut, L as ct } from "../chunks/matrix-operation-contract-Cqy4EW2H.js";
7
- import { m as or } from "../chunks/matrix-formatter-xsq7n_e6.js";
8
- import { M as ft, a as pt, S as gt, E as mt, C as yt } from "../chunks/search-BHsQIWBV.js";
9
- import { X as ht, C as bt, j as vt } from "../chunks/x-CXDkqdur.js";
10
- function ye(e, r, t) {
1
+ import { toSemaphorInputSnapshots as rt, toSemaphorInputBinding as tt, toSemaphorSelectionSnapshots as nt, toSemaphorActiveInputSnapshots as X, toSemaphorMatrixIntent as it, toSemaphorSqlIntent as ot, toSemaphorInputOptionsIntent as st, toSemaphorRecordsIntent as at, toSemaphorAnalysisQueryOptions as lt, toSemaphorAnalysisIntent as dt, toSemaphorMetricIntent as ut, hasSemaphorInputValue as fe, normalizeSemaphorInputOptions as qr, toSemaphorInputSpec as Ar } from "../data-app-sdk-adapters/index.js";
2
+ import { jsxs as p, Fragment as Tr, jsx as l } from "react/jsx-runtime";
3
+ import { createContext as Ae, useContext as Q, useState as _, useRef as T, useEffect as B, useMemo as x, Fragment as ct, useId as kr, useCallback as L, useReducer as ft } from "react";
4
+ import { q as pt, u as gt, ac as mt, aW as xe, k as yt } from "../chunks/validators-BDYzZFgs.js";
5
+ import { l as ko, b0 as Co } from "../chunks/validators-BDYzZFgs.js";
6
+ import { Q as ht, a6 as bt, a5 as vt, D as sr, t as ar, L as St } from "../chunks/matrix-operation-contract-xL8IhFzp.js";
7
+ import { m as lr } from "../chunks/matrix-formatter-ZVS5QOuq.js";
8
+ import { M as wt, a as It, S as xt, E as qt, C as At, r as dr } from "../chunks/selection-reducer-B94WgZ9V.js";
9
+ import { X as Tt, C as kt, j as Ct } from "../chunks/x-CXDkqdur.js";
10
+ function he(e, r, t) {
11
11
  return {
12
12
  ...t,
13
13
  name: e,
14
14
  role: r
15
15
  };
16
16
  }
17
- function io(e) {
17
+ function go(e) {
18
18
  return e;
19
19
  }
20
- function oo(e) {
20
+ function mo(e) {
21
21
  return e;
22
22
  }
23
- const so = {
23
+ const yo = {
24
24
  source: {
25
25
  semantic(e) {
26
26
  return {
@@ -37,16 +37,16 @@ const so = {
37
37
  },
38
38
  field: {
39
39
  measure(e, r = {}) {
40
- return ye(e, "measure", r);
40
+ return he(e, "measure", r);
41
41
  },
42
42
  dimension(e, r = {}) {
43
- return ye(e, "dimension", r);
43
+ return he(e, "dimension", r);
44
44
  },
45
45
  date(e, r = {}) {
46
- return ye(e, "date", r);
46
+ return he(e, "date", r);
47
47
  },
48
48
  id(e, r = {}) {
49
- return ye(e, "id", r);
49
+ return he(e, "id", r);
50
50
  }
51
51
  },
52
52
  filter(e) {
@@ -55,10 +55,16 @@ const so = {
55
55
  kind: "filter"
56
56
  };
57
57
  },
58
+ selection(e) {
59
+ return {
60
+ ...e,
61
+ kind: "selection"
62
+ };
63
+ },
58
64
  bindInput(e, r) {
59
65
  return {
60
66
  toAnalyticsInput() {
61
- const [t] = Gr([e]), n = Jr({
67
+ const [t] = rt([e]), n = tt({
62
68
  ...r,
63
69
  inputId: r.inputId || t.inputId
64
70
  });
@@ -130,13 +136,13 @@ const so = {
130
136
  queryKind: "matrix"
131
137
  };
132
138
  }
133
- }, fe = 10, Ne = 8;
134
- function Pe(e, r) {
139
+ }, pe = 10, Ne = 8;
140
+ function He(e, r) {
135
141
  const t = e == null ? void 0 : e.result;
136
142
  if (t)
137
143
  switch (t.kind) {
138
144
  case "records":
139
- return de({
145
+ return ue({
140
146
  title: "Records",
141
147
  rowNoun: "rows",
142
148
  records: t.records,
@@ -144,7 +150,7 @@ function Pe(e, r) {
144
150
  rowCount: t.rowCount
145
151
  });
146
152
  case "sql":
147
- return de({
153
+ return ue({
148
154
  title: "SQL Rows",
149
155
  rowNoun: "rows",
150
156
  records: t.records,
@@ -152,10 +158,10 @@ function Pe(e, r) {
152
158
  rowCount: t.rowCount
153
159
  });
154
160
  case "inputOptions":
155
- return de({
161
+ return ue({
156
162
  title: "Options",
157
163
  rowNoun: "options",
158
- records: t.options.slice(0, fe).map((n) => {
164
+ records: t.options.slice(0, pe).map((n) => {
159
165
  var i;
160
166
  return {
161
167
  label: n.label,
@@ -173,16 +179,16 @@ function Pe(e, r) {
173
179
  rowCount: t.rowCount ?? t.options.length
174
180
  });
175
181
  case "metric":
176
- return wt(t, r);
182
+ return Et(t, r);
177
183
  case "matrix":
178
- return de({
184
+ return ue({
179
185
  title: "Matrix Cells",
180
186
  rowNoun: "cells",
181
- records: t.window.blocks.flatMap((n) => n.cells).slice(0, fe).map((n) => {
187
+ records: t.window.blocks.flatMap((n) => n.cells).slice(0, pe).map((n) => {
182
188
  const i = t.window.descriptors.measures.find((o) => o.id === n.measureId);
183
189
  return {
184
- row: or(n.rowPath),
185
- column: or(n.columnPath),
190
+ row: lr(n.rowPath),
191
+ column: lr(n.columnPath),
186
192
  measure: (i == null ? void 0 : i.column.label) || n.measureId,
187
193
  value: n.value
188
194
  };
@@ -196,11 +202,11 @@ function Pe(e, r) {
196
202
  rowCount: t.window.blocks.reduce((n, i) => n + i.cells.length, 0)
197
203
  });
198
204
  default:
199
- return It(t);
205
+ return Lt(t);
200
206
  }
201
207
  }
202
- function wt(e, r) {
203
- var o, s, c, u, f;
208
+ function Et(e, r) {
209
+ var o, s, f, c, u;
204
210
  const t = [
205
211
  {
206
212
  metric: "primaryValue",
@@ -214,19 +220,19 @@ function wt(e, r) {
214
220
  },
215
221
  {
216
222
  metric: "delta",
217
- value: (r == null ? void 0 : r.delta) ?? ((c = e.comparison) == null ? void 0 : c.delta)
223
+ value: (r == null ? void 0 : r.delta) ?? ((f = e.comparison) == null ? void 0 : f.delta)
218
224
  },
219
225
  {
220
226
  metric: "deltaPercent",
221
- value: (r == null ? void 0 : r.deltaPercent) ?? ((u = e.comparison) == null ? void 0 : u.deltaPercent)
227
+ value: (r == null ? void 0 : r.deltaPercent) ?? ((c = e.comparison) == null ? void 0 : c.deltaPercent)
222
228
  }
223
- ), (((f = r == null ? void 0 : r.missingMeasures) == null ? void 0 : f.filter(Boolean)) ?? []).forEach((g) => {
229
+ ), (((u = r == null ? void 0 : r.missingMeasures) == null ? void 0 : u.filter(Boolean)) ?? []).forEach((g) => {
224
230
  t.push({ metric: `missing:${g}`, value: "missing" });
225
231
  }), Object.entries((r == null ? void 0 : r.measures) ?? {}).sort(([g], [m]) => g.localeCompare(m)).forEach(([g, m]) => {
226
232
  t.push({ metric: `measure:${g}`, value: m });
227
233
  }), Object.entries((r == null ? void 0 : r.measureBindings) ?? {}).sort(([g], [m]) => g.localeCompare(m)).forEach(([g, m]) => {
228
234
  t.push({ metric: `binding:${g}`, value: m });
229
- }), de({
235
+ }), ue({
230
236
  title: "Metric",
231
237
  rowNoun: "values",
232
238
  records: t,
@@ -237,98 +243,98 @@ function wt(e, r) {
237
243
  rowCount: t.length
238
244
  });
239
245
  }
240
- function de({
246
+ function ue({
241
247
  title: e,
242
248
  rowNoun: r,
243
249
  records: t,
244
250
  columns: n,
245
251
  rowCount: i
246
252
  }) {
247
- const o = St(n, t);
253
+ const o = Rt(n, t);
248
254
  if (!o.length)
249
255
  return;
250
- const s = i ?? t.length, c = t.slice(0, fe);
256
+ const s = i ?? t.length, f = t.slice(0, pe);
251
257
  return {
252
258
  title: e,
253
- summary: `${qt(s)} ${r}`,
259
+ summary: `${Ot(s)} ${r}`,
254
260
  columns: o.slice(0, Ne),
255
- rows: c,
256
- truncatedRows: s > c.length,
261
+ rows: f,
262
+ truncatedRows: s > f.length,
257
263
  truncatedColumns: o.length > Ne
258
264
  };
259
265
  }
260
- function St(e, r) {
266
+ function Rt(e, r) {
261
267
  if (e != null && e.length)
262
268
  return e.filter((n) => n.key).map((n) => ({
263
269
  key: n.key,
264
270
  label: n.label || n.key
265
271
  }));
266
272
  const t = /* @__PURE__ */ new Set();
267
- return r.slice(0, fe).forEach((n) => {
273
+ return r.slice(0, pe).forEach((n) => {
268
274
  Object.keys(n).forEach((i) => t.add(i));
269
275
  }), [...t].map((n) => ({ key: n, label: n }));
270
276
  }
271
- function It(e) {
272
- throw new Error(`Unhandled Semaphor result kind: ${xr(e)}`);
277
+ function Lt(e) {
278
+ throw new Error(`Unhandled Semaphor result kind: ${Cr(e)}`);
273
279
  }
274
- function xt(e) {
275
- return e === null ? "null" : e === void 0 ? "" : typeof e == "string" ? sr(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : sr(xr(e));
280
+ function $t(e) {
281
+ return e === null ? "null" : e === void 0 ? "" : typeof e == "string" ? ur(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : ur(Cr(e));
276
282
  }
277
- function qt(e) {
283
+ function Ot(e) {
278
284
  return typeof e == "number" ? e.toLocaleString() : "-";
279
285
  }
280
- function xr(e) {
286
+ function Cr(e) {
281
287
  return JSON.stringify(e, null, 2) ?? "undefined";
282
288
  }
283
- function sr(e) {
289
+ function ur(e) {
284
290
  return e.length > 80 ? `${e.slice(0, 77)}...` : e;
285
291
  }
286
- function Ae(e) {
292
+ function Te(e) {
287
293
  return e.viewTitle || e.queryLabel || e.viewId || e.queryId;
288
294
  }
289
- function At(e) {
295
+ function Dt(e) {
290
296
  if (e.label)
291
297
  return e.label;
292
298
  if (e.queryKind !== "inputOptions")
293
299
  return;
294
300
  const t = e.labelField.label || e.valueField.label || e.labelField.name || e.valueField.name || e.inputId;
295
- return `${Tt(t)} Options`;
301
+ return `${Bt(t)} Options`;
296
302
  }
297
- function Tt(e) {
303
+ function Bt(e) {
298
304
  return (e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\bfilter\b/gi, " ").replace(/\boptions?\b/gi, " ").replace(/\bid\b/gi, " ").replace(/\s+/g, " ").trim() || e).split(" ").filter(Boolean).map((n) => n === n.toUpperCase() && n.length > 1 ? n : `${n.slice(0, 1).toUpperCase()}${n.slice(1)}`).join(" ");
299
305
  }
300
- function He(e) {
306
+ function Ve(e) {
301
307
  return e.flatMap((r) => {
302
- var g, m, v, y;
303
- const t = r.latestAttempt, n = t == null ? void 0 : t.executionResult, i = Ee(
308
+ var g, m, h, S;
309
+ const t = r.latestAttempt, n = t == null ? void 0 : t.executionResult, i = Re(
304
310
  (g = n == null ? void 0 : n.validation) == null ? void 0 : g.warnings
305
- ), o = Ee(
311
+ ), o = Re(
306
312
  (m = n == null ? void 0 : n.validation) == null ? void 0 : m.errors
307
- ), s = Rt(
308
- (v = n == null ? void 0 : n.coverage) == null ? void 0 : v.missingObligations
309
- ), c = Ee(
310
- (y = n == null ? void 0 : n.coverage) == null ? void 0 : y.warnings
311
- ), u = [], f = Ae(r);
312
- (t == null ? void 0 : t.status) === "error" && u.push({
313
+ ), s = Nt(
314
+ (h = n == null ? void 0 : n.coverage) == null ? void 0 : h.missingObligations
315
+ ), f = Re(
316
+ (S = n == null ? void 0 : n.coverage) == null ? void 0 : S.warnings
317
+ ), c = [], u = Te(r);
318
+ (t == null ? void 0 : t.status) === "error" && c.push({
313
319
  trace: r,
314
320
  tone: "error",
315
- title: f,
321
+ title: u,
316
322
  message: t.errorMessage || "Query attempt failed."
317
323
  });
318
324
  for (const b of r.clientWarnings)
319
- u.push({ trace: r, tone: "warning", title: f, message: b });
325
+ c.push({ trace: r, tone: "warning", title: u, message: b });
320
326
  for (const b of i)
321
- u.push({ trace: r, tone: "warning", title: f, ...b });
327
+ c.push({ trace: r, tone: "warning", title: u, ...b });
322
328
  for (const b of o)
323
- u.push({ trace: r, tone: "error", title: f, ...b });
329
+ c.push({ trace: r, tone: "error", title: u, ...b });
324
330
  for (const b of s)
325
- u.push({ trace: r, tone: "warning", title: f, message: b });
326
- for (const b of c)
327
- u.push({ trace: r, tone: "warning", title: f, ...b });
328
- return u;
331
+ c.push({ trace: r, tone: "warning", title: u, message: b });
332
+ for (const b of f)
333
+ c.push({ trace: r, tone: "warning", title: u, ...b });
334
+ return c;
329
335
  });
330
336
  }
331
- function kt(e) {
337
+ function Kt(e) {
332
338
  return {
333
339
  traceId: e.trace.traceId,
334
340
  queryId: e.trace.queryId,
@@ -342,19 +348,19 @@ function kt(e) {
342
348
  path: e.path
343
349
  };
344
350
  }
345
- function Ct(e, r) {
351
+ function Wt(e, r) {
346
352
  return e.filter((t) => t.trace.traceId === r.traceId).length;
347
353
  }
348
- function Et(e) {
349
- const r = He(e), t = e.filter(
354
+ function Mt(e) {
355
+ const r = Ve(e), t = e.filter(
350
356
  (s) => {
351
- var c;
352
- return ((c = s.latestAttempt) == null ? void 0 : c.status) === "error";
357
+ var f;
358
+ return ((f = s.latestAttempt) == null ? void 0 : f.status) === "error";
353
359
  }
354
360
  ).length, n = e.filter(
355
361
  (s) => {
356
- var c;
357
- return ((c = s.latestAttempt) == null ? void 0 : c.status) === "loading";
362
+ var f;
363
+ return ((f = s.latestAttempt) == null ? void 0 : f.status) === "loading";
358
364
  }
359
365
  ).length, i = r.filter((s) => s.tone === "error").length, o = r.filter((s) => s.tone === "warning").length;
360
366
  return {
@@ -367,15 +373,15 @@ function Et(e) {
367
373
  severity: t || i ? "error" : o ? "warning" : n ? "loading" : "ok"
368
374
  };
369
375
  }
370
- function Rt(e) {
376
+ function Nt(e) {
371
377
  return Array.isArray(e) ? e.filter((r) => typeof r == "string") : [];
372
378
  }
373
- function Ee(e) {
374
- return Array.isArray(e) ? e.map(Lt).filter(
379
+ function Re(e) {
380
+ return Array.isArray(e) ? e.map(_t).filter(
375
381
  (r) => !!r
376
382
  ) : [];
377
383
  }
378
- function Lt(e) {
384
+ function _t(e) {
379
385
  if (typeof e == "string")
380
386
  return { message: e };
381
387
  if (!e || typeof e != "object" || Array.isArray(e))
@@ -390,10 +396,10 @@ function Lt(e) {
390
396
  ...i ? { path: i } : {}
391
397
  } : n ? { message: n, code: n } : void 0;
392
398
  }
393
- function $t(e) {
399
+ function Ft(e) {
394
400
  if (!e.enabled)
395
401
  return e;
396
- const r = e.queries.map(qr);
402
+ const r = e.queries.map(Er);
397
403
  return {
398
404
  enabled: e.enabled,
399
405
  queries: r,
@@ -402,29 +408,29 @@ function $t(e) {
402
408
  getQueries: (t) => r.filter((n) => n.queryId === t)
403
409
  };
404
410
  }
405
- function ar(e) {
406
- return e ? qr(e) : void 0;
411
+ function cr(e) {
412
+ return e ? Er(e) : void 0;
407
413
  }
408
- function qr(e) {
414
+ function Er(e) {
409
415
  var r;
410
416
  return (r = e == null ? void 0 : e.latestAttempt) != null && r.executionResult ? {
411
417
  ...e,
412
418
  latestAttempt: {
413
419
  ...e.latestAttempt,
414
- resultPreview: e.latestAttempt.resultPreview || Pe(e.latestAttempt.executionResult),
415
- executionResult: Ot(
420
+ resultPreview: e.latestAttempt.resultPreview || He(e.latestAttempt.executionResult),
421
+ executionResult: zt(
416
422
  e.latestAttempt.executionResult
417
423
  )
418
424
  }
419
425
  } : e;
420
426
  }
421
- function Ot(e) {
427
+ function zt(e) {
422
428
  const {
423
429
  compiledQuery: r,
424
430
  intent: t,
425
431
  result: n,
426
432
  ...i
427
- } = e, o = Dt(
433
+ } = e, o = jt(
428
434
  i.metadata
429
435
  );
430
436
  return {
@@ -432,7 +438,7 @@ function Ot(e) {
432
438
  ...o ? { metadata: o } : {}
433
439
  };
434
440
  }
435
- function Dt(e) {
441
+ function jt(e) {
436
442
  if (!e || typeof e != "object" || Array.isArray(e))
437
443
  return e;
438
444
  const r = e.dataAppDebug;
@@ -444,7 +450,7 @@ function Dt(e) {
444
450
  dataAppDebug: n
445
451
  };
446
452
  }
447
- function Bt(e) {
453
+ function Pt(e) {
448
454
  return e === "relative" ? {
449
455
  position: "relative",
450
456
  top: "auto",
@@ -458,7 +464,7 @@ function Bt(e) {
458
464
  left: e.endsWith("left") ? 20 : "auto"
459
465
  };
460
466
  }
461
- function Kt(e) {
467
+ function Ht(e) {
462
468
  return e === "error" ? {
463
469
  borderColor: "var(--sd-error-border)",
464
470
  background: "var(--sd-error-bg)",
@@ -477,7 +483,7 @@ function Kt(e) {
477
483
  color: "var(--sd-success-fg)"
478
484
  };
479
485
  }
480
- function Wt(e) {
486
+ function Vt(e) {
481
487
  return e === "right" ? {
482
488
  top: 16,
483
489
  right: 16,
@@ -496,23 +502,23 @@ function Wt(e) {
496
502
  borderRadius: 6
497
503
  };
498
504
  }
499
- function Nt(e) {
505
+ function Qt(e) {
500
506
  return e === "right" ? {
501
507
  gridTemplateColumns: "minmax(210px, 280px) minmax(0, 1fr)"
502
508
  } : {
503
509
  gridTemplateColumns: "minmax(260px, 340px) minmax(0, 1fr)"
504
510
  };
505
511
  }
506
- function Mt(e) {
512
+ function Ut(e) {
507
513
  return {
508
514
  borderRight: "1px solid var(--sd-border)",
509
515
  borderBottom: 0
510
516
  };
511
517
  }
512
- function Ar(e) {
518
+ function Rr(e) {
513
519
  return e === "error" ? { background: "var(--sd-error-dot)" } : e === "success" ? { background: "var(--sd-success-dot)" } : e === "loading" ? { background: "var(--sd-loading-dot)" } : { background: "var(--sd-idle-dot)" };
514
520
  }
515
- function _t(e) {
521
+ function Gt(e) {
516
522
  return e === "error" ? {
517
523
  borderColor: "var(--sd-error-border)",
518
524
  color: "var(--sd-error-fg)"
@@ -527,7 +533,7 @@ function _t(e) {
527
533
  color: "var(--sd-fg-muted)"
528
534
  };
529
535
  }
530
- const lr = "semaphor-devtools-stylesheet", R = "semaphor-devtools", Ft = `
536
+ const fr = "semaphor-devtools-stylesheet", R = "semaphor-devtools", Jt = `
531
537
  .${R} {
532
538
  --sd-bg: #ffffff;
533
539
  --sd-bg-muted: #fafafa;
@@ -644,13 +650,13 @@ const lr = "semaphor-devtools-stylesheet", R = "semaphor-devtools", Ft = `
644
650
  color: var(--sd-fg);
645
651
  }
646
652
  `;
647
- function Tr() {
648
- if (typeof document > "u" || document.getElementById(lr))
653
+ function Lr() {
654
+ if (typeof document > "u" || document.getElementById(fr))
649
655
  return;
650
656
  const e = document.createElement("style");
651
- e.id = lr, e.textContent = Ft, document.head.appendChild(e);
657
+ e.id = fr, e.textContent = Jt, document.head.appendChild(e);
652
658
  }
653
- const he = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', W = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", ae = {
659
+ const be = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', W = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", le = {
654
660
  color: "var(--sd-fg-muted)",
655
661
  fontSize: 10,
656
662
  fontWeight: 600,
@@ -672,7 +678,7 @@ const a = {
672
678
  borderStyle: "solid",
673
679
  borderRadius: 6,
674
680
  boxShadow: "var(--sd-shadow)",
675
- font: `600 12px/1.2 ${he}`,
681
+ font: `600 12px/1.2 ${be}`,
676
682
  cursor: "pointer"
677
683
  },
678
684
  launcherText: {
@@ -717,7 +723,7 @@ const a = {
717
723
  background: "var(--sd-bg)",
718
724
  color: "var(--sd-fg)",
719
725
  boxShadow: "var(--sd-shadow)",
720
- font: `13px/1.4 ${he}`
726
+ font: `13px/1.4 ${be}`
721
727
  },
722
728
  panelFullscreen: {
723
729
  top: 0,
@@ -786,7 +792,7 @@ const a = {
786
792
  outline: 0,
787
793
  background: "transparent",
788
794
  color: "var(--sd-fg)",
789
- font: `12px/1.4 ${he}`
795
+ font: `12px/1.4 ${be}`
790
796
  },
791
797
  issueSummary: {
792
798
  margin: "0 10px 10px",
@@ -809,7 +815,7 @@ const a = {
809
815
  background: "transparent",
810
816
  color: "inherit",
811
817
  cursor: "pointer",
812
- ...ae
818
+ ...le
813
819
  },
814
820
  issueSummaryHeaderLabel: {
815
821
  display: "inline-flex",
@@ -916,7 +922,7 @@ const a = {
916
922
  alignItems: "center",
917
923
  justifyContent: "space-between",
918
924
  padding: "4px 6px 3px",
919
- ...ae
925
+ ...le
920
926
  },
921
927
  queryGroupCount: {
922
928
  color: "var(--sd-fg-subtle)",
@@ -1189,14 +1195,14 @@ const a = {
1189
1195
  },
1190
1196
  sectionTitle: {
1191
1197
  marginBottom: 8,
1192
- ...ae
1198
+ ...le
1193
1199
  },
1194
1200
  disclosure: {
1195
1201
  marginTop: 16
1196
1202
  },
1197
1203
  disclosureSummary: {
1198
1204
  cursor: "pointer",
1199
- ...ae
1205
+ ...le
1200
1206
  },
1201
1207
  disclosureBody: {
1202
1208
  marginTop: 8
@@ -1535,7 +1541,7 @@ const a = {
1535
1541
  gap: 5
1536
1542
  },
1537
1543
  codeBlockLabel: {
1538
- ...ae
1544
+ ...le
1539
1545
  },
1540
1546
  codeBlock: {
1541
1547
  maxHeight: 260,
@@ -1568,7 +1574,7 @@ const a = {
1568
1574
  borderStyle: "solid",
1569
1575
  borderRadius: 5,
1570
1576
  background: "var(--sd-bg)",
1571
- font: `600 11px/1 ${he}`,
1577
+ font: `600 11px/1 ${be}`,
1572
1578
  cursor: "pointer"
1573
1579
  },
1574
1580
  inspectButtonText: {
@@ -1576,129 +1582,129 @@ const a = {
1576
1582
  textOverflow: "ellipsis",
1577
1583
  whiteSpace: "nowrap"
1578
1584
  }
1579
- }, Re = 10, Le = 100, zt = 25, jt = 500, kr = {
1585
+ }, Le = 10, $e = 100, Yt = 25, Xt = 500, $r = {
1580
1586
  enabled: !1,
1581
1587
  queries: [],
1582
1588
  issues: [],
1583
1589
  getQuery: () => {
1584
1590
  },
1585
1591
  getQueries: () => []
1586
- }, Ve = qe(null), Qe = qe(null), Ue = qe(
1592
+ }, Qe = Ae(null), Ue = Ae(null), Ge = Ae(
1587
1593
  void 0
1588
1594
  ), V = [];
1589
- function Pt({
1595
+ function Zt({
1590
1596
  debug: e,
1591
1597
  children: r
1592
1598
  }) {
1593
- const t = I(() => Vn(e), [e]), [n, i] = ot(
1594
- Mn,
1599
+ const t = x(() => ri(e), [e]), [n, i] = ft(
1600
+ Un,
1595
1601
  t,
1596
- Br
1597
- ), o = E(n), s = Ir(), [c, u] = z({ open: !1 });
1602
+ _r
1603
+ ), o = T(n), s = kr(), [f, c] = _({ open: !1 });
1598
1604
  o.current = n, B(() => {
1599
1605
  i({ type: "config", config: t });
1600
1606
  }, [t]), B(() => {
1601
1607
  if (!n.enabled || !n.exposeWindowBridge || typeof window > "u")
1602
1608
  return;
1603
- const b = Hn(() => o.current);
1604
- return Ht({
1609
+ const b = ei(() => o.current);
1610
+ return en({
1605
1611
  ownerId: s,
1606
1612
  bridge: b
1607
1613
  }), () => {
1608
- Vt(s);
1614
+ rn(s);
1609
1615
  };
1610
1616
  }, [s, n.enabled, n.exposeWindowBridge]);
1611
- const f = I(() => ({ state: n, dispatch: i }), [n]), g = D((b) => {
1612
- u({ open: !0, focus: b });
1613
- }, []), m = D(() => {
1614
- u((b) => ({ ...b, open: !1 }));
1615
- }, []), v = D((b) => {
1616
- u({ open: !0, focus: b });
1617
- }, []), y = I(
1617
+ const u = x(() => ({ state: n, dispatch: i }), [n]), g = L((b) => {
1618
+ c({ open: !0, focus: b });
1619
+ }, []), m = L(() => {
1620
+ c((b) => ({ ...b, open: !1 }));
1621
+ }, []), h = L((b) => {
1622
+ c({ open: !0, focus: b });
1623
+ }, []), S = x(
1618
1624
  () => ({
1619
- open: c.open,
1620
- focus: c.focus,
1625
+ open: f.open,
1626
+ focus: f.focus,
1621
1627
  openDevtools: g,
1622
1628
  closeDevtools: m,
1623
- focusTrace: v
1629
+ focusTrace: h
1624
1630
  }),
1625
1631
  [
1626
1632
  m,
1627
- v,
1633
+ h,
1628
1634
  g,
1629
- c.focus,
1630
- c.open
1635
+ f.focus,
1636
+ f.open
1631
1637
  ]
1632
1638
  );
1633
- return /* @__PURE__ */ l(Ve.Provider, { value: f, children: /* @__PURE__ */ l(Qe.Provider, { value: y, children: r }) });
1639
+ return /* @__PURE__ */ l(Qe.Provider, { value: u, children: /* @__PURE__ */ l(Ue.Provider, { value: S, children: r }) });
1634
1640
  }
1635
- function Ht(e) {
1641
+ function en(e) {
1636
1642
  const r = V.findIndex(
1637
1643
  (t) => t.ownerId === e.ownerId
1638
1644
  );
1639
- r >= 0 && V.splice(r, 1), V.push(e), Cr();
1645
+ r >= 0 && V.splice(r, 1), V.push(e), Or();
1640
1646
  }
1641
- function Vt(e) {
1647
+ function rn(e) {
1642
1648
  const r = V.findIndex(
1643
1649
  (t) => t.ownerId === e
1644
1650
  );
1645
- r >= 0 && V.splice(r, 1), Cr();
1651
+ r >= 0 && V.splice(r, 1), Or();
1646
1652
  }
1647
- function Cr() {
1653
+ function Or() {
1648
1654
  if (typeof window > "u")
1649
1655
  return;
1650
1656
  const e = V[V.length - 1];
1651
1657
  e ? window.__SEMAPHOR_DEVTOOLS__ = e.bridge : delete window.__SEMAPHOR_DEVTOOLS__;
1652
1658
  }
1653
- function ao({
1659
+ function ho({
1654
1660
  id: e,
1655
1661
  title: r,
1656
1662
  children: t
1657
1663
  }) {
1658
- const n = I(() => ({ id: e, title: r }), [e, r]);
1659
- return /* @__PURE__ */ l(Ue.Provider, { value: n, children: t });
1664
+ const n = x(() => ({ id: e, title: r }), [e, r]);
1665
+ return /* @__PURE__ */ l(Ge.Provider, { value: n, children: t });
1660
1666
  }
1661
- function Qt({
1667
+ function tn({
1662
1668
  buttonPosition: e = "bottom-right",
1663
1669
  initialIsOpen: r = !1,
1664
1670
  panelPosition: t = "right",
1665
1671
  className: n,
1666
1672
  style: i
1667
1673
  } = {}) {
1668
- const o = Er(), s = Q(Qe), [c, u] = z(""), [f, g] = z(!1), m = E(null), v = E(null), y = s == null ? void 0 : s.openDevtools, b = s == null ? void 0 : s.closeDevtools, T = (s == null ? void 0 : s.open) === !0;
1674
+ const o = Dr(), s = Q(Ue), [f, c] = _(""), [u, g] = _(!1), m = T(null), h = T(null), S = s == null ? void 0 : s.openDevtools, b = s == null ? void 0 : s.closeDevtools, w = (s == null ? void 0 : s.open) === !0;
1669
1675
  B(() => {
1670
- Tr();
1676
+ Lr();
1671
1677
  }, []), B(() => {
1672
- r && o.enabled && (y == null || y());
1673
- }, [r, o.enabled, y]), B(() => {
1674
- if (!T || !b)
1678
+ r && o.enabled && (S == null || S());
1679
+ }, [r, o.enabled, S]), B(() => {
1680
+ if (!w || !b)
1675
1681
  return;
1676
- const w = (S) => {
1677
- var x, O;
1678
- const L = S.target;
1679
- L instanceof Node && ((x = m.current) != null && x.contains(L) || (O = v.current) != null && O.contains(L) || b());
1682
+ const v = (I) => {
1683
+ var q, D;
1684
+ const $ = I.target;
1685
+ $ instanceof Node && ((q = m.current) != null && q.contains($) || (D = h.current) != null && D.contains($) || b());
1680
1686
  };
1681
- return document.addEventListener("pointerdown", w, !0), document.addEventListener("mousedown", w, !0), document.addEventListener("click", w, !0), () => {
1682
- document.removeEventListener("pointerdown", w, !0), document.removeEventListener("mousedown", w, !0), document.removeEventListener("click", w, !0);
1687
+ return document.addEventListener("pointerdown", v, !0), document.addEventListener("mousedown", v, !0), document.addEventListener("click", v, !0), () => {
1688
+ document.removeEventListener("pointerdown", v, !0), document.removeEventListener("mousedown", v, !0), document.removeEventListener("click", v, !0);
1683
1689
  };
1684
- }, [b, T]);
1685
- const d = I(
1686
- () => Et(o.queries),
1690
+ }, [b, w]);
1691
+ const d = x(
1692
+ () => Mt(o.queries),
1687
1693
  [o.queries]
1688
- ), h = I(
1689
- () => He(o.queries),
1694
+ ), y = x(
1695
+ () => Ve(o.queries),
1690
1696
  [o.queries]
1691
- ), K = mn(d), k = I(
1692
- () => yn(o.queries, c),
1693
- [o.queries, c]
1694
- ), M = I(
1695
- () => hn(k),
1696
- [k]
1697
- ), $ = I(
1698
- () => Rr(k, s == null ? void 0 : s.focus) || k[0],
1699
- [k, s == null ? void 0 : s.focus]
1697
+ ), K = qn(d), C = x(
1698
+ () => An(o.queries, f),
1699
+ [o.queries, f]
1700
+ ), N = x(
1701
+ () => Tn(C),
1702
+ [C]
1703
+ ), O = x(
1704
+ () => Br(C, s == null ? void 0 : s.focus) || C[0],
1705
+ [C, s == null ? void 0 : s.focus]
1700
1706
  );
1701
- return !o.enabled || !s ? null : /* @__PURE__ */ p(Sr, { children: [
1707
+ return !o.enabled || !s ? null : /* @__PURE__ */ p(Tr, { children: [
1702
1708
  /* @__PURE__ */ p(
1703
1709
  "button",
1704
1710
  {
@@ -1709,23 +1715,23 @@ function Qt({
1709
1715
  className: n ? `${R} ${n}` : R,
1710
1716
  style: {
1711
1717
  ...a.launcher,
1712
- ...Bt(e),
1713
- ...Kt(d.severity),
1718
+ ...Pt(e),
1719
+ ...Ht(d.severity),
1714
1720
  ...i
1715
1721
  },
1716
1722
  onClick: () => {
1717
- var S;
1718
- const w = (S = h[0]) == null ? void 0 : S.trace;
1723
+ var I;
1724
+ const v = (I = y[0]) == null ? void 0 : I.trace;
1719
1725
  s.openDevtools(
1720
- w ? {
1721
- traceId: w.traceId,
1722
- queryId: w.queryId,
1723
- viewId: w.viewId
1726
+ v ? {
1727
+ traceId: v.traceId,
1728
+ queryId: v.queryId,
1729
+ viewId: v.viewId
1724
1730
  } : void 0
1725
1731
  );
1726
1732
  },
1727
1733
  children: [
1728
- /* @__PURE__ */ l(Gt, {}),
1734
+ /* @__PURE__ */ l(on, {}),
1729
1735
  /* @__PURE__ */ l("span", { style: a.launcherText, children: d.total }),
1730
1736
  d.issueCount > 0 ? /* @__PURE__ */ p("span", { style: a.launcherIssueCount, children: [
1731
1737
  d.issueCount,
@@ -1738,15 +1744,15 @@ function Qt({
1738
1744
  s.open ? /* @__PURE__ */ p(
1739
1745
  "div",
1740
1746
  {
1741
- ref: v,
1747
+ ref: h,
1742
1748
  role: "dialog",
1743
1749
  "aria-label": "Semaphor Inspector",
1744
1750
  "aria-modal": "false",
1745
1751
  className: R,
1746
1752
  style: {
1747
1753
  ...a.panel,
1748
- ...Wt(t),
1749
- ...f ? a.panelFullscreen : null
1754
+ ...Vt(t),
1755
+ ...u ? a.panelFullscreen : null
1750
1756
  },
1751
1757
  children: [
1752
1758
  /* @__PURE__ */ p("div", { style: a.panelHeader, children: [
@@ -1772,11 +1778,11 @@ function Qt({
1772
1778
  "button",
1773
1779
  {
1774
1780
  type: "button",
1775
- "aria-label": f ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
1776
- title: f ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
1781
+ "aria-label": u ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
1782
+ title: u ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
1777
1783
  style: a.iconButton,
1778
- onClick: () => g((w) => !w),
1779
- children: f ? /* @__PURE__ */ l(ft, { size: 15 }) : /* @__PURE__ */ l(pt, { size: 15 })
1784
+ onClick: () => g((v) => !v),
1785
+ children: u ? /* @__PURE__ */ l(wt, { size: 15 }) : /* @__PURE__ */ l(It, { size: 15 })
1780
1786
  }
1781
1787
  ),
1782
1788
  /* @__PURE__ */ l(
@@ -1786,32 +1792,32 @@ function Qt({
1786
1792
  "aria-label": "Close Semaphor Inspector",
1787
1793
  style: a.iconButton,
1788
1794
  onClick: s.closeDevtools,
1789
- children: /* @__PURE__ */ l(ht, { size: 15 })
1795
+ children: /* @__PURE__ */ l(Tt, { size: 15 })
1790
1796
  }
1791
1797
  )
1792
1798
  ] })
1793
1799
  ] }),
1794
1800
  /* @__PURE__ */ p("label", { style: a.searchBox, children: [
1795
- /* @__PURE__ */ l(gt, { size: 14 }),
1801
+ /* @__PURE__ */ l(xt, { size: 14 }),
1796
1802
  /* @__PURE__ */ l(
1797
1803
  "input",
1798
1804
  {
1799
1805
  "aria-label": "Search Semaphor traces",
1800
- value: c,
1801
- onChange: (w) => u(w.currentTarget.value),
1806
+ value: f,
1807
+ onChange: (v) => c(v.currentTarget.value),
1802
1808
  placeholder: "Search traces",
1803
1809
  style: a.searchInput
1804
1810
  }
1805
1811
  )
1806
1812
  ] }),
1807
- h.length ? /* @__PURE__ */ l(
1808
- Zt,
1813
+ y.length ? /* @__PURE__ */ l(
1814
+ dn,
1809
1815
  {
1810
- issues: h,
1811
- onSelect: (w) => s.focusTrace({
1812
- traceId: w.traceId,
1813
- queryId: w.queryId,
1814
- viewId: w.viewId
1816
+ issues: y,
1817
+ onSelect: (v) => s.focusTrace({
1818
+ traceId: v.traceId,
1819
+ queryId: v.queryId,
1820
+ viewId: v.viewId
1815
1821
  })
1816
1822
  }
1817
1823
  ) : null,
@@ -1820,7 +1826,7 @@ function Qt({
1820
1826
  {
1821
1827
  style: {
1822
1828
  ...a.panelBody,
1823
- ...Nt(t)
1829
+ ...Qt(t)
1824
1830
  },
1825
1831
  children: [
1826
1832
  /* @__PURE__ */ l(
@@ -1828,43 +1834,43 @@ function Qt({
1828
1834
  {
1829
1835
  style: {
1830
1836
  ...a.queryList,
1831
- ...Mt()
1837
+ ...Ut()
1832
1838
  },
1833
1839
  "aria-label": "Registered queries",
1834
- children: k.length ? M.map((w) => /* @__PURE__ */ p("div", { style: a.queryGroup, children: [
1840
+ children: C.length ? N.map((v) => /* @__PURE__ */ p("div", { style: a.queryGroup, children: [
1835
1841
  /* @__PURE__ */ p("div", { style: a.queryGroupHeader, children: [
1836
- /* @__PURE__ */ l("span", { children: w.title }),
1837
- /* @__PURE__ */ l("span", { style: a.queryGroupCount, children: w.traces.length })
1842
+ /* @__PURE__ */ l("span", { children: v.title }),
1843
+ /* @__PURE__ */ l("span", { style: a.queryGroupCount, children: v.traces.length })
1838
1844
  ] }),
1839
- w.traces.length ? w.traces.map((S) => {
1840
- var te;
1841
- const L = vn(S, $), x = Ae(S), O = Or(S), ge = Dr(S), ee = Sn(S, x, ge), re = ee.join(" · "), C = Lr(O), j = Ct(h, S);
1845
+ v.traces.length ? v.traces.map((I) => {
1846
+ var ne;
1847
+ const $ = Cn(I, O), q = Te(I), D = Mr(I), me = Nr(I), re = Rn(I, q, me), te = re.join(" · "), E = Kr(D), j = Wt(y, I);
1842
1848
  return /* @__PURE__ */ p(
1843
1849
  "button",
1844
1850
  {
1845
1851
  type: "button",
1846
- title: `${x} · ${O} · ${re}`,
1852
+ title: `${q} · ${D} · ${te}`,
1847
1853
  style: {
1848
1854
  ...a.queryListItem,
1849
- ...L ? a.queryListItemSelected : null
1855
+ ...$ ? a.queryListItemSelected : null
1850
1856
  },
1851
1857
  onClick: () => s.focusTrace({
1852
- traceId: S.traceId,
1853
- queryId: S.queryId,
1854
- viewId: S.viewId
1858
+ traceId: I.traceId,
1859
+ queryId: I.queryId,
1860
+ viewId: I.viewId
1855
1861
  }),
1856
1862
  children: [
1857
1863
  /* @__PURE__ */ p("span", { style: a.queryListItemHeader, children: [
1858
- /* @__PURE__ */ l(en, { status: (te = S.latestAttempt) == null ? void 0 : te.status }),
1859
- /* @__PURE__ */ l("span", { style: a.queryListTitle, title: x, children: x }),
1864
+ /* @__PURE__ */ l(un, { status: (ne = I.latestAttempt) == null ? void 0 : ne.status }),
1865
+ /* @__PURE__ */ l("span", { style: a.queryListTitle, title: q, children: q }),
1860
1866
  /* @__PURE__ */ l(
1861
1867
  "span",
1862
1868
  {
1863
1869
  style: {
1864
1870
  ...a.queryListKindChip,
1865
- ...$r(C)
1871
+ ...Wr(E)
1866
1872
  },
1867
- children: O
1873
+ children: D
1868
1874
  }
1869
1875
  ),
1870
1876
  j > 0 ? /* @__PURE__ */ l("span", { style: a.queryListIssueBadge, children: j }) : null
@@ -1874,22 +1880,22 @@ function Qt({
1874
1880
  {
1875
1881
  className: `${R}-source`,
1876
1882
  style: a.queryListSource,
1877
- title: re,
1878
- children: ee.map((ne, ie) => /* @__PURE__ */ p(it, { children: [
1879
- ie > 0 ? /* @__PURE__ */ l("span", { style: a.queryListSubtitleSep, children: " · " }) : null,
1880
- /* @__PURE__ */ l("span", { children: ne })
1881
- ] }, `${ne}:${ie}`))
1883
+ title: te,
1884
+ children: re.map((ie, oe) => /* @__PURE__ */ p(ct, { children: [
1885
+ oe > 0 ? /* @__PURE__ */ l("span", { style: a.queryListSubtitleSep, children: " · " }) : null,
1886
+ /* @__PURE__ */ l("span", { children: ie })
1887
+ ] }, `${ie}:${oe}`))
1882
1888
  }
1883
1889
  )
1884
1890
  ]
1885
1891
  },
1886
- Me(S)
1892
+ _e(I)
1887
1893
  );
1888
1894
  }) : /* @__PURE__ */ l("div", { style: a.queryGroupEmpty, children: "No input traces" })
1889
- ] }, w.title)) : /* @__PURE__ */ l("div", { style: a.emptyState, children: "No matching traces" })
1895
+ ] }, v.title)) : /* @__PURE__ */ l("div", { style: a.emptyState, children: "No matching traces" })
1890
1896
  }
1891
1897
  ),
1892
- /* @__PURE__ */ l(Jt, { trace: $ })
1898
+ /* @__PURE__ */ l(sn, { trace: O })
1893
1899
  ]
1894
1900
  }
1895
1901
  )
@@ -1898,32 +1904,32 @@ function Qt({
1898
1904
  ) : null
1899
1905
  ] });
1900
1906
  }
1901
- function lo({
1907
+ function bo({
1902
1908
  queryId: e,
1903
1909
  viewId: r,
1904
1910
  label: t,
1905
1911
  className: n,
1906
1912
  style: i
1907
1913
  } = {}) {
1908
- var m, v;
1909
- const o = Er(), s = Q(Qe), c = Q(Ue);
1914
+ var m, h;
1915
+ const o = Dr(), s = Q(Ue), f = Q(Ge);
1910
1916
  B(() => {
1911
- Tr();
1917
+ Lr();
1912
1918
  }, []);
1913
- const u = r || (c == null ? void 0 : c.id), f = I(
1914
- () => bn(o.queries, {
1919
+ const c = r || (f == null ? void 0 : f.id), u = x(
1920
+ () => kn(o.queries, {
1915
1921
  queryId: e,
1916
- viewId: u
1922
+ viewId: c
1917
1923
  }),
1918
1924
  [
1919
1925
  o.queries,
1920
1926
  e,
1921
- u
1927
+ c
1922
1928
  ]
1923
1929
  );
1924
- if (!o.enabled || !s || !f)
1930
+ if (!o.enabled || !s || !u)
1925
1931
  return null;
1926
- const g = t || `Inspect ${In(f, !!e)}`;
1932
+ const g = t || `Inspect ${Ln(u, !!e)}`;
1927
1933
  return /* @__PURE__ */ p(
1928
1934
  "button",
1929
1935
  {
@@ -1933,26 +1939,26 @@ function lo({
1933
1939
  className: n ? `${R} ${n}` : R,
1934
1940
  style: {
1935
1941
  ...a.inspectButton,
1936
- ..._t((m = f.latestAttempt) == null ? void 0 : m.status),
1942
+ ...Gt((m = u.latestAttempt) == null ? void 0 : m.status),
1937
1943
  ...i
1938
1944
  },
1939
1945
  onClick: () => s.openDevtools({
1940
- traceId: f.traceId,
1941
- queryId: f.queryId,
1942
- viewId: f.viewId
1946
+ traceId: u.traceId,
1947
+ queryId: u.queryId,
1948
+ viewId: u.viewId
1943
1949
  }),
1944
1950
  children: [
1945
- /* @__PURE__ */ l(mt, { size: 13 }),
1946
- /* @__PURE__ */ l("span", { style: a.inspectButtonText, children: ((v = f.latestAttempt) == null ? void 0 : v.status) || "idle" })
1951
+ /* @__PURE__ */ l(qt, { size: 13 }),
1952
+ /* @__PURE__ */ l("span", { style: a.inspectButtonText, children: ((h = u.latestAttempt) == null ? void 0 : h.status) || "idle" })
1947
1953
  ]
1948
1954
  }
1949
1955
  );
1950
1956
  }
1951
- function Er() {
1952
- const e = Q(Ve);
1953
- return !e || !e.state.enabled ? kr : ue(e.state);
1957
+ function Dr() {
1958
+ const e = Q(Qe);
1959
+ return !e || !e.state.enabled ? $r : ce(e.state);
1954
1960
  }
1955
- function Ut({
1961
+ function nn({
1956
1962
  spec: e,
1957
1963
  queryKind: r,
1958
1964
  queryKey: t,
@@ -1960,171 +1966,171 @@ function Ut({
1960
1966
  activeInputs: i,
1961
1967
  debug: o
1962
1968
  }) {
1963
- const s = Q(Ve), c = Q(Ue), u = !!(s != null && s.state.enabled), f = s == null ? void 0 : s.dispatch, g = Un(e), m = At(e), v = I(
1969
+ const s = Q(Qe), f = Q(Ge), c = !!(s != null && s.state.enabled), u = s == null ? void 0 : s.dispatch, g = ni(e), m = Dt(e), h = x(
1964
1970
  () => JSON.stringify(e),
1965
1971
  [e]
1966
- ), y = I(
1972
+ ), S = x(
1967
1973
  () => JSON.stringify(i || []),
1968
1974
  [i]
1969
- ), b = I(
1975
+ ), b = x(
1970
1976
  () => JSON.stringify(n || null),
1971
1977
  [n]
1972
- ), T = E(e), d = E(v), h = E(n), K = E(b), k = E(i), M = E(y), $ = Qn(o), w = JSON.stringify($ || []), S = E($), L = E(w);
1973
- d.current !== v && (d.current = v, T.current = e), K.current !== b && (K.current = b, h.current = n), M.current !== y && (M.current = y, k.current = i), L.current !== w && (L.current = w, S.current = $);
1974
- const x = T.current, O = h.current, ge = k.current, ee = S.current, re = Ir(), C = I(
1975
- () => g || `query_${Nr(t)}`,
1978
+ ), w = T(e), d = T(h), y = T(n), K = T(b), C = T(i), N = T(S), O = ti(o), v = JSON.stringify(O || []), I = T(O), $ = T(v);
1979
+ d.current !== h && (d.current = h, w.current = e), K.current !== b && (K.current = b, y.current = n), N.current !== S && (N.current = S, C.current = i), $.current !== v && ($.current = v, I.current = O);
1980
+ const q = w.current, D = y.current, me = C.current, re = I.current, te = kr(), E = x(
1981
+ () => g || `query_${jr(t)}`,
1976
1982
  [t, g]
1977
- ), j = (o == null ? void 0 : o.viewId) || (c == null ? void 0 : c.id), te = (o == null ? void 0 : o.viewTitle) || (o == null ? void 0 : o.title) || (c == null ? void 0 : c.title), ne = o == null ? void 0 : o.visualType, ie = o == null ? void 0 : o.sectionTitle, P = I(
1983
+ ), j = (o == null ? void 0 : o.viewId) || (f == null ? void 0 : f.id), ne = (o == null ? void 0 : o.viewTitle) || (o == null ? void 0 : o.title) || (f == null ? void 0 : f.title), ie = o == null ? void 0 : o.visualType, oe = o == null ? void 0 : o.sectionTitle, P = x(
1978
1984
  () => [
1979
1985
  j || "unscoped-view",
1980
- C,
1981
- re
1986
+ E,
1987
+ te
1982
1988
  ].join("::"),
1983
- [C, re, j]
1984
- ), Ze = I(
1989
+ [E, te, j]
1990
+ ), er = x(
1985
1991
  () => ({
1986
1992
  traceKey: P,
1987
- spec: x,
1988
- queryId: C,
1993
+ spec: q,
1994
+ queryId: E,
1989
1995
  queryLabel: m,
1990
1996
  queryKind: r,
1991
- builder: Gn(r),
1997
+ builder: ii(r),
1992
1998
  viewId: j,
1993
- viewTitle: te,
1994
- visualType: ne,
1995
- sectionTitle: ie,
1996
- sourceHints: ee,
1997
- intent: O,
1998
- activeInputs: ge,
1999
+ viewTitle: ne,
2000
+ visualType: ie,
2001
+ sectionTitle: oe,
2002
+ sourceHints: re,
2003
+ intent: D,
2004
+ activeInputs: me,
1999
2005
  clientWarnings: g ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
2000
2006
  }),
2001
2007
  [
2002
- C,
2008
+ E,
2003
2009
  r,
2004
2010
  g,
2005
2011
  m,
2006
- x,
2007
- ge,
2008
- O,
2009
- ee,
2010
- ie,
2012
+ q,
2013
+ me,
2014
+ D,
2015
+ re,
2016
+ oe,
2011
2017
  P,
2012
2018
  j,
2013
- te,
2014
- ne
2019
+ ne,
2020
+ ie
2015
2021
  ]
2016
2022
  );
2017
2023
  B(() => {
2018
- if (!(!u || !f))
2019
- return f({ type: "register", descriptor: Ze }), () => {
2020
- f({ type: "unregister", traceKey: P });
2024
+ if (!(!c || !u))
2025
+ return u({ type: "register", descriptor: er }), () => {
2026
+ u({ type: "unregister", traceKey: P });
2021
2027
  };
2022
- }, [Ze, f, u, P]);
2023
- const _ = D(
2024
- (q, U) => {
2025
- !u || !f || f({ type: "event", traceKey: P, event: q, latestAttempt: U });
2028
+ }, [er, u, c, P]);
2029
+ const F = L(
2030
+ (A, U) => {
2031
+ !c || !u || u({ type: "event", traceKey: P, event: A, latestAttempt: U });
2026
2032
  },
2027
- [f, u, P]
2028
- ), er = D(() => {
2029
- _(
2033
+ [u, c, P]
2034
+ ), rr = L(() => {
2035
+ F(
2030
2036
  {
2031
2037
  type: "query_started",
2032
- queryId: C,
2033
- at: ve()
2038
+ queryId: E,
2039
+ at: Se()
2034
2040
  },
2035
2041
  { status: "loading" }
2036
2042
  );
2037
- }, [_, C]), rr = D(
2038
- (q, U) => {
2039
- const oe = yr(q), se = ni(q), Ur = ii(q), ir = mr(q);
2040
- _(
2043
+ }, [F, E]), tr = L(
2044
+ (A, U) => {
2045
+ const se = Sr(A), ae = fi(A), et = pi(A), or = vr(A);
2046
+ F(
2041
2047
  {
2042
2048
  type: "query_succeeded",
2043
- queryId: C,
2044
- requestId: oe,
2045
- at: ve(),
2046
- rowCount: se,
2049
+ queryId: E,
2050
+ requestId: se,
2051
+ at: Se(),
2052
+ rowCount: ae,
2047
2053
  durationMs: U
2048
2054
  },
2049
2055
  {
2050
- requestId: oe,
2056
+ requestId: se,
2051
2057
  status: "success",
2052
2058
  durationMs: U,
2053
- rowCount: se,
2054
- columnCount: Ur,
2055
- metricCoverage: oi(q),
2056
- resultPreview: Pe(
2057
- ir,
2058
- si(q)
2059
+ rowCount: ae,
2060
+ columnCount: et,
2061
+ metricCoverage: gi(A),
2062
+ resultPreview: He(
2063
+ or,
2064
+ mi(A)
2059
2065
  ),
2060
- executionResult: ir
2066
+ executionResult: or
2061
2067
  }
2062
2068
  );
2063
2069
  },
2064
- [_, C]
2065
- ), me = D(
2066
- (q, U) => {
2067
- const oe = yr(q), se = q instanceof Error ? q.message : String(q);
2068
- _(
2070
+ [F, E]
2071
+ ), ye = L(
2072
+ (A, U) => {
2073
+ const se = Sr(A), ae = A instanceof Error ? A.message : String(A);
2074
+ F(
2069
2075
  {
2070
2076
  type: "query_failed",
2071
- queryId: C,
2072
- requestId: oe,
2073
- at: ve(),
2074
- errorMessage: se
2077
+ queryId: E,
2078
+ requestId: se,
2079
+ at: Se(),
2080
+ errorMessage: ae
2075
2081
  },
2076
2082
  {
2077
- requestId: oe,
2083
+ requestId: se,
2078
2084
  status: "error",
2079
2085
  durationMs: U,
2080
- errorMessage: se,
2081
- executionResult: mr(q)
2086
+ errorMessage: ae,
2087
+ executionResult: vr(A)
2082
2088
  }
2083
2089
  );
2084
2090
  },
2085
- [_, C]
2086
- ), tr = D(
2087
- (q) => {
2088
- _(
2091
+ [F, E]
2092
+ ), nr = L(
2093
+ (A) => {
2094
+ F(
2089
2095
  {
2090
2096
  type: "query_ignored_stale",
2091
- queryId: C,
2092
- at: ve(),
2093
- reason: q
2097
+ queryId: E,
2098
+ at: Se(),
2099
+ reason: A
2094
2100
  }
2095
2101
  );
2096
2102
  },
2097
- [_, C]
2098
- ), nr = D(
2099
- (q) => {
2100
- me(q, 0);
2103
+ [F, E]
2104
+ ), ir = L(
2105
+ (A) => {
2106
+ ye(A, 0);
2101
2107
  },
2102
- [me]
2103
- ), Ce = u ? s == null ? void 0 : s.state.entries[P] : void 0;
2104
- return I(
2108
+ [ye]
2109
+ ), Ee = c ? s == null ? void 0 : s.state.entries[P] : void 0;
2110
+ return x(
2105
2111
  () => ({
2106
- enabled: u,
2107
- queryId: C,
2108
- trace: Ce ? we(Ce) : void 0,
2109
- start: er,
2110
- success: rr,
2111
- failure: me,
2112
- ignored: tr,
2113
- validationFailure: nr
2112
+ enabled: c,
2113
+ queryId: E,
2114
+ trace: Ee ? we(Ee) : void 0,
2115
+ start: rr,
2116
+ success: tr,
2117
+ failure: ye,
2118
+ ignored: nr,
2119
+ validationFailure: ir
2114
2120
  }),
2115
2121
  [
2116
- u,
2117
- me,
2118
- tr,
2119
- C,
2120
- er,
2122
+ c,
2123
+ ye,
2124
+ nr,
2125
+ E,
2121
2126
  rr,
2122
- Ce,
2123
- nr
2127
+ tr,
2128
+ Ee,
2129
+ ir
2124
2130
  ]
2125
2131
  );
2126
2132
  }
2127
- function Gt() {
2133
+ function on() {
2128
2134
  return /* @__PURE__ */ l("span", { style: a.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ p(
2129
2135
  "svg",
2130
2136
  {
@@ -2142,27 +2148,27 @@ function Gt() {
2142
2148
  }
2143
2149
  ) });
2144
2150
  }
2145
- function Jt({
2151
+ function sn({
2146
2152
  trace: e
2147
2153
  }) {
2148
- var $, w, S, L, x;
2154
+ var O, v, I, $, q;
2149
2155
  if (!e)
2150
2156
  return /* @__PURE__ */ l("div", { style: a.detailsPane, children: /* @__PURE__ */ l("div", { style: a.emptyState, children: "No traces registered yet" }) });
2151
- const r = e.latestAttempt, t = r == null ? void 0 : r.executionResult, n = Oe(
2152
- ($ = t == null ? void 0 : t.validation) == null ? void 0 : $.warnings
2153
- ), i = Oe((w = t == null ? void 0 : t.validation) == null ? void 0 : w.errors), o = Bn(
2154
- (S = t == null ? void 0 : t.coverage) == null ? void 0 : S.missingObligations
2155
- ), s = Oe(
2156
- (L = t == null ? void 0 : t.coverage) == null ? void 0 : L.warnings
2157
- ), c = t == null ? void 0 : t.compiledQuery, u = Nn(t), f = ((x = e.server) == null ? void 0 : x.compiledSql) || u.compiledSql, g = (r == null ? void 0 : r.resultPreview) || Pe(t), m = [
2157
+ const r = e.latestAttempt, t = r == null ? void 0 : r.executionResult, n = De(
2158
+ (O = t == null ? void 0 : t.validation) == null ? void 0 : O.warnings
2159
+ ), i = De((v = t == null ? void 0 : t.validation) == null ? void 0 : v.errors), o = Pn(
2160
+ (I = t == null ? void 0 : t.coverage) == null ? void 0 : I.missingObligations
2161
+ ), s = De(
2162
+ ($ = t == null ? void 0 : t.coverage) == null ? void 0 : $.warnings
2163
+ ), f = t == null ? void 0 : t.compiledQuery, c = Qn(t), u = ((q = e.server) == null ? void 0 : q.compiledSql) || c.compiledSql, g = (r == null ? void 0 : r.resultPreview) || He(t), m = [
2158
2164
  ...r != null && r.errorMessage ? [r.errorMessage] : [],
2159
2165
  ...i
2160
- ], v = [
2166
+ ], h = [
2161
2167
  ...e.clientWarnings,
2162
2168
  ...n,
2163
2169
  ...o,
2164
2170
  ...s
2165
- ], y = e.inputsApplied.length > 0, b = !!(c || f), T = An(e), d = En(r == null ? void 0 : r.rowCount), h = Rn(r == null ? void 0 : r.durationMs), K = e.sourceRefs.length, k = Or(e), M = Lr(k);
2171
+ ], S = e.inputsApplied.length > 0, b = !!(f || u), w = Dn(e), d = Mn(r == null ? void 0 : r.rowCount), y = Nn(r == null ? void 0 : r.durationMs), K = e.sourceRefs.length, C = Mr(e), N = Kr(C);
2166
2172
  return /* @__PURE__ */ p("div", { style: a.detailsPane, children: [
2167
2173
  /* @__PURE__ */ p("div", { style: a.detailsHeader, children: [
2168
2174
  /* @__PURE__ */ p("div", { style: a.detailsHeaderTopRow, children: [
@@ -2172,71 +2178,71 @@ function Jt({
2172
2178
  "aria-hidden": !0,
2173
2179
  style: {
2174
2180
  ...a.detailsHeaderStatusDot,
2175
- ...Ar(r == null ? void 0 : r.status)
2181
+ ...Rr(r == null ? void 0 : r.status)
2176
2182
  }
2177
2183
  }
2178
2184
  ),
2179
- /* @__PURE__ */ l("span", { style: a.detailsTitle, children: Ae(e) }),
2185
+ /* @__PURE__ */ l("span", { style: a.detailsTitle, children: Te(e) }),
2180
2186
  /* @__PURE__ */ l(
2181
2187
  "span",
2182
2188
  {
2183
2189
  style: {
2184
2190
  ...a.detailsKindChip,
2185
- ...$r(M)
2191
+ ...Wr(N)
2186
2192
  },
2187
- children: k
2193
+ children: C
2188
2194
  }
2189
2195
  )
2190
2196
  ] }),
2191
2197
  /* @__PURE__ */ p("div", { style: a.metaStrip, children: [
2192
- /* @__PURE__ */ l("span", { style: a.metaStripItem, children: T }),
2198
+ /* @__PURE__ */ l("span", { style: a.metaStripItem, children: w }),
2193
2199
  /* @__PURE__ */ l("span", { style: a.metaStripDot, children: "·" }),
2194
2200
  /* @__PURE__ */ p("span", { style: a.metaStripItem, children: [
2195
2201
  d,
2196
2202
  " rows"
2197
2203
  ] }),
2198
2204
  /* @__PURE__ */ l("span", { style: a.metaStripDot, children: "·" }),
2199
- /* @__PURE__ */ l("span", { style: a.metaStripItem, children: h }),
2200
- K > 0 ? /* @__PURE__ */ p(Sr, { children: [
2205
+ /* @__PURE__ */ l("span", { style: a.metaStripItem, children: y }),
2206
+ K > 0 ? /* @__PURE__ */ p(Tr, { children: [
2201
2207
  /* @__PURE__ */ l("span", { style: a.metaStripDot, children: "·" }),
2202
2208
  /* @__PURE__ */ l("span", { style: a.metaStripItem, children: K === 1 ? "1 source" : `${K} sources` })
2203
2209
  ] }) : null
2204
2210
  ] })
2205
2211
  ] }),
2206
- m.length ? /* @__PURE__ */ l(dr, { tone: "error", title: "Error", items: m }) : null,
2207
- v.length ? /* @__PURE__ */ l(dr, { tone: "warning", title: "Warnings", items: v }) : null,
2208
- /* @__PURE__ */ l(rn, { trace: e }),
2209
- y ? /* @__PURE__ */ l(un, { inputs: e.inputsApplied }) : null,
2212
+ m.length ? /* @__PURE__ */ l(pr, { tone: "error", title: "Error", items: m }) : null,
2213
+ h.length ? /* @__PURE__ */ l(pr, { tone: "warning", title: "Warnings", items: h }) : null,
2214
+ /* @__PURE__ */ l(cn, { trace: e }),
2215
+ S ? /* @__PURE__ */ l(vn, { inputs: e.inputsApplied }) : null,
2210
2216
  /* @__PURE__ */ l(
2211
- Yt,
2217
+ an,
2212
2218
  {
2213
2219
  trace: e,
2214
2220
  resultPreview: g,
2215
- compiledQuery: c,
2216
- compiledSql: f,
2221
+ compiledQuery: f,
2222
+ compiledSql: u,
2217
2223
  hasCompiled: b
2218
2224
  }
2219
2225
  )
2220
2226
  ] });
2221
2227
  }
2222
- function Yt({
2228
+ function an({
2223
2229
  trace: e,
2224
2230
  resultPreview: r,
2225
2231
  compiledQuery: t,
2226
2232
  compiledSql: n,
2227
2233
  hasCompiled: i
2228
2234
  }) {
2229
- var b, T;
2235
+ var b, w;
2230
2236
  const o = [];
2231
2237
  r && o.push({
2232
2238
  id: "returned",
2233
2239
  label: "Returned",
2234
- render: () => /* @__PURE__ */ l(cn, { preview: r })
2240
+ render: () => /* @__PURE__ */ l(Sn, { preview: r })
2235
2241
  }), i && o.push({
2236
2242
  id: "compiled",
2237
2243
  label: "Compiled",
2238
2244
  render: () => /* @__PURE__ */ l(
2239
- fn,
2245
+ wn,
2240
2246
  {
2241
2247
  compiledQuery: t,
2242
2248
  compiledSql: n
@@ -2245,67 +2251,67 @@ function Yt({
2245
2251
  }), (e.sourceRefs.length || e.fieldRefs.length) && o.push({
2246
2252
  id: "lineage",
2247
2253
  label: "Sources",
2248
- render: () => /* @__PURE__ */ l(on, { trace: e })
2254
+ render: () => /* @__PURE__ */ l(gn, { trace: e })
2249
2255
  }), (b = e.sourceHints) != null && b.length && o.push({
2250
2256
  id: "hints",
2251
2257
  label: "Hints",
2252
- render: () => /* @__PURE__ */ l(sn, { hints: e.sourceHints ?? [] })
2258
+ render: () => /* @__PURE__ */ l(mn, { hints: e.sourceHints ?? [] })
2253
2259
  }), o.push({
2254
2260
  id: "lifecycle",
2255
2261
  label: "Lifecycle",
2256
- render: () => /* @__PURE__ */ l(Xt, { trace: e })
2262
+ render: () => /* @__PURE__ */ l(ln, { trace: e })
2257
2263
  }), o.push({
2258
2264
  id: "raw",
2259
2265
  label: "Raw",
2260
- render: () => /* @__PURE__ */ l("pre", { style: a.codeBlock, children: Ln(e) })
2266
+ render: () => /* @__PURE__ */ l("pre", { style: a.codeBlock, children: _n(e) })
2261
2267
  });
2262
- const s = (T = o[0]) == null ? void 0 : T.id, c = e.traceId || `${e.viewId ?? ""}:${e.queryId}`, [u, f] = z(s), g = E(c), m = E(!1), v = o.map((d) => d.id).join("|");
2268
+ const s = (w = o[0]) == null ? void 0 : w.id, f = e.traceId || `${e.viewId ?? ""}:${e.queryId}`, [c, u] = _(s), g = T(f), m = T(!1), h = o.map((d) => d.id).join("|");
2263
2269
  B(() => {
2264
- if (g.current !== c) {
2265
- g.current = c, m.current = !1, f(s);
2270
+ if (g.current !== f) {
2271
+ g.current = f, m.current = !1, u(s);
2266
2272
  return;
2267
2273
  }
2268
- if (!(u ? v.split("|").includes(u) : !1)) {
2269
- m.current = !1, f(s);
2274
+ if (!(c ? h.split("|").includes(c) : !1)) {
2275
+ m.current = !1, u(s);
2270
2276
  return;
2271
2277
  }
2272
- !m.current && u !== s && f(s);
2273
- }, [u, s, v, c]);
2274
- const y = o.find((d) => d.id === u) ?? o[0];
2278
+ !m.current && c !== s && u(s);
2279
+ }, [c, s, h, f]);
2280
+ const S = o.find((d) => d.id === c) ?? o[0];
2275
2281
  return /* @__PURE__ */ p("div", { style: a.traceTabs, children: [
2276
2282
  /* @__PURE__ */ l("div", { style: a.traceTabBar, role: "tablist", "aria-label": "Trace details", children: o.map((d) => {
2277
- const h = d.id === y.id;
2283
+ const y = d.id === S.id;
2278
2284
  return /* @__PURE__ */ l(
2279
2285
  "button",
2280
2286
  {
2281
2287
  type: "button",
2282
2288
  role: "tab",
2283
- "aria-selected": h,
2289
+ "aria-selected": y,
2284
2290
  className: `${R}-tab`,
2285
2291
  style: {
2286
2292
  ...a.traceTab,
2287
- ...h ? a.traceTabActive : null
2293
+ ...y ? a.traceTabActive : null
2288
2294
  },
2289
2295
  onClick: () => {
2290
- m.current = !0, f(d.id);
2296
+ m.current = !0, u(d.id);
2291
2297
  },
2292
2298
  children: d.label
2293
2299
  },
2294
2300
  d.id
2295
2301
  );
2296
2302
  }) }),
2297
- /* @__PURE__ */ l("div", { style: a.traceTabPanel, role: "tabpanel", children: y.render() })
2303
+ /* @__PURE__ */ l("div", { style: a.traceTabPanel, role: "tabpanel", children: S.render() })
2298
2304
  ] });
2299
2305
  }
2300
- function Xt({
2306
+ function ln({
2301
2307
  trace: e
2302
2308
  }) {
2303
2309
  return e.recentEvents.length ? /* @__PURE__ */ l("div", { style: a.eventList, children: e.recentEvents.slice(-5).map((r, t) => /* @__PURE__ */ p("div", { style: a.eventRow, children: [
2304
- /* @__PURE__ */ l("span", { style: a.eventType, children: $n(r) }),
2305
- /* @__PURE__ */ l("span", { style: a.eventMeta, children: On(r) })
2310
+ /* @__PURE__ */ l("span", { style: a.eventType, children: Fn(r) }),
2311
+ /* @__PURE__ */ l("span", { style: a.eventMeta, children: zn(r) })
2306
2312
  ] }, `${r.type}:${r.at}:${t}`)) }) : /* @__PURE__ */ l("div", { style: a.mutedText, children: "No attempts recorded" });
2307
2313
  }
2308
- function dr({
2314
+ function pr({
2309
2315
  tone: e,
2310
2316
  title: r,
2311
2317
  items: t
@@ -2316,13 +2322,13 @@ function dr({
2316
2322
  t.length > 1 ? /* @__PURE__ */ l("ul", { style: a.alertCardList, children: t.map((i, o) => /* @__PURE__ */ l("li", { children: i }, `${e}-${o}`)) }) : /* @__PURE__ */ l("div", { children: t[0] })
2317
2323
  ] });
2318
2324
  }
2319
- function Zt({
2325
+ function dn({
2320
2326
  issues: e,
2321
2327
  onSelect: r
2322
2328
  }) {
2323
- const [t, n] = z(!1), i = e.slice(0, 6), o = e.length - i.length, s = e.filter((f) => f.tone === "error").length, c = e.length - s, u = [
2329
+ const [t, n] = _(!1), i = e.slice(0, 6), o = e.length - i.length, s = e.filter((u) => u.tone === "error").length, f = e.length - s, c = [
2324
2330
  s ? `${s} error${s === 1 ? "" : "s"}` : "",
2325
- c ? `${c} warning${c === 1 ? "" : "s"}` : ""
2331
+ f ? `${f} warning${f === 1 ? "" : "s"}` : ""
2326
2332
  ].filter(Boolean);
2327
2333
  return /* @__PURE__ */ p("section", { style: a.issueSummary, "aria-label": "Semaphor trace issues", children: [
2328
2334
  /* @__PURE__ */ p(
@@ -2331,10 +2337,10 @@ function Zt({
2331
2337
  type: "button",
2332
2338
  "aria-expanded": t,
2333
2339
  style: a.issueSummaryToggle,
2334
- onClick: () => n((f) => !f),
2340
+ onClick: () => n((u) => !u),
2335
2341
  children: [
2336
2342
  /* @__PURE__ */ p("span", { style: a.issueSummaryHeaderLabel, children: [
2337
- t ? /* @__PURE__ */ l(bt, { size: 13 }) : /* @__PURE__ */ l(yt, { size: 13 }),
2343
+ t ? /* @__PURE__ */ l(kt, { size: 13 }) : /* @__PURE__ */ l(At, { size: 13 }),
2338
2344
  /* @__PURE__ */ l("span", { children: "Issues" })
2339
2345
  ] }),
2340
2346
  /* @__PURE__ */ l("span", { style: a.issueSummaryCount, children: e.length })
@@ -2342,31 +2348,31 @@ function Zt({
2342
2348
  }
2343
2349
  ),
2344
2350
  t ? /* @__PURE__ */ p("div", { style: a.issueSummaryList, children: [
2345
- i.map((f, g) => /* @__PURE__ */ p(
2351
+ i.map((u, g) => /* @__PURE__ */ p(
2346
2352
  "button",
2347
2353
  {
2348
2354
  type: "button",
2349
- title: `${f.title}: ${f.message}`,
2355
+ title: `${u.title}: ${u.message}`,
2350
2356
  style: a.issueSummaryItem,
2351
- onClick: () => r(f.trace),
2357
+ onClick: () => r(u.trace),
2352
2358
  children: [
2353
2359
  /* @__PURE__ */ l(
2354
2360
  "span",
2355
2361
  {
2356
2362
  style: {
2357
2363
  ...a.issueSummaryBadge,
2358
- ...f.tone === "error" ? a.issueSummaryBadgeError : a.issueSummaryBadgeWarning
2364
+ ...u.tone === "error" ? a.issueSummaryBadgeError : a.issueSummaryBadgeWarning
2359
2365
  },
2360
- children: f.tone === "error" ? "Error" : "Warning"
2366
+ children: u.tone === "error" ? "Error" : "Warning"
2361
2367
  }
2362
2368
  ),
2363
2369
  /* @__PURE__ */ p("span", { style: a.issueSummaryText, children: [
2364
- /* @__PURE__ */ l("span", { style: a.issueSummaryTitle, children: f.title }),
2365
- /* @__PURE__ */ l("span", { style: a.issueSummaryMessage, children: f.message })
2370
+ /* @__PURE__ */ l("span", { style: a.issueSummaryTitle, children: u.title }),
2371
+ /* @__PURE__ */ l("span", { style: a.issueSummaryMessage, children: u.message })
2366
2372
  ] })
2367
2373
  ]
2368
2374
  },
2369
- `${f.trace.traceId}:${f.title}:${g}`
2375
+ `${u.trace.traceId}:${u.title}:${g}`
2370
2376
  )),
2371
2377
  o > 0 ? /* @__PURE__ */ p("div", { style: a.issueSummaryMore, children: [
2372
2378
  o,
@@ -2375,12 +2381,12 @@ function Zt({
2375
2381
  " in traces"
2376
2382
  ] }) : null
2377
2383
  ] }) : /* @__PURE__ */ p("div", { style: a.issueSummaryCollapsed, children: [
2378
- u.join(" · "),
2384
+ c.join(" · "),
2379
2385
  " across traces"
2380
2386
  ] })
2381
2387
  ] });
2382
2388
  }
2383
- function en({
2389
+ function un({
2384
2390
  status: e
2385
2391
  }) {
2386
2392
  return /* @__PURE__ */ l(
@@ -2389,18 +2395,18 @@ function en({
2389
2395
  "aria-hidden": !0,
2390
2396
  style: {
2391
2397
  ...a.statusDot,
2392
- ...Ar(e)
2398
+ ...Rr(e)
2393
2399
  }
2394
2400
  }
2395
2401
  );
2396
2402
  }
2397
- function rn({
2403
+ function cn({
2398
2404
  trace: e
2399
2405
  }) {
2400
2406
  var i;
2401
- const r = (i = e.projectionFieldRefs) != null && i.length ? e.projectionFieldRefs : e.fieldRefs, t = e.inputFieldRefs || [], n = qn(r);
2407
+ const r = (i = e.projectionFieldRefs) != null && i.length ? e.projectionFieldRefs : e.fieldRefs, t = e.inputFieldRefs || [], n = On(r);
2402
2408
  return /* @__PURE__ */ p("div", { style: a.recipe, children: [
2403
- /* @__PURE__ */ l(tn, { sources: e.sourceRefs }),
2409
+ /* @__PURE__ */ l(fn, { sources: e.sourceRefs }),
2404
2410
  /* @__PURE__ */ l(H, { title: "Measures", fields: n.measures }),
2405
2411
  /* @__PURE__ */ l(H, { title: "Time fields", fields: n.timeFields }),
2406
2412
  /* @__PURE__ */ l(
@@ -2422,7 +2428,7 @@ function rn({
2422
2428
  )
2423
2429
  ] });
2424
2430
  }
2425
- function tn({
2431
+ function fn({
2426
2432
  sources: e
2427
2433
  }) {
2428
2434
  return e.length ? /* @__PURE__ */ p("div", { style: a.recipeGroup, children: [
@@ -2431,26 +2437,26 @@ function tn({
2431
2437
  /* @__PURE__ */ l("span", { style: a.recipeGroupCount, children: e.length })
2432
2438
  ] }),
2433
2439
  /* @__PURE__ */ l("div", { style: a.sourcePillRow, children: e.map((r, t) => /* @__PURE__ */ l(
2434
- nn,
2440
+ pn,
2435
2441
  {
2436
2442
  source: r
2437
2443
  },
2438
- `${F(r)}:${t}`
2444
+ `${z(r)}:${t}`
2439
2445
  )) })
2440
2446
  ] }) : null;
2441
2447
  }
2442
- function nn({ source: e }) {
2443
- const r = F(e);
2448
+ function pn({ source: e }) {
2449
+ const r = z(e);
2444
2450
  return /* @__PURE__ */ p("span", { style: a.sourcePill, title: r, children: [
2445
2451
  /* @__PURE__ */ l("span", { style: a.sourcePillLabel, children: r }),
2446
2452
  /* @__PURE__ */ l("span", { style: a.sourcePillRole, children: e.kind })
2447
2453
  ] });
2448
2454
  }
2449
- function on({
2455
+ function gn({
2450
2456
  trace: e
2451
2457
  }) {
2452
2458
  return /* @__PURE__ */ p("div", { style: a.traceLineage, children: [
2453
- /* @__PURE__ */ l(an, { sources: e.sourceRefs }),
2459
+ /* @__PURE__ */ l(yn, { sources: e.sourceRefs }),
2454
2460
  /* @__PURE__ */ l(
2455
2461
  H,
2456
2462
  {
@@ -2461,11 +2467,11 @@ function on({
2461
2467
  )
2462
2468
  ] });
2463
2469
  }
2464
- function sn({
2470
+ function mn({
2465
2471
  hints: e
2466
2472
  }) {
2467
2473
  return /* @__PURE__ */ l("div", { style: a.recipeFieldList, children: e.map((r, t) => {
2468
- const n = Cn(r), i = r.component || r.exportName || n || "Source hint", o = [
2474
+ const n = Wn(r), i = r.component || r.exportName || n || "Source hint", o = [
2469
2475
  r.exportName && r.exportName !== i ? r.exportName : void 0,
2470
2476
  n,
2471
2477
  r.note
@@ -2484,7 +2490,7 @@ function sn({
2484
2490
  );
2485
2491
  }) });
2486
2492
  }
2487
- function an({
2493
+ function yn({
2488
2494
  sources: e
2489
2495
  }) {
2490
2496
  return /* @__PURE__ */ p("div", { style: a.recipeGroup, children: [
@@ -2496,13 +2502,13 @@ function an({
2496
2502
  "div",
2497
2503
  {
2498
2504
  style: a.recipeFieldRow,
2499
- title: F(r),
2505
+ title: z(r),
2500
2506
  children: [
2501
- /* @__PURE__ */ l("span", { style: a.recipeFieldName, children: F(r) }),
2507
+ /* @__PURE__ */ l("span", { style: a.recipeFieldName, children: z(r) }),
2502
2508
  /* @__PURE__ */ l("span", { style: a.recipeFieldMeta, children: r.kind })
2503
2509
  ]
2504
2510
  },
2505
- `${F(r)}:${t}`
2511
+ `${z(r)}:${t}`
2506
2512
  )) }) : /* @__PURE__ */ l("div", { style: a.recipeEmptyText, children: "No sources captured" })
2507
2513
  ] });
2508
2514
  }
@@ -2517,20 +2523,20 @@ function H({
2517
2523
  /* @__PURE__ */ l("span", { style: a.recipeGroupCount, children: r.length })
2518
2524
  ] }),
2519
2525
  r.length ? /* @__PURE__ */ l("div", { style: a.fieldChipList, children: r.map((n, i) => /* @__PURE__ */ l(
2520
- ln,
2526
+ hn,
2521
2527
  {
2522
2528
  field: n,
2523
2529
  groupTitle: e
2524
2530
  },
2525
- `${Ge(n)}:${i}`
2531
+ `${Je(n)}:${i}`
2526
2532
  )) }) : /* @__PURE__ */ l("div", { style: a.recipeEmptyText, children: t })
2527
2533
  ] });
2528
2534
  }
2529
- function ln({
2535
+ function hn({
2530
2536
  field: e,
2531
2537
  groupTitle: r
2532
2538
  }) {
2533
- const t = Tn(e), n = e.label || e.name, i = e.dataType && e.dataType !== "unknown" ? e.dataType : void 0, o = e.source ? F(e.source) : void 0, s = [t, i, o].filter(Boolean).join(" · "), c = dn(e, r);
2539
+ const t = Bn(e), n = e.label || e.name, i = e.dataType && e.dataType !== "unknown" ? e.dataType : void 0, o = e.source ? z(e.source) : void 0, s = [t, i, o].filter(Boolean).join(" · "), f = bn(e, r);
2534
2540
  return /* @__PURE__ */ p(
2535
2541
  "div",
2536
2542
  {
@@ -2538,7 +2544,7 @@ function ln({
2538
2544
  style: a.fieldChip,
2539
2545
  title: s,
2540
2546
  children: [
2541
- /* @__PURE__ */ l("span", { style: { ...a.fieldGlyph, ...c.style }, children: c.text }),
2547
+ /* @__PURE__ */ l("span", { style: { ...a.fieldGlyph, ...f.style }, children: f.text }),
2542
2548
  e.aggregate ? /* @__PURE__ */ l("span", { style: a.fieldAggBadge, children: e.aggregate }) : null,
2543
2549
  /* @__PURE__ */ l("span", { style: a.fieldChipName, children: n }),
2544
2550
  i ? /* @__PURE__ */ l("span", { style: a.fieldChipMeta, children: i }) : null,
@@ -2548,7 +2554,7 @@ function ln({
2548
2554
  }
2549
2555
  );
2550
2556
  }
2551
- function dn(e, r) {
2557
+ function bn(e, r) {
2552
2558
  const t = e.dataType, n = e.role;
2553
2559
  return !!e.aggregate || n === "measure" || r === "Measures" ? {
2554
2560
  text: "Σ",
@@ -2587,7 +2593,7 @@ function dn(e, r) {
2587
2593
  }
2588
2594
  };
2589
2595
  }
2590
- function un({
2596
+ function vn({
2591
2597
  inputs: e
2592
2598
  }) {
2593
2599
  return /* @__PURE__ */ p("div", { style: a.inputsAppliedBlock, children: [
@@ -2596,7 +2602,7 @@ function un({
2596
2602
  /* @__PURE__ */ l("span", { style: a.inputsAppliedCount, children: e.length })
2597
2603
  ] }),
2598
2604
  /* @__PURE__ */ l("div", { style: a.inputRecipeList, children: e.map((r) => {
2599
- const t = kn(r);
2605
+ const t = Kn(r);
2600
2606
  return /* @__PURE__ */ p(
2601
2607
  "div",
2602
2608
  {
@@ -2617,7 +2623,7 @@ function un({
2617
2623
  }) })
2618
2624
  ] });
2619
2625
  }
2620
- function cn({
2626
+ function Sn({
2621
2627
  preview: e
2622
2628
  }) {
2623
2629
  return /* @__PURE__ */ p("div", { style: a.resultPreview, children: [
@@ -2627,7 +2633,7 @@ function cn({
2627
2633
  ] }),
2628
2634
  /* @__PURE__ */ l("div", { style: a.resultPreviewScroller, children: /* @__PURE__ */ p("table", { style: a.resultPreviewTable, children: [
2629
2635
  /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: e.columns.map((r) => /* @__PURE__ */ l("th", { style: a.resultPreviewTh, children: r.label }, r.key)) }) }),
2630
- /* @__PURE__ */ l("tbody", { children: e.rows.length ? e.rows.map((r, t) => /* @__PURE__ */ l("tr", { children: e.columns.map((n) => /* @__PURE__ */ l("td", { style: a.resultPreviewTd, children: xt(r[n.key]) }, n.key)) }, t)) : /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l(
2636
+ /* @__PURE__ */ l("tbody", { children: e.rows.length ? e.rows.map((r, t) => /* @__PURE__ */ l("tr", { children: e.columns.map((n) => /* @__PURE__ */ l("td", { style: a.resultPreviewTd, children: $t(r[n.key]) }, n.key)) }, t)) : /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l(
2631
2637
  "td",
2632
2638
  {
2633
2639
  colSpan: e.columns.length,
@@ -2638,7 +2644,7 @@ function cn({
2638
2644
  ] }) }),
2639
2645
  e.truncatedRows || e.truncatedColumns ? /* @__PURE__ */ p("div", { style: a.resultPreviewFootnote, children: [
2640
2646
  "Showing first ",
2641
- fe,
2647
+ pe,
2642
2648
  " rows and first",
2643
2649
  " ",
2644
2650
  Ne,
@@ -2646,23 +2652,23 @@ function cn({
2646
2652
  ] }) : null
2647
2653
  ] });
2648
2654
  }
2649
- function fn({
2655
+ function wn({
2650
2656
  compiledQuery: e,
2651
2657
  compiledSql: r
2652
2658
  }) {
2653
2659
  return (e == null ? void 0 : e.kind) === "sql" ? /* @__PURE__ */ p("div", { style: a.compiledQuery, children: [
2654
- /* @__PURE__ */ l(ur, { label: "SQL", value: e.sql }),
2655
- e.pythonCode ? /* @__PURE__ */ l($e, { label: "Python", value: e.pythonCode }) : null,
2660
+ /* @__PURE__ */ l(gr, { label: "SQL", value: e.sql }),
2661
+ e.pythonCode ? /* @__PURE__ */ l(Oe, { label: "Python", value: e.pythonCode }) : null,
2656
2662
  e.parameters ? /* @__PURE__ */ l(
2657
- $e,
2663
+ Oe,
2658
2664
  {
2659
2665
  label: "Parameters",
2660
- value: _e(e.parameters)
2666
+ value: Fe(e.parameters)
2661
2667
  }
2662
2668
  ) : null
2663
- ] }) : r ? /* @__PURE__ */ l(ur, { label: "SQL", value: r }) : /* @__PURE__ */ l($e, { label: "Compiled Query", value: _e(e) });
2669
+ ] }) : r ? /* @__PURE__ */ l(gr, { label: "SQL", value: r }) : /* @__PURE__ */ l(Oe, { label: "Compiled Query", value: Fe(e) });
2664
2670
  }
2665
- function $e({
2671
+ function Oe({
2666
2672
  label: e,
2667
2673
  value: r
2668
2674
  }) {
@@ -2671,16 +2677,16 @@ function $e({
2671
2677
  /* @__PURE__ */ l("pre", { style: a.codeBlock, children: r })
2672
2678
  ] });
2673
2679
  }
2674
- function ur({
2680
+ function gr({
2675
2681
  label: e,
2676
2682
  value: r
2677
2683
  }) {
2678
2684
  return /* @__PURE__ */ p("div", { style: a.codeBlockGroup, children: [
2679
2685
  /* @__PURE__ */ l("div", { style: a.codeBlockLabel, children: e }),
2680
- /* @__PURE__ */ l("pre", { style: a.codeBlock, children: gn(r) })
2686
+ /* @__PURE__ */ l("pre", { style: a.codeBlock, children: xn(r) })
2681
2687
  ] });
2682
2688
  }
2683
- const pn = /* @__PURE__ */ new Set([
2689
+ const In = /* @__PURE__ */ new Set([
2684
2690
  "SELECT",
2685
2691
  "FROM",
2686
2692
  "JOIN",
@@ -2718,14 +2724,14 @@ const pn = /* @__PURE__ */ new Set([
2718
2724
  "ALL",
2719
2725
  "WITH"
2720
2726
  ]);
2721
- function gn(e) {
2727
+ function xn(e) {
2722
2728
  return e.split(/(\s+|,|\(|\))/).map((t, n) => {
2723
2729
  if (!t) return null;
2724
2730
  const i = t.toUpperCase();
2725
- return pn.has(i) ? /* @__PURE__ */ l("span", { style: a.sqlKeyword, children: t }, n) : t.startsWith("$") || t.startsWith(":") || t.startsWith("?") ? /* @__PURE__ */ l("span", { style: a.sqlBindParam, children: t }, n) : /* @__PURE__ */ l("span", { children: t }, n);
2731
+ return In.has(i) ? /* @__PURE__ */ l("span", { style: a.sqlKeyword, children: t }, n) : t.startsWith("$") || t.startsWith(":") || t.startsWith("?") ? /* @__PURE__ */ l("span", { style: a.sqlBindParam, children: t }, n) : /* @__PURE__ */ l("span", { children: t }, n);
2726
2732
  });
2727
2733
  }
2728
- function mn(e) {
2734
+ function qn(e) {
2729
2735
  return [
2730
2736
  `${e.total} ${e.total === 1 ? "trace" : "traces"}`,
2731
2737
  `${e.loading} loading`,
@@ -2734,7 +2740,7 @@ function mn(e) {
2734
2740
  `${e.warningCount} warning${e.warningCount === 1 ? "" : "s"}`
2735
2741
  ].join(" · ");
2736
2742
  }
2737
- function yn(e, r) {
2743
+ function An(e, r) {
2738
2744
  const t = r.trim().toLowerCase();
2739
2745
  return t ? e.filter(
2740
2746
  (n) => [
@@ -2746,36 +2752,36 @@ function yn(e, r) {
2746
2752
  n.sectionTitle,
2747
2753
  n.builder,
2748
2754
  n.queryKind,
2749
- Dr(n)
2755
+ Nr(n)
2750
2756
  ].filter(Boolean).join(" ").toLowerCase().includes(t)
2751
2757
  ) : e;
2752
2758
  }
2753
- function hn(e) {
2754
- const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(Me));
2759
+ function Tn(e) {
2760
+ const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(_e));
2755
2761
  return [
2756
- { title: "Views", traces: e.filter((i) => !t.has(Me(i))) },
2762
+ { title: "Views", traces: e.filter((i) => !t.has(_e(i))) },
2757
2763
  { title: "Inputs", traces: r }
2758
2764
  ];
2759
2765
  }
2760
- function Rr(e, r) {
2766
+ function Br(e, r) {
2761
2767
  if (!(!(r != null && r.traceId) && !(r != null && r.queryId) && !(r != null && r.viewId)))
2762
2768
  return r.traceId ? e.find((t) => t.traceId === r.traceId) : e.find((t) => !(r.queryId && t.queryId !== r.queryId || r.viewId && t.viewId !== r.viewId));
2763
2769
  }
2764
- function bn(e, r) {
2770
+ function kn(e, r) {
2765
2771
  if (r.queryId)
2766
- return Rr(e, r);
2772
+ return Br(e, r);
2767
2773
  if (!r.viewId)
2768
2774
  return;
2769
2775
  const t = e.filter((n) => n.viewId === r.viewId);
2770
2776
  return t.length === 1 ? t[0] : void 0;
2771
2777
  }
2772
- function vn(e, r) {
2778
+ function Cn(e, r) {
2773
2779
  return !!(e && r && e.traceId === r.traceId);
2774
2780
  }
2775
- function Me(e) {
2781
+ function _e(e) {
2776
2782
  return e.traceId;
2777
2783
  }
2778
- function wn(e) {
2784
+ function En(e) {
2779
2785
  switch (e) {
2780
2786
  case "metric":
2781
2787
  return "metric";
@@ -2790,14 +2796,14 @@ function wn(e) {
2790
2796
  case "sql":
2791
2797
  return "sql";
2792
2798
  default:
2793
- return Te(e);
2799
+ return ke(e);
2794
2800
  }
2795
2801
  }
2796
- function Lr(e) {
2802
+ function Kr(e) {
2797
2803
  const r = e.trim().toLowerCase();
2798
2804
  return r === "metric" || r === "kpi" ? "metric" : r === "records" || r === "table" ? "records" : r === "matrix" || r === "pivot" ? "matrix" : r === "analysis" ? "analysis" : r === "inputs" || r === "input options" ? "inputs" : r === "sql" ? "sql" : "default";
2799
2805
  }
2800
- function $r(e) {
2806
+ function Wr(e) {
2801
2807
  switch (e) {
2802
2808
  case "metric":
2803
2809
  return {
@@ -2829,25 +2835,25 @@ function $r(e) {
2829
2835
  };
2830
2836
  }
2831
2837
  }
2832
- function Sn(e, r, t) {
2838
+ function Rn(e, r, t) {
2833
2839
  const n = [];
2834
2840
  return e.queryLabel && e.queryLabel !== r && n.push(e.queryLabel), e.queryId && e.queryId !== r && e.queryId !== e.queryLabel ? n.push(e.queryId) : e.viewId && e.viewId !== r && e.viewId !== e.queryLabel && n.push(e.viewId), n.push(t), n;
2835
2841
  }
2836
- function Or(e) {
2837
- return xn(e.visualType) || wn(e.queryKind);
2842
+ function Mr(e) {
2843
+ return $n(e.visualType) || En(e.queryKind);
2838
2844
  }
2839
- function In(e, r) {
2840
- return r ? e.queryLabel || e.queryId : Ae(e);
2845
+ function Ln(e, r) {
2846
+ return r ? e.queryLabel || e.queryId : Te(e);
2841
2847
  }
2842
- function xn(e) {
2848
+ function $n(e) {
2843
2849
  if (e)
2844
2850
  return e.replace(/[_-]+/g, " ").replace(/\b\w/g, (r) => r.toUpperCase());
2845
2851
  }
2846
- function Dr(e) {
2847
- const r = e.sourceRefs.map(F);
2852
+ function Nr(e) {
2853
+ const r = e.sourceRefs.map(z);
2848
2854
  return r.length ? r.length === 1 ? r[0] : `${r[0]} + ${r.length - 1} more` : "No source";
2849
2855
  }
2850
- function qn(e) {
2856
+ function On(e) {
2851
2857
  return e.reduce(
2852
2858
  (r, t) => (t.role === "measure" ? r.measures.push(t) : t.role === "date" ? r.timeFields.push(t) : t.role === "dimension" ? r.dimensions.push(t) : t.role === "id" ? r.identifiers.push(t) : r.other.push(t), r),
2853
2859
  {
@@ -2859,7 +2865,7 @@ function qn(e) {
2859
2865
  }
2860
2866
  );
2861
2867
  }
2862
- function An(e) {
2868
+ function Dn(e) {
2863
2869
  var r, t;
2864
2870
  if (e.queryKind === "records" && ((r = e.projectionFieldRefs) != null && r.length) && e.projectionFieldRefs.every((n) => n.role === "measure") && ((t = e.latestAttempt) == null ? void 0 : t.rowCount) === 1)
2865
2871
  return "KPI query";
@@ -2877,15 +2883,15 @@ function An(e) {
2877
2883
  case "sql":
2878
2884
  return "SQL query";
2879
2885
  default:
2880
- return Te(e.queryKind);
2886
+ return ke(e.queryKind);
2881
2887
  }
2882
2888
  }
2883
- function Tn(e) {
2889
+ function Bn(e) {
2884
2890
  return [e.aggregate, e.label || e.name].filter(Boolean).join(" ");
2885
2891
  }
2886
- function kn(e) {
2887
- var c, u, f;
2888
- const r = e.valuePreview || "redacted", t = e.inputLabel || e.inputId, n = ((c = e.fieldRef) == null ? void 0 : c.label) || ((u = e.fieldRef) == null ? void 0 : u.name), i = (f = e.fieldRef) != null && f.source ? F(e.fieldRef.source) : void 0, o = [n ? `on ${n}` : void 0, i].filter(Boolean).join(" · "), s = [
2892
+ function Kn(e) {
2893
+ var f, c, u;
2894
+ const r = e.valuePreview || "redacted", t = e.inputLabel || e.inputId, n = ((f = e.fieldRef) == null ? void 0 : f.label) || ((c = e.fieldRef) == null ? void 0 : c.name), i = (u = e.fieldRef) != null && u.source ? z(e.fieldRef.source) : void 0, o = [n ? `on ${n}` : void 0, i].filter(Boolean).join(" · "), s = [
2889
2895
  t,
2890
2896
  e.inputId,
2891
2897
  e.operator,
@@ -2901,29 +2907,29 @@ function kn(e) {
2901
2907
  title: s
2902
2908
  };
2903
2909
  }
2904
- function F(e) {
2910
+ function z(e) {
2905
2911
  return e.kind === "semantic" ? e.datasetName || e.datasetId || e.domainId : e.kind === "physical" ? [
2906
2912
  e.schemaName,
2907
2913
  e.tableName
2908
2914
  ].filter(Boolean).join(".") || e.tableName : e.connectionId ? `SQL ${e.connectionId}` : "SQL source";
2909
2915
  }
2910
- function Cn(e) {
2916
+ function Wn(e) {
2911
2917
  if (e.file)
2912
2918
  return e.line && e.column ? `${e.file}:${e.line}:${e.column}` : e.line ? `${e.file}:${e.line}` : e.file;
2913
2919
  }
2914
- function En(e) {
2920
+ function Mn(e) {
2915
2921
  return typeof e == "number" ? e.toLocaleString() : "-";
2916
2922
  }
2917
- function Rn(e) {
2923
+ function Nn(e) {
2918
2924
  return typeof e == "number" ? `${Math.round(e)}ms` : "-";
2919
2925
  }
2920
- function Ln(e) {
2921
- return _e(e);
2926
+ function _n(e) {
2927
+ return Fe(e);
2922
2928
  }
2923
- function _e(e) {
2929
+ function Fe(e) {
2924
2930
  return JSON.stringify(e, null, 2) ?? "undefined";
2925
2931
  }
2926
- function $n(e) {
2932
+ function Fn(e) {
2927
2933
  switch (e.type) {
2928
2934
  case "query_started":
2929
2935
  return "Started";
@@ -2936,10 +2942,10 @@ function $n(e) {
2936
2942
  case "input_changed":
2937
2943
  return "Input changed";
2938
2944
  default:
2939
- return Dn(e);
2945
+ return jn(e);
2940
2946
  }
2941
2947
  }
2942
- function On(e) {
2948
+ function zn(e) {
2943
2949
  return [
2944
2950
  e.at,
2945
2951
  "durationMs" in e && typeof e.durationMs == "number" ? `${Math.round(e.durationMs)}ms` : void 0,
@@ -2948,20 +2954,20 @@ function On(e) {
2948
2954
  "errorMessage" in e ? e.errorMessage : void 0
2949
2955
  ].filter(Boolean).join(" - ");
2950
2956
  }
2951
- function Dn(e) {
2957
+ function jn(e) {
2952
2958
  throw new Error(`Unsupported Semaphor trace event: ${JSON.stringify(e)}`);
2953
2959
  }
2954
- function Bn(e) {
2960
+ function Pn(e) {
2955
2961
  return Array.isArray(e) ? e.filter((r) => typeof r == "string") : [];
2956
2962
  }
2957
- function Oe(e) {
2958
- return Array.isArray(e) ? e.map((r) => Kn(r)).filter((r) => !!r) : [];
2963
+ function De(e) {
2964
+ return Array.isArray(e) ? e.map((r) => Hn(r)).filter((r) => !!r) : [];
2959
2965
  }
2960
- function Kn(e) {
2966
+ function Hn(e) {
2961
2967
  var r;
2962
- return (r = Wn(e)) == null ? void 0 : r.message;
2968
+ return (r = Vn(e)) == null ? void 0 : r.message;
2963
2969
  }
2964
- function Wn(e) {
2970
+ function Vn(e) {
2965
2971
  if (typeof e == "string")
2966
2972
  return { message: e };
2967
2973
  if (!e || typeof e != "object" || Array.isArray(e))
@@ -2973,14 +2979,14 @@ function Wn(e) {
2973
2979
  ...i ? { path: i } : {}
2974
2980
  } : t ? { message: t } : n ? { message: n, code: n } : void 0;
2975
2981
  }
2976
- function Nn(e) {
2982
+ function Qn(e) {
2977
2983
  const r = e == null ? void 0 : e.metadata, t = r && typeof r == "object" && !Array.isArray(r) && "dataAppDebug" in r && r.dataAppDebug && typeof r.dataAppDebug == "object" && !Array.isArray(r.dataAppDebug) ? r.dataAppDebug : void 0;
2978
2984
  return {
2979
2985
  compiledSql: typeof (t == null ? void 0 : t.compiledSql) == "string" ? t.compiledSql : void 0,
2980
2986
  queryHash: typeof (t == null ? void 0 : t.queryHash) == "string" ? t.queryHash : void 0
2981
2987
  };
2982
2988
  }
2983
- function Br(e) {
2989
+ function _r(e) {
2984
2990
  return {
2985
2991
  ...e,
2986
2992
  order: [],
@@ -2988,29 +2994,29 @@ function Br(e) {
2988
2994
  sequence: 0
2989
2995
  };
2990
2996
  }
2991
- function Mn(e, r) {
2997
+ function Un(e, r) {
2992
2998
  if (r.type === "config")
2993
2999
  return r.config.enabled ? {
2994
3000
  ...e,
2995
3001
  ...r.config
2996
- } : Br(r.config);
3002
+ } : _r(r.config);
2997
3003
  if (!e.enabled)
2998
3004
  return e;
2999
3005
  switch (r.type) {
3000
3006
  case "register":
3001
- return jn(_n(e, r.descriptor));
3007
+ return Xn(Gn(e, r.descriptor));
3002
3008
  case "unregister":
3003
- return Fn(e, r.traceKey);
3009
+ return Jn(e, r.traceKey);
3004
3010
  case "event":
3005
- return zn(e, r);
3011
+ return Yn(e, r);
3006
3012
  default:
3007
3013
  return e;
3008
3014
  }
3009
3015
  }
3010
- function _n(e, r) {
3011
- const t = e.entries[r.traceKey], n = t ? e.sequence : e.sequence + 1, i = Je(), o = {
3012
- ...t || Pn(r),
3013
- ...Kr(r),
3016
+ function Gn(e, r) {
3017
+ const t = e.entries[r.traceKey], n = t ? e.sequence : e.sequence + 1, i = Ye(), o = {
3018
+ ...t || Zn(r),
3019
+ ...Fr(r),
3014
3020
  traceKey: r.traceKey,
3015
3021
  latestAttempt: (t == null ? void 0 : t.latestAttempt) || { status: "idle" },
3016
3022
  recentEvents: (t == null ? void 0 : t.recentEvents) || [],
@@ -3028,7 +3034,7 @@ function _n(e, r) {
3028
3034
  }
3029
3035
  };
3030
3036
  }
3031
- function Fn(e, r) {
3037
+ function Jn(e, r) {
3032
3038
  const t = e.entries[r];
3033
3039
  return t ? {
3034
3040
  ...e,
@@ -3041,11 +3047,11 @@ function Fn(e, r) {
3041
3047
  }
3042
3048
  } : e;
3043
3049
  }
3044
- function zn(e, r) {
3050
+ function Yn(e, r) {
3045
3051
  const t = e.entries[r.traceKey];
3046
3052
  if (!t)
3047
3053
  return e;
3048
- const n = Je(), i = [
3054
+ const n = Ye(), i = [
3049
3055
  ...t.recentEvents,
3050
3056
  r.event
3051
3057
  ].slice(-e.maxEventsPerQuery);
@@ -3065,7 +3071,7 @@ function zn(e, r) {
3065
3071
  }
3066
3072
  };
3067
3073
  }
3068
- function jn(e) {
3074
+ function Xn(e) {
3069
3075
  if (e.order.length <= e.maxQueries)
3070
3076
  return e;
3071
3077
  const r = e.order.map((i) => e.entries[i]).filter((i) => !!i).sort((i, o) => i.mounted !== o.mounted ? i.mounted ? 1 : -1 : i.lastEventAt - o.lastEventAt), t = e.order.length - e.maxQueries, n = new Set(
@@ -3079,10 +3085,10 @@ function jn(e) {
3079
3085
  )
3080
3086
  } : e;
3081
3087
  }
3082
- function Pn(e) {
3083
- const r = Je();
3088
+ function Zn(e) {
3089
+ const r = Ye();
3084
3090
  return {
3085
- ...Kr(e),
3091
+ ...Fr(e),
3086
3092
  traceKey: e.traceKey,
3087
3093
  latestAttempt: { status: "idle" },
3088
3094
  recentEvents: [],
@@ -3091,14 +3097,14 @@ function Pn(e) {
3091
3097
  lastEventAt: r
3092
3098
  };
3093
3099
  }
3094
- function Kr(e) {
3100
+ function Fr(e) {
3095
3101
  var n;
3096
- const r = Zn(e.spec), t = ei(
3102
+ const r = li(e.spec), t = di(
3097
3103
  e.spec,
3098
3104
  e.activeInputs
3099
3105
  );
3100
3106
  return {
3101
- traceId: Nr(e.traceKey),
3107
+ traceId: jr(e.traceKey),
3102
3108
  viewId: e.viewId,
3103
3109
  viewTitle: e.viewTitle,
3104
3110
  visualType: e.visualType,
@@ -3107,17 +3113,17 @@ function Kr(e) {
3107
3113
  queryLabel: e.queryLabel,
3108
3114
  queryKind: e.queryKind,
3109
3115
  builder: e.builder,
3110
- sourceRefs: Xn(e.intent),
3116
+ sourceRefs: ai(e.intent),
3111
3117
  sourceHints: (n = e.sourceHints) != null && n.length ? e.sourceHints : void 0,
3112
3118
  projectionFieldRefs: r,
3113
3119
  inputFieldRefs: t,
3114
- fieldRefs: ri(e.intent),
3120
+ fieldRefs: ui(e.intent),
3115
3121
  inputsApplied: (e.activeInputs || []).map((i) => ({
3116
3122
  inputId: i.inputId,
3117
3123
  inputLabel: i.label,
3118
3124
  fieldRef: i.field,
3119
3125
  operator: i.operator,
3120
- valuePreview: Jn(i)
3126
+ valuePreview: oi(i)
3121
3127
  })),
3122
3128
  recentEvents: [],
3123
3129
  clientWarnings: e.clientWarnings
@@ -3133,10 +3139,10 @@ function we(e) {
3133
3139
  } = e;
3134
3140
  return o;
3135
3141
  }
3136
- function ue(e) {
3142
+ function ce(e) {
3137
3143
  if (!e.enabled)
3138
- return kr;
3139
- const r = e.order.map((n) => e.entries[n]).filter((n) => !!n).map(we), t = He(r).map(kt);
3144
+ return $r;
3145
+ const r = e.order.map((n) => e.entries[n]).filter((n) => !!n).map(we), t = Ve(r).map(Kt);
3140
3146
  return {
3141
3147
  enabled: !0,
3142
3148
  queries: r,
@@ -3150,72 +3156,72 @@ function ue(e) {
3150
3156
  getQueries: (n) => Object.values(e.entries).filter((i) => i.queryId === n).map(we)
3151
3157
  };
3152
3158
  }
3153
- function Hn(e) {
3159
+ function ei(e) {
3154
3160
  return {
3155
- snapshot: () => $t(ue(e())),
3156
- getQuery: (r) => ar(ue(e()).getQuery(r)),
3157
- getQueries: (r) => ue(e()).getQueries(r).map((t) => ar(t)).filter((t) => !!t),
3158
- getIssues: () => ue(e()).issues
3161
+ snapshot: () => Ft(ce(e())),
3162
+ getQuery: (r) => cr(ce(e()).getQuery(r)),
3163
+ getQueries: (r) => ce(e()).getQueries(r).map((t) => cr(t)).filter((t) => !!t),
3164
+ getIssues: () => ce(e()).issues
3159
3165
  };
3160
3166
  }
3161
- function Vn(e) {
3167
+ function ri(e) {
3162
3168
  return e === void 0 || e === !1 ? {
3163
3169
  enabled: !1,
3164
3170
  exposeWindowBridge: !1,
3165
- maxEventsPerQuery: Re,
3166
- maxQueries: Le
3171
+ maxEventsPerQuery: Le,
3172
+ maxQueries: $e
3167
3173
  } : e === !0 ? {
3168
3174
  enabled: !0,
3169
3175
  exposeWindowBridge: !1,
3170
- maxEventsPerQuery: Re,
3171
- maxQueries: Le
3176
+ maxEventsPerQuery: Le,
3177
+ maxQueries: $e
3172
3178
  } : {
3173
3179
  enabled: e.enabled !== !1,
3174
3180
  exposeWindowBridge: e.exposeWindowBridge === !0,
3175
- maxEventsPerQuery: fr(
3181
+ maxEventsPerQuery: yr(
3176
3182
  e.maxEventsPerQuery,
3177
- Re,
3178
- zt
3183
+ Le,
3184
+ Yt
3179
3185
  ),
3180
- maxQueries: fr(
3186
+ maxQueries: yr(
3181
3187
  e.maxQueries,
3182
- Le,
3183
- jt
3188
+ $e,
3189
+ Xt
3184
3190
  )
3185
3191
  };
3186
3192
  }
3187
- function Qn(e) {
3193
+ function ti(e) {
3188
3194
  const t = [
3189
3195
  e == null ? void 0 : e.sourceHint,
3190
3196
  ...(e == null ? void 0 : e.sourceHints) || []
3191
3197
  ].filter((n) => !!n).map((n) => ({
3192
- file: be(n.file),
3193
- line: cr(n.line),
3194
- column: cr(n.column),
3195
- exportName: be(n.exportName),
3196
- component: be(n.component),
3197
- note: be(n.note)
3198
+ file: ve(n.file),
3199
+ line: mr(n.line),
3200
+ column: mr(n.column),
3201
+ exportName: ve(n.exportName),
3202
+ component: ve(n.component),
3203
+ note: ve(n.note)
3198
3204
  })).filter(
3199
3205
  (n) => !!(n.file || n.line || n.column || n.exportName || n.component || n.note)
3200
3206
  );
3201
3207
  return t.length ? t : void 0;
3202
3208
  }
3203
- function be(e) {
3209
+ function ve(e) {
3204
3210
  if (typeof e != "string")
3205
3211
  return;
3206
3212
  const r = e.trim();
3207
3213
  return r || void 0;
3208
3214
  }
3209
- function cr(e) {
3215
+ function mr(e) {
3210
3216
  return typeof e == "number" && Number.isInteger(e) && e > 0 ? e : void 0;
3211
3217
  }
3212
- function fr(e, r, t) {
3218
+ function yr(e, r, t) {
3213
3219
  return e === void 0 || !Number.isFinite(e) || !Number.isInteger(e) || e <= 0 ? r : Math.min(e, t);
3214
3220
  }
3215
- function Un(e) {
3221
+ function ni(e) {
3216
3222
  return typeof e.id == "string" && e.id.trim() ? e.id : void 0;
3217
3223
  }
3218
- function Gn(e) {
3224
+ function ii(e) {
3219
3225
  switch (e) {
3220
3226
  case "metric":
3221
3227
  return "semaphor.metric";
@@ -3230,14 +3236,14 @@ function Gn(e) {
3230
3236
  case "sql":
3231
3237
  return "semaphor.sql";
3232
3238
  default:
3233
- return Te(e);
3239
+ return ke(e);
3234
3240
  }
3235
3241
  }
3236
- function Te(e) {
3242
+ function ke(e) {
3237
3243
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
3238
3244
  }
3239
- function Jn(e) {
3240
- if (Yn(e))
3245
+ function oi(e) {
3246
+ if (si(e))
3241
3247
  return;
3242
3248
  const r = e.value;
3243
3249
  if (r !== void 0) {
@@ -3247,17 +3253,17 @@ function Jn(e) {
3247
3253
  ).map((n) => String(n));
3248
3254
  if (t.length === r.length && t.length > 0) {
3249
3255
  const n = t.slice(0, 3).join(", "), i = t.length > 3 ? `, +${t.length - 3} more` : "";
3250
- return pr(`${n}${i}`);
3256
+ return hr(`${n}${i}`);
3251
3257
  }
3252
3258
  return `${r.length} selected`;
3253
3259
  }
3254
- return typeof r == "number" || typeof r == "boolean" ? String(r) : typeof r == "string" ? pr(r) : r && typeof r == "object" ? `object(${Object.keys(r).slice(0, 5).join(",")})` : String(r);
3260
+ return typeof r == "number" || typeof r == "boolean" ? String(r) : typeof r == "string" ? hr(r) : r && typeof r == "object" ? `object(${Object.keys(r).slice(0, 5).join(",")})` : String(r);
3255
3261
  }
3256
3262
  }
3257
- function pr(e) {
3263
+ function hr(e) {
3258
3264
  return e.length > 80 ? `${e.slice(0, 77)}...` : e;
3259
3265
  }
3260
- function Yn(e) {
3266
+ function si(e) {
3261
3267
  var t;
3262
3268
  const r = [
3263
3269
  e.inputId,
@@ -3268,125 +3274,125 @@ function Yn(e) {
3268
3274
  (n) => r.includes(n)
3269
3275
  );
3270
3276
  }
3271
- function Xn(e) {
3277
+ function ai(e) {
3272
3278
  const r = [];
3273
- return xe(e, (t) => {
3274
- ti(t) && r.push(t);
3275
- }), at(r);
3279
+ return qe(e, (t) => {
3280
+ ci(t) && r.push(t);
3281
+ }), gt(r);
3276
3282
  }
3277
- function Zn(e) {
3283
+ function li(e) {
3278
3284
  switch (e.queryKind) {
3279
3285
  case "metric":
3280
3286
  case "analysis":
3281
- return J([
3287
+ return Y([
3282
3288
  ...e.measures || [],
3283
3289
  e.primaryMeasure,
3284
3290
  e.dateField,
3285
3291
  ...e.dimensions || []
3286
3292
  ]);
3287
3293
  case "records":
3288
- return J(e.fields || []);
3294
+ return Y(e.fields || []);
3289
3295
  case "inputOptions":
3290
- return J([
3296
+ return Y([
3291
3297
  e.labelField,
3292
3298
  e.valueField,
3293
3299
  e.searchField,
3294
3300
  ...e.disambiguationFields || []
3295
3301
  ]);
3296
3302
  case "sql":
3297
- return J(e.fields || []);
3303
+ return Y(e.fields || []);
3298
3304
  case "matrix":
3299
- return J([
3300
- ...(e.rows || []).map(gr),
3301
- ...(e.columns || []).map(gr),
3305
+ return Y([
3306
+ ...(e.rows || []).map(br),
3307
+ ...(e.columns || []).map(br),
3302
3308
  ...e.measures.flatMap((r) => r.kind === "aggregate" ? [r.field] : Object.values(r.definition.inputs).map((t) => t.field))
3303
3309
  ]);
3304
3310
  default:
3305
- return Te(e);
3311
+ return ke(e);
3306
3312
  }
3307
3313
  }
3308
- function ei(e, r) {
3314
+ function di(e, r) {
3309
3315
  const t = [
3310
- ...(e.inputs || []).map(Wr),
3316
+ ...(e.inputs || []).map(zr),
3311
3317
  ...(r || []).map((n) => n.field)
3312
3318
  ];
3313
- return J(t);
3319
+ return Y(t);
3314
3320
  }
3315
- function J(e) {
3321
+ function Y(e) {
3316
3322
  const r = /* @__PURE__ */ new Map();
3317
3323
  return e.forEach((t) => {
3318
- t && pe(t) && r.set(Ge(t), t);
3324
+ t && ge(t) && r.set(Je(t), t);
3319
3325
  }), [...r.values()];
3320
3326
  }
3321
- function Wr(e) {
3327
+ function zr(e) {
3322
3328
  if (!e || typeof e != "object")
3323
3329
  return;
3324
3330
  const r = e.toAnalyticsInput;
3325
3331
  if (typeof r == "function") {
3326
3332
  const n = r.call(e);
3327
- return Wr(n);
3333
+ return zr(n);
3328
3334
  }
3329
3335
  const t = e.field;
3330
- return pe(t) ? t : void 0;
3336
+ return ge(t) ? t : void 0;
3331
3337
  }
3332
- function gr(e) {
3333
- if (pe(e))
3338
+ function br(e) {
3339
+ if (ge(e))
3334
3340
  return e;
3335
3341
  if (!e || typeof e != "object")
3336
3342
  return;
3337
3343
  const r = e.field;
3338
- return pe(r) ? r : void 0;
3344
+ return ge(r) ? r : void 0;
3339
3345
  }
3340
- function ri(e) {
3346
+ function ui(e) {
3341
3347
  const r = /* @__PURE__ */ new Map();
3342
- return xe(e, (t) => {
3343
- pe(t) && r.set(Ge(t), t);
3348
+ return qe(e, (t) => {
3349
+ ge(t) && r.set(Je(t), t);
3344
3350
  }), [...r.values()];
3345
3351
  }
3346
- function xe(e, r) {
3352
+ function qe(e, r) {
3347
3353
  if (!(!e || typeof e != "object")) {
3348
3354
  if (r(e), Array.isArray(e)) {
3349
- e.forEach((t) => xe(t, r));
3355
+ e.forEach((t) => qe(t, r));
3350
3356
  return;
3351
3357
  }
3352
3358
  Object.values(e).forEach(
3353
- (t) => xe(t, r)
3359
+ (t) => qe(t, r)
3354
3360
  );
3355
3361
  }
3356
3362
  }
3357
- function ti(e) {
3363
+ function ci(e) {
3358
3364
  if (!e || typeof e != "object")
3359
3365
  return !1;
3360
3366
  const r = e;
3361
3367
  return r.kind === "semantic" ? typeof r.domainId == "string" && typeof r.datasetName == "string" : r.kind === "physical" ? typeof r.connectionId == "string" && typeof r.tableName == "string" : r.kind === "sql" ? typeof r.connectionId == "string" : !1;
3362
3368
  }
3363
- function pe(e) {
3369
+ function ge(e) {
3364
3370
  if (!e || typeof e != "object")
3365
3371
  return !1;
3366
3372
  const r = e;
3367
3373
  return typeof r.name == "string" && (r.source !== void 0 || r.role !== void 0 || r.dataType !== void 0 || r.aggregate !== void 0);
3368
3374
  }
3369
- function Ge(e) {
3375
+ function Je(e) {
3370
3376
  return [
3371
3377
  e.name,
3372
3378
  e.role,
3373
3379
  e.aggregate,
3374
- e.source ? st(e.source) : ""
3380
+ e.source ? pt(e.source) : ""
3375
3381
  ].join(":");
3376
3382
  }
3377
- function ni(e) {
3383
+ function fi(e) {
3378
3384
  const r = e;
3379
3385
  return typeof (r == null ? void 0 : r.rowCount) == "number" ? r.rowCount : Array.isArray(r == null ? void 0 : r.records) ? r.records.length : void 0;
3380
3386
  }
3381
- function ii(e) {
3387
+ function pi(e) {
3382
3388
  const r = e;
3383
3389
  return Array.isArray(r == null ? void 0 : r.columns) ? r.columns.length : void 0;
3384
3390
  }
3385
- function mr(e) {
3391
+ function vr(e) {
3386
3392
  const r = e;
3387
3393
  return r == null ? void 0 : r.executionResult;
3388
3394
  }
3389
- function oi(e) {
3395
+ function gi(e) {
3390
3396
  const r = e, t = [
3391
3397
  ...r != null && r.measures ? Object.keys(r.measures) : [],
3392
3398
  ...r != null && r.measureBindings ? Object.keys(r.measureBindings) : []
@@ -3399,41 +3405,41 @@ function oi(e) {
3399
3405
  ...n.length > 0 ? { missingMeasures: n } : {}
3400
3406
  };
3401
3407
  }
3402
- function si(e) {
3408
+ function mi(e) {
3403
3409
  const r = e;
3404
3410
  if (!r || typeof r != "object")
3405
3411
  return;
3406
3412
  const t = {};
3407
- return Fe(r.primaryValue) && (t.primaryValue = r.primaryValue), Fe(r.comparisonValue) && (t.comparisonValue = r.comparisonValue), typeof r.comparisonKind == "string" && (t.comparisonKind = r.comparisonKind), (typeof r.delta == "number" || r.delta === null) && (t.delta = r.delta), (typeof r.deltaPercent == "number" || r.deltaPercent === null) && (t.deltaPercent = r.deltaPercent), ai(r.measures) && (t.measures = r.measures), li(r.measureBindings) && (t.measureBindings = r.measureBindings), Array.isArray(r.missingMeasures) && (t.missingMeasures = r.missingMeasures.filter(
3413
+ return ze(r.primaryValue) && (t.primaryValue = r.primaryValue), ze(r.comparisonValue) && (t.comparisonValue = r.comparisonValue), typeof r.comparisonKind == "string" && (t.comparisonKind = r.comparisonKind), (typeof r.delta == "number" || r.delta === null) && (t.delta = r.delta), (typeof r.deltaPercent == "number" || r.deltaPercent === null) && (t.deltaPercent = r.deltaPercent), yi(r.measures) && (t.measures = r.measures), hi(r.measureBindings) && (t.measureBindings = r.measureBindings), Array.isArray(r.missingMeasures) && (t.missingMeasures = r.missingMeasures.filter(
3408
3414
  (n) => typeof n == "string" && !!n
3409
3415
  )), Object.keys(t).length > 0 ? t : void 0;
3410
3416
  }
3411
- function Fe(e) {
3417
+ function ze(e) {
3412
3418
  return e === null || typeof e == "number" || typeof e == "string";
3413
3419
  }
3414
- function ai(e) {
3415
- return e !== null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every(Fe);
3420
+ function yi(e) {
3421
+ return e !== null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every(ze);
3416
3422
  }
3417
- function li(e) {
3423
+ function hi(e) {
3418
3424
  return e !== null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every((r) => typeof r == "string");
3419
3425
  }
3420
- function yr(e) {
3426
+ function Sr(e) {
3421
3427
  const r = e;
3422
3428
  return typeof (r == null ? void 0 : r.requestId) == "string" ? r.requestId : void 0;
3423
3429
  }
3424
- function Nr(e) {
3430
+ function jr(e) {
3425
3431
  let r = 2166136261;
3426
3432
  for (let t = 0; t < e.length; t += 1)
3427
3433
  r ^= e.charCodeAt(t), r = Math.imul(r, 16777619);
3428
3434
  return (r >>> 0).toString(36);
3429
3435
  }
3430
- function ve() {
3436
+ function Se() {
3431
3437
  return (/* @__PURE__ */ new Date()).toISOString();
3432
3438
  }
3433
- function Je() {
3439
+ function Ye() {
3434
3440
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
3435
3441
  }
3436
- const di = [
3442
+ const bi = [
3437
3443
  "primary",
3438
3444
  "comparisons",
3439
3445
  "contributors",
@@ -3447,7 +3453,7 @@ const di = [
3447
3453
  "largestPositiveChanges",
3448
3454
  "largestNegativeDrivers",
3449
3455
  "largestPositiveDrivers"
3450
- ], ui = [
3456
+ ], vi = [
3451
3457
  "primary",
3452
3458
  "records",
3453
3459
  "periodChanges",
@@ -3462,12 +3468,12 @@ const di = [
3462
3468
  "largestNegativeDrivers",
3463
3469
  "largestPositiveDrivers"
3464
3470
  ];
3465
- function Mr(e) {
3471
+ function Pr(e) {
3466
3472
  if (!e)
3467
3473
  return {};
3468
- const r = yi(e.executionResult), t = ci(e, r), n = gi(t), i = _r(
3469
- Xe(e.analysisWarnings),
3470
- vi(t)
3474
+ const r = Ai(e.executionResult), t = Si(e, r), n = xi(t), i = Hr(
3475
+ Ze(e.analysisWarnings),
3476
+ Ci(t)
3471
3477
  );
3472
3478
  return {
3473
3479
  ...e,
@@ -3480,19 +3486,19 @@ function Mr(e) {
3480
3486
  } : {}
3481
3487
  };
3482
3488
  }
3483
- function ci(e, r) {
3484
- const t = fi(e.resultSets);
3485
- for (const i of di) {
3489
+ function Si(e, r) {
3490
+ const t = wi(e.resultSets);
3491
+ for (const i of bi) {
3486
3492
  if (t[i])
3487
3493
  continue;
3488
- const o = hi(e[i]);
3494
+ const o = Ti(e[i]);
3489
3495
  if (!o.length)
3490
3496
  continue;
3491
- const s = r.length ? r : bi(o);
3497
+ const s = r.length ? r : ki(o);
3492
3498
  t[i] = {
3493
3499
  id: i,
3494
3500
  role: i,
3495
- ...Ye({
3501
+ ...Xe({
3496
3502
  records: o,
3497
3503
  columns: s,
3498
3504
  resultSetKey: i
@@ -3501,20 +3507,20 @@ function ci(e, r) {
3501
3507
  rowCount: o.length
3502
3508
  };
3503
3509
  }
3504
- const n = mi(e.executionResult);
3510
+ const n = qi(e.executionResult);
3505
3511
  return n && n.records.length > 0 && !t.records && (t.records = n), t;
3506
3512
  }
3507
- function fi(e) {
3513
+ function wi(e) {
3508
3514
  return Object.fromEntries(
3509
3515
  Object.entries(e || {}).map(([r, t]) => [
3510
3516
  r,
3511
- pi(t, r)
3517
+ Ii(t, r)
3512
3518
  ])
3513
3519
  );
3514
3520
  }
3515
- function pi(e, r = e.id || e.role || "resultSet") {
3521
+ function Ii(e, r = e.id || e.role || "resultSet") {
3516
3522
  var n;
3517
- const t = Ye({
3523
+ const t = Xe({
3518
3524
  records: e.records || [],
3519
3525
  columns: e.columns || [],
3520
3526
  resultSetKey: r
@@ -3523,28 +3529,28 @@ function pi(e, r = e.id || e.role || "resultSet") {
3523
3529
  ...e,
3524
3530
  ...t,
3525
3531
  ...e.warnings || t.warnings ? {
3526
- warnings: _r(
3527
- Xe(e.warnings),
3532
+ warnings: Hr(
3533
+ Ze(e.warnings),
3528
3534
  t.warnings
3529
3535
  )
3530
3536
  } : {},
3531
3537
  rowCount: e.rowCount ?? ((n = e.records) == null ? void 0 : n.length) ?? 0
3532
3538
  };
3533
3539
  }
3534
- function gi(e) {
3540
+ function xi(e) {
3535
3541
  var r;
3536
- for (const t of ui)
3542
+ for (const t of vi)
3537
3543
  if ((r = e[t]) != null && r.records.length)
3538
3544
  return e[t];
3539
3545
  return Object.values(e).find((t) => t.records.length) || Object.values(e)[0];
3540
3546
  }
3541
- function mi(e) {
3547
+ function qi(e) {
3542
3548
  const r = e == null ? void 0 : e.result;
3543
3549
  if (!(!r || r.kind !== "records" && r.kind !== "sql"))
3544
3550
  return {
3545
3551
  id: "records",
3546
3552
  role: "records",
3547
- ...Ye({
3553
+ ...Xe({
3548
3554
  records: r.records,
3549
3555
  columns: r.columns,
3550
3556
  resultSetKey: "records"
@@ -3553,16 +3559,16 @@ function mi(e) {
3553
3559
  rowCount: r.rowCount ?? r.records.length
3554
3560
  };
3555
3561
  }
3556
- function yi(e) {
3562
+ function Ai(e) {
3557
3563
  const r = e == null ? void 0 : e.result;
3558
3564
  return !r || r.kind !== "records" && r.kind !== "sql" ? [] : r.columns;
3559
3565
  }
3560
- function hi(e) {
3566
+ function Ti(e) {
3561
3567
  return Array.isArray(e) ? e.filter(
3562
3568
  (r) => !!(r && typeof r == "object" && !Array.isArray(r))
3563
3569
  ) : [];
3564
3570
  }
3565
- function Ye({
3571
+ function Xe({
3566
3572
  records: e,
3567
3573
  columns: r,
3568
3574
  resultSetKey: t
@@ -3572,10 +3578,10 @@ function Ye({
3572
3578
  const n = [];
3573
3579
  return {
3574
3580
  records: e.map((o, s) => {
3575
- const c = {};
3576
- return r.forEach((u) => {
3577
- if (Object.prototype.hasOwnProperty.call(o, u.key)) {
3578
- c[u.key] = o[u.key];
3581
+ const f = {};
3582
+ return r.forEach((c) => {
3583
+ if (Object.prototype.hasOwnProperty.call(o, c.key)) {
3584
+ f[c.key] = o[c.key];
3579
3585
  return;
3580
3586
  }
3581
3587
  n.push({
@@ -3583,18 +3589,18 @@ function Ye({
3583
3589
  severity: "warning",
3584
3590
  resultSetKey: t,
3585
3591
  rowIndex: s,
3586
- columnKey: u.key,
3587
- ...u.name ? { columnName: u.name } : {},
3588
- ...u.label ? { columnLabel: u.label } : {},
3592
+ columnKey: c.key,
3593
+ ...c.name ? { columnName: c.name } : {},
3594
+ ...c.label ? { columnLabel: c.label } : {},
3589
3595
  availableKeys: Object.keys(o),
3590
- message: `Analysis result set "${t}" row ${s} is missing column key "${u.key}". Rows must expose values by column.key; labels and column names are display metadata only.`
3596
+ message: `Analysis result set "${t}" row ${s} is missing column key "${c.key}". Rows must expose values by column.key; labels and column names are display metadata only.`
3591
3597
  });
3592
- }), c;
3598
+ }), f;
3593
3599
  }),
3594
3600
  ...n.length ? { warnings: n } : {}
3595
3601
  };
3596
3602
  }
3597
- function bi(e) {
3603
+ function ki(e) {
3598
3604
  return Array.from(
3599
3605
  new Set(e.flatMap((t) => Object.keys(t)))
3600
3606
  ).map((t) => ({
@@ -3603,219 +3609,227 @@ function bi(e) {
3603
3609
  label: t
3604
3610
  }));
3605
3611
  }
3606
- function vi(e) {
3612
+ function Ci(e) {
3607
3613
  return Object.values(e).flatMap(
3608
- (r) => Xe(r.warnings)
3614
+ (r) => Ze(r.warnings)
3609
3615
  );
3610
3616
  }
3611
- function Xe(e) {
3612
- return Array.isArray(e) ? e.filter(wi) : [];
3617
+ function Ze(e) {
3618
+ return Array.isArray(e) ? e.filter(Ei) : [];
3613
3619
  }
3614
- function wi(e) {
3620
+ function Ei(e) {
3615
3621
  return !!(e && typeof e == "object" && !Array.isArray(e));
3616
3622
  }
3617
- function _r(...e) {
3623
+ function Hr(...e) {
3618
3624
  const r = /* @__PURE__ */ new Set(), t = [];
3619
3625
  for (const n of e.flatMap((i) => i || [])) {
3620
- const i = Si(n);
3626
+ const i = Ri(n);
3621
3627
  r.has(i) || (r.add(i), t.push(n));
3622
3628
  }
3623
3629
  return t;
3624
3630
  }
3625
- function Si(e) {
3631
+ function Ri(e) {
3626
3632
  return e.code === "missing_analysis_result_key" ? [
3627
3633
  e.code,
3628
3634
  e.resultSetKey,
3629
3635
  e.rowIndex,
3630
3636
  e.columnKey
3631
- ].join(":") : ze(e);
3637
+ ].join(":") : je(e);
3632
3638
  }
3633
- function ze(e) {
3639
+ function je(e) {
3634
3640
  if (!e || typeof e != "object")
3635
3641
  return JSON.stringify(e);
3636
3642
  if (Array.isArray(e))
3637
- return `[${e.map((t) => ze(t)).join(",")}]`;
3643
+ return `[${e.map((t) => je(t)).join(",")}]`;
3638
3644
  const r = e;
3639
- return `{${Object.keys(r).sort().map((t) => `${JSON.stringify(t)}:${ze(r[t])}`).join(",")}}`;
3645
+ return `{${Object.keys(r).sort().map((t) => `${JSON.stringify(t)}:${je(r[t])}`).join(",")}}`;
3640
3646
  }
3641
- const De = {
3647
+ const Be = {
3642
3648
  primaryValue: null
3643
- }, Be = {}, Ii = { records: [] }, Ke = { options: [] }, xi = { records: [] }, We = {};
3644
- function qi(e) {
3645
- const r = Y(e.inputs), t = rt(e);
3649
+ }, Ke = {}, Li = { records: [] }, We = { options: [] }, $i = { records: [] }, Me = {};
3650
+ function G(e, r) {
3651
+ const t = nt(r);
3652
+ return t.length === 0 ? e : {
3653
+ ...e,
3654
+ selections: t,
3655
+ queryKey: JSON.stringify([e.queryKey, t])
3656
+ };
3657
+ }
3658
+ function Oi(e) {
3659
+ const r = X(e.inputs), t = lt(e);
3646
3660
  try {
3647
- const n = tt(e), i = Z(n, "analysis");
3661
+ const n = dt(e), i = ee(n, "analysis");
3648
3662
  return i ? {
3649
3663
  error: i,
3650
3664
  activeInputs: r,
3651
3665
  analysisOptions: t,
3652
- queryKey: A(
3666
+ queryKey: k(
3653
3667
  void 0,
3654
3668
  r,
3655
3669
  i,
3656
3670
  t
3657
3671
  ),
3658
- idleData: Be
3672
+ idleData: Ke
3659
3673
  } : {
3660
3674
  intent: n,
3661
3675
  error: null,
3662
3676
  activeInputs: r,
3663
3677
  analysisOptions: t,
3664
- queryKey: A(n, r, void 0, t),
3665
- idleData: Be
3678
+ queryKey: k(n, r, void 0, t),
3679
+ idleData: Ke
3666
3680
  };
3667
3681
  } catch (n) {
3668
- const i = X(n, "analysis");
3682
+ const i = Z(n, "analysis");
3669
3683
  return {
3670
3684
  error: i,
3671
3685
  activeInputs: r,
3672
3686
  analysisOptions: t,
3673
- queryKey: A(
3687
+ queryKey: k(
3674
3688
  void 0,
3675
3689
  r,
3676
3690
  i,
3677
3691
  t
3678
3692
  ),
3679
- idleData: Be
3693
+ idleData: Ke
3680
3694
  };
3681
3695
  }
3682
3696
  }
3683
- function Ai(e) {
3684
- const r = Y(e.inputs);
3697
+ function Di(e) {
3698
+ const r = X(e.inputs);
3685
3699
  try {
3686
- const t = nt(e), n = Z(t);
3700
+ const t = ut(e), n = ee(t);
3687
3701
  return n ? {
3688
3702
  error: n,
3689
3703
  activeInputs: r,
3690
- queryKey: A(void 0, r, n),
3691
- idleData: De
3704
+ queryKey: k(void 0, r, n),
3705
+ idleData: Be
3692
3706
  } : {
3693
3707
  intent: t,
3694
3708
  error: null,
3695
3709
  activeInputs: r,
3696
- queryKey: A(t, r),
3697
- idleData: De
3710
+ queryKey: k(t, r),
3711
+ idleData: Be
3698
3712
  };
3699
3713
  } catch (t) {
3700
- const n = X(t, "metric");
3714
+ const n = Z(t, "metric");
3701
3715
  return {
3702
3716
  error: n,
3703
3717
  activeInputs: r,
3704
- queryKey: A(void 0, r, n),
3705
- idleData: De
3718
+ queryKey: k(void 0, r, n),
3719
+ idleData: Be
3706
3720
  };
3707
3721
  }
3708
3722
  }
3709
- function Ti(e) {
3710
- const r = Y(e.inputs), t = Ii;
3723
+ function Bi(e) {
3724
+ const r = X(e.inputs), t = Li;
3711
3725
  try {
3712
- const n = et(e), i = Z(n);
3726
+ const n = at(e), i = ee(n);
3713
3727
  return i ? {
3714
3728
  error: i,
3715
3729
  activeInputs: r,
3716
- queryKey: A(void 0, r, i),
3730
+ queryKey: k(void 0, r, i),
3717
3731
  idleData: t
3718
3732
  } : {
3719
3733
  intent: n,
3720
3734
  error: null,
3721
3735
  activeInputs: r,
3722
- queryKey: A(n, r),
3736
+ queryKey: k(n, r),
3723
3737
  idleData: t
3724
3738
  };
3725
3739
  } catch (n) {
3726
- const i = X(n, "records");
3740
+ const i = Z(n, "records");
3727
3741
  return {
3728
3742
  error: i,
3729
3743
  activeInputs: r,
3730
- queryKey: A(void 0, r, i),
3744
+ queryKey: k(void 0, r, i),
3731
3745
  idleData: t
3732
3746
  };
3733
3747
  }
3734
3748
  }
3735
- function ki(e) {
3736
- const r = Y(e.inputs);
3749
+ function Ki(e) {
3750
+ const r = X(e.inputs);
3737
3751
  try {
3738
- const t = Zr(e), n = Z(t);
3752
+ const t = st(e), n = ee(t);
3739
3753
  return n ? {
3740
3754
  error: n,
3741
3755
  activeInputs: r,
3742
- queryKey: A(void 0, r, n),
3743
- idleData: Ke
3756
+ queryKey: k(void 0, r, n),
3757
+ idleData: We
3744
3758
  } : {
3745
3759
  intent: t,
3746
3760
  error: null,
3747
3761
  activeInputs: r,
3748
- queryKey: A(t, r),
3749
- idleData: Ke
3762
+ queryKey: k(t, r),
3763
+ idleData: We
3750
3764
  };
3751
3765
  } catch (t) {
3752
- const n = X(t, "inputOptions");
3766
+ const n = Z(t, "inputOptions");
3753
3767
  return {
3754
3768
  error: n,
3755
3769
  activeInputs: r,
3756
- queryKey: A(void 0, r, n),
3757
- idleData: Ke
3770
+ queryKey: k(void 0, r, n),
3771
+ idleData: We
3758
3772
  };
3759
3773
  }
3760
3774
  }
3761
- function Ci(e) {
3762
- const r = Y(e.inputs), t = xi;
3775
+ function Wi(e) {
3776
+ const r = X(e.inputs), t = $i;
3763
3777
  try {
3764
- const n = Xr(e), i = Z(n);
3778
+ const n = ot(e), i = ee(n);
3765
3779
  return i ? {
3766
3780
  error: i,
3767
3781
  activeInputs: r,
3768
- queryKey: A(void 0, r, i),
3782
+ queryKey: k(void 0, r, i),
3769
3783
  idleData: t
3770
3784
  } : {
3771
3785
  intent: n,
3772
3786
  error: null,
3773
3787
  activeInputs: r,
3774
- queryKey: A(n, r),
3788
+ queryKey: k(n, r),
3775
3789
  idleData: t
3776
3790
  };
3777
3791
  } catch (n) {
3778
- const i = X(n, "sql");
3792
+ const i = Z(n, "sql");
3779
3793
  return {
3780
3794
  error: i,
3781
3795
  activeInputs: r,
3782
- queryKey: A(void 0, r, i),
3796
+ queryKey: k(void 0, r, i),
3783
3797
  idleData: t
3784
3798
  };
3785
3799
  }
3786
3800
  }
3787
- function Ei(e) {
3788
- const r = Y(e.inputs);
3801
+ function Mi(e) {
3802
+ const r = X(e.inputs);
3789
3803
  try {
3790
- const t = Yr(e), n = dt.parse(e.matrixWindowRequest), i = Z(t);
3804
+ const t = it(e), n = ht.parse(e.matrixWindowRequest), i = ee(t);
3791
3805
  return i ? {
3792
3806
  error: i,
3793
3807
  activeInputs: r,
3794
- queryKey: A(void 0, r, i),
3795
- idleData: We
3808
+ queryKey: k(void 0, r, i),
3809
+ idleData: Me
3796
3810
  } : {
3797
3811
  intent: t,
3798
3812
  error: null,
3799
3813
  activeInputs: r,
3800
3814
  matrixWindowRequest: n,
3801
- queryKey: JSON.stringify([A(t, r), n]),
3802
- idleData: We
3815
+ queryKey: JSON.stringify([k(t, r), n]),
3816
+ idleData: Me
3803
3817
  };
3804
3818
  } catch (t) {
3805
- const n = X(t, "matrix");
3819
+ const n = Z(t, "matrix");
3806
3820
  return {
3807
3821
  error: n,
3808
3822
  activeInputs: r,
3809
- queryKey: A(void 0, r, n),
3810
- idleData: We
3823
+ queryKey: k(void 0, r, n),
3824
+ idleData: Me
3811
3825
  };
3812
3826
  }
3813
3827
  }
3814
- function je(e) {
3828
+ function Pe(e) {
3815
3829
  var o;
3816
- if (Ri(e))
3830
+ if (Ni(e))
3817
3831
  return e;
3818
- const r = e instanceof Error ? e : void 0, t = e, n = t == null ? void 0 : t.executionResult, i = ke(
3832
+ const r = e instanceof Error ? e : void 0, t = e, n = t == null ? void 0 : t.executionResult, i = Ce(
3819
3833
  (r == null ? void 0 : r.message) ?? String(e),
3820
3834
  {
3821
3835
  requestId: typeof (t == null ? void 0 : t.requestId) == "string" ? t.requestId : void 0,
@@ -3827,8 +3841,8 @@ function je(e) {
3827
3841
  );
3828
3842
  return i.name = (r == null ? void 0 : r.name) || i.name, i.stack = r == null ? void 0 : r.stack, i;
3829
3843
  }
3830
- function X(e, r) {
3831
- const t = je(e);
3844
+ function Z(e, r) {
3845
+ const t = Pe(e);
3832
3846
  if (t.executionResult || t.validation)
3833
3847
  return t;
3834
3848
  const n = {
@@ -3848,39 +3862,39 @@ function X(e, r) {
3848
3862
  recommendedNextStep: "Update the Data App query spec to satisfy the SDK builder contract."
3849
3863
  }
3850
3864
  ]
3851
- }, i = Fr(
3865
+ }, i = Vr(
3852
3866
  void 0,
3853
3867
  r,
3854
3868
  n
3855
- ), o = ke(t.message, {
3869
+ ), o = Ce(t.message, {
3856
3870
  executionResult: i,
3857
3871
  validation: n,
3858
3872
  validationIssues: n.errors
3859
3873
  });
3860
3874
  return o.stack = t.stack, o;
3861
3875
  }
3862
- function ke(e, r = {}) {
3876
+ function Ce(e, r = {}) {
3863
3877
  var i, o, s;
3864
3878
  const t = new Error(e);
3865
3879
  t.name = "SemaphorDataAppQueryError", t.kind = "data_app_query_error", r.requestId && (t.requestId = r.requestId), r.details !== void 0 && (t.details = r.details), r.executionResult !== void 0 && (t.executionResult = r.executionResult), r.validation !== void 0 && (t.validation = r.validation);
3866
3880
  const n = r.validationIssues ?? ((i = r.validation) == null ? void 0 : i.errors) ?? ((s = (o = r.executionResult) == null ? void 0 : o.validation) == null ? void 0 : s.errors);
3867
3881
  return n !== void 0 && (t.validationIssues = n), t;
3868
3882
  }
3869
- function Ri(e) {
3883
+ function Ni(e) {
3870
3884
  return e instanceof Error && e.kind === "data_app_query_error";
3871
3885
  }
3872
- function Z(e, r = e.kind) {
3873
- const t = lt(e);
3886
+ function ee(e, r = e.kind) {
3887
+ const t = mt(e);
3874
3888
  if (t.ok)
3875
3889
  return null;
3876
3890
  const n = t.errors.map(
3877
3891
  (o) => o.path ? `${o.code} at ${o.path}: ${o.message}` : `${o.code}: ${o.message}`
3878
- ).join("; "), i = Fr(
3892
+ ).join("; "), i = Vr(
3879
3893
  e,
3880
3894
  r,
3881
3895
  t
3882
3896
  );
3883
- return ke(
3897
+ return Ce(
3884
3898
  `Invalid Semaphor analytics intent. ${n}`,
3885
3899
  {
3886
3900
  executionResult: i,
@@ -3889,9 +3903,9 @@ function Z(e, r = e.kind) {
3889
3903
  }
3890
3904
  );
3891
3905
  }
3892
- function Fr(e, r, t) {
3906
+ function Vr(e, r, t) {
3893
3907
  return {
3894
- ...Ie(e) ? { intentId: Ie(e) } : {},
3908
+ ...xe(e) ? { intentId: xe(e) } : {},
3895
3909
  ...e ? { intent: e } : {},
3896
3910
  status: "failed",
3897
3911
  resultShape: r,
@@ -3928,7 +3942,7 @@ function Fr(e, r, t) {
3928
3942
  }
3929
3943
  };
3930
3944
  }
3931
- function A(e, r, t, n) {
3945
+ function k(e, r, t, n) {
3932
3946
  return JSON.stringify({
3933
3947
  intent: e,
3934
3948
  activeInputs: r,
@@ -3936,22 +3950,22 @@ function A(e, r, t, n) {
3936
3950
  error: t == null ? void 0 : t.message
3937
3951
  });
3938
3952
  }
3939
- function Li() {
3953
+ function _i() {
3940
3954
  return {
3941
- executeAnalysis: (e, r, t) => le(
3955
+ executeAnalysis: (e, r, t) => de(
3942
3956
  e,
3943
3957
  r,
3944
3958
  t ?? {}
3945
- ).then(Mr),
3946
- executeMetric: (e, r) => le(e, r),
3947
- executeRecords: (e, r) => le(e, r),
3948
- executeInputOptions: (e, r) => le(e, r),
3949
- executeSql: (e, r) => le(e, r),
3959
+ ).then(Pr),
3960
+ executeMetric: (e, r) => de(e, r),
3961
+ executeRecords: (e, r) => de(e, r),
3962
+ executeInputOptions: (e, r) => de(e, r),
3963
+ executeSql: (e, r) => de(e, r),
3950
3964
  executeMatrix: async (e, r) => {
3951
3965
  var n, i;
3952
- const t = await $i(e, r);
3966
+ const t = await Fi(e, r);
3953
3967
  if (t.status === "failed")
3954
- throw jr(
3968
+ throw Ur(
3955
3969
  ((n = t.metadata.matrixFailure) == null ? void 0 : n.message) ?? "Matrix execution failed.",
3956
3970
  { executionResult: t }
3957
3971
  );
@@ -3959,72 +3973,78 @@ function Li() {
3959
3973
  }
3960
3974
  };
3961
3975
  }
3962
- async function le(e, r, t) {
3976
+ async function de(e, r, t) {
3963
3977
  if (!r.token)
3964
3978
  throw new Error(
3965
3979
  "SemaphorDataAppProvider needs a token to execute queries."
3966
3980
  );
3967
- const n = Hr(r), i = Di(e, n);
3981
+ const n = Jr(r), i = ji(e, n);
3968
3982
  let o;
3969
3983
  try {
3970
- o = await zr({
3984
+ o = await Qr({
3971
3985
  intent: e,
3972
3986
  activeInputs: r.activeInputs,
3987
+ selections: r.selections,
3973
3988
  ...t ? { analysisOptions: t } : {},
3974
3989
  resultShape: e.kind,
3975
- ...Oi(r) ? { debug: { responseDetail: "debug" } } : {}
3990
+ ...zi(r) ? { debug: { responseDetail: "debug" } } : {}
3976
3991
  }, r);
3977
- } catch (c) {
3992
+ } catch (f) {
3978
3993
  throw new Error(
3979
- `${i}: ${c instanceof Error ? c.message : String(c)}`
3994
+ `${i}: ${f instanceof Error ? f.message : String(f)}`
3980
3995
  );
3981
3996
  }
3982
- const s = await Pr(o);
3997
+ const s = await Gr(o);
3983
3998
  if (!o.ok || s.error)
3984
- throw jr(
3999
+ throw Ur(
3985
4000
  `${i}: ${s.error || `Semaphor Data App execution failed with status ${o.status}.`}`,
3986
4001
  s
3987
4002
  );
3988
4003
  return s;
3989
4004
  }
3990
- function zr(e, r, t) {
4005
+ function Qr(e, r, t) {
3991
4006
  if (!r.token) throw new Error("SemaphorDataAppProvider needs a token to execute queries.");
3992
- return fetch(Hr(r), {
4007
+ return fetch(Jr(r), {
3993
4008
  method: "POST",
3994
4009
  signal: t,
3995
4010
  headers: { "Content-Type": "application/json", Authorization: `Bearer ${r.token}` },
3996
4011
  body: JSON.stringify(e)
3997
4012
  });
3998
4013
  }
3999
- async function $i(e, r, t) {
4000
- const n = ut.parse(e), i = await zr({ ...n, activeInputs: r.activeInputs, resultShape: "matrix" }, r, t), o = await Pr(i), s = ct.safeParse(o.executionResult);
4014
+ async function Fi(e, r, t) {
4015
+ const n = bt.parse(e), i = await Qr({
4016
+ ...n,
4017
+ activeInputs: r.activeInputs,
4018
+ selections: r.selections,
4019
+ resultShape: "matrix"
4020
+ }, r, t), o = await Gr(i), s = vt.safeParse(o.executionResult);
4001
4021
  if (!s.success) throw new Error(o.error || "Matrix execution returned an invalid governed result.");
4002
4022
  if (!i.ok && s.data.status !== "failed") throw new Error(o.error || `Matrix request failed (${i.status}).`);
4003
4023
  return s.data;
4004
4024
  }
4005
- function jr(e, r) {
4025
+ function Ur(e, r) {
4006
4026
  var t;
4007
- return ke(e, {
4027
+ return Ce(e, {
4008
4028
  requestId: r.requestId,
4009
4029
  details: r.details,
4010
4030
  executionResult: r.executionResult,
4011
4031
  validation: (t = r.executionResult) == null ? void 0 : t.validation
4012
4032
  });
4013
4033
  }
4014
- function Oi(e) {
4034
+ function zi(e) {
4015
4035
  const r = e.debug;
4016
4036
  return r ? r === !0 ? !0 : r.enabled !== !1 && r.requestServerDebug !== !1 : !1;
4017
4037
  }
4018
- function Di(e, r) {
4038
+ function ji(e, r) {
4019
4039
  return [
4020
4040
  `Semaphor ${e.kind} query`,
4021
- Ie(e) ? `id=${Ie(e)}` : void 0,
4041
+ xe(e) ? `id=${xe(e)}` : void 0,
4022
4042
  "label" in e && e.label ? `label=${e.label}` : void 0,
4023
- Bi(e),
4024
- `endpoint=${Ki(r)}`
4043
+ Pi(e),
4044
+ `endpoint=${Hi(r)}`
4025
4045
  ].filter((t) => !!t).join(" ");
4026
4046
  }
4027
- function Bi(e) {
4047
+ function Pi(e) {
4028
4048
  const r = "source" in e ? e.source : void 0;
4029
4049
  if (!(!r || typeof r != "object")) {
4030
4050
  if (r.kind === "semantic")
@@ -4043,7 +4063,7 @@ function Bi(e) {
4043
4063
  return r.connectionId ? `source=${r.connectionId}` : void 0;
4044
4064
  }
4045
4065
  }
4046
- function Ki(e) {
4066
+ function Hi(e) {
4047
4067
  if (!e)
4048
4068
  return "/api/v1/data-app/execute";
4049
4069
  try {
@@ -4052,7 +4072,7 @@ function Ki(e) {
4052
4072
  return e;
4053
4073
  }
4054
4074
  }
4055
- async function Pr(e) {
4075
+ async function Gr(e) {
4056
4076
  const r = await e.text().catch(() => "");
4057
4077
  if (!r.trim())
4058
4078
  return e.ok ? {
@@ -4065,81 +4085,81 @@ async function Pr(e) {
4065
4085
  error: "Semaphor Data App execution returned invalid JSON.",
4066
4086
  details: r
4067
4087
  } : {
4068
- error: Wi(e, r),
4088
+ error: Vi(e, r),
4069
4089
  details: r
4070
4090
  };
4071
4091
  }
4072
4092
  }
4073
- function Wi(e, r) {
4093
+ function Vi(e, r) {
4074
4094
  const t = e.statusText ? ` ${e.statusText}` : "", n = r.replace(/\s+/g, " ").trim();
4075
4095
  return n ? `Semaphor Data App execution failed with status ${e.status}${t}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${t}.`;
4076
4096
  }
4077
- function Hr(e) {
4078
- const r = Ni(e).replace(/\/+$/, "");
4097
+ function Jr(e) {
4098
+ const r = Qi(e).replace(/\/+$/, "");
4079
4099
  return r ? r.endsWith("/api") ? `${r}/v1/data-app/execute` : `${r}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
4080
4100
  }
4081
- function Ni(e) {
4101
+ function Qi(e) {
4082
4102
  if (e.apiBaseUrl)
4083
4103
  return e.apiBaseUrl;
4084
4104
  if (!e.token)
4085
4105
  return "";
4086
4106
  try {
4087
- return vt(e.token).apiServiceUrl || "";
4107
+ return Ct(e.token).apiServiceUrl || "";
4088
4108
  } catch {
4089
4109
  return "";
4090
4110
  }
4091
4111
  }
4092
- const Vr = qe({});
4093
- function Mi() {
4112
+ const Yr = Ae({});
4113
+ function Ui() {
4094
4114
  if (!(typeof window > "u"))
4095
4115
  return window.__SEMAPHOR_DATA_APP_RUNTIME__;
4096
4116
  }
4097
- function _i() {
4098
- return Q(Vr);
4117
+ function Gi() {
4118
+ return Q(Yr);
4099
4119
  }
4100
- function uo(e) {
4101
- const [r, t] = z(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : r, o = I(
4102
- () => vr(e.options),
4120
+ function vo(e) {
4121
+ const [r, t] = _(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : r, o = x(
4122
+ () => qr(e.options),
4103
4123
  [e.options]
4104
- ), s = D(
4105
- (u) => {
4124
+ ), s = L(
4125
+ (c) => {
4106
4126
  var g;
4107
- const f = u;
4108
- (g = e.onValueChange) == null || g.call(e, f), n || t(f);
4127
+ const u = c;
4128
+ (g = e.onValueChange) == null || g.call(e, u), n || t(u);
4109
4129
  },
4110
4130
  [n, e]
4111
- ), c = D(() => s(void 0), [s]);
4112
- return I(() => {
4113
- const u = wr(e);
4131
+ ), f = L(() => s(void 0), [s]);
4132
+ return x(() => {
4133
+ const c = Ar(e);
4114
4134
  return {
4115
4135
  id: e.id,
4116
4136
  kind: e.kind,
4117
4137
  label: e.label,
4118
- field: u.field,
4119
- operator: u.operator,
4120
- relationshipHint: u.relationshipHint,
4138
+ field: c.field,
4139
+ operator: c.operator,
4140
+ relationshipHint: c.relationshipHint,
4121
4141
  controlRole: e.kind === "control" ? e.role : void 0,
4122
4142
  value: i,
4123
4143
  options: o,
4124
- isActive: ce(i),
4144
+ isActive: fe(i),
4125
4145
  setValue: s,
4126
- clear: c,
4146
+ clear: f,
4127
4147
  toAnalyticsInput: () => ({
4128
- inputId: u.inputId,
4129
- field: u.field,
4148
+ inputId: c.inputId,
4149
+ field: c.field,
4130
4150
  kind: e.kind,
4131
4151
  label: e.label,
4132
4152
  value: i,
4133
- isActive: ce(i),
4134
- operator: u.operator,
4135
- relationshipHint: u.relationshipHint,
4153
+ isActive: fe(i),
4154
+ operator: c.operator,
4155
+ relationshipHint: c.relationshipHint,
4136
4156
  controlRole: e.kind === "control" ? e.role : void 0
4137
4157
  })
4138
4158
  };
4139
- }, [c, o, s, e, i]);
4159
+ }, [f, o, s, e, i]);
4140
4160
  }
4141
- function co(e) {
4142
- const [r, t] = z(() => Ui(e));
4161
+ function So(e) {
4162
+ const [r, t] = _(() => no(e));
4143
4163
  return B(() => {
4144
4164
  t((n) => {
4145
4165
  let i = n;
@@ -4147,40 +4167,40 @@ function co(e) {
4147
4167
  !Object.prototype.hasOwnProperty.call(i, o.id) && o.defaultValue !== void 0 && (i = { ...i, [o.id]: o.defaultValue });
4148
4168
  return i;
4149
4169
  });
4150
- }, [e]), I(
4170
+ }, [e]), x(
4151
4171
  () => e.map((n) => {
4152
4172
  const i = Object.prototype.hasOwnProperty.call(
4153
4173
  n,
4154
4174
  "value"
4155
- ), o = i ? n.value : r[n.id], s = vr(n.options), c = (g) => {
4175
+ ), o = i ? n.value : r[n.id], s = qr(n.options), f = (g) => {
4156
4176
  var m;
4157
- (m = n.onValueChange) == null || m.call(n, g), i || t((v) => ({
4158
- ...v,
4177
+ (m = n.onValueChange) == null || m.call(n, g), i || t((h) => ({
4178
+ ...h,
4159
4179
  [n.id]: g
4160
4180
  }));
4161
- }, u = () => c(void 0), f = wr(n);
4181
+ }, c = () => f(void 0), u = Ar(n);
4162
4182
  return {
4163
4183
  id: n.id,
4164
4184
  kind: n.kind,
4165
4185
  label: n.label,
4166
- field: f.field,
4167
- operator: f.operator,
4168
- relationshipHint: f.relationshipHint,
4186
+ field: u.field,
4187
+ operator: u.operator,
4188
+ relationshipHint: u.relationshipHint,
4169
4189
  controlRole: n.kind === "control" ? n.role : void 0,
4170
4190
  value: o,
4171
4191
  options: s,
4172
- isActive: ce(o),
4173
- setValue: c,
4174
- clear: u,
4192
+ isActive: fe(o),
4193
+ setValue: f,
4194
+ clear: c,
4175
4195
  toAnalyticsInput: () => ({
4176
- inputId: f.inputId,
4177
- field: f.field,
4196
+ inputId: u.inputId,
4197
+ field: u.field,
4178
4198
  kind: n.kind,
4179
4199
  label: n.label,
4180
4200
  value: o,
4181
- isActive: ce(o),
4182
- operator: f.operator,
4183
- relationshipHint: f.relationshipHint,
4201
+ isActive: fe(o),
4202
+ operator: u.operator,
4203
+ relationshipHint: u.relationshipHint,
4184
4204
  controlRole: n.kind === "control" ? n.role : void 0
4185
4205
  })
4186
4206
  };
@@ -4188,78 +4208,96 @@ function co(e) {
4188
4208
  [e, r]
4189
4209
  );
4190
4210
  }
4191
- function fo(e, r) {
4192
- const t = (r == null ? void 0 : r.status) === "success" ? r.options : void 0, n = I(() => zi(t), [t]);
4211
+ function wo(e, r) {
4212
+ const t = (r == null ? void 0 : r.status) === "success" ? r.options : void 0, n = x(() => Yi(t), [t]);
4193
4213
  B(() => {
4194
- Fi(e.value, t) || e.clear();
4214
+ Ji(e.value, t) || e.clear();
4195
4215
  }, [e, n, r == null ? void 0 : r.status, t]);
4196
4216
  }
4197
- function Fi(e, r) {
4198
- if (!ce(e) || r === void 0)
4217
+ function Ji(e, r) {
4218
+ if (!fe(e) || r === void 0)
4199
4219
  return !0;
4200
4220
  const t = new Set(
4201
- r.map((i) => hr(i.value))
4221
+ r.map((i) => wr(i.value))
4202
4222
  );
4203
4223
  return (Array.isArray(e) ? e : [e]).every(
4204
- (i) => t.has(hr(i))
4224
+ (i) => t.has(wr(i))
4205
4225
  );
4206
4226
  }
4207
- function zi(e) {
4227
+ function Yi(e) {
4208
4228
  return JSON.stringify((e || []).map((r) => r.value));
4209
4229
  }
4210
- function hr(e) {
4230
+ function wr(e) {
4211
4231
  return `${typeof e}:${String(e)}`;
4212
4232
  }
4213
- function po(e, r = {}) {
4214
- const t = I(
4233
+ function Io(e, r = {}) {
4234
+ const t = x(
4215
4235
  () => r.inputs ? {
4216
4236
  ...e,
4217
4237
  inputs: r.inputs
4218
4238
  } : e,
4219
4239
  [r.inputs, e]
4220
- ), n = I(() => {
4240
+ ), n = x(() => (() => {
4221
4241
  switch (t.queryKind) {
4222
4242
  case "metric":
4223
4243
  return {
4224
4244
  queryKind: t.queryKind,
4225
- request: Ai(t)
4245
+ request: G(
4246
+ Di(t),
4247
+ r.selections
4248
+ )
4226
4249
  };
4227
4250
  case "analysis":
4228
4251
  return {
4229
4252
  queryKind: t.queryKind,
4230
- request: qi(t)
4253
+ request: G(
4254
+ Oi(t),
4255
+ r.selections
4256
+ )
4231
4257
  };
4232
4258
  case "records":
4233
4259
  return {
4234
4260
  queryKind: t.queryKind,
4235
- request: Ti(t)
4261
+ request: G(
4262
+ Bi(t),
4263
+ r.selections
4264
+ )
4236
4265
  };
4237
4266
  case "inputOptions":
4238
4267
  return {
4239
4268
  queryKind: t.queryKind,
4240
- request: ki(t)
4269
+ request: G(
4270
+ Ki(t),
4271
+ r.selections
4272
+ )
4241
4273
  };
4242
4274
  case "sql":
4243
4275
  return {
4244
4276
  queryKind: t.queryKind,
4245
- request: Ci(t)
4277
+ request: G(
4278
+ Wi(t),
4279
+ r.selections
4280
+ )
4246
4281
  };
4247
4282
  case "matrix":
4248
4283
  return {
4249
4284
  queryKind: t.queryKind,
4250
- request: Ei(t)
4285
+ request: G(
4286
+ Mi(t),
4287
+ r.selections
4288
+ )
4251
4289
  };
4252
4290
  default:
4253
- return Se(t);
4291
+ return Ie(t);
4254
4292
  }
4255
- }, [t]), i = Ut({
4293
+ })(), [t, r.selections]), i = nn({
4256
4294
  spec: t,
4257
4295
  queryKind: n.queryKind,
4258
4296
  queryKey: n.request.queryKey,
4259
4297
  intent: n.request.intent,
4260
4298
  activeInputs: n.request.activeInputs,
4261
4299
  debug: r.debug
4262
- }), o = E(null), s = I(
4300
+ }), o = T(null), s = x(
4263
4301
  () => ({
4264
4302
  start: i.start,
4265
4303
  success: i.success,
@@ -4272,85 +4310,87 @@ function po(e, r = {}) {
4272
4310
  i.start,
4273
4311
  i.success
4274
4312
  ]
4275
- ), c = D(
4313
+ ), f = L(
4276
4314
  (d) => {
4277
- var K, k, M, $, w, S, L, x, O;
4278
- const h = n.request;
4279
- if (h.intent)
4315
+ var K, C, N, O, v, I, $, q, D;
4316
+ const y = n.request;
4317
+ if (y.intent)
4280
4318
  switch (n.queryKind) {
4281
4319
  case "metric":
4282
4320
  return (K = d.executor) == null ? void 0 : K.executeMetric(
4283
- h.intent,
4321
+ y.intent,
4284
4322
  d
4285
4323
  );
4286
4324
  case "analysis":
4287
- return (M = (k = d.executor) == null ? void 0 : k.executeAnalysis) == null ? void 0 : M.call(
4288
- k,
4289
- h.intent,
4325
+ return (N = (C = d.executor) == null ? void 0 : C.executeAnalysis) == null ? void 0 : N.call(
4326
+ C,
4327
+ y.intent,
4290
4328
  d,
4291
- h.analysisOptions
4329
+ y.analysisOptions
4292
4330
  );
4293
4331
  case "records":
4294
- return ($ = d.executor) == null ? void 0 : $.executeRecords(
4295
- h.intent,
4332
+ return (O = d.executor) == null ? void 0 : O.executeRecords(
4333
+ y.intent,
4296
4334
  d
4297
4335
  );
4298
4336
  case "inputOptions":
4299
- return (w = d.executor) == null ? void 0 : w.executeInputOptions(
4300
- h.intent,
4337
+ return (v = d.executor) == null ? void 0 : v.executeInputOptions(
4338
+ y.intent,
4301
4339
  d
4302
4340
  );
4303
4341
  case "sql":
4304
- return (L = (S = d.executor) == null ? void 0 : S.executeSql) == null ? void 0 : L.call(
4305
- S,
4306
- h.intent,
4342
+ return ($ = (I = d.executor) == null ? void 0 : I.executeSql) == null ? void 0 : $.call(
4343
+ I,
4344
+ y.intent,
4307
4345
  d
4308
4346
  );
4309
4347
  case "matrix":
4310
- if (!h.matrixWindowRequest) throw new Error("Matrix window request is required.");
4311
- return (O = (x = d.executor) == null ? void 0 : x.executeMatrix) == null ? void 0 : O.call(
4312
- x,
4313
- { intent: h.intent, matrixWindowRequest: h.matrixWindowRequest },
4348
+ if (!y.matrixWindowRequest) throw new Error("Matrix window request is required.");
4349
+ return (D = (q = d.executor) == null ? void 0 : q.executeMatrix) == null ? void 0 : D.call(
4350
+ q,
4351
+ { intent: y.intent, matrixWindowRequest: y.matrixWindowRequest },
4314
4352
  d
4315
4353
  );
4316
4354
  default:
4317
- return Se(n);
4355
+ return Ie(n);
4318
4356
  }
4319
4357
  },
4320
4358
  [n]
4321
- ), u = Qi(
4359
+ ), c = to(
4322
4360
  n.request.queryKey,
4323
- c,
4361
+ f,
4324
4362
  n.request.idleData,
4325
4363
  n.request.activeInputs,
4364
+ n.request.selections,
4326
4365
  s
4327
- ), f = i.queryId, g = i.validationFailure;
4366
+ ), u = i.queryId, g = i.validationFailure;
4328
4367
  B(() => {
4329
4368
  const d = n.request.error;
4330
4369
  if (!d) {
4331
4370
  o.current = null;
4332
4371
  return;
4333
4372
  }
4334
- const h = `${f}:${d.message}`;
4335
- o.current !== h && (o.current = h, g(d));
4373
+ const y = `${u}:${d.message}`;
4374
+ o.current !== y && (o.current = y, g(d));
4336
4375
  }, [
4337
4376
  n.request.error,
4338
4377
  n.request.queryKey,
4339
- f,
4378
+ u,
4340
4379
  g
4341
4380
  ]);
4342
- const m = n.request.error ? n.request.idleData : u.data, v = n.request.error ? "error" : u.status, y = !n.request.error && u.status === "loading", b = n.request.error || u.error, T = i.trace;
4381
+ const m = n.request.error ? n.request.idleData : c.data, h = n.request.error ? "error" : c.status, S = !n.request.error && c.status === "loading", b = n.request.error || c.error, w = i.trace;
4343
4382
  switch (n.queryKind) {
4344
4383
  case "metric": {
4345
- const d = m, h = G({
4384
+ const d = m, y = J({
4346
4385
  queryKind: n.queryKind,
4347
- status: v,
4348
- isLoading: y,
4386
+ status: h,
4387
+ isLoading: S,
4349
4388
  error: b,
4350
- trace: T,
4389
+ trace: w,
4351
4390
  payload: d,
4352
4391
  activeInputs: n.request.activeInputs,
4353
- isStale: u.isStale
4392
+ selections: n.request.selections,
4393
+ isStale: c.isStale
4354
4394
  });
4355
4395
  return {
4356
4396
  id: t.id,
@@ -4364,37 +4404,39 @@ function po(e, r = {}) {
4364
4404
  delta: d == null ? void 0 : d.delta,
4365
4405
  deltaPercent: d == null ? void 0 : d.deltaPercent,
4366
4406
  records: d == null ? void 0 : d.records,
4367
- ...h
4407
+ ...y
4368
4408
  };
4369
4409
  }
4370
4410
  case "analysis": {
4371
- const d = Mr(m), h = G({
4411
+ const d = Pr(m), y = J({
4372
4412
  queryKind: n.queryKind,
4373
- status: v,
4374
- isLoading: y,
4413
+ status: h,
4414
+ isLoading: S,
4375
4415
  error: b,
4376
- trace: T,
4416
+ trace: w,
4377
4417
  payload: d,
4378
4418
  activeInputs: n.request.activeInputs,
4379
- isStale: u.isStale
4419
+ selections: n.request.selections,
4420
+ isStale: c.isStale
4380
4421
  });
4381
4422
  return {
4382
4423
  id: t.id,
4383
4424
  intent: n.request.intent,
4384
4425
  ...d || {},
4385
- ...h
4426
+ ...y
4386
4427
  };
4387
4428
  }
4388
4429
  case "records": {
4389
- const d = m, h = G({
4430
+ const d = m, y = J({
4390
4431
  queryKind: n.queryKind,
4391
- status: v,
4392
- isLoading: y,
4432
+ status: h,
4433
+ isLoading: S,
4393
4434
  error: b,
4394
- trace: T,
4435
+ trace: w,
4395
4436
  payload: d,
4396
4437
  activeInputs: n.request.activeInputs,
4397
- isStale: u.isStale
4438
+ selections: n.request.selections,
4439
+ isStale: c.isStale
4398
4440
  });
4399
4441
  return {
4400
4442
  id: t.id,
@@ -4404,19 +4446,20 @@ function po(e, r = {}) {
4404
4446
  rowCount: d == null ? void 0 : d.rowCount,
4405
4447
  pagination: d == null ? void 0 : d.pagination,
4406
4448
  totals: d == null ? void 0 : d.totals,
4407
- ...h
4449
+ ...y
4408
4450
  };
4409
4451
  }
4410
4452
  case "inputOptions": {
4411
- const d = m, h = G({
4453
+ const d = m, y = J({
4412
4454
  queryKind: n.queryKind,
4413
- status: v,
4414
- isLoading: y,
4455
+ status: h,
4456
+ isLoading: S,
4415
4457
  error: b,
4416
- trace: T,
4458
+ trace: w,
4417
4459
  payload: d,
4418
4460
  activeInputs: n.request.activeInputs,
4419
- isStale: u.isStale
4461
+ selections: n.request.selections,
4462
+ isStale: c.isStale
4420
4463
  });
4421
4464
  return {
4422
4465
  id: t.id,
@@ -4424,19 +4467,20 @@ function po(e, r = {}) {
4424
4467
  options: (d == null ? void 0 : d.options) || [],
4425
4468
  dependencyOutcomes: d == null ? void 0 : d.dependencyOutcomes,
4426
4469
  match: d == null ? void 0 : d.match,
4427
- ...h
4470
+ ...y
4428
4471
  };
4429
4472
  }
4430
4473
  case "sql": {
4431
- const d = m, h = G({
4474
+ const d = m, y = J({
4432
4475
  queryKind: n.queryKind,
4433
- status: v,
4434
- isLoading: y,
4476
+ status: h,
4477
+ isLoading: S,
4435
4478
  error: b,
4436
- trace: T,
4479
+ trace: w,
4437
4480
  payload: d,
4438
4481
  activeInputs: n.request.activeInputs,
4439
- isStale: u.isStale
4482
+ selections: n.request.selections,
4483
+ isStale: c.isStale
4440
4484
  });
4441
4485
  return {
4442
4486
  id: t.id,
@@ -4447,35 +4491,36 @@ function po(e, r = {}) {
4447
4491
  pagination: d == null ? void 0 : d.pagination,
4448
4492
  output: d == null ? void 0 : d.output,
4449
4493
  rowLimitExceeded: d == null ? void 0 : d.rowLimitExceeded,
4450
- ...h
4494
+ ...y
4451
4495
  };
4452
4496
  }
4453
4497
  case "matrix": {
4454
- const d = m, h = G({
4498
+ const d = m, y = J({
4455
4499
  queryKind: n.queryKind,
4456
- status: v,
4457
- isLoading: y,
4500
+ status: h,
4501
+ isLoading: S,
4458
4502
  error: b,
4459
- trace: T,
4503
+ trace: w,
4460
4504
  payload: d,
4461
4505
  activeInputs: n.request.activeInputs,
4462
- isStale: u.isStale
4506
+ selections: n.request.selections,
4507
+ isStale: c.isStale
4463
4508
  });
4464
4509
  return {
4465
4510
  id: t.id,
4466
4511
  intent: n.request.intent,
4467
4512
  window: d == null ? void 0 : d.window,
4468
- ...h,
4469
- executionResult: Pi(h.executionResult) ? h.executionResult : void 0
4513
+ ...y,
4514
+ executionResult: Zi(y.executionResult) ? y.executionResult : void 0
4470
4515
  };
4471
4516
  }
4472
4517
  default:
4473
- return Se(n);
4518
+ return Ie(n);
4474
4519
  }
4475
4520
  }
4476
- function G(e) {
4477
- var o, s, c;
4478
- const r = ji(e.payload) ?? ((o = e.error) == null ? void 0 : o.executionResult), t = ((s = e.error) == null ? void 0 : s.validation) ?? (r == null ? void 0 : r.validation), n = r == null ? void 0 : r.coverage, i = r == null ? void 0 : r.diagnosticFeedback;
4521
+ function J(e) {
4522
+ var o, s, f, c;
4523
+ const r = Xi(e.payload) ?? ((o = e.error) == null ? void 0 : o.executionResult), t = ((s = e.error) == null ? void 0 : s.validation) ?? (r == null ? void 0 : r.validation), n = r == null ? void 0 : r.coverage, i = r == null ? void 0 : r.diagnosticFeedback;
4479
4524
  return {
4480
4525
  status: e.status,
4481
4526
  executionStatus: r == null ? void 0 : r.status,
@@ -4484,51 +4529,51 @@ function G(e) {
4484
4529
  coverage: n,
4485
4530
  diagnosticFeedback: i,
4486
4531
  isLoading: e.isLoading,
4487
- isEmpty: Vi(e.queryKind, e.payload, e.status),
4488
- isPartial: Hi(e.payload, r),
4489
- isFiltered: !!((c = e.activeInputs) != null && c.some(
4532
+ isEmpty: ro(e.queryKind, e.payload, e.status),
4533
+ isPartial: eo(e.payload, r),
4534
+ isFiltered: !!((f = e.activeInputs) != null && f.some(
4490
4535
  (u) => u.kind === "filter" && u.isActive
4491
- )),
4536
+ ) || (c = e.selections) != null && c.length),
4492
4537
  isStale: e.isStale,
4493
4538
  isValidated: !!t,
4494
4539
  error: e.error,
4495
4540
  trace: e.trace
4496
4541
  };
4497
4542
  }
4498
- function ji(e) {
4543
+ function Xi(e) {
4499
4544
  const r = e;
4500
4545
  return r == null ? void 0 : r.executionResult;
4501
4546
  }
4502
- function Pi(e) {
4547
+ function Zi(e) {
4503
4548
  return (e == null ? void 0 : e.resultShape) === "matrix";
4504
4549
  }
4505
- function Hi(e, r) {
4550
+ function eo(e, r) {
4506
4551
  var n, i;
4507
4552
  const t = !!(e != null && e.rowLimitExceeded);
4508
4553
  return !!((r == null ? void 0 : r.status) === "partial" || ((n = r == null ? void 0 : r.diagnosticFeedback) == null ? void 0 : n.status) === "partial" || (r == null ? void 0 : r.status) !== "failed" && ((i = r == null ? void 0 : r.coverage) != null && i.missingObligations.length) || t);
4509
4554
  }
4510
- function Vi(e, r, t) {
4555
+ function ro(e, r, t) {
4511
4556
  var n, i, o;
4512
4557
  if (t !== "success")
4513
4558
  return !1;
4514
4559
  switch (e) {
4515
4560
  case "metric": {
4516
4561
  const s = r;
4517
- return (s == null ? void 0 : s.primaryValue) == null && !N(s == null ? void 0 : s.records);
4562
+ return (s == null ? void 0 : s.primaryValue) == null && !M(s == null ? void 0 : s.records);
4518
4563
  }
4519
4564
  case "analysis": {
4520
4565
  const s = r;
4521
- return s ? !s.answerSummary && !N(s.records) && !N(s.changes) && !N(s.drivers) && !N(s.largestNegativeChanges) && !N(s.largestPositiveChanges) && !N(s.largestNegativeDrivers) && !N(s.largestPositiveDrivers) && !Object.values(s.resultSets || {}).some(
4522
- (c) => N(c.records)
4566
+ return s ? !s.answerSummary && !M(s.records) && !M(s.changes) && !M(s.drivers) && !M(s.largestNegativeChanges) && !M(s.largestPositiveChanges) && !M(s.largestNegativeDrivers) && !M(s.largestPositiveDrivers) && !Object.values(s.resultSets || {}).some(
4567
+ (f) => M(f.records)
4523
4568
  ) : !0;
4524
4569
  }
4525
4570
  case "records": {
4526
4571
  const s = r;
4527
- return !N(s == null ? void 0 : s.records);
4572
+ return !M(s == null ? void 0 : s.records);
4528
4573
  }
4529
4574
  case "sql": {
4530
4575
  const s = r;
4531
- return !N(s == null ? void 0 : s.records) && (s == null ? void 0 : s.output) === void 0;
4576
+ return !M(s == null ? void 0 : s.records) && (s == null ? void 0 : s.output) === void 0;
4532
4577
  }
4533
4578
  case "inputOptions": {
4534
4579
  const s = r;
@@ -4536,117 +4581,194 @@ function Vi(e, r, t) {
4536
4581
  }
4537
4582
  case "matrix": {
4538
4583
  const s = r;
4539
- return !((i = s == null ? void 0 : s.window) != null && i.pages.some((c) => c.members.length > 0)) && !((o = s == null ? void 0 : s.window) != null && o.blocks.some((c) => c.cells.length > 0));
4584
+ return !((i = s == null ? void 0 : s.window) != null && i.pages.some((f) => f.members.length > 0)) && !((o = s == null ? void 0 : s.window) != null && o.blocks.some((f) => f.cells.length > 0));
4540
4585
  }
4541
4586
  default:
4542
- return Se(e);
4587
+ return Ie(e);
4543
4588
  }
4544
4589
  }
4545
- function N(e) {
4590
+ function M(e) {
4546
4591
  return Array.isArray(e) && e.length > 0;
4547
4592
  }
4548
- function Qi(e, r, t, n, i) {
4549
- const o = _i(), s = E(r), c = E(n), [u, f] = z({
4593
+ function to(e, r, t, n, i, o) {
4594
+ const s = Gi(), f = T(r), c = T(n), u = T(i), [g, m] = _({
4550
4595
  status: "idle",
4551
4596
  data: t,
4552
4597
  error: null,
4553
4598
  isStale: !1
4554
4599
  });
4555
- return s.current = r, c.current = n, B(() => {
4556
- let g;
4600
+ return f.current = r, c.current = n, u.current = i, B(() => {
4601
+ let h;
4557
4602
  try {
4558
- g = s.current({
4559
- ...o,
4560
- activeInputs: c.current
4603
+ h = f.current({
4604
+ ...s,
4605
+ activeInputs: c.current,
4606
+ selections: u.current
4561
4607
  });
4562
- } catch (y) {
4563
- i == null || i.failure(y, 0), f({
4608
+ } catch (w) {
4609
+ o == null || o.failure(w, 0), m({
4564
4610
  status: "error",
4565
4611
  data: t,
4566
- error: je(y),
4612
+ error: Pe(w),
4567
4613
  isStale: !1
4568
4614
  });
4569
4615
  return;
4570
4616
  }
4571
- if (!g) {
4572
- f({ status: "idle", data: t, error: null, isStale: !1 });
4617
+ if (!h) {
4618
+ m({ status: "idle", data: t, error: null, isStale: !1 });
4573
4619
  return;
4574
4620
  }
4575
- let m = !1;
4576
- const v = Qr();
4577
- return i == null || i.start(), f((y) => ({
4621
+ let S = !1;
4622
+ const b = Xr();
4623
+ return o == null || o.start(), m((w) => ({
4578
4624
  status: "loading",
4579
- data: y.data,
4625
+ data: w.data,
4580
4626
  error: null,
4581
- isStale: y.isStale || y.status === "success"
4582
- })), g.then((y) => {
4583
- m ? i == null || i.ignored("superseded") : (i == null || i.success(y, br(v)), f({ status: "success", data: y, error: null, isStale: !1 }));
4584
- }).catch((y) => {
4585
- m ? i == null || i.ignored("superseded") : (i == null || i.failure(y, br(v)), f({
4627
+ isStale: w.isStale || w.status === "success"
4628
+ })), h.then((w) => {
4629
+ S ? o == null || o.ignored("superseded") : (o == null || o.success(w, Ir(b)), m({ status: "success", data: w, error: null, isStale: !1 }));
4630
+ }).catch((w) => {
4631
+ S ? o == null || o.ignored("superseded") : (o == null || o.failure(w, Ir(b)), m({
4586
4632
  status: "error",
4587
4633
  data: t,
4588
- error: je(y),
4634
+ error: Pe(w),
4589
4635
  isStale: !1
4590
4636
  }));
4591
4637
  }), () => {
4592
- m = !0;
4638
+ S = !0;
4593
4639
  };
4594
- }, [t, e, o, i]), u;
4640
+ }, [t, e, s, o]), g;
4595
4641
  }
4596
- function Qr() {
4642
+ function Xr() {
4597
4643
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
4598
4644
  }
4599
- function br(e) {
4600
- return Math.max(0, Math.round(Qr() - e));
4645
+ function Ir(e) {
4646
+ return Math.max(0, Math.round(Xr() - e));
4601
4647
  }
4602
- function Ui(e) {
4648
+ function no(e) {
4603
4649
  return Object.fromEntries(
4604
4650
  e.filter((r) => r.defaultValue !== void 0).map((r) => [r.id, r.defaultValue])
4605
4651
  );
4606
4652
  }
4607
- function Se(e) {
4653
+ function Ie(e) {
4608
4654
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
4609
4655
  }
4610
- function Gi(e) {
4656
+ function xo(e) {
4657
+ const [r, t] = _(() => xr(e, e.defaultTuples || [])), n = Object.prototype.hasOwnProperty.call(e, "tuples"), i = xr(
4658
+ e,
4659
+ n ? e.tuples || [] : r
4660
+ ), o = T(i);
4661
+ o.current = i;
4662
+ const s = L(
4663
+ (u) => {
4664
+ var g;
4665
+ o.current = u, (g = e.onTuplesChange) == null || g.call(e, u), n || t(u);
4666
+ },
4667
+ [n, e]
4668
+ ), f = L(
4669
+ (u, g = { kind: "replace" }) => {
4670
+ const m = Zr(e, u), h = dr(o.current, m, g, {
4671
+ multipleSelection: e.multipleSelection ?? !0,
4672
+ tupleKey: sr
4673
+ });
4674
+ return (h.outcome !== "limitReached" || g.kind === "range") && s(h.tuples), h;
4675
+ },
4676
+ [s, e]
4677
+ ), c = L(() => {
4678
+ const u = o.current;
4679
+ if (u.length === 0)
4680
+ return;
4681
+ const g = dr(
4682
+ u,
4683
+ u[0],
4684
+ { kind: "clear" },
4685
+ {
4686
+ multipleSelection: e.multipleSelection ?? !0,
4687
+ tupleKey: sr
4688
+ }
4689
+ );
4690
+ s(g.tuples);
4691
+ }, [s, e.multipleSelection]);
4692
+ return x(
4693
+ () => ({
4694
+ id: e.id,
4695
+ kind: "selection",
4696
+ label: e.label,
4697
+ fields: e.fields,
4698
+ tuples: i,
4699
+ isActive: i.length > 0,
4700
+ select: f,
4701
+ clear: c,
4702
+ toAnalyticsSelection: () => i.length > 0 ? { id: e.id, tuples: i } : void 0
4703
+ }),
4704
+ [c, f, e.fields, e.id, e.label, i]
4705
+ );
4706
+ }
4707
+ function xr(e, r) {
4708
+ if (e.fields.length === 0)
4709
+ throw new Error(`Semaphor selection "${e.id}" requires at least one field.`);
4710
+ if (r.length > ar)
4711
+ throw new Error(
4712
+ `Semaphor selection "${e.id}" cannot contain more than ${ar} tuples.`
4713
+ );
4714
+ if (e.multipleSelection === !1 && r.length > 1)
4715
+ throw new Error(
4716
+ `Semaphor selection "${e.id}" allows only one selected tuple.`
4717
+ );
4718
+ return r.map((t) => Zr(e, t));
4719
+ }
4720
+ function Zr(e, r) {
4721
+ const t = St.parse(r);
4722
+ for (const n of t.conditions)
4723
+ if (!e.fields.some(
4724
+ (i) => yt(i, n.field)
4725
+ ))
4726
+ throw new Error(
4727
+ `Semaphor selection "${e.id}" received field "${n.field.name}" outside its declared fields.`
4728
+ );
4729
+ return t;
4730
+ }
4731
+ function io(e) {
4611
4732
  return !e || typeof e == "boolean" || e.enabled === !1 ? null : e.autoRenderDevtools === !0 ? {} : e.autoRenderDevtools ? e.autoRenderDevtools : null;
4612
4733
  }
4613
- function go({
4734
+ function qo({
4614
4735
  token: e,
4615
4736
  apiBaseUrl: r,
4616
4737
  executor: t,
4617
4738
  debug: n,
4618
4739
  children: i
4619
4740
  }) {
4620
- var y;
4621
- const o = Mi(), s = ((y = o == null ? void 0 : o.authToken) == null ? void 0 : y.accessToken) || e, c = (o == null ? void 0 : o.dataApiBaseUrl) || (o == null ? void 0 : o.apiBaseUrl) || r, u = (o == null ? void 0 : o.debug) ?? n, f = Gi(u), g = I(() => Li(), []), m = t || g, v = I(
4741
+ var S;
4742
+ const o = Ui(), s = ((S = o == null ? void 0 : o.authToken) == null ? void 0 : S.accessToken) || e, f = (o == null ? void 0 : o.dataApiBaseUrl) || (o == null ? void 0 : o.apiBaseUrl) || r, c = (o == null ? void 0 : o.debug) ?? n, u = io(c), g = x(() => _i(), []), m = t || g, h = x(
4622
4743
  () => ({
4623
4744
  token: s,
4624
- apiBaseUrl: c,
4745
+ apiBaseUrl: f,
4625
4746
  executor: m,
4626
- debug: u
4747
+ debug: c
4627
4748
  }),
4628
- [c, u, m, s]
4749
+ [f, c, m, s]
4629
4750
  );
4630
- return /* @__PURE__ */ l(Pt, { debug: u, children: /* @__PURE__ */ p(Vr.Provider, { value: v, children: [
4751
+ return /* @__PURE__ */ l(Zt, { debug: c, children: /* @__PURE__ */ p(Yr.Provider, { value: h, children: [
4631
4752
  i,
4632
- f ? /* @__PURE__ */ l(Qt, { ...f }) : null
4753
+ u ? /* @__PURE__ */ l(tn, { ...u }) : null
4633
4754
  ] }) });
4634
4755
  }
4635
4756
  export {
4636
- go as SemaphorDataAppProvider,
4637
- Qt as SemaphorDevtools,
4638
- lo as SemaphorDevtoolsInspectButton,
4639
- ao as SemaphorViewBoundary,
4640
- Li as createSemaphorQueryExecutor,
4641
- io as defineSemaphorDataApp,
4642
- oo as defineSemaphorInput,
4643
- Fi as isSemaphorInputValueValidForOptions,
4644
- so as semaphor,
4645
- ho as semaphorMetricAggregate,
4646
- bo as semaphorMetricMeasureBindingKey,
4647
- fo as useClearInvalidSemaphorInputValue,
4648
- Er as useSemaphorDevtools,
4649
- uo as useSemaphorInput,
4650
- co as useSemaphorInputs,
4651
- po as useSemaphorQuery
4757
+ qo as SemaphorDataAppProvider,
4758
+ tn as SemaphorDevtools,
4759
+ bo as SemaphorDevtoolsInspectButton,
4760
+ ho as SemaphorViewBoundary,
4761
+ _i as createSemaphorQueryExecutor,
4762
+ go as defineSemaphorDataApp,
4763
+ mo as defineSemaphorInput,
4764
+ Ji as isSemaphorInputValueValidForOptions,
4765
+ yo as semaphor,
4766
+ ko as semaphorMetricAggregate,
4767
+ Co as semaphorMetricMeasureBindingKey,
4768
+ wo as useClearInvalidSemaphorInputValue,
4769
+ Dr as useSemaphorDevtools,
4770
+ vo as useSemaphorInput,
4771
+ So as useSemaphorInputs,
4772
+ Io as useSemaphorQuery,
4773
+ xo as useSemaphorSelection
4652
4774
  };