react-semaphor 0.1.568 → 0.1.570

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 (191) hide show
  1. package/README.md +0 -7
  2. package/dist/analytics-protocol/index.js +434 -454
  3. package/dist/appearance/index.js +6 -3
  4. package/dist/appearance-runtime/index.js +1 -1
  5. package/dist/assistant-context/index.js +1 -1
  6. package/dist/brand-studio/index.js +572 -436
  7. package/dist/briefings/index.js +4 -4
  8. package/dist/chunks/appearance-context-BwBp25ZG.js +162 -0
  9. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +80 -0
  10. package/dist/chunks/assistant-chat-B-Ddyy8b.js +5940 -0
  11. package/dist/chunks/{bookmark-impact-CJ-65omV.js → bookmark-impact-DCYD-6Fr.js} +2 -2
  12. package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
  13. package/dist/chunks/brand-B4BdpAB_.js +54 -0
  14. package/dist/chunks/{card-filter-builder-BBuB99GZ.js → card-filter-builder-0VvKmRst.js} +992 -991
  15. package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-PtcDWvkN.js} +252 -253
  16. package/dist/chunks/{dashboard-YnWZC4dK.js → dashboard-DxGIr1vZ.js} +1 -1
  17. package/dist/chunks/{dashboard-briefing-launcher-BF89TU2h.js → dashboard-briefing-launcher-B-quOOOQ.js} +253 -253
  18. package/dist/chunks/{dashboard-controls-atHc1EjP.js → dashboard-controls-Caodx80b.js} +288 -285
  19. package/dist/chunks/dashboard-json-Ct-AGDHF.js +66 -0
  20. package/dist/chunks/{dates-CKO05ino.js → dates-B9mL8BHE.js} +16 -15
  21. package/dist/chunks/edit-Bpdh_P_a.js +226 -0
  22. package/dist/chunks/{edit-dashboard-visual-DdmTfn-J.js → edit-dashboard-visual-DeDTuYB5.js} +2257 -2270
  23. package/dist/chunks/{filter-reach-copy-jZGzK_IH.js → filter-reach-copy-BSY33ro5.js} +1440 -1301
  24. package/dist/chunks/filter-value-text-DvvSNlho.js +146 -0
  25. package/dist/chunks/index-BVKzKl5d.js +90 -0
  26. package/dist/chunks/{index-RNaTnE3m.js → index-CV_Kzou0.js} +233 -223
  27. package/dist/chunks/{index-CPNZW0mu.js → index-y3HUzRNk.js} +76 -77
  28. package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-8rR-LPTk.js} +1 -1
  29. package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C1-uTgjR.js} +1 -1
  30. package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
  31. package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
  32. package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
  33. package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
  34. package/dist/chunks/paintbrush-aR17Z3C9.js +27 -0
  35. package/dist/chunks/{palette-4vf2BEEg.js → palette-a5FCZKFI.js} +1 -1
  36. package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → pickers-DkqmtnTL.js} +352 -290
  37. package/dist/chunks/pivot-result-contract-expectations-C-HnUKYe.js +55 -0
  38. package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
  39. package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
  40. package/dist/chunks/{report-preferences-dialog-Mbd-I0wV.js → report-preferences-dialog-Yvhv3WX2.js} +95 -97
  41. package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
  42. package/dist/chunks/{resolve-dashboard-input-context-Du0fjN3h.js → resolve-dashboard-input-context-Lkbwycwe.js} +5491 -5683
  43. package/dist/chunks/resolver-DG_tfEpt.js +156 -0
  44. package/dist/chunks/{save-D6pHmSSP.js → save-D985VvYp.js} +1 -1
  45. package/dist/chunks/{saved-dashboard-context-y8N6RvjS.js → saved-dashboard-context-DC_TEd6y.js} +6 -6
  46. package/dist/chunks/schema-C9NPiIru.js +2568 -0
  47. package/dist/chunks/{semaphor-ready-indicator-BSEdUq40.js → semaphor-ready-indicator-ByFvqHEO.js} +35916 -36001
  48. package/dist/chunks/{shelf-drop-preview-context-D7QqPl36.js → shelf-drop-preview-context-CjoVaK6J.js} +64 -66
  49. package/dist/chunks/{stored-dashboard-d3xQYxBD.js → stored-dashboard-C0hekXiI.js} +332 -333
  50. package/dist/chunks/{code-editor-DJNOsgJH.js → style-sheet-parts-C7qGZuH1.js} +2402 -2040
  51. package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-CP8zSOhj.js} +1 -1
  52. package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-CqbJjIuu.js} +18 -18
  53. package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
  54. package/dist/chunks/{upload-Cf3wXZT8.js → upload-CiGNKJ_0.js} +1 -1
  55. package/dist/chunks/validators-B8fpdinG.js +3651 -0
  56. package/dist/chunks/{variable-draft-DOX03R4A.js → variable-draft-9-huI1h4.js} +4 -4
  57. package/dist/dashboard/index.js +2 -2
  58. package/dist/dashboard-authoring/index.js +1888 -1826
  59. package/dist/format-utils/index.js +230 -231
  60. package/dist/index.js +349 -353
  61. package/dist/layouts/index.js +1 -1
  62. package/dist/report-runtime-context/index.js +1 -1
  63. package/dist/style.css +1 -1
  64. package/dist/surfboard/index.js +2 -2
  65. package/dist/types/appearance/index.d.ts +1 -0
  66. package/dist/types/brand-studio/brand-studio-draft.d.ts +7 -0
  67. package/dist/types/brand-studio/index.d.ts +1 -1
  68. package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
  69. package/dist/types/components/providers/appearance-runtime-provider.d.ts +4 -1
  70. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -2
  71. package/dist/types/components/sharing-and-management/utils/types.d.ts +0 -72
  72. package/dist/types/components/surfboard/filter/types.d.ts +5 -4
  73. package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
  74. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +0 -1
  75. package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -9
  76. package/dist/types/components/visual/data-table/utils/pagination-utils.d.ts +0 -19
  77. package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -1
  78. package/dist/types/index.js +9 -9
  79. package/dist/types/lib/appearance/aliases.d.ts +42 -0
  80. package/dist/types/lib/appearance/compiler.d.ts +6 -0
  81. package/dist/types/lib/appearance/defaults.d.ts +6 -0
  82. package/dist/types/lib/appearance/index.d.ts +2 -0
  83. package/dist/types/lib/appearance/normalize-organization.d.ts +17 -0
  84. package/dist/types/lib/appearance/resolver.d.ts +2 -2
  85. package/dist/types/lib/appearance/types.d.ts +38 -1
  86. package/dist/types/lib/charts/types.d.ts +6 -2
  87. package/dist/types/lib/dashboard/semantic-dataset-references.d.ts +0 -1
  88. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +0 -2
  89. package/dist/types/lib/dashboard-variables/types.d.ts +1 -6
  90. package/dist/types/lib/download-pdf.d.ts +0 -1
  91. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -4
  92. package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
  93. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  94. package/dist/types/lib/stores/dashboard-store.d.ts +15 -6
  95. package/dist/types/lib/stores/editor-store.d.ts +0 -1
  96. package/dist/types/lib/stores/table-actions.d.ts +0 -1
  97. package/dist/types/lib/table-formatting/table-formatting-css.d.ts +0 -5
  98. package/dist/types/lib/types/common-types.d.ts +3 -2
  99. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  100. package/dist/types/lib/types/index.d.ts +1 -1
  101. package/dist/types/lib/types/summary-types.d.ts +0 -5
  102. package/dist/types/lib/utils/card-definition.d.ts +7 -7
  103. package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
  104. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +4 -4
  105. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
  106. package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
  107. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +10 -10
  108. package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
  109. package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
  110. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +72 -72
  111. package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
  112. package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
  113. package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
  114. package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
  115. package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
  116. package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
  117. package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
  118. package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
  119. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
  120. package/dist/types/shared/assistant-protocol/context.d.ts +30 -30
  121. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +344 -1772
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +4 -1
  124. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
  125. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +9 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +104 -104
  127. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
  128. package/dist/types/shared/dashboard-authoring/dashboard-style/bounds.d.ts +17 -0
  129. package/dist/types/shared/dashboard-authoring/dashboard-style/brand.d.ts +20 -0
  130. package/dist/types/shared/dashboard-authoring/dashboard-style/edit-words.d.ts +7 -0
  131. package/dist/types/shared/dashboard-authoring/dashboard-style/edit.d.ts +19 -0
  132. package/dist/types/shared/dashboard-authoring/dashboard-style/index.d.ts +15 -0
  133. package/dist/types/shared/dashboard-authoring/dashboard-style/layers.d.ts +19 -0
  134. package/dist/types/shared/dashboard-authoring/dashboard-style/legacy.d.ts +21 -0
  135. package/dist/types/shared/dashboard-authoring/dashboard-style/parse.d.ts +18 -0
  136. package/dist/types/shared/dashboard-authoring/dashboard-style/pickers.d.ts +12 -0
  137. package/dist/types/shared/dashboard-authoring/dashboard-style/types.d.ts +122 -0
  138. package/dist/types/shared/dashboard-authoring/dashboard-style/view.d.ts +10 -0
  139. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +11 -0
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +23 -0
  142. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
  143. package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
  144. package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
  145. package/dist/types/shared/format-utils/matrix-continuation.d.ts +10 -10
  146. package/dist/types/shared/temporal/index.d.ts +0 -2
  147. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
  148. package/package.json +7 -26
  149. package/DATA_APP_SDK.md +0 -339
  150. package/dist/chunks/appearance-context-DEYtWinQ.js +0 -126
  151. package/dist/chunks/appearance-runtime-provider-B-M8gwlZ.js +0 -81
  152. package/dist/chunks/assistant-chat-BN5I8KuN.js +0 -8849
  153. package/dist/chunks/color-CJvdlFM_.js +0 -2162
  154. package/dist/chunks/dashboard-json-Cxp3inxd.js +0 -68
  155. package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
  156. package/dist/chunks/index-CLIro-EG.js +0 -425
  157. package/dist/chunks/index-CuHybtft.js +0 -51
  158. package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
  159. package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
  160. package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
  161. package/dist/chunks/operators-B3zZoskU.js +0 -66
  162. package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
  163. package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
  164. package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
  165. package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
  166. package/dist/chunks/validators-wtjw0aw6.js +0 -3332
  167. package/dist/data-app-sdk/index.js +0 -1412
  168. package/dist/data-app-sdk-adapters/index.js +0 -361
  169. package/dist/data-app-sdk-validation/index.js +0 -1031
  170. package/dist/types/components/sharing-and-management/utils/group-types.d.ts +0 -105
  171. package/dist/types/data-app-sdk/adapters.d.ts +0 -35
  172. package/dist/types/data-app-sdk/builders.d.ts +0 -62
  173. package/dist/types/data-app-sdk/contracts.d.ts +0 -419
  174. package/dist/types/data-app-sdk/executor.d.ts +0 -5
  175. package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
  176. package/dist/types/data-app-sdk/hooks.d.ts +0 -11
  177. package/dist/types/data-app-sdk/index.d.ts +0 -9
  178. package/dist/types/data-app-sdk/provider.d.ts +0 -8
  179. package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
  180. package/dist/types/data-app-sdk/selection.d.ts +0 -2
  181. package/dist/types/data-app-sdk/validation.d.ts +0 -58
  182. package/dist/types/data-app-sdk-adapters.d.ts +0 -2
  183. package/dist/types/data-app-sdk-validation.d.ts +0 -2
  184. package/dist/types/data-app-sdk.d.ts +0 -2
  185. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
  186. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
  187. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
  188. package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
  189. package/dist/types/shared/temporal/relative-date.d.ts +0 -21
  190. package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
  191. package/src/data-app-sdk/README.md +0 -402
@@ -1,4 +1,4 @@
1
- const v = {
1
+ const k = {
2
2
  /** Widest first. */
3
3
  breakpoints: ["lg", "md", "sm", "xs", "xxs"],
4
4
  columns: { lg: 48, md: 36, sm: 24, xs: 12, xxs: 6 },
@@ -8,42 +8,44 @@ const v = {
8
8
  customizable: ["sm", "xs"],
9
9
  /** The preview canvas widths: Laptop, Tablet, Phone, Small phone (Desktop is at least `minContainerWidthPx.lg`; RL-D19). */
10
10
  previewWidthPx: { md: 1024, sm: 820, xs: 390, xxs: 360 }
11
- }, b = v.columns.lg;
12
- function J(n) {
11
+ }, b = k.columns.lg;
12
+ function Q(n) {
13
13
  return n === "sm" || n === "xs";
14
14
  }
15
- function Mt(n) {
16
- return n === "lg" || J(n);
17
- }
18
15
  function kt(n) {
19
- return n === "md" || Mt(n);
16
+ return n === "lg" || Q(n);
17
+ }
18
+ function vt(n) {
19
+ return n === "md" || kt(n);
20
20
  }
21
- const vt = [
21
+ const Wt = [
22
22
  "table",
23
23
  "matrixTable",
24
24
  "detailTable"
25
- ], Wt = new Set(vt);
25
+ ], Ht = new Set(Wt);
26
26
  function _t(n) {
27
- return typeof n == "string" && Wt.has(n);
27
+ return typeof n == "string" && Ht.has(n);
28
28
  }
29
- function Ht(n) {
29
+ function zt(n) {
30
30
  var t, i;
31
31
  return ((t = n == null ? void 0 : n.cards) == null ? void 0 : t.find((o) => o.id === n.activeCardId)) ?? ((i = n == null ? void 0 : n.cards) == null ? void 0 : i[0]);
32
32
  }
33
33
  function U(n) {
34
34
  var i;
35
- const t = (i = Ht(n)) == null ? void 0 : i.type;
35
+ const t = (i = zt(n)) == null ? void 0 : i.type;
36
36
  return t === "kpi" ? "kpi" : t === "text" ? "text" : _t(t) ? "table" : "chart";
37
37
  }
38
- function nt(n) {
38
+ function it(n) {
39
39
  return n === "kpi" || n === "text" ? "short" : "tall";
40
40
  }
41
- const R = {
41
+ const E = {
42
42
  kpi: { h: 15, minH: 12, minW: 6 },
43
43
  chart: { h: 30, minH: 16, minW: 12 },
44
44
  table: { h: 38, minH: 18, minW: 12 },
45
- text: { h: 10, minH: 8, minW: 12 }
46
- }, T = {
45
+ // One line fits at every gap: 6 rows is 42 px of card at the widest gap (24), where the text
46
+ // card's padding tightens to 8 px (dashboard-card.tsx); a heading line is about 23 px.
47
+ text: { h: 10, minH: 6, minW: 12 }
48
+ }, C = {
47
49
  kpi: 48,
48
50
  chart: 24,
49
51
  table: 48,
@@ -56,16 +58,16 @@ function q(n) {
56
58
  (e) => Array.from({ length: e }, () => 48 / e)
57
59
  );
58
60
  }
59
- const st = {
61
+ const at = {
60
62
  full: 48,
61
63
  half: 24,
62
64
  third: 16,
63
65
  quarter: 12
64
- }, zt = ["full", "half", "third", "quarter"];
65
- function It(n) {
66
+ }, It = ["full", "half", "third", "quarter"];
67
+ function Ot(n) {
66
68
  let t = "full", i = 1 / 0;
67
- for (const o of zt) {
68
- const e = Math.abs(st[o] - n);
69
+ for (const o of It) {
70
+ const e = Math.abs(at[o] - n);
69
71
  e < i && (t = o, i = e);
70
72
  }
71
73
  return t;
@@ -78,43 +80,43 @@ function O(n) {
78
80
  for (const i of n) t = Math.max(t, i.y + i.h);
79
81
  return t;
80
82
  }
81
- function it(n, t) {
83
+ function ot(n, t) {
82
84
  for (const i of n) if (P(i, t)) return i;
83
85
  }
84
- function Ot(n) {
86
+ function At(n) {
85
87
  return n.slice().sort((t, i) => t.y > i.y || t.y === i.y && t.x > i.x ? 1 : t.y === i.y && t.x === i.x ? 0 : -1);
86
88
  }
87
- function at(n, t, i) {
89
+ function ft(n, t, i) {
88
90
  t.y += 1;
89
91
  const o = n.findIndex((e) => e.i === t.i);
90
92
  for (let e = o + 1; e < n.length; e += 1) {
91
93
  const r = n[e];
92
94
  if (!r.static) {
93
95
  if (r.y > t.y + t.h) break;
94
- P(t, r) && at(n, r, i + t.h);
96
+ P(t, r) && ft(n, r, i + t.h);
95
97
  }
96
98
  }
97
99
  t.y = i;
98
100
  }
99
- function At(n, t, i) {
100
- for (t.y = Math.min(O(n), t.y); t.y > 0 && !it(n, t); ) t.y -= 1;
101
+ function Et(n, t, i) {
102
+ for (t.y = Math.min(O(n), t.y); t.y > 0 && !ot(n, t); ) t.y -= 1;
101
103
  let o;
102
- for (; o = it(n, t); )
103
- at(i, t, o.y + o.h);
104
+ for (; o = ot(n, t); )
105
+ ft(i, t, o.y + o.h);
104
106
  return t.y = Math.max(t.y, 0), t.x = Math.max(t.x, 0), t;
105
107
  }
106
108
  function g(n) {
107
- const t = n.map((r) => ({ ...r })), i = t.filter((r) => r.static), o = Ot(t), e = /* @__PURE__ */ new Map();
109
+ const t = n.map((r) => ({ ...r })), i = t.filter((r) => r.static), o = At(t), e = /* @__PURE__ */ new Map();
108
110
  for (const r of o) {
109
111
  let s = { ...r };
110
- s.static || (s = At(i, s, o), i.push(s)), e.set(r, s);
112
+ s.static || (s = Et(i, s, o), i.push(s)), e.set(r, s);
111
113
  }
112
114
  return t.map((r) => e.get(r));
113
115
  }
114
- function Et(n) {
116
+ function St(n) {
115
117
  return g(n).every((i, o) => i.y === n[o].y && i.x === n[o].x);
116
118
  }
117
- function St(n) {
119
+ function Bt(n) {
118
120
  for (let t = 0; t < n.length; t += 1)
119
121
  for (let i = t + 1; i < n.length; i += 1)
120
122
  if (P(n[t], n[i])) return !0;
@@ -137,67 +139,67 @@ function F(n) {
137
139
  }
138
140
  return i.length && t.push(i), t;
139
141
  }
140
- function Bt(n) {
142
+ function Lt(n) {
141
143
  return new Map(n.map((t, i) => [t, i]));
142
144
  }
143
- function Lt(n, t, i, o) {
144
- const e = (c) => t.get(c) ?? "chart", r = A(n, i).map((c) => c.i), s = r.find((c) => e(c) === "text"), a = o ? r : [
145
+ function Tt(n, t, i, o) {
146
+ const e = (d) => t.get(d) ?? "chart", r = A(n, i).map((d) => d.i), s = r.find((d) => e(d) === "text"), a = o ? r : [
145
147
  ...s ? [s] : [],
146
- ...r.filter((c) => e(c) === "kpi"),
147
- ...r.filter((c) => e(c) === "chart"),
148
- ...r.filter((c) => e(c) === "table"),
149
- ...r.filter((c) => e(c) === "text" && c !== s)
150
- ], f = (c) => {
151
- const m = a[c];
148
+ ...r.filter((d) => e(d) === "kpi"),
149
+ ...r.filter((d) => e(d) === "chart"),
150
+ ...r.filter((d) => e(d) === "table"),
151
+ ...r.filter((d) => e(d) === "text" && d !== s)
152
+ ], f = (d) => {
153
+ const m = a[d];
152
154
  if (!o) return a.filter((M) => e(M) === e(m));
153
- let h = c;
154
- for (; h > 0 && e(a[h - 1]) === e(m); ) h -= 1;
155
- let l = c;
155
+ let p = d;
156
+ for (; p > 0 && e(a[p - 1]) === e(m); ) p -= 1;
157
+ let l = d;
156
158
  for (; l < a.length - 1 && e(a[l + 1]) === e(m); ) l += 1;
157
- return a.slice(h, l + 1);
158
- }, y = (c) => {
159
- const m = a[c], h = e(m);
160
- if (h === "table") return b;
161
- if (h === "text") return m === s ? b : b / 2;
162
- const l = f(c);
163
- if (h === "kpi") return q(l.length)[l.indexOf(m)];
159
+ return a.slice(p, l + 1);
160
+ }, y = (d) => {
161
+ const m = a[d], p = e(m);
162
+ if (p === "table") return b;
163
+ if (p === "text") return m === s ? b : b / 2;
164
+ const l = f(d);
165
+ if (p === "kpi") return q(l.length)[l.indexOf(m)];
164
166
  const M = l.indexOf(m);
165
167
  return l.length === 1 || l.length % 2 === 1 && M === 0 ? b : b / 2;
166
168
  };
167
- let x = 0, d = 0, u = 0;
168
- const p = a.map((c, m) => {
169
- const h = R[e(c)], l = Math.min(y(m), b);
170
- x > 0 && x + l > b && (x = 0, d += u, u = 0);
171
- const M = { i: c, x, y: d, w: l, h: h.h, minW: Math.min(h.minW, b), minH: h.minH };
172
- return x += l, u = Math.max(u, h.h), M;
169
+ let x = 0, c = 0, u = 0;
170
+ const h = a.map((d, m) => {
171
+ const p = E[e(d)], l = Math.min(y(m), b);
172
+ x > 0 && x + l > b && (x = 0, c += u, u = 0);
173
+ const M = { i: d, x, y: c, w: l, h: p.h, minW: Math.min(p.minW, b), minH: p.minH };
174
+ return x += l, u = Math.max(u, p.h), M;
173
175
  });
174
- return { items: g(p), order: a };
176
+ return { items: g(h), order: a };
175
177
  }
176
- function C(n) {
178
+ function $(n) {
177
179
  return Math.floor(n + 0.5);
178
180
  }
179
- function ft(n, t, i, o, e, r) {
180
- const s = v.columns[t], a = { i: n.i, x: i, y: o, w: e, h: n.h }, f = r ?? n.minW;
181
+ function ct(n, t, i, o, e, r) {
182
+ const s = k.columns[t], a = { i: n.i, x: i, y: o, w: e, h: n.h }, f = r ?? n.minW;
181
183
  return f !== void 0 && (a.minW = Math.max(1, Math.min(f, e, s))), n.minH !== void 0 && (a.minH = n.minH), n.maxW !== void 0 && (a.maxW = Math.max(e, Math.min(n.maxW, s))), n.maxH !== void 0 && (a.maxH = n.maxH), n.static !== void 0 && (a.static = n.static), n.isResizable !== void 0 && (a.isResizable = n.isResizable), n.isDraggable !== void 0 && (a.isDraggable = n.isDraggable), a;
182
184
  }
183
- function ct(n) {
185
+ function dt(n) {
184
186
  return g(
185
187
  n.map((t) => {
186
- let i = C(t.x * 0.75), e = C((t.x + t.w) * 0.75) - i;
188
+ let i = $(t.x * 0.75), e = $((t.x + t.w) * 0.75) - i;
187
189
  e === 0 && (e = 1, i === 36 && (i = 35));
188
- const r = t.minW === void 0 ? void 0 : Math.min(Math.max(1, C(t.minW * 0.75)), e);
189
- return ft(t, "md", i, t.y, e, r);
190
+ const r = t.minW === void 0 ? void 0 : Math.min(Math.max(1, $(t.minW * 0.75)), e);
191
+ return ct(t, "md", i, t.y, e, r);
190
192
  })
191
193
  );
192
194
  }
193
- function Tt(n, t) {
194
- const i = new Map(ct(n).map((r) => [r.i, r])), o = new Map(t.map((r) => [r.i, r])), e = v.columns.lg;
195
+ function Ct(n, t) {
196
+ const i = new Map(dt(n).map((r) => [r.i, r])), o = new Map(t.map((r) => [r.i, r])), e = k.columns.lg;
195
197
  return n.map((r) => {
196
198
  const s = o.get(r.i), a = i.get(r.i);
197
199
  if (!s || !a) return r;
198
200
  const f = { ...r };
199
201
  if (s.x !== a.x || s.w !== a.w) {
200
- const y = Math.min(e - 1, C(s.x * 1.3333333333333333)), x = Math.min(e, Math.max(y + 1, C((s.x + s.w) * (4 / 3))));
202
+ const y = Math.min(e - 1, $(s.x * 1.3333333333333333)), x = Math.min(e, Math.max(y + 1, $((s.x + s.w) * (4 / 3))));
201
203
  f.x = y, f.w = x - y;
202
204
  }
203
205
  return (s.y !== a.y || s.h !== a.h) && (f.y = s.y, f.h = s.h), f;
@@ -209,12 +211,12 @@ function K(n, t, i) {
209
211
  for (const r of n) {
210
212
  let s = 0;
211
213
  for (const a of r)
212
- o.set(a.source.i, ft(a.source, t, a.x, e, a.w)), s = Math.max(s, a.source.h);
214
+ o.set(a.source.i, ct(a.source, t, a.x, e, a.w)), s = Math.max(s, a.source.h);
213
215
  e += s;
214
216
  }
215
217
  return g(i.map((r) => o.get(r.i)));
216
218
  }
217
- function ot(n, t, i) {
219
+ function et(n, t, i) {
218
220
  const o = [];
219
221
  for (const e of n) {
220
222
  let r;
@@ -230,17 +232,17 @@ function ot(n, t, i) {
230
232
  }
231
233
  return o;
232
234
  }
233
- function dt(n, t, i, o) {
234
- if (n === "md") return ct(t);
235
- const e = v.columns[n], r = F(A(t, o)), s = (a) => i.get(a.i) ?? "chart";
236
- return n === "sm" ? K(ot(r, e, (a) => s(a) === "table" || s(a) === "text"), "sm", t) : n === "xs" ? K(ot(r, e, (a) => s(a) !== "kpi"), "xs", t) : K(
235
+ function ut(n, t, i, o) {
236
+ if (n === "md") return dt(t);
237
+ const e = k.columns[n], r = F(A(t, o)), s = (a) => i.get(a.i) ?? "chart";
238
+ return n === "sm" ? K(et(r, e, (a) => s(a) === "table" || s(a) === "text"), "sm", t) : n === "xs" ? K(et(r, e, (a) => s(a) !== "kpi"), "xs", t) : K(
237
239
  r.flatMap((a) => a.map((f) => [{ source: f, x: 0, w: e }])),
238
240
  "xxs",
239
241
  t
240
242
  );
241
243
  }
242
- function H(n, t, i) {
243
- const o = R[t];
244
+ function _(n, t, i) {
245
+ const o = E[t];
244
246
  return { i: n, x: 0, y: 0, w: i, h: o.h, minW: Math.min(o.minW, i), minH: o.minH };
245
247
  }
246
248
  function Y(n, t) {
@@ -249,7 +251,7 @@ function Y(n, t) {
249
251
  function X(n, t, i) {
250
252
  return n.map((o) => o.y >= t ? { ...o, y: o.y + i } : o);
251
253
  }
252
- function Ct(n, t, i) {
254
+ function $t(n, t, i) {
253
255
  const o = (f, y) => !t.some((x) => P({ ...n, i: "\0", x: f, y }, x)), e = n.x + n.w;
254
256
  if (e + n.w <= i && o(e, n.y)) return { x: e, y: n.y };
255
257
  const r = Math.max(i - n.w, 0), s = n.y + n.h, a = [s, ...t.map((f) => f.y + f.h).filter((f) => f > s).sort((f, y) => f - y)];
@@ -257,7 +259,7 @@ function Ct(n, t, i) {
257
259
  for (let y = 0; y <= r; y += 1) if (o(y, f)) return { x: y, y: f };
258
260
  return { x: 0, y: s };
259
261
  }
260
- function ut(n, t) {
262
+ function mt(n, t) {
261
263
  const i = Math.max(1, Math.min(n.w, t));
262
264
  return {
263
265
  ...n,
@@ -267,248 +269,252 @@ function ut(n, t) {
267
269
  ...n.maxW !== void 0 ? { maxW: Math.max(i, Math.min(n.maxW, t)) } : {}
268
270
  };
269
271
  }
270
- function mt(n, t, i, o) {
271
- const e = n.find((f) => f.i === t), r = ut(e, o), { x: s, y: a } = Ct(r, n.filter((f) => f.i !== t), o);
272
+ function lt(n, t, i, o) {
273
+ const e = n.find((f) => f.i === t), r = mt(e, o), { x: s, y: a } = $t(r, n.filter((f) => f.i !== t), o);
272
274
  return [...n, { ...r, i, x: s, y: a }];
273
275
  }
274
- function $t(n, t, i, o, e) {
275
- var p, c;
276
+ function Rt(n, t, i, o, e) {
277
+ var h, d;
276
278
  const r = o == null ? void 0 : o.position;
277
279
  if (r && typeof r == "object" && "beside" in r)
278
- return g(Y(mt(n, r.beside, t, b), e.frameOrder));
279
- const s = o != null && o.width ? st[o.width] : void 0;
280
+ return g(Y(lt(n, r.beside, t, b), e.frameOrder));
281
+ const s = o != null && o.width ? at[o.width] : void 0;
280
282
  let a = n.slice();
281
283
  const f = (m) => g(Y([...a, m], e.frameOrder));
282
284
  if (r === "top") {
283
- const m = H(t, i, s ?? T[i]);
285
+ const m = _(t, i, s ?? C[i]);
284
286
  return a = X(a, 0, m.h), f(m);
285
287
  }
286
288
  if (r === "end")
287
- return f({ ...H(t, i, s ?? T[i]), y: O(a) });
288
- const y = r === void 0 && s !== void 0, x = r && typeof r == "object" && "after" in r ? r.after : y ? (p = A(a, e.frameOrder).at(-1)) == null ? void 0 : p.i : void 0;
289
- if (y && x === void 0) return f(H(t, i, s));
289
+ return f({ ..._(t, i, s ?? C[i]), y: O(a) });
290
+ const y = r === void 0 && s !== void 0, x = r && typeof r == "object" && "after" in r ? r.after : y ? (h = A(a, e.frameOrder).at(-1)) == null ? void 0 : h.i : void 0;
291
+ if (y && x === void 0) return f(_(t, i, s));
290
292
  if (x !== void 0) {
291
- const m = H(t, i, s ?? T[i]), l = F(A(a, e.frameOrder)).find((W) => W.some((k) => k.i === x)), M = l.find((W) => W.i === x), z = l[l.length - 1];
293
+ const m = _(t, i, s ?? C[i]), l = F(A(a, e.frameOrder)).find((W) => W.some((v) => v.i === x)), M = l.find((W) => W.i === x), z = l[l.length - 1];
292
294
  if (b - (z.x + z.w) >= m.w) {
293
- const W = new Set(l.filter((k) => k.x > M.x).map((k) => k.i));
294
- return a = a.map((k) => W.has(k.i) ? { ...k, x: k.x + m.w } : k), f({ ...m, x: M.x + M.w, y: M.y });
295
+ const W = new Set(l.filter((v) => v.x > M.x).map((v) => v.i));
296
+ return a = a.map((v) => W.has(v.i) ? { ...v, x: v.x + m.w } : v), f({ ...m, x: M.x + M.w, y: M.y });
295
297
  }
296
- const S = Math.max(...l.map((W) => W.y + W.h));
297
- return a = X(a, S, m.h), f({ ...m, x: 0, y: S });
298
+ const B = Math.max(...l.map((W) => W.y + W.h));
299
+ return a = X(a, B, m.h), f({ ...m, x: 0, y: B });
298
300
  }
299
- const d = (m) => e.kinds.get(m.i) ?? "chart", u = F(A(a, e.frameOrder));
301
+ const c = (m) => e.kinds.get(m.i) ?? "chart", u = F(A(a, e.frameOrder));
300
302
  if (i === "kpi") {
301
- const m = ((c = u[0]) == null ? void 0 : c.length) === 1 && d(u[0][0]) === "text" ? 1 : 0;
302
- let h = m;
303
- for (; h < u.length && u[h].every((w) => d(w) === "kpi"); ) h += 1;
304
- if (h === m) {
305
- const w = m === 1 ? u[0][0].y + u[0][0].h : 0, D = H(t, i, q(1)[0]);
303
+ const m = ((d = u[0]) == null ? void 0 : d.length) === 1 && c(u[0][0]) === "text" ? 1 : 0;
304
+ let p = m;
305
+ for (; p < u.length && u[p].every((w) => c(w) === "kpi"); ) p += 1;
306
+ if (p === m) {
307
+ const w = m === 1 ? u[0][0].y + u[0][0].h : 0, D = _(t, i, q(1)[0]);
306
308
  return a = X(a, w, D.h), f({ ...D, y: w });
307
309
  }
308
- const l = u.slice(m, h).flat(), M = new Set(l.map((w) => w.i)), z = Math.min(...l.map((w) => w.y)), E = Math.max(...l.map((w) => w.y + w.h)), S = [...l, H(t, i, 12)], W = q(S.length);
309
- let k = 0, G = z, B = 0;
310
- const wt = S.map((w, D) => {
310
+ const l = u.slice(m, p).flat(), M = new Set(l.map((w) => w.i)), z = Math.min(...l.map((w) => w.y)), S = Math.max(...l.map((w) => w.y + w.h)), B = [...l, _(t, i, 12)], W = q(B.length);
311
+ let v = 0, G = z, L = 0;
312
+ const bt = B.map((w, D) => {
311
313
  const N = W[D];
312
- k > 0 && k + N > b && (k = 0, G += B, B = 0);
313
- const gt = { ...w, x: k, y: G, w: N, ...w.minW !== void 0 ? { minW: Math.min(w.minW, N) } : {} };
314
- return k += N, B = Math.max(B, w.h), gt;
315
- }), tt = G + B, bt = a.filter((w) => !M.has(w.i)).map((w) => w.y >= z && tt > E ? { ...w, y: w.y + (tt - E) } : w);
316
- return g(Y([...bt, ...wt], e.frameOrder));
314
+ v > 0 && v + N > b && (v = 0, G += L, L = 0);
315
+ const Mt = { ...w, x: v, y: G, w: N, ...w.minW !== void 0 ? { minW: Math.min(w.minW, N) } : {} };
316
+ return v += N, L = Math.max(L, w.h), Mt;
317
+ }), nt = G + L, gt = a.filter((w) => !M.has(w.i)).map((w) => w.y >= z && nt > S ? { ...w, y: w.y + (nt - S) } : w);
318
+ return g(Y([...gt, ...bt], e.frameOrder));
317
319
  }
318
320
  if (i === "chart") {
319
- const m = u[u.length - 1], h = (m == null ? void 0 : m.length) === 1 ? m[0] : void 0;
320
- return h && d(h) === "chart" && (h.x + h.w <= 24 || h.x >= 24) ? f({ ...H(t, i, 24), x: h.x + h.w <= 24 ? 24 : 0, y: h.y }) : f({ ...H(t, i, 24), y: O(a) });
321
+ const m = u[u.length - 1], p = (m == null ? void 0 : m.length) === 1 ? m[0] : void 0;
322
+ return p && c(p) === "chart" && (p.x + p.w <= 24 || p.x >= 24) ? f({ ..._(t, i, 24), x: p.x + p.w <= 24 ? 24 : 0, y: p.y }) : f({ ..._(t, i, 24), y: O(a) });
321
323
  }
322
- return f({ ...H(t, i, b), y: O(a) });
324
+ return f({ ..._(t, i, b), y: O(a) });
323
325
  }
324
- function lt(n, t, i) {
326
+ function ht(n, t, i) {
325
327
  const o = Math.max(1, Math.min(i, Math.round(t.w * i / b)));
326
- return [...n, ut({ ...t, x: 0, y: O(n), w: o }, i)];
328
+ return [...n, mt({ ...t, x: 0, y: O(n), w: o }, i)];
327
329
  }
328
- const Q = ["md", "sm", "xs", "xxs"], ht = [];
329
- function L(n) {
330
+ const tt = ["md", "sm", "xs", "xxs"], pt = [];
331
+ function T(n) {
330
332
  const t = n.map((i) => i.id);
331
333
  return {
332
334
  frames: n,
333
335
  ids: t,
334
336
  kinds: new Map(n.map((i) => [i.id, U(i)])),
335
- frameOrder: Bt(t)
337
+ frameOrder: Lt(t)
336
338
  };
337
339
  }
338
- function _(n) {
340
+ function H(n) {
339
341
  return typeof n == "number" && Number.isFinite(n) ? Math.round(n) : void 0;
340
342
  }
341
- function $(n, t, i) {
343
+ function R(n, t, i) {
342
344
  const o = new Set(i.ids), e = /* @__PURE__ */ new Map();
343
345
  if (!Array.isArray(n)) return e;
344
346
  for (const r of n) {
345
347
  if (!r || typeof r != "object") continue;
346
348
  const s = r, a = s.i;
347
349
  if (typeof a != "string" || !o.has(a) || e.has(a)) continue;
348
- const f = i.kinds.get(a) ?? "chart", y = _(s.minH), x = Math.max(1, Math.min(_(s.w) ?? Math.min(T[f], t), t)), d = Math.max(_(s.h) ?? R[f].h, y ?? 1, 1), u = {
350
+ const f = i.kinds.get(a) ?? "chart", y = H(s.minH), x = Math.max(1, Math.min(H(s.w) ?? Math.min(C[f], t), t)), c = Math.max(H(s.h) ?? E[f].h, y ?? 1, 1), u = {
349
351
  i: a,
350
- x: Math.max(0, Math.min(_(s.x) ?? 0, t - x)),
351
- y: Math.max(0, _(s.y) ?? Number.MAX_SAFE_INTEGER),
352
+ x: Math.max(0, Math.min(H(s.x) ?? 0, t - x)),
353
+ y: Math.max(0, H(s.y) ?? Number.MAX_SAFE_INTEGER),
352
354
  w: x,
353
- h: d
354
- }, p = _(s.minW);
355
- p !== void 0 && (u.minW = Math.max(1, Math.min(p, x))), y !== void 0 && (u.minH = Math.max(1, Math.min(y, d)));
356
- const c = _(s.maxW);
357
- c !== void 0 && (u.maxW = Math.max(c, x));
358
- const m = _(s.maxH);
359
- m !== void 0 && (u.maxH = Math.max(m, d)), typeof s.static == "boolean" && (u.static = s.static), typeof s.isResizable == "boolean" && (u.isResizable = s.isResizable), typeof s.isDraggable == "boolean" && (u.isDraggable = s.isDraggable), e.set(a, u);
355
+ h: c
356
+ }, h = H(s.minW);
357
+ h !== void 0 && (u.minW = Math.max(1, Math.min(h, x))), y !== void 0 && (u.minH = Math.max(1, Math.min(y, c)));
358
+ const d = H(s.maxW);
359
+ d !== void 0 && (u.maxW = Math.max(d, x));
360
+ const m = H(s.maxH);
361
+ m !== void 0 && (u.maxH = Math.max(m, c)), typeof s.static == "boolean" && (u.static = s.static), typeof s.isResizable == "boolean" && (u.isResizable = s.isResizable), typeof s.isDraggable == "boolean" && (u.isDraggable = s.isDraggable), e.set(a, V(u, i));
360
362
  }
361
363
  return e;
362
364
  }
363
- function Rt(n, t) {
365
+ function V(n, t) {
366
+ const i = E[t.kinds.get(n.i) ?? "chart"].minH;
367
+ return n.minH !== void 0 && n.minH > i ? { ...n, minH: i } : n;
368
+ }
369
+ function Dt(n, t) {
364
370
  return t.ids.every((i) => n.has(i));
365
371
  }
366
372
  function j(n, t) {
367
373
  return t.ids.flatMap((i) => n.has(i) ? [n.get(i)] : []);
368
374
  }
369
- function V(n, t) {
375
+ function Z(n, t) {
370
376
  const i = g(j(n, t)), o = new Map(i.map((r) => [r.i, r]));
371
377
  let e = O(i);
372
378
  for (const r of t.ids) {
373
379
  if (o.has(r)) continue;
374
- const s = t.kinds.get(r) ?? "chart", a = R[s], f = T[s];
380
+ const s = t.kinds.get(r) ?? "chart", a = E[s], f = C[s];
375
381
  o.set(r, { i: r, x: 0, y: e, w: f, h: a.h, minW: Math.min(a.minW, f), minH: a.minH }), e += a.h;
376
382
  }
377
383
  return g(t.ids.map((r) => o.get(r)));
378
384
  }
379
- function Dt(n, t) {
385
+ function Nt(n, t) {
380
386
  const i = b / t;
381
387
  return n.map((o) => {
382
388
  if (!o || typeof o != "object") return o;
383
- const e = o, r = _(e.x), s = _(e.w);
389
+ const e = o, r = H(e.x), s = H(e.w);
384
390
  if (r === void 0 || s === void 0) return e;
385
391
  const a = Math.round(r * i), f = Math.round((r + s) * i);
386
392
  return { ...e, x: a, w: Math.max(1, f - a) };
387
393
  });
388
394
  }
389
- function Nt(n) {
395
+ function Ft(n) {
390
396
  const t = n.layouts ?? {};
391
397
  if (Array.isArray(t.lg)) return t.lg;
392
398
  if (Array.isArray(n.layout)) return n.layout;
393
- for (const i of Q) {
399
+ for (const i of tt) {
394
400
  const o = t[i];
395
- if (Array.isArray(o)) return Dt(o, v.columns[i]);
401
+ if (Array.isArray(o)) return Nt(o, k.columns[i]);
396
402
  }
397
403
  return [];
398
404
  }
399
- function et(n, t) {
405
+ function rt(n, t) {
400
406
  var i;
401
407
  return (i = n.layouts) == null ? void 0 : i[t];
402
408
  }
403
- function pt(n, t, i, o) {
409
+ function xt(n, t, i, o) {
404
410
  let e = g(j(n, o));
405
411
  for (const r of t)
406
- n.has(r.i) || (e = lt(e, r, v.columns[i]));
407
- return g(Z(e, o));
412
+ n.has(r.i) || (e = ht(e, r, k.columns[i]));
413
+ return g(J(e, o));
408
414
  }
409
- function Z(n, t) {
415
+ function J(n, t) {
410
416
  return n.slice().sort((i, o) => (t.frameOrder.get(i.i) ?? 0) - (t.frameOrder.get(o.i) ?? 0));
411
417
  }
412
- const Ft = ["i", "x", "y", "w", "h", "minW", "minH", "maxW", "maxH", "static", "isResizable", "isDraggable"];
413
- function xt(n, t) {
418
+ const jt = ["i", "x", "y", "w", "h", "minW", "minH", "maxW", "maxH", "static", "isResizable", "isDraggable"];
419
+ function yt(n, t) {
414
420
  return !Array.isArray(n) || n.length !== t.length ? !1 : t.every((i, o) => {
415
421
  const e = n[o];
416
- return !!e && Ft.every((r) => e[r] === i[r]);
422
+ return !!e && jt.every((r) => e[r] === i[r]);
417
423
  });
418
424
  }
419
- function jt(n, t) {
425
+ function Pt(n, t) {
420
426
  const i = new Map(t.map((o) => [o.i, o]));
421
427
  return n.length === t.length && n.every((o) => {
422
428
  const e = i.get(o.i);
423
429
  return !!e && e.x === o.x && e.y === o.y && e.w === o.w && e.h === o.h;
424
430
  });
425
431
  }
426
- function Pt(n, t) {
427
- return v.breakpoints.every((i) => xt(n[i], t[i]));
432
+ function Gt(n, t) {
433
+ return k.breakpoints.every((i) => yt(n[i], t[i]));
428
434
  }
429
- function Gt(n) {
430
- return v.customizable.filter((t) => n.includes(t));
435
+ function Kt(n) {
436
+ return k.customizable.filter((t) => n.includes(t));
431
437
  }
432
- function yt(n, t, i) {
438
+ function wt(n, t, i) {
433
439
  const o = { lg: n };
434
- for (const e of Q)
435
- o[e] = i[e] ?? dt(e, n, t.kinds, t.frameOrder);
440
+ for (const e of tt)
441
+ o[e] = i[e] ?? ut(e, n, t.kinds, t.frameOrder);
436
442
  return o;
437
443
  }
438
- function Kt(n, t) {
444
+ function Yt(n, t) {
439
445
  return F(A(n, t.frameOrder)).map((i) => ({
440
- tiles: i.map((o) => ({ frameId: o.i, kind: t.kinds.get(o.i) ?? "chart", width: It(o.w) }))
446
+ tiles: i.map((o) => ({ frameId: o.i, kind: t.kinds.get(o.i) ?? "chart", width: Ot(o.w) }))
441
447
  }));
442
448
  }
443
- function Yt(n) {
444
- const t = L(n.frames ?? ht), i = V($(Nt(n), b, t), t), o = Array.isArray(n.customizedBreakpoints), e = {}, r = [];
445
- for (const f of Q) {
446
- const y = v.columns[f], x = $(et(n, f), y, t), d = Rt(x, t) && t.ids.length > 0;
447
- if (J(f)) {
449
+ function Xt(n) {
450
+ const t = T(n.frames ?? pt), i = Z(R(Ft(n), b, t), t), o = Array.isArray(n.customizedBreakpoints), e = {}, r = [];
451
+ for (const f of tt) {
452
+ const y = k.columns[f], x = R(rt(n, f), y, t), c = Dt(x, t) && t.ids.length > 0;
453
+ if (Q(f)) {
448
454
  if (o && n.customizedBreakpoints.includes(f)) {
449
- e[f] = pt(x, i, f, t), r.push(f);
455
+ e[f] = xt(x, i, f, t), r.push(f);
450
456
  continue;
451
457
  }
452
- if (!o && d) {
453
- const p = g(j(x, t));
454
- jt(p, dt(f, i, t.kinds, t.frameOrder)) || (e[f] = p, r.push(f));
458
+ if (!o && c) {
459
+ const h = g(j(x, t));
460
+ Pt(h, ut(f, i, t.kinds, t.frameOrder)) || (e[f] = h, r.push(f));
455
461
  }
456
462
  continue;
457
463
  }
458
- !o && d && (e[f] = g(j(x, t)));
464
+ !o && c && (e[f] = g(j(x, t)));
459
465
  }
460
- const s = yt(i, t, e), a = v.breakpoints.some((f) => !xt(et(n, f), s[f]));
461
- return { layouts: s, customizedBreakpoints: r, rows: Kt(i, t), repaired: a };
466
+ const s = wt(i, t, e), a = k.breakpoints.some((f) => !yt(rt(n, f), s[f]));
467
+ return { layouts: s, customizedBreakpoints: r, rows: Yt(i, t), repaired: a };
462
468
  }
463
469
  function I(n) {
464
470
  return { ok: !1, failure: n };
465
471
  }
466
- function rt(n, t, i) {
467
- const o = R[i];
472
+ function st(n, t, i) {
473
+ const o = E[i];
468
474
  return n.map((e) => e.i === t ? { ...e, h: o.h, minH: o.minH, minW: Math.min(o.minW, e.w) } : e);
469
475
  }
470
- function Xt(n, t) {
471
- const i = Yt(n), o = n.frames ?? ht;
476
+ function Ut(n, t) {
477
+ const i = Xt(n), o = n.frames ?? pt;
472
478
  let e = o, r = i.layouts.lg, s = i.customizedBreakpoints.slice();
473
479
  const a = {};
474
- for (const d of s) a[d] = i.layouts[d];
480
+ for (const c of s) a[c] = i.layouts[c];
475
481
  switch (t.kind) {
476
482
  case "frame_added": {
477
- const { frame: d, placement: u } = t;
478
- if (o.some((l) => l.id === d.id))
479
- return I({ code: "frame_already_on_sheet", frameId: d.id, message: `A frame with id ${d.id} is already on this sheet.` });
480
- const p = u == null ? void 0 : u.position, c = typeof p == "object" ? "after" in p ? p.after : p.beside : void 0;
481
- if (c !== void 0 && !o.some((l) => l.id === c))
482
- return I({ code: "position_target_not_found", frameId: c, message: `No frame ${c} on this sheet to place the new frame next to.` });
483
- if (p === "top") e = [d, ...o];
484
- else if (c !== void 0) {
485
- const l = o.findIndex((M) => M.id === c);
486
- e = [...o.slice(0, l + 1), d, ...o.slice(l + 1)];
487
- } else e = [...o, d];
488
- const m = L(e);
489
- r = $t(r, d.id, m.kinds.get(d.id), u, m);
490
- const h = r.find((l) => l.i === d.id);
483
+ const { frame: c, placement: u } = t;
484
+ if (o.some((l) => l.id === c.id))
485
+ return I({ code: "frame_already_on_sheet", frameId: c.id, message: `A frame with id ${c.id} is already on this sheet.` });
486
+ const h = u == null ? void 0 : u.position, d = typeof h == "object" ? "after" in h ? h.after : h.beside : void 0;
487
+ if (d !== void 0 && !o.some((l) => l.id === d))
488
+ return I({ code: "position_target_not_found", frameId: d, message: `No frame ${d} on this sheet to place the new frame next to.` });
489
+ if (h === "top") e = [c, ...o];
490
+ else if (d !== void 0) {
491
+ const l = o.findIndex((M) => M.id === d);
492
+ e = [...o.slice(0, l + 1), c, ...o.slice(l + 1)];
493
+ } else e = [...o, c];
494
+ const m = T(e);
495
+ r = Rt(r, c.id, m.kinds.get(c.id), u, m);
496
+ const p = r.find((l) => l.i === c.id);
491
497
  for (const l of s) {
492
- const M = v.columns[l], z = a[l], E = typeof p == "object" && "beside" in p ? mt(z, p.beside, d.id, M) : lt(z, h, M);
493
- a[l] = g(Z(E, m));
498
+ const M = k.columns[l], z = a[l], S = typeof h == "object" && "beside" in h ? lt(z, h.beside, c.id, M) : ht(z, p, M);
499
+ a[l] = g(J(S, m));
494
500
  }
495
501
  break;
496
502
  }
497
503
  case "frame_removed": {
498
- if (!o.some((d) => d.id === t.frameId))
504
+ if (!o.some((c) => c.id === t.frameId))
499
505
  return I({ code: "frame_not_on_sheet", frameId: t.frameId, message: `No frame ${t.frameId} on this sheet.` });
500
- e = o.filter((d) => d.id !== t.frameId), r = g(r.filter((d) => d.i !== t.frameId));
501
- for (const d of s)
502
- a[d] = g(a[d].filter((u) => u.i !== t.frameId));
506
+ e = o.filter((c) => c.id !== t.frameId), r = g(r.filter((c) => c.i !== t.frameId));
507
+ for (const c of s)
508
+ a[c] = g(a[c].filter((u) => u.i !== t.frameId));
503
509
  break;
504
510
  }
505
511
  case "frame_updated": {
506
- const d = o.findIndex((c) => c.id === t.frame.id);
507
- if (d < 0)
512
+ const c = o.findIndex((d) => d.id === t.frame.id);
513
+ if (c < 0)
508
514
  return I({ code: "frame_not_on_sheet", frameId: t.frame.id, message: `No frame ${t.frame.id} on this sheet.` });
509
- e = o.map((c, m) => m === d ? t.frame : c);
510
- const u = U(o[d]), p = U(t.frame);
511
- if (u === p)
515
+ e = o.map((d, m) => m === c ? t.frame : d);
516
+ const u = U(o[c]), h = U(t.frame);
517
+ if (u === h)
512
518
  return {
513
519
  ok: !0,
514
520
  frames: e,
@@ -517,50 +523,54 @@ function Xt(n, t) {
517
523
  changed: !0,
518
524
  layoutsChanged: !1
519
525
  };
520
- if (t.resizeForNewKind && nt(u) !== nt(p)) {
521
- r = g(rt(r, t.frame.id, p));
522
- for (const c of s)
523
- a[c] = g(rt(a[c], t.frame.id, p));
526
+ if (t.resizeForNewKind && it(u) !== it(h)) {
527
+ r = g(st(r, t.frame.id, h));
528
+ for (const d of s)
529
+ a[d] = g(st(a[d], t.frame.id, h));
524
530
  }
525
531
  break;
526
532
  }
527
533
  case "grid_edited": {
528
- if (!kt(t.breakpoint))
534
+ if (!vt(t.breakpoint))
529
535
  return I({ code: "breakpoint_not_editable", breakpoint: String(t.breakpoint), message: `The ${String(t.breakpoint)} layout is derived; edit Desktop, Tablet or Phone.` });
530
- const d = L(o);
536
+ const c = T(o);
531
537
  if (t.breakpoint === "md") {
532
- const u = [...$(t.items, v.columns.md, d).values()];
533
- r = V(new Map(Tt(r, u).map((p) => [p.i, p])), d);
538
+ const u = [...R(t.items, k.columns.md, c).values()];
539
+ r = Z(new Map(Ct(r, u).map((h) => [h.i, h])), c);
534
540
  } else if (t.breakpoint === "lg")
535
- r = V($(t.items, b, d), d);
541
+ r = Z(R(t.items, b, c), c);
536
542
  else {
537
543
  const u = t.breakpoint;
538
- a[u] = pt($(t.items, v.columns[u], d), r, u, d), s.includes(u) || (s = Gt([...s, u]));
544
+ a[u] = xt(R(t.items, k.columns[u], c), r, u, c), s.includes(u) || (s = Kt([...s, u]));
539
545
  }
540
546
  break;
541
547
  }
542
548
  case "reset_to_automatic": {
543
- if (!J(t.breakpoint))
549
+ if (!Q(t.breakpoint))
544
550
  return I({ code: "breakpoint_not_editable", breakpoint: String(t.breakpoint), message: "Only Tablet and Phone can go back to automatic." });
545
- s = s.filter((d) => d !== t.breakpoint), delete a[t.breakpoint];
551
+ s = s.filter((c) => c !== t.breakpoint), delete a[t.breakpoint];
546
552
  break;
547
553
  }
548
554
  case "arrange": {
549
- const d = L(o), u = Lt(r, d.kinds, d.frameOrder, t.keepOrder === !0), p = new Map(o.map((c) => [c.id, c]));
550
- e = u.order.map((c) => p.get(c)), e.every((c, m) => c === o[m]) && (e = o), r = u.items, s = [];
551
- for (const c of v.customizable) delete a[c];
555
+ const c = T(o), u = Tt(r, c.kinds, c.frameOrder, t.keepOrder === !0), h = new Map(o.map((d) => [d.id, d]));
556
+ e = u.order.map((d) => h.get(d)), e.every((d, m) => d === o[m]) && (e = o), r = u.items, s = [];
557
+ for (const d of k.customizable) delete a[d];
552
558
  break;
553
559
  }
554
560
  }
555
- const f = L(e);
556
- r = Z(r, f);
557
- const y = yt(r, f, a), x = !Pt(y, i.layouts) || s.join() !== i.customizedBreakpoints.join();
561
+ const f = T(e);
562
+ r = J(r, f).map((c) => V(c, f));
563
+ for (const c of k.customizable) {
564
+ const u = a[c];
565
+ u && (a[c] = u.map((h) => V(h, f)));
566
+ }
567
+ const y = wt(r, f, a), x = !Gt(y, i.layouts) || s.join() !== i.customizedBreakpoints.join();
558
568
  return { ok: !0, frames: e, layouts: y, customizedBreakpoints: s, changed: e !== o || x, layoutsChanged: x };
559
569
  }
560
- function Ut(n, t) {
570
+ function qt(n, t) {
561
571
  const i = [...t].sort().join("\0");
562
- for (const o of v.breakpoints) {
563
- const e = n[o], r = v.columns[o];
572
+ for (const o of k.breakpoints) {
573
+ const e = n[o], r = k.columns[o];
564
574
  if (!Array.isArray(e)) throw new Error(`Layout ${o} is missing.`);
565
575
  if (e.map((s) => s.i).sort().join("\0") !== i) throw new Error(`Layout ${o} doesn't hold exactly the sheet's frames.`);
566
576
  for (const s of e) {
@@ -572,14 +582,14 @@ function Ut(n, t) {
572
582
  if (s.maxW !== void 0 && s.maxW < s.w) throw new Error(`Layout ${o}: ${s.i} maxW below w.`);
573
583
  if (s.maxH !== void 0 && s.maxH < s.h) throw new Error(`Layout ${o}: ${s.i} maxH below h.`);
574
584
  }
575
- if (St(e)) throw new Error(`Layout ${o} has overlapping items.`);
576
- if (!Et(e)) throw new Error(`Layout ${o} isn't packed.`);
585
+ if (Bt(e)) throw new Error(`Layout ${o} has overlapping items.`);
586
+ if (!St(e)) throw new Error(`Layout ${o} isn't packed.`);
577
587
  }
578
588
  }
579
589
  export {
580
- v as D,
581
- Xt as a,
582
- Ut as b,
590
+ k as D,
591
+ Ut as a,
592
+ qt as b,
583
593
  _t as i,
584
- Yt as r
594
+ Xt as r
585
595
  };