react-semaphor 0.1.603 → 0.1.605

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 (208) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1491
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +3 -1598
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-CEmZUf9o.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-DMFrDqn_.js +1 -0
  11. package/dist/chunks/appearance-provider-CfoAVQuG.js +608 -0
  12. package/dist/chunks/appearance-runtime-provider-Bx8H-moR.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-DgUaCE9k.js +51 -0
  15. package/dist/chunks/attachment-filter-line-C_zHMhGh.js +1 -0
  16. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  17. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  18. package/dist/chunks/bookmark-impact-BAtemeyK.js +1 -0
  19. package/dist/chunks/bookmark-state-DScd31KT.js +1 -0
  20. package/dist/chunks/brand-C9APUFaP.js +1 -0
  21. package/dist/chunks/card-filter-builder-ClWrXB7P.js +11 -0
  22. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  23. package/dist/chunks/comparison-window-caption-tguyN24S.js +1 -0
  24. package/dist/chunks/context-CntvtZwC.js +2 -0
  25. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  26. package/dist/chunks/dashboard-ChIcbVTx.js +1 -0
  27. package/dist/chunks/dashboard-briefing-launcher-CwMlhkxV.js +42 -0
  28. package/dist/chunks/dashboard-controls-UCSAFCGA.js +42 -0
  29. package/dist/chunks/dashboard-json-B120hYDa.js +1 -0
  30. package/dist/chunks/dashboard-temporal-snapshot-BFJKbp_6.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-DvHp03h_.js +73 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-WwUV5JzN.js +1 -0
  34. package/dist/chunks/filter-reach-preview-C5M5_hf_.js +1 -0
  35. package/dist/chunks/filter-value-text-DqTHe_vu.js +1 -0
  36. package/dist/chunks/index-DViPGDFj.js +1 -0
  37. package/dist/chunks/index-bkP6SnYu.js +1 -0
  38. package/dist/chunks/kpi-trend-rule-B87LNzcz.js +1 -0
  39. package/dist/chunks/layout-grid-CFzqJ7GC.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-5T-2euHZ.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-vVAv-aqg.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-CWvcEsQ0.js +1 -0
  43. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  44. package/dist/chunks/numeric-range-options-C8tr-Bls.js +1 -0
  45. package/dist/chunks/palette-NvEIuXHN.js +6 -0
  46. package/dist/chunks/pivot-result-contract-expectations-BNWhS8mv.js +1 -0
  47. package/dist/chunks/pivot-result-identity-B0eWVMXg.js +1 -0
  48. package/dist/chunks/raw-temporal-value-BHQ-ldpW.js +1 -0
  49. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  50. package/dist/chunks/report-preferences-dialog-Bseb2Rlg.js +1 -0
  51. package/dist/chunks/report-runtime-context-Cd1b5pku.js +1 -0
  52. package/dist/chunks/resolve-dashboard-input-context-BDY7KwRe.js +8 -0
  53. package/dist/chunks/resolver-CjsW8Rz0.js +1 -0
  54. package/dist/chunks/saved-dashboard-context-C3lWc4Dx.js +1 -0
  55. package/dist/chunks/schema-O1Y3WTGF.js +4 -0
  56. package/dist/chunks/selection-filter-compiler-kYsRugss.js +1 -0
  57. package/dist/chunks/semaphor-ready-indicator-BQarSo6S.js +612 -0
  58. package/dist/chunks/set-6mOnfQeH.js +1 -0
  59. package/dist/chunks/slider-BPnHdMGq.js +4 -0
  60. package/dist/chunks/stored-dashboard-DfrxDLhR.js +1 -0
  61. package/dist/chunks/table-export-sheet-xaczzWZF.js +2 -0
  62. package/dist/chunks/token-types-1vzMWjI-.js +1 -0
  63. package/dist/chunks/validators-Dg2kyF4_.js +1 -0
  64. package/dist/chunks/variable-draft-B4_xqr4Y.js +1 -0
  65. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  66. package/dist/dashboard/index.js +1 -7
  67. package/dist/dashboard-authoring/index.js +1 -4614
  68. package/dist/format-utils/index.js +1 -425
  69. package/dist/index.js +1 -554
  70. package/dist/layouts/index.js +1 -7
  71. package/dist/live-channel/index.js +1 -124
  72. package/dist/pdf-export-policy/index.js +1 -92
  73. package/dist/pdf-table-layout/index.js +1 -993
  74. package/dist/report-runtime-context/index.js +1 -9
  75. package/dist/shared/index.js +1 -6
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +1 -9
  78. package/dist/types/brand-studio/brand-studio-draft.d.ts +45 -13
  79. package/dist/types/brand-studio/brand-studio-editor.d.ts +13 -2
  80. package/dist/types/components/index.d.ts +1 -0
  81. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +17 -6
  82. package/dist/types/components/visual/data-table/types/data-table.d.ts +52 -42
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/appearance/aliases.d.ts +3 -0
  85. package/dist/types/lib/appearance/index.d.ts +1 -0
  86. package/dist/types/lib/appearance/table-density.d.ts +18 -0
  87. package/dist/types/lib/appearance/types.d.ts +39 -1
  88. package/dist/types/lib/dashboard-viewer/column-header-actions.d.ts +100 -0
  89. package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +0 -27
  90. package/dist/types/lib/dashboard-viewer/table-view.d.ts +26 -2
  91. package/dist/types/lib/dashboard-viewer/use-table-view.d.ts +2 -0
  92. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  93. package/dist/types/lib/hooks/use-add-new-frame.d.ts +7 -0
  94. package/dist/types/lib/hooks/use-dashboard-card.d.ts +4 -0
  95. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +8 -0
  96. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  97. package/dist/types/lib/stores/dashboard-store.d.ts +14 -2
  98. package/dist/types/lib/stores/explorer-actions.d.ts +7 -10
  99. package/dist/types/lib/types/common-types.d.ts +1 -2
  100. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  101. package/dist/types/lib/utils/card-config-utils.d.ts +13 -0
  102. package/dist/types/lib/utils/field-placement.d.ts +17 -0
  103. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  104. package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +21 -1
  105. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +7 -4
  106. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +180 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  114. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  115. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +2 -8
  117. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/column-display-values.d.ts +5 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/column-display.d.ts +52 -0
  120. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -0
  121. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +9 -0
  122. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +4 -0
  123. package/dist/types/shared/dashboard-authoring/card-settings/table-viewer-switches.d.ts +15 -0
  124. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -0
  125. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  126. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +132 -3
  127. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +3 -1
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +10 -1
  130. package/dist/types/shared/dashboard-authoring/field-aggregations.d.ts +9 -2
  131. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +116 -0
  132. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  133. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  134. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  135. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +2 -0
  136. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +7 -2
  137. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +6 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/dashboard-authoring/sheet-kinds.d.ts +36 -0
  141. package/dist/types/shared/dashboard-authoring/table-sheet-shape.d.ts +140 -0
  142. package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +15 -0
  143. package/dist/types/shared/dashboard-viewer/table-settings.d.ts +8 -2
  144. package/dist/types/shared/format-utils/types/format-types.d.ts +1 -1
  145. package/dist/usage-events/index.js +1 -285
  146. package/dist/value-format-preferences/index.js +1 -635
  147. package/package.json +5 -2
  148. package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
  149. package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
  150. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  151. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  152. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  153. package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
  154. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  155. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  156. package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
  157. package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
  158. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  159. package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
  160. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  161. package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
  162. package/dist/chunks/context-UCQ7sere.js +0 -369
  163. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  164. package/dist/chunks/dashboard-BghI99oY.js +0 -14
  165. package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
  166. package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
  167. package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
  168. package/dist/chunks/dates-BnrXF4bb.js +0 -185
  169. package/dist/chunks/edit-9df1zOWe.js +0 -226
  170. package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
  171. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  172. package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
  173. package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
  174. package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
  175. package/dist/chunks/index-BVKzKl5d.js +0 -90
  176. package/dist/chunks/index-CV_Kzou0.js +0 -595
  177. package/dist/chunks/index-D5rxbtS4.js +0 -2795
  178. package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
  179. package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
  180. package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
  181. package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
  182. package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
  183. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  184. package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
  185. package/dist/chunks/palette-Be62Tkoa.js +0 -23
  186. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  187. package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
  188. package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
  189. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
  190. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  191. package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
  192. package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
  193. package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
  194. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  195. package/dist/chunks/save-C5A0JnEV.js +0 -21
  196. package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
  197. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  198. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
  199. package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
  200. package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
  201. package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
  202. package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
  203. package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
  204. package/dist/chunks/token-types-XbM6QByy.js +0 -8
  205. package/dist/chunks/upload-H15d7uHK.js +0 -15
  206. package/dist/chunks/validators-Baf3VIf5.js +0 -3686
  207. package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
  208. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -1,369 +0,0 @@
1
- var T = Object.defineProperty;
2
- var q = (e, a, i) => a in e ? T(e, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[a] = i;
3
- var b = (e, a, i) => q(e, typeof a != "symbol" ? a + "" : a, i);
4
- import { z as t } from "zod";
5
- import { s as k } from "./analytics-base-schemas-DsUh5Q3C.js";
6
- const J = 1, Y = [
7
- // before streaming (HTTP status in spec section 10)
8
- "assistant_unavailable",
9
- "context_invalid",
10
- "context_too_large",
11
- "conversation_not_found",
12
- "conversation_full",
13
- "turn_in_progress",
14
- "daily_limit_reached",
15
- // inside the stream
16
- "budget_exhausted",
17
- "not_permitted",
18
- "no_data_found",
19
- "model_unavailable"
20
- ];
21
- function _(e) {
22
- return `You've used ${e === void 0 ? "today's questions" : `today's ${e} questions`}. They reset tomorrow. To keep going, contact your administrator.`;
23
- }
24
- function z(e, a = {}) {
25
- return e === "daily_limit_reached" ? _(a.dailyLimit) : $[e];
26
- }
27
- const $ = {
28
- assistant_unavailable: "The assistant is not available here.",
29
- context_invalid: "Something on this page changed. Try again.",
30
- context_too_large: "There is too much on this page to send with your question. Ask about one card, or clear some filters.",
31
- conversation_not_found: "This conversation has ended. Start a new one.",
32
- conversation_full: "This conversation is full. Start a new one.",
33
- turn_in_progress: "Still answering your last question.",
34
- daily_limit_reached: _(),
35
- budget_exhausted: "This question needed more steps than one answer allows. Try asking for less at once.",
36
- not_permitted: "You do not have access to the data this needs.",
37
- no_data_found: "No data matched this question.",
38
- model_unavailable: "The assistant could not answer right now. Try again."
39
- }, A = {
40
- messageChars: 4e3,
41
- /** The whole serialized AssistantContext, in UTF-8 bytes. */
42
- contextBytes: 48 * 1024,
43
- /** The whole request body (context, message, added sources) except `openDashboard`, in UTF-8 bytes. */
44
- requestBytes: 128 * 1024,
45
- /**
46
- * The dashboard on screen sent with a question (Phase 7, D7-12), alone, in
47
- * UTF-8 bytes of its JSON. Over it the browser sends the question without it.
48
- */
49
- openDashboardBytes: 2 * 1024 * 1024,
50
- summaryCards: 30,
51
- // AssistantContext.cards
52
- otherSheets: 50,
53
- activeInputs: 50,
54
- /** Values listed for one input, or in one filter's text. */
55
- inputValues: 50,
56
- addedSources: 50,
57
- cardFields: 60,
58
- /** Fields of the asked-about card tagged in one question (Phase 11). */
59
- taggedFields: 5,
60
- cardFilters: 40,
61
- cardControls: 40,
62
- drillSteps: 10,
63
- sqlChars: 2e4,
64
- sqlParameters: 40,
65
- idChars: 200,
66
- labelChars: 500,
67
- /** One filter, control or SQL parameter description. */
68
- textChars: 4e3,
69
- turnsPerConversation: 40,
70
- conversationBytes: 1024 * 1024,
71
- toolCallsPerTurn: 12,
72
- secondsPerTurn: 120,
73
- artifactRecords: 200,
74
- // rows kept on an artifact (D4-6: several fit in a conversation's 1 MB)
75
- conversationTtlSeconds: 24 * 60 * 60
76
- };
77
- function G(e) {
78
- return new TextEncoder().encode(JSON.stringify(e)).length;
79
- }
80
- function H(e, a) {
81
- if (e.length <= a) return e;
82
- const i = (n) => ` [${n} more characters not shown]`, s = a - i(e.length).length;
83
- return `${e.slice(0, s)}${i(e.length - s)}`;
84
- }
85
- class X extends Error {
86
- constructor(i) {
87
- super($.context_too_large);
88
- b(this, "code", "context_too_large");
89
- this.bytes = i, this.name = "AssistantContextTooLargeError";
90
- }
91
- }
92
- const j = 1, N = ["dashboard", "editor", "none"], r = A, p = t.string().min(1).max(r.idChars), h = t.string().max(r.labelChars), u = t.string().max(r.textChars), g = t.number().int().positive(), v = t.string().min(1).max(100), S = t.object({ id: p, title: h }).strict(), E = t.object({
93
- inputId: p,
94
- label: h,
95
- value: t.discriminatedUnion("kind", [
96
- t.object({
97
- kind: t.literal("set"),
98
- text: u,
99
- omittedValues: g.optional(),
100
- notApplied: t.literal("opened_from_another_dashboard").optional(),
101
- fingerprint: v
102
- }).strict(),
103
- t.object({ kind: t.literal("varies") }).strict()
104
- ]),
105
- globalDate: t.literal(!0).optional()
106
- }).strict(), y = {
107
- id: p,
108
- title: h,
109
- visualType: t.string().max(100),
110
- source: k.optional()
111
- }, F = t.object(y).strict(), I = (e) => t.object(Object.fromEntries(e.map((a) => [a, g.optional()]))).strict().optional(), L = t.object({
112
- role: t.enum(["row", "column", "measure", "detail"]),
113
- label: h,
114
- name: h,
115
- aggregate: t.string().max(40).optional(),
116
- granularity: t.string().max(40).optional()
117
- }).strict(), x = t.discriminatedUnion("status", [
118
- t.object({
119
- status: t.literal("described"),
120
- fields: t.array(L).max(r.cardFields),
121
- filters: t.array(
122
- t.object({
123
- origin: t.enum(["dashboard_input", "card_input", "card", "drill", "selection"]),
124
- text: u,
125
- omittedValues: g.optional()
126
- }).strict()
127
- ).max(r.cardFilters),
128
- controls: t.array(t.object({ label: h, valueText: u }).strict()).max(r.cardControls),
129
- drillPath: t.array(u).max(r.drillSteps),
130
- sql: t.object({
131
- text: t.string().max(r.sqlChars),
132
- parameters: t.array(t.object({ name: h, valueText: u }).strict()).max(r.sqlParameters)
133
- }).strict().optional(),
134
- comparisons: t.array(u).max(r.cardFields).optional(),
135
- omitted: I(["fields", "filters", "controls", "drillSteps", "sqlParameters", "comparisons"])
136
- }).strict(),
137
- t.object({
138
- status: t.literal("not_described"),
139
- reason: t.enum(["matrix", "custom_visual", "python", "snapshot_blocked", "snapshot_pending"]),
140
- message: u.optional()
141
- }).strict()
142
- ]), R = t.object({
143
- ...y,
144
- fingerprint: v,
145
- description: x
146
- }).strict(), K = t.object({
147
- version: t.literal(j),
148
- surface: t.enum(N),
149
- dashboard: t.object({
150
- id: p,
151
- title: h,
152
- unsavedEdits: t.boolean()
153
- }).strict().optional(),
154
- sheet: S.optional(),
155
- otherSheets: t.array(S).max(r.otherSheets),
156
- activeInputs: t.array(E).max(r.activeInputs),
157
- cards: t.array(F).max(r.summaryCards),
158
- selectedCard: R.optional(),
159
- editing: t.object({ mode: t.enum(["visual", "sql"]) }).strict().optional(),
160
- omitted: I(["otherSheets", "activeInputs", "cards"]),
161
- timeZone: t.string().min(1).max(100)
162
- }).strict().superRefine((e, a) => {
163
- e.surface !== "none" && !e.dashboard && a.addIssue({
164
- code: t.ZodIssueCode.custom,
165
- path: ["dashboard"],
166
- message: `required on the ${e.surface} surface`
167
- }), e.selectedCard && e.surface === "none" && a.addIssue({
168
- code: t.ZodIssueCode.custom,
169
- path: ["selectedCard"],
170
- message: "only on the dashboard and editor surfaces"
171
- }), e.surface === "editor" != !!e.editing && a.addIssue({
172
- code: t.ZodIssueCode.custom,
173
- path: ["editing"],
174
- message: "required on the editor surface, and only there"
175
- });
176
- });
177
- function ee(e, a) {
178
- if (!e) return [];
179
- const i = [];
180
- e.surface !== a.surface && i.push({
181
- kind: "surface_changed",
182
- from: e.surface,
183
- to: a.surface
184
- }), e.sheet && a.sheet && e.sheet.id !== a.sheet.id && i.push({
185
- kind: "sheet_changed",
186
- fromSheetId: e.sheet.id,
187
- toSheetId: a.sheet.id
188
- });
189
- const s = e.selectedCard, n = a.selectedCard;
190
- (s == null ? void 0 : s.id) !== (n == null ? void 0 : n.id) ? i.push({
191
- kind: "selection_changed",
192
- ...s ? { fromCardId: s.id } : {},
193
- ...n ? { toCardId: n.id } : {}
194
- }) : s && n && s.fingerprint !== n.fingerprint && i.push({ kind: "card_changed", cardId: n.id });
195
- const d = O(
196
- e.activeInputs ?? [],
197
- a.activeInputs
198
- );
199
- return d.length > 0 && i.push({ kind: "inputs_changed", inputIds: d }), i;
200
- }
201
- function O(e, a) {
202
- const i = (o) => o ? o.value.kind === "set" ? o.value.fingerprint : "varies" : void 0, s = new Map(e.map((o) => [o.inputId, o])), n = new Map(a.map((o) => [o.inputId, o]));
203
- return [.../* @__PURE__ */ new Set([...s.keys(), ...n.keys()])].filter(
204
- (o) => i(s.get(o)) !== i(n.get(o))
205
- );
206
- }
207
- function te(e, a, i) {
208
- var n, d, o;
209
- const s = [];
210
- if (e.surface === "none" || !e.dashboard)
211
- s.push(
212
- "The user is not looking at a dashboard. Answer from the sources they added; if none fit, find the data with the discovery tools or ask which data to use."
213
- );
214
- else {
215
- const c = e.surface === "editor" ? "editing a visual on" : "looking at";
216
- s.push(
217
- `The user is ${c} the dashboard ${l(e.dashboard.title)} (id ${e.dashboard.id})${e.dashboard.unsavedEdits ? ", which has unsaved edits" : ""}.`
218
- ), e.sheet && s.push(
219
- `Current sheet: ${l(e.sheet.title)} (id ${e.sheet.id}).`
220
- ), e.otherSheets.length > 0 && s.push(
221
- `Other sheets: ${e.otherSheets.map((C) => l(C.title)).join(", ")}${m((n = e.omitted) == null ? void 0 : n.otherSheets, "sheets")}.`
222
- );
223
- }
224
- if (e.activeInputs.length > 0) {
225
- s.push(
226
- "",
227
- "Dashboard inputs with a value (which of them a card applies is in that card's description when the user asks about it):"
228
- );
229
- for (const c of e.activeInputs)
230
- s.push(`- ${B(c)}`);
231
- (d = e.omitted) != null && d.activeInputs && s.push(`- ${e.omitted.activeInputs} more inputs are not listed.`);
232
- }
233
- if (e.cards.length > 0) {
234
- s.push("", "Cards on this sheet:");
235
- for (const c of e.cards)
236
- s.push(`- ${f(c)}`);
237
- (o = e.omitted) != null && o.cards && s.push(`- ${e.omitted.cards} more cards are not listed.`);
238
- }
239
- if (e.selectedCard && s.push("", ...Q(e.selectedCard, e.editing)), i.length > 0) {
240
- s.push("", "Sources the user added:");
241
- for (const c of i)
242
- s.push(`- ${w(c)}`);
243
- }
244
- if (a.length > 0) {
245
- s.push("", "Since the last question:");
246
- for (const c of a)
247
- s.push(`- ${V(c, e)}`);
248
- }
249
- return s.push("", `The user's time zone is ${e.timeZone}.`), s.join(`
250
- `);
251
- }
252
- function P(e) {
253
- const a = [e.name, e.aggregate, e.granularity ? `by ${e.granularity}` : void 0].filter(Boolean);
254
- return `${e.role} ${l(e.label)} (${a.join(", ")})`;
255
- }
256
- function l(e) {
257
- return JSON.stringify(e);
258
- }
259
- function m(e, a) {
260
- return e ? `, and ${e} more ${a}` : "";
261
- }
262
- function f(e) {
263
- return `${l(e.title)} (card id ${e.id}, ${e.visualType})${e.source ? ` from ${w(e.source)}` : ""}`;
264
- }
265
- function B(e) {
266
- const { value: a } = e;
267
- return a.kind === "varies" ? `${l(e.label)}: differs by card; ask about a card to see its value` : a.notApplied ? `${a.text} (not applied in this view: it was opened from another dashboard without this dashboard's own filters)` : `${a.text}${e.globalDate ? ", applied to each card's own date field, on cards that have one" : ""}`;
268
- }
269
- const D = {
270
- matrix: "it is a Matrix card",
271
- custom_visual: "it is a custom visual",
272
- python: "it is computed with Python",
273
- snapshot_blocked: "the dashboard could not compile it",
274
- snapshot_pending: "it was still loading when the question was sent"
275
- }, M = {
276
- dashboard_input: "dashboard input",
277
- card_input: "the card's own input",
278
- card: "the card's own filter",
279
- drill: "drill",
280
- selection: "selection on another card"
281
- };
282
- function Q(e, a) {
283
- var d;
284
- const i = a ? [
285
- `The user is editing the visual ${f(e)} in ${a.mode === "sql" ? "SQL" : "visual"} mode. What follows is their draft as it is on screen, which may not be saved: fromCard on this card runs the draft, and its rows are the draft's, not the saved card's. You cannot change the visual; to help change it, explain the steps in the editor or write SQL for them to paste.`
286
- ] : [`The user is asking about the card ${f(e)}.`], s = e.description;
287
- if (s.status === "not_described")
288
- return i.push(
289
- `How this card is built is not available to you: ${D[s.reason]}${s.message ? ` (${s.message})` : ""}. Answer with the tools, and say that you could not read the card's definition.`
290
- ), i;
291
- const n = s.omitted ?? {};
292
- if (i.push(a ? "What the draft runs, as the editor compiled it:" : "What the card runs, as the dashboard compiled it:"), s.fields.length > 0) {
293
- const o = s.fields.map(P);
294
- i.push(`- Fields: ${o.join("; ")}${m(n.fields, "fields not listed")}.`);
295
- } else
296
- i.push("- Fields: none.");
297
- if (s.filters.length > 0) {
298
- i.push("- Filters, all applied together:");
299
- for (const o of s.filters)
300
- i.push(` - ${M[o.origin]}: ${o.text}`);
301
- n.filters && i.push(` - ${n.filters} more filters are not listed.`);
302
- } else
303
- i.push("- Filters: none.");
304
- if (s.drillPath.length > 0 && i.push(
305
- `- Drilled into: ${s.drillPath.join(", then ")}${m(n.drillSteps, "steps")}.`
306
- ), s.controls.length > 0) {
307
- i.push("- Controls:");
308
- for (const o of s.controls)
309
- i.push(` - ${l(o.label)}: ${o.valueText}`);
310
- n.controls && i.push(` - ${n.controls} more controls are not listed.`);
311
- }
312
- if (s.sql && (i.push("- SQL:", "```sql", s.sql.text, "```"), s.sql.parameters.length > 0 && i.push(
313
- `- SQL parameters: ${s.sql.parameters.map((o) => `${o.name} = ${o.valueText}`).join("; ")}${m(n.sqlParameters, "parameters")}.`
314
- )), (d = s.comparisons) != null && d.length) {
315
- i.push("- Comparisons (the windows are known only once a query runs):");
316
- for (const o of s.comparisons) i.push(` - ${o}`);
317
- n.comparisons && i.push(` - ${n.comparisons} more comparisons are not listed.`);
318
- }
319
- return i.push(
320
- "This lists the card's fields, filters, drill path, controls, SQL and comparisons; it does not include the card's sorting, row limit or calculated-field formulas. A query you build yourself can differ from the card."
321
- ), i;
322
- }
323
- function w(e) {
324
- switch (e.kind) {
325
- case "semantic":
326
- return `dataset ${l(e.label ?? e.datasetName)} (domainId ${e.domainId}, datasetName ${e.datasetName})`;
327
- case "physical":
328
- return `table ${[e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".")} (connectionId ${e.connectionId})`;
329
- case "sql":
330
- return `SQL on ${e.label ? l(e.label) : "a connection"} (connectionId ${e.connectionId})`;
331
- }
332
- }
333
- function V(e, a) {
334
- var i;
335
- switch (e.kind) {
336
- case "surface_changed":
337
- return `the user moved from the ${e.from} view to the ${e.to} view.`;
338
- case "sheet_changed":
339
- return `the user switched sheets (now ${l(((i = a.sheet) == null ? void 0 : i.title) ?? e.toSheetId)}).`;
340
- case "selection_changed":
341
- return e.toCardId ? `the user is now asking about card ${e.toCardId}.` : "the user is no longer asking about a specific card.";
342
- case "card_changed":
343
- return `card ${e.cardId} now runs differently (its fields, filters, controls or SQL changed).`;
344
- case "inputs_changed":
345
- return `these dashboard inputs changed: ${e.inputIds.map((n) => {
346
- const d = a.activeInputs.find((o) => o.inputId === n);
347
- return d ? l(d.label) : `input ${n} (now cleared)`;
348
- }).join(", ")}.`;
349
- }
350
- }
351
- export {
352
- A,
353
- K as a,
354
- L as b,
355
- G as c,
356
- X as d,
357
- j as e,
358
- H as f,
359
- N as g,
360
- ee as h,
361
- P as i,
362
- w as j,
363
- J as k,
364
- Y as l,
365
- _ as m,
366
- z as n,
367
- $ as o,
368
- te as r
369
- };
@@ -1,16 +0,0 @@
1
- const t = [
2
- "docked-right",
3
- "docked-left",
4
- "centered",
5
- "full-page"
6
- ];
7
- function A(s) {
8
- return typeof s == "string" && t.includes(s);
9
- }
10
- const n = "Assistant", S = 40;
11
- export {
12
- t as A,
13
- n as D,
14
- S as a,
15
- A as i
16
- };
@@ -1,14 +0,0 @@
1
- import { jsx as a, jsxs as n } from "react/jsx-runtime";
2
- import { E as o, F as i, S as d, B as s, a as c, U as l, D as t, A as h, C as f, b } from "./semaphor-ready-indicator-FBvunj6S.js";
3
- function u(e) {
4
- if (typeof window > "u")
5
- return null;
6
- const { preferences: r } = e;
7
- return /* @__PURE__ */ a(o, { FallbackComponent: i, children: /* @__PURE__ */ a(d, { dashboardProps: e, children: /* @__PURE__ */ n(s, { children: [
8
- /* @__PURE__ */ a(c, { componentType: "dashboard", componentId: e.id }),
9
- /* @__PURE__ */ a(l, { appearance: e.appearance, children: /* @__PURE__ */ a(t, { preferences: r, children: /* @__PURE__ */ a(h, { children: /* @__PURE__ */ a("main", { className: "flex h-full flex-col", children: /* @__PURE__ */ a(f, { ...e, type: "dashboard", children: /* @__PURE__ */ a(b, {}) }) }) }) }) })
10
- ] }) }) });
11
- }
12
- export {
13
- u as D
14
- };